@scalar/cli 2.1.0 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +28 -24
  2. package/chunks/action-42D2C47G.js +18 -0
  3. package/chunks/{action-DFKHSDFV.js → action-6FAJNP6C.js} +7 -3
  4. package/chunks/{action-5R5FDF6S.js → action-6MZZHPVQ.js} +120 -22
  5. package/chunks/{action-BYZUBXVB.js → action-7H3XARJP.js} +8 -4
  6. package/chunks/{action-H5OHT2GV.js → action-AMNYOA4B.js} +7 -3
  7. package/chunks/{action-ANU5HGC4.js → action-DCINFQ57.js} +17 -14
  8. package/chunks/{action-GB6DM53B.js → action-DGD6Q6Y5.js} +21 -10
  9. package/chunks/{action-TPBKPHNS.js → action-EPNE5XCM.js} +22 -22
  10. package/chunks/{action-C5VB4ITT.js → action-FF2OMGAS.js} +36 -18
  11. package/chunks/{action-Q5UJ32D6.js → action-H3RTILLM.js} +1 -1
  12. package/chunks/action-HIL5ZFNB.js +84 -0
  13. package/chunks/{action-MENXFJH3.js → action-HXHBU7XC.js} +9 -9
  14. package/chunks/{action-F4Y6Q2VB.js → action-LFL3ZZKN.js} +21 -21
  15. package/chunks/action-LUVBQEIQ.js +250 -0
  16. package/chunks/{action-TZ5KGAQT.js → action-OILGZAMK.js} +17 -14
  17. package/chunks/{action-HD2T6BFJ.js → action-OK55BFGM.js} +10 -10
  18. package/chunks/{action-HNKM3Q65.js → action-P7RFXIC7.js} +17 -14
  19. package/chunks/action-PAA4NWUJ.js +374 -0
  20. package/chunks/action-PHLOE27S.js +522 -0
  21. package/chunks/{action-CYP4VDK3.js → action-RBVPKCRI.js} +12 -35
  22. package/chunks/action-SJYAMXYI.js +244 -0
  23. package/chunks/{action-45OGQB2M.js → action-TWHLZW4V.js} +17 -8
  24. package/chunks/{action-GEBRPNRT.js → action-V5KYG7XD.js} +15 -16
  25. package/chunks/{action-BNEGJBUH.js → action-W62AIEBN.js} +8 -9
  26. package/chunks/{action-PVDDRIM6.js → action-X7TZA3RE.js} +65 -26
  27. package/chunks/{action-CLSD7O2R.js → action-XUQ7TKKJ.js} +10 -10
  28. package/chunks/{action-BMFXENMX.js → action-Y6CEKYEK.js} +39 -34
  29. package/chunks/{action-STIEAXOE.js → action-YRWHX2AE.js} +16 -5
  30. package/chunks/{action-W5BATF4Q.js → action-ZLTUMRO2.js} +24 -24
  31. package/chunks/{action-UDZUUJSI.js → action-ZWQLQENM.js} +18 -7
  32. package/chunks/{agent-XGLOHXNA.js → agent-JAXLLDPE.js} +25 -5
  33. package/chunks/asyncapi-P6Y3L7RG.js +105 -0
  34. package/chunks/{build.action-LKOILPA6.js → build.action-AZ5ECU4B.js} +22 -22
  35. package/chunks/chunk-3BWGTPPT.js +27022 -0
  36. package/chunks/{chunk-ZTVWAKNJ.js → chunk-3DJ2GKEG.js} +1 -1
  37. package/chunks/chunk-3ZJYGGAA.js +30 -0
  38. package/chunks/{chunk-IX7LJ3AD.js → chunk-4ORL4MST.js} +2 -3
  39. package/chunks/{chunk-ASMHW5AY.js → chunk-6ZMT63IV.js} +1 -1
  40. package/chunks/{chunk-B6QZJWCQ.js → chunk-B2MHTD3R.js} +4 -6
  41. package/chunks/{chunk-P646T2WH.js → chunk-CIFOFSZ3.js} +131 -13
  42. package/chunks/chunk-CX7ZRMTC.js +404 -0
  43. package/chunks/{chunk-HQKBZOYU.js → chunk-FOKFF4EP.js} +3 -3
  44. package/chunks/{chunk-UPUTMFD4.js → chunk-FQVVKQPU.js} +185 -13
  45. package/chunks/{chunk-P2VH7DOC.js → chunk-HUCR333E.js} +6 -6
  46. package/chunks/{chunk-KWOL7A6J.js → chunk-HXIDUCSZ.js} +2 -2
  47. package/chunks/{chunk-H2WRMLYY.js → chunk-IKT5F47M.js} +3571 -7
  48. package/chunks/{chunk-OAXFCOJV.js → chunk-JV7TUEXQ.js} +2 -1
  49. package/chunks/{chunk-2BSG2QHO.js → chunk-KEOCJ3NJ.js} +133 -20
  50. package/chunks/{chunk-AHWWJ3MD.js → chunk-LCPFHE4Z.js} +1 -1
  51. package/chunks/{chunk-TLFMATXR.js → chunk-LQN4S62O.js} +33 -25
  52. package/chunks/chunk-M622VXRQ.js +14 -0
  53. package/chunks/chunk-M6Q3ARBV.js +210 -0
  54. package/chunks/{chunk-4QS7SJTG.js → chunk-MNLXYOVF.js} +51 -36
  55. package/chunks/{chunk-5BISXQX4.js → chunk-NIXG4KDE.js} +11 -13
  56. package/chunks/{chunk-47Y4L5IT.js → chunk-NNMSZVAB.js} +1031 -481
  57. package/chunks/chunk-OQKDBLOZ.js +741 -0
  58. package/chunks/{chunk-NUXPNUSS.js → chunk-RAO7VUGM.js} +1 -1
  59. package/chunks/{chunk-SHSHFGA7.js → chunk-RPVHJMQT.js} +4 -6
  60. package/chunks/{chunk-23I5PKZZ.js → chunk-SWWWYWHC.js} +32 -5
  61. package/chunks/{chunk-X4QLDBB5.js → chunk-T5HJUAWB.js} +24 -3
  62. package/chunks/chunk-TYLWJ2UL.js +25 -0
  63. package/chunks/{chunk-SXYALPYK.js → chunk-UB3XGOUW.js} +498 -60
  64. package/chunks/{chunk-TQ5XC2E3.js → chunk-UMPODUJO.js} +77 -11
  65. package/chunks/{chunk-4DGQIAJX.js → chunk-VNYE4R7N.js} +154 -14
  66. package/chunks/{create.action-FFQLBSJH.js → create.action-34OTO2SB.js} +22 -22
  67. package/chunks/{delete.action-QNN3LC2F.js → delete.action-6LRT4M3S.js} +22 -22
  68. package/chunks/{delete.action-STHQHP4F.js → delete.action-ZYXFMIOW.js} +22 -22
  69. package/chunks/{get.action-OTKYOP3Z.js → get.action-XP36SA2J.js} +15 -16
  70. package/chunks/{list.action-KDM5RHEH.js → list.action-6LF6KSD5.js} +19 -19
  71. package/chunks/{list.action-6I5EZAVB.js → list.action-WVRVLX5E.js} +22 -22
  72. package/chunks/{publish.action-PODTVRXS.js → publish.action-AHFUBT5C.js} +44 -36
  73. package/chunks/{update.action-KMD4ZM75.js → update.action-YQTVUDYE.js} +22 -22
  74. package/chunks/{update.action-4F6STTEQ.js → update.action-ZREAFJVG.js} +22 -22
  75. package/docs.html +107 -104
  76. package/index.js +84 -68
  77. package/package.json +19 -15
  78. package/chunks/action-CCW66QJN.js +0 -72
  79. package/chunks/action-CQ56FVES.js +0 -65
  80. package/chunks/action-JOSVV6YA.js +0 -71
  81. package/chunks/action-P7LN6FGY.js +0 -13
  82. package/chunks/action-R6ZZO26F.js +0 -299
  83. package/chunks/action-TWFJNQ2R.js +0 -95
  84. package/chunks/chunk-5BPPGTUU.js +0 -463
  85. package/chunks/chunk-DOVIWNKQ.js +0 -108
  86. package/chunks/chunk-ISGLWBXZ.js +0 -4265
  87. package/chunks/chunk-T7MDADON.js +0 -17
  88. package/chunks/chunk-VTYTPSXO.js +0 -161
