httpsnippet-client-api 7.0.0-beta.16 → 7.0.0-beta.17
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/.turbo/turbo-attw.log +34 -0
- package/.turbo/turbo-build.log +9 -0
- package/CHANGELOG.md +7 -0
- package/dist/index.cjs +194 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +189 -26
- package/dist/index.js.map +1 -1
- package/package.json +28 -29
- package/src/index.ts +5 -7
- package/tsup.config.ts +0 -2
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
> httpsnippet-client-api@7.0.0-beta.16 attw
|
|
3
|
+
> attw --pack --format ascii --profile node16
|
|
4
|
+
|
|
5
|
+
[1G[0K
|
|
6
|
+
httpsnippet-client-api v7.0.0-beta.16
|
|
7
|
+
|
|
8
|
+
Build tools:
|
|
9
|
+
- typescript@^5.8.2
|
|
10
|
+
- tsup@^8.5.0
|
|
11
|
+
|
|
12
|
+
[90m (ignoring resolutions: 'node10')[39m
|
|
13
|
+
[90m[39m
|
|
14
|
+
[0m No problems found 🌟[0m
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
[1m[34m[1m[92m"httpsnippet-client-api"[39m[34m[22m[1m[39m[22m
|
|
18
|
+
|
|
19
|
+
node16 (from CJS): 🟢 (CJS)
|
|
20
|
+
node16 (from ESM): 🟢 (ESM)
|
|
21
|
+
bundler: 🟢
|
|
22
|
+
node10: (ignored) 🟢
|
|
23
|
+
|
|
24
|
+
***********************************
|
|
25
|
+
|
|
26
|
+
[1m[34m[1m[92m"httpsnippet-client-api/package.json"[39m[34m[22m[1m[39m[22m
|
|
27
|
+
|
|
28
|
+
node16 (from CJS): 🟢 (JSON)
|
|
29
|
+
node16 (from ESM): 🟢 (JSON)
|
|
30
|
+
bundler: 🟢 (JSON)
|
|
31
|
+
node10: (ignored) 🟢 (JSON)
|
|
32
|
+
|
|
33
|
+
***********************************
|
|
34
|
+
[1G[0Kâ ™[1G[0K
|
package/CHANGELOG.md
ADDED
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/index.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/index.ts
|
|
2
2
|
var _codebuilder = require('@readme/httpsnippet/helpers/code-builder');
|
|
3
3
|
|
|
4
4
|
// node_modules/camelcase/index.js
|
|
@@ -110,10 +110,137 @@ function getOwnEnumerableKeys(object) {
|
|
|
110
110
|
];
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
// ../../node_modules/reserved-identifiers/index.js
|
|
114
|
+
var identifiers = [
|
|
115
|
+
// Keywords
|
|
116
|
+
"await",
|
|
117
|
+
"break",
|
|
118
|
+
"case",
|
|
119
|
+
"catch",
|
|
120
|
+
"class",
|
|
121
|
+
"const",
|
|
122
|
+
"continue",
|
|
123
|
+
"debugger",
|
|
124
|
+
"default",
|
|
125
|
+
"delete",
|
|
126
|
+
"do",
|
|
127
|
+
"else",
|
|
128
|
+
"enum",
|
|
129
|
+
"export",
|
|
130
|
+
"extends",
|
|
131
|
+
"false",
|
|
132
|
+
"finally",
|
|
133
|
+
"for",
|
|
134
|
+
"function",
|
|
135
|
+
"if",
|
|
136
|
+
"import",
|
|
137
|
+
"in",
|
|
138
|
+
"instanceof",
|
|
139
|
+
"new",
|
|
140
|
+
"null",
|
|
141
|
+
"return",
|
|
142
|
+
"super",
|
|
143
|
+
"switch",
|
|
144
|
+
"this",
|
|
145
|
+
"throw",
|
|
146
|
+
"true",
|
|
147
|
+
"try",
|
|
148
|
+
"typeof",
|
|
149
|
+
"var",
|
|
150
|
+
"void",
|
|
151
|
+
"while",
|
|
152
|
+
"with",
|
|
153
|
+
"yield",
|
|
154
|
+
// Future reserved keywords
|
|
155
|
+
"implements",
|
|
156
|
+
"interface",
|
|
157
|
+
"package",
|
|
158
|
+
"private",
|
|
159
|
+
"protected",
|
|
160
|
+
"public",
|
|
161
|
+
// Not keywords, but still restricted
|
|
162
|
+
"arguments",
|
|
163
|
+
"eval"
|
|
164
|
+
];
|
|
165
|
+
var globalProperties = [
|
|
166
|
+
"globalThis",
|
|
167
|
+
"Infinity",
|
|
168
|
+
"NaN",
|
|
169
|
+
"undefined"
|
|
170
|
+
];
|
|
171
|
+
function reservedIdentifiers({ includeGlobalProperties = false } = {}) {
|
|
172
|
+
return /* @__PURE__ */ new Set([
|
|
173
|
+
...identifiers,
|
|
174
|
+
...includeGlobalProperties ? globalProperties : []
|
|
175
|
+
]);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// ../../node_modules/identifier-regex/index.js
|
|
179
|
+
var baseRegex = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*/u;
|
|
180
|
+
var basePattern = `(?<![@#$_\\p{ID_Continue}\\p{ID_Start}])(?!(?:${[...reservedIdentifiers({ includeGlobalProperties: true })].join("|")})(?![$_\\p{ID_Continue}]))${baseRegex.source}`;
|
|
181
|
+
var regex = new RegExp(basePattern, "u");
|
|
182
|
+
var regexExact = new RegExp(`^${basePattern}$`, "u");
|
|
183
|
+
function identifierRegex({ exact = true } = {}) {
|
|
184
|
+
return exact ? regexExact : regex;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// ../../node_modules/function-timeout/index.js
|
|
188
|
+
var _vm = require('vm'); var _vm2 = _interopRequireDefault(_vm);
|
|
189
|
+
var script = new _vm2.default.Script("returnValue = functionToRun()");
|
|
190
|
+
function functionTimeout(function_, { timeout, context: context2 = _vm2.default.createContext() } = {}) {
|
|
191
|
+
const wrappedFunction = (...arguments_) => {
|
|
192
|
+
context2.functionToRun = () => function_(...arguments_);
|
|
193
|
+
script.runInNewContext(context2, { timeout });
|
|
194
|
+
return context2.returnValue;
|
|
195
|
+
};
|
|
196
|
+
Object.defineProperty(wrappedFunction, "name", {
|
|
197
|
+
value: `functionTimeout(${function_.name || "<anonymous>"})`,
|
|
198
|
+
configurable: true
|
|
199
|
+
});
|
|
200
|
+
return wrappedFunction;
|
|
201
|
+
}
|
|
202
|
+
function isTimeoutError(error) {
|
|
203
|
+
return _optionalChain([error, 'optionalAccess', _2 => _2.code]) === "ERR_SCRIPT_EXECUTION_TIMEOUT";
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// ../../node_modules/super-regex/index.js
|
|
207
|
+
var context = {};
|
|
208
|
+
function isMatch(regex3, string, { timeout } = {}) {
|
|
209
|
+
try {
|
|
210
|
+
return functionTimeout(() => structuredClone(regex3).test(string), { timeout, context })();
|
|
211
|
+
} catch (error) {
|
|
212
|
+
if (isTimeoutError(error)) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
throw error;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// ../../node_modules/is-identifier/index.js
|
|
220
|
+
var regex2 = identifierRegex();
|
|
221
|
+
function isIdentifier(value) {
|
|
222
|
+
if (typeof value !== "string") {
|
|
223
|
+
throw new TypeError(`Expected a string, got \`${typeof value}\`.`);
|
|
224
|
+
}
|
|
225
|
+
if (value.length > 1e5) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
return isMatch(regex2, value, { timeout: 1e3 });
|
|
229
|
+
}
|
|
230
|
+
|
|
113
231
|
// ../../node_modules/stringify-object/index.js
|
|
232
|
+
var CHARACTER_ESCAPES = {
|
|
233
|
+
"\n": String.raw`\n`,
|
|
234
|
+
"\r": String.raw`\r`,
|
|
235
|
+
" ": String.raw`\t`,
|
|
236
|
+
"\b": String.raw`\b`,
|
|
237
|
+
"\f": String.raw`\f`,
|
|
238
|
+
"\v": String.raw`\v`,
|
|
239
|
+
"\0": String.raw`\0`
|
|
240
|
+
};
|
|
114
241
|
function stringifyObject(input, options, pad) {
|
|
115
242
|
const seen = [];
|
|
116
|
-
return function stringify2(input2, options2 = {}, pad2 = "") {
|
|
243
|
+
return (function stringify2(input2, options2 = {}, pad2 = "") {
|
|
117
244
|
const indent = options2.indent || " ";
|
|
118
245
|
let tokens;
|
|
119
246
|
if (options2.inlineCharacterLimit === void 0) {
|
|
@@ -135,36 +262,70 @@ function stringifyObject(input, options, pad) {
|
|
|
135
262
|
if (options2.inlineCharacterLimit === void 0) {
|
|
136
263
|
return string;
|
|
137
264
|
}
|
|
138
|
-
const oneLined = string.
|
|
265
|
+
const oneLined = string.replaceAll(tokens.newline, "").replaceAll(tokens.newlineOrSpace, " ").replaceAll(tokens.pad, "").replaceAll(tokens.indent, "");
|
|
139
266
|
if (oneLined.length <= options2.inlineCharacterLimit) {
|
|
140
267
|
return oneLined;
|
|
141
268
|
}
|
|
142
|
-
return string.
|
|
269
|
+
return string.replaceAll(tokens.newline, "\n").replaceAll(tokens.newlineOrSpace, "\n").replaceAll(tokens.pad, pad2).replaceAll(tokens.indent, pad2 + indent);
|
|
143
270
|
};
|
|
144
271
|
if (seen.includes(input2)) {
|
|
145
272
|
return '"[Circular]"';
|
|
146
273
|
}
|
|
147
|
-
|
|
274
|
+
const type = typeof input2;
|
|
275
|
+
if (input2 === null || input2 === void 0 || type === "number" || type === "boolean" || type === "function" || isRegexp(input2)) {
|
|
148
276
|
return String(input2);
|
|
149
277
|
}
|
|
278
|
+
if (type === "bigint") {
|
|
279
|
+
return String(input2) + "n";
|
|
280
|
+
}
|
|
281
|
+
if (type === "symbol") {
|
|
282
|
+
const { description } = input2;
|
|
283
|
+
if (description === void 0) {
|
|
284
|
+
return "Symbol()";
|
|
285
|
+
}
|
|
286
|
+
if (_optionalChain([description, 'optionalAccess', _3 => _3.startsWith, 'call', _4 => _4("Symbol.")]) && Symbol[description.slice(7)] === input2) {
|
|
287
|
+
return description;
|
|
288
|
+
}
|
|
289
|
+
const globalKey = Symbol.keyFor(input2);
|
|
290
|
+
if (globalKey !== void 0) {
|
|
291
|
+
return `Symbol.for(${stringify2(globalKey, options2)})`;
|
|
292
|
+
}
|
|
293
|
+
return `Symbol(${stringify2(description, options2)})`;
|
|
294
|
+
}
|
|
150
295
|
if (input2 instanceof Date) {
|
|
151
|
-
return `new Date('${input2.toISOString()}')`;
|
|
296
|
+
return Number.isNaN(input2.getTime()) ? "new Date('Invalid Date')" : `new Date('${input2.toISOString()}')`;
|
|
297
|
+
}
|
|
298
|
+
if (input2 instanceof Map || input2 instanceof Set) {
|
|
299
|
+
const isMap = input2 instanceof Map;
|
|
300
|
+
const name = isMap ? "Map" : "Set";
|
|
301
|
+
if (input2.size === 0) {
|
|
302
|
+
return `new ${name}()`;
|
|
303
|
+
}
|
|
304
|
+
seen.push(input2);
|
|
305
|
+
const items = [...input2].map((item) => {
|
|
306
|
+
if (isMap) {
|
|
307
|
+
const [key, value] = item;
|
|
308
|
+
return tokens.indent + `[${stringify2(key, options2, pad2 + indent)}, ${stringify2(value, options2, pad2 + indent)}]`;
|
|
309
|
+
}
|
|
310
|
+
return tokens.indent + stringify2(item, options2, pad2 + indent);
|
|
311
|
+
}).join("," + tokens.newlineOrSpace);
|
|
312
|
+
seen.pop();
|
|
313
|
+
return expandWhiteSpace(`new ${name}([${tokens.newline}${items}${tokens.newline}${tokens.pad}])`);
|
|
152
314
|
}
|
|
153
315
|
if (Array.isArray(input2)) {
|
|
154
316
|
if (input2.length === 0) {
|
|
155
317
|
return "[]";
|
|
156
318
|
}
|
|
157
319
|
seen.push(input2);
|
|
158
|
-
const
|
|
159
|
-
const eol = input2.length - 1 === i ? tokens.newline : "," + tokens.newlineOrSpace;
|
|
320
|
+
const items = input2.map((element, index) => {
|
|
160
321
|
let value = stringify2(element, options2, pad2 + indent);
|
|
161
322
|
if (options2.transform) {
|
|
162
|
-
value = options2.transform(input2,
|
|
323
|
+
value = options2.transform(input2, index, value);
|
|
163
324
|
}
|
|
164
|
-
return tokens.indent + value
|
|
165
|
-
}).join(""
|
|
325
|
+
return tokens.indent + value;
|
|
326
|
+
}).join("," + tokens.newlineOrSpace);
|
|
166
327
|
seen.pop();
|
|
167
|
-
return expandWhiteSpace(
|
|
328
|
+
return expandWhiteSpace(`[${tokens.newline}${items}${tokens.newline}${tokens.pad}]`);
|
|
168
329
|
}
|
|
169
330
|
if (isObject(input2)) {
|
|
170
331
|
let objectKeys = getOwnEnumerableKeys(input2);
|
|
@@ -175,29 +336,31 @@ function stringifyObject(input, options, pad) {
|
|
|
175
336
|
return "{}";
|
|
176
337
|
}
|
|
177
338
|
seen.push(input2);
|
|
178
|
-
const
|
|
179
|
-
const eol = objectKeys.length - 1 === index ? tokens.newline : "," + tokens.newlineOrSpace;
|
|
339
|
+
const pairs = objectKeys.map((element) => {
|
|
180
340
|
const isSymbol = typeof element === "symbol";
|
|
181
|
-
|
|
182
|
-
|
|
341
|
+
let key;
|
|
342
|
+
if (isSymbol) {
|
|
343
|
+
key = `[${stringify2(element, options2)}]`;
|
|
344
|
+
} else if (isIdentifier(element)) {
|
|
345
|
+
key = element;
|
|
346
|
+
} else {
|
|
347
|
+
key = stringify2(element, options2);
|
|
348
|
+
}
|
|
183
349
|
let value = stringify2(input2[element], options2, pad2 + indent);
|
|
184
350
|
if (options2.transform) {
|
|
185
351
|
value = options2.transform(input2, element, value);
|
|
186
352
|
}
|
|
187
|
-
return tokens.indent +
|
|
188
|
-
}).join(""
|
|
353
|
+
return tokens.indent + key + ": " + value;
|
|
354
|
+
}).join("," + tokens.newlineOrSpace);
|
|
189
355
|
seen.pop();
|
|
190
|
-
return expandWhiteSpace(
|
|
356
|
+
return expandWhiteSpace(`{${tokens.newline}${pairs}${tokens.newline}${tokens.pad}}`);
|
|
191
357
|
}
|
|
192
|
-
|
|
193
|
-
input2 = String(input2).replace(/[\r\n]/g, (x) => x === "\n" ? "\\n" : "\\r");
|
|
358
|
+
const stringified = String(input2).replaceAll("\\", "\\\\").replaceAll(/[\u0000-\u001F\u007F]/g, (x) => _nullishCoalesce(CHARACTER_ESCAPES[x], () => ( `\\u${x.codePointAt(0).toString(16).padStart(4, "0")}`)));
|
|
194
359
|
if (options2.singleQuotes === false) {
|
|
195
|
-
|
|
196
|
-
return `"${input2}"`;
|
|
360
|
+
return `"${stringified.replaceAll('"', String.raw`\"`)}"`;
|
|
197
361
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}(input, options, pad);
|
|
362
|
+
return `'${stringified.replaceAll("'", String.raw`\'`)}'`;
|
|
363
|
+
})(input, options, pad);
|
|
201
364
|
}
|
|
202
365
|
|
|
203
366
|
// src/index.ts
|
|
@@ -205,9 +368,9 @@ var registryUUIDRegex = /^@(?<project>[a-zA-Z0-9-_]+)(\/?(?<version>.+))?#(?<uui
|
|
|
205
368
|
function getProjectPrefixFromRegistryUUID(uri) {
|
|
206
369
|
const matches = uri.match(registryUUIDRegex);
|
|
207
370
|
if (!matches) {
|
|
208
|
-
return
|
|
371
|
+
return;
|
|
209
372
|
}
|
|
210
|
-
return _optionalChain([matches, 'access',
|
|
373
|
+
return _optionalChain([matches, 'access', _5 => _5.groups, 'optionalAccess', _6 => _6.project]);
|
|
211
374
|
}
|
|
212
375
|
function stringify(obj, opts = {}) {
|
|
213
376
|
return stringifyObject(obj, { indent: " ", ...opts });
|
|
@@ -270,11 +433,11 @@ var client = {
|
|
|
270
433
|
const opts = {
|
|
271
434
|
...options
|
|
272
435
|
};
|
|
273
|
-
if (!_optionalChain([opts, 'optionalAccess',
|
|
436
|
+
if (!_optionalChain([opts, 'optionalAccess', _7 => _7.api])) {
|
|
274
437
|
throw new Error("This HTTPSnippet client must have an `api` config supplied to it.");
|
|
275
|
-
} else if (!_optionalChain([opts, 'optionalAccess',
|
|
438
|
+
} else if (!_optionalChain([opts, 'optionalAccess', _8 => _8.api, 'optionalAccess', _9 => _9.definition])) {
|
|
276
439
|
throw new Error("This HTTPSnippet client must have an `api.definition` option supplied to it.");
|
|
277
|
-
} else if (!_optionalChain([opts, 'optionalAccess',
|
|
440
|
+
} else if (!_optionalChain([opts, 'optionalAccess', _10 => _10.api, 'optionalAccess', _11 => _11.registryURI])) {
|
|
278
441
|
throw new Error("This HTTPSnippet client must have an `api.registryURI` option supplied to it.");
|
|
279
442
|
}
|
|
280
443
|
const method = source.method.toLowerCase();
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/erunion/code/readme/api/packages/httpsnippet-client-api/dist/index.cjs","../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"],"names":["preserveConsecutiveUppercase","stringify","input","options","pad"],"mappings":"AAAA;ACKA,uEAA4B;ADH5B;AACA;AEHA,IAAM,UAAA,EAAY,WAAA;AAClB,IAAM,UAAA,EAAY,WAAA;AAClB,IAAM,gBAAA,EAAkB,yBAAA;AACxB,IAAM,WAAA,EAAa,wBAAA;AACnB,IAAM,WAAA,EAAa,UAAA;AAEnB,IAAM,mBA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YAAA;AACA,YAAA;AACE,cAAA;AACA,cAAA;AACF,YAAA;AAEA,YAAA;AACF,UAAA;AAEA,UAAA;AACA,UAAA;AACF,QAAA;AAIE,UAAA;AACA,UAAA;AACE,YAAA;AACA,YAAA;AACF,UAAA;AACF,QAAA;AAGE,UAAA;AACE,YAAA;AACA,YAAA;AACF,UAAA;AACF,QAAA;AAII,QAAA;AACF,UAAA;AACF,QAAA;AAGE,UAAA;AACF,QAAA;AACD,MAAA;AAEG,MAAA;AACF,QAAA;AACF,MAAA;AACF,IAAA;AAGI,IAAA;AACI,IAAA;AACD,MAAA;AACH,QAAA;AACA,QAAA;AAEG,MAAA;AACC,QAAA;AACF,UAAA;AACF,QAAA;AACA,QAAA;AAEG,MAAA;AACC,QAAA;AACF,UAAA;AAMA,UAAA;AACE,YAAA;AACF,UAAA;AAEA,UAAA;AACE,YAAA;AACE,cAAA;AACF,YAAA;AACE,cAAA;AACF,YAAA;AACD,UAAA;AACH,QAAA;AACA,QAAA;AAEF,MAAA;AACM,QAAA;AACF,UAAA;AACF,QAAA;AACJ,IAAA;AAEM,IAAA;AAEA,IAAA;AAIA,IAAA;AACF,IAAA;AACG,MAAA;AACP,IAAA;AAEI,IAAA;AACG,MAAA;AACP,IAAA;AAEI,IAAA;AACG,MAAA;AACP,IAAA;AAEI,IAAA;AACG,MAAA;AACP,IAAA;AAEQ,IAAA;AACH,IAAA;AACA,IAAA;AAEE,IAAA;AACT,EAAA;AACF;AAEM;AACI,EAAA;AACR,EAAA;AACF;AAEO;AD2DK;AACA;AACA","file":"/Users/erunion/code/readme/api/packages/httpsnippet-client-api/dist/index.cjs","sourcesContent":[null,"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"]}
|
|
1
|
+
{"version":3,"sources":["/Users/erunion/code/readme/api/packages/httpsnippet-client-api/dist/index.cjs","../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/reserved-identifiers/index.js","../../../node_modules/identifier-regex/index.js","../../../node_modules/function-timeout/index.js","../../../node_modules/super-regex/index.js","../../../node_modules/is-identifier/index.js","../../../node_modules/stringify-object/index.js"],"names":["preserveConsecutiveUppercase","pad","input"],"mappings":"AAAA;ACKA,uEAA4B;ADH5B;AACA;AEHA,IAAM,UAAA,EAAY,WAAA;AAClB,IAAM,UAAA,EAAY,WAAA;AAClB,IAAM,gBAAA,EAAkB,yBAAA;AACxB,IAAM,WAAA,EAAa,wBAAA;AACnB,IAAM,WAAA,EAAa,UAAA;AAEnB,IAAM,mBAAA,EAAqB,IAAI,MAAA,CAAO,IAAA,EAAM,UAAA,CAAW,MAAM,CAAA;AAC7D,IAAM,0BAAA,EAA4B,IAAI,MAAA,CAAO,UAAA,CAAW,OAAA,EAAS,UAAA,CAAW,MAAA,EAAQ,IAAI,CAAA;AACxF,IAAM,uBAAA,EAAyB,IAAI,MAAA,CAAO,OAAA,EAAS,UAAA,CAAW,MAAA,EAAQ,IAAI,CAAA;AAE1E,IAAM,kBAAA,EAAoB,CAAC,MAAA,EAAQ,WAAA,EAAa,WAAA,EAAaA,6BAAAA,EAAAA,GAAiC;AAC7F,EAAA,IAAI,gBAAA,EAAkB,KAAA;AACtB,EAAA,IAAI,gBAAA,EAAkB,KAAA;AACtB,EAAA,IAAI,oBAAA,EAAsB,KAAA;AAC1B,EAAA,IAAI,wBAAA,EAA0B,KAAA;AAE9B,EAAA,IAAA,CAAA,IAAS,MAAA,EAAQ,CAAA,EAAG,MAAA,EAAQ,MAAA,CAAO,MAAA,EAAQ,KAAA,EAAA,EAAS;AACnD,IAAA,MAAM,UAAA,EAAY,MAAA,CAAO,KAAK,CAAA;AAC9B,IAAA,wBAAA,EAA0B,MAAA,EAAQ,EAAA,EAAI,MAAA,CAAO,MAAA,EAAQ,CAAC,EAAA,IAAM,IAAA,EAAM,IAAA;AAElE,IAAA,GAAA,CAAI,gBAAA,GAAmB,SAAA,CAAU,IAAA,CAAK,SAAS,CAAA,EAAG;AACjD,MAAA,OAAA,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B,MAAA;AAEN,MAAA;AAGE,QAAA;AAEA,QAAA;AAGY,UAAA;AACzB,UAAA;AACsC,YAAA;AACvD,UAAA;AAE0E,YAAA;AACrC,YAAA;AACiB,cAAA;AAC9B,cAAA;AAC7B,YAAA;AAEoD,YAAA;AACtD,UAAA;AAEqB,UAAA;AACrB,UAAA;AACyC,QAAA;AAIkB,UAAA;AACJ,UAAA;AAChC,YAAA;AACrB,YAAA;AACF,UAAA;AACmC,QAAA;AAGkB,UAAA;AAC9B,YAAA;AACrB,YAAA;AACF,UAAA;AACF,QAAA;AAIsD,QAAA;AACR,UAAA;AACvC,QAAA;AAGkC,UAAA;AACzC,QAAA;AACD,MAAA;AAE2C,MAAA;AACO,QAAA;AACnD,MAAA;AACF,IAAA;AAEI,IAAA;AACuB,IAAA;AACpB,MAAA;AACa,QAAA;AAChB,QAAA;AAEG,MAAA;AACmB,QAAA;AACJ,UAAA;AAClB,QAAA;AACA,QAAA;AAEG,MAAA;AACkB,QAAA;AACX,UAAA;AAMyF,UAAA;AACjE,YAAA;AAChC,UAAA;AAEiC,UAAA;AACX,YAAA;AACO,cAAA;AACpB,YAAA;AACoB,cAAA;AAC3B,YAAA;AACD,UAAA;AACH,QAAA;AACA,QAAA;AAEF,MAAA;AACqB,QAAA;AACD,UAAA;AAClB,QAAA;AACJ,IAAA;AAEc,IAAA;AAE+C,IAAA;AAIuC,IAAA;AACnE,IAAA;AACoB,MAAA;AACrD,IAAA;AAEsC,IAAA;AACmB,MAAA;AACzD,IAAA;AAEqB,IAAA;AACK,MAAA;AAC1B,IAAA;AAEuB,IAAA;AACK,MAAA;AAC5B,IAAA;AAEqD,IAAA;AACL,IAAA;AACJ,IAAA;AAEhC,IAAA;AACd,EAAA;AACF;AAEyC;AAC/B,EAAA;AACR,EAAA;AACF;AAEe;ADgOuK;AACA;AACA","file":"/Users/erunion/code/readme/api/packages/httpsnippet-client-api/dist/index.cjs","sourcesContent":[null,"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';\nimport contentType from 'content-type';\nimport Oas from 'oas';\nimport { matchesMimeType } from 'oas/utils';\nimport { isReservedOrBuiltinsLC } from 'reserved2';\nimport stringifyObject from 'stringify-object';\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): string | undefined {\n const matches = uri.match(registryUUIDRegex);\n if (!matches) {\n return;\n }\n\n return matches.groups?.project;\n}\n\nfunction stringify(obj: unknown, 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 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","// https://262.ecma-international.org/14.0/#sec-keywords-and-reserved-words\n// 14 is ES2023\nconst identifiers = [\n\t// Keywords\n\t'await',\n\t'break',\n\t'case',\n\t'catch',\n\t'class',\n\t'const',\n\t'continue',\n\t'debugger',\n\t'default',\n\t'delete',\n\t'do',\n\t'else',\n\t'enum',\n\t'export',\n\t'extends',\n\t'false',\n\t'finally',\n\t'for',\n\t'function',\n\t'if',\n\t'import',\n\t'in',\n\t'instanceof',\n\t'new',\n\t'null',\n\t'return',\n\t'super',\n\t'switch',\n\t'this',\n\t'throw',\n\t'true',\n\t'try',\n\t'typeof',\n\t'var',\n\t'void',\n\t'while',\n\t'with',\n\t'yield',\n\n\t// Future reserved keywords\n\t'implements',\n\t'interface',\n\t'package',\n\t'private',\n\t'protected',\n\t'public',\n\n\t// Not keywords, but still restricted\n\t'arguments',\n\t'eval',\n];\n\n// https://262.ecma-international.org/14.0/#sec-value-properties-of-the-global-object\nconst globalProperties = [\n\t'globalThis',\n\t'Infinity',\n\t'NaN',\n\t'undefined',\n];\n\nexport default function reservedIdentifiers({includeGlobalProperties = false} = {}) {\n\treturn new Set([\n\t\t...identifiers,\n\t\t...(includeGlobalProperties ? globalProperties : []),\n\t]);\n}\n","import reservedIdentifiers from 'reserved-identifiers';\n\nconst baseRegex = /[$_\\p{ID_Start}][$_\\u200C\\u200D\\p{ID_Continue}]*/u;\nconst basePattern = `(?<![@#$_\\\\p{ID_Continue}\\\\p{ID_Start}])(?!(?:${[...reservedIdentifiers({includeGlobalProperties: true})].join('|')})(?![$_\\\\p{ID_Continue}]))${baseRegex.source}`;\nconst regex = new RegExp(basePattern, 'u');\nconst regexExact = new RegExp(`^${basePattern}$`, 'u');\n\nexport default function identifierRegex({exact = true} = {}) {\n\treturn exact ? regexExact : regex;\n}\n","import vm from 'node:vm';\n\nconst script = new vm.Script('returnValue = functionToRun()');\n\n// TODO: Document the `context` option and add to types when I know it's something I want to keep.\n\n// If you use the `context` option, you do it at your own risk.\nexport default function functionTimeout(function_, {timeout, context = vm.createContext()} = {}) {\n\tconst wrappedFunction = (...arguments_) => {\n\t\tcontext.functionToRun = () => function_(...arguments_);\n\t\tscript.runInNewContext(context, {timeout});\n\t\treturn context.returnValue;\n\t};\n\n\tObject.defineProperty(wrappedFunction, 'name', {\n\t\tvalue: `functionTimeout(${function_.name || '<anonymous>'})`,\n\t\tconfigurable: true,\n\t});\n\n\treturn wrappedFunction;\n}\n\nexport function isTimeoutError(error) {\n\treturn error?.code === 'ERR_SCRIPT_EXECUTION_TIMEOUT';\n}\n","import functionTimeout, {isTimeoutError} from 'function-timeout';\nimport timeSpan from 'time-span';\n\nconst resultToMatch = result => ({\n\tmatch: result[0],\n\tindex: result.index,\n\tgroups: result.slice(1),\n\tnamedGroups: result.groups ?? {},\n\tinput: result.input,\n});\n\nconst context = {};\n\nexport function isMatch(regex, string, {timeout} = {}) {\n\ttry {\n\t\treturn functionTimeout(() => structuredClone(regex).test(string), {timeout, context})();\n\t} catch (error) {\n\t\tif (isTimeoutError(error)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\nexport function firstMatch(regex, string, {timeout} = {}) {\n\ttry {\n\t\tconst result = functionTimeout(() => structuredClone(regex).exec(string), {timeout, context})();\n\n\t\tif (result === null) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn resultToMatch(result);\n\t} catch (error) {\n\t\tif (isTimeoutError(error)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\nexport function matches(regex, string, {timeout = Number.POSITIVE_INFINITY, matchTimeout = Number.POSITIVE_INFINITY} = {}) {\n\tif (!regex.global) {\n\t\tthrow new Error('The regex must have the global flag, otherwise, use `firstMatch()` instead');\n\t}\n\n\treturn {\n\t\t* [Symbol.iterator]() {\n\t\t\ttry {\n\t\t\t\tconst matches = string.matchAll(regex); // The regex is only executed when iterated over.\n\n\t\t\t\twhile (true) {\n\t\t\t\t\t// `matches.next` must be called within an arrow function so that it doesn't loose its context.\n\t\t\t\t\tconst nextMatch = functionTimeout(() => matches.next(), {\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\ttimeout: (timeout !== Number.POSITIVE_INFINITY || matchTimeout !== Number.POSITIVE_INFINITY) ? Math.min(timeout, matchTimeout) : undefined,\n\t\t\t\t\t});\n\n\t\t\t\t\tconst end = timeSpan();\n\t\t\t\t\tconst {value, done} = nextMatch();\n\t\t\t\t\ttimeout -= Math.ceil(end());\n\n\t\t\t\t\tif (done) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tyield resultToMatch(value);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (!isTimeoutError(error)) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t};\n}\n","import identifierRegex from 'identifier-regex';\nimport {isMatch} from 'super-regex';\n\nconst regex = identifierRegex();\n\nexport default function isIdentifier(value) {\n\tif (typeof value !== 'string') {\n\t\tthrow new TypeError(`Expected a string, got \\`${typeof value}\\`.`);\n\t}\n\n\t// Prevent abuse.\n\tif (value.length > 100_000) {\n\t\treturn false;\n\t}\n\n\treturn isMatch(regex, value, {timeout: 1000});\n}\n","import isRegexp from 'is-regexp';\nimport isObject from 'is-obj';\nimport getOwnEnumerableKeys from 'get-own-enumerable-keys';\nimport isIdentifier from 'is-identifier';\n\nconst CHARACTER_ESCAPES = {\n\t'\\n': String.raw`\\n`,\n\t'\\r': String.raw`\\r`,\n\t'\\t': String.raw`\\t`,\n\t'\\b': String.raw`\\b`,\n\t'\\f': String.raw`\\f`,\n\t'\\v': String.raw`\\v`,\n\t'\\0': String.raw`\\0`,\n};\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.replaceAll(tokens.newline, '')\n\t\t\t\t.replaceAll(tokens.newlineOrSpace, ' ')\n\t\t\t\t.replaceAll(tokens.pad, '')\n\t\t\t\t.replaceAll(tokens.indent, '');\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.replaceAll(tokens.newline, '\\n')\n\t\t\t\t.replaceAll(tokens.newlineOrSpace, '\\n')\n\t\t\t\t.replaceAll(tokens.pad, pad)\n\t\t\t\t.replaceAll(tokens.indent, pad + indent);\n\t\t};\n\n\t\tif (seen.includes(input)) {\n\t\t\treturn '\"[Circular]\"';\n\t\t}\n\n\t\tconst type = typeof input;\n\n\t\tif (\n\t\t\tinput === null\n\t\t\t|| input === undefined\n\t\t\t|| type === 'number'\n\t\t\t|| type === 'boolean'\n\t\t\t|| type === 'function'\n\t\t\t|| isRegexp(input)\n\t\t) {\n\t\t\treturn String(input);\n\t\t}\n\n\t\tif (type === 'bigint') {\n\t\t\treturn String(input) + 'n';\n\t\t}\n\n\t\tif (type === 'symbol') {\n\t\t\tconst {description} = input;\n\n\t\t\tif (description === undefined) {\n\t\t\t\treturn 'Symbol()';\n\t\t\t}\n\n\t\t\t// Check for well-known symbols first\n\t\t\tif (description?.startsWith('Symbol.') && Symbol[description.slice(7)] === input) {\n\t\t\t\treturn description;\n\t\t\t}\n\n\t\t\t// Check if it's a global registry symbol\n\t\t\tconst globalKey = Symbol.keyFor(input);\n\t\t\tif (globalKey !== undefined) {\n\t\t\t\treturn `Symbol.for(${stringify(globalKey, options)})`;\n\t\t\t}\n\n\t\t\treturn `Symbol(${stringify(description, options)})`;\n\t\t}\n\n\t\tif (input instanceof Date) {\n\t\t\treturn Number.isNaN(input.getTime())\n\t\t\t\t? 'new Date(\\'Invalid Date\\')'\n\t\t\t\t: `new Date('${input.toISOString()}')`;\n\t\t}\n\n\t\tif (input instanceof Map || input instanceof Set) {\n\t\t\tconst isMap = input instanceof Map;\n\t\t\tconst name = isMap ? 'Map' : 'Set';\n\n\t\t\tif (input.size === 0) {\n\t\t\t\treturn `new ${name}()`;\n\t\t\t}\n\n\t\t\tseen.push(input);\n\n\t\t\tconst items = [...input].map(item => {\n\t\t\t\tif (isMap) {\n\t\t\t\t\tconst [key, value] = item;\n\t\t\t\t\treturn tokens.indent + `[${stringify(key, options, pad + indent)}, ${stringify(value, options, pad + indent)}]`;\n\t\t\t\t}\n\n\t\t\t\treturn tokens.indent + stringify(item, options, pad + indent);\n\t\t\t}).join(',' + tokens.newlineOrSpace);\n\n\t\t\tseen.pop();\n\n\t\t\treturn expandWhiteSpace(`new ${name}([${tokens.newline}${items}${tokens.newline}${tokens.pad}])`);\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 items = input.map((element, index) => {\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, index, value);\n\t\t\t\t}\n\n\t\t\t\treturn tokens.indent + value;\n\t\t\t}).join(',' + tokens.newlineOrSpace);\n\n\t\t\tseen.pop();\n\n\t\t\treturn expandWhiteSpace(`[${tokens.newline}${items}${tokens.newline}${tokens.pad}]`);\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 pairs = objectKeys.map(element => {\n\t\t\t\tconst isSymbol = typeof element === 'symbol';\n\n\t\t\t\tlet key;\n\t\t\t\tif (isSymbol) {\n\t\t\t\t\tkey = `[${stringify(element, options)}]`;\n\t\t\t\t} else if (isIdentifier(element)) {\n\t\t\t\t\tkey = element;\n\t\t\t\t} else {\n\t\t\t\t\tkey = stringify(element, options);\n\t\t\t\t}\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 + key + ': ' + value;\n\t\t\t}).join(',' + tokens.newlineOrSpace);\n\n\t\t\tseen.pop();\n\n\t\t\treturn expandWhiteSpace(`{${tokens.newline}${pairs}${tokens.newline}${tokens.pad}}`);\n\t\t}\n\n\t\t// String escaping\n\t\tconst stringified = String(input)\n\t\t\t.replaceAll('\\\\', '\\\\\\\\')\n\t\t\t// eslint-disable-next-line no-control-regex\n\t\t\t.replaceAll(/[\\u0000-\\u001F\\u007F]/g, x =>\n\t\t\t\tCHARACTER_ESCAPES[x] ?? `\\\\u${x.codePointAt(0).toString(16).padStart(4, '0')}`);\n\n\t\tif (options.singleQuotes === false) {\n\t\t\treturn `\"${stringified.replaceAll('\"', String.raw`\\\"`)}\"`;\n\t\t}\n\n\t\treturn `'${stringified.replaceAll('\\'', String.raw`\\'`)}'`;\n\t})(input, options, pad);\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -110,10 +110,137 @@ function getOwnEnumerableKeys(object) {
|
|
|
110
110
|
];
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
// ../../node_modules/reserved-identifiers/index.js
|
|
114
|
+
var identifiers = [
|
|
115
|
+
// Keywords
|
|
116
|
+
"await",
|
|
117
|
+
"break",
|
|
118
|
+
"case",
|
|
119
|
+
"catch",
|
|
120
|
+
"class",
|
|
121
|
+
"const",
|
|
122
|
+
"continue",
|
|
123
|
+
"debugger",
|
|
124
|
+
"default",
|
|
125
|
+
"delete",
|
|
126
|
+
"do",
|
|
127
|
+
"else",
|
|
128
|
+
"enum",
|
|
129
|
+
"export",
|
|
130
|
+
"extends",
|
|
131
|
+
"false",
|
|
132
|
+
"finally",
|
|
133
|
+
"for",
|
|
134
|
+
"function",
|
|
135
|
+
"if",
|
|
136
|
+
"import",
|
|
137
|
+
"in",
|
|
138
|
+
"instanceof",
|
|
139
|
+
"new",
|
|
140
|
+
"null",
|
|
141
|
+
"return",
|
|
142
|
+
"super",
|
|
143
|
+
"switch",
|
|
144
|
+
"this",
|
|
145
|
+
"throw",
|
|
146
|
+
"true",
|
|
147
|
+
"try",
|
|
148
|
+
"typeof",
|
|
149
|
+
"var",
|
|
150
|
+
"void",
|
|
151
|
+
"while",
|
|
152
|
+
"with",
|
|
153
|
+
"yield",
|
|
154
|
+
// Future reserved keywords
|
|
155
|
+
"implements",
|
|
156
|
+
"interface",
|
|
157
|
+
"package",
|
|
158
|
+
"private",
|
|
159
|
+
"protected",
|
|
160
|
+
"public",
|
|
161
|
+
// Not keywords, but still restricted
|
|
162
|
+
"arguments",
|
|
163
|
+
"eval"
|
|
164
|
+
];
|
|
165
|
+
var globalProperties = [
|
|
166
|
+
"globalThis",
|
|
167
|
+
"Infinity",
|
|
168
|
+
"NaN",
|
|
169
|
+
"undefined"
|
|
170
|
+
];
|
|
171
|
+
function reservedIdentifiers({ includeGlobalProperties = false } = {}) {
|
|
172
|
+
return /* @__PURE__ */ new Set([
|
|
173
|
+
...identifiers,
|
|
174
|
+
...includeGlobalProperties ? globalProperties : []
|
|
175
|
+
]);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// ../../node_modules/identifier-regex/index.js
|
|
179
|
+
var baseRegex = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*/u;
|
|
180
|
+
var basePattern = `(?<![@#$_\\p{ID_Continue}\\p{ID_Start}])(?!(?:${[...reservedIdentifiers({ includeGlobalProperties: true })].join("|")})(?![$_\\p{ID_Continue}]))${baseRegex.source}`;
|
|
181
|
+
var regex = new RegExp(basePattern, "u");
|
|
182
|
+
var regexExact = new RegExp(`^${basePattern}$`, "u");
|
|
183
|
+
function identifierRegex({ exact = true } = {}) {
|
|
184
|
+
return exact ? regexExact : regex;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// ../../node_modules/function-timeout/index.js
|
|
188
|
+
import vm from "vm";
|
|
189
|
+
var script = new vm.Script("returnValue = functionToRun()");
|
|
190
|
+
function functionTimeout(function_, { timeout, context: context2 = vm.createContext() } = {}) {
|
|
191
|
+
const wrappedFunction = (...arguments_) => {
|
|
192
|
+
context2.functionToRun = () => function_(...arguments_);
|
|
193
|
+
script.runInNewContext(context2, { timeout });
|
|
194
|
+
return context2.returnValue;
|
|
195
|
+
};
|
|
196
|
+
Object.defineProperty(wrappedFunction, "name", {
|
|
197
|
+
value: `functionTimeout(${function_.name || "<anonymous>"})`,
|
|
198
|
+
configurable: true
|
|
199
|
+
});
|
|
200
|
+
return wrappedFunction;
|
|
201
|
+
}
|
|
202
|
+
function isTimeoutError(error) {
|
|
203
|
+
return error?.code === "ERR_SCRIPT_EXECUTION_TIMEOUT";
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// ../../node_modules/super-regex/index.js
|
|
207
|
+
var context = {};
|
|
208
|
+
function isMatch(regex3, string, { timeout } = {}) {
|
|
209
|
+
try {
|
|
210
|
+
return functionTimeout(() => structuredClone(regex3).test(string), { timeout, context })();
|
|
211
|
+
} catch (error) {
|
|
212
|
+
if (isTimeoutError(error)) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
throw error;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// ../../node_modules/is-identifier/index.js
|
|
220
|
+
var regex2 = identifierRegex();
|
|
221
|
+
function isIdentifier(value) {
|
|
222
|
+
if (typeof value !== "string") {
|
|
223
|
+
throw new TypeError(`Expected a string, got \`${typeof value}\`.`);
|
|
224
|
+
}
|
|
225
|
+
if (value.length > 1e5) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
return isMatch(regex2, value, { timeout: 1e3 });
|
|
229
|
+
}
|
|
230
|
+
|
|
113
231
|
// ../../node_modules/stringify-object/index.js
|
|
232
|
+
var CHARACTER_ESCAPES = {
|
|
233
|
+
"\n": String.raw`\n`,
|
|
234
|
+
"\r": String.raw`\r`,
|
|
235
|
+
" ": String.raw`\t`,
|
|
236
|
+
"\b": String.raw`\b`,
|
|
237
|
+
"\f": String.raw`\f`,
|
|
238
|
+
"\v": String.raw`\v`,
|
|
239
|
+
"\0": String.raw`\0`
|
|
240
|
+
};
|
|
114
241
|
function stringifyObject(input, options, pad) {
|
|
115
242
|
const seen = [];
|
|
116
|
-
return function stringify2(input2, options2 = {}, pad2 = "") {
|
|
243
|
+
return (function stringify2(input2, options2 = {}, pad2 = "") {
|
|
117
244
|
const indent = options2.indent || " ";
|
|
118
245
|
let tokens;
|
|
119
246
|
if (options2.inlineCharacterLimit === void 0) {
|
|
@@ -135,36 +262,70 @@ function stringifyObject(input, options, pad) {
|
|
|
135
262
|
if (options2.inlineCharacterLimit === void 0) {
|
|
136
263
|
return string;
|
|
137
264
|
}
|
|
138
|
-
const oneLined = string.
|
|
265
|
+
const oneLined = string.replaceAll(tokens.newline, "").replaceAll(tokens.newlineOrSpace, " ").replaceAll(tokens.pad, "").replaceAll(tokens.indent, "");
|
|
139
266
|
if (oneLined.length <= options2.inlineCharacterLimit) {
|
|
140
267
|
return oneLined;
|
|
141
268
|
}
|
|
142
|
-
return string.
|
|
269
|
+
return string.replaceAll(tokens.newline, "\n").replaceAll(tokens.newlineOrSpace, "\n").replaceAll(tokens.pad, pad2).replaceAll(tokens.indent, pad2 + indent);
|
|
143
270
|
};
|
|
144
271
|
if (seen.includes(input2)) {
|
|
145
272
|
return '"[Circular]"';
|
|
146
273
|
}
|
|
147
|
-
|
|
274
|
+
const type = typeof input2;
|
|
275
|
+
if (input2 === null || input2 === void 0 || type === "number" || type === "boolean" || type === "function" || isRegexp(input2)) {
|
|
148
276
|
return String(input2);
|
|
149
277
|
}
|
|
278
|
+
if (type === "bigint") {
|
|
279
|
+
return String(input2) + "n";
|
|
280
|
+
}
|
|
281
|
+
if (type === "symbol") {
|
|
282
|
+
const { description } = input2;
|
|
283
|
+
if (description === void 0) {
|
|
284
|
+
return "Symbol()";
|
|
285
|
+
}
|
|
286
|
+
if (description?.startsWith("Symbol.") && Symbol[description.slice(7)] === input2) {
|
|
287
|
+
return description;
|
|
288
|
+
}
|
|
289
|
+
const globalKey = Symbol.keyFor(input2);
|
|
290
|
+
if (globalKey !== void 0) {
|
|
291
|
+
return `Symbol.for(${stringify2(globalKey, options2)})`;
|
|
292
|
+
}
|
|
293
|
+
return `Symbol(${stringify2(description, options2)})`;
|
|
294
|
+
}
|
|
150
295
|
if (input2 instanceof Date) {
|
|
151
|
-
return `new Date('${input2.toISOString()}')`;
|
|
296
|
+
return Number.isNaN(input2.getTime()) ? "new Date('Invalid Date')" : `new Date('${input2.toISOString()}')`;
|
|
297
|
+
}
|
|
298
|
+
if (input2 instanceof Map || input2 instanceof Set) {
|
|
299
|
+
const isMap = input2 instanceof Map;
|
|
300
|
+
const name = isMap ? "Map" : "Set";
|
|
301
|
+
if (input2.size === 0) {
|
|
302
|
+
return `new ${name}()`;
|
|
303
|
+
}
|
|
304
|
+
seen.push(input2);
|
|
305
|
+
const items = [...input2].map((item) => {
|
|
306
|
+
if (isMap) {
|
|
307
|
+
const [key, value] = item;
|
|
308
|
+
return tokens.indent + `[${stringify2(key, options2, pad2 + indent)}, ${stringify2(value, options2, pad2 + indent)}]`;
|
|
309
|
+
}
|
|
310
|
+
return tokens.indent + stringify2(item, options2, pad2 + indent);
|
|
311
|
+
}).join("," + tokens.newlineOrSpace);
|
|
312
|
+
seen.pop();
|
|
313
|
+
return expandWhiteSpace(`new ${name}([${tokens.newline}${items}${tokens.newline}${tokens.pad}])`);
|
|
152
314
|
}
|
|
153
315
|
if (Array.isArray(input2)) {
|
|
154
316
|
if (input2.length === 0) {
|
|
155
317
|
return "[]";
|
|
156
318
|
}
|
|
157
319
|
seen.push(input2);
|
|
158
|
-
const
|
|
159
|
-
const eol = input2.length - 1 === i ? tokens.newline : "," + tokens.newlineOrSpace;
|
|
320
|
+
const items = input2.map((element, index) => {
|
|
160
321
|
let value = stringify2(element, options2, pad2 + indent);
|
|
161
322
|
if (options2.transform) {
|
|
162
|
-
value = options2.transform(input2,
|
|
323
|
+
value = options2.transform(input2, index, value);
|
|
163
324
|
}
|
|
164
|
-
return tokens.indent + value
|
|
165
|
-
}).join(""
|
|
325
|
+
return tokens.indent + value;
|
|
326
|
+
}).join("," + tokens.newlineOrSpace);
|
|
166
327
|
seen.pop();
|
|
167
|
-
return expandWhiteSpace(
|
|
328
|
+
return expandWhiteSpace(`[${tokens.newline}${items}${tokens.newline}${tokens.pad}]`);
|
|
168
329
|
}
|
|
169
330
|
if (isObject(input2)) {
|
|
170
331
|
let objectKeys = getOwnEnumerableKeys(input2);
|
|
@@ -175,29 +336,31 @@ function stringifyObject(input, options, pad) {
|
|
|
175
336
|
return "{}";
|
|
176
337
|
}
|
|
177
338
|
seen.push(input2);
|
|
178
|
-
const
|
|
179
|
-
const eol = objectKeys.length - 1 === index ? tokens.newline : "," + tokens.newlineOrSpace;
|
|
339
|
+
const pairs = objectKeys.map((element) => {
|
|
180
340
|
const isSymbol = typeof element === "symbol";
|
|
181
|
-
|
|
182
|
-
|
|
341
|
+
let key;
|
|
342
|
+
if (isSymbol) {
|
|
343
|
+
key = `[${stringify2(element, options2)}]`;
|
|
344
|
+
} else if (isIdentifier(element)) {
|
|
345
|
+
key = element;
|
|
346
|
+
} else {
|
|
347
|
+
key = stringify2(element, options2);
|
|
348
|
+
}
|
|
183
349
|
let value = stringify2(input2[element], options2, pad2 + indent);
|
|
184
350
|
if (options2.transform) {
|
|
185
351
|
value = options2.transform(input2, element, value);
|
|
186
352
|
}
|
|
187
|
-
return tokens.indent +
|
|
188
|
-
}).join(""
|
|
353
|
+
return tokens.indent + key + ": " + value;
|
|
354
|
+
}).join("," + tokens.newlineOrSpace);
|
|
189
355
|
seen.pop();
|
|
190
|
-
return expandWhiteSpace(
|
|
356
|
+
return expandWhiteSpace(`{${tokens.newline}${pairs}${tokens.newline}${tokens.pad}}`);
|
|
191
357
|
}
|
|
192
|
-
|
|
193
|
-
input2 = String(input2).replace(/[\r\n]/g, (x) => x === "\n" ? "\\n" : "\\r");
|
|
358
|
+
const stringified = String(input2).replaceAll("\\", "\\\\").replaceAll(/[\u0000-\u001F\u007F]/g, (x) => CHARACTER_ESCAPES[x] ?? `\\u${x.codePointAt(0).toString(16).padStart(4, "0")}`);
|
|
194
359
|
if (options2.singleQuotes === false) {
|
|
195
|
-
|
|
196
|
-
return `"${input2}"`;
|
|
360
|
+
return `"${stringified.replaceAll('"', String.raw`\"`)}"`;
|
|
197
361
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}(input, options, pad);
|
|
362
|
+
return `'${stringified.replaceAll("'", String.raw`\'`)}'`;
|
|
363
|
+
})(input, options, pad);
|
|
201
364
|
}
|
|
202
365
|
|
|
203
366
|
// src/index.ts
|
|
@@ -205,7 +368,7 @@ var registryUUIDRegex = /^@(?<project>[a-zA-Z0-9-_]+)(\/?(?<version>.+))?#(?<uui
|
|
|
205
368
|
function getProjectPrefixFromRegistryUUID(uri) {
|
|
206
369
|
const matches = uri.match(registryUUIDRegex);
|
|
207
370
|
if (!matches) {
|
|
208
|
-
return
|
|
371
|
+
return;
|
|
209
372
|
}
|
|
210
373
|
return matches.groups?.project;
|
|
211
374
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,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KAAK;AACpG,QAAI,OAAO,SAAS,aAAa;AAC/B,WAAK,KAAK,UAAU,MAAM,EAAE,qBAAqB,CAAC,CAAC;AAAA,IACrD;AAEA,QAAI,OAAO,KAAK,QAAQ,EAAE,SAAS,GAAG;AACpC,WAAK,KAAK,UAAU,UAAU,EAAE,qBAAqB,CAAC,CAAC;AAAA,IACzD;AAEA,QAAI,SAAS,QAAQ;AACnB,WAAK,SAAS,KAAK,IAAI,CAAC;AAAA,IAC1B;AAEA,QAAI,WAAW,QAAQ;AACrB,WAAK,WAAW,KAAK,IAAI,CAAC;AAAA,IAC5B;AAEA,SAAK,GAAG,WAAW,IAAI,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,GAAG;AACrD,SAAK,0CAA0C,CAAC;AAChD,SAAK,sCAAsC,CAAC;AAE5C,WAAO,KAAK;AAAA,EACd;AACF;AAEA,IAAM,SAAmC;AAAA,EACvC,QAAQ;AAAA,EACR;AACF;AAEA,IAAO,gBAAQ;","names":["preserveConsecutiveUppercase","stringify","input","options","pad"]}
|
|
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/reserved-identifiers/index.js","../../../node_modules/identifier-regex/index.js","../../../node_modules/function-timeout/index.js","../../../node_modules/super-regex/index.js","../../../node_modules/is-identifier/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';\nimport contentType from 'content-type';\nimport Oas from 'oas';\nimport { matchesMimeType } from 'oas/utils';\nimport { isReservedOrBuiltinsLC } from 'reserved2';\nimport stringifyObject from 'stringify-object';\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): string | undefined {\n const matches = uri.match(registryUUIDRegex);\n if (!matches) {\n return;\n }\n\n return matches.groups?.project;\n}\n\nfunction stringify(obj: unknown, 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 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","// https://262.ecma-international.org/14.0/#sec-keywords-and-reserved-words\n// 14 is ES2023\nconst identifiers = [\n\t// Keywords\n\t'await',\n\t'break',\n\t'case',\n\t'catch',\n\t'class',\n\t'const',\n\t'continue',\n\t'debugger',\n\t'default',\n\t'delete',\n\t'do',\n\t'else',\n\t'enum',\n\t'export',\n\t'extends',\n\t'false',\n\t'finally',\n\t'for',\n\t'function',\n\t'if',\n\t'import',\n\t'in',\n\t'instanceof',\n\t'new',\n\t'null',\n\t'return',\n\t'super',\n\t'switch',\n\t'this',\n\t'throw',\n\t'true',\n\t'try',\n\t'typeof',\n\t'var',\n\t'void',\n\t'while',\n\t'with',\n\t'yield',\n\n\t// Future reserved keywords\n\t'implements',\n\t'interface',\n\t'package',\n\t'private',\n\t'protected',\n\t'public',\n\n\t// Not keywords, but still restricted\n\t'arguments',\n\t'eval',\n];\n\n// https://262.ecma-international.org/14.0/#sec-value-properties-of-the-global-object\nconst globalProperties = [\n\t'globalThis',\n\t'Infinity',\n\t'NaN',\n\t'undefined',\n];\n\nexport default function reservedIdentifiers({includeGlobalProperties = false} = {}) {\n\treturn new Set([\n\t\t...identifiers,\n\t\t...(includeGlobalProperties ? globalProperties : []),\n\t]);\n}\n","import reservedIdentifiers from 'reserved-identifiers';\n\nconst baseRegex = /[$_\\p{ID_Start}][$_\\u200C\\u200D\\p{ID_Continue}]*/u;\nconst basePattern = `(?<![@#$_\\\\p{ID_Continue}\\\\p{ID_Start}])(?!(?:${[...reservedIdentifiers({includeGlobalProperties: true})].join('|')})(?![$_\\\\p{ID_Continue}]))${baseRegex.source}`;\nconst regex = new RegExp(basePattern, 'u');\nconst regexExact = new RegExp(`^${basePattern}$`, 'u');\n\nexport default function identifierRegex({exact = true} = {}) {\n\treturn exact ? regexExact : regex;\n}\n","import vm from 'node:vm';\n\nconst script = new vm.Script('returnValue = functionToRun()');\n\n// TODO: Document the `context` option and add to types when I know it's something I want to keep.\n\n// If you use the `context` option, you do it at your own risk.\nexport default function functionTimeout(function_, {timeout, context = vm.createContext()} = {}) {\n\tconst wrappedFunction = (...arguments_) => {\n\t\tcontext.functionToRun = () => function_(...arguments_);\n\t\tscript.runInNewContext(context, {timeout});\n\t\treturn context.returnValue;\n\t};\n\n\tObject.defineProperty(wrappedFunction, 'name', {\n\t\tvalue: `functionTimeout(${function_.name || '<anonymous>'})`,\n\t\tconfigurable: true,\n\t});\n\n\treturn wrappedFunction;\n}\n\nexport function isTimeoutError(error) {\n\treturn error?.code === 'ERR_SCRIPT_EXECUTION_TIMEOUT';\n}\n","import functionTimeout, {isTimeoutError} from 'function-timeout';\nimport timeSpan from 'time-span';\n\nconst resultToMatch = result => ({\n\tmatch: result[0],\n\tindex: result.index,\n\tgroups: result.slice(1),\n\tnamedGroups: result.groups ?? {},\n\tinput: result.input,\n});\n\nconst context = {};\n\nexport function isMatch(regex, string, {timeout} = {}) {\n\ttry {\n\t\treturn functionTimeout(() => structuredClone(regex).test(string), {timeout, context})();\n\t} catch (error) {\n\t\tif (isTimeoutError(error)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\nexport function firstMatch(regex, string, {timeout} = {}) {\n\ttry {\n\t\tconst result = functionTimeout(() => structuredClone(regex).exec(string), {timeout, context})();\n\n\t\tif (result === null) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn resultToMatch(result);\n\t} catch (error) {\n\t\tif (isTimeoutError(error)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\nexport function matches(regex, string, {timeout = Number.POSITIVE_INFINITY, matchTimeout = Number.POSITIVE_INFINITY} = {}) {\n\tif (!regex.global) {\n\t\tthrow new Error('The regex must have the global flag, otherwise, use `firstMatch()` instead');\n\t}\n\n\treturn {\n\t\t* [Symbol.iterator]() {\n\t\t\ttry {\n\t\t\t\tconst matches = string.matchAll(regex); // The regex is only executed when iterated over.\n\n\t\t\t\twhile (true) {\n\t\t\t\t\t// `matches.next` must be called within an arrow function so that it doesn't loose its context.\n\t\t\t\t\tconst nextMatch = functionTimeout(() => matches.next(), {\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\ttimeout: (timeout !== Number.POSITIVE_INFINITY || matchTimeout !== Number.POSITIVE_INFINITY) ? Math.min(timeout, matchTimeout) : undefined,\n\t\t\t\t\t});\n\n\t\t\t\t\tconst end = timeSpan();\n\t\t\t\t\tconst {value, done} = nextMatch();\n\t\t\t\t\ttimeout -= Math.ceil(end());\n\n\t\t\t\t\tif (done) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tyield resultToMatch(value);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (!isTimeoutError(error)) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t};\n}\n","import identifierRegex from 'identifier-regex';\nimport {isMatch} from 'super-regex';\n\nconst regex = identifierRegex();\n\nexport default function isIdentifier(value) {\n\tif (typeof value !== 'string') {\n\t\tthrow new TypeError(`Expected a string, got \\`${typeof value}\\`.`);\n\t}\n\n\t// Prevent abuse.\n\tif (value.length > 100_000) {\n\t\treturn false;\n\t}\n\n\treturn isMatch(regex, value, {timeout: 1000});\n}\n","import isRegexp from 'is-regexp';\nimport isObject from 'is-obj';\nimport getOwnEnumerableKeys from 'get-own-enumerable-keys';\nimport isIdentifier from 'is-identifier';\n\nconst CHARACTER_ESCAPES = {\n\t'\\n': String.raw`\\n`,\n\t'\\r': String.raw`\\r`,\n\t'\\t': String.raw`\\t`,\n\t'\\b': String.raw`\\b`,\n\t'\\f': String.raw`\\f`,\n\t'\\v': String.raw`\\v`,\n\t'\\0': String.raw`\\0`,\n};\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.replaceAll(tokens.newline, '')\n\t\t\t\t.replaceAll(tokens.newlineOrSpace, ' ')\n\t\t\t\t.replaceAll(tokens.pad, '')\n\t\t\t\t.replaceAll(tokens.indent, '');\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.replaceAll(tokens.newline, '\\n')\n\t\t\t\t.replaceAll(tokens.newlineOrSpace, '\\n')\n\t\t\t\t.replaceAll(tokens.pad, pad)\n\t\t\t\t.replaceAll(tokens.indent, pad + indent);\n\t\t};\n\n\t\tif (seen.includes(input)) {\n\t\t\treturn '\"[Circular]\"';\n\t\t}\n\n\t\tconst type = typeof input;\n\n\t\tif (\n\t\t\tinput === null\n\t\t\t|| input === undefined\n\t\t\t|| type === 'number'\n\t\t\t|| type === 'boolean'\n\t\t\t|| type === 'function'\n\t\t\t|| isRegexp(input)\n\t\t) {\n\t\t\treturn String(input);\n\t\t}\n\n\t\tif (type === 'bigint') {\n\t\t\treturn String(input) + 'n';\n\t\t}\n\n\t\tif (type === 'symbol') {\n\t\t\tconst {description} = input;\n\n\t\t\tif (description === undefined) {\n\t\t\t\treturn 'Symbol()';\n\t\t\t}\n\n\t\t\t// Check for well-known symbols first\n\t\t\tif (description?.startsWith('Symbol.') && Symbol[description.slice(7)] === input) {\n\t\t\t\treturn description;\n\t\t\t}\n\n\t\t\t// Check if it's a global registry symbol\n\t\t\tconst globalKey = Symbol.keyFor(input);\n\t\t\tif (globalKey !== undefined) {\n\t\t\t\treturn `Symbol.for(${stringify(globalKey, options)})`;\n\t\t\t}\n\n\t\t\treturn `Symbol(${stringify(description, options)})`;\n\t\t}\n\n\t\tif (input instanceof Date) {\n\t\t\treturn Number.isNaN(input.getTime())\n\t\t\t\t? 'new Date(\\'Invalid Date\\')'\n\t\t\t\t: `new Date('${input.toISOString()}')`;\n\t\t}\n\n\t\tif (input instanceof Map || input instanceof Set) {\n\t\t\tconst isMap = input instanceof Map;\n\t\t\tconst name = isMap ? 'Map' : 'Set';\n\n\t\t\tif (input.size === 0) {\n\t\t\t\treturn `new ${name}()`;\n\t\t\t}\n\n\t\t\tseen.push(input);\n\n\t\t\tconst items = [...input].map(item => {\n\t\t\t\tif (isMap) {\n\t\t\t\t\tconst [key, value] = item;\n\t\t\t\t\treturn tokens.indent + `[${stringify(key, options, pad + indent)}, ${stringify(value, options, pad + indent)}]`;\n\t\t\t\t}\n\n\t\t\t\treturn tokens.indent + stringify(item, options, pad + indent);\n\t\t\t}).join(',' + tokens.newlineOrSpace);\n\n\t\t\tseen.pop();\n\n\t\t\treturn expandWhiteSpace(`new ${name}([${tokens.newline}${items}${tokens.newline}${tokens.pad}])`);\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 items = input.map((element, index) => {\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, index, value);\n\t\t\t\t}\n\n\t\t\t\treturn tokens.indent + value;\n\t\t\t}).join(',' + tokens.newlineOrSpace);\n\n\t\t\tseen.pop();\n\n\t\t\treturn expandWhiteSpace(`[${tokens.newline}${items}${tokens.newline}${tokens.pad}]`);\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 pairs = objectKeys.map(element => {\n\t\t\t\tconst isSymbol = typeof element === 'symbol';\n\n\t\t\t\tlet key;\n\t\t\t\tif (isSymbol) {\n\t\t\t\t\tkey = `[${stringify(element, options)}]`;\n\t\t\t\t} else if (isIdentifier(element)) {\n\t\t\t\t\tkey = element;\n\t\t\t\t} else {\n\t\t\t\t\tkey = stringify(element, options);\n\t\t\t\t}\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 + key + ': ' + value;\n\t\t\t}).join(',' + tokens.newlineOrSpace);\n\n\t\t\tseen.pop();\n\n\t\t\treturn expandWhiteSpace(`{${tokens.newline}${pairs}${tokens.newline}${tokens.pad}}`);\n\t\t}\n\n\t\t// String escaping\n\t\tconst stringified = String(input)\n\t\t\t.replaceAll('\\\\', '\\\\\\\\')\n\t\t\t// eslint-disable-next-line no-control-regex\n\t\t\t.replaceAll(/[\\u0000-\\u001F\\u007F]/g, x =>\n\t\t\t\tCHARACTER_ESCAPES[x] ?? `\\\\u${x.codePointAt(0).toString(16).padStart(4, '0')}`);\n\n\t\tif (options.singleQuotes === false) {\n\t\t\treturn `\"${stringified.replaceAll('\"', String.raw`\\\"`)}\"`;\n\t\t}\n\n\t\treturn `'${stringified.replaceAll('\\'', String.raw`\\'`)}'`;\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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AAI,IAAI,MAAM;AAAA,YAC3B,OAAO;AACL,mBAAK,MAAM,IAAI,IAAI,MAAM;AAAA,YAC3B;AAAA,UACF,CAAC;AAAA,QACH;AACA;AAAA,MAEF;AACE,YAAI,SAAS,MAAM;AACjB,iBAAO,SAAS;AAAA,QAClB;AAAA,IACJ;AAEA,UAAM,OAAO,CAAC;AAEd,UAAM,WAAW,UAAU,eAAe,EAAE,WAAW,KAAK,CAAC;AAI7D,UAAM,uBAAuB,OAAO,SAAS,eAAe,OAAO,KAAK,QAAQ,EAAE,SAAS,IAAI,KAAK;AACpG,QAAI,OAAO,SAAS,aAAa;AAC/B,WAAK,KAAK,UAAU,MAAM,EAAE,qBAAqB,CAAC,CAAC;AAAA,IACrD;AAEA,QAAI,OAAO,KAAK,QAAQ,EAAE,SAAS,GAAG;AACpC,WAAK,KAAK,UAAU,UAAU,EAAE,qBAAqB,CAAC,CAAC;AAAA,IACzD;AAEA,QAAI,SAAS,QAAQ;AACnB,WAAK,SAAS,KAAK,IAAI,CAAC;AAAA,IAC1B;AAEA,QAAI,WAAW,QAAQ;AACrB,WAAK,WAAW,KAAK,IAAI,CAAC;AAAA,IAC5B;AAEA,SAAK,GAAG,WAAW,IAAI,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,GAAG;AACrD,SAAK,0CAA0C,CAAC;AAChD,SAAK,sCAAsC,CAAC;AAE5C,WAAO,KAAK;AAAA,EACd;AACF;AAEA,IAAM,SAAmC;AAAA,EACvC,QAAQ;AAAA,EACR;AACF;AAEA,IAAO,gBAAQ;","names":["preserveConsecutiveUppercase","context","regex","regex","stringify","input","options","pad"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "httpsnippet-client-api",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.17",
|
|
4
4
|
"description": "An HTTPSnippet client for generating snippets for the `api` module.",
|
|
5
|
-
"
|
|
5
|
+
"bugs": {
|
|
6
|
+
"url": "https://github.com/readmeio/api/issues"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"author": "Jon Ursenbach <jon@readme.io>",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/readmeio/api.git",
|
|
13
|
+
"directory": "packages/httpsnippet-client-api"
|
|
14
|
+
},
|
|
6
15
|
"type": "module",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"main": "dist/index.cjs",
|
|
18
|
+
"module": "dist/index.js",
|
|
19
|
+
"types": "dist/index.d.cts",
|
|
7
20
|
"exports": {
|
|
8
21
|
".": {
|
|
9
22
|
"require": "./dist/index.cjs",
|
|
@@ -11,9 +24,6 @@
|
|
|
11
24
|
},
|
|
12
25
|
"./package.json": "./package.json"
|
|
13
26
|
},
|
|
14
|
-
"main": "dist/index.cjs",
|
|
15
|
-
"module": "dist/index.js",
|
|
16
|
-
"types": "dist/index.d.cts",
|
|
17
27
|
"scripts": {
|
|
18
28
|
"attw": "attw --pack --format ascii --profile node16",
|
|
19
29
|
"build": "tsup",
|
|
@@ -22,38 +32,27 @@
|
|
|
22
32
|
"prepack": "npm run build",
|
|
23
33
|
"test": "echo 'Please run tests from the root!' && exit 1"
|
|
24
34
|
},
|
|
25
|
-
"repository": {
|
|
26
|
-
"type": "git",
|
|
27
|
-
"url": "https://github.com/readmeio/api.git",
|
|
28
|
-
"directory": "packages/httpsnippet-client-api"
|
|
29
|
-
},
|
|
30
|
-
"bugs": {
|
|
31
|
-
"url": "https://github.com/readmeio/api/issues"
|
|
32
|
-
},
|
|
33
|
-
"author": "Jon Ursenbach <jon@readme.io>",
|
|
34
|
-
"license": "MIT",
|
|
35
|
-
"engines": {
|
|
36
|
-
"node": ">=20.10.0"
|
|
37
|
-
},
|
|
38
35
|
"dependencies": {
|
|
39
36
|
"content-type": "^1.0.5",
|
|
40
|
-
"oas": "^
|
|
37
|
+
"oas": "^37.0.0",
|
|
41
38
|
"reserved2": "^0.1.5"
|
|
42
39
|
},
|
|
43
|
-
"peerDependencies": {
|
|
44
|
-
"@readme/httpsnippet": "^11.0.0"
|
|
45
|
-
},
|
|
46
40
|
"devDependencies": {
|
|
47
|
-
"@readme/oas-examples": "^
|
|
41
|
+
"@readme/oas-examples": "^7.0.0",
|
|
48
42
|
"@types/content-type": "^1.1.8",
|
|
49
43
|
"@types/stringify-object": "^4.0.5",
|
|
50
|
-
"@vitest/coverage-v8": "^
|
|
44
|
+
"@vitest/coverage-v8": "^4.1.6",
|
|
51
45
|
"camelcase": "^8.0.0",
|
|
52
|
-
"jest-expect-openapi": "^
|
|
53
|
-
"stringify-object": "^
|
|
46
|
+
"jest-expect-openapi": "^6.1.0",
|
|
47
|
+
"stringify-object": "^6.0.0",
|
|
48
|
+
"tsup": "^8.5.0",
|
|
54
49
|
"typescript": "^5.8.2",
|
|
55
|
-
"vitest": "^
|
|
50
|
+
"vitest": "^4.1.6"
|
|
56
51
|
},
|
|
57
|
-
"
|
|
58
|
-
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@readme/httpsnippet": "^11.0.0"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=20.10.0"
|
|
57
|
+
}
|
|
59
58
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,12 +4,12 @@ import type { Operation } from 'oas/operation';
|
|
|
4
4
|
import type { HttpMethods, OASDocument } from 'oas/types';
|
|
5
5
|
|
|
6
6
|
import { CodeBuilder } from '@readme/httpsnippet/helpers/code-builder';
|
|
7
|
-
import camelCase from 'camelcase';
|
|
7
|
+
import camelCase from 'camelcase';
|
|
8
8
|
import contentType from 'content-type';
|
|
9
9
|
import Oas from 'oas';
|
|
10
10
|
import { matchesMimeType } from 'oas/utils';
|
|
11
11
|
import { isReservedOrBuiltinsLC } from 'reserved2';
|
|
12
|
-
import stringifyObject from 'stringify-object';
|
|
12
|
+
import stringifyObject from 'stringify-object';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @note This regex also exists in `api/fetcher`.
|
|
@@ -22,17 +22,16 @@ const registryUUIDRegex = /^@(?<project>[a-zA-Z0-9-_]+)(\/?(?<version>.+))?#(?<u
|
|
|
22
22
|
/**
|
|
23
23
|
* @note This function also exists in `api/fetcher`.
|
|
24
24
|
*/
|
|
25
|
-
function getProjectPrefixFromRegistryUUID(uri: string) {
|
|
25
|
+
function getProjectPrefixFromRegistryUUID(uri: string): string | undefined {
|
|
26
26
|
const matches = uri.match(registryUUIDRegex);
|
|
27
27
|
if (!matches) {
|
|
28
|
-
return
|
|
28
|
+
return;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
return matches.groups?.project;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
function stringify(obj: any, opts = {}) {
|
|
34
|
+
function stringify(obj: unknown, opts = {}) {
|
|
36
35
|
return stringifyObject(obj, { indent: ' ', ...opts });
|
|
37
36
|
}
|
|
38
37
|
|
|
@@ -304,7 +303,6 @@ const client: Client<APIOptions> = {
|
|
|
304
303
|
}
|
|
305
304
|
}
|
|
306
305
|
|
|
307
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
308
306
|
let body: any;
|
|
309
307
|
switch (postData.mimeType) {
|
|
310
308
|
case 'application/x-www-form-urlencoded':
|
package/tsup.config.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
/* eslint-disable import/no-extraneous-dependencies, node/no-extraneous-import */
|
|
2
1
|
import type { Options } from 'tsup';
|
|
3
2
|
|
|
4
3
|
import { defineConfig } from 'tsup';
|
|
5
4
|
|
|
6
|
-
// eslint-disable-next-line import/no-relative-packages
|
|
7
5
|
import config from '../../tsup.config.js';
|
|
8
6
|
|
|
9
7
|
export default defineConfig((options: Options) => ({
|