@farming-labs/docs 0.2.114 → 0.2.116
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/{agent-5jyEosML.mjs → agent-CEZCaYto.mjs} +52 -7
- package/dist/{agent-Dlswu0Mm.mjs → agent-DGNTD-N6.mjs} +3 -3
- package/dist/{agent-evals-CnQC3W2a.mjs → agent-evals-CmeTjDMC.mjs} +3 -3
- package/dist/{agent-export-yilcRMg6.mjs → agent-export-DIKwVWYN.mjs} +11 -10
- package/dist/agent-skills-bundle.d.mts +8 -2
- package/dist/agent-skills-bundle.mjs +7 -1
- package/dist/{agent-skills-progressive-disclosure-DL-q4JZo.mjs → agent-skills-progressive-disclosure-BDSjGGFd.mjs} +1 -1
- package/dist/{agent-skills-server-CF6iVTBR.d.mts → agent-skills-server-BWRJjIQG.d.mts} +2 -2
- package/dist/{agent-skills-server-Ddbf15pY.mjs → agent-skills-server-Ddm90WL6.mjs} +1 -1
- package/dist/agent-skills-vite.d.mts +4 -4
- package/dist/agent-skills-vite.mjs +7 -3
- package/dist/{agents-D5waM-jZ.mjs → agents-l8RtkFim.mjs} +10 -9
- package/dist/{analytics-CwXxM9oL.d.mts → analytics-R9c-Md4b.d.mts} +1 -1
- package/dist/api-reference-0XdEWya8.mjs +3033 -0
- package/dist/{authoring-CsR0sewh.mjs → authoring-CvsCmYuq.mjs} +4 -4
- package/dist/{authoring-mcp-BpwboE3k.mjs → authoring-mcp-C35lj3cI.mjs} +2 -2
- package/dist/browser.d.mts +3 -3
- package/dist/cli/index.mjs +75 -34
- package/dist/client/react.d.mts +1 -1
- package/dist/{cloud-Bvof6mET.mjs → cloud-DtmNQJg2.mjs} +3 -3
- package/dist/{cloud-ask-ai-C9dvEBpW.d.mts → cloud-ask-ai-DLyrydIR.d.mts} +1 -1
- package/dist/{codeblocks-C911CdyJ.mjs → codeblocks-DEcqNXve.mjs} +2 -2
- package/dist/{content-change-hydration-CDuohygf.d.mts → content-change-hydration-BWJNUIot.d.mts} +33 -5
- package/dist/{dev-Bx0JNglW.mjs → dev-Df77AKR1.mjs} +9 -24
- package/dist/docs-cloud-server.d.mts +2 -2
- package/dist/docs-cloud-server.mjs +1 -1
- package/dist/{doctor-DbsNvdb8.mjs → doctor-zNmt9s6j.mjs} +266 -17
- package/dist/{downgrade-BXmQMkMy.mjs → downgrade-C6DSsOO9.mjs} +2 -2
- package/dist/{feedback-DWVUMrxy.mjs → feedback-CNsQP2jY.mjs} +1 -1
- package/dist/{golden-evaluations-D49vhw5u.mjs → golden-evaluations-B1QDOzYj.mjs} +6 -2
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +5 -5
- package/dist/{init-CCV2eRNB.mjs → init-BXKzipSS.mjs} +3 -3
- package/dist/{mcp-D-1u1RBW.mjs → mcp-Bj3ZoEtt.mjs} +33 -19
- package/dist/mcp.d.mts +12 -4
- package/dist/mcp.mjs +50 -8
- package/dist/openapi-anOaQn9o.mjs +20 -0
- package/dist/openapi-diff-DKW3xkQU.mjs +461 -0
- package/dist/{openapi-mcp-D8NVpTW1.mjs → openapi-mcp-UF4Cx885.mjs} +43 -91
- package/dist/openapi-operations-DFpaqOqA.mjs +324 -0
- package/dist/openapi-sdk-DqRHPsCb.mjs +415 -0
- package/dist/openapi-source-CiKbUK71.mjs +37 -0
- package/dist/{package-version-Ci99L0yo.mjs → package-version-CTkii52k.mjs} +1 -1
- package/dist/{prompt-references-CV1zw72C.mjs → prompt-references-Cficetgk.mjs} +2 -2
- package/dist/{retrieval-digest-CBhsp9LK.d.mts → retrieval-digest-PD4fFy7P.d.mts} +2 -2
- package/dist/{review-BdM27yh7.mjs → review-CcplK9Hj.mjs} +9 -9
- package/dist/{robots-Bne9ODlC.mjs → robots-BPYWIGqD.mjs} +1 -1
- package/dist/{robots-D6VufwPn.mjs → robots-D4T3zZr_.mjs} +4 -4
- package/dist/{search-BCxmGlxh.mjs → search-BNmlDQJ2.mjs} +27 -11
- package/dist/server.d.mts +132 -9
- package/dist/server.mjs +12 -10
- package/dist/{sidebar-Bne72SU-.d.mts → sidebar-CGbvEPTX.d.mts} +1 -1
- package/dist/{sitemap-ChOEBnrk.mjs → sitemap-Bc4LkIcm.mjs} +10 -9
- package/dist/sitemap-server-C4bpuoLi.mjs +235 -0
- package/dist/{skills-qswruIKO.mjs → skills-B6wl1bUL.mjs} +10 -9
- package/dist/{standards-discovery-CjyUCxdy.d.mts → standards-discovery-C1RLKwV9.d.mts} +1 -1
- package/dist/{templates-DdB4BBGq.mjs → templates-BiORflC3.mjs} +1 -2
- package/dist/{types-BkAk6B2d.d.mts → types-Dkl2DUfp.d.mts} +39 -9
- package/dist/{upgrade-B92U83xo.mjs → upgrade-8zStRidw.mjs} +2 -2
- package/package.json +2 -1
- package/dist/sitemap-server-D3mFJkjE.mjs +0 -1166
- /package/dist/{agent-feedback-loop-vaC-M1sx.mjs → agent-feedback-loop-CcZL_sb1.mjs} +0 -0
- /package/dist/{audience-exposure-CkNZNeVX.d.mts → audience-exposure-BAjHjaTT.d.mts} +0 -0
- /package/dist/{cloud-ask-ai-CK2qlNns.mjs → cloud-ask-ai-BDtBbbZZ.mjs} +0 -0
- /package/dist/{code-blocks-D90CCJFs.mjs → code-blocks-GYdvS3BH.mjs} +0 -0
- /package/dist/{config-DrZ3fXgf.mjs → config-BnUOoj07.mjs} +0 -0
- /package/dist/{errors-BDmra6mz.mjs → errors-BkS29NUA.mjs} +0 -0
- /package/dist/{feedback-evals-k0sFDdms.mjs → feedback-evals-CYuS2wTu.mjs} +0 -0
- /package/dist/{openapi-mcp-node-vO3IXVGI.mjs → openapi-mcp-node-C4jUpZG6.mjs} +0 -0
- /package/dist/{propose-DJOiHu9Y.mjs → propose-ZH_mGMY_.mjs} +0 -0
- /package/dist/{utils-Cc1SrVza.mjs → utils-c9arebCi.mjs} +0 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
//#region src/openapi-operations.ts
|
|
2
|
+
const OPENAPI_OPERATION_METHODS = [
|
|
3
|
+
"get",
|
|
4
|
+
"put",
|
|
5
|
+
"post",
|
|
6
|
+
"delete",
|
|
7
|
+
"options",
|
|
8
|
+
"head",
|
|
9
|
+
"patch",
|
|
10
|
+
"trace"
|
|
11
|
+
];
|
|
12
|
+
function buildNormalizedOpenApiModel(document) {
|
|
13
|
+
const info = asRecord(document.info);
|
|
14
|
+
const specificationVersion = stringValue(document.openapi) ?? stringValue(document.swagger) ?? "unknown";
|
|
15
|
+
const servers = normalizeServers(document);
|
|
16
|
+
const globalSecurity = normalizeSecurity(document.security);
|
|
17
|
+
const securitySchemes = normalizeSecuritySchemes(document);
|
|
18
|
+
const paths = asRecord(document.paths) ?? {};
|
|
19
|
+
const operations = [];
|
|
20
|
+
const operationIds = /* @__PURE__ */ new Map();
|
|
21
|
+
for (const path of Object.keys(paths).sort()) {
|
|
22
|
+
if (path.startsWith("x-")) continue;
|
|
23
|
+
const pathItem = resolveRecord(document, paths[path]);
|
|
24
|
+
if (!pathItem) continue;
|
|
25
|
+
for (const method of OPENAPI_OPERATION_METHODS) {
|
|
26
|
+
const operation = resolveRecord(document, pathItem[method]);
|
|
27
|
+
if (!operation) continue;
|
|
28
|
+
const selector = `${method.toUpperCase()} ${path}`;
|
|
29
|
+
const explicitOperationId = stringValue(operation.operationId);
|
|
30
|
+
const operationId = explicitOperationId ?? createGeneratedOperationId(method, path);
|
|
31
|
+
const pointer = `/paths/${escapeJsonPointer(path)}/${method}`;
|
|
32
|
+
const previousPointer = operationIds.get(operationId);
|
|
33
|
+
if (previousPointer) throw new Error(`OpenAPI operation ID collision: \`${operationId}\` is used at ${previousPointer} and ${pointer}.`);
|
|
34
|
+
operationIds.set(operationId, pointer);
|
|
35
|
+
const parameters = normalizeParameters(document, pathItem.parameters, operation.parameters);
|
|
36
|
+
const requestBody = normalizeRequestBody(document, operation.requestBody, parameters, document, operation);
|
|
37
|
+
const responses = normalizeResponses(document, operation.responses, document, operation);
|
|
38
|
+
const security = operation.security === void 0 ? globalSecurity : normalizeSecurity(operation.security);
|
|
39
|
+
const usedSchemeNames = new Set(security.flatMap((requirement) => Object.keys(requirement)));
|
|
40
|
+
const usedSecuritySchemes = Object.fromEntries(Object.entries(securitySchemes).filter(([name]) => usedSchemeNames.has(name)));
|
|
41
|
+
const tags = normalizeTags(operation.tags, path);
|
|
42
|
+
const summary = stringValue(operation.summary);
|
|
43
|
+
const description = stringValue(operation.description);
|
|
44
|
+
const operationServers = normalizeServerValues(operation.servers);
|
|
45
|
+
const pathServers = normalizeServerValues(pathItem.servers);
|
|
46
|
+
const examples = [
|
|
47
|
+
...parameters.flatMap((parameter) => parameter.examples),
|
|
48
|
+
...requestBody?.content.flatMap((entry) => entry.examples) ?? [],
|
|
49
|
+
...responses.flatMap((response) => response.content.flatMap((entry) => entry.examples))
|
|
50
|
+
];
|
|
51
|
+
operations.push({
|
|
52
|
+
id: operationId,
|
|
53
|
+
operationId,
|
|
54
|
+
operationIdSource: explicitOperationId ? "explicit" : "generated",
|
|
55
|
+
slug: createOperationSlug(operationId),
|
|
56
|
+
selector,
|
|
57
|
+
pointer,
|
|
58
|
+
method: method.toUpperCase(),
|
|
59
|
+
path,
|
|
60
|
+
title: summary ?? description ?? selector,
|
|
61
|
+
...summary ? { summary } : {},
|
|
62
|
+
...description ? { description } : {},
|
|
63
|
+
tags,
|
|
64
|
+
deprecated: operation.deprecated === true,
|
|
65
|
+
parameters,
|
|
66
|
+
...requestBody ? { requestBody } : {},
|
|
67
|
+
responses,
|
|
68
|
+
examples,
|
|
69
|
+
security,
|
|
70
|
+
securitySchemes: usedSecuritySchemes,
|
|
71
|
+
servers: operationServers.length > 0 ? operationServers : pathServers.length > 0 ? pathServers : servers,
|
|
72
|
+
extensions: Object.fromEntries(Object.entries(operation).filter(([key]) => key.startsWith("x-")))
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const declaredTags = Array.isArray(document.tags) ? document.tags.flatMap((tag) => {
|
|
77
|
+
const name = stringValue(asRecord(tag)?.name);
|
|
78
|
+
return name ? [name] : [];
|
|
79
|
+
}) : [];
|
|
80
|
+
const tags = Array.from(new Set([...declaredTags, ...operations.flatMap((operation) => operation.tags)]));
|
|
81
|
+
return {
|
|
82
|
+
title: stringValue(info?.title) ?? "API Reference",
|
|
83
|
+
version: stringValue(info?.version) ?? "0.0.0",
|
|
84
|
+
specificationVersion,
|
|
85
|
+
servers,
|
|
86
|
+
tags,
|
|
87
|
+
operationCount: operations.length,
|
|
88
|
+
operations
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function normalizeParameters(document, pathParameters, operationParameters) {
|
|
92
|
+
const parameters = /* @__PURE__ */ new Map();
|
|
93
|
+
for (const value of [pathParameters, operationParameters]) {
|
|
94
|
+
if (!Array.isArray(value)) continue;
|
|
95
|
+
for (const item of value) {
|
|
96
|
+
const parameter = resolveRecord(document, item);
|
|
97
|
+
if (!parameter) continue;
|
|
98
|
+
const name = stringValue(parameter.name);
|
|
99
|
+
const location = stringValue(parameter.in);
|
|
100
|
+
if (!name || !location) continue;
|
|
101
|
+
const examples = normalizeParameterExamples(document, parameter);
|
|
102
|
+
const description = stringValue(parameter.description);
|
|
103
|
+
parameters.set(`${location}:${name}`, {
|
|
104
|
+
name,
|
|
105
|
+
in: location,
|
|
106
|
+
required: parameter.required === true || location === "path",
|
|
107
|
+
...description ? { description } : {},
|
|
108
|
+
...parameter.schema !== void 0 ? { schema: parameter.schema } : {},
|
|
109
|
+
examples
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return Array.from(parameters.values());
|
|
114
|
+
}
|
|
115
|
+
function normalizeParameterExamples(document, parameter) {
|
|
116
|
+
const examples = [];
|
|
117
|
+
if (parameter.example !== void 0) examples.push({
|
|
118
|
+
name: "default",
|
|
119
|
+
location: "parameter",
|
|
120
|
+
value: parameter.example
|
|
121
|
+
});
|
|
122
|
+
const exampleMap = asRecord(parameter.examples);
|
|
123
|
+
if (exampleMap) for (const name of Object.keys(exampleMap).sort()) examples.push(normalizeExample(document, name, exampleMap[name], "parameter"));
|
|
124
|
+
return examples;
|
|
125
|
+
}
|
|
126
|
+
function normalizeRequestBody(document, value, parameters, root, operation) {
|
|
127
|
+
const requestBody = resolveRecord(document, value);
|
|
128
|
+
if (requestBody) {
|
|
129
|
+
const description = stringValue(requestBody.description);
|
|
130
|
+
return {
|
|
131
|
+
required: requestBody.required === true,
|
|
132
|
+
...description ? { description } : {},
|
|
133
|
+
content: normalizeContent(document, requestBody.content, "request")
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const bodyParameter = parameters.find((parameter) => parameter.in === "body");
|
|
137
|
+
if (!bodyParameter) return void 0;
|
|
138
|
+
const consumes = normalizeStringArray(operation.consumes);
|
|
139
|
+
const mediaTypes = consumes.length > 0 ? consumes : normalizeStringArray(root.consumes);
|
|
140
|
+
return {
|
|
141
|
+
required: bodyParameter.required,
|
|
142
|
+
...bodyParameter.description ? { description: bodyParameter.description } : {},
|
|
143
|
+
content: (mediaTypes.length > 0 ? mediaTypes : ["application/json"]).map((mediaType) => ({
|
|
144
|
+
mediaType,
|
|
145
|
+
...bodyParameter.schema !== void 0 ? { schema: bodyParameter.schema } : {},
|
|
146
|
+
examples: bodyParameter.examples
|
|
147
|
+
}))
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function normalizeResponses(document, value, root, operation) {
|
|
151
|
+
const responses = asRecord(value);
|
|
152
|
+
if (!responses) return [];
|
|
153
|
+
const produces = normalizeStringArray(operation.produces);
|
|
154
|
+
const fallbackMediaTypes = produces.length > 0 ? produces : normalizeStringArray(root.produces);
|
|
155
|
+
return Object.keys(responses).sort(compareResponseStatus).flatMap((status) => {
|
|
156
|
+
const response = resolveRecord(document, responses[status]);
|
|
157
|
+
if (!response) return [];
|
|
158
|
+
const description = stringValue(response.description);
|
|
159
|
+
let content = normalizeContent(document, response.content, "response", status);
|
|
160
|
+
if (content.length === 0 && response.schema !== void 0) {
|
|
161
|
+
const legacyExamples = asRecord(response.examples);
|
|
162
|
+
content = (fallbackMediaTypes.length > 0 ? fallbackMediaTypes : ["application/json"]).map((mediaType) => ({
|
|
163
|
+
mediaType,
|
|
164
|
+
schema: response.schema,
|
|
165
|
+
examples: legacyExamples && Object.hasOwn(legacyExamples, mediaType) ? [{
|
|
166
|
+
name: "default",
|
|
167
|
+
location: "response",
|
|
168
|
+
status,
|
|
169
|
+
mediaType,
|
|
170
|
+
value: legacyExamples[mediaType]
|
|
171
|
+
}] : []
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
return [{
|
|
175
|
+
status,
|
|
176
|
+
...description ? { description } : {},
|
|
177
|
+
content
|
|
178
|
+
}];
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function normalizeContent(document, value, location, status) {
|
|
182
|
+
const content = asRecord(value);
|
|
183
|
+
if (!content) return [];
|
|
184
|
+
return Object.keys(content).sort().flatMap((mediaType) => {
|
|
185
|
+
const media = resolveRecord(document, content[mediaType]);
|
|
186
|
+
if (!media) return [];
|
|
187
|
+
const examples = [];
|
|
188
|
+
if (media.example !== void 0) examples.push({
|
|
189
|
+
name: "default",
|
|
190
|
+
location,
|
|
191
|
+
mediaType,
|
|
192
|
+
...status ? { status } : {},
|
|
193
|
+
value: media.example
|
|
194
|
+
});
|
|
195
|
+
const exampleMap = asRecord(media.examples);
|
|
196
|
+
if (exampleMap) for (const name of Object.keys(exampleMap).sort()) examples.push(normalizeExample(document, name, exampleMap[name], location, mediaType, status));
|
|
197
|
+
return [{
|
|
198
|
+
mediaType,
|
|
199
|
+
...media.schema !== void 0 ? { schema: media.schema } : {},
|
|
200
|
+
examples
|
|
201
|
+
}];
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function normalizeExample(document, name, value, location, mediaType, status) {
|
|
205
|
+
const example = resolveRecord(document, value);
|
|
206
|
+
if (!example) return {
|
|
207
|
+
name,
|
|
208
|
+
location,
|
|
209
|
+
...mediaType ? { mediaType } : {},
|
|
210
|
+
...status ? { status } : {},
|
|
211
|
+
value
|
|
212
|
+
};
|
|
213
|
+
const summary = stringValue(example.summary);
|
|
214
|
+
const description = stringValue(example.description);
|
|
215
|
+
const externalValue = stringValue(example.externalValue);
|
|
216
|
+
return {
|
|
217
|
+
name,
|
|
218
|
+
location,
|
|
219
|
+
...summary ? { summary } : {},
|
|
220
|
+
...description ? { description } : {},
|
|
221
|
+
...mediaType ? { mediaType } : {},
|
|
222
|
+
...status ? { status } : {},
|
|
223
|
+
...Object.hasOwn(example, "value") ? { value: example.value } : {},
|
|
224
|
+
...externalValue ? { externalValue } : {}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function normalizeSecuritySchemes(document) {
|
|
228
|
+
const schemes = asRecord(asRecord(document.components)?.securitySchemes) ?? asRecord(document.securityDefinitions);
|
|
229
|
+
if (!schemes) return {};
|
|
230
|
+
return Object.fromEntries(Object.entries(schemes).map(([name, value]) => [name, resolveRecord(document, value) ?? value]));
|
|
231
|
+
}
|
|
232
|
+
function normalizeSecurity(value) {
|
|
233
|
+
if (!Array.isArray(value)) return [];
|
|
234
|
+
return value.flatMap((requirement) => {
|
|
235
|
+
const record = asRecord(requirement);
|
|
236
|
+
if (!record) return [];
|
|
237
|
+
return [Object.fromEntries(Object.entries(record).map(([name, scopes]) => [name, normalizeStringArray(scopes)]))];
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
function normalizeServers(document) {
|
|
241
|
+
const servers = normalizeServerValues(document.servers);
|
|
242
|
+
if (servers.length > 0) return servers;
|
|
243
|
+
const host = stringValue(document.host);
|
|
244
|
+
if (!host) return [];
|
|
245
|
+
const schemes = normalizeStringArray(document.schemes);
|
|
246
|
+
const basePath = stringValue(document.basePath) ?? "";
|
|
247
|
+
return (schemes.length > 0 ? schemes : ["https"]).map((scheme) => `${scheme}://${host}${basePath}`);
|
|
248
|
+
}
|
|
249
|
+
function normalizeServerValues(value) {
|
|
250
|
+
if (!Array.isArray(value)) return [];
|
|
251
|
+
return value.flatMap((server) => {
|
|
252
|
+
const url = stringValue(asRecord(server)?.url);
|
|
253
|
+
return url ? [url] : [];
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function normalizeTags(value, path) {
|
|
257
|
+
const tags = normalizeStringArray(value);
|
|
258
|
+
return tags.length > 0 ? tags : [inferTag(path)];
|
|
259
|
+
}
|
|
260
|
+
function inferTag(path) {
|
|
261
|
+
const segment = path.split("/").filter(Boolean).find((part) => !part.startsWith("{"));
|
|
262
|
+
if (!segment) return "General";
|
|
263
|
+
return segment.replace(/[-_]+/g, " ").replace(/\b\w/g, (character) => character.toUpperCase());
|
|
264
|
+
}
|
|
265
|
+
function resolveRecord(document, value, activeReferences = /* @__PURE__ */ new Set()) {
|
|
266
|
+
const record = asRecord(value);
|
|
267
|
+
if (!record) return void 0;
|
|
268
|
+
const reference = stringValue(record.$ref);
|
|
269
|
+
if (!reference || !reference.startsWith("#/")) return record;
|
|
270
|
+
if (activeReferences.has(reference)) return Object.fromEntries(Object.entries(record).filter(([key]) => key !== "$ref"));
|
|
271
|
+
const resolved = resolveRecord(document, resolveJsonPointer(document, reference.slice(1)), new Set(activeReferences).add(reference));
|
|
272
|
+
const siblings = Object.fromEntries(Object.entries(record).filter(([key]) => key !== "$ref"));
|
|
273
|
+
return resolved ? {
|
|
274
|
+
...resolved,
|
|
275
|
+
...siblings
|
|
276
|
+
} : Object.keys(siblings).length > 0 ? siblings : record;
|
|
277
|
+
}
|
|
278
|
+
function resolveJsonPointer(document, pointer) {
|
|
279
|
+
let current = document;
|
|
280
|
+
for (const token of pointer.slice(1).split("/")) {
|
|
281
|
+
if (!current || typeof current !== "object") return void 0;
|
|
282
|
+
const key = token.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
283
|
+
current = current[key];
|
|
284
|
+
}
|
|
285
|
+
return current;
|
|
286
|
+
}
|
|
287
|
+
function createGeneratedOperationId(method, path) {
|
|
288
|
+
return `${method}_${path.replace(/[^a-zA-Z0-9]+/g, "_")}`;
|
|
289
|
+
}
|
|
290
|
+
function createOperationSlug(operationId) {
|
|
291
|
+
return `${operationId.trim().replace(/([a-z\d])([A-Z])/g, "$1-$2").replace(/[^a-zA-Z0-9]+/g, "-").replace(/^-+|-+$/g, "").toLowerCase() || "operation"}-${fnv1a32(operationId).toString(36)}`;
|
|
292
|
+
}
|
|
293
|
+
function fnv1a32(value) {
|
|
294
|
+
let hash = 2166136261;
|
|
295
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
296
|
+
hash ^= value.charCodeAt(index);
|
|
297
|
+
hash = Math.imul(hash, 16777619);
|
|
298
|
+
}
|
|
299
|
+
return hash >>> 0;
|
|
300
|
+
}
|
|
301
|
+
function compareResponseStatus(left, right) {
|
|
302
|
+
if (left === "default") return 1;
|
|
303
|
+
if (right === "default") return -1;
|
|
304
|
+
return left.localeCompare(right, void 0, { numeric: true });
|
|
305
|
+
}
|
|
306
|
+
function normalizeStringArray(value) {
|
|
307
|
+
if (!Array.isArray(value)) return [];
|
|
308
|
+
return value.flatMap((item) => {
|
|
309
|
+
const normalized = stringValue(item);
|
|
310
|
+
return normalized ? [normalized] : [];
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function stringValue(value) {
|
|
314
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
315
|
+
}
|
|
316
|
+
function asRecord(value) {
|
|
317
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
318
|
+
}
|
|
319
|
+
function escapeJsonPointer(value) {
|
|
320
|
+
return value.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
//#endregion
|
|
324
|
+
export { buildNormalizedOpenApiModel as n, OPENAPI_OPERATION_METHODS as t };
|