package/README.md CHANGED
@@ -171,18 +171,18 @@ Options:
171
171
 
172
172
  Commands:
173
173
  bundle [options] [file|url] Bundle an OpenAPI document by resolving all references and external dependencies
174
- split [options] [file|url] Split your OpenAPI documents on small chunks
175
- join [options] <files...> Merge multiple OpenAPI documents into a single unified document
176
- format [options] [file|url] Format an OpenAPI file
174
+ split [options] [file|url] Split OpenAPI or AsyncAPI documents into small chunks
175
+ join [options] <files...> Merge multiple OpenAPI or AsyncAPI documents into a single unified document
176
+ format [options] [file|url] Format an OpenAPI or AsyncAPI file
177
177
  convert [options] [file|url] Convert a Postman collection to an OpenAPI document
178
178
  markdown [options] [file|url] Generate Markdown from an OpenAPI file
179
- mock [options] [file|url] Mock an API from an OpenAPI file
180
- serve [options] [file|url] Serve an API Reference from an OpenAPI file
181
- share [options] [file] Share an OpenAPI file
182
- validate [file|url] Validate an OpenAPI file
179
+ mock [options] [file|url] Mock an OpenAPI API or AsyncAPI WebSocket and SSE channels
180
+ serve [options] [file|url] Serve an API Reference from an OpenAPI or AsyncAPI file
181
+ share [options] [file] Share an OpenAPI or AsyncAPI file
182
+ validate [file|url] Validate an OpenAPI or AsyncAPI file
183
183
  void [options] Boot a server to mirror HTTP requests
