@redocly/replay 0.28.0-next.9 → 0.28.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/dist/{replay-AiChatProvider-B_f9Wn8a.js → replay-AiChatProvider-BRqjyy2W.js} +2 -2
- package/dist/{replay-AiChatProvider-DuTK5g1N.js → replay-AiChatProvider-DUVoLgY2.js} +138 -140
- package/dist/{replay-AiChatSqliteDBStorage-cXsRIQfJ.js → replay-AiChatSqliteDBStorage-0evx56pl.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-CHfMo6M6.js → replay-AiChatSqliteDBStorage-C5AnRloD.js} +1 -1
- package/dist/{replay-AiPanel-CGbGwIMX.js → replay-AiPanel-CMjVD12K.js} +50 -50
- package/dist/{replay-AiPanel-C_C52r20.js → replay-AiPanel-PVgJioX3.js} +2 -2
- package/dist/replay-FileWatcher-CFYprlWN.js +364 -0
- package/dist/replay-FileWatcher-DGLwO5Kd.js +1 -0
- package/dist/{replay-SemanticSearchService-BLF1oOOu.js → replay-SemanticSearchService-Bh5xYa91.js} +15 -15
- package/dist/{replay-SemanticSearchService-DTc0oxN4.js → replay-SemanticSearchService-CulKCCNl.js} +1 -1
- package/dist/{replay-SqliteDBStorage-DF9kKplR.js → replay-SqliteDBStorage-Bz0muHEk.js} +1 -1
- package/dist/{replay-SqliteDBStorage-B_kyJ0a3.js → replay-SqliteDBStorage-CVHRAsPD.js} +1 -1
- package/dist/replay-TauriFileSystemAdapter-B163-f2D.js +108 -0
- package/dist/replay-TauriFileSystemAdapter-D4bOmvzP.js +1 -0
- package/dist/{replay-TauriRootStorage-Den8gI4S.js → replay-TauriRootStorage-2MPQE-3f.js} +192 -188
- package/dist/replay-TauriRootStorage-CjWUrnWz.js +1 -0
- package/dist/{replay-agent-loop-B8Mjb8DU.js → replay-agent-loop-BgYyBo9e.js} +3 -3
- package/dist/{replay-agent-loop-Z_nrrmg_.js → replay-agent-loop-DYDFXAZj.js} +1 -1
- package/dist/{replay-ai-chat-mappers-D7e8buTk.js → replay-ai-chat-mappers-BEwNRQPV.js} +1 -1
- package/dist/{replay-ai-chat-mappers-aJ_VMb6Z.js → replay-ai-chat-mappers-CMtNqQHX.js} +1 -1
- package/dist/{replay-create-model-Bw20x80b.js → replay-create-model-B2ZsGTjs.js} +3 -3
- package/dist/{replay-create-model-Be3vPVDb.js → replay-create-model-DPxfOEfv.js} +4 -4
- package/dist/{replay-db-BQXljNM0.js → replay-db-C9iqyMet.js} +1 -1
- package/dist/{replay-db-BmZNrdZM.js → replay-db-D4-LmLRk.js} +1 -1
- package/dist/{replay-external-resolver-BQvSDNfH.js → replay-external-resolver-BXgVrfzk.js} +2 -2
- package/dist/{replay-external-resolver-BLzbbtnT.js → replay-external-resolver-CTUbNZGW.js} +1 -1
- package/dist/{replay-index-BCz452N6.js → replay-index-4TEahAPK.js} +21604 -21055
- package/dist/{replay-index-C0kvTxxm.js → replay-index-B4U7iZuq.js} +41 -41
- package/dist/{replay-index-DAIwC3ls.js → replay-index-B8O3wYqo.js} +1 -1
- package/dist/{replay-index-C7y4K4Cr.js → replay-index-Bdg7noSD.js} +1 -1
- package/dist/replay-index-CG9VN2JQ.js +4 -0
- package/dist/{replay-index-B-uZhXHj.js → replay-index-DcC173cC.js} +1 -1
- package/dist/{replay-index-DYtXcqDk.js → replay-index-Nz5obVS5.js} +1131 -1131
- package/dist/{replay-index-wBHsAQEV.js → replay-index-q63USe25.js} +1 -1
- package/dist/{replay-lint-BzkTeXqI.js → replay-lint-4XFKTmSY.js} +97 -97
- package/dist/{replay-lint-graphql-BZF2eLiZ.js → replay-lint-graphql-BsBWkZ6L.js} +1 -1
- package/dist/{replay-lint-graphql-BDBGJSir.js → replay-lint-graphql-De2eDZnT.js} +1 -1
- package/dist/{replay-lint-CqDMOMQt.js → replay-lint-s7ylMBWz.js} +6100 -6063
- package/dist/{replay-periodic-revalidation-C7SkB1vs.js → replay-periodic-revalidation-BMFP7f-u.js} +1 -1
- package/dist/{replay-periodic-revalidation-orCv_JoF.js → replay-periodic-revalidation-DJbblUef.js} +1 -1
- package/dist/{replay-resolve-DZMWoig2.js → replay-resolve-BtNxNrKo.js} +1 -1
- package/dist/{replay-resolve-0e5f8I7b.js → replay-resolve-BueEsOnR.js} +1 -1
- package/dist/{replay-respect-run-ChP63WzG.js → replay-respect-run-B_dJjlti.js} +1 -1
- package/dist/{replay-respect-run-CLW3wGhx.js → replay-respect-run-Dfpbcsns.js} +3 -3
- package/dist/{replay-tauri-path-DBt1dqkG.js → replay-tauri-path-Bht3XIt7.js} +1 -1
- package/dist/{replay-tauri-path-DvLF4Z8f.js → replay-tauri-path-CiuYXh_j.js} +2 -2
- package/dist/replay-useAiChatQueries-02CRdEPJ.js +215 -0
- package/dist/{replay-useAiChatQueries-S6v5duiJ.js → replay-useAiChatQueries-D2hh5omV.js} +994 -945
- package/dist/{replay-validate-key-CNl7BV_v.js → replay-validate-key-ALwOF1Ux.js} +1 -1
- package/dist/{replay-validate-key-CMJODIH6.js → replay-validate-key-B7fbWbfv.js} +2 -2
- package/dist/replay.cjs +1 -1
- package/dist/replay.d.ts +5 -0
- package/dist/replay.js +8 -8
- package/package.json +5 -5
- package/dist/replay-FileWatcher-DEOB0_DG.js +0 -1
- package/dist/replay-FileWatcher-Z6eygcBI.js +0 -359
- package/dist/replay-TauriFileSystemAdapter-CwSMakdJ.js +0 -1
- package/dist/replay-TauriFileSystemAdapter-DcFBYSUW.js +0 -99
- package/dist/replay-TauriRootStorage-DEGEIJrz.js +0 -1
- package/dist/replay-index-gM6vL6iT.js +0 -4
- package/dist/replay-useAiChatQueries-Bypgnkwa.js +0 -215
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { k as I, l as T, m as z, t as P, A as
|
|
3
|
-
import {
|
|
4
|
-
import { i as B, B as E, n as
|
|
5
|
-
import { R as ds, S as gs, Y as hs, e as us, g as Es, b as vs, c as Ss, d as xs, f as Ts, h as bs, j as Os, p as
|
|
1
|
+
import { _ as x, $ as f } from "./replay-index-4TEahAPK.js";
|
|
2
|
+
import { k as I, l as T, m as z, t as P, A as L, S as V, N as $, n as M, w as U, J as Y, o as G, p as b, q as D } from "./replay-lint-s7ylMBWz.js";
|
|
3
|
+
import { r as he, s as ue, u as Ee, x as ve, C as Se, y as xe, z as Te, B as be, E as Oe, F as _e, H as Re, I as Ne, M as Ie, P as Pe, Q as De, R as ke, U as Ce, V as je, W as we, X as Fe, Y as ze, Z as Le, _ as Ve, $ as $e, a0 as Me, a1 as Ue, a2 as Ye, a3 as Ge, a4 as Be, a5 as Je, a6 as Ke, a7 as We, a8 as He, a9 as qe, aa as Xe, ab as Qe, ac as Ze, ad as Ae, ae as es, af as ss, ag as ts, ah as ns, ai as as, aj as os, ak as rs, al as is, am as ls, an as cs, ao as ps, ae as ys, ap as fs } from "./replay-lint-s7ylMBWz.js";
|
|
4
|
+
import { i as B, B as E, n as J, a as K, m as k } from "./replay-resolve-BtNxNrKo.js";
|
|
5
|
+
import { R as ds, S as gs, Y as hs, e as us, g as Es, b as vs, c as Ss, d as xs, f as Ts, h as bs, j as Os, p as _s, r as Rs, k as Ns, s as Is, u as Ps } from "./replay-resolve-BtNxNrKo.js";
|
|
6
6
|
function re(e) {
|
|
7
7
|
return (x.extname(e) === ".yaml" || x.extname(e) === ".yml") && !1;
|
|
8
8
|
}
|
|
@@ -13,7 +13,7 @@ async function le(e) {
|
|
|
13
13
|
return new Promise((s) => setTimeout(s, e));
|
|
14
14
|
}
|
|
15
15
|
const v = "type", O = ["api-description", "api-operation", "data-schema"];
|
|
16
|
-
function
|
|
16
|
+
function W(e, s) {
|
|
17
17
|
const { ctx: t } = T("EntityFileDefault", s), { ctx: a, discriminatorResolver: n } = T("EntityFile", e);
|
|
18
18
|
return {
|
|
19
19
|
entityTypes: {
|
|
@@ -264,7 +264,7 @@ const ce = (e) => ({
|
|
|
264
264
|
S(e);
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
}),
|
|
267
|
+
}), H = /^[a-z0-9]+(?:-[a-z0-9]+)*$/, _ = 2, R = 150, q = () => ({
|
|
268
268
|
any(e, { report: s, location: t }) {
|
|
269
269
|
if (f(e) && "key" in e) {
|
|
270
270
|
const a = e.key;
|
|
@@ -275,13 +275,13 @@ const ce = (e) => ({
|
|
|
275
275
|
});
|
|
276
276
|
return;
|
|
277
277
|
}
|
|
278
|
-
a.length <
|
|
279
|
-
message: `Entity 'key' must be at least ${
|
|
278
|
+
a.length < _ && s({
|
|
279
|
+
message: `Entity 'key' must be at least ${_} characters long.`,
|
|
280
280
|
location: t.child(["key"])
|
|
281
|
-
}), a.length >
|
|
282
|
-
message: `Entity 'key' must not exceed ${
|
|
281
|
+
}), a.length > R && s({
|
|
282
|
+
message: `Entity 'key' must not exceed ${R} characters.`,
|
|
283
283
|
location: t.child(["key"])
|
|
284
|
-
}),
|
|
284
|
+
}), H.test(a) || s({
|
|
285
285
|
message: "Entity `key` must contain only lowercase letters, numbers, and hyphens, and cannot start or end with a hyphen.",
|
|
286
286
|
location: t.child(["key"])
|
|
287
287
|
});
|
|
@@ -292,7 +292,7 @@ function N(e, s) {
|
|
|
292
292
|
const a = s.split("-").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join("") + e;
|
|
293
293
|
return Object.values(P).includes(a) ? a : e;
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function X(e, s) {
|
|
296
296
|
const t = {};
|
|
297
297
|
for (const [a, n] of Object.entries(s))
|
|
298
298
|
if (C(a, n)) {
|
|
@@ -362,7 +362,7 @@ async function se(e) {
|
|
|
362
362
|
problems: [],
|
|
363
363
|
specVersion: "entity",
|
|
364
364
|
visitorsData: {}
|
|
365
|
-
}, { entityTypes: r, discriminatorResolver: m } =
|
|
365
|
+
}, { entityTypes: r, discriminatorResolver: m } = W(t, a), p = J(r);
|
|
366
366
|
let y = p.Entity;
|
|
367
367
|
if (Array.isArray(s.parsed))
|
|
368
368
|
y = p.EntityFileArray;
|
|
@@ -375,7 +375,7 @@ async function se(e) {
|
|
|
375
375
|
u && typeof u == "string" && p[u] && (y = p[u]);
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
const g =
|
|
378
|
+
const g = L(l), d = Array.isArray(g) ? g.map((h) => ({
|
|
379
379
|
severity: n || "error",
|
|
380
380
|
ruleId: "entity assertions",
|
|
381
381
|
visitor: h
|
|
@@ -389,7 +389,7 @@ async function se(e) {
|
|
|
389
389
|
{
|
|
390
390
|
severity: n || "error",
|
|
391
391
|
ruleId: "entity struct",
|
|
392
|
-
visitor:
|
|
392
|
+
visitor: V()
|
|
393
393
|
},
|
|
394
394
|
{
|
|
395
395
|
severity: n || "error",
|
|
@@ -399,15 +399,15 @@ async function se(e) {
|
|
|
399
399
|
{
|
|
400
400
|
severity: n || "error",
|
|
401
401
|
ruleId: "entity key-valid",
|
|
402
|
-
visitor:
|
|
402
|
+
visitor: q()
|
|
403
403
|
},
|
|
404
404
|
...d
|
|
405
|
-
], w =
|
|
405
|
+
], w = M(j, p), F = await K({
|
|
406
406
|
rootDocument: s,
|
|
407
407
|
rootType: y,
|
|
408
408
|
externalRefResolver: o
|
|
409
409
|
});
|
|
410
|
-
return
|
|
410
|
+
return U({
|
|
411
411
|
document: s,
|
|
412
412
|
rootType: y,
|
|
413
413
|
normalizedVisitors: w,
|
|
@@ -418,9 +418,9 @@ async function se(e) {
|
|
|
418
418
|
async function fe(e, s, t) {
|
|
419
419
|
if (!s.rules)
|
|
420
420
|
throw new Error(`Scorecard level "${s.name}" has no rules defined.`);
|
|
421
|
-
const a = new E(), n = k(JSON.stringify(e, null, 2), "entity"), o = n.parsed[v], l =
|
|
421
|
+
const a = new E(), n = k(JSON.stringify(e, null, 2), "entity"), o = n.parsed[v], l = X(o || "unknown", s.rules), { entityRules: c, apiRules: r } = Q(l), m = await se({
|
|
422
422
|
document: n,
|
|
423
|
-
entitySchema:
|
|
423
|
+
entitySchema: Y,
|
|
424
424
|
entityDefaultSchema: G,
|
|
425
425
|
externalRefResolver: a,
|
|
426
426
|
assertionConfig: c
|
|
@@ -491,8 +491,8 @@ export {
|
|
|
491
491
|
Te as Config,
|
|
492
492
|
be as ConfigTypes,
|
|
493
493
|
Oe as ConfigValidationError,
|
|
494
|
-
|
|
495
|
-
|
|
494
|
+
_e as DEFAULT_CONFIG,
|
|
495
|
+
Re as DEFAULT_PROJECT_PLUGIN_PATHS,
|
|
496
496
|
me as HandledError,
|
|
497
497
|
Ne as IGNORE_BANNER,
|
|
498
498
|
Ie as IGNORE_FILE,
|
|
@@ -510,26 +510,26 @@ export {
|
|
|
510
510
|
ce as StatsOAS,
|
|
511
511
|
hs as YamlParseError,
|
|
512
512
|
ze as bundle,
|
|
513
|
-
|
|
514
|
-
|
|
513
|
+
Le as bundleDocument,
|
|
514
|
+
Ve as bundleFromString,
|
|
515
515
|
$e as clearPluginsCache,
|
|
516
516
|
b as createConfig,
|
|
517
|
-
|
|
518
|
-
|
|
517
|
+
Me as createConfigTypes,
|
|
518
|
+
W as createEntityTypes,
|
|
519
519
|
z as dequal,
|
|
520
|
-
|
|
520
|
+
Ue as detectSpec,
|
|
521
521
|
re as doesYamlFileExist,
|
|
522
522
|
us as escapePointerFragment,
|
|
523
|
-
|
|
523
|
+
Ye as findConfig,
|
|
524
524
|
Ge as formatProblems,
|
|
525
525
|
Be as getAstNodeByPointer,
|
|
526
|
-
|
|
526
|
+
Je as getCodeframe,
|
|
527
527
|
Es as getDir,
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
528
|
+
Ke as getLineColLocation,
|
|
529
|
+
We as getMajorSpecVersion,
|
|
530
|
+
He as getPluginCacheVersion,
|
|
531
|
+
qe as getTotals,
|
|
532
|
+
Xe as getTypes,
|
|
533
533
|
vs as isAbsoluteUrl,
|
|
534
534
|
Ss as isBrowser,
|
|
535
535
|
I as isEmptyObject,
|
|
@@ -555,20 +555,20 @@ export {
|
|
|
555
555
|
os as logger,
|
|
556
556
|
k as makeDocumentFromString,
|
|
557
557
|
rs as mapTypeToComponent,
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
558
|
+
J as normalizeTypes,
|
|
559
|
+
M as normalizeVisitors,
|
|
560
|
+
_s as parseYaml,
|
|
561
561
|
le as pause,
|
|
562
562
|
is as pluralize,
|
|
563
|
-
|
|
563
|
+
Rs as readFileFromUrl,
|
|
564
564
|
ls as regexFromString,
|
|
565
|
-
|
|
565
|
+
K as resolveDocument,
|
|
566
566
|
Ns as resolvePath,
|
|
567
567
|
cs as resolvePlugins,
|
|
568
568
|
ps as slash,
|
|
569
569
|
Is as stringifyYaml,
|
|
570
570
|
Ps as unescapePointerFragment,
|
|
571
571
|
ys as validate,
|
|
572
|
-
|
|
572
|
+
U as walkDocument,
|
|
573
573
|
fs as xmlEscape
|
|
574
574
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./replay-SemanticSearchService-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./replay-SemanticSearchService-CulKCCNl.js");exports.getSemanticSearchService=e.getSemanticSearchService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./replay-index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./replay-index-Nz5obVS5.js");async function a(t={}){return typeof t=="object"&&Object.freeze(t),await i.invoke("plugin:dialog|open",{options:t})}async function o(t={}){return typeof t=="object"&&Object.freeze(t),await i.invoke("plugin:dialog|save",{options:t})}async function l(t,n){const e=typeof n=="string"?{title:n}:n;await i.invoke("plugin:dialog|message",{message:t.toString(),title:e?.title?.toString(),kind:e?.kind,okButtonLabel:e?.okLabel?.toString()})}async function r(t,n){const e=typeof n=="string"?{title:n}:n;return await i.invoke("plugin:dialog|ask",{message:t.toString(),title:e?.title?.toString(),kind:e?.kind,okButtonLabel:e?.okLabel?.toString()??"Yes",cancelButtonLabel:e?.cancelLabel?.toString()??"No"})}async function c(t,n){const e=typeof n=="string"?{title:n}:n;return await i.invoke("plugin:dialog|confirm",{message:t.toString(),title:e?.title?.toString(),kind:e?.kind,okButtonLabel:e?.okLabel?.toString()??"Ok",cancelButtonLabel:e?.cancelLabel?.toString()??"Cancel"})}exports.ask=r;exports.confirm=c;exports.message=l;exports.open=a;exports.save=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./replay-index-DYtXcqDk.js"),s=require("./replay-lint-BzkTeXqI.js"),o=require("./replay-resolve-0e5f8I7b.js");function j(e){return(p.pathBrowserifyExports.extname(e)===".yaml"||p.pathBrowserifyExports.extname(e)===".yml")&&!1}function k(e){return p.isPlainObject(e)&&!s.isEmptyObject(e)}async function L(e){return new Promise(t=>setTimeout(t,e))}const S="type",v=["api-description","api-operation","data-schema"];function R(e,t){const{ctx:n}=s.getNodeTypesFromJSONSchema("EntityFileDefault",t),{ctx:r,discriminatorResolver:i}=s.getNodeTypesFromJSONSchema("EntityFile",e);return{entityTypes:{...n,...r,EntityFileArray:{properties:{},items:y=>{if(p.isPlainObject(y)){const m=y[S];if(!m)return"Entity";const l=i?.(y,m);if(l&&typeof l=="string")return l}return"Entity"}}},discriminatorResolver:i}}function c(e,t){if(o.isRef(t.parent))return;const n=t.key.toString(),r=e.counts??={};r[n]=(r[n]??0)+1}function O(e){for(const i of Object.values(e))i.items&&(i.total=i.items.size);const{xExtensions:t}=e,n=t.counts??{},r=Object.keys(n).sort();t.total=r.length,t.counts=Object.fromEntries(r.map(i=>[i,n[i]]))}const w=e=>({SpecExtension:{enter(t,n){c(e.xExtensions,n)}},XCodeSampleList:{enter(t,n){c(e.xExtensions,n)}},ExamplesMap:{enter(t,n){n.key.toString()==="x-examples"&&c(e.xExtensions,n)}},EnumDescriptions:{enter(t,n){c(e.xExtensions,n)}},TagGroups:{enter(t,n){c(e.xExtensions,n)}},Logo:{enter(t,n){c(e.xExtensions,n)}},XServerList:{enter(t,n){c(e.xExtensions,n)}},XUsePkce:{enter(t,n){c(e.xExtensions,n)}},Operation:{enter(t,n){n.key.toString()==="x-query"&&c(e.xExtensions,n)}},ExternalDocs:{leave(){e.externalDocs.total++}},ref:{enter(t){e.refs.items.add(t.$ref)}},Tag:{leave(t){e.tags.items.add(t.name)}},Link:{leave(t){e.links.items.add(t.operationId)}},WebhooksMap:{enter(t,n){n.key.toString()==="x-webhooks"&&c(e.xExtensions,n)},Operation:{leave(t){if(e.webhooks.total++,t.tags)for(const n of t.tags)e.tags.items.add(n)}}},Paths:{PathItem:{leave(){e.pathItems.total++},Operation:{leave(t){if(e.operations.total++,t.tags)for(const n of t.tags)e.tags.items.add(n)}},Parameter:{leave(t){e.parameters.items.add(t.name)}}}},NamedSchemas:{Schema:{leave(){e.schemas.total++}}},Root:{leave(){O(e)}}}),z=e=>({SpecExtension:{enter(t,n){c(e.xExtensions,n)}},ExternalDocs:{leave(){e.externalDocs.total++}},ref:{enter(t){e.refs.items.add(t.$ref)}},Tag:{leave(t){e.tags.items.add(t.name)}},ChannelMap:{Channel:{leave(){e.channels.total++},Operation:{leave(t){if(e.operations.total++,t.tags)for(const n of t.tags)e.tags.items.add(n)}},Parameter:{leave(t,{key:n}){e.parameters.items.add(n.toString())}}}},NamedSchemas:{Schema:{leave(){e.schemas.total++}}},Root:{leave(){O(e)}}}),V=e=>({SpecExtension:{enter(t,n){c(e.xExtensions,n)}},ExternalDocs:{leave(){e.externalDocs.total++}},ref:{enter(t){e.refs.items.add(t.$ref)}},Tag:{leave(t){e.tags.items.add(t.name)}},NamedChannels:{Channel:{leave(){e.channels.total++},Parameter:{leave(t,{key:n}){e.parameters.items.add(n.toString())}}}},NamedOperations:{Operation:{leave(t){if(e.operations.total++,t.tags)for(const n of t.tags)e.tags.items.add(n)}}},NamedSchemas:{Schema:{leave(){e.schemas.total++}}},Root:{leave(){O(e)}}}),G=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,b=2,P=150,U=()=>({any(e,{report:t,location:n}){if(p.isPlainObject(e)&&"key"in e){const r=e.key;if(typeof r!="string"){t({message:"Entity `key` must be a string.",location:n.child(["key"])});return}r.length<b&&t({message:`Entity 'key' must be at least ${b} characters long.`,location:n.child(["key"])}),r.length>P&&t({message:`Entity 'key' must not exceed ${P} characters.`,location:n.child(["key"])}),G.test(r)||t({message:"Entity `key` must contain only lowercase letters, numbers, and hyphens, and cannot start or end with a hyphen.",location:n.child(["key"])})}}});function x(e,t){const r=t.split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join("")+e;return Object.values(s.t).includes(r)?r:e}function B(e,t){const n={};for(const[r,i]of Object.entries(t))if(_(r,i)){if(i.severity==="off")continue;n[r]={...q(e,r,i)}}else n[r]=i;return n}function M(e){const t={},n={};for(const[r,i]of Object.entries(e))if(_(r,i)){const a=i;$(a)?t[r]=a:n[r]=a}else n[r]=i;return{entityRules:t,apiRules:n}}function Y(e,t,n){if(!p.isPlainObject(n.parsed)||!p.isPlainObject(n.parsed.components))return null;const r=n.parsed.components,i="schemas"in r?r.schemas:void 0;if(!i||!(e in i))return null;const a=i[e];try{const y=JSON.parse(t);if(s.dequal(a,y))return a}catch{return null}return null}function _(e,t){return e.startsWith("rule/")&&p.isPlainObject(t)}function $(e){return Object.values(s.t).some(t=>e.subject.type===t)}function q(e,t,n){const r=x(n.subject.type,e),i=n.where?.map(a=>({...a,subject:{...a.subject,type:x(a.subject.type,e)}}));return{assertionId:t,subject:{...n.subject,type:r},assertions:n.assertions,...i&&{where:i},...n.message&&{message:n.message},...n.severity&&{severity:n.severity}}}async function N(e){const{document:t,entitySchema:n,entityDefaultSchema:r,severity:i,externalRefResolver:a=new o.BaseResolver,assertionConfig:y={}}=e,m={problems:[],specVersion:"entity",visitorsData:{}},{entityTypes:l,discriminatorResolver:g}=R(n,r),d=o.normalizeTypes(l);let f=d.Entity;if(Array.isArray(t.parsed))f=d.EntityFileArray;else if(p.isPlainObject(t.parsed)){const h=t.parsed[S];if(!h)f=d.Entity;else{const T=g?.(t.parsed,h);T&&typeof T=="string"&&d[T]&&(f=d[T])}}const E=s.Assertions(y),u=Array.isArray(E)?E.map(h=>({severity:i||"error",ruleId:"entity assertions",visitor:h})):[{severity:i||"error",ruleId:"entity assertions",visitor:E}],C=[{severity:i||"error",ruleId:"entity struct",visitor:s.Struct()},{severity:i||"error",ruleId:"entity no-unresolved-refs",visitor:s.NoUnresolvedRefs()},{severity:i||"error",ruleId:"entity key-valid",visitor:U()},...u],D=s.normalizeVisitors(C,d),F=await o.resolveDocument({rootDocument:t,rootType:f,externalRefResolver:a});return s.walkDocument({document:t,rootType:f,normalizedVisitors:D,resolvedRefMap:F,ctx:m}),m.problems}async function A(e,t,n){if(!t.rules)throw new Error(`Scorecard level "${t.name}" has no rules defined.`);const r=new o.BaseResolver,i=o.makeDocumentFromString(JSON.stringify(e,null,2),"entity"),a=i.parsed[S],y=B(a||"unknown",t.rules),{entityRules:m,apiRules:l}=M(y),g=await N({document:i,entitySchema:s.Rs,entityDefaultSchema:s.Ps,externalRefResolver:r,assertionConfig:m});if(v.includes(e.type)){if(Object.keys(l).length===0)return g;if(!n)throw new Error(`Document is required for entity type "${e.type}". Provide the source API document to lint API rules.`);if(e.type==="data-schema"&&e.metadata?.schema){Object.values(l).forEach(u=>{if(p.isPlainObject(u)&&p.isPlainObject(u.subject)&&u.subject.type!=="Schema")throw new Error(`API rules for "data-schema" entity must target Schema subject, but found "${u.subject.type}".`)});const f=Y(e.title,e.metadata.schema,n);if(!f)throw new Error(`Schema "${e.title}" not found in the document. Ensure the schema exists in components.schemas.`);const E=await I({schema:f,schemaKey:e.title,config:await s.createConfig({rules:l}),specType:e.metadata.specType,sourceDocument:n,externalRefResolver:r});return[...g,...E]}const d=await s.lintDocument({document:n,externalRefResolver:r,config:await s.createConfig({rules:l})});return[...g,...d]}else if(!s.isEmptyObject(l))throw new Error(`API rules are not supported for entity type "${e.type}". Only ${v.join(", ")} support API rules.`);return g}async function I(e){const{schema:t,schemaKey:n,config:r,sourceDocument:i,specType:a,externalRefResolver:y=new o.BaseResolver(r.resolve)}=e,m=i.parsed,l=m[a],g=m.info,d=o.makeDocumentFromString(JSON.stringify({[a]:l,info:g,components:{schemas:{[n]:t}}},null,2),i?.source.absoluteRef||`schema:${n}`);return(await s.lintDocument({document:d,config:r,externalRefResolver:y})).filter(E=>E.location.some(u=>u.pointer?.includes(`/components/schemas/${n}`)))}class H extends Error{}exports.isPlainObject=p.isPlainObject;exports.Arazzo1Types=s.Arazzo1Types;exports.Arazzo1_1Types=s.Arazzo1_1Types;exports.AsyncApi2Types=s.AsyncApi2Types;exports.AsyncApi3Types=s.AsyncApi3Types;exports.CONFIG_BUNDLER_VISITOR_ID=s.CONFIG_BUNDLER_VISITOR_ID;exports.CONFIG_FILE_NAME=s.CONFIG_FILE_NAME;exports.Config=s.Config;exports.ConfigTypes=s.ConfigTypes;exports.ConfigValidationError=s.ConfigValidationError;exports.DEFAULT_CONFIG=s.DEFAULT_CONFIG;exports.DEFAULT_PROJECT_PLUGIN_PATHS=s.DEFAULT_PROJECT_PLUGIN_PATHS;exports.IGNORE_BANNER=s.IGNORE_BANNER;exports.IGNORE_FILE=s.IGNORE_FILE;exports.Oas2Types=s.Oas2Types;exports.Oas3Types=s.Oas3Types;exports.Oas3_1Types=s.Oas3_1Types;exports.Oas3_2Types=s.Oas3_2Types;exports.OpenRpcTypes=s.OpenRpcTypes;exports.Overlay1Types=s.Overlay1Types;exports.PLUGINS_COLLECTOR_VISITOR_ID=s.PLUGINS_COLLECTOR_VISITOR_ID;exports.bundle=s.bundle;exports.bundleDocument=s.bundleDocument;exports.bundleFromString=s.bundleFromString;exports.clearPluginsCache=s.clearPluginsCache;exports.createConfig=s.createConfig;exports.createConfigTypes=s.createConfigTypes;exports.dequal=s.dequal;exports.detectSpec=s.detectSpec;exports.findConfig=s.findConfig;exports.formatProblems=s.formatProblems;exports.getAstNodeByPointer=s.getAstNodeByPointer;exports.getCodeframe=s.getCodeframe;exports.getLineColLocation=s.getLineColLocation;exports.getMajorSpecVersion=s.getMajorSpecVersion;exports.getPluginCacheVersion=s.getPluginCacheVersion;exports.getTotals=s.getTotals;exports.getTypes=s.getTypes;exports.isEmptyObject=s.isEmptyObject;exports.isNotEmptyArray=s.isNotEmptyArray;exports.isString=s.isString;exports.keysOf=s.keysOf;exports.lint=s.lint;exports.lintConfig=s.lintConfig;exports.lintDocument=s.lintDocument;exports.lintFromString=s.lintFromString;exports.loadConfig=s.loadConfig;exports.loadIgnoreConfig=s.loadIgnoreConfig;exports.logger=s.logger;exports.mapTypeToComponent=s.mapTypeToComponent;exports.normalizeVisitors=s.normalizeVisitors;exports.pluralize=s.pluralize;exports.regexFromString=s.regexFromString;exports.resolvePlugins=s.resolvePlugins;exports.slash=s.slash;exports.validate=s.lint;exports.walkDocument=s.walkDocument;exports.xmlEscape=s.xmlEscape;exports.BaseResolver=o.BaseResolver;exports.ResolveError=o.ResolveError;exports.Source=o.Source;exports.YamlParseError=o.YamlParseError;exports.escapePointerFragment=o.escapePointerFragment;exports.getDir=o.getDir;exports.isAbsoluteUrl=o.isAbsoluteUrl;exports.isBrowser=o.isBrowser;exports.isGraphqlRef=o.isGraphqlRef;exports.isMappingRef=o.isMappingRef;exports.isRef=o.isRef;exports.isSupportedExtension=o.isSupportedExtension;exports.isTruthy=o.isTruthy;exports.makeDocumentFromString=o.makeDocumentFromString;exports.normalizeTypes=o.normalizeTypes;exports.parseYaml=o.parseYaml;exports.readFileFromUrl=o.readFileFromUrl;exports.resolveDocument=o.resolveDocument;exports.resolvePath=o.resolvePath;exports.stringifyYaml=o.stringifyYaml;exports.unescapePointerFragment=o.unescapePointerFragment;exports.HandledError=H;exports.StatsAsync2=z;exports.StatsAsync3=V;exports.StatsOAS=w;exports.createEntityTypes=R;exports.doesYamlFileExist=j;exports.isNotEmptyObject=k;exports.lintEntityFile=N;exports.lintEntityWithScorecardLevel=A;exports.lintSchema=I;exports.pause=L;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./replay-index-Nz5obVS5.js"),s=require("./replay-lint-4XFKTmSY.js"),o=require("./replay-resolve-BueEsOnR.js");function j(e){return(p.pathBrowserifyExports.extname(e)===".yaml"||p.pathBrowserifyExports.extname(e)===".yml")&&!1}function k(e){return p.isPlainObject(e)&&!s.isEmptyObject(e)}async function L(e){return new Promise(t=>setTimeout(t,e))}const S="type",v=["api-description","api-operation","data-schema"];function R(e,t){const{ctx:n}=s.getNodeTypesFromJSONSchema("EntityFileDefault",t),{ctx:r,discriminatorResolver:i}=s.getNodeTypesFromJSONSchema("EntityFile",e);return{entityTypes:{...n,...r,EntityFileArray:{properties:{},items:y=>{if(p.isPlainObject(y)){const m=y[S];if(!m)return"Entity";const l=i?.(y,m);if(l&&typeof l=="string")return l}return"Entity"}}},discriminatorResolver:i}}function c(e,t){if(o.isRef(t.parent))return;const n=t.key.toString(),r=e.counts??={};r[n]=(r[n]??0)+1}function O(e){for(const i of Object.values(e))i.items&&(i.total=i.items.size);const{xExtensions:t}=e,n=t.counts??{},r=Object.keys(n).sort();t.total=r.length,t.counts=Object.fromEntries(r.map(i=>[i,n[i]]))}const w=e=>({SpecExtension:{enter(t,n){c(e.xExtensions,n)}},XCodeSampleList:{enter(t,n){c(e.xExtensions,n)}},ExamplesMap:{enter(t,n){n.key.toString()==="x-examples"&&c(e.xExtensions,n)}},EnumDescriptions:{enter(t,n){c(e.xExtensions,n)}},TagGroups:{enter(t,n){c(e.xExtensions,n)}},Logo:{enter(t,n){c(e.xExtensions,n)}},XServerList:{enter(t,n){c(e.xExtensions,n)}},XUsePkce:{enter(t,n){c(e.xExtensions,n)}},Operation:{enter(t,n){n.key.toString()==="x-query"&&c(e.xExtensions,n)}},ExternalDocs:{leave(){e.externalDocs.total++}},ref:{enter(t){e.refs.items.add(t.$ref)}},Tag:{leave(t){e.tags.items.add(t.name)}},Link:{leave(t){e.links.items.add(t.operationId)}},WebhooksMap:{enter(t,n){n.key.toString()==="x-webhooks"&&c(e.xExtensions,n)},Operation:{leave(t){if(e.webhooks.total++,t.tags)for(const n of t.tags)e.tags.items.add(n)}}},Paths:{PathItem:{leave(){e.pathItems.total++},Operation:{leave(t){if(e.operations.total++,t.tags)for(const n of t.tags)e.tags.items.add(n)}},Parameter:{leave(t){e.parameters.items.add(t.name)}}}},NamedSchemas:{Schema:{leave(){e.schemas.total++}}},Root:{leave(){O(e)}}}),z=e=>({SpecExtension:{enter(t,n){c(e.xExtensions,n)}},ExternalDocs:{leave(){e.externalDocs.total++}},ref:{enter(t){e.refs.items.add(t.$ref)}},Tag:{leave(t){e.tags.items.add(t.name)}},ChannelMap:{Channel:{leave(){e.channels.total++},Operation:{leave(t){if(e.operations.total++,t.tags)for(const n of t.tags)e.tags.items.add(n)}},Parameter:{leave(t,{key:n}){e.parameters.items.add(n.toString())}}}},NamedSchemas:{Schema:{leave(){e.schemas.total++}}},Root:{leave(){O(e)}}}),V=e=>({SpecExtension:{enter(t,n){c(e.xExtensions,n)}},ExternalDocs:{leave(){e.externalDocs.total++}},ref:{enter(t){e.refs.items.add(t.$ref)}},Tag:{leave(t){e.tags.items.add(t.name)}},NamedChannels:{Channel:{leave(){e.channels.total++},Parameter:{leave(t,{key:n}){e.parameters.items.add(n.toString())}}}},NamedOperations:{Operation:{leave(t){if(e.operations.total++,t.tags)for(const n of t.tags)e.tags.items.add(n)}}},NamedSchemas:{Schema:{leave(){e.schemas.total++}}},Root:{leave(){O(e)}}}),G=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,b=2,x=150,U=()=>({any(e,{report:t,location:n}){if(p.isPlainObject(e)&&"key"in e){const r=e.key;if(typeof r!="string"){t({message:"Entity `key` must be a string.",location:n.child(["key"])});return}r.length<b&&t({message:`Entity 'key' must be at least ${b} characters long.`,location:n.child(["key"])}),r.length>x&&t({message:`Entity 'key' must not exceed ${x} characters.`,location:n.child(["key"])}),G.test(r)||t({message:"Entity `key` must contain only lowercase letters, numbers, and hyphens, and cannot start or end with a hyphen.",location:n.child(["key"])})}}});function P(e,t){const r=t.split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join("")+e;return Object.values(s.t).includes(r)?r:e}function B(e,t){const n={};for(const[r,i]of Object.entries(t))if(_(r,i)){if(i.severity==="off")continue;n[r]={...q(e,r,i)}}else n[r]=i;return n}function M(e){const t={},n={};for(const[r,i]of Object.entries(e))if(_(r,i)){const a=i;$(a)?t[r]=a:n[r]=a}else n[r]=i;return{entityRules:t,apiRules:n}}function Y(e,t,n){if(!p.isPlainObject(n.parsed)||!p.isPlainObject(n.parsed.components))return null;const r=n.parsed.components,i="schemas"in r?r.schemas:void 0;if(!i||!(e in i))return null;const a=i[e];try{const y=JSON.parse(t);if(s.dequal(a,y))return a}catch{return null}return null}function _(e,t){return e.startsWith("rule/")&&p.isPlainObject(t)}function $(e){return Object.values(s.t).some(t=>e.subject.type===t)}function q(e,t,n){const r=P(n.subject.type,e),i=n.where?.map(a=>({...a,subject:{...a.subject,type:P(a.subject.type,e)}}));return{assertionId:t,subject:{...n.subject,type:r},assertions:n.assertions,...i&&{where:i},...n.message&&{message:n.message},...n.severity&&{severity:n.severity}}}async function N(e){const{document:t,entitySchema:n,entityDefaultSchema:r,severity:i,externalRefResolver:a=new o.BaseResolver,assertionConfig:y={}}=e,m={problems:[],specVersion:"entity",visitorsData:{}},{entityTypes:l,discriminatorResolver:g}=R(n,r),d=o.normalizeTypes(l);let f=d.Entity;if(Array.isArray(t.parsed))f=d.EntityFileArray;else if(p.isPlainObject(t.parsed)){const h=t.parsed[S];if(!h)f=d.Entity;else{const T=g?.(t.parsed,h);T&&typeof T=="string"&&d[T]&&(f=d[T])}}const E=s.Assertions(y),u=Array.isArray(E)?E.map(h=>({severity:i||"error",ruleId:"entity assertions",visitor:h})):[{severity:i||"error",ruleId:"entity assertions",visitor:E}],C=[{severity:i||"error",ruleId:"entity struct",visitor:s.Struct()},{severity:i||"error",ruleId:"entity no-unresolved-refs",visitor:s.NoUnresolvedRefs()},{severity:i||"error",ruleId:"entity key-valid",visitor:U()},...u],D=s.normalizeVisitors(C,d),F=await o.resolveDocument({rootDocument:t,rootType:f,externalRefResolver:a});return s.walkDocument({document:t,rootType:f,normalizedVisitors:D,resolvedRefMap:F,ctx:m}),m.problems}async function A(e,t,n){if(!t.rules)throw new Error(`Scorecard level "${t.name}" has no rules defined.`);const r=new o.BaseResolver,i=o.makeDocumentFromString(JSON.stringify(e,null,2),"entity"),a=i.parsed[S],y=B(a||"unknown",t.rules),{entityRules:m,apiRules:l}=M(y),g=await N({document:i,entitySchema:s.Js,entityDefaultSchema:s.Ls,externalRefResolver:r,assertionConfig:m});if(v.includes(e.type)){if(Object.keys(l).length===0)return g;if(!n)throw new Error(`Document is required for entity type "${e.type}". Provide the source API document to lint API rules.`);if(e.type==="data-schema"&&e.metadata?.schema){Object.values(l).forEach(u=>{if(p.isPlainObject(u)&&p.isPlainObject(u.subject)&&u.subject.type!=="Schema")throw new Error(`API rules for "data-schema" entity must target Schema subject, but found "${u.subject.type}".`)});const f=Y(e.title,e.metadata.schema,n);if(!f)throw new Error(`Schema "${e.title}" not found in the document. Ensure the schema exists in components.schemas.`);const E=await I({schema:f,schemaKey:e.title,config:await s.createConfig({rules:l}),specType:e.metadata.specType,sourceDocument:n,externalRefResolver:r});return[...g,...E]}const d=await s.lintDocument({document:n,externalRefResolver:r,config:await s.createConfig({rules:l})});return[...g,...d]}else if(!s.isEmptyObject(l))throw new Error(`API rules are not supported for entity type "${e.type}". Only ${v.join(", ")} support API rules.`);return g}async function I(e){const{schema:t,schemaKey:n,config:r,sourceDocument:i,specType:a,externalRefResolver:y=new o.BaseResolver(r.resolve)}=e,m=i.parsed,l=m[a],g=m.info,d=o.makeDocumentFromString(JSON.stringify({[a]:l,info:g,components:{schemas:{[n]:t}}},null,2),i?.source.absoluteRef||`schema:${n}`);return(await s.lintDocument({document:d,config:r,externalRefResolver:y})).filter(E=>E.location.some(u=>u.pointer?.includes(`/components/schemas/${n}`)))}class J extends Error{}exports.isPlainObject=p.isPlainObject;exports.Arazzo1Types=s.Arazzo1Types;exports.Arazzo1_1Types=s.Arazzo1_1Types;exports.AsyncApi2Types=s.AsyncApi2Types;exports.AsyncApi3Types=s.AsyncApi3Types;exports.CONFIG_BUNDLER_VISITOR_ID=s.CONFIG_BUNDLER_VISITOR_ID;exports.CONFIG_FILE_NAME=s.CONFIG_FILE_NAME;exports.Config=s.Config;exports.ConfigTypes=s.ConfigTypes;exports.ConfigValidationError=s.ConfigValidationError;exports.DEFAULT_CONFIG=s.DEFAULT_CONFIG;exports.DEFAULT_PROJECT_PLUGIN_PATHS=s.DEFAULT_PROJECT_PLUGIN_PATHS;exports.IGNORE_BANNER=s.IGNORE_BANNER;exports.IGNORE_FILE=s.IGNORE_FILE;exports.Oas2Types=s.Oas2Types;exports.Oas3Types=s.Oas3Types;exports.Oas3_1Types=s.Oas3_1Types;exports.Oas3_2Types=s.Oas3_2Types;exports.OpenRpcTypes=s.OpenRpcTypes;exports.Overlay1Types=s.Overlay1Types;exports.PLUGINS_COLLECTOR_VISITOR_ID=s.PLUGINS_COLLECTOR_VISITOR_ID;exports.bundle=s.bundle;exports.bundleDocument=s.bundleDocument;exports.bundleFromString=s.bundleFromString;exports.clearPluginsCache=s.clearPluginsCache;exports.createConfig=s.createConfig;exports.createConfigTypes=s.createConfigTypes;exports.dequal=s.dequal;exports.detectSpec=s.detectSpec;exports.findConfig=s.findConfig;exports.formatProblems=s.formatProblems;exports.getAstNodeByPointer=s.getAstNodeByPointer;exports.getCodeframe=s.getCodeframe;exports.getLineColLocation=s.getLineColLocation;exports.getMajorSpecVersion=s.getMajorSpecVersion;exports.getPluginCacheVersion=s.getPluginCacheVersion;exports.getTotals=s.getTotals;exports.getTypes=s.getTypes;exports.isEmptyObject=s.isEmptyObject;exports.isNotEmptyArray=s.isNotEmptyArray;exports.isString=s.isString;exports.keysOf=s.keysOf;exports.lint=s.lint;exports.lintConfig=s.lintConfig;exports.lintDocument=s.lintDocument;exports.lintFromString=s.lintFromString;exports.loadConfig=s.loadConfig;exports.loadIgnoreConfig=s.loadIgnoreConfig;exports.logger=s.logger;exports.mapTypeToComponent=s.mapTypeToComponent;exports.normalizeVisitors=s.normalizeVisitors;exports.pluralize=s.pluralize;exports.regexFromString=s.regexFromString;exports.resolvePlugins=s.resolvePlugins;exports.slash=s.slash;exports.validate=s.lint;exports.walkDocument=s.walkDocument;exports.xmlEscape=s.xmlEscape;exports.BaseResolver=o.BaseResolver;exports.ResolveError=o.ResolveError;exports.Source=o.Source;exports.YamlParseError=o.YamlParseError;exports.escapePointerFragment=o.escapePointerFragment;exports.getDir=o.getDir;exports.isAbsoluteUrl=o.isAbsoluteUrl;exports.isBrowser=o.isBrowser;exports.isGraphqlRef=o.isGraphqlRef;exports.isMappingRef=o.isMappingRef;exports.isRef=o.isRef;exports.isSupportedExtension=o.isSupportedExtension;exports.isTruthy=o.isTruthy;exports.makeDocumentFromString=o.makeDocumentFromString;exports.normalizeTypes=o.normalizeTypes;exports.parseYaml=o.parseYaml;exports.readFileFromUrl=o.readFileFromUrl;exports.resolveDocument=o.resolveDocument;exports.resolvePath=o.resolvePath;exports.stringifyYaml=o.stringifyYaml;exports.unescapePointerFragment=o.unescapePointerFragment;exports.HandledError=J;exports.StatsAsync2=z;exports.StatsAsync3=V;exports.StatsOAS=w;exports.createEntityTypes=R;exports.doesYamlFileExist=j;exports.isNotEmptyObject=k;exports.lintEntityFile=N;exports.lintEntityWithScorecardLevel=A;exports.lintSchema=I;exports.pause=L;
|