@scalar/cli 2.17.0 → 2.18.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.
- package/README.md +77 -3
- package/chunks/{action-Y4L4OPPH.js → action-2WVJ2WEW.js} +15 -16
- package/chunks/{action-UOUS2G2B.js → action-4BDZ2CXP.js} +6 -7
- package/chunks/{action-52ZSECW2.js → action-5AXDB5VN.js} +14 -15
- package/chunks/{action-7PVWQJ7V.js → action-6I3TJLRO.js} +28 -26
- package/chunks/{action-MPBZUWQ2.js → action-6WZN63LT.js} +20 -19
- package/chunks/{action-5NYKJDBG.js → action-7GZGVTYI.js} +1067 -766
- package/chunks/{action-2Y6UTXAG.js → action-7ZCJAWI2.js} +5 -5
- package/chunks/{action-UWVZ6V7B.js → action-A6YOY24G.js} +5 -5
- package/chunks/{action-KJJ35X2T.js → action-AGGHY4N2.js} +21 -20
- package/chunks/{action-MKZYWAXH.js → action-BVZOA2G5.js} +9 -10
- package/chunks/{action-5TQHROY5.js → action-BYDJ4R4F.js} +14 -15
- package/chunks/{action-VJDK7ROI.js → action-CBAL5CYB.js} +16 -17
- package/chunks/action-COFGCCYS.js +89 -0
- package/chunks/action-CYU5Q5LT.js +254 -0
- package/chunks/{action-XMANK72Z.js → action-DTQH6CKR.js} +24 -23
- package/chunks/{action-AFZE62DU.js → action-ED5WLLIE.js} +6 -7
- package/chunks/action-F4CQ4DW3.js +654 -0
- package/chunks/{action-TA6VOPQ5.js → action-GVW5PSPT.js} +17 -18
- package/chunks/{action-TTDV5NIP.js → action-H5VRLFCY.js} +5 -5
- package/chunks/{action-2SZMLOYJ.js → action-IWEAWDT3.js} +9 -10
- package/chunks/{action-3EATJRIK.js → action-JN6JVQUV.js} +14 -15
- package/chunks/{action-WPUITVPF.js → action-KVM76ZKQ.js} +11 -11
- package/chunks/{action-PS4F4QWI.js → action-LLMFEBHH.js} +3 -4
- package/chunks/{action-WUMW2GH6.js → action-PEG7AUA6.js} +14 -13
- package/chunks/{action-UVWH2KZY.js → action-QC72LLYE.js} +7 -5
- package/chunks/{action-P5MGMJG3.js → action-QP6MRSQW.js} +15 -14
- package/chunks/{action-W47MFJSP.js → action-R53K22GE.js} +219 -45
- package/chunks/{action-RWITXLMW.js → action-SJPWL723.js} +5 -4
- package/chunks/{action-SBD4TFRS.js → action-T3R4SDAI.js} +5 -5
- package/chunks/{action-GOKWY3AQ.js → action-TT7ZJNST.js} +20 -19
- package/chunks/{action-LALZGEVR.js → action-UPVVJE26.js} +14 -15
- package/chunks/{action-RM4RZFZV.js → action-V35W4MRK.js} +10 -11
- package/chunks/{action-J3C4LAT5.js → action-W4KGRBRV.js} +5 -5
- package/chunks/{action-VWQNDXZT.js → action-ZIVYJCC2.js} +14 -15
- package/chunks/{action-LI6DZLDZ.js → action-ZU5X2KQX.js} +22 -21
- package/chunks/{actions-GWMW7V2B.js → actions-CERT7BL4.js} +16 -16
- package/chunks/{actions-4X5RTQCM.js → actions-RCIS37Y6.js} +14 -15
- package/chunks/{agent-LB5ZCVUN.js → agent-CT3RRYPJ.js} +7 -7
- package/chunks/{asyncapi-J6VAMIMO.js → asyncapi-DVBS23QW.js} +9 -10
- package/chunks/{build.action-YP46CGLS.js → build.action-7MKMMV6V.js} +16 -17
- package/chunks/{chunk-B3CMXTHQ.js → chunk-36UI2W7I.js} +1 -1
- package/chunks/{chunk-4TSZVWGM.js → chunk-4BMOCIYO.js} +19 -4
- package/chunks/{chunk-SKXMYIA2.js → chunk-5EO2CVAR.js} +4 -4
- package/chunks/{chunk-4YQNT5UH.js → chunk-5GZAGHKL.js} +1 -1
- package/chunks/{chunk-3BZ3VY6H.js → chunk-7LUXRNKV.js} +27 -2
- package/chunks/{chunk-KDEKIOIP.js → chunk-CWCRBWA6.js} +1 -1
- package/chunks/{chunk-YFUHTGGP.js → chunk-CYIGEQOJ.js} +2 -2
- package/chunks/{chunk-I4FQOD5L.js → chunk-DVA4NCCY.js} +3 -3
- package/chunks/{chunk-63AB5A5B.js → chunk-F6E7FJEC.js} +6 -6
- package/chunks/{chunk-2KMYC3ZI.js → chunk-FMPJSW6A.js} +2 -2
- package/chunks/{chunk-IZ3UMB7D.js → chunk-GCVB22TG.js} +2 -2
- package/chunks/{chunk-36AMOACU.js → chunk-GXKNYM54.js} +3 -3
- package/chunks/chunk-I25ZCHBJ.js +22 -0
- package/chunks/{chunk-KYCM5SL3.js → chunk-JBMHCTZD.js} +1 -0
- package/chunks/{chunk-57EMU765.js → chunk-JEOQ7LSA.js} +1 -1
- package/chunks/{chunk-DXEHHE6H.js → chunk-KI2AVDKM.js} +6 -4
- package/chunks/{chunk-QDT27U6O.js → chunk-KSY2GH53.js} +2 -2
- package/chunks/{chunk-LS6XOFVD.js → chunk-KWQVA66H.js} +11 -23
- package/chunks/{chunk-KJT4VYUO.js → chunk-LPWRG2MS.js} +1 -1
- package/chunks/{chunk-NKCM2UH5.js → chunk-LVUMNGVA.js} +1 -1
- package/chunks/{chunk-H6LOSAC7.js → chunk-M34HMQMV.js} +39 -83
- package/chunks/{chunk-XGKFAPON.js → chunk-MRZ5A7LB.js} +4 -4
- package/chunks/chunk-O3I3LTTJ.js +24 -0
- package/chunks/{chunk-XQPB4OGW.js → chunk-O4DJIA6Y.js} +2 -19
- package/chunks/{action-B3IDMFFO.js → chunk-OKLL5422.js} +5 -243
- package/chunks/{chunk-RVZZQKVE.js → chunk-PMDHYIB4.js} +4 -22
- package/chunks/{chunk-BIYCLKLZ.js → chunk-RELSIFIL.js} +1 -1
- package/chunks/{chunk-QLKBXVUV.js → chunk-RGJPENX7.js} +1 -1
- package/chunks/{chunk-3KK72EMO.js → chunk-RHAQ4XBA.js} +3 -3
- package/chunks/{action-S7DB6MBK.js → chunk-RQ7QBRJT.js} +1 -82
- package/chunks/chunk-S3LY7RKP.js +54 -0
- package/chunks/{chunk-X2NZINNR.js → chunk-S5OGPH2P.js} +3 -3
- package/chunks/{chunk-VNMVAJ6X.js → chunk-U36HEOGO.js} +17 -21
- package/chunks/{chunk-CAD672DX.js → chunk-Y3CXAIAG.js} +1 -1
- package/chunks/{chunk-HNWIIDGX.js → chunk-Z7EH7CJC.js} +3 -3
- package/chunks/{chunk-SVDXXGEO.js → chunk-ZMJW5UWU.js} +3 -3
- package/chunks/{chunk-UI5PWDNE.js → chunk-ZQDAPKWX.js} +9 -16
- package/chunks/{create.action-PRZKNQHM.js → create.action-VA2ISPIM.js} +16 -17
- package/chunks/{delete.action-G7OAQBR5.js → delete.action-AIWMDGXV.js} +16 -17
- package/chunks/{delete.action-2BLCOX6Y.js → delete.action-GEN6OD7A.js} +16 -17
- package/chunks/{diff.action-KDOJQVJ5.js → diff.action-LBK656RN.js} +15 -14
- package/chunks/{get.action-IKO22SCB.js → get.action-5SWRNQ3D.js} +15 -14
- package/chunks/{get.action-HSYV5TFY.js → get.action-UPPPGGI4.js} +17 -18
- package/chunks/{list.action-KYIFUM3C.js → list.action-YJZBC25S.js} +17 -18
- package/chunks/{list.action-IVJS7UFI.js → list.action-YOWWC4I4.js} +19 -20
- package/chunks/{publish.action-2QIOUMVY.js → publish.action-QMVDHDJZ.js} +22 -21
- package/chunks/{update.action-XZD6T5UR.js → update.action-GFDZIGEP.js} +17 -18
- package/chunks/{update.action-7QATFOGP.js → update.action-SNGKPS7A.js} +16 -17
- package/index.js +194 -154
- package/package.json +11 -11
- package/skills/scalar-cli/SKILL.md +3 -2
- package/template.md +76 -2
- package/chunks/chunk-YTJ67DWS.js +0 -32
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
childReferenceContext
|
|
4
|
+
} from "./chunk-DWWY3LPC.js";
|
|
5
|
+
import {
|
|
6
|
+
writeFileAtomic
|
|
7
|
+
} from "./chunk-CNJ4TLU7.js";
|
|
2
8
|
import {
|
|
3
9
|
measureTime
|
|
4
10
|
} from "./chunk-KHDYYVYF.js";
|
|
@@ -10,7 +16,7 @@ import {
|
|
|
10
16
|
} from "./chunk-WGTZEX4Y.js";
|
|
11
17
|
import {
|
|
12
18
|
isAsyncApiDocument
|
|
13
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-CWCRBWA6.js";
|
|
14
20
|
import {
|
|
15
21
|
safeNormalize
|
|
16
22
|
} from "./chunk-A2MPF6GE.js";
|
|
@@ -18,7 +24,7 @@ import "./chunk-FDW4LC45.js";
|
|
|
18
24
|
import {
|
|
19
25
|
isYamlFileName
|
|
20
26
|
} from "./chunk-4ORL4MST.js";
|
|
21
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-KSY2GH53.js";
|
|
22
28
|
import {
|
|
23
29
|
output
|
|
24
30
|
} from "./chunk-T5HJUAWB.js";
|
|
@@ -26,11 +32,11 @@ import {
|
|
|
26
32
|
err,
|
|
27
33
|
ok
|
|
28
34
|
} from "./chunk-DUIMDHQQ.js";
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-Y3CXAIAG.js";
|
|
36
|
+
import "./chunk-5GZAGHKL.js";
|
|
31
37
|
import {
|
|
32
38
|
external_exports
|
|
33
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-JBMHCTZD.js";
|
|
34
40
|
import "./chunk-3MZYUBJ6.js";
|
|
35
41
|
|
|
36
42
|
// src/domains/document/join/action.ts
|
|
@@ -38,7 +44,9 @@ import fs from "node:fs/promises";
|
|
|
38
44
|
import path from "node:path";
|
|
39
45
|
import as from "ansis";
|
|
40
46
|
import YAML from "yaml";
|
|
41
|
-
import {
|
|
47
|
+
import {
|
|
48
|
+
bundle
|
|
49
|
+
} from "@scalar/json-magic/bundle";
|
|
42
50
|
import { fetchUrls, readFiles } from "@scalar/json-magic/bundle/plugins/node";
|
|
43
51
|
|
|
44
52
|
// src/domains/document/join/helpers.ts
|
|
@@ -177,8 +185,136 @@ var joinAsyncApi = (inputs, prefixes) => {
|
|
|
177
185
|
return conflicts.length ? { ok: false, conflicts } : { ok: true, document: result };
|
|
178
186
|
};
|
|
179
187
|
|
|
188
|
+
// src/domains/document/join/bundle.ts
|
|
189
|
+
import { randomUUID } from "node:crypto";
|
|
190
|
+
import {
|
|
191
|
+
bundleWithDiagnostics
|
|
192
|
+
} from "@scalar/json-magic/bundle";
|
|
193
|
+
var bundleJoinDocument = async (input, config) => {
|
|
194
|
+
const hidden = /* @__PURE__ */ new Map();
|
|
195
|
+
const documents = [];
|
|
196
|
+
const partials = /* @__PURE__ */ new WeakSet();
|
|
197
|
+
const diagnostics = [];
|
|
198
|
+
const mask = (document) => {
|
|
199
|
+
if (document !== null && typeof document === "object" && partials.has(document))
|
|
200
|
+
return;
|
|
201
|
+
documents.push(document);
|
|
202
|
+
const visited = /* @__PURE__ */ new WeakSet();
|
|
203
|
+
const swagger = document !== null && typeof document === "object" && "swagger" in document && document.swagger === "2.0";
|
|
204
|
+
const visit = (value, context) => {
|
|
205
|
+
if (value === null || typeof value !== "object" || visited.has(value))
|
|
206
|
+
return;
|
|
207
|
+
visited.add(value);
|
|
208
|
+
const api = ["openapi", "swagger", "asyncapi"].some((key) => key in value);
|
|
209
|
+
const schema = [
|
|
210
|
+
"type",
|
|
211
|
+
"$id",
|
|
212
|
+
"$schema",
|
|
213
|
+
"$defs",
|
|
214
|
+
"definitions",
|
|
215
|
+
"properties",
|
|
216
|
+
"patternProperties",
|
|
217
|
+
"dependentSchemas",
|
|
218
|
+
"dependencies",
|
|
219
|
+
"items",
|
|
220
|
+
"additionalItems",
|
|
221
|
+
"additionalProperties",
|
|
222
|
+
"unevaluatedItems",
|
|
223
|
+
"unevaluatedProperties",
|
|
224
|
+
"contains",
|
|
225
|
+
"contentSchema",
|
|
226
|
+
"propertyNames",
|
|
227
|
+
"not",
|
|
228
|
+
"if",
|
|
229
|
+
"then",
|
|
230
|
+
"else",
|
|
231
|
+
"allOf",
|
|
232
|
+
"anyOf",
|
|
233
|
+
"oneOf",
|
|
234
|
+
"prefixItems"
|
|
235
|
+
].some((key) => key in value) || "examples" in value && Array.isArray(value.examples);
|
|
236
|
+
const current = context === "object" && !api && schema ? "schema" : context;
|
|
237
|
+
for (const [key, child] of Object.entries(value)) {
|
|
238
|
+
if (value === document && key === (config.externalDocumentsKey ?? "x-ext"))
|
|
239
|
+
continue;
|
|
240
|
+
const next = Array.isArray(value) && !["objects", "schemas", "messages"].includes(current) ? current : childReferenceContext(current, key, swagger, "bundle");
|
|
241
|
+
if (next === "data" && child !== null && typeof child === "object") {
|
|
242
|
+
const token = randomUUID();
|
|
243
|
+
hidden.set(token, child);
|
|
244
|
+
Object.defineProperty(value, key, {
|
|
245
|
+
value: token,
|
|
246
|
+
enumerable: true,
|
|
247
|
+
configurable: true,
|
|
248
|
+
writable: true
|
|
249
|
+
});
|
|
250
|
+
} else visit(child, next);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
visit(document, "object");
|
|
254
|
+
};
|
|
255
|
+
const restore = (value, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
256
|
+
if (value === null || typeof value !== "object" || seen.has(value)) return;
|
|
257
|
+
seen.add(value);
|
|
258
|
+
for (const [key, child] of Object.entries(value)) {
|
|
259
|
+
if (typeof child === "string" && hidden.has(child)) {
|
|
260
|
+
Object.defineProperty(value, key, {
|
|
261
|
+
value: hidden.get(child),
|
|
262
|
+
enumerable: true,
|
|
263
|
+
configurable: true,
|
|
264
|
+
writable: true
|
|
265
|
+
});
|
|
266
|
+
restore(hidden.get(child), seen);
|
|
267
|
+
} else restore(child, seen);
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
const settings = {
|
|
271
|
+
...config,
|
|
272
|
+
traversal: "generic",
|
|
273
|
+
visitedNodes: config.visitedNodes ?? /* @__PURE__ */ new Set(),
|
|
274
|
+
hooks: {
|
|
275
|
+
...config.hooks,
|
|
276
|
+
resolveDocument: (document, origin) => {
|
|
277
|
+
const identity = config.hooks?.resolveDocument?.(document, origin);
|
|
278
|
+
mask(document);
|
|
279
|
+
return identity;
|
|
280
|
+
},
|
|
281
|
+
onAfterNodeProcess: async (node, context) => {
|
|
282
|
+
await config.hooks?.onAfterNodeProcess?.(node, context);
|
|
283
|
+
if (typeof node.$ref !== "string") return;
|
|
284
|
+
const children = Object.fromEntries(
|
|
285
|
+
Object.entries(node).filter(
|
|
286
|
+
([key, value]) => key !== "$ref" && key !== "$id" && value !== null && typeof value === "object"
|
|
287
|
+
)
|
|
288
|
+
);
|
|
289
|
+
if (!Object.keys(children).length) return;
|
|
290
|
+
const partial = { ...children, $id: context.origin };
|
|
291
|
+
partials.add(partial);
|
|
292
|
+
const nested = await bundleWithDiagnostics(partial, {
|
|
293
|
+
...settings,
|
|
294
|
+
origin: config.origin ?? (typeof input === "string" ? input : "/"),
|
|
295
|
+
root: context.rootNode,
|
|
296
|
+
cache: context.resolutionCache,
|
|
297
|
+
urlMap: true
|
|
298
|
+
});
|
|
299
|
+
diagnostics.push(...nested.diagnostics);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
try {
|
|
304
|
+
const result = await bundleWithDiagnostics(input, settings);
|
|
305
|
+
restore(result.document);
|
|
306
|
+
return {
|
|
307
|
+
...result,
|
|
308
|
+
complete: result.complete && diagnostics.length === 0,
|
|
309
|
+
diagnostics: [...result.diagnostics, ...diagnostics]
|
|
310
|
+
};
|
|
311
|
+
} finally {
|
|
312
|
+
for (const document of documents) restore(document);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
|
|
180
316
|
// src/domains/document/join/openapi.ts
|
|
181
|
-
import {
|
|
317
|
+
import { escapeJsonPointer } from "@scalar/json-magic/helpers/escape-json-pointer";
|
|
182
318
|
import { join } from "@scalar/json-magic/join";
|
|
183
319
|
import { upgrade as upgrade2 } from "@scalar/openapi-upgrader";
|
|
184
320
|
var omitEmptySection = (value) => {
|
|
@@ -186,45 +322,52 @@ var omitEmptySection = (value) => {
|
|
|
186
322
|
if (isDocument(value)) return Object.keys(value).length ? value : void 0;
|
|
187
323
|
return value ?? void 0;
|
|
188
324
|
};
|
|
189
|
-
var
|
|
190
|
-
|
|
325
|
+
var prepareReferences = async (document, componentPrefix, externalPrefix) => {
|
|
326
|
+
const rewrites = [];
|
|
327
|
+
await bundleJoinDocument(document, {
|
|
328
|
+
plugins: [],
|
|
191
329
|
treeShake: false,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
node.$ref =
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
type: "lifecycle",
|
|
208
|
-
onBeforeNodeProcess: (node, context) => {
|
|
209
|
-
if (context.path.length !== 2 || context.path[0] !== "components")
|
|
210
|
-
return;
|
|
211
|
-
for (const key of Object.keys(node)) {
|
|
212
|
-
const value = node[key];
|
|
213
|
-
delete node[key];
|
|
214
|
-
const name = `${prefix}${key}`;
|
|
215
|
-
if (!isPollutionKey(key) && !isPollutionKey(name))
|
|
216
|
-
node[name] = value;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
330
|
+
hooks: {
|
|
331
|
+
onAfterNodeProcess: (node, context) => {
|
|
332
|
+
if (typeof node.$ref !== "string") return;
|
|
333
|
+
const target = context.resolveReference(node.$ref);
|
|
334
|
+
if (!target || target.resourceRelative) return;
|
|
335
|
+
const parts = [...target.path];
|
|
336
|
+
const offset = parts[0] === "components" ? 2 : parts[0] === "x-ext" ? 1 : void 0;
|
|
337
|
+
if (offset === void 0 || parts[offset] === void 0) return;
|
|
338
|
+
parts[offset] = (offset === 2 ? componentPrefix : externalPrefix) + parts[offset];
|
|
339
|
+
const reference = "#/" + parts.map((part) => encodeURIComponent(escapeJsonPointer(part))).join("/");
|
|
340
|
+
rewrites.push(() => {
|
|
341
|
+
node.$ref = reference;
|
|
342
|
+
});
|
|
219
343
|
}
|
|
220
|
-
|
|
344
|
+
}
|
|
221
345
|
});
|
|
346
|
+
for (const rewrite of rewrites) rewrite();
|
|
347
|
+
const rename = (entries, prefix) => Object.fromEntries(
|
|
348
|
+
Object.entries(entries).filter(
|
|
349
|
+
([key]) => !isPollutionKey(key) && !isPollutionKey(prefix + key)
|
|
350
|
+
).map(([key, value]) => [prefix + key, value])
|
|
351
|
+
);
|
|
352
|
+
if (isDocument(document.components)) {
|
|
353
|
+
for (const [kind, entries] of Object.entries(document.components)) {
|
|
354
|
+
if (isDocument(entries))
|
|
355
|
+
document.components[kind] = rename(entries, componentPrefix);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (isDocument(document["x-ext"])) {
|
|
359
|
+
document["x-ext"] = rename(document["x-ext"], externalPrefix);
|
|
360
|
+
}
|
|
222
361
|
};
|
|
223
362
|
var joinOpenApi = async (inputs, prefixes) => {
|
|
224
363
|
const documents = await Promise.all(
|
|
225
364
|
inputs.map(async (input, index) => {
|
|
226
365
|
const document = upgrade2(structuredClone(input), "3.1");
|
|
227
|
-
await
|
|
366
|
+
await prepareReferences(
|
|
367
|
+
document,
|
|
368
|
+
prefixes[index] ?? "",
|
|
369
|
+
`document${index}-`
|
|
370
|
+
);
|
|
228
371
|
return {
|
|
229
372
|
...document,
|
|
230
373
|
info: isDocument(document.info) ? document.info : {},
|
|
@@ -241,6 +384,7 @@ var joinOpenApi = async (inputs, prefixes) => {
|
|
|
241
384
|
const [field] = path2;
|
|
242
385
|
if (isPollutionKey(path2.at(-1) ?? "") && (field === "info" || field === "components" || path2.length === 2))
|
|
243
386
|
return "skip";
|
|
387
|
+
if (field === "x-ext") return path2.length === 1 ? "merge" : "replace";
|
|
244
388
|
if (field === "info") return "merge-by-index";
|
|
245
389
|
if (field === "tags") return { uniqueBy: "name" };
|
|
246
390
|
if (field === "servers") return { uniqueBy: "url" };
|
|
@@ -292,6 +436,9 @@ var formatErrorMessage = (conflicts) => {
|
|
|
292
436
|
return `Webhook '${conflict.path} ${conflict.method}' has conflicts`;
|
|
293
437
|
});
|
|
294
438
|
};
|
|
439
|
+
var formatReferenceDiagnostics = (diagnostics) => diagnostics.map(
|
|
440
|
+
({ source, pointer, reference, kind }) => `${source}${pointer}: ${kind === "missing-target" ? "Missing target" : "Could not load document"} for ${reference}`
|
|
441
|
+
).join("\n");
|
|
295
442
|
async function joinAction(rawInput, rawOpt) {
|
|
296
443
|
const { error, data: input } = external_exports.array(external_exports.string()).safeParse(rawInput);
|
|
297
444
|
if (error) {
|
|
@@ -326,12 +473,27 @@ async function joinAction(rawInput, rawOpt) {
|
|
|
326
473
|
return output.error().title("Cannot join OpenAPI and AsyncAPI documents together").exit("error");
|
|
327
474
|
}
|
|
328
475
|
const specification = asyncApiCount ? "AsyncAPI" : "OpenAPI";
|
|
329
|
-
const documents =
|
|
476
|
+
const documents = await Promise.all(
|
|
330
477
|
input.map(async (file) => {
|
|
331
|
-
const
|
|
478
|
+
const bundleInput = asyncApiCount ? async (source, config) => ({
|
|
479
|
+
document: await bundle(source, config),
|
|
480
|
+
complete: true,
|
|
481
|
+
diagnostics: []
|
|
482
|
+
}) : bundleJoinDocument;
|
|
483
|
+
const bundled = await bundleInput(path.resolve(file), {
|
|
332
484
|
plugins: [readFiles(), fetchUrls()],
|
|
333
485
|
treeShake: false
|
|
486
|
+
}).catch((error2) => {
|
|
487
|
+
return output.error().title("Invalid input").message(
|
|
488
|
+
`${file}: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
489
|
+
).exit("error");
|
|
334
490
|
});
|
|
491
|
+
const document = bundled.document;
|
|
492
|
+
if (!asyncApiCount && !bundled.complete) {
|
|
493
|
+
return output.error().title("Invalid reference").message(
|
|
494
|
+
`${file}: ${formatReferenceDiagnostics(bundled.diagnostics)}`
|
|
495
|
+
).exit("error");
|
|
496
|
+
}
|
|
335
497
|
if (!isDocument(document)) {
|
|
336
498
|
return output.error().title("Invalid input").message(
|
|
337
499
|
"Could not read an API document from one of the input files. Provide valid JSON or YAML files."
|
|
@@ -339,10 +501,10 @@ async function joinAction(rawInput, rawOpt) {
|
|
|
339
501
|
}
|
|
340
502
|
return document;
|
|
341
503
|
})
|
|
342
|
-
)
|
|
504
|
+
);
|
|
343
505
|
const prefixes = opts.prefixComponentsWithPathValue ? getPrefixes(files, opts.prefixComponentsWithPathValue) : [];
|
|
344
506
|
const { executionTimeMs, result } = await measureTime(async () => {
|
|
345
|
-
if (!asyncApiCount) return joinOpenApi(
|
|
507
|
+
if (!asyncApiCount) return joinOpenApi(documents, prefixes);
|
|
346
508
|
const joined = joinAsyncApi(documents, prefixes);
|
|
347
509
|
return joined.ok ? ok(joined.document) : err(joined.conflicts);
|
|
348
510
|
});
|
|
@@ -350,12 +512,24 @@ async function joinAction(rawInput, rawOpt) {
|
|
|
350
512
|
return output.error().title(`Failed to join ${specification} documents`).line().line(`Conflicts:
|
|
351
513
|
${formatErrorMessage(result.error).join("\n")}`).line().exit("error");
|
|
352
514
|
}
|
|
515
|
+
if (!asyncApiCount) {
|
|
516
|
+
const resolved = await bundleJoinDocument(result.data, {
|
|
517
|
+
plugins: [],
|
|
518
|
+
treeShake: false
|
|
519
|
+
});
|
|
520
|
+
if (!resolved.complete) {
|
|
521
|
+
return output.error().title("Invalid reference in joined API description").message(formatReferenceDiagnostics(resolved.diagnostics)).exit("error");
|
|
522
|
+
}
|
|
523
|
+
}
|
|
353
524
|
const isYaml = isYamlFileName(opts.output);
|
|
354
|
-
await
|
|
525
|
+
const written = await writeFileAtomic(
|
|
355
526
|
opts.output,
|
|
356
|
-
isYaml ? YAML.stringify(result.data) : JSON.stringify(result.data, null, 2)
|
|
357
|
-
"utf8"
|
|
527
|
+
isYaml ? YAML.stringify(result.data) : JSON.stringify(result.data, null, 2)
|
|
358
528
|
);
|
|
529
|
+
if (!written.ok)
|
|
530
|
+
return output.error().message(
|
|
531
|
+
`Could not write joined API description to ${opts.output}: ${written.error}`
|
|
532
|
+
).exit("error");
|
|
359
533
|
output.info().message(
|
|
360
534
|
`${as.green(`${specification} descriptions joined`)} (${as.white(`${as.bold(`${Math.round(executionTimeMs)}`)} ms`)})`
|
|
361
535
|
).line(`Written to ${as.cyan(opts.output)}`).print();
|
|
@@ -2,14 +2,15 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
|
|
|
2
2
|
import {
|
|
3
3
|
readAndParseConfig,
|
|
4
4
|
renderConfigError
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-KI2AVDKM.js";
|
|
6
|
+
import "./chunk-S3LY7RKP.js";
|
|
7
|
+
import "./chunk-M34HMQMV.js";
|
|
7
8
|
import {
|
|
8
9
|
output
|
|
9
10
|
} from "./chunk-T5HJUAWB.js";
|
|
10
11
|
import "./chunk-DUIMDHQQ.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-RGJPENX7.js";
|
|
13
|
+
import "./chunk-JBMHCTZD.js";
|
|
13
14
|
import "./chunk-3MZYUBJ6.js";
|
|
14
15
|
|
|
15
16
|
// src/domains/project/check-config/action.ts
|
|
@@ -2,18 +2,18 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
|
|
|
2
2
|
import {
|
|
3
3
|
getFileOrUrl
|
|
4
4
|
} from "./chunk-WGTZEX4Y.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-CWCRBWA6.js";
|
|
6
6
|
import "./chunk-A2MPF6GE.js";
|
|
7
7
|
import "./chunk-FDW4LC45.js";
|
|
8
8
|
import "./chunk-4ORL4MST.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-KSY2GH53.js";
|
|
10
10
|
import {
|
|
11
11
|
output
|
|
12
12
|
} from "./chunk-T5HJUAWB.js";
|
|
13
13
|
import "./chunk-DUIMDHQQ.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-Y3CXAIAG.js";
|
|
15
|
+
import "./chunk-5GZAGHKL.js";
|
|
16
|
+
import "./chunk-JBMHCTZD.js";
|
|
17
17
|
import "./chunk-3MZYUBJ6.js";
|
|
18
18
|
|
|
19
19
|
// src/domains/document/markdown/action.ts
|
|
@@ -8,44 +8,45 @@ import {
|
|
|
8
8
|
import "./chunk-AEFPCC4U.js";
|
|
9
9
|
import {
|
|
10
10
|
getPublishUrl
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-I25ZCHBJ.js";
|
|
12
|
+
import "./chunk-O3I3LTTJ.js";
|
|
13
|
+
import "./chunk-PMDHYIB4.js";
|
|
14
|
+
import "./chunk-O4DJIA6Y.js";
|
|
13
15
|
import {
|
|
14
16
|
BaseCollections
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KWQVA66H.js";
|
|
16
18
|
import {
|
|
17
19
|
getDatabaseClient
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-Z7EH7CJC.js";
|
|
19
21
|
import {
|
|
20
22
|
apiService
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-U36HEOGO.js";
|
|
24
|
+
import "./chunk-MRZ5A7LB.js";
|
|
25
|
+
import "./chunk-CYIGEQOJ.js";
|
|
26
|
+
import "./chunk-4BMOCIYO.js";
|
|
27
|
+
import "./chunk-F6E7FJEC.js";
|
|
28
|
+
import "./chunk-DVA4NCCY.js";
|
|
27
29
|
import "./chunk-BIQFYZP6.js";
|
|
28
30
|
import "./chunk-RE5Z56QD.js";
|
|
29
31
|
import "./chunk-4ORL4MST.js";
|
|
30
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-KSY2GH53.js";
|
|
31
33
|
import "./chunk-VUXPDHTQ.js";
|
|
32
34
|
import {
|
|
33
35
|
getAuthData
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-3BZ3VY6H.js";
|
|
36
|
+
} from "./chunk-ZMJW5UWU.js";
|
|
37
|
+
import "./chunk-7LUXRNKV.js";
|
|
37
38
|
import {
|
|
38
39
|
output,
|
|
39
40
|
printTable
|
|
40
41
|
} from "./chunk-T5HJUAWB.js";
|
|
41
42
|
import "./chunk-DUIMDHQQ.js";
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-Y3CXAIAG.js";
|
|
44
|
+
import "./chunk-GXKNYM54.js";
|
|
44
45
|
import {
|
|
45
46
|
publishRecordSchema
|
|
46
|
-
} from "./chunk-
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
47
|
+
} from "./chunk-RGJPENX7.js";
|
|
48
|
+
import "./chunk-5GZAGHKL.js";
|
|
49
|
+
import "./chunk-JBMHCTZD.js";
|
|
49
50
|
import "./chunk-3MZYUBJ6.js";
|
|
50
51
|
|
|
51
52
|
// src/domains/project/list/action.ts
|
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
BaseCollections
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KWQVA66H.js";
|
|
5
5
|
import {
|
|
6
6
|
getDatabaseClient
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-Z7EH7CJC.js";
|
|
8
|
+
import "./chunk-MRZ5A7LB.js";
|
|
9
|
+
import "./chunk-CYIGEQOJ.js";
|
|
10
|
+
import "./chunk-4BMOCIYO.js";
|
|
11
|
+
import "./chunk-DVA4NCCY.js";
|
|
12
12
|
import "./chunk-RE5Z56QD.js";
|
|
13
13
|
import "./chunk-4ORL4MST.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-KSY2GH53.js";
|
|
15
15
|
import "./chunk-VUXPDHTQ.js";
|
|
16
16
|
import {
|
|
17
17
|
getAuthData
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-3BZ3VY6H.js";
|
|
18
|
+
} from "./chunk-ZMJW5UWU.js";
|
|
19
|
+
import "./chunk-7LUXRNKV.js";
|
|
21
20
|
import {
|
|
22
21
|
output
|
|
23
22
|
} from "./chunk-T5HJUAWB.js";
|
|
24
23
|
import "./chunk-DUIMDHQQ.js";
|
|
25
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-Y3CXAIAG.js";
|
|
26
25
|
import {
|
|
27
26
|
teamSchema
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
27
|
+
} from "./chunk-GXKNYM54.js";
|
|
28
|
+
import "./chunk-RGJPENX7.js";
|
|
29
|
+
import "./chunk-5GZAGHKL.js";
|
|
30
|
+
import "./chunk-JBMHCTZD.js";
|
|
32
31
|
import "./chunk-3MZYUBJ6.js";
|
|
33
32
|
|
|
34
33
|
// src/domains/auth/whoami/action.ts
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-WGTZEX4Y.js";
|
|
10
10
|
import {
|
|
11
11
|
isAsyncApiContent
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CWCRBWA6.js";
|
|
13
13
|
import "./chunk-A2MPF6GE.js";
|
|
14
14
|
import "./chunk-FDW4LC45.js";
|
|
15
15
|
import {
|
|
@@ -18,20 +18,19 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
isUrl
|
|
20
20
|
} from "./chunk-4ORL4MST.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-KSY2GH53.js";
|
|
22
22
|
import "./chunk-VUXPDHTQ.js";
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-3BZ3VY6H.js";
|
|
23
|
+
import "./chunk-ZMJW5UWU.js";
|
|
24
|
+
import "./chunk-7LUXRNKV.js";
|
|
26
25
|
import {
|
|
27
26
|
output
|
|
28
27
|
} from "./chunk-T5HJUAWB.js";
|
|
29
28
|
import "./chunk-DUIMDHQQ.js";
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
34
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-Y3CXAIAG.js";
|
|
30
|
+
import "./chunk-GXKNYM54.js";
|
|
31
|
+
import "./chunk-RGJPENX7.js";
|
|
32
|
+
import "./chunk-5GZAGHKL.js";
|
|
33
|
+
import "./chunk-JBMHCTZD.js";
|
|
35
34
|
import "./chunk-3MZYUBJ6.js";
|
|
36
35
|
|
|
37
36
|
// src/domains/document/mock/action.ts
|
|
@@ -122,7 +121,7 @@ function getMethodColor(method) {
|
|
|
122
121
|
async function mockAction(fileArgument, { watch, port }) {
|
|
123
122
|
const content = await getFileOrUrl(fileArgument);
|
|
124
123
|
if (isAsyncApiContent(content)) {
|
|
125
|
-
const { mockAsyncApi } = await import("./asyncapi-
|
|
124
|
+
const { mockAsyncApi } = await import("./asyncapi-DVBS23QW.js");
|
|
126
125
|
return mockAsyncApi(fileArgument, { watch, port });
|
|
127
126
|
}
|
|
128
127
|
const origin = isUrl(fileArgument) ? fileArgument : path2.resolve(fileArgument);
|
|
@@ -2,20 +2,20 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
|
|
|
2
2
|
import {
|
|
3
3
|
getFileOrUrl
|
|
4
4
|
} from "./chunk-WGTZEX4Y.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-CWCRBWA6.js";
|
|
6
6
|
import "./chunk-A2MPF6GE.js";
|
|
7
7
|
import "./chunk-FDW4LC45.js";
|
|
8
8
|
import {
|
|
9
9
|
isYamlFileName
|
|
10
10
|
} from "./chunk-4ORL4MST.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-KSY2GH53.js";
|
|
12
12
|
import {
|
|
13
13
|
output
|
|
14
14
|
} from "./chunk-T5HJUAWB.js";
|
|
15
15
|
import "./chunk-DUIMDHQQ.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-Y3CXAIAG.js";
|
|
17
|
+
import "./chunk-5GZAGHKL.js";
|
|
18
|
+
import "./chunk-JBMHCTZD.js";
|
|
19
19
|
import "./chunk-3MZYUBJ6.js";
|
|
20
20
|
|
|
21
21
|
// src/domains/document/postman/action.ts
|
|
@@ -4,26 +4,25 @@ import {
|
|
|
4
4
|
} from "./chunk-SNQFFEYH.js";
|
|
5
5
|
import {
|
|
6
6
|
apiService
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-U36HEOGO.js";
|
|
8
|
+
import "./chunk-MRZ5A7LB.js";
|
|
9
|
+
import "./chunk-CYIGEQOJ.js";
|
|
10
|
+
import "./chunk-4BMOCIYO.js";
|
|
11
|
+
import "./chunk-F6E7FJEC.js";
|
|
12
|
+
import "./chunk-DVA4NCCY.js";
|
|
13
13
|
import "./chunk-BIQFYZP6.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-3BZ3VY6H.js";
|
|
14
|
+
import "./chunk-KSY2GH53.js";
|
|
15
|
+
import "./chunk-ZMJW5UWU.js";
|
|
16
|
+
import "./chunk-7LUXRNKV.js";
|
|
18
17
|
import {
|
|
19
18
|
output
|
|
20
19
|
} from "./chunk-T5HJUAWB.js";
|
|
21
20
|
import "./chunk-DUIMDHQQ.js";
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-Y3CXAIAG.js";
|
|
22
|
+
import "./chunk-GXKNYM54.js";
|
|
23
|
+
import "./chunk-RGJPENX7.js";
|
|
24
|
+
import "./chunk-5GZAGHKL.js";
|
|
25
|
+
import "./chunk-JBMHCTZD.js";
|
|
27
26
|
import "./chunk-3MZYUBJ6.js";
|
|
28
27
|
|
|
29
28
|
// src/domains/registry/delete/action.ts
|