httpsnippet-client-api 7.0.0-alpha.6 → 7.0.0-beta.12
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 +35 -9
- package/dist/index.cjs +253 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -6
- package/dist/index.d.ts +20 -6
- package/dist/index.js +249 -21
- package/dist/index.js.map +1 -1
- package/package.json +12 -10
- package/src/index.ts +96 -29
- package/tsup.config.ts +11 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,218 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { CodeBuilder } from "@readme/httpsnippet/helpers/code-builder";
|
|
3
|
+
|
|
4
|
+
// node_modules/camelcase/index.js
|
|
5
|
+
var UPPERCASE = /[\p{Lu}]/u;
|
|
6
|
+
var LOWERCASE = /[\p{Ll}]/u;
|
|
7
|
+
var LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
|
8
|
+
var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
9
|
+
var SEPARATORS = /[_.\- ]+/;
|
|
10
|
+
var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
11
|
+
var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
12
|
+
var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
13
|
+
var preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase2) => {
|
|
14
|
+
let isLastCharLower = false;
|
|
15
|
+
let isLastCharUpper = false;
|
|
16
|
+
let isLastLastCharUpper = false;
|
|
17
|
+
let isLastLastCharPreserved = false;
|
|
18
|
+
for (let index = 0; index < string.length; index++) {
|
|
19
|
+
const character = string[index];
|
|
20
|
+
isLastLastCharPreserved = index > 2 ? string[index - 3] === "-" : true;
|
|
21
|
+
if (isLastCharLower && UPPERCASE.test(character)) {
|
|
22
|
+
string = string.slice(0, index) + "-" + string.slice(index);
|
|
23
|
+
isLastCharLower = false;
|
|
24
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
25
|
+
isLastCharUpper = true;
|
|
26
|
+
index++;
|
|
27
|
+
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase2)) {
|
|
28
|
+
string = string.slice(0, index - 1) + "-" + string.slice(index - 1);
|
|
29
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
30
|
+
isLastCharUpper = false;
|
|
31
|
+
isLastCharLower = true;
|
|
32
|
+
} else {
|
|
33
|
+
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
|
34
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
35
|
+
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return string;
|
|
39
|
+
};
|
|
40
|
+
var preserveConsecutiveUppercase = (input, toLowerCase) => {
|
|
41
|
+
LEADING_CAPITAL.lastIndex = 0;
|
|
42
|
+
return input.replaceAll(LEADING_CAPITAL, (match) => toLowerCase(match));
|
|
43
|
+
};
|
|
44
|
+
var postProcess = (input, toUpperCase) => {
|
|
45
|
+
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
46
|
+
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
47
|
+
return input.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ["_", "-"].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match)).replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));
|
|
48
|
+
};
|
|
49
|
+
function camelCase(input, options) {
|
|
50
|
+
if (!(typeof input === "string" || Array.isArray(input))) {
|
|
51
|
+
throw new TypeError("Expected the input to be `string | string[]`");
|
|
52
|
+
}
|
|
53
|
+
options = {
|
|
54
|
+
pascalCase: false,
|
|
55
|
+
preserveConsecutiveUppercase: false,
|
|
56
|
+
...options
|
|
57
|
+
};
|
|
58
|
+
if (Array.isArray(input)) {
|
|
59
|
+
input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
|
|
60
|
+
} else {
|
|
61
|
+
input = input.trim();
|
|
62
|
+
}
|
|
63
|
+
if (input.length === 0) {
|
|
64
|
+
return "";
|
|
65
|
+
}
|
|
66
|
+
const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
|
|
67
|
+
const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
|
|
68
|
+
if (input.length === 1) {
|
|
69
|
+
if (SEPARATORS.test(input)) {
|
|
70
|
+
return "";
|
|
71
|
+
}
|
|
72
|
+
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
|
73
|
+
}
|
|
74
|
+
const hasUpperCase = input !== toLowerCase(input);
|
|
75
|
+
if (hasUpperCase) {
|
|
76
|
+
input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
|
|
77
|
+
}
|
|
78
|
+
input = input.replace(LEADING_SEPARATORS, "");
|
|
79
|
+
input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
|
|
80
|
+
if (options.pascalCase) {
|
|
81
|
+
input = toUpperCase(input.charAt(0)) + input.slice(1);
|
|
82
|
+
}
|
|
83
|
+
return postProcess(input, toUpperCase);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/index.ts
|
|
3
87
|
import contentType from "content-type";
|
|
4
88
|
import Oas from "oas";
|
|
5
89
|
import { matchesMimeType } from "oas/utils";
|
|
6
|
-
import
|
|
90
|
+
import { isReservedOrBuiltinsLC } from "reserved2";
|
|
91
|
+
|
|
92
|
+
// ../../node_modules/is-regexp/index.js
|
|
93
|
+
var { toString } = Object.prototype;
|
|
94
|
+
function isRegexp(value) {
|
|
95
|
+
return toString.call(value) === "[object RegExp]";
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ../../node_modules/stringify-object/node_modules/is-obj/index.js
|
|
99
|
+
function isObject(value) {
|
|
100
|
+
const type = typeof value;
|
|
101
|
+
return value !== null && (type === "object" || type === "function");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ../../node_modules/get-own-enumerable-keys/index.js
|
|
105
|
+
var { propertyIsEnumerable } = Object.prototype;
|
|
106
|
+
function getOwnEnumerableKeys(object) {
|
|
107
|
+
return [
|
|
108
|
+
...Object.keys(object),
|
|
109
|
+
...Object.getOwnPropertySymbols(object).filter((key) => propertyIsEnumerable.call(object, key))
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ../../node_modules/stringify-object/index.js
|
|
114
|
+
function stringifyObject(input, options, pad) {
|
|
115
|
+
const seen = [];
|
|
116
|
+
return function stringify2(input2, options2 = {}, pad2 = "") {
|
|
117
|
+
const indent = options2.indent || " ";
|
|
118
|
+
let tokens;
|
|
119
|
+
if (options2.inlineCharacterLimit === void 0) {
|
|
120
|
+
tokens = {
|
|
121
|
+
newline: "\n",
|
|
122
|
+
newlineOrSpace: "\n",
|
|
123
|
+
pad: pad2,
|
|
124
|
+
indent: pad2 + indent
|
|
125
|
+
};
|
|
126
|
+
} else {
|
|
127
|
+
tokens = {
|
|
128
|
+
newline: "@@__STRINGIFY_OBJECT_NEW_LINE__@@",
|
|
129
|
+
newlineOrSpace: "@@__STRINGIFY_OBJECT_NEW_LINE_OR_SPACE__@@",
|
|
130
|
+
pad: "@@__STRINGIFY_OBJECT_PAD__@@",
|
|
131
|
+
indent: "@@__STRINGIFY_OBJECT_INDENT__@@"
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
const expandWhiteSpace = (string) => {
|
|
135
|
+
if (options2.inlineCharacterLimit === void 0) {
|
|
136
|
+
return string;
|
|
137
|
+
}
|
|
138
|
+
const oneLined = string.replace(new RegExp(tokens.newline, "g"), "").replace(new RegExp(tokens.newlineOrSpace, "g"), " ").replace(new RegExp(tokens.pad + "|" + tokens.indent, "g"), "");
|
|
139
|
+
if (oneLined.length <= options2.inlineCharacterLimit) {
|
|
140
|
+
return oneLined;
|
|
141
|
+
}
|
|
142
|
+
return string.replace(new RegExp(tokens.newline + "|" + tokens.newlineOrSpace, "g"), "\n").replace(new RegExp(tokens.pad, "g"), pad2).replace(new RegExp(tokens.indent, "g"), pad2 + indent);
|
|
143
|
+
};
|
|
144
|
+
if (seen.includes(input2)) {
|
|
145
|
+
return '"[Circular]"';
|
|
146
|
+
}
|
|
147
|
+
if (input2 === null || input2 === void 0 || typeof input2 === "number" || typeof input2 === "boolean" || typeof input2 === "function" || typeof input2 === "symbol" || isRegexp(input2)) {
|
|
148
|
+
return String(input2);
|
|
149
|
+
}
|
|
150
|
+
if (input2 instanceof Date) {
|
|
151
|
+
return `new Date('${input2.toISOString()}')`;
|
|
152
|
+
}
|
|
153
|
+
if (Array.isArray(input2)) {
|
|
154
|
+
if (input2.length === 0) {
|
|
155
|
+
return "[]";
|
|
156
|
+
}
|
|
157
|
+
seen.push(input2);
|
|
158
|
+
const returnValue = "[" + tokens.newline + input2.map((element, i) => {
|
|
159
|
+
const eol = input2.length - 1 === i ? tokens.newline : "," + tokens.newlineOrSpace;
|
|
160
|
+
let value = stringify2(element, options2, pad2 + indent);
|
|
161
|
+
if (options2.transform) {
|
|
162
|
+
value = options2.transform(input2, i, value);
|
|
163
|
+
}
|
|
164
|
+
return tokens.indent + value + eol;
|
|
165
|
+
}).join("") + tokens.pad + "]";
|
|
166
|
+
seen.pop();
|
|
167
|
+
return expandWhiteSpace(returnValue);
|
|
168
|
+
}
|
|
169
|
+
if (isObject(input2)) {
|
|
170
|
+
let objectKeys = getOwnEnumerableKeys(input2);
|
|
171
|
+
if (options2.filter) {
|
|
172
|
+
objectKeys = objectKeys.filter((element) => options2.filter(input2, element));
|
|
173
|
+
}
|
|
174
|
+
if (objectKeys.length === 0) {
|
|
175
|
+
return "{}";
|
|
176
|
+
}
|
|
177
|
+
seen.push(input2);
|
|
178
|
+
const returnValue = "{" + tokens.newline + objectKeys.map((element, index) => {
|
|
179
|
+
const eol = objectKeys.length - 1 === index ? tokens.newline : "," + tokens.newlineOrSpace;
|
|
180
|
+
const isSymbol = typeof element === "symbol";
|
|
181
|
+
const isClassic = !isSymbol && /^[a-z$_][$\w]*$/i.test(element);
|
|
182
|
+
const key = isSymbol || isClassic ? element : stringify2(element, options2);
|
|
183
|
+
let value = stringify2(input2[element], options2, pad2 + indent);
|
|
184
|
+
if (options2.transform) {
|
|
185
|
+
value = options2.transform(input2, element, value);
|
|
186
|
+
}
|
|
187
|
+
return tokens.indent + String(key) + ": " + value + eol;
|
|
188
|
+
}).join("") + tokens.pad + "}";
|
|
189
|
+
seen.pop();
|
|
190
|
+
return expandWhiteSpace(returnValue);
|
|
191
|
+
}
|
|
192
|
+
input2 = input2.replace(/\\/g, "\\\\");
|
|
193
|
+
input2 = String(input2).replace(/[\r\n]/g, (x) => x === "\n" ? "\\n" : "\\r");
|
|
194
|
+
if (options2.singleQuotes === false) {
|
|
195
|
+
input2 = input2.replace(/"/g, '\\"');
|
|
196
|
+
return `"${input2}"`;
|
|
197
|
+
}
|
|
198
|
+
input2 = input2.replace(/'/g, "\\'");
|
|
199
|
+
return `'${input2}'`;
|
|
200
|
+
}(input, options, pad);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// src/index.ts
|
|
204
|
+
var registryUUIDRegex = /^@(?<project>[a-zA-Z0-9-_]+)(\/?(?<version>.+))?#(?<uuid>[a-z0-9]+)$/;
|
|
205
|
+
function getProjectPrefixFromRegistryUUID(uri) {
|
|
206
|
+
const matches = uri.match(registryUUIDRegex);
|
|
207
|
+
if (!matches) {
|
|
208
|
+
return void 0;
|
|
209
|
+
}
|
|
210
|
+
return matches.groups?.project;
|
|
211
|
+
}
|
|
7
212
|
function stringify(obj, opts = {}) {
|
|
8
213
|
return stringifyObject(obj, { indent: " ", ...opts });
|
|
9
214
|
}
|
|
10
|
-
function buildAuthSnippet(authKey) {
|
|
215
|
+
function buildAuthSnippet(sdkVariable, authKey) {
|
|
11
216
|
if (Array.isArray(authKey)) {
|
|
12
217
|
const auth = [];
|
|
13
218
|
authKey.forEach((token, i) => {
|
|
@@ -16,9 +221,9 @@ function buildAuthSnippet(authKey) {
|
|
|
16
221
|
}
|
|
17
222
|
auth.push(`'${token.replace(/'/g, "\\'")}'`);
|
|
18
223
|
});
|
|
19
|
-
return
|
|
224
|
+
return `${sdkVariable}.auth(${auth.join(", ")});`;
|
|
20
225
|
}
|
|
21
|
-
return
|
|
226
|
+
return `${sdkVariable}.auth('${authKey.replace(/'/g, "\\'")}');`;
|
|
22
227
|
}
|
|
23
228
|
function getAuthSources(operation) {
|
|
24
229
|
const matchers = {
|
|
@@ -58,26 +263,41 @@ var client = {
|
|
|
58
263
|
title: "API",
|
|
59
264
|
link: "https://npm.im/api",
|
|
60
265
|
description: "Automatic SDK generation from an OpenAPI definition.",
|
|
61
|
-
extname: ".js"
|
|
266
|
+
extname: ".js",
|
|
267
|
+
installation: 'npx api install "{packageName}"'
|
|
62
268
|
},
|
|
63
269
|
convert: ({ cookiesObj, headersObj, postData, queryObj, url, ...source }, options) => {
|
|
64
270
|
const opts = {
|
|
65
271
|
...options
|
|
66
272
|
};
|
|
67
|
-
if (!
|
|
68
|
-
throw new Error("This
|
|
69
|
-
} else if (!
|
|
70
|
-
throw new Error("This
|
|
273
|
+
if (!opts?.api) {
|
|
274
|
+
throw new Error("This HTTPSnippet client must have an `api` config supplied to it.");
|
|
275
|
+
} else if (!opts?.api?.definition) {
|
|
276
|
+
throw new Error("This HTTPSnippet client must have an `api.definition` option supplied to it.");
|
|
277
|
+
} else if (!opts?.api?.registryURI) {
|
|
278
|
+
throw new Error("This HTTPSnippet client must have an `api.registryURI` option supplied to it.");
|
|
71
279
|
}
|
|
72
280
|
const method = source.method.toLowerCase();
|
|
73
|
-
const oas = new Oas(opts.
|
|
281
|
+
const oas = new Oas(opts.api.definition);
|
|
74
282
|
const apiDefinition = oas.getDefinition();
|
|
75
283
|
const foundOperation = oas.findOperation(url, method);
|
|
76
284
|
if (!foundOperation) {
|
|
77
285
|
throw new Error(
|
|
78
|
-
`Unable to locate a matching operation in the supplied \`
|
|
286
|
+
`Unable to locate a matching operation in the supplied \`api.definition\` for: ${source.method} ${url}`
|
|
79
287
|
);
|
|
80
288
|
}
|
|
289
|
+
let sdkPackageName;
|
|
290
|
+
let sdkVariable;
|
|
291
|
+
if (opts.api.identifier) {
|
|
292
|
+
sdkPackageName = opts.api.identifier;
|
|
293
|
+
sdkVariable = camelCase(opts.api.identifier);
|
|
294
|
+
if (isReservedOrBuiltinsLC(sdkVariable)) {
|
|
295
|
+
sdkVariable = `_${sdkVariable}`;
|
|
296
|
+
}
|
|
297
|
+
} else {
|
|
298
|
+
sdkPackageName = getProjectPrefixFromRegistryUUID(opts.api.registryURI);
|
|
299
|
+
sdkVariable = camelCase(sdkPackageName || "sdk");
|
|
300
|
+
}
|
|
81
301
|
const operationSlugs = foundOperation.url.slugs;
|
|
82
302
|
const operation = oas.operation(foundOperation.url.nonNormalizedPath, method);
|
|
83
303
|
const operationPathParameters = operation.getParameters().filter((param) => param.in === "path");
|
|
@@ -85,7 +305,7 @@ var client = {
|
|
|
85
305
|
const authData = [];
|
|
86
306
|
const authSources = getAuthSources(operation);
|
|
87
307
|
const { blank, push, join } = new CodeBuilder({ indent: opts.indent || " " });
|
|
88
|
-
push(`
|
|
308
|
+
push(`import ${sdkVariable} from '@api/${sdkPackageName}';`);
|
|
89
309
|
blank();
|
|
90
310
|
const configData = [];
|
|
91
311
|
if ((apiDefinition.servers || []).length > 1) {
|
|
@@ -94,20 +314,20 @@ var client = {
|
|
|
94
314
|
if (baseUrl !== stockUrl) {
|
|
95
315
|
const serverVars = oas.splitVariables(baseUrl);
|
|
96
316
|
const serverUrl = serverVars ? oas.url(serverVars.selected, serverVars.variables) : baseUrl;
|
|
97
|
-
configData.push(
|
|
317
|
+
configData.push(`${sdkVariable}.server('${serverUrl}');`);
|
|
98
318
|
}
|
|
99
319
|
}
|
|
100
320
|
let metadata = {};
|
|
101
321
|
Object.keys(queryObj).forEach((param) => {
|
|
102
322
|
if (authSources.query.includes(param)) {
|
|
103
|
-
authData.push(buildAuthSnippet(queryObj[param]));
|
|
323
|
+
authData.push(buildAuthSnippet(sdkVariable, queryObj[param]));
|
|
104
324
|
return;
|
|
105
325
|
}
|
|
106
326
|
metadata[param] = queryObj[param];
|
|
107
327
|
});
|
|
108
328
|
Object.keys(cookiesObj).forEach((cookie) => {
|
|
109
329
|
if (authSources.cookie.includes(cookie)) {
|
|
110
|
-
authData.push(buildAuthSnippet(cookiesObj[cookie]));
|
|
330
|
+
authData.push(buildAuthSnippet(sdkVariable, cookiesObj[cookie]));
|
|
111
331
|
return;
|
|
112
332
|
}
|
|
113
333
|
metadata[cookie] = cookiesObj[cookie];
|
|
@@ -131,14 +351,14 @@ var client = {
|
|
|
131
351
|
if (headerLower in authSources.header) {
|
|
132
352
|
const authScheme = authSources.header[headerLower];
|
|
133
353
|
if (authScheme === "*") {
|
|
134
|
-
authData.push(buildAuthSnippet(headers[header]));
|
|
354
|
+
authData.push(buildAuthSnippet(sdkVariable, headers[header]));
|
|
135
355
|
} else {
|
|
136
356
|
let authKey = headers[header].replace(`${authSources.header[headerLower]} `, "");
|
|
137
357
|
if (authScheme.toLowerCase() === "basic") {
|
|
138
358
|
authKey = Buffer.from(authKey, "base64").toString("ascii");
|
|
139
359
|
authKey = authKey.split(":");
|
|
140
360
|
}
|
|
141
|
-
authData.push(buildAuthSnippet(authKey));
|
|
361
|
+
authData.push(buildAuthSnippet(sdkVariable, authKey));
|
|
142
362
|
}
|
|
143
363
|
delete headers[header];
|
|
144
364
|
return;
|
|
@@ -154,7 +374,11 @@ var client = {
|
|
|
154
374
|
return;
|
|
155
375
|
}
|
|
156
376
|
}
|
|
157
|
-
|
|
377
|
+
if (["accept", "content-type"].includes(headerLower)) {
|
|
378
|
+
requestHeaders[headerLower] = headers[header];
|
|
379
|
+
} else {
|
|
380
|
+
requestHeaders[header] = headers[header];
|
|
381
|
+
}
|
|
158
382
|
});
|
|
159
383
|
if (Object.keys(requestHeaders).length > 0) {
|
|
160
384
|
metadata = Object.assign(metadata, requestHeaders);
|
|
@@ -205,14 +429,18 @@ var client = {
|
|
|
205
429
|
if (configData.length) {
|
|
206
430
|
push(configData.join("\n"));
|
|
207
431
|
}
|
|
208
|
-
push(
|
|
432
|
+
push(`${sdkVariable}.${accessor}(${args.join(", ")})`);
|
|
209
433
|
push(".then(({ data }) => console.log(data))", 1);
|
|
210
434
|
push(".catch(err => console.error(err));", 1);
|
|
211
435
|
return join();
|
|
212
436
|
}
|
|
213
437
|
};
|
|
214
|
-
var
|
|
438
|
+
var plugin = {
|
|
439
|
+
target: "node",
|
|
440
|
+
client
|
|
441
|
+
};
|
|
442
|
+
var index_default = plugin;
|
|
215
443
|
export {
|
|
216
|
-
|
|
444
|
+
index_default as default
|
|
217
445
|
};
|
|
218
446
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { ReducedHelperObject } from '@readme/httpsnippet/helpers/reducer';\nimport type { Client } from '@readme/httpsnippet/targets';\nimport type Operation from 'oas/operation';\nimport type { HttpMethods, OASDocument } from 'oas/rmoas.types';\n\nimport { CodeBuilder } from '@readme/httpsnippet/helpers/code-builder';\nimport contentType from 'content-type';\nimport Oas from 'oas';\nimport { matchesMimeType } from 'oas/utils';\nimport stringifyObject from 'stringify-object';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction stringify(obj: any, opts = {}) {\n return stringifyObject(obj, { indent: ' ', ...opts });\n}\n\nfunction buildAuthSnippet(authKey: string | string[]) {\n // Auth key will be an array for Basic auth cases.\n if (Array.isArray(authKey)) {\n const auth: string[] = [];\n authKey.forEach((token, i) => {\n // If the token part is the last part of the key and it's empty, don't add it to the snippet.\n if (token.length === 0 && authKey.length > 1 && i === authKey.length - 1) {\n return;\n }\n\n auth.push(`'${token.replace(/'/g, \"\\\\'\")}'`);\n });\n\n return `sdk.auth(${auth.join(', ')});`;\n }\n\n return `sdk.auth('${authKey.replace(/'/g, \"\\\\'\")}');`;\n}\n\nfunction getAuthSources(operation: Operation) {\n const matchers: { cookie: string[]; header: Record<string, string>; query: string[] } = {\n header: {},\n query: [],\n cookie: [],\n };\n\n if (operation.getSecurity().length === 0) {\n return matchers;\n }\n\n Object.entries(operation.prepareSecurity()).forEach(([, schemes]) => {\n schemes.forEach(scheme => {\n if (scheme.type === 'http') {\n if (scheme.scheme === 'basic') {\n matchers.header.authorization = 'Basic';\n } else if (scheme.scheme === 'bearer') {\n matchers.header.authorization = 'Bearer';\n }\n } else if (scheme.type === 'oauth2') {\n matchers.header.authorization = 'Bearer';\n } else if (scheme.type === 'apiKey') {\n if (scheme.in === 'query') {\n matchers.query.push(scheme.name);\n } else if (scheme.in === 'header') {\n // The way that this asterisk header matcher works is that since this `apiKey` goes in a\n // named header (`scheme.name`) because the header is the key, we're matching against the\n // entire header -- counter to the way that the HTTP basic matcher above works where we\n // match and extract the API key from everything after `Basic ` in the `Authorization`\n // header.\n matchers.header[scheme.name.toLowerCase()] = '*';\n } else if (scheme.in === 'cookie') {\n matchers.cookie.push(scheme.name);\n }\n }\n });\n });\n\n return matchers;\n}\n\ninterface APIOptions {\n apiDefinition: OASDocument;\n apiDefinitionUri: string;\n escapeBrackets?: boolean;\n indent?: string | false;\n}\n\nconst client: Client<APIOptions> = {\n info: {\n key: 'api',\n title: 'API',\n link: 'https://npm.im/api',\n description: 'Automatic SDK generation from an OpenAPI definition.',\n extname: '.js',\n },\n convert: ({ cookiesObj, headersObj, postData, queryObj, url, ...source }, options) => {\n const opts = {\n ...options,\n } as APIOptions;\n\n if (!('apiDefinitionUri' in opts)) {\n throw new Error('This HTTP Snippet client must have an `apiDefinitionUri` option supplied to it.');\n } else if (!('apiDefinition' in opts)) {\n throw new Error('This HTTP Snippet client must have an `apiDefinition` option supplied to it.');\n }\n\n const method = source.method.toLowerCase() as HttpMethods;\n const oas = new Oas(opts.apiDefinition);\n const apiDefinition = oas.getDefinition();\n const foundOperation = oas.findOperation(url, method);\n if (!foundOperation) {\n throw new Error(\n `Unable to locate a matching operation in the supplied \\`apiDefinition\\` for: ${source.method} ${url}`,\n );\n }\n\n const operationSlugs = foundOperation.url.slugs;\n const operation = oas.operation(foundOperation.url.nonNormalizedPath, method);\n const operationPathParameters = operation.getParameters().filter(param => param.in === 'path');\n const path = operation.path;\n const authData: string[] = [];\n const authSources = getAuthSources(operation);\n\n const { blank, push, join } = new CodeBuilder({ indent: opts.indent || ' ' });\n\n push(`const sdk = require('api')('${opts.apiDefinitionUri}');`);\n blank();\n\n // If we have multiple servers configured and our source URL differs from the stock URL that we\n // receive from our `oas` library then the URL either has server variables contained in it (that\n // don't match the defaults), or the OAS offers alternate server URLs and we should expose that\n // in the generated snippet.\n const configData = [];\n if ((apiDefinition.servers || []).length > 1) {\n const stockUrl = oas.url();\n const baseUrl = url.replace(path, '');\n if (baseUrl !== stockUrl) {\n const serverVars = oas.splitVariables(baseUrl);\n const serverUrl = serverVars ? oas.url(serverVars.selected, serverVars.variables) : baseUrl;\n\n configData.push(`sdk.server('${serverUrl}');`);\n }\n }\n\n let metadata: Record<string, string | string[]> = {};\n Object.keys(queryObj).forEach(param => {\n if (authSources.query.includes(param)) {\n authData.push(buildAuthSnippet(queryObj[param]));\n\n // If this query param is part of an auth source then we don't want it doubled up in the\n // snippet.\n return;\n }\n\n metadata[param] = queryObj[param];\n });\n\n Object.keys(cookiesObj).forEach(cookie => {\n if (authSources.cookie.includes(cookie)) {\n authData.push(buildAuthSnippet(cookiesObj[cookie]));\n\n // If this cookie is part of an auth source then we don't want it doubled up.\n return;\n }\n\n // Note that we may have the potential to overlap any cookie that also shares the name as\n // another metadata parameter. This problem is currently inherent to `api` and not this\n // snippet generator.\n metadata[cookie] = cookiesObj[cookie];\n });\n\n // If we have path parameters present we should add them into the metadata object.\n Array.from(Object.entries(operationSlugs)).forEach(([param, value]) => {\n // The keys in `operationSlugs` will always be prefixed with a `:` in the `oas` library so\n // we can safely do this substring here without asserting this context.\n const cleanedParam = param.substring(1);\n\n // If our incoming path slug out of `oas.findOperation()` has been sanitized and is missing\n // a hyphen, but there is a parameter in the OpenAPI definition that matches what our\n // hyphen-less slug is then we should use that for the snippet.\n const unsanitizedParam = operationPathParameters.find(p => {\n return p.name.includes('-') && p.name.replace(/-/g, '') === cleanedParam ? p.name : false;\n });\n\n if (unsanitizedParam) {\n metadata[unsanitizedParam.name] = value;\n } else {\n metadata[cleanedParam] = value;\n }\n });\n\n if (Object.keys(headersObj).length) {\n const headers = headersObj;\n const requestHeaders: ReducedHelperObject = {};\n\n Object.keys(headers).forEach(header => {\n // Headers in HTTPSnippet are case-insensitive so we need to add in some special handling to\n // make sure we're able to match them properly.\n const headerLower = header.toLowerCase();\n\n if (headerLower in authSources.header) {\n // If this header has been set up as an authentication header, let's remove it and add it\n // into our auth data so we can build up an `.auth()` snippet for the SDK.\n const authScheme = authSources.header[headerLower];\n if (authScheme === '*') {\n authData.push(buildAuthSnippet(headers[header]));\n } else {\n // @ts-expect-error `headers[header]` is typed improperly in HTTPSnippet.\n let authKey = headers[header].replace(`${authSources.header[headerLower]} `, '');\n if (authScheme.toLowerCase() === 'basic') {\n authKey = Buffer.from(authKey, 'base64').toString('ascii');\n authKey = authKey.split(':');\n }\n\n authData.push(buildAuthSnippet(authKey));\n }\n\n delete headers[header];\n return;\n } else if (headerLower === 'content-type') {\n // `Content-Type` headers are automatically added within the SDK so we can filter them out\n // if they don't have parameters attached to them.\n // @ts-expect-error `headers[header]` is typed improperly in HTTPSnippet.\n const parsedContentType = contentType.parse(headers[header]);\n if (!Object.keys(parsedContentType.parameters).length) {\n delete headers[header];\n return;\n }\n } else if (headerLower === 'accept') {\n // If the `Accept` header here is JSON-like header then we can remove it from the code\n // snippet because `api` natively supports and prioritizes JSON over any other mime type.\n if (matchesMimeType.json(headers[header] as string)) {\n delete headers[header];\n return;\n }\n }\n\n // If we haven't used our header anywhere else, or we've deleted it from the payload\n // because it'll be handled internally by `api` then we should add the lowercased version\n // of our header into the generated code snippet.\n requestHeaders[headerLower] = headers[header];\n });\n\n if (Object.keys(requestHeaders).length > 0) {\n metadata = Object.assign(metadata, requestHeaders);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let body: any;\n switch (postData.mimeType) {\n case 'application/x-www-form-urlencoded':\n body = postData.paramsObj;\n break;\n\n case 'application/json':\n if (postData.jsonObj) {\n body = postData.jsonObj;\n }\n break;\n\n case 'multipart/form-data':\n if (postData.params) {\n body = {};\n\n // If there's a `Content-Type` header present in the metadata, but it's for the\n // `multipart/form-data` request then dump it off the snippet. We shouldn't offload that\n // unnecessary bloat of multipart boundaries to the user, instead letting the SDK handle it\n // automatically.\n if ('content-type' in metadata && metadata['content-type'].indexOf('multipart/form-data') === 0) {\n delete metadata['content-type'];\n }\n\n postData.params.forEach(param => {\n if (param.fileName) {\n body[param.name] = param.fileName;\n } else {\n body[param.name] = param.value;\n }\n });\n }\n break;\n\n default:\n if (postData.text) {\n body = postData.text;\n }\n }\n\n const args = [];\n\n const accessor = operation.getOperationId({ camelCase: true });\n\n // If we're going to be rendering out body params and metadata we should cut their character\n // limit in half because we'll be rendering them in their own lines.\n const inlineCharacterLimit = typeof body !== 'undefined' && Object.keys(metadata).length > 0 ? 40 : 80;\n if (typeof body !== 'undefined') {\n args.push(stringify(body, { inlineCharacterLimit }));\n }\n\n if (Object.keys(metadata).length > 0) {\n args.push(stringify(metadata, { inlineCharacterLimit }));\n }\n\n if (authData.length) {\n push(authData.join('\\n'));\n }\n\n if (configData.length) {\n push(configData.join('\\n'));\n }\n\n push(`sdk.${accessor}(${args.join(', ')})`);\n push('.then(({ data }) => console.log(data))', 1);\n push('.catch(err => console.error(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AK,sCAAsC,CAAC;AAE5C,WAAO,KAAK;AAAA,EACd;AACF;AAEA,IAAO,cAAQ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../node_modules/camelcase/index.js","../../../node_modules/is-regexp/index.js","../../../node_modules/stringify-object/node_modules/is-obj/index.js","../../../node_modules/get-own-enumerable-keys/index.js","../../../node_modules/stringify-object/index.js"],"sourcesContent":["import type { ReducedHelperObject } from '@readme/httpsnippet/helpers/reducer';\nimport type { Client, ClientPlugin } from '@readme/httpsnippet/targets';\nimport type { Operation } from 'oas/operation';\nimport type { HttpMethods, OASDocument } from 'oas/types';\n\nimport { CodeBuilder } from '@readme/httpsnippet/helpers/code-builder';\nimport camelCase from 'camelcase'; // eslint-disable-line import/no-extraneous-dependencies\nimport contentType from 'content-type';\nimport Oas from 'oas';\nimport { matchesMimeType } from 'oas/utils';\nimport { isReservedOrBuiltinsLC } from 'reserved2';\nimport stringifyObject from 'stringify-object'; // eslint-disable-line import/no-extraneous-dependencies\n\n/**\n * @note This regex also exists in `api/fetcher`.\n *\n * @example @petstore/v1.0#n6kvf10vakpemvplx\n * @example @petstore#n6kvf10vakpemvplx\n */\nconst registryUUIDRegex = /^@(?<project>[a-zA-Z0-9-_]+)(\\/?(?<version>.+))?#(?<uuid>[a-z0-9]+)$/;\n\n/**\n * @note This function also exists in `api/fetcher`.\n */\nfunction getProjectPrefixFromRegistryUUID(uri: string) {\n const matches = uri.match(registryUUIDRegex);\n if (!matches) {\n return undefined;\n }\n\n return matches.groups?.project;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction stringify(obj: any, opts = {}) {\n return stringifyObject(obj, { indent: ' ', ...opts });\n}\n\nfunction buildAuthSnippet(sdkVariable: string, authKey: string[] | string) {\n // Auth key will be an array for Basic auth cases.\n if (Array.isArray(authKey)) {\n const auth: string[] = [];\n authKey.forEach((token, i) => {\n // If the token part is the last part of the key and it's empty, don't add it to the snippet.\n if (token.length === 0 && authKey.length > 1 && i === authKey.length - 1) {\n return;\n }\n\n auth.push(`'${token.replace(/'/g, \"\\\\'\")}'`);\n });\n\n return `${sdkVariable}.auth(${auth.join(', ')});`;\n }\n\n return `${sdkVariable}.auth('${authKey.replace(/'/g, \"\\\\'\")}');`;\n}\n\nfunction getAuthSources(operation: Operation) {\n const matchers: { cookie: string[]; header: Record<string, string>; query: string[] } = {\n header: {},\n query: [],\n cookie: [],\n };\n\n if (operation.getSecurity().length === 0) {\n return matchers;\n }\n\n Object.entries(operation.prepareSecurity()).forEach(([, schemes]) => {\n schemes.forEach(scheme => {\n if (scheme.type === 'http') {\n if (scheme.scheme === 'basic') {\n matchers.header.authorization = 'Basic';\n } else if (scheme.scheme === 'bearer') {\n matchers.header.authorization = 'Bearer';\n }\n } else if (scheme.type === 'oauth2') {\n matchers.header.authorization = 'Bearer';\n } else if (scheme.type === 'apiKey') {\n if (scheme.in === 'query') {\n matchers.query.push(scheme.name);\n } else if (scheme.in === 'header') {\n // The way that this asterisk header matcher works is that since this `apiKey` goes in a\n // named header (`scheme.name`) because the header is the key, we're matching against the\n // entire header -- counter to the way that the HTTP basic matcher above works where we\n // match and extract the API key from everything after `Basic ` in the `Authorization`\n // header.\n matchers.header[scheme.name.toLowerCase()] = '*';\n } else if (scheme.in === 'cookie') {\n matchers.cookie.push(scheme.name);\n }\n }\n });\n });\n\n return matchers;\n}\n\ninterface APIOptions {\n api?: {\n definition: OASDocument;\n\n /**\n * The string to identify this SDK as. This is used in the `import sdk from '<identifier>'`\n * sample as well as the the variable name we attach the SDK to.\n *\n * @example `@api/developers`\n */\n identifier?: string;\n\n /**\n * The URI that is used to download this API definition from `npx api install`.\n *\n * @example `@developers/v2.0#17273l2glm9fq4l5`\n */\n registryURI: string;\n };\n escapeBrackets?: boolean;\n indent?: string | false;\n}\n\nconst client: Client<APIOptions> = {\n info: {\n key: 'api',\n title: 'API',\n link: 'https://npm.im/api',\n description: 'Automatic SDK generation from an OpenAPI definition.',\n extname: '.js',\n installation: 'npx api install \"{packageName}\"',\n },\n convert: ({ cookiesObj, headersObj, postData, queryObj, url, ...source }, options) => {\n const opts = {\n ...options,\n };\n\n if (!opts?.api) {\n throw new Error('This HTTPSnippet client must have an `api` config supplied to it.');\n } else if (!opts?.api?.definition) {\n throw new Error('This HTTPSnippet client must have an `api.definition` option supplied to it.');\n } else if (!opts?.api?.registryURI) {\n throw new Error('This HTTPSnippet client must have an `api.registryURI` option supplied to it.');\n }\n\n const method = source.method.toLowerCase() as HttpMethods;\n const oas = new Oas(opts.api.definition);\n const apiDefinition = oas.getDefinition();\n const foundOperation = oas.findOperation(url, method);\n if (!foundOperation) {\n throw new Error(\n `Unable to locate a matching operation in the supplied \\`api.definition\\` for: ${source.method} ${url}`,\n );\n }\n\n let sdkPackageName: string | undefined;\n let sdkVariable: string;\n if (opts.api.identifier) {\n sdkPackageName = opts.api.identifier;\n\n sdkVariable = camelCase(opts.api.identifier);\n if (isReservedOrBuiltinsLC(sdkVariable)) {\n // If this identifier is a reserved JS word then we should prefix it with an underscore so\n // this snippet can be valid code.\n sdkVariable = `_${sdkVariable}`;\n }\n } else {\n sdkPackageName = getProjectPrefixFromRegistryUUID(opts.api.registryURI);\n sdkVariable = camelCase(sdkPackageName || 'sdk');\n }\n\n const operationSlugs = foundOperation.url.slugs;\n const operation = oas.operation(foundOperation.url.nonNormalizedPath, method);\n const operationPathParameters = operation.getParameters().filter(param => param.in === 'path');\n const path = operation.path;\n const authData: string[] = [];\n const authSources = getAuthSources(operation);\n\n const { blank, push, join } = new CodeBuilder({ indent: opts.indent || ' ' });\n\n push(`import ${sdkVariable} from '@api/${sdkPackageName}';`);\n blank();\n\n // If we have multiple servers configured and our source URL differs from the stock URL that we\n // receive from our `oas` library then the URL either has server variables contained in it (that\n // don't match the defaults), or the OAS offers alternate server URLs and we should expose that\n // in the generated snippet.\n const configData = [];\n if ((apiDefinition.servers || []).length > 1) {\n const stockUrl = oas.url();\n const baseUrl = url.replace(path, '');\n if (baseUrl !== stockUrl) {\n const serverVars = oas.splitVariables(baseUrl);\n const serverUrl = serverVars ? oas.url(serverVars.selected, serverVars.variables) : baseUrl;\n\n configData.push(`${sdkVariable}.server('${serverUrl}');`);\n }\n }\n\n let metadata: Record<string, string[] | string> = {};\n Object.keys(queryObj).forEach(param => {\n if (authSources.query.includes(param)) {\n authData.push(buildAuthSnippet(sdkVariable, queryObj[param]));\n\n // If this query param is part of an auth source then we don't want it doubled up in the\n // snippet.\n return;\n }\n\n metadata[param] = queryObj[param];\n });\n\n Object.keys(cookiesObj).forEach(cookie => {\n if (authSources.cookie.includes(cookie)) {\n authData.push(buildAuthSnippet(sdkVariable, cookiesObj[cookie]));\n\n // If this cookie is part of an auth source then we don't want it doubled up.\n return;\n }\n\n // Note that we may have the potential to overlap any cookie that also shares the name as\n // another metadata parameter. This problem is currently inherent to `api` and not this\n // snippet generator.\n metadata[cookie] = cookiesObj[cookie];\n });\n\n // If we have path parameters present we should add them into the metadata object.\n Array.from(Object.entries(operationSlugs)).forEach(([param, value]) => {\n // The keys in `operationSlugs` will always be prefixed with a `:` in the `oas` library so\n // we can safely do this substring here without asserting this context.\n const cleanedParam = param.substring(1);\n\n // If our incoming path slug out of `oas.findOperation()` has been sanitized and is missing\n // a hyphen, but there is a parameter in the OpenAPI definition that matches what our\n // hyphen-less slug is then we should use that for the snippet.\n const unsanitizedParam = operationPathParameters.find(p => {\n return p.name.includes('-') && p.name.replace(/-/g, '') === cleanedParam ? p.name : false;\n });\n\n if (unsanitizedParam) {\n metadata[unsanitizedParam.name] = value;\n } else {\n metadata[cleanedParam] = value;\n }\n });\n\n if (Object.keys(headersObj).length) {\n const headers = headersObj;\n const requestHeaders: ReducedHelperObject = {};\n\n Object.keys(headers).forEach(header => {\n // Headers in HTTPSnippet are case-insensitive so we need to add in some special handling to\n // make sure we're able to match them properly.\n const headerLower = header.toLowerCase();\n\n if (headerLower in authSources.header) {\n // If this header has been set up as an authentication header, let's remove it and add it\n // into our auth data so we can build up an `.auth()` snippet for the SDK.\n const authScheme = authSources.header[headerLower];\n if (authScheme === '*') {\n authData.push(buildAuthSnippet(sdkVariable, headers[header]));\n } else {\n // @ts-expect-error `headers[header]` is typed improperly in HTTPSnippet.\n let authKey = headers[header].replace(`${authSources.header[headerLower]} `, '');\n if (authScheme.toLowerCase() === 'basic') {\n authKey = Buffer.from(authKey, 'base64').toString('ascii');\n authKey = authKey.split(':');\n }\n\n authData.push(buildAuthSnippet(sdkVariable, authKey));\n }\n\n delete headers[header];\n return;\n } else if (headerLower === 'content-type') {\n // `Content-Type` headers are automatically added within the SDK so we can filter them out\n // if they don't have parameters attached to them.\n // @ts-expect-error `headers[header]` is typed improperly in HTTPSnippet.\n const parsedContentType = contentType.parse(headers[header]);\n if (!Object.keys(parsedContentType.parameters).length) {\n delete headers[header];\n return;\n }\n } else if (headerLower === 'accept') {\n // If the `Accept` header here is JSON-like header then we can remove it from the code\n // snippet because `api` natively supports and prioritizes JSON over any other mime type.\n if (matchesMimeType.json(headers[header] as string)) {\n delete headers[header];\n return;\n }\n }\n\n // If we haven't used our header anywhere else, or we've deleted it from the payload\n // because it'll be handled internally by `api` then we should add it into our code snippet.\n if (['accept', 'content-type'].includes(headerLower)) {\n requestHeaders[headerLower] = headers[header];\n } else {\n // Non-reserved headers retain their casing because we want to generate a snippet that\n // matches the TS types that are created during codegeneration.\n requestHeaders[header] = headers[header];\n }\n });\n\n if (Object.keys(requestHeaders).length > 0) {\n metadata = Object.assign(metadata, requestHeaders);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let body: any;\n switch (postData.mimeType) {\n case 'application/x-www-form-urlencoded':\n body = postData.paramsObj;\n break;\n\n case 'application/json':\n if (postData.jsonObj) {\n body = postData.jsonObj;\n }\n break;\n\n case 'multipart/form-data':\n if (postData.params) {\n body = {};\n\n // If there's a `Content-Type` header present in the metadata, but it's for the\n // `multipart/form-data` request then dump it off the snippet. We shouldn't offload that\n // unnecessary bloat of multipart boundaries to the user, instead letting the SDK handle it\n // automatically.\n if ('content-type' in metadata && metadata['content-type'].indexOf('multipart/form-data') === 0) {\n delete metadata['content-type'];\n }\n\n postData.params.forEach(param => {\n if (param.fileName) {\n body[param.name] = param.fileName;\n } else {\n body[param.name] = param.value;\n }\n });\n }\n break;\n\n default:\n if (postData.text) {\n body = postData.text;\n }\n }\n\n const args = [];\n\n const accessor = operation.getOperationId({ camelCase: true });\n\n // If we're going to be rendering out body params and metadata we should cut their character\n // limit in half because we'll be rendering them in their own lines.\n const inlineCharacterLimit = typeof body !== 'undefined' && Object.keys(metadata).length > 0 ? 40 : 80;\n if (typeof body !== 'undefined') {\n args.push(stringify(body, { inlineCharacterLimit }));\n }\n\n if (Object.keys(metadata).length > 0) {\n args.push(stringify(metadata, { inlineCharacterLimit }));\n }\n\n if (authData.length) {\n push(authData.join('\\n'));\n }\n\n if (configData.length) {\n push(configData.join('\\n'));\n }\n\n push(`${sdkVariable}.${accessor}(${args.join(', ')})`);\n push('.then(({ data }) => console.log(data))', 1);\n push('.catch(err => console.error(err));', 1);\n\n return join();\n },\n};\n\nconst plugin: ClientPlugin<APIOptions> = {\n target: 'node',\n client,\n};\n\nexport default plugin;\n","const UPPERCASE = /[\\p{Lu}]/u;\nconst LOWERCASE = /[\\p{Ll}]/u;\nconst LEADING_CAPITAL = /^[\\p{Lu}](?![\\p{Lu}])/gu;\nconst IDENTIFIER = /([\\p{Alpha}\\p{N}_]|$)/u;\nconst SEPARATORS = /[_.\\- ]+/;\n\nconst LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source);\nconst SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu');\nconst NUMBERS_AND_IDENTIFIER = new RegExp('\\\\d+' + IDENTIFIER.source, 'gu');\n\nconst preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase) => {\n\tlet isLastCharLower = false;\n\tlet isLastCharUpper = false;\n\tlet isLastLastCharUpper = false;\n\tlet isLastLastCharPreserved = false;\n\n\tfor (let index = 0; index < string.length; index++) {\n\t\tconst character = string[index];\n\t\tisLastLastCharPreserved = index > 2 ? string[index - 3] === '-' : true;\n\n\t\tif (isLastCharLower && UPPERCASE.test(character)) {\n\t\t\tstring = string.slice(0, index) + '-' + string.slice(index);\n\t\t\tisLastCharLower = false;\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = true;\n\t\t\tindex++;\n\t\t} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase)) {\n\t\t\tstring = string.slice(0, index - 1) + '-' + string.slice(index - 1);\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = false;\n\t\t\tisLastCharLower = true;\n\t\t} else {\n\t\t\tisLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;\n\t\t}\n\t}\n\n\treturn string;\n};\n\nconst preserveConsecutiveUppercase = (input, toLowerCase) => {\n\tLEADING_CAPITAL.lastIndex = 0;\n\n\treturn input.replaceAll(LEADING_CAPITAL, match => toLowerCase(match));\n};\n\nconst postProcess = (input, toUpperCase) => {\n\tSEPARATORS_AND_IDENTIFIER.lastIndex = 0;\n\tNUMBERS_AND_IDENTIFIER.lastIndex = 0;\n\n\treturn input\n\t\t.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ['_', '-'].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match))\n\t\t.replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));\n};\n\nexport default function camelCase(input, options) {\n\tif (!(typeof input === 'string' || Array.isArray(input))) {\n\t\tthrow new TypeError('Expected the input to be `string | string[]`');\n\t}\n\n\toptions = {\n\t\tpascalCase: false,\n\t\tpreserveConsecutiveUppercase: false,\n\t\t...options,\n\t};\n\n\tif (Array.isArray(input)) {\n\t\tinput = input.map(x => x.trim())\n\t\t\t.filter(x => x.length)\n\t\t\t.join('-');\n\t} else {\n\t\tinput = input.trim();\n\t}\n\n\tif (input.length === 0) {\n\t\treturn '';\n\t}\n\n\tconst toLowerCase = options.locale === false\n\t\t? string => string.toLowerCase()\n\t\t: string => string.toLocaleLowerCase(options.locale);\n\n\tconst toUpperCase = options.locale === false\n\t\t? string => string.toUpperCase()\n\t\t: string => string.toLocaleUpperCase(options.locale);\n\n\tif (input.length === 1) {\n\t\tif (SEPARATORS.test(input)) {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn options.pascalCase ? toUpperCase(input) : toLowerCase(input);\n\t}\n\n\tconst hasUpperCase = input !== toLowerCase(input);\n\n\tif (hasUpperCase) {\n\t\tinput = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);\n\t}\n\n\tinput = input.replace(LEADING_SEPARATORS, '');\n\tinput = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);\n\n\tif (options.pascalCase) {\n\t\tinput = toUpperCase(input.charAt(0)) + input.slice(1);\n\t}\n\n\treturn postProcess(input, toUpperCase);\n}\n","const {toString} = Object.prototype;\n\nexport default function isRegexp(value) {\n\treturn toString.call(value) === '[object RegExp]';\n}\n","export default function isObject(value) {\n\tconst type = typeof value;\n\treturn value !== null && (type === 'object' || type === 'function');\n}\n","const {propertyIsEnumerable} = Object.prototype;\n\nexport default function getOwnEnumerableKeys(object) {\n\treturn [\n\t\t...Object.keys(object),\n\t\t...Object.getOwnPropertySymbols(object)\n\t\t\t.filter(key => propertyIsEnumerable.call(object, key)),\n\t];\n}\n","import isRegexp from 'is-regexp';\nimport isObject from 'is-obj';\nimport getOwnEnumerableKeys from 'get-own-enumerable-keys';\n\nexport default function stringifyObject(input, options, pad) {\n\tconst seen = [];\n\n\treturn (function stringify(input, options = {}, pad = '') {\n\t\tconst indent = options.indent || '\\t';\n\n\t\tlet tokens;\n\t\tif (options.inlineCharacterLimit === undefined) {\n\t\t\ttokens = {\n\t\t\t\tnewline: '\\n',\n\t\t\t\tnewlineOrSpace: '\\n',\n\t\t\t\tpad,\n\t\t\t\tindent: pad + indent,\n\t\t\t};\n\t\t} else {\n\t\t\ttokens = {\n\t\t\t\tnewline: '@@__STRINGIFY_OBJECT_NEW_LINE__@@',\n\t\t\t\tnewlineOrSpace: '@@__STRINGIFY_OBJECT_NEW_LINE_OR_SPACE__@@',\n\t\t\t\tpad: '@@__STRINGIFY_OBJECT_PAD__@@',\n\t\t\t\tindent: '@@__STRINGIFY_OBJECT_INDENT__@@',\n\t\t\t};\n\t\t}\n\n\t\tconst expandWhiteSpace = string => {\n\t\t\tif (options.inlineCharacterLimit === undefined) {\n\t\t\t\treturn string;\n\t\t\t}\n\n\t\t\tconst oneLined = string\n\t\t\t\t.replace(new RegExp(tokens.newline, 'g'), '')\n\t\t\t\t.replace(new RegExp(tokens.newlineOrSpace, 'g'), ' ')\n\t\t\t\t.replace(new RegExp(tokens.pad + '|' + tokens.indent, 'g'), '');\n\n\t\t\tif (oneLined.length <= options.inlineCharacterLimit) {\n\t\t\t\treturn oneLined;\n\t\t\t}\n\n\t\t\treturn string\n\t\t\t\t.replace(new RegExp(tokens.newline + '|' + tokens.newlineOrSpace, 'g'), '\\n')\n\t\t\t\t.replace(new RegExp(tokens.pad, 'g'), pad)\n\t\t\t\t.replace(new RegExp(tokens.indent, 'g'), pad + indent);\n\t\t};\n\n\t\tif (seen.includes(input)) {\n\t\t\treturn '\"[Circular]\"';\n\t\t}\n\n\t\tif (\n\t\t\tinput === null\n\t\t\t|| input === undefined\n\t\t\t|| typeof input === 'number'\n\t\t\t|| typeof input === 'boolean'\n\t\t\t|| typeof input === 'function'\n\t\t\t|| typeof input === 'symbol'\n\t\t\t|| isRegexp(input)\n\t\t) {\n\t\t\treturn String(input);\n\t\t}\n\n\t\tif (input instanceof Date) {\n\t\t\treturn `new Date('${input.toISOString()}')`;\n\t\t}\n\n\t\tif (Array.isArray(input)) {\n\t\t\tif (input.length === 0) {\n\t\t\t\treturn '[]';\n\t\t\t}\n\n\t\t\tseen.push(input);\n\n\t\t\tconst returnValue = '[' + tokens.newline + input.map((element, i) => {\n\t\t\t\tconst eol = input.length - 1 === i ? tokens.newline : ',' + tokens.newlineOrSpace;\n\n\t\t\t\tlet value = stringify(element, options, pad + indent);\n\t\t\t\tif (options.transform) {\n\t\t\t\t\tvalue = options.transform(input, i, value);\n\t\t\t\t}\n\n\t\t\t\treturn tokens.indent + value + eol;\n\t\t\t}).join('') + tokens.pad + ']';\n\n\t\t\tseen.pop();\n\n\t\t\treturn expandWhiteSpace(returnValue);\n\t\t}\n\n\t\tif (isObject(input)) {\n\t\t\tlet objectKeys = getOwnEnumerableKeys(input);\n\n\t\t\tif (options.filter) {\n\t\t\t\t// eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument\n\t\t\t\tobjectKeys = objectKeys.filter(element => options.filter(input, element));\n\t\t\t}\n\n\t\t\tif (objectKeys.length === 0) {\n\t\t\t\treturn '{}';\n\t\t\t}\n\n\t\t\tseen.push(input);\n\n\t\t\tconst returnValue = '{' + tokens.newline + objectKeys.map((element, index) => {\n\t\t\t\tconst eol = objectKeys.length - 1 === index ? tokens.newline : ',' + tokens.newlineOrSpace;\n\t\t\t\tconst isSymbol = typeof element === 'symbol';\n\t\t\t\tconst isClassic = !isSymbol && /^[a-z$_][$\\w]*$/i.test(element);\n\t\t\t\tconst key = isSymbol || isClassic ? element : stringify(element, options);\n\n\t\t\t\tlet value = stringify(input[element], options, pad + indent);\n\t\t\t\tif (options.transform) {\n\t\t\t\t\tvalue = options.transform(input, element, value);\n\t\t\t\t}\n\n\t\t\t\treturn tokens.indent + String(key) + ': ' + value + eol;\n\t\t\t}).join('') + tokens.pad + '}';\n\n\t\t\tseen.pop();\n\n\t\t\treturn expandWhiteSpace(returnValue);\n\t\t}\n\n\t\tinput = input.replace(/\\\\/g, '\\\\\\\\');\n\t\tinput = String(input).replace(/[\\r\\n]/g, x => x === '\\n' ? '\\\\n' : '\\\\r');\n\n\t\tif (options.singleQuotes === false) {\n\t\t\tinput = input.replace(/\"/g, '\\\\\"');\n\t\t\treturn `\"${input}\"`;\n\t\t}\n\n\t\tinput = input.replace(/'/g, '\\\\\\'');\n\t\treturn `'${input}'`;\n\t})(input, options, pad);\n}\n"],"mappings":";AAKA,SAAS,mBAAmB;;;ACL5B,IAAM,YAAY;AAClB,IAAM,YAAY;AAClB,IAAM,kBAAkB;AACxB,IAAM,aAAa;AACnB,IAAM,aAAa;AAEnB,IAAM,qBAAqB,IAAI,OAAO,MAAM,WAAW,MAAM;AAC7D,IAAM,4BAA4B,IAAI,OAAO,WAAW,SAAS,WAAW,QAAQ,IAAI;AACxF,IAAM,yBAAyB,IAAI,OAAO,SAAS,WAAW,QAAQ,IAAI;AAE1E,IAAM,oBAAoB,CAAC,QAAQ,aAAa,aAAaA,kCAAiC;AAC7F,MAAI,kBAAkB;AACtB,MAAI,kBAAkB;AACtB,MAAI,sBAAsB;AAC1B,MAAI,0BAA0B;AAE9B,WAAS,QAAQ,GAAG,QAAQ,OAAO,QAAQ,SAAS;AACnD,UAAM,YAAY,OAAO,KAAK;AAC9B,8BAA0B,QAAQ,IAAI,OAAO,QAAQ,CAAC,MAAM,MAAM;AAElE,QAAI,mBAAmB,UAAU,KAAK,SAAS,GAAG;AACjD,eAAS,OAAO,MAAM,GAAG,KAAK,IAAI,MAAM,OAAO,MAAM,KAAK;AAC1D,wBAAkB;AAClB,4BAAsB;AACtB,wBAAkB;AAClB;AAAA,IACD,WAAW,mBAAmB,uBAAuB,UAAU,KAAK,SAAS,MAAM,CAAC,2BAA2BA,gCAA+B;AAC7I,eAAS,OAAO,MAAM,GAAG,QAAQ,CAAC,IAAI,MAAM,OAAO,MAAM,QAAQ,CAAC;AAClE,4BAAsB;AACtB,wBAAkB;AAClB,wBAAkB;AAAA,IACnB,OAAO;AACN,wBAAkB,YAAY,SAAS,MA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
|
"name": "httpsnippet-client-api",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-beta.12",
|
|
4
4
|
"description": "An HTTPSnippet client for generating snippets for the `api` module.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lint:types": "tsc --noEmit",
|
|
21
21
|
"prebuild": "rm -rf dist/",
|
|
22
22
|
"prepack": "npm run build",
|
|
23
|
-
"test": "
|
|
23
|
+
"test": "echo 'Please run tests from the root!' && exit 1"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
@@ -37,21 +37,23 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"content-type": "^1.0.5",
|
|
40
|
-
"
|
|
40
|
+
"reserved2": "^0.1.5"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@readme/httpsnippet": "
|
|
44
|
-
"oas": "^
|
|
43
|
+
"@readme/httpsnippet": "^11.0.0",
|
|
44
|
+
"oas": "^25.0.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@readme/oas-examples": "^5.12.0",
|
|
48
48
|
"@readme/openapi-parser": "^2.5.0",
|
|
49
|
-
"@types/content-type": "^1.1.
|
|
50
|
-
"@types/stringify-object": "^
|
|
51
|
-
"@vitest/coverage-v8": "^0.
|
|
49
|
+
"@types/content-type": "^1.1.8",
|
|
50
|
+
"@types/stringify-object": "^4.0.5",
|
|
51
|
+
"@vitest/coverage-v8": "^3.0.5",
|
|
52
|
+
"camelcase": "^8.0.0",
|
|
53
|
+
"stringify-object": "^5.0.0",
|
|
52
54
|
"typescript": "^5.2.2",
|
|
53
|
-
"vitest": "^0.
|
|
55
|
+
"vitest": "^3.0.4"
|
|
54
56
|
},
|
|
55
57
|
"prettier": "@readme/eslint-config/prettier",
|
|
56
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "7d641ec20ed9106d2da618d14f7fcc912d36ada2"
|
|
57
59
|
}
|