@redocly/replay 0.28.0-next.2 → 0.28.0-next.4
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-D3tGLym7.js → replay-AiChatProvider-BIplPHOS.js} +6 -6
- package/dist/{replay-AiChatProvider-DLZX3ihL.js → replay-AiChatProvider-TF1u9E5L.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-ckjqpV-2.js → replay-AiChatSqliteDBStorage-Bay95FHW.js} +1 -1
- package/dist/{replay-AiChatSqliteDBStorage-yawoZunX.js → replay-AiChatSqliteDBStorage-C-rkQ3jG.js} +1 -1
- package/dist/{replay-AiPanel-CtMW4jHp.js → replay-AiPanel-DU5aVA3q.js} +4 -4
- package/dist/{replay-AiPanel-C2dOENPe.js → replay-AiPanel-DzGN1t86.js} +1 -1
- package/dist/{replay-FileWatcher-sxKCrDRy.js → replay-FileWatcher-XMkIoDEA.js} +1 -1
- package/dist/{replay-FileWatcher-Da7VcNHD.js → replay-FileWatcher-iYbHpwCv.js} +2 -2
- package/dist/{replay-SemanticSearchService-d98JHVBr.js → replay-SemanticSearchService-BWwCFW3F.js} +1 -1
- package/dist/{replay-SemanticSearchService-Z4oXtg1-.js → replay-SemanticSearchService-Dk4UTm2r.js} +1 -1
- package/dist/{replay-SqliteDBStorage-u6WbcK1f.js → replay-SqliteDBStorage-BFdjYsG7.js} +1 -1
- package/dist/{replay-SqliteDBStorage-3VBWw1et.js → replay-SqliteDBStorage-DGQjzDy4.js} +1 -1
- package/dist/{replay-TauriFileSystemAdapter-CjAHiJt1.js → replay-TauriFileSystemAdapter-C8k9RvT1.js} +1 -1
- package/dist/{replay-TauriFileSystemAdapter-ICQ2nRWO.js → replay-TauriFileSystemAdapter-CLzYSck7.js} +1 -1
- package/dist/{replay-TauriRootStorage-hW8Tndk0.js → replay-TauriRootStorage-C1MIH5ji.js} +2 -2
- package/dist/{replay-TauriRootStorage-CQj8br8Q.js → replay-TauriRootStorage-CiGY8MO6.js} +1 -1
- package/dist/{replay-agent-loop-B-IEIGri.js → replay-agent-loop-BoEw65rR.js} +3 -3
- package/dist/{replay-agent-loop-B06Jshb3.js → replay-agent-loop-Cm1iS9G2.js} +1 -1
- package/dist/{replay-ai-chat-mappers-B5sjJdrE.js → replay-ai-chat-mappers-Csm9vJrG.js} +1 -1
- package/dist/{replay-ai-chat-mappers-UGovEa4H.js → replay-ai-chat-mappers-IZNFNXug.js} +1 -1
- package/dist/{replay-create-model-lRYWX-0l.js → replay-create-model-BqvD-0wF.js} +3 -3
- package/dist/{replay-create-model-B-KPLEJi.js → replay-create-model-Y9UJSztb.js} +3 -3
- package/dist/{replay-db-00pWKHyY.js → replay-db-BImXgUGU.js} +1 -1
- package/dist/{replay-db-B_wOpXdd.js → replay-db-C7FD3opa.js} +1 -1
- package/dist/{replay-external-resolver-D-h0nPH_.js → replay-external-resolver-Bj3sLTnz.js} +2 -2
- package/dist/{replay-external-resolver-Ds5-nzcf.js → replay-external-resolver-CjM7Da6t.js} +1 -1
- package/dist/{replay-index-C-A7VOiR.js → replay-index-BH8cTSEK.js} +21 -21
- package/dist/{replay-index-C8p-US63.js → replay-index-BuYoH96w.js} +11 -11
- package/dist/{replay-index-9rbZ-mEz.js → replay-index-CKRKzXMt.js} +1 -1
- package/dist/replay-index-Cp06WK82.js +574 -0
- package/dist/{replay-index-DenMrfEa.js → replay-index-DJwfdo0s.js} +1 -1
- package/dist/{replay-index-lxN84rl9.js → replay-index-DlTloE6S.js} +1 -1
- package/dist/replay-index-Dxk-kqkZ.js +1 -0
- package/dist/{replay-index-CtSJHuow.js → replay-index-xheWgsnj.js} +2 -2
- package/dist/{replay-lint-To3OwiOO.js → replay-lint--iBW-6Vj.js} +9461 -13309
- package/dist/replay-lint-BIbkYU09.js +177 -0
- package/dist/{replay-lint-graphql-Bm1aR8BO.js → replay-lint-graphql-2b4GIER6.js} +1 -1
- package/dist/{replay-lint-graphql-k2xF1Dxd.js → replay-lint-graphql-EXBI8I89.js} +1 -1
- package/dist/{replay-resolve-Id-g4Fn5.js → replay-resolve-B5yIfyuT.js} +16 -16
- package/dist/{replay-resolve-uDAWE6Oj.js → replay-resolve-D9BUvjqv.js} +357 -355
- package/dist/{replay-respect-run-BkDXTsm6.js → replay-respect-run-Bx46aUHi.js} +3 -3
- package/dist/{replay-respect-run-B0ZG-ZH7.js → replay-respect-run-DNFoFnJU.js} +1 -1
- package/dist/{replay-tauri-path-BfRUQXOx.js → replay-tauri-path-BVoW6En0.js} +2 -2
- package/dist/{replay-tauri-path-GCN1liZ4.js → replay-tauri-path-C8GiFO5s.js} +1 -1
- package/dist/{replay-useAiChatQueries-CeHqt0jZ.js → replay-useAiChatQueries-BDgjmzz-.js} +1 -1
- package/dist/{replay-useAiChatQueries-cuGEM1L6.js → replay-useAiChatQueries-BTuu2xLG.js} +4 -4
- package/dist/{replay-validate-key-BismpJXJ.js → replay-validate-key-CjcIElmE.js} +2 -2
- package/dist/{replay-validate-key-DYqoWPkp.js → replay-validate-key-D4M7QvCw.js} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/package.json +4 -4
- package/dist/replay-index-BCtyyb1v.js +0 -504
- package/dist/replay-index-DCvqReXK.js +0 -1
- package/dist/replay-lint-BJ5AeIt-.js +0 -184
|
@@ -1,504 +0,0 @@
|
|
|
1
|
-
import { aS as u, aT as p } from "./replay-index-C-A7VOiR.js";
|
|
2
|
-
import { i as N, g as T, d as j, t as P, A as F, S as w, N as V, n as $, w as L, C as Y, R as G, c as S, l as D } from "./replay-lint-To3OwiOO.js";
|
|
3
|
-
import { a as fe, b as de, e as ge, f as he, h as ve, j as Ee, k as ue, m as Te, o as Se, D as Re, p as be, I as Oe, q as Ie, O as Ne, r as Pe, s as De, u as Ce, v as _e, x as xe, P as ke, y as ze, z as je, B as Fe, E as we, F as Ve, G as $e, H as Le, J as Ye, K as Ge, L as Me, M as Ue, Q as Be, T as Ke, U as We, V as He, W as Je, X as qe, Y as Xe, Z as Ze, _ as Qe, $ as Ae, a0 as es, a1 as ss, a2 as ts, a3 as as, a4 as ns, a5 as rs, a6 as is, a7 as os, Z as ls, a8 as cs } from "./replay-lint-To3OwiOO.js";
|
|
4
|
-
import { B as v, n as M, r as U, m as C } from "./replay-resolve-uDAWE6Oj.js";
|
|
5
|
-
import { R as ps, S as ys, Y as fs, e as ds, g as gs, i as hs, a as vs, b as Es, c as us, d as Ts, f as Ss, h as Rs, p as bs, j as Os, k as Is, s as Ns, u as Ps } from "./replay-resolve-uDAWE6Oj.js";
|
|
6
|
-
function ae(e) {
|
|
7
|
-
return (u.extname(e) === ".yaml" || u.extname(e) === ".yml") && !1;
|
|
8
|
-
}
|
|
9
|
-
function ne(e) {
|
|
10
|
-
return p(e) && !N(e);
|
|
11
|
-
}
|
|
12
|
-
async function re(e) {
|
|
13
|
-
return new Promise((s) => setTimeout(s, e));
|
|
14
|
-
}
|
|
15
|
-
const E = "type", R = ["api-description", "api-operation", "data-schema"];
|
|
16
|
-
function B(e, s) {
|
|
17
|
-
const { ctx: t } = T("EntityFileDefault", s), { ctx: a, discriminatorResolver: n } = T("EntityFile", e);
|
|
18
|
-
return {
|
|
19
|
-
entityTypes: {
|
|
20
|
-
...t,
|
|
21
|
-
...a,
|
|
22
|
-
EntityFileArray: {
|
|
23
|
-
properties: {},
|
|
24
|
-
items: (o) => {
|
|
25
|
-
if (p(o)) {
|
|
26
|
-
const l = o[E];
|
|
27
|
-
if (!l)
|
|
28
|
-
return "Entity";
|
|
29
|
-
const i = n?.(o, l);
|
|
30
|
-
if (i && typeof i == "string")
|
|
31
|
-
return i;
|
|
32
|
-
}
|
|
33
|
-
return "Entity";
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
discriminatorResolver: n
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
const ie = (e) => ({
|
|
41
|
-
ExternalDocs: {
|
|
42
|
-
leave() {
|
|
43
|
-
e.externalDocs.total++;
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
ref: {
|
|
47
|
-
enter(s) {
|
|
48
|
-
e.refs.items.add(s.$ref);
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
Tag: {
|
|
52
|
-
leave(s) {
|
|
53
|
-
e.tags.items.add(s.name);
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
Link: {
|
|
57
|
-
leave(s) {
|
|
58
|
-
e.links.items.add(s.operationId);
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
WebhooksMap: {
|
|
62
|
-
Operation: {
|
|
63
|
-
leave(s) {
|
|
64
|
-
if (e.webhooks.total++, s.tags)
|
|
65
|
-
for (const t of s.tags)
|
|
66
|
-
e.tags.items.add(t);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
Paths: {
|
|
71
|
-
PathItem: {
|
|
72
|
-
leave() {
|
|
73
|
-
e.pathItems.total++;
|
|
74
|
-
},
|
|
75
|
-
Operation: {
|
|
76
|
-
leave(s) {
|
|
77
|
-
if (e.operations.total++, s.tags)
|
|
78
|
-
for (const t of s.tags)
|
|
79
|
-
e.tags.items.add(t);
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
Parameter: {
|
|
83
|
-
leave(s) {
|
|
84
|
-
e.parameters.items.add(s.name);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
NamedSchemas: {
|
|
90
|
-
Schema: {
|
|
91
|
-
leave() {
|
|
92
|
-
e.schemas.total++;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
Root: {
|
|
97
|
-
leave() {
|
|
98
|
-
e.parameters.total = e.parameters.items.size, e.refs.total = e.refs.items.size, e.links.total = e.links.items.size, e.tags.total = e.tags.items.size;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}), oe = (e) => ({
|
|
102
|
-
ExternalDocs: {
|
|
103
|
-
leave() {
|
|
104
|
-
e.externalDocs.total++;
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
ref: {
|
|
108
|
-
enter(s) {
|
|
109
|
-
e.refs.items.add(s.$ref);
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
Tag: {
|
|
113
|
-
leave(s) {
|
|
114
|
-
e.tags.items.add(s.name);
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
ChannelMap: {
|
|
118
|
-
Channel: {
|
|
119
|
-
leave() {
|
|
120
|
-
e.channels.total++;
|
|
121
|
-
},
|
|
122
|
-
Operation: {
|
|
123
|
-
leave(s) {
|
|
124
|
-
if (e.operations.total++, s.tags)
|
|
125
|
-
for (const t of s.tags)
|
|
126
|
-
e.tags.items.add(t);
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
Parameter: {
|
|
130
|
-
leave(s) {
|
|
131
|
-
s.name && e.parameters.items.add(s.name);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
NamedSchemas: {
|
|
137
|
-
Schema: {
|
|
138
|
-
leave() {
|
|
139
|
-
e.schemas.total++;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
Root: {
|
|
144
|
-
leave() {
|
|
145
|
-
e.parameters.total = e.parameters.items.size, e.refs.total = e.refs.items.size, e.tags.total = e.tags.items.size;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}), le = (e) => ({
|
|
149
|
-
ExternalDocs: {
|
|
150
|
-
leave() {
|
|
151
|
-
e.externalDocs.total++;
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
ref: {
|
|
155
|
-
enter(s) {
|
|
156
|
-
e.refs.items.add(s.$ref);
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
Tag: {
|
|
160
|
-
leave(s) {
|
|
161
|
-
e.tags.items.add(s.name);
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
NamedChannels: {
|
|
165
|
-
Channel: {
|
|
166
|
-
leave() {
|
|
167
|
-
e.channels.total++;
|
|
168
|
-
},
|
|
169
|
-
Parameter: {
|
|
170
|
-
leave(s) {
|
|
171
|
-
s.name && e.parameters.items.add(s.name);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
NamedOperations: {
|
|
177
|
-
Operation: {
|
|
178
|
-
leave(s) {
|
|
179
|
-
if (e.operations.total++, s.tags)
|
|
180
|
-
for (const t of s.tags)
|
|
181
|
-
e.tags.items.add(t);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
NamedSchemas: {
|
|
186
|
-
Schema: {
|
|
187
|
-
leave() {
|
|
188
|
-
e.schemas.total++;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
Root: {
|
|
193
|
-
leave() {
|
|
194
|
-
e.parameters.total = e.parameters.items.size, e.refs.total = e.refs.items.size, e.tags.total = e.tags.items.size;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}), K = /^[a-z0-9]+(?:-[a-z0-9]+)*$/, b = 2, O = 150, W = () => ({
|
|
198
|
-
any(e, { report: s, location: t }) {
|
|
199
|
-
if (p(e) && "key" in e) {
|
|
200
|
-
const a = e.key;
|
|
201
|
-
if (typeof a != "string") {
|
|
202
|
-
s({
|
|
203
|
-
message: "Entity `key` must be a string.",
|
|
204
|
-
location: t.child(["key"])
|
|
205
|
-
});
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
a.length < b && s({
|
|
209
|
-
message: `Entity 'key' must be at least ${b} characters long.`,
|
|
210
|
-
location: t.child(["key"])
|
|
211
|
-
}), a.length > O && s({
|
|
212
|
-
message: `Entity 'key' must not exceed ${O} characters.`,
|
|
213
|
-
location: t.child(["key"])
|
|
214
|
-
}), K.test(a) || s({
|
|
215
|
-
message: "Entity `key` must contain only lowercase letters, numbers, and hyphens, and cannot start or end with a hyphen.",
|
|
216
|
-
location: t.child(["key"])
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
function I(e, s) {
|
|
222
|
-
const a = s.split("-").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join("") + e;
|
|
223
|
-
return Object.values(P).includes(a) ? a : e;
|
|
224
|
-
}
|
|
225
|
-
function H(e, s) {
|
|
226
|
-
const t = {};
|
|
227
|
-
for (const [a, n] of Object.entries(s))
|
|
228
|
-
if (_(a, n)) {
|
|
229
|
-
if (n.severity === "off")
|
|
230
|
-
continue;
|
|
231
|
-
t[a] = {
|
|
232
|
-
...Z(e, a, n)
|
|
233
|
-
};
|
|
234
|
-
} else
|
|
235
|
-
t[a] = n;
|
|
236
|
-
return t;
|
|
237
|
-
}
|
|
238
|
-
function J(e) {
|
|
239
|
-
const s = {}, t = {};
|
|
240
|
-
for (const [a, n] of Object.entries(e))
|
|
241
|
-
if (_(a, n)) {
|
|
242
|
-
const r = n;
|
|
243
|
-
X(r) ? s[a] = r : t[a] = r;
|
|
244
|
-
} else
|
|
245
|
-
t[a] = n;
|
|
246
|
-
return { entityRules: s, apiRules: t };
|
|
247
|
-
}
|
|
248
|
-
function q(e, s, t) {
|
|
249
|
-
if (!p(t.parsed) || !p(t.parsed.components))
|
|
250
|
-
return null;
|
|
251
|
-
const a = t.parsed.components, n = "schemas" in a ? a.schemas : void 0;
|
|
252
|
-
if (!n || !(e in n))
|
|
253
|
-
return null;
|
|
254
|
-
const r = n[e];
|
|
255
|
-
try {
|
|
256
|
-
const o = JSON.parse(s);
|
|
257
|
-
if (j(r, o))
|
|
258
|
-
return r;
|
|
259
|
-
} catch {
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
return null;
|
|
263
|
-
}
|
|
264
|
-
function _(e, s) {
|
|
265
|
-
return e.startsWith("rule/") && p(s);
|
|
266
|
-
}
|
|
267
|
-
function X(e) {
|
|
268
|
-
return Object.values(P).some((s) => e.subject.type === s);
|
|
269
|
-
}
|
|
270
|
-
function Z(e, s, t) {
|
|
271
|
-
const a = I(t.subject.type, e), n = t.where?.map((r) => ({
|
|
272
|
-
...r,
|
|
273
|
-
subject: {
|
|
274
|
-
...r.subject,
|
|
275
|
-
type: I(r.subject.type, e)
|
|
276
|
-
}
|
|
277
|
-
}));
|
|
278
|
-
return {
|
|
279
|
-
assertionId: s,
|
|
280
|
-
subject: {
|
|
281
|
-
...t.subject,
|
|
282
|
-
type: a
|
|
283
|
-
},
|
|
284
|
-
assertions: t.assertions,
|
|
285
|
-
...n && { where: n },
|
|
286
|
-
...t.message && { message: t.message },
|
|
287
|
-
...t.severity && { severity: t.severity }
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
async function Q(e) {
|
|
291
|
-
const { document: s, entitySchema: t, entityDefaultSchema: a, severity: n, externalRefResolver: r = new v(), assertionConfig: o = {} } = e, l = {
|
|
292
|
-
problems: [],
|
|
293
|
-
specVersion: "entity",
|
|
294
|
-
visitorsData: {}
|
|
295
|
-
}, { entityTypes: i, discriminatorResolver: y } = B(t, a), c = M(i);
|
|
296
|
-
let m = c.Entity;
|
|
297
|
-
if (Array.isArray(s.parsed))
|
|
298
|
-
m = c.EntityFileArray;
|
|
299
|
-
else if (p(s.parsed)) {
|
|
300
|
-
const g = s.parsed[E];
|
|
301
|
-
if (!g)
|
|
302
|
-
m = c.Entity;
|
|
303
|
-
else {
|
|
304
|
-
const h = y?.(s.parsed, g);
|
|
305
|
-
h && typeof h == "string" && c[h] && (m = c[h]);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
const d = F(o), f = Array.isArray(d) ? d.map((g) => ({
|
|
309
|
-
severity: n || "error",
|
|
310
|
-
ruleId: "entity assertions",
|
|
311
|
-
visitor: g
|
|
312
|
-
})) : [
|
|
313
|
-
{
|
|
314
|
-
severity: n || "error",
|
|
315
|
-
ruleId: "entity assertions",
|
|
316
|
-
visitor: d
|
|
317
|
-
}
|
|
318
|
-
], x = [
|
|
319
|
-
{
|
|
320
|
-
severity: n || "error",
|
|
321
|
-
ruleId: "entity struct",
|
|
322
|
-
visitor: w()
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
severity: n || "error",
|
|
326
|
-
ruleId: "entity no-unresolved-refs",
|
|
327
|
-
visitor: V()
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
severity: n || "error",
|
|
331
|
-
ruleId: "entity key-valid",
|
|
332
|
-
visitor: W()
|
|
333
|
-
},
|
|
334
|
-
...f
|
|
335
|
-
], k = $(x, c), z = await U({
|
|
336
|
-
rootDocument: s,
|
|
337
|
-
rootType: m,
|
|
338
|
-
externalRefResolver: r
|
|
339
|
-
});
|
|
340
|
-
return L({
|
|
341
|
-
document: s,
|
|
342
|
-
rootType: m,
|
|
343
|
-
normalizedVisitors: k,
|
|
344
|
-
resolvedRefMap: z,
|
|
345
|
-
ctx: l
|
|
346
|
-
}), l.problems;
|
|
347
|
-
}
|
|
348
|
-
async function ce(e, s, t) {
|
|
349
|
-
if (!s.rules)
|
|
350
|
-
throw new Error(`Scorecard level "${s.name}" has no rules defined.`);
|
|
351
|
-
const a = new v(), n = C(JSON.stringify(e, null, 2), "entity"), r = n.parsed[E], o = H(r || "unknown", s.rules), { entityRules: l, apiRules: i } = J(o), y = await Q({
|
|
352
|
-
document: n,
|
|
353
|
-
entitySchema: Y,
|
|
354
|
-
entityDefaultSchema: G,
|
|
355
|
-
externalRefResolver: a,
|
|
356
|
-
assertionConfig: l
|
|
357
|
-
});
|
|
358
|
-
if (R.includes(e.type)) {
|
|
359
|
-
if (Object.keys(i).length === 0)
|
|
360
|
-
return y;
|
|
361
|
-
if (!t)
|
|
362
|
-
throw new Error(`Document is required for entity type "${e.type}". Provide the source API document to lint API rules.`);
|
|
363
|
-
if (e.type === "data-schema" && e.metadata?.schema) {
|
|
364
|
-
Object.values(i).forEach((f) => {
|
|
365
|
-
if (p(f) && p(f.subject) && f.subject.type !== "Schema")
|
|
366
|
-
throw new Error(`API rules for "data-schema" entity must target Schema subject, but found "${f.subject.type}".`);
|
|
367
|
-
});
|
|
368
|
-
const m = q(e.title, e.metadata.schema, t);
|
|
369
|
-
if (!m)
|
|
370
|
-
throw new Error(`Schema "${e.title}" not found in the document. Ensure the schema exists in components.schemas.`);
|
|
371
|
-
const d = await A({
|
|
372
|
-
schema: m,
|
|
373
|
-
schemaKey: e.title,
|
|
374
|
-
config: await S({
|
|
375
|
-
rules: i
|
|
376
|
-
}),
|
|
377
|
-
specType: e.metadata.specType,
|
|
378
|
-
sourceDocument: t,
|
|
379
|
-
externalRefResolver: a
|
|
380
|
-
});
|
|
381
|
-
return [...y, ...d];
|
|
382
|
-
}
|
|
383
|
-
const c = await D({
|
|
384
|
-
document: t,
|
|
385
|
-
externalRefResolver: a,
|
|
386
|
-
config: await S({
|
|
387
|
-
rules: i
|
|
388
|
-
})
|
|
389
|
-
});
|
|
390
|
-
return [...y, ...c];
|
|
391
|
-
} else if (!N(i))
|
|
392
|
-
throw new Error(`API rules are not supported for entity type "${e.type}". Only ${R.join(", ")} support API rules.`);
|
|
393
|
-
return y;
|
|
394
|
-
}
|
|
395
|
-
async function A(e) {
|
|
396
|
-
const { schema: s, schemaKey: t, config: a, sourceDocument: n, specType: r, externalRefResolver: o = new v(a.resolve) } = e, l = n.parsed, i = l[r], y = l.info, c = C(JSON.stringify({
|
|
397
|
-
[r]: i,
|
|
398
|
-
info: y,
|
|
399
|
-
components: {
|
|
400
|
-
schemas: {
|
|
401
|
-
[t]: s
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}, null, 2), n?.source.absoluteRef || `schema:${t}`);
|
|
405
|
-
return (await D({
|
|
406
|
-
document: c,
|
|
407
|
-
config: a,
|
|
408
|
-
externalRefResolver: o
|
|
409
|
-
})).filter((d) => d.location.some((f) => f.pointer?.includes(`/components/schemas/${t}`)));
|
|
410
|
-
}
|
|
411
|
-
class me extends Error {
|
|
412
|
-
}
|
|
413
|
-
export {
|
|
414
|
-
fe as Arazzo1Types,
|
|
415
|
-
de as Arazzo1_1Types,
|
|
416
|
-
ge as AsyncApi2Types,
|
|
417
|
-
he as AsyncApi3Types,
|
|
418
|
-
v as BaseResolver,
|
|
419
|
-
ve as CONFIG_BUNDLER_VISITOR_ID,
|
|
420
|
-
Ee as CONFIG_FILE_NAME,
|
|
421
|
-
ue as Config,
|
|
422
|
-
Te as ConfigTypes,
|
|
423
|
-
Se as ConfigValidationError,
|
|
424
|
-
Re as DEFAULT_CONFIG,
|
|
425
|
-
be as DEFAULT_PROJECT_PLUGIN_PATHS,
|
|
426
|
-
me as HandledError,
|
|
427
|
-
Oe as IGNORE_BANNER,
|
|
428
|
-
Ie as IGNORE_FILE,
|
|
429
|
-
Ne as Oas2Types,
|
|
430
|
-
Pe as Oas3Types,
|
|
431
|
-
De as Oas3_1Types,
|
|
432
|
-
Ce as Oas3_2Types,
|
|
433
|
-
_e as OpenRpcTypes,
|
|
434
|
-
xe as Overlay1Types,
|
|
435
|
-
ke as PLUGINS_COLLECTOR_VISITOR_ID,
|
|
436
|
-
ps as ResolveError,
|
|
437
|
-
ys as Source,
|
|
438
|
-
oe as StatsAsync2,
|
|
439
|
-
le as StatsAsync3,
|
|
440
|
-
ie as StatsOAS,
|
|
441
|
-
fs as YamlParseError,
|
|
442
|
-
ze as bundle,
|
|
443
|
-
je as bundleDocument,
|
|
444
|
-
Fe as bundleFromString,
|
|
445
|
-
we as clearPluginsCache,
|
|
446
|
-
S as createConfig,
|
|
447
|
-
Ve as createConfigTypes,
|
|
448
|
-
B as createEntityTypes,
|
|
449
|
-
j as dequal,
|
|
450
|
-
$e as detectSpec,
|
|
451
|
-
ae as doesYamlFileExist,
|
|
452
|
-
ds as escapePointerFragment,
|
|
453
|
-
Le as findConfig,
|
|
454
|
-
Ye as formatProblems,
|
|
455
|
-
Ge as getAstNodeByPointer,
|
|
456
|
-
Me as getCodeframe,
|
|
457
|
-
gs as getDir,
|
|
458
|
-
Ue as getLineColLocation,
|
|
459
|
-
Be as getMajorSpecVersion,
|
|
460
|
-
Ke as getPluginCacheVersion,
|
|
461
|
-
We as getTotals,
|
|
462
|
-
He as getTypes,
|
|
463
|
-
hs as isAbsoluteUrl,
|
|
464
|
-
vs as isBrowser,
|
|
465
|
-
N as isEmptyObject,
|
|
466
|
-
Es as isGraphqlRef,
|
|
467
|
-
us as isMappingRef,
|
|
468
|
-
Je as isNotEmptyArray,
|
|
469
|
-
ne as isNotEmptyObject,
|
|
470
|
-
p as isPlainObject,
|
|
471
|
-
Ts as isRef,
|
|
472
|
-
qe as isString,
|
|
473
|
-
Ss as isSupportedExtension,
|
|
474
|
-
Rs as isTruthy,
|
|
475
|
-
Xe as keysOf,
|
|
476
|
-
Ze as lint,
|
|
477
|
-
Qe as lintConfig,
|
|
478
|
-
D as lintDocument,
|
|
479
|
-
Q as lintEntityFile,
|
|
480
|
-
ce as lintEntityWithScorecardLevel,
|
|
481
|
-
Ae as lintFromString,
|
|
482
|
-
A as lintSchema,
|
|
483
|
-
es as loadConfig,
|
|
484
|
-
ss as loadIgnoreConfig,
|
|
485
|
-
ts as logger,
|
|
486
|
-
C as makeDocumentFromString,
|
|
487
|
-
as as mapTypeToComponent,
|
|
488
|
-
M as normalizeTypes,
|
|
489
|
-
$ as normalizeVisitors,
|
|
490
|
-
bs as parseYaml,
|
|
491
|
-
re as pause,
|
|
492
|
-
ns as pluralize,
|
|
493
|
-
Os as readFileFromUrl,
|
|
494
|
-
rs as regexFromString,
|
|
495
|
-
U as resolveDocument,
|
|
496
|
-
Is as resolvePath,
|
|
497
|
-
is as resolvePlugins,
|
|
498
|
-
os as slash,
|
|
499
|
-
Ns as stringifyYaml,
|
|
500
|
-
Ps as unescapePointerFragment,
|
|
501
|
-
ls as validate,
|
|
502
|
-
L as walkDocument,
|
|
503
|
-
cs as xmlEscape
|
|
504
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./replay-index-C8p-US63.js"),t=require("./replay-lint-BJ5AeIt-.js"),o=require("./replay-resolve-Id-g4Fn5.js");function F(e){return(c.pathBrowserifyExports.extname(e)===".yaml"||c.pathBrowserifyExports.extname(e)===".yml")&&!1}function j(e){return c.isPlainObject(e)&&!t.isEmptyObject(e)}async function z(e){return new Promise(s=>setTimeout(s,e))}const T="type",v=["api-description","api-operation","data-schema"];function P(e,s){const{ctx:n}=t.getNodeTypesFromJSONSchema("EntityFileDefault",s),{ctx:i,discriminatorResolver:r}=t.getNodeTypesFromJSONSchema("EntityFile",e);return{entityTypes:{...n,...i,EntityFileArray:{properties:{},items:p=>{if(c.isPlainObject(p)){const y=p[T];if(!y)return"Entity";const l=r?.(p,y);if(l&&typeof l=="string")return l}return"Entity"}}},discriminatorResolver:r}}const k=e=>({ExternalDocs:{leave(){e.externalDocs.total++}},ref:{enter(s){e.refs.items.add(s.$ref)}},Tag:{leave(s){e.tags.items.add(s.name)}},Link:{leave(s){e.links.items.add(s.operationId)}},WebhooksMap:{Operation:{leave(s){if(e.webhooks.total++,s.tags)for(const n of s.tags)e.tags.items.add(n)}}},Paths:{PathItem:{leave(){e.pathItems.total++},Operation:{leave(s){if(e.operations.total++,s.tags)for(const n of s.tags)e.tags.items.add(n)}},Parameter:{leave(s){e.parameters.items.add(s.name)}}}},NamedSchemas:{Schema:{leave(){e.schemas.total++}}},Root:{leave(){e.parameters.total=e.parameters.items.size,e.refs.total=e.refs.items.size,e.links.total=e.links.items.size,e.tags.total=e.tags.items.size}}}),x=e=>({ExternalDocs:{leave(){e.externalDocs.total++}},ref:{enter(s){e.refs.items.add(s.$ref)}},Tag:{leave(s){e.tags.items.add(s.name)}},ChannelMap:{Channel:{leave(){e.channels.total++},Operation:{leave(s){if(e.operations.total++,s.tags)for(const n of s.tags)e.tags.items.add(n)}},Parameter:{leave(s){s.name&&e.parameters.items.add(s.name)}}}},NamedSchemas:{Schema:{leave(){e.schemas.total++}}},Root:{leave(){e.parameters.total=e.parameters.items.size,e.refs.total=e.refs.items.size,e.tags.total=e.tags.items.size}}}),w=e=>({ExternalDocs:{leave(){e.externalDocs.total++}},ref:{enter(s){e.refs.items.add(s.$ref)}},Tag:{leave(s){e.tags.items.add(s.name)}},NamedChannels:{Channel:{leave(){e.channels.total++},Parameter:{leave(s){s.name&&e.parameters.items.add(s.name)}}}},NamedOperations:{Operation:{leave(s){if(e.operations.total++,s.tags)for(const n of s.tags)e.tags.items.add(n)}}},NamedSchemas:{Schema:{leave(){e.schemas.total++}}},Root:{leave(){e.parameters.total=e.parameters.items.size,e.refs.total=e.refs.items.size,e.tags.total=e.tags.items.size}}}),L=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,O=2,S=150,V=()=>({any(e,{report:s,location:n}){if(c.isPlainObject(e)&&"key"in e){const i=e.key;if(typeof i!="string"){s({message:"Entity `key` must be a string.",location:n.child(["key"])});return}i.length<O&&s({message:`Entity 'key' must be at least ${O} characters long.`,location:n.child(["key"])}),i.length>S&&s({message:`Entity 'key' must not exceed ${S} characters.`,location:n.child(["key"])}),L.test(i)||s({message:"Entity `key` must contain only lowercase letters, numbers, and hyphens, and cannot start or end with a hyphen.",location:n.child(["key"])})}}});function b(e,s){const i=s.split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")+e;return Object.values(t.t).includes(i)?i:e}function G(e,s){const n={};for(const[i,r]of Object.entries(s))if(R(i,r)){if(r.severity==="off")continue;n[i]={...Y(e,i,r)}}else n[i]=r;return n}function U(e){const s={},n={};for(const[i,r]of Object.entries(e))if(R(i,r)){const a=r;M(a)?s[i]=a:n[i]=a}else n[i]=r;return{entityRules:s,apiRules:n}}function B(e,s,n){if(!c.isPlainObject(n.parsed)||!c.isPlainObject(n.parsed.components))return null;const i=n.parsed.components,r="schemas"in i?i.schemas:void 0;if(!r||!(e in r))return null;const a=r[e];try{const p=JSON.parse(s);if(t.dequal(a,p))return a}catch{return null}return null}function R(e,s){return e.startsWith("rule/")&&c.isPlainObject(s)}function M(e){return Object.values(t.t).some(s=>e.subject.type===s)}function Y(e,s,n){const i=b(n.subject.type,e),r=n.where?.map(a=>({...a,subject:{...a.subject,type:b(a.subject.type,e)}}));return{assertionId:s,subject:{...n.subject,type:i},assertions:n.assertions,...r&&{where:r},...n.message&&{message:n.message},...n.severity&&{severity:n.severity}}}async function I(e){const{document:s,entitySchema:n,entityDefaultSchema:i,severity:r,externalRefResolver:a=new o.BaseResolver,assertionConfig:p={}}=e,y={problems:[],specVersion:"entity",visitorsData:{}},{entityTypes:l,discriminatorResolver:d}=P(n,i),m=o.normalizeTypes(l);let f=m.Entity;if(Array.isArray(s.parsed))f=m.EntityFileArray;else if(c.isPlainObject(s.parsed)){const u=s.parsed[T];if(!u)f=m.Entity;else{const E=d?.(s.parsed,u);E&&typeof E=="string"&&m[E]&&(f=m[E])}}const h=t.Assertions(p),g=Array.isArray(h)?h.map(u=>({severity:r||"error",ruleId:"entity assertions",visitor:u})):[{severity:r||"error",ruleId:"entity assertions",visitor:h}],C=[{severity:r||"error",ruleId:"entity struct",visitor:t.Struct()},{severity:r||"error",ruleId:"entity no-unresolved-refs",visitor:t.NoUnresolvedRefs()},{severity:r||"error",ruleId:"entity key-valid",visitor:V()},...g],D=t.normalizeVisitors(C,m),_=await o.resolveDocument({rootDocument:s,rootType:f,externalRefResolver:a});return t.walkDocument({document:s,rootType:f,normalizedVisitors:D,resolvedRefMap:_,ctx:y}),y.problems}async function $(e,s,n){if(!s.rules)throw new Error(`Scorecard level "${s.name}" has no rules defined.`);const i=new o.BaseResolver,r=o.makeDocumentFromString(JSON.stringify(e,null,2),"entity"),a=r.parsed[T],p=G(a||"unknown",s.rules),{entityRules:y,apiRules:l}=U(p),d=await I({document:r,entitySchema:t.Cs,entityDefaultSchema:t.Rs,externalRefResolver:i,assertionConfig:y});if(v.includes(e.type)){if(Object.keys(l).length===0)return d;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(g=>{if(c.isPlainObject(g)&&c.isPlainObject(g.subject)&&g.subject.type!=="Schema")throw new Error(`API rules for "data-schema" entity must target Schema subject, but found "${g.subject.type}".`)});const f=B(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 h=await N({schema:f,schemaKey:e.title,config:await t.createConfig({rules:l}),specType:e.metadata.specType,sourceDocument:n,externalRefResolver:i});return[...d,...h]}const m=await t.lintDocument({document:n,externalRefResolver:i,config:await t.createConfig({rules:l})});return[...d,...m]}else if(!t.isEmptyObject(l))throw new Error(`API rules are not supported for entity type "${e.type}". Only ${v.join(", ")} support API rules.`);return d}async function N(e){const{schema:s,schemaKey:n,config:i,sourceDocument:r,specType:a,externalRefResolver:p=new o.BaseResolver(i.resolve)}=e,y=r.parsed,l=y[a],d=y.info,m=o.makeDocumentFromString(JSON.stringify({[a]:l,info:d,components:{schemas:{[n]:s}}},null,2),r?.source.absoluteRef||`schema:${n}`);return(await t.lintDocument({document:m,config:i,externalRefResolver:p})).filter(h=>h.location.some(g=>g.pointer?.includes(`/components/schemas/${n}`)))}class q extends Error{}exports.isPlainObject=c.isPlainObject;exports.Arazzo1Types=t.Arazzo1Types;exports.Arazzo1_1Types=t.Arazzo1_1Types;exports.AsyncApi2Types=t.AsyncApi2Types;exports.AsyncApi3Types=t.AsyncApi3Types;exports.CONFIG_BUNDLER_VISITOR_ID=t.CONFIG_BUNDLER_VISITOR_ID;exports.CONFIG_FILE_NAME=t.CONFIG_FILE_NAME;exports.Config=t.Config;exports.ConfigTypes=t.ConfigTypes;exports.ConfigValidationError=t.ConfigValidationError;exports.DEFAULT_CONFIG=t.DEFAULT_CONFIG;exports.DEFAULT_PROJECT_PLUGIN_PATHS=t.DEFAULT_PROJECT_PLUGIN_PATHS;exports.IGNORE_BANNER=t.IGNORE_BANNER;exports.IGNORE_FILE=t.IGNORE_FILE;exports.Oas2Types=t.Oas2Types;exports.Oas3Types=t.Oas3Types;exports.Oas3_1Types=t.Oas3_1Types;exports.Oas3_2Types=t.Oas3_2Types;exports.OpenRpcTypes=t.OpenRpcTypes;exports.Overlay1Types=t.Overlay1Types;exports.PLUGINS_COLLECTOR_VISITOR_ID=t.PLUGINS_COLLECTOR_VISITOR_ID;exports.bundle=t.bundle;exports.bundleDocument=t.bundleDocument;exports.bundleFromString=t.bundleFromString;exports.clearPluginsCache=t.clearPluginsCache;exports.createConfig=t.createConfig;exports.createConfigTypes=t.createConfigTypes;exports.dequal=t.dequal;exports.detectSpec=t.detectSpec;exports.findConfig=t.findConfig;exports.formatProblems=t.formatProblems;exports.getAstNodeByPointer=t.getAstNodeByPointer;exports.getCodeframe=t.getCodeframe;exports.getLineColLocation=t.getLineColLocation;exports.getMajorSpecVersion=t.getMajorSpecVersion;exports.getPluginCacheVersion=t.getPluginCacheVersion;exports.getTotals=t.getTotals;exports.getTypes=t.getTypes;exports.isEmptyObject=t.isEmptyObject;exports.isNotEmptyArray=t.isNotEmptyArray;exports.isString=t.isString;exports.keysOf=t.keysOf;exports.lint=t.lint;exports.lintConfig=t.lintConfig;exports.lintDocument=t.lintDocument;exports.lintFromString=t.lintFromString;exports.loadConfig=t.loadConfig;exports.loadIgnoreConfig=t.loadIgnoreConfig;exports.logger=t.logger;exports.mapTypeToComponent=t.mapTypeToComponent;exports.normalizeVisitors=t.normalizeVisitors;exports.pluralize=t.pluralize;exports.regexFromString=t.regexFromString;exports.resolvePlugins=t.resolvePlugins;exports.slash=t.slash;exports.validate=t.lint;exports.walkDocument=t.walkDocument;exports.xmlEscape=t.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=q;exports.StatsAsync2=x;exports.StatsAsync3=w;exports.StatsOAS=k;exports.createEntityTypes=P;exports.doesYamlFileExist=F;exports.isNotEmptyObject=j;exports.lintEntityFile=I;exports.lintEntityWithScorecardLevel=$;exports.lintSchema=N;exports.pause=z;
|