@scalar/cli 2.1.0 → 2.5.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 (88) hide show
  1. package/README.md +28 -24
  2. package/chunks/{action-CYP4VDK3.js → action-37EV4UHW.js} +12 -35
  3. package/chunks/{action-MENXFJH3.js → action-4XI7XJR4.js} +9 -9
  4. package/chunks/{action-H5OHT2GV.js → action-5IU77OII.js} +7 -3
  5. package/chunks/{action-STIEAXOE.js → action-B3KKREWQ.js} +16 -5
  6. package/chunks/{action-BYZUBXVB.js → action-CH24QGTE.js} +8 -4
  7. package/chunks/action-F3UX5E3M.js +522 -0
  8. package/chunks/{action-GB6DM53B.js → action-FDB7NEOK.js} +21 -10
  9. package/chunks/action-FIXBOJEW.js +244 -0
  10. package/chunks/{action-DFKHSDFV.js → action-G26LSVZ7.js} +7 -3
  11. package/chunks/{action-Q5UJ32D6.js → action-H3RTILLM.js} +1 -1
  12. package/chunks/{action-GEBRPNRT.js → action-HGBBV353.js} +15 -16
  13. package/chunks/{action-5R5FDF6S.js → action-IUE4IOWO.js} +67 -22
  14. package/chunks/{action-TPBKPHNS.js → action-JZLZ7ZAD.js} +22 -22
  15. package/chunks/action-LA6KVAXQ.js +374 -0
  16. package/chunks/{action-PVDDRIM6.js → action-M7RQKBSB.js} +65 -26
  17. package/chunks/{action-F4Y6Q2VB.js → action-MSLBC2SO.js} +21 -21
  18. package/chunks/{action-BNEGJBUH.js → action-NVSZT2ZD.js} +8 -9
  19. package/chunks/{action-ANU5HGC4.js → action-OGQSTRMX.js} +17 -14
  20. package/chunks/{action-CLSD7O2R.js → action-PAGJ5PWC.js} +10 -10
  21. package/chunks/action-QE2ZQQX7.js +250 -0
  22. package/chunks/{action-HD2T6BFJ.js → action-QPUSPD5M.js} +10 -10
  23. package/chunks/{action-45OGQB2M.js → action-R7IMFHQ5.js} +17 -8
  24. package/chunks/{action-UDZUUJSI.js → action-SH4UUXPL.js} +18 -7
  25. package/chunks/action-SNLCIBQC.js +84 -0
  26. package/chunks/{action-C5VB4ITT.js → action-SQG3JAII.js} +36 -18
  27. package/chunks/action-UZQJNYK4.js +18 -0
  28. package/chunks/{action-HNKM3Q65.js → action-VC4DCVST.js} +17 -14
  29. package/chunks/{action-BMFXENMX.js → action-VTVFY2MP.js} +39 -34
  30. package/chunks/{action-TZ5KGAQT.js → action-WFWYGY7O.js} +17 -14
  31. package/chunks/{action-W5BATF4Q.js → action-XMNX5ZYT.js} +24 -24
  32. package/chunks/{agent-XGLOHXNA.js → agent-HCQRMHQ5.js} +25 -5
  33. package/chunks/asyncapi-QM76O55R.js +105 -0
  34. package/chunks/{build.action-LKOILPA6.js → build.action-P7FCIMYU.js} +22 -22
  35. package/chunks/{chunk-23I5PKZZ.js → chunk-24WAOKGG.js} +32 -5
  36. package/chunks/chunk-3L6DLIXJ.js +25530 -0
  37. package/chunks/chunk-3ZJYGGAA.js +30 -0
  38. package/chunks/{chunk-ZTVWAKNJ.js → chunk-4NHMAG6F.js} +1 -1
  39. package/chunks/{chunk-IX7LJ3AD.js → chunk-4ORL4MST.js} +2 -3
  40. package/chunks/{chunk-OAXFCOJV.js → chunk-4ZDQXWBT.js} +2 -1
  41. package/chunks/{chunk-ASMHW5AY.js → chunk-6ZMT63IV.js} +1 -1
  42. package/chunks/{chunk-P2VH7DOC.js → chunk-7AGLC7WV.js} +6 -6
  43. package/chunks/{chunk-SXYALPYK.js → chunk-AO3F5XWR.js} +498 -60
  44. package/chunks/{chunk-B6QZJWCQ.js → chunk-B2MHTD3R.js} +4 -6
  45. package/chunks/{chunk-4QS7SJTG.js → chunk-CISTON3A.js} +51 -36
  46. package/chunks/chunk-COBPBRQF.js +25 -0
  47. package/chunks/{chunk-2BSG2QHO.js → chunk-F467BYYR.js} +133 -20
  48. package/chunks/{chunk-TLFMATXR.js → chunk-GSGZHE26.js} +33 -25
  49. package/chunks/{chunk-UPUTMFD4.js → chunk-HCPN3KNF.js} +185 -13
  50. package/chunks/{chunk-P646T2WH.js → chunk-HPL3ZZ2P.js} +131 -13
  51. package/chunks/{chunk-H2WRMLYY.js → chunk-IKT5F47M.js} +3571 -7
  52. package/chunks/{chunk-AHWWJ3MD.js → chunk-K4DTP5TV.js} +1 -1
  53. package/chunks/{chunk-TQ5XC2E3.js → chunk-LFU5ZUAP.js} +77 -11
  54. package/chunks/{chunk-5BISXQX4.js → chunk-M37TP6U2.js} +11 -13
  55. package/chunks/chunk-OQKDBLOZ.js +741 -0
  56. package/chunks/chunk-P7H7GY5A.js +14 -0
  57. package/chunks/{chunk-47Y4L5IT.js → chunk-PBXZN65A.js} +1031 -481
  58. package/chunks/{chunk-HQKBZOYU.js → chunk-PT5TI77I.js} +3 -3
  59. package/chunks/chunk-Q7DOQHZN.js +404 -0
  60. package/chunks/{chunk-X4QLDBB5.js → chunk-T5HJUAWB.js} +24 -3
  61. package/chunks/{chunk-NUXPNUSS.js → chunk-UGGNHILG.js} +1 -1
  62. package/chunks/{chunk-4DGQIAJX.js → chunk-VNYE4R7N.js} +154 -14
  63. package/chunks/{chunk-KWOL7A6J.js → chunk-X5T526CE.js} +2 -2
  64. package/chunks/chunk-XCSR4RIT.js +210 -0
  65. package/chunks/{chunk-SHSHFGA7.js → chunk-Z2KMGFE6.js} +4 -6
  66. package/chunks/{create.action-FFQLBSJH.js → create.action-HDD2WUON.js} +22 -22
  67. package/chunks/{delete.action-STHQHP4F.js → delete.action-7GOZY7ID.js} +22 -22
  68. package/chunks/{delete.action-QNN3LC2F.js → delete.action-VE66JFDS.js} +22 -22
  69. package/chunks/{get.action-OTKYOP3Z.js → get.action-2745EB4N.js} +15 -16
  70. package/chunks/{list.action-KDM5RHEH.js → list.action-3VTXQJRA.js} +19 -19
  71. package/chunks/{list.action-6I5EZAVB.js → list.action-4QDCZLSZ.js} +22 -22
  72. package/chunks/{publish.action-PODTVRXS.js → publish.action-ULQLZKWU.js} +44 -36
  73. package/chunks/{update.action-KMD4ZM75.js → update.action-6QEFP7NA.js} +22 -22
  74. package/chunks/{update.action-4F6STTEQ.js → update.action-OROQSP2S.js} +22 -22
  75. package/docs.html +104 -103
  76. package/index.js +84 -68
  77. package/package.json +16 -12
  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