184
- lint [options] [file|url] Lint your OpenAPI file using spectral rules
185
- upgrade [options] [file|url] Upgrade OpenAPI document to version 3.1
184
+ lint [options] [file|url] Lint your OpenAPI or AsyncAPI file using spectral rules
185
+ upgrade [options] [file|url] Upgrade an OpenAPI or AsyncAPI document to version 3.1
186
186
  help [command] display help for command
187
187
  ```
188
188
 
@@ -204,13 +204,16 @@ Options:
204
204
  ```
205
205
 
206
206
  #### split
207
+
208
+ Splits AsyncAPI channels, operations, messages, and reusable components (including payload schemas) into JSON chunks. AsyncAPI versions are preserved, including 2.6, 3.0, and 3.1; splitting does not upgrade the document or add Scalar navigation metadata. Use `scalar document upgrade` separately to normalize versions. Nested external references are bundled relative to their source files or URLs, and chunk references resolve relative to the generated files. Both relative and absolute output directories are supported. The entry point is `out.json`.
209
+
207
210
  ```
208
211
  Usage: scalar document split [options] [file|url]
209
212
 
210
- Split your OpenAPI documents on small chunks
213
+ Split OpenAPI or AsyncAPI documents into small chunks
211
214
 
212
215
  Arguments:
213
- file|url Path to OpenAPI file or URL to split
216
+ file|url Path to OpenAPI or AsyncAPI file or URL to split
214
217
 
215
218
  Options:
216
219
  -o, --output <path> Path to save the chunks
@@ -221,10 +224,10 @@ Options:
221
224
  ```
222
225
  Usage: scalar document join [options] <files...>
223
226
 
224
- Merge multiple OpenAPI documents into a single unified document
227
+ Merge multiple OpenAPI or AsyncAPI documents into a single unified document
225
228
 
226
229
  Arguments:
227
- files Paths to the OpenAPI files to merge
230
+ files Paths to the OpenAPI or AsyncAPI files to merge
228
231
 
229
232
  Options:
230
233
  --output -o <file> Path to save the merged output file
@@ -236,7 +239,7 @@ Options:
236
239
  ```
237
240
  Usage: scalar document format [options] [file|url]
238
241
 
239
- Format an OpenAPI file
242
+ Format an OpenAPI or AsyncAPI file
240
243
 
241
244
  Arguments:
242
245
  file|url File or URL to format
@@ -279,10 +282,10 @@ Options:
279
282
  ```
280
283
  Usage: scalar document mock [options] [file|url]
281
284
 
282
- Mock an API from an OpenAPI file
285
+ Mock an OpenAPI API or AsyncAPI WebSocket and SSE channels
283
286
 
284
287
  Arguments:
285
- file|url OpenAPI file or URL to mock the server for
288
+ file|url OpenAPI or AsyncAPI file or URL to mock
286
289
 
287
290
  Options:
288
291
  -w, --watch watch the file for changes
@@ -295,10 +298,10 @@ Options:
295
298
  ```
296
299
  Usage: scalar document serve [options] [file|url]
297
300
 
298
- Serve an API Reference from an OpenAPI file
301
+ Serve an API Reference from an OpenAPI or AsyncAPI file
299
302
 
300
303
  Arguments:
301
- file|url OpenAPI file or URL to show the reference for
304
+ file|url OpenAPI or AsyncAPI file or URL to show the reference for
302
305
 
303
306
  Options:
304
307
  -w, --watch watch the file for changes
@@ -311,7 +314,7 @@ Options:
311
314
  ```
312
315
  Usage: scalar document share [options] [file]
313
316
 
314
- Share an OpenAPI file
317
+ Share an OpenAPI or AsyncAPI file
315
318
 
316
319
  Arguments:
317
320
  file file to share
@@ -325,7 +328,7 @@ Options:
325
328
  ```
326
329
  Usage: scalar document validate [options] [file|url]
327
330
 
328
- Validate an OpenAPI file
331
+ Validate an OpenAPI or AsyncAPI file
329
332
 
330
333
  Arguments:
331
334
  file|url File or URL to validate
@@ -350,10 +353,10 @@ Options:
350
353
  ```
351
354
  Usage: scalar document lint [options] [file|url]
352
355
 
353
- Lint your OpenAPI file using spectral rules
356
+ Lint your OpenAPI or AsyncAPI file using spectral rules
354
357
 