@@ -1,463 +0,0 @@
1
- import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
- import {
3
- baseRegistrySchema
4
- } from "./chunk-VTYTPSXO.js";
5
- import {
6
- brandedUid,
7
- docVersionSchema,
8
- entitySchema,
9
- mintUid,
10
- namespaceSchema,
11
- nanoidSchema,
12
- slugSchema,
13
- timestampSchema
14
- } from "./chunk-ISGLWBXZ.js";
15
- import {
16
- external_exports
17
- } from "./chunk-H2WRMLYY.js";
18
- import {
19
- require_dist
20
- } from "./chunk-K74E42RV.js";
21
- import {
22
- __toESM
23
- } from "./chunk-3MZYUBJ6.js";
24
-
25
- // ../../packages/entities/dist/sdk/schema.js
26
- var SdkLanguage;
27
- (function(SdkLanguage2) {
28
- SdkLanguage2["Typescript"] = "typescript";
29
- SdkLanguage2["Python"] = "python";
30
- SdkLanguage2["Cli"] = "cli";
31
- SdkLanguage2["CSharp"] = "csharp";
32
- SdkLanguage2["Java"] = "java";
33
- SdkLanguage2["Ruby"] = "ruby";
34
- SdkLanguage2["Php"] = "php";
35
- SdkLanguage2["Go"] = "go";
36
- SdkLanguage2["Rust"] = "rust";
37
- SdkLanguage2["Kotlin"] = "kotlin";
38
- SdkLanguage2["Swift"] = "swift";
39
- SdkLanguage2["Cpp"] = "cpp";
40
- SdkLanguage2["Dart"] = "dart";
41
- })(SdkLanguage || (SdkLanguage = {}));
42
- var SdkLanguageLabels = {
43
- [SdkLanguage.Typescript]: "Typescript",
44
- [SdkLanguage.Python]: "Python",
45
- [SdkLanguage.Cli]: "CLI",
46
- [SdkLanguage.CSharp]: "C#",
47
- [SdkLanguage.Java]: "Java",
48
- [SdkLanguage.Ruby]: "Ruby",
49
- [SdkLanguage.Php]: "PHP",
50
- [SdkLanguage.Go]: "Go",
51
- [SdkLanguage.Rust]: "Rust",
52
- [SdkLanguage.Kotlin]: "Kotlin",
53
- [SdkLanguage.Swift]: "Swift",
54
- [SdkLanguage.Cpp]: "C++",
55
- [SdkLanguage.Dart]: "Dart"
56
- };
57
- var SdkRegistryLabels = {
58
- [SdkLanguage.Typescript]: "npm",
59
- [SdkLanguage.Python]: "PyPI",
60
- [SdkLanguage.Go]: "Go modules",
61
- [SdkLanguage.Rust]: "crates.io",
62
- [SdkLanguage.Java]: "Maven Central",
63
- [SdkLanguage.Kotlin]: "Maven Central",
64
- [SdkLanguage.Ruby]: "RubyGems",
65
- [SdkLanguage.Php]: "Packagist",
66
- [SdkLanguage.CSharp]: "NuGet",
67
- [SdkLanguage.Swift]: "Swift Package Manager",
68
- [SdkLanguage.Dart]: "pub.dev",
69
- [SdkLanguage.Cli]: "Homebrew"
70
- };
71
- var SdkLanguageExperimental = {
72
- [SdkLanguage.Typescript]: false,
73
- [SdkLanguage.Python]: false,
74
- [SdkLanguage.Cli]: false,
75
- [SdkLanguage.CSharp]: true,
76
- [SdkLanguage.Java]: true,
77
- [SdkLanguage.Ruby]: true,
78
- [SdkLanguage.Php]: true,
79
- [SdkLanguage.Go]: false,
80
- [SdkLanguage.Rust]: true,
81
- [SdkLanguage.Kotlin]: true,
82
- [SdkLanguage.Swift]: true,
83
- [SdkLanguage.Cpp]: true,
84
- [SdkLanguage.Dart]: true
85
- };
86
- var sdkTargetDestinationSchema = external_exports.object({
87
- provider: external_exports.literal("github").default("github"),
88
- linkedBy: external_exports.string(),
89
- /**
90
- * GitHub App installation that grants push access. Optional because legacy
91
- * links predate it and it is derivable from `linkedBy` + repo at sync time.
92
- */
93
- installationId: external_exports.number().int().optional(),
94
- /** GitHub repo id — the auth anchor and the webhook routing key. */
95
- id: external_exports.number().int(),
96
- expired: external_exports.boolean().default(false)
97
- }).meta({ id: "sdk-target-destination" });
98
- var sdkSampleRepoSchema = external_exports.object({
99
- provider: external_exports.literal("github").default("github"),
100
- /**
101
- * 'pending' from SDK creation until the repo is provisioned in scalar-sdks;
102
- * 'ready' once it exists (name/installationId are filled in then). The
103
- * pending state lets the dashboard show the section immediately. Defaults to
104
- * 'ready' so pre-existing bindings (which always have a repo) read correctly.
105
- */
106
- status: external_exports.enum(["pending", "ready"]).default("ready"),
107
- /** "scalar-sdks/<repo>" (present once ready). */
108
- name: external_exports.string().optional(),
109
- /** scalar-sdks installation that grants push access for the bot (once ready). */
110
- installationId: external_exports.number().int().optional(),
111
- baseBranch: external_exports.string().min(1).default("main"),
112
- /**
113
- * GitHub invitation accept URL, surfaced in the dashboard. Null once the
114
- * invite has been re-issued for an already-accepted user (no link to show).
115
- */
116
- invitationUrl: external_exports.string().nullable().optional(),
117
- /**
118
- * When provisioning was first kicked for this target (unix seconds), stamped
119
- * as the pending binding is seeded. The dashboard anchors its stalled-timeout
120
- * on it so a target added long after the SDK was created still gets the full
121
- * "Preparing" window instead of reading as stalled immediately. Absent on
122
- * pre-feature bindings (readers fall back to the SDK's `createdAt`).
123
- */
124
- provisionStartedAt: timestampSchema.optional(),
125
- /** Last build whose artifact was pushed to the playground. */
126
- lastSyncedBuild: nanoidSchema.optional()
127
- }).meta({ id: "sdk-sample-repo" });
128
- var sdkTargetSchema = external_exports.object({
129
- language: external_exports.enum(SdkLanguage),
130
- slug: slugSchema,
131
- destination: sdkTargetDestinationSchema.nullable().default(null),
132
- /**
133
- * Preview repo in scalar-sdks for this target. Independent of `destination`:
134
- * it always mirrors the latest build so users can play with the output before
135
- * setting up a production repo.
136
- */
137
- sample: sdkSampleRepoSchema.nullable().default(null)
138
- }).meta({ id: "sdk-target" });
139
- var sdkVersionTargetStateSchema = external_exports.object({
140
- activeSync: external_exports.object({
141
- repository: external_exports.string(),
142
- /**
143
- * The release PR managed by release-please on scalar-next, when one
144
- * was open after the sync. Release cutting is the repo's own workflow.
145
- */
146
- pullRequest: external_exports.number().optional(),
147
- /** scalar-next tip the sync landed. */
148
- commitHash: external_exports.string()
149
- }).optional(),
150
- /**
151
- * Set when the last combine merge collided: the build awaiting resolution
152
- * on the conflict PR (scalar-merge-conflict into scalar-next), resolved by
153
- * the developer on GitHub. Cleared on a clean reconcile.
154
- */
155
- conflict: external_exports.object({
156
- build: nanoidSchema,
157
- /** The conflict PR into scalar-next, for deep links. */
158
- pullRequest: external_exports.number().optional()
159
- }).optional(),
160
- activeBuild: nanoidSchema.optional()
161
- }).meta({ id: "sdk-version-target-state" });
162
- var sdkVersionStatusSchema = external_exports.enum(["draft", "published"]);
163
- var sdkVersionSchema = external_exports.object({
164
- version: docVersionSchema,
165
- /**
166
- * The exact API version this SDK version was created against (build
167
- * provenance). Always concrete — the SDK-level `sdkSchema.apiVersion` is
168
- * the range-capable auto-update spec.
169
- */
170
- apiVersion: docVersionSchema,
171
- createdAt: timestampSchema.optional(),
172
- /** Draft while being edited; published once a build of it succeeds. */
173
- status: sdkVersionStatusSchema.default("published"),
174
- /** Config snapshot for this version. Defaults to `{}` so pre-migration docs still validate. */
175
- config: external_exports.string().default("{}"),
176
- /** Language targets this version ships, derived from `config`. */
177
- languages: external_exports.enum(SdkLanguage).array().default([]),
178
- publishedAt: timestampSchema.optional(),
179
- /** What created/last-touched this version, for display. */
180
- changeSource: external_exports.enum(["user", "api-version", "created"]).optional(),
181
- changeNote: external_exports.string().optional(),
182
- /**
183
- * Content identity of the API document save that auto-created this
184
- * version: the managed doc version's `jsonSha` — the same key space as
185
- * {@link sdkBuildApiSchema}'s `documentHash`. Lets redelivered (or
186
- * repeated, identical) save events recognize content the SDK already
187
- * processed instead of minting another version.
188
- */
189
- apiDocumentHash: external_exports.string().optional(),
190
- /** Active sync/build per language, for this version. */
191
- targets: external_exports.partialRecord(external_exports.enum(SdkLanguage), sdkVersionTargetStateSchema).default({})
192
- }).meta({ id: "sdk-version" });
193
- var sdkSchema = baseRegistrySchema.extend({
194
- /** Own uid, branded so it cannot be confused with another entity's uid */
195
- uid: brandedUid().default(mintUid).meta({ default: "nanoid()" }),
196
- /**
197
- * The registry API this SDK is generated from. Null when unlinked — the SDK
198
- * keeps its versions/builds but can't build a new version until re-linked.
199
- *
200
- * Branded as a ManagedDoc uid: this points at a managed DOC, not a managed
201
- * SCHEMA, so comparing it to a `ManagedSchema` uid is a compile error.
202
- */
203
- apiUid: brandedUid().nullable(),
204
- /**
205
- * The API version this SDK follows — the auto-update gate. An exact value
206
- * (`3.0.1`, kept in sync with the version the SDK is on) auto-rebuilds only
207
- * when that version's content changes; a range prefix widens it (`~1.2.0`
208
- * adds patch bumps, `^1.2.3` minors, `3` any 3.x, `*` any version). Ranges
209
- * are user intent and never rewritten by the platform. Distinct from
210
- * `sdkVersionSchema.apiVersion`, the exact build provenance of one SDK
211
- * version. Null while unlinked; absent on pre-feature docs (readers fall
212
- * back to the tracked version with exact semantics). `docVersionSchema`
213
- * keeps the same floor as every other version field: non-empty, no
214
- * reserved names (`latest` would be a spec that can never match).
215
- */
216
- apiVersion: docVersionSchema.nullable().optional(),
217
- /**
218
- * Current latest revision
219
- * for SDK. Can be selected
220
- * by user.
221
- */
222
- currentVersion: nanoidSchema,
223
- /** All versions available for SDK. */
224
- versions: sdkVersionSchema.array().default([]),
225
- /**
226
- * Persistent per-language registry: every language the SDK has, each with its
227
- * registry slug + git destination. Survives across versions — destinations and
228
- * slugs persist even when a version drops a language. The *active* language set
229
- * is the latest published version's `languages`.
230
- */
231
- targets: sdkTargetSchema.array().min(1),
232
- /**
233
- * @deprecated Config now lives per-version (`sdkVersionSchema.config`). Kept
234
- * optional for the migration/legacy path; new code reads the version config.
235
- */
236
- config: external_exports.string().optional()
237
- }).meta({ id: "sdk" });
238
- var sdkBuildStatusSchema = external_exports.enum(["pending", "error", "generated"]).meta({ id: "sdk-build-status" });
239
- var sdkGitStatusSchema = external_exports.enum(["pending", "error", "synced", "conflicts"]).meta({ id: "sdk-git-status" });
240
- var sdkBuildApiSchema = external_exports.object({
241
- uid: nanoidSchema,
242
- namespace: namespaceSchema,
243
- version: docVersionSchema,
244
- slug: slugSchema,
245
- upgraded: external_exports.boolean().default(false),
246
- /**
247
- * Identity of the API document content this build was enqueued against:
248
- * the managed doc version's `jsonSha` at enqueue time. Rebuild triggering
249
- * compares it with the version's current `jsonSha` — an in-place content
250
- * rewrite that lands between enqueue and generation makes the comparison
251
- * conservatively re-trigger rather than miss the change. Nullable:
252
- * document versions hashed before `jsonSha` existed carry none, and
253
- * mongobase round-trips an unset optional as null.
254
- */
255
- documentHash: external_exports.string().nullable().optional()
256
- }).meta({ id: "sdk-build-api" });
257
- var sdkbuildSdkSchema = external_exports.object({
258
- uid: nanoidSchema,
259
- namespace: namespaceSchema,
260
- version: docVersionSchema,
261
- slug: slugSchema
262
- }).meta({ id: "sdk-build-sdk" });
263
- var sdkBuildGitSchema = external_exports.object({
264
- /**
265
- * The release PR (clean sync) or conflict PR (conflicted sync), when one
266
- * exists. Nullable: mongobase round-trips an unset optional as null, and a
267
- * strict number parse would drop the doc on read.
268
- */
269
- pullRequest: external_exports.number().nullable().optional(),
270
- commitHash: external_exports.string()
271
- }).optional().meta({ id: "sdk-build-git" });
272
- var sdkBuildTargetSchema = external_exports.object({
273
- /** SDK language to generate */
274
- language: external_exports.enum(SdkLanguage),
275
- /** Per-target published slug the artifact lands under */
276
- slug: slugSchema,
277
- /** Build status */
278
- buildStatus: sdkBuildStatusSchema,
279
- /**
280
- * Additional build message. Nullable: mongobase round-trips an unset
281
- * optional as null, and a strict string parse would drop the doc on read.
282
- */
283
- buildMessage: external_exports.string().nullable().optional(),
284
- /** Git sync status */
285
- gitStatus: sdkGitStatusSchema.optional(),
286
- /**
287
- * When the target entered `gitStatus: 'pending'`, in unix seconds. Lets a
288
- * still-"pending" sync be recognized as stalled (a terminal message never
289
- * arrived) so the dashboard can offer a retry instead of spinning forever.
290
- * Nullable for the same round-trip reason as buildMessage.
291
- */
292
- syncStartedAt: external_exports.number().nullable().optional(),
293
- /** Additional git message. Nullable for the same round-trip reason as buildMessage. */
294
- gitMessage: external_exports.string().nullable().optional(),
295
- /**
296
- * Machine-readable git failure class assigned by the generator (e.g.
297
- * 'github-workflows-permission'). Nullable for the same round-trip reason
298
- * as buildMessage.
299
- */
300
- gitErrorCode: external_exports.string().nullable().optional(),
301
- /** Linked git repository name */
302
- repository: external_exports.string().nullable().optional(),
303
- /** Git sync commit and PR */
304
- gitSync: sdkBuildGitSchema
305
- }).meta({ id: "sdk-build-target" });
306
- var sdkBuildSchema = entitySchema.extend({
307
- teamUid: nanoidSchema,
308
- /** SDK metadata on generation */
309
- sdk: sdkbuildSdkSchema,
310
- /** Original API used to generate SDK */
311
- api: sdkBuildApiSchema,
312
- /** Custom SDK config */
313
- config: external_exports.string(),
314
- /** Should auto set active sdk version */
315
- autoBump: external_exports.boolean().default(false),
316
- /** Per-language build targets */
317
- targets: sdkBuildTargetSchema.array().min(1)
318
- }).meta({ id: "sdk-build" });
319
- var sdkBuildLogChunkSchema = entitySchema.extend({
320
- teamUid: nanoidSchema,
321
- buildUid: nanoidSchema,
322
- /** Monotonic order within a build. */
323
- sequence: external_exports.number().int(),
324
- chunk: external_exports.string()
325
- }).meta({ id: "sdk-build-log-chunk" });
326
- var sdkCodeSampleSchema = external_exports.object({
327
- lang: external_exports.string(),
328
- label: external_exports.string(),
329
- source: external_exports.string()
330
- }).meta({ id: "sdk-code-sample" });
331
-
332
- // ../../packages/entities/dist/sdk/auto-update.js
333
- import semver2 from "semver";
334
-
335
- // ../../packages/entities/dist/sdk/helpers.js
336
- import semver from "semver";
337
-
338
- // ../../packages/entities/dist/sdk/scalar-config.js
339
- var import_yaml = __toESM(require_dist(), 1);
340
- var SCALAR_TARGET_LANGUAGES = [
341
- "node",
342
- "typescript",
343
- "python",
344
- "go",
345
- "rust",
346
- "java",
347
- "kotlin",
348
- "ruby",
349
- "swift",
350
- "terraform",
351
- "cli",
352
- "php",
353
- "csharp",
354
- "cpp",
355
- "dart",
356
- "sql",
357
- "http",
358
- "openapi"
359
- ];
360
- var scalarTargetLanguageSchema = external_exports.enum(SCALAR_TARGET_LANGUAGES).meta({ id: "scalar-target-language" });
361
- var sdkLanguageToScalarTarget = {
362
- [SdkLanguage.Typescript]: "typescript",
363
- [SdkLanguage.Python]: "python",
364
- [SdkLanguage.CSharp]: "csharp",
365
- [SdkLanguage.Java]: "java",
366
- [SdkLanguage.Ruby]: "ruby",
367
- [SdkLanguage.Php]: "php",
368
- [SdkLanguage.Go]: "go",
369
- [SdkLanguage.Rust]: "rust",
370
- [SdkLanguage.Kotlin]: "kotlin",
371
- [SdkLanguage.Swift]: "swift",
372
- [SdkLanguage.Cpp]: "cpp",
373
- [SdkLanguage.Dart]: "dart",
374
- [SdkLanguage.Cli]: "cli"
375
- };
376
- var sdkLanguageToRegistry = {
377
- [SdkLanguage.Typescript]: "npm",
378
- [SdkLanguage.Python]: "pypi",
379
- [SdkLanguage.Go]: "go",
380
- [SdkLanguage.Rust]: "cargo",
381
- [SdkLanguage.Java]: "maven",
382
- [SdkLanguage.Kotlin]: "maven",
383
- [SdkLanguage.Ruby]: "rubygems",
384
- [SdkLanguage.Php]: "packagist",
385
- [SdkLanguage.CSharp]: "nuget",
386
- [SdkLanguage.Swift]: "swiftpm",
387
- [SdkLanguage.Dart]: "pub",
388
- [SdkLanguage.Cli]: "homebrew"
389
- };
390
- var registryPackageUrls = {
391
- [SdkLanguage.Typescript]: (name) => `https://www.npmjs.com/package/${name}`,
392
- [SdkLanguage.Python]: (name) => `https://pypi.org/project/${name}`,
393
- [SdkLanguage.Ruby]: (name) => `https://rubygems.org/gems/${name}`,
394
- [SdkLanguage.Rust]: (name) => `https://crates.io/crates/${name}`,
395
- [SdkLanguage.CSharp]: (name) => `https://www.nuget.org/packages/${name}`,
396
- [SdkLanguage.Dart]: (name) => `https://pub.dev/packages/${name}`,
397
- // Packagist pages exist only for `vendor/name` packages.
398
- [SdkLanguage.Php]: (name) => name.includes("/") ? `https://packagist.org/packages/${name}` : null
399
- };
400
- var scalarTargetDestinationsSchema = external_exports.object({
401
- production: external_exports.object({
402
- repo: external_exports.string(),
403
- branch: external_exports.string().optional()
404
- }).optional()
405
- }).meta({ id: "scalar-target-destinations" });
406
- var scalarTargetEntrySchema = external_exports.looseObject({
407
- packageName: external_exports.string().optional(),
408
- // Prerelease channel for the target's releases (release-please's
409
- // `prerelease-type` with its `prerelease` versioning strategy): releases
410
- // version as `1.2.0-<type>.1`, `-<type>.2`, … auto-incrementing. Absent
411
- // falls back to the channel the promote branch implies (see
412
- // derivePrereleaseType); a conventional branch like `main` means stable
413
- // releases.
414
- prereleaseType: external_exports.string().optional(),
415
- destinations: scalarTargetDestinationsSchema.optional(),
416
- // Per-registry publish config (e.g. `{ npm: { authMethod: 'oidc' } }`). Present only when the
417
- // target opts into publish-on-merge; the generator reads it to emit publish workflow steps.
418
- publish: external_exports.record(external_exports.string(), external_exports.any()).optional()
419
- }).meta({ id: "scalar-target-entry" });
420
- var scalarClientSettingsSchema = external_exports.looseObject({
421
- opts: external_exports.record(external_exports.string(), external_exports.any()).optional(),
422
- defaultHeaders: external_exports.record(external_exports.string(), external_exports.string()).optional(),
423
- defaultTimeout: external_exports.union([external_exports.number(), external_exports.string()]).optional(),
424
- defaultEnvPrefix: external_exports.string().optional()
425
- }).meta({ id: "scalar-client-settings" });
426
- var scalarDiagnosticsSchema = external_exports.looseObject({
427
- failOn: external_exports.enum(["off", "info", "warn", "error"]).optional(),
428
- maxWarnings: external_exports.number().optional()
429
- }).meta({ id: "scalar-diagnostics" });
430
- var scalarSdkConfigSchema = external_exports.looseObject({
431
- name: external_exports.string().optional(),
432
- resources: external_exports.record(external_exports.string(), external_exports.any()).optional(),
433
- targets: external_exports.partialRecord(scalarTargetLanguageSchema, scalarTargetEntrySchema).optional(),
434
- clientSettings: scalarClientSettingsSchema.optional(),
435
- environments: external_exports.record(external_exports.string(), external_exports.string()).optional(),
436
- codeSampleLanguages: scalarTargetLanguageSchema.array().optional(),
437
- diagnostics: scalarDiagnosticsSchema.optional()
438
- }).meta({ id: "scalar-sdk-config" });
439
- var scalarTargetToSdkLanguage = Object.fromEntries(Object.entries(sdkLanguageToScalarTarget).map(([language, target]) => [
440
- target,
441
- language
442
- ]));
443
- var resolveSdkConfigRequestSchema = external_exports.object({
444
- api: external_exports.object({
445
- namespace: namespaceSchema,
446
- slug: slugSchema,
447
- version: docVersionSchema.optional(),
448
- upgraded: external_exports.boolean().optional()
449
- }),
450
- namespace: namespaceSchema,
451
- slug: slugSchema,
452
- languages: external_exports.enum(SdkLanguage).array().min(1),
453
- /** Candidate config to validate/complete; omit for the pure
454
- * document-derived default. */
455
- config: external_exports.string().optional()
456
- });
457
-
458
- export {
459
- SdkLanguage,
460
- sdkSchema,
461
- sdkBuildSchema,
462
- scalarSdkConfigSchema
463
- };
@@ -1,108 +0,0 @@
1
- import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
- import {
3
- RegistryAsset
4
- } from "./chunk-4QS7SJTG.js";
5
- import {
6
- docVersionSchema,
7
- namespaceSchema
8
- } from "./chunk-ISGLWBXZ.js";
9
- import {
10
- external_exports
11
- } from "./chunk-H2WRMLYY.js";
12
-
13
- // ../../packages/urls/dist/registry/path-generators.js
14
- function versionFormat(version) {
15
- if (!version || version === "latest")
16
- return "latest";
17
- return docVersionSchema.parse(version);
18
- }
19
- function filetypeFormat(filetype) {
20
- return filetype ? external_exports.enum(["yaml", "json", "zip"]).parse(filetype) : "yaml";
21
- }
22
- function registryFormat(format) {
23
- return external_exports.enum(["yaml", "json", "preview"]).parse(format);
24
- }
25
- function buildAsset(namespace, asset, slug) {
26
- return {
27
- /**
28
- * Get registry record path.
29
- *
30
- * Registry collection records have a base resource path
31
- * with the primary registry item metadata: namespace,
32
- * asset type and slug.
33
- *
34
- * @example scalar/apis/scalar-galaxy
35
- */
36
- path: () => {
37
- return `${namespace}/${asset}/${slug}`;
38
- },
39
- /**
40
- * Get registry GCS file storage path
41
- *
42
- * Unlike registry record paths, storage paths contain the version
43
- * of a registry item, and the respective file type.
44
- *
45
- * @example scalar/apis/scalar-galaxy/1.0.0.json
46
- */
47
- file: (opts) => {
48
- return `${namespace}/${asset}/${slug}/${opts?.build || versionFormat(opts?.version)}${opts?.upgraded ? "_upgraded" : ""}${opts?.variant === "processed" ? "_processed" : ""}.${filetypeFormat(opts?.type)}`;
49
- },
50
- /**
51
- * Get registry GCS folder storage path
52
- *
53
- * @example scalar/apis/scalar-galaxy
54
- */
55
- folder: (opts) => {
56
- return `${namespace}/${asset}/${slug}${opts?.version ? `/${opts.version}` : ""}`;
57
- },
58
- /**
59
- * Get a full standardized registry url path
60
- *
61
- * Our registry resolver understands a few path formats.
62
- * However, this is our primary registry format to use across
63
- * internal products.
64
- *
65
- * @example @scalar/apis/scalar-galaxy/1.0.0?format=preview
66
- */
67
- url: (opts) => {
68
- const query = [
69
- opts?.format ? `format=${registryFormat(opts.format)}` : "",
70
- opts?.variant === "processed" ? "variant=processed" : "",
71
- opts?.lang ? `lang=${opts.lang}` : ""
72
- ].filter(Boolean).join("&");
73
- return `@${namespace}/${asset}/${slug}@${versionFormat(opts?.version)}${query ? `?${query}` : ""}`;
74
- }
75
- };
76
- }
77
- function registry(teamNamespace) {
78
- const namespace = namespaceSchema.parse(teamNamespace);
79
- return {
80
- apis: (slug) => buildAsset(namespace, RegistryAsset.Apis, slug),
81
- rules: (slug) => buildAsset(namespace, RegistryAsset.Rules, slug),
82
- sdks: (slug) => buildAsset(namespace, RegistryAsset.Sdks, slug),
83
- schemas: (slug) => buildAsset(namespace, RegistryAsset.Schemas, slug),
84
- workspaces: (slug) => buildAsset(namespace, RegistryAsset.Workspaces, slug)
85
- };
86
- }
87
-
88
- // ../../packages/urls/dist/publish/full.js
89
- function getPublishUrl(domain, subpath) {
90
- const url = `https://${domain}${subpath ?? ""}`;
91
- return new URL(url).toString();
92
- }
93
-
94
- // ../../packages/urls/dist/publish/previews.js
95
- function getPublishPreviewUrl(publishUid, domain, subpath = "") {
96
- const url = `https://${getPublishPreviewDomain(publishUid, domain)}${subpath ?? ""}`;
97
- new URL(url);
98
- return url;
99
- }
100
- function getPublishPreviewDomain(publishUid, domain) {
101
- return `${publishUid}--${domain}`;
102
- }
103
-
104
- export {
105
- getPublishUrl,
106
- getPublishPreviewUrl,
107
- registry
108
- };