355
358
  Arguments:
356
- file|url OpenAPI file path or url
359
+ file|url OpenAPI or AsyncAPI file path or url
357
360
 
358
361
  Options:
359
362
  -r, --rule <file|url> Rule path or url
@@ -364,10 +367,10 @@ Options:
364
367
  ```
365
368
  Usage: scalar document upgrade [options] [file|url]
366
369
 
367
- Upgrade OpenAPI document to version 3.1
370
+ Upgrade an OpenAPI or AsyncAPI document to version 3.1
368
371
 
369
372
  Arguments:
370
- file|url File or URL to validate
373
+ file|url File or URL to upgrade
371
374
 
372
375
  Options:
373
376
  -o, --output <file> Path to save the upgraded output file
@@ -819,6 +822,7 @@ Options:
819
822
  --namespace <namespace> Scalar team namespace
820
823
  --version <version> API version (e.g. 0.1.0)
821
824
  --private Make API private (default: false)
825
+ --force Force override an existing version (default: false)
822
826
  --bundle Bundle all external references before uploading
823
827
  --treeShake Remove unused components from the bundled document
824
828
  --urlMap Generate a map of resolved URLs when bundling the document
@@ -0,0 +1,18 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ IsolateDownloadError,
4
+ downloadIsolate,
5
+ isDiskWriteError,
6
+ updateIsolate
7
+ } from "./chunk-UMPODUJO.js";
8
+ import "./chunk-3ZJYGGAA.js";
9
+ import "./chunk-HXIDUCSZ.js";
10
+ import "./chunk-JV7TUEXQ.js";
11
+ import "./chunk-T5HJUAWB.js";
12
+ import "./chunk-3MZYUBJ6.js";
13
+ export {
14
+ IsolateDownloadError,
15
+ downloadIsolate,
16
+ isDiskWriteError,
17
+ updateIsolate
18
+ };
@@ -1,11 +1,15 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  getFileOrUrl
4
- } from "./chunk-23I5PKZZ.js";
5
- import "./chunk-IX7LJ3AD.js";
4
+ } from "./chunk-SWWWYWHC.js";
5
+ import "./chunk-MNLXYOVF.js";
6
+ import "./chunk-CX7ZRMTC.js";
7
+ import "./chunk-4ORL4MST.js";
6
8
  import {
7
9
  output
8
- } from "./chunk-X4QLDBB5.js";
10
+ } from "./chunk-T5HJUAWB.js";
11
+ import "./chunk-LQN4S62O.js";
12
+ import "./chunk-IKT5F47M.js";
9
13
  import "./chunk-3MZYUBJ6.js";
10
14
 
11
15
  // src/domains/document/markdown/action.ts
@@ -6,19 +6,34 @@ import {
6
6
  findConfig,
7
7
  getCurrentFolderName,
8
8
  scalarConfigSchema
9
- } from "./chunk-47Y4L5IT.js";
10
- import "./chunk-5BPPGTUU.js";
11
- import "./chunk-4QS7SJTG.js";
12
- import "./chunk-VTYTPSXO.js";
13
- import "./chunk-TLFMATXR.js";
9
+ } from "./chunk-NNMSZVAB.js";
14
10
  import {
15
- slugify
16
- } from "./chunk-ISGLWBXZ.js";
17
- import "./chunk-H2WRMLYY.js";
11
+ apiService
12
+ } from "./chunk-UB3XGOUW.js";
13
+ import "./chunk-FQVVKQPU.js";
14
+ import "./chunk-B2MHTD3R.js";
15
+ import "./chunk-3BWGTPPT.js";
16
+ import "./chunk-M622VXRQ.js";
17
+ import "./chunk-CIFOFSZ3.js";
18
+ import {
19
+ getMetadata
20
+ } from "./chunk-NIXG4KDE.js";
21
+ import {
22
+ config
23
+ } from "./chunk-JV7TUEXQ.js";
24
+ import "./chunk-VNYE4R7N.js";
25
+ import "./chunk-OQKDBLOZ.js";
18
26
  import "./chunk-K74E42RV.js";
27
+ import "./chunk-MNLXYOVF.js";
28
+ import "./chunk-CX7ZRMTC.js";
29
+ import "./chunk-4ORL4MST.js";
19
30
  import {
20
31
  output
21
- } from "./chunk-X4QLDBB5.js";
32
+ } from "./chunk-T5HJUAWB.js";
33
+ import "./chunk-LQN4S62O.js";
34
+ import {
35
+ slugify
36
+ } from "./chunk-IKT5F47M.js";
22
37
  import "./chunk-3MZYUBJ6.js";
23
38
 
24
39
  // src/domains/project/init/action.ts
@@ -27,13 +42,13 @@ import path from "node:path";
27
42
  import { cancel, confirm, isCancel, text } from "@clack/prompts";
28
43
  import as from "ansis";
29
44
 
30
- // ../../node_modules/.pnpm/@scalar+galaxy@0.6.12/node_modules/@scalar/galaxy/dist/3.1.json
45
+ // ../../node_modules/.pnpm/@scalar+galaxy@0.7.1/node_modules/@scalar/galaxy/dist/3.1.json
31
46
  var __default = {
32
47
  openapi: "3.1.1",
33
48
  info: {
34
49
  title: "Scalar Galaxy",
35
50
  description: "The Scalar Galaxy is an example OpenAPI document to test OpenAPI tools and libraries. It's a fictional universe with fictional planets and fictional data.\n\n## Resources\n\n* https://github.com/scalar/scalar\n* https://github.com/OAI/OpenAPI-Specification\n* https://scalar.com\n\n## Markdown Support\n\nAll descriptions *can* contain ~~tons of text~~ **Markdown**. [If GitHub supports the syntax](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax), chances are we're supporting it, too.\n\n<details>\n <summary>Examples</summary>\n\n **Blockquotes**\n\n > I love OpenAPI. <3\n\n **Tables**\n\n | Feature | Availability |\n | ---------------- | ------------ |\n | Markdown Support | \u2713 |\n\n **Accordion**\n\n ```html\n <details>\n <summary>Using Details Tags</summary>\n <p>HTML Example</p>\n </details>\n ```\n\n **Images**\n\n Yes, there's support for images, too!\n\n ![Empty placeholder image showing the width/height](https://images.placeholders.dev/?width=1280&height=720)\n\n **Alerts**\n\n > [!tip]\n > You can use Markdown alerts in your descriptions.\n\n</details>\n",
36
- version: "0.6.12",
51
+ version: "0.7.1",
37
52
  contact: {
38
53
  name: "Scalar Support",
39
54
  url: "https://scalar.com",
@@ -184,6 +199,23 @@ var __default = {
184
199
  $ref: "#/components/schemas/PaginatedResource"
185
200
  }
186
201
  }
202
+ },
203
+ links: {
204
+ GetFirstPlanet: {
205
+ operationId: "getPlanet",
206
+ description: "Retrieve the first planet when the response contains at least one planet.",
207
+ parameters: {
208
+ "path.planetId": "$response.body#/data/0/id"
209
+ }
210
+ },
211
+ FirstPage: {
212
+ operationId: "getAllData",
213
+ description: "Return to the first page using the requested page size.",
214
+ parameters: {
215
+ "query.limit": "$request.query.limit",
216
+ "query.offset": "0"
217
+ }
218
+ }
187
219
  }
188
220
  }
189
221
  },
@@ -307,6 +339,19 @@ var __default = {
307
339
  $ref: "#/components/schemas/Planet"
308
340
  }
309
341
  }
342
+ },
343
+ links: {
344
+ GetPlanet: {
345
+ $ref: "#/components/links/GetPlanet"
346
+ },
347
+ UpdatePlanet: {
348
+ operationRef: "#/paths/~1planets~1%7BplanetId%7D/put",
349
+ description: "Update the created planet using its ID and response body.",
350
+ parameters: {
351
+ planetId: "$response.body#/id"
352
+ },
353
+ requestBody: "$response.body"
354
+ }
310
355
  }
311
356
  },
312
357
  "400": {
@@ -361,6 +406,15 @@ var __default = {
361
406
  $ref: "#/components/schemas/Planet"
362
407
  }
363
408
  }
409
+ },
410
+ links: {
411
+ DeletePlanet: {
412
+ operationId: "deletePlanet",
413
+ description: "Delete this planet using the ID from the request path.",
414
+ parameters: {
415
+ planetId: "$request.path.planetId"
416
+ }
417
+ }
364
418
  }
365
419
  },
366
420
  "404": {
@@ -410,6 +464,11 @@ var __default = {
410
464
  $ref: "#/components/schemas/Planet"
411
465
  }
412
466
  }
467
+ },
468
+ links: {
469
+ GetPlanet: {
470
+ $ref: "#/components/links/GetPlanet"
471
+ }
413
472
  }
414
473
  },
415
474
  "400": {
@@ -832,6 +891,15 @@ var __default = {
832
891
  }
833
892
  },
834
893
  components: {
894
+ links: {
895
+ GetPlanet: {
896
+ operationId: "getPlanet",
897
+ description: "Retrieve the planet using the ID returned in the response.",
898
+ parameters: {
899
+ planetId: "$response.body#/id"
900
+ }
901
+ }
902
+ },
835
903
  securitySchemes: {
836
904
  bearerAuth: {
837
905
  type: "http",
@@ -1991,7 +2059,6 @@ async function initAction({
1991
2059
  force
1992
2060
  }) {
1993
2061
  const configFile = findConfig() || CONFIG_FILE_DEFAULT;
1994
- let validInput;
1995
2062
  const nextSteps = () => {
1996
2063
  output.info().line("What to do next:").line(
1997
2064
  ` ${as.cyan("scalar project preview")} to preview your project locally`
@@ -2053,26 +2120,57 @@ async function initAction({
2053
2120
  }
2054
2121
  }
2055
2122
  });
2056
- validInput = !!subdomain;
2123
+ const { auth } = await getMetadata();
2124
+ const apiClient = auth ? await apiService({ noExit: true }).catch(() => null) : void 0;
2125
+ if (!apiClient) {
2126
+ output.warn().message(
2127
+ "Subdomain availability was not checked. Run scalar auth login to check availability."
2128
+ ).print();
2129
+ }
2057
2130
  const folderName = getCurrentFolderName();
2058
- while (!validInput) {
2059
- const response = await text({
2131
+ const suppliedSubdomain = typeof subdomain === "string" ? subdomain.trim().toLowerCase() : void 0;
2132
+ if (subdomain !== void 0 && !suppliedSubdomain) {
2133
+ return output.error().message("Provide a name with --subdomain.").exit("error");
2134
+ }
2135
+ while (true) {
2136
+ const response = suppliedSubdomain ?? await text({
2060
2137
  message: "What is the name of your project?",
2061
2138
  defaultValue: folderName,
2062
2139
  placeholder: folderName
2063
2140
  });
2064
2141
  if (isCancel(response)) {
2065
- handleCancel();
2066
- } else {
2067
- validInput = true;
2142
+ return handleCancel();
2068
2143
  }
2069
2144
  const title = response.toString();
2070
- const slug = slugify(title);
2145
+ const slug = suppliedSubdomain ?? slugify(title);
2146
+ const validSubdomain = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(slug);
2147
+ if (!validSubdomain) {
2148
+ const message = "Use a subdomain with 1 to 63 letters, numbers, or hyphens, starting and ending with a letter or number.";
2149
+ if (suppliedSubdomain) {
2150
+ return output.error().message(message).exit("error");
2151
+ }
2152
+ output.error().message(message).print();
2153
+ continue;
2154
+ }
2155
+ if (apiClient) {
2156
+ const result = await apiClient.publish.getDomainAvailability(`${slug}.${config.publishTld}`).catch(() => null);
2157
+ if (!result || result.error) {
2158
+ return output.error().message("Could not check subdomain availability. Please try again.").exit("error");
2159
+ }
2160
+ if (!result.data.available) {
2161
+ const message = `Subdomain "${slug}" is already taken. Choose another name.`;
2162
+ if (suppliedSubdomain) {
2163
+ return output.error().message(message).exit("error");
2164
+ }
2165
+ output.error().message(message).print();
2166
+ continue;
2167
+ }
2168
+ }
2071
2169
  configuration.info = { title, description: `Documentation for ${title}` };
2072
- subdomain = slug;
2073
- output.info().line(`${as.green("\u2714")} Subdomain: ${as.green(subdomain)}`).print();
2170
+ configuration.siteConfig.subdomain = slug;
2171
+ output.info().line(`${as.green("\u2714")} Subdomain: ${as.green(slug)}`).print();
2172
+ break;
2074
2173
  }
2075
- configuration.siteConfig.subdomain = subdomain.trim();
2076
2174
  const content = JSON.stringify(configuration, null, 2);
2077
2175
  await fs.writeFile(configFile, content);
2078
2176
  await fs.writeFile(
@@ -2,20 +2,24 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
  import {
3
3
  measureTime
4
4
  } from "./chunk-KHDYYVYF.js";
5
- import "./chunk-23I5PKZZ.js";
5
+ import "./chunk-SWWWYWHC.js";
6
6
  import {
7
7
  DEFAULT_FETCH_CONCURRENCY
8
- } from "./chunk-AHWWJ3MD.js";
8
+ } from "./chunk-LCPFHE4Z.js";
9
9
  import {
10
10
  require_dist
11
11
  } from "./chunk-K74E42RV.js";
12
+ import "./chunk-MNLXYOVF.js";
13
+ import "./chunk-CX7ZRMTC.js";
12
14
  import {
13
15
  isUrl,
14
16
  isYamlFileName
15
- } from "./chunk-IX7LJ3AD.js";
17
+ } from "./chunk-4ORL4MST.js";
16
18
  import {
17
19
  output
18
- } from "./chunk-X4QLDBB5.js";
20
+ } from "./chunk-T5HJUAWB.js";
21
+ import "./chunk-LQN4S62O.js";
22
+ import "./chunk-IKT5F47M.js";
19
23
  import {
20
24
  __toESM
21
25
  } from "./chunk-3MZYUBJ6.js";
@@ -1,16 +1,20 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  getFileOrUrl
4
- } from "./chunk-23I5PKZZ.js";
4
+ } from "./chunk-SWWWYWHC.js";
5
5
  import {
6
6
  require_dist
7
7
  } from "./chunk-K74E42RV.js";
8
+ import "./chunk-MNLXYOVF.js";
9
+ import "./chunk-CX7ZRMTC.js";
8
10
  import {
9
11
  isYamlFileName
10
- } from "./chunk-IX7LJ3AD.js";
12
+ } from "./chunk-4ORL4MST.js";
11
13
  import {
12
14
  output
13
- } from "./chunk-X4QLDBB5.js";
15
+ } from "./chunk-T5HJUAWB.js";
16
+ import "./chunk-LQN4S62O.js";
17
+ import "./chunk-IKT5F47M.js";
14
18
  import {
15
19
  __toESM
16
20
  } from "./chunk-3MZYUBJ6.js";
@@ -1,22 +1,25 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  apiService
4
- } from "./chunk-SXYALPYK.js";
5
- import "./chunk-UPUTMFD4.js";
6
- import "./chunk-B6QZJWCQ.js";
7
- import "./chunk-P646T2WH.js";
8
- import "./chunk-4QS7SJTG.js";
9
- import "./chunk-VTYTPSXO.js";
10
- import "./chunk-5BISXQX4.js";
11
- import "./chunk-OAXFCOJV.js";
12
- import "./chunk-TLFMATXR.js";
13
- import "./chunk-4DGQIAJX.js";
14
- import "./chunk-ISGLWBXZ.js";
15
- import "./chunk-H2WRMLYY.js";
16
- import "./chunk-IX7LJ3AD.js";
4
+ } from "./chunk-UB3XGOUW.js";
5
+ import "./chunk-FQVVKQPU.js";
6
+ import "./chunk-B2MHTD3R.js";
7
+ import "./chunk-3BWGTPPT.js";
8
+ import "./chunk-M622VXRQ.js";
9
+ import "./chunk-CIFOFSZ3.js";
10
+ import "./chunk-NIXG4KDE.js";
11
+ import "./chunk-JV7TUEXQ.js";
12
+ import "./chunk-VNYE4R7N.js";
13
+ import "./chunk-OQKDBLOZ.js";
14
+ import "./chunk-K74E42RV.js";
15
+ import "./chunk-MNLXYOVF.js";
16
+ import "./chunk-CX7ZRMTC.js";
17
+ import "./chunk-4ORL4MST.js";
17
18
  import {
18
19
  output
19
- } from "./chunk-X4QLDBB5.js";
20
+ } from "./chunk-T5HJUAWB.js";
21
+ import "./chunk-LQN4S62O.js";
22
+ import "./chunk-IKT5F47M.js";
20
23
  import "./chunk-3MZYUBJ6.js";
21
24
 
22
25
  // src/domains/registry/delete/action.ts
@@ -3,18 +3,25 @@ import {
3
3
  measureTime
4
4
  } from "./chunk-KHDYYVYF.js";
5
5
  import {
6
- getFileOrUrl
7
- } from "./chunk-23I5PKZZ.js";
6
+ getFileOrUrl,
7
+ isAsyncApiDocument,
8
+ isDocument,
9
+ safeNormalize
10
+ } from "./chunk-SWWWYWHC.js";
8
11
  import {
9
12
  require_dist
10
13
  } from "./chunk-K74E42RV.js";
14
+ import "./chunk-MNLXYOVF.js";
15
+ import "./chunk-CX7ZRMTC.js";
11
16
  import {
12
17
  isUrl,
13
18
  isYamlFileName
14
- } from "./chunk-IX7LJ3AD.js";
19
+ } from "./chunk-4ORL4MST.js";
15
20
  import {
16
21
  output
17
- } from "./chunk-X4QLDBB5.js";
22
+ } from "./chunk-T5HJUAWB.js";
23
+ import "./chunk-LQN4S62O.js";
24
+ import "./chunk-IKT5F47M.js";
18
25
  import {
19
26
  __toESM
20
27
  } from "./chunk-3MZYUBJ6.js";
@@ -24,9 +31,8 @@ var import_yaml = __toESM(require_dist(), 1);
24
31
  import fs from "node:fs/promises";
25
32
  import { confirm } from "@clack/prompts";
26
33
  import as from "ansis";
27
- import { normalize } from "@scalar/json-magic/helpers/normalize";
34
+ import { upgrade as upgradeAsyncApi } from "@scalar/asyncapi-upgrader";
28
35
  import { upgrade } from "@scalar/openapi-upgrader";
29
- var isDocument = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
30
36
  async function upgradeAction(input, { output: outputFilePath }) {
31
37
  if (!input) {
32
38
  return output.error().title("Missing input").message("Please provide a file path or URL to upgrade").exit("error");
@@ -47,22 +53,27 @@ async function upgradeAction(input, { output: outputFilePath }) {
47
53
  }
48
54
  }
49
55
  const outputFileName = outputFilePath ?? input;
50
- const document = normalize(await getFileOrUrl(input));
56
+ const content = await getFileOrUrl(input);
57
+ const document = safeNormalize(content);
51
58
  if (!isDocument(document)) {
52
59
  return output.error().title("Invalid input").message(
53
- "Could not read an OpenAPI document from the input. Please provide a valid JSON or YAML file."
60
+ "Could not read a document from the input. Please provide a valid JSON or YAML file."
54
61
  ).exit("error");
55
62
  }
63
+ const isAsyncApi = isAsyncApiDocument(document);
56
64
  const { result: upgraded, executionTimeMs } = await measureTime(
57
- () => upgrade(document, "3.1")
65
+ () => isAsyncApi ? upgradeAsyncApi(document) : upgrade(document, "3.1")
58
66
  );
59
67
  const isYaml = isYamlFileName(outputFileName);
60
68
  await fs.writeFile(
61
69
  outputFileName,
62
70
  isYaml ? import_yaml.default.stringify(upgraded) : JSON.stringify(upgraded, null, 2)
63
71
  );
72
+ const specification = isAsyncApi ? "AsyncAPI" : "OpenAPI";
73
+ const version = upgraded[isAsyncApi ? "asyncapi" : "openapi"];
74
+ const versionSuffix = typeof version === "string" ? ` to version ${version}` : "";
64
75
  output.info().message(
65
- `${as.green(`\u2728 OpenAPI Schema upgraded to version ${upgraded.openapi}`)} in ${as.white(`${as.bold(`${executionTimeMs.toFixed(2)}`)} ms`)}`
76
+ `${as.green(`\u2728 ${specification} Schema upgraded${versionSuffix}`)} in ${as.white(`${as.bold(`${executionTimeMs.toFixed(2)}`)} ms`)}`
66
77
  ).print();
67
78
  }
68
79
  export {
@@ -1,7 +1,7 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  getProjectDeployments
4
- } from "./chunk-HQKBZOYU.js";
4
+ } from "./chunk-FOKFF4EP.js";
5
5
  import {
6
6
  resolveProject
7
7
  } from "./chunk-T7B6WNZC.js";
@@ -10,33 +10,33 @@ import {
10
10
  } from "./chunk-AEFPCC4U.js";
11
11
  import {
12
12
  apiService
13
- } from "./chunk-SXYALPYK.js";
14
- import "./chunk-2BSG2QHO.js";
15
- import "./chunk-SHSHFGA7.js";
16
- import "./chunk-UPUTMFD4.js";
17
- import "./chunk-B6QZJWCQ.js";
18
- import "./chunk-5BPPGTUU.js";
19
- import "./chunk-P646T2WH.js";
20
- import "./chunk-4QS7SJTG.js";
21
- import "./chunk-VTYTPSXO.js";
13
+ } from "./chunk-UB3XGOUW.js";
14
+ import "./chunk-KEOCJ3NJ.js";
15
+ import "./chunk-RPVHJMQT.js";
16
+ import "./chunk-FQVVKQPU.js";
17
+ import "./chunk-B2MHTD3R.js";
18
+ import "./chunk-3BWGTPPT.js";
19
+ import "./chunk-M622VXRQ.js";
20
+ import "./chunk-CIFOFSZ3.js";
22
21
  import {
23
22
  getAuthData
24
- } from "./chunk-5BISXQX4.js";
25
- import "./chunk-OAXFCOJV.js";
26
- import "./chunk-TLFMATXR.js";
27
- import "./chunk-4DGQIAJX.js";
28
- import {
29
- slugSchema
30
- } from "./chunk-ISGLWBXZ.js";
31
- import {
32
- external_exports
33
- } from "./chunk-H2WRMLYY.js";
23
+ } from "./chunk-NIXG4KDE.js";
24
+ import "./chunk-JV7TUEXQ.js";
25
+ import "./chunk-VNYE4R7N.js";
26
+ import "./chunk-OQKDBLOZ.js";
34
27
  import "./chunk-K74E42RV.js";
35
- import "./chunk-IX7LJ3AD.js";
28
+ import "./chunk-MNLXYOVF.js";
29
+ import "./chunk-CX7ZRMTC.js";
30
+ import "./chunk-4ORL4MST.js";
36
31
  import {
37
32
  output,
38
33
  printTable
39
- } from "./chunk-X4QLDBB5.js";
34
+ } from "./chunk-T5HJUAWB.js";
35
+ import "./chunk-LQN4S62O.js";
36
+ import {
37
+ external_exports,
38
+ slugSchema
39
+ } from "./chunk-IKT5F47M.js";
40
40
  import "./chunk-3MZYUBJ6.js";
41
41
 
42
42
  // src/domains/project/deployments/list/action.ts