@scalar/postman-to-openapi 0.1.26 → 0.1.28
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/CHANGELOG.md +21 -0
- package/dist/convert.d.ts.map +1 -1
- package/dist/convert.js +4 -10
- package/dist/helpers/externalDocsHelper.d.ts.map +1 -1
- package/dist/helpers/formDataHelpers.d.ts.map +1 -1
- package/dist/helpers/formDataHelpers.js +1 -3
- package/dist/helpers/itemHelpers.d.ts.map +1 -1
- package/dist/helpers/itemHelpers.js +3 -9
- package/dist/helpers/licenseContactHelper.d.ts.map +1 -1
- package/dist/helpers/licenseContactHelper.js +4 -8
- package/dist/helpers/logoHelper.d.ts.map +1 -1
- package/dist/helpers/logoHelper.js +1 -2
- package/dist/helpers/md-utils.d.ts.map +1 -1
- package/dist/helpers/md-utils.js +1 -8
- package/dist/helpers/parameterHelpers.d.ts.map +1 -1
- package/dist/helpers/parameterHelpers.js +2 -5
- package/dist/helpers/requestBodyHelpers.d.ts.map +1 -1
- package/dist/helpers/requestBodyHelpers.js +1 -1
- package/dist/helpers/responseHelpers.d.ts.map +1 -1
- package/dist/helpers/responseHelpers.js +1 -1
- package/dist/helpers/schemaHelpers.d.ts.map +1 -1
- package/dist/helpers/schemaHelpers.js +6 -8
- package/dist/helpers/serverHelpers.d.ts.map +1 -1
- package/dist/helpers/serverHelpers.js +1 -1
- package/dist/helpers/statusCodeHelpers.d.ts.map +1 -1
- package/dist/helpers/statusCodeHelpers.js +2 -4
- package/dist/helpers/urlHelpers.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @scalar/postman-to-openapi
|
|
2
2
|
|
|
3
|
+
## 0.1.28
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fa6afe8: chore: code formatting
|
|
8
|
+
- 1223c1f: chore: code style
|
|
9
|
+
- Updated dependencies [54fdfcb]
|
|
10
|
+
- @scalar/oas-utils@0.2.105
|
|
11
|
+
- @scalar/openapi-types@0.1.7
|
|
12
|
+
|
|
13
|
+
## 0.1.27
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [f500435]
|
|
18
|
+
- Updated dependencies [da5cf08]
|
|
19
|
+
- Updated dependencies [b5727ef]
|
|
20
|
+
- Updated dependencies [4de3124]
|
|
21
|
+
- Updated dependencies [34e6f52]
|
|
22
|
+
- @scalar/oas-utils@0.2.104
|
|
23
|
+
|
|
3
24
|
## 0.1.26
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/dist/convert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AASxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AASxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AA2BhD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,MAAM,GAAG,WAAW,CAAC,QAAQ,CAsK3F"}
|
package/dist/convert.js
CHANGED
|
@@ -12,9 +12,7 @@ function extractTags(items) {
|
|
|
12
12
|
const tags = [];
|
|
13
13
|
function processTagItem(item, parentPath = '') {
|
|
14
14
|
if (item.item) {
|
|
15
|
-
const currentPath = parentPath
|
|
16
|
-
? `${parentPath} > ${item.name}`
|
|
17
|
-
: item.name;
|
|
15
|
+
const currentPath = parentPath ? `${parentPath} > ${item.name}` : item.name;
|
|
18
16
|
// Add tag for the current folder
|
|
19
17
|
tags.push({
|
|
20
18
|
name: currentPath,
|
|
@@ -34,14 +32,11 @@ function extractTags(items) {
|
|
|
34
32
|
*/
|
|
35
33
|
export function convert(postmanCollection) {
|
|
36
34
|
// Parse string input if provided
|
|
37
|
-
const collection = typeof postmanCollection === 'string'
|
|
38
|
-
? JSON.parse(postmanCollection)
|
|
39
|
-
: postmanCollection;
|
|
35
|
+
const collection = typeof postmanCollection === 'string' ? JSON.parse(postmanCollection) : postmanCollection;
|
|
40
36
|
// Extract title from collection info, fallback to 'API' if not provided
|
|
41
37
|
const title = collection.info.name || 'API';
|
|
42
38
|
// Look for version in collection variables, default to '1.0.0'
|
|
43
|
-
const version = collection.variable?.find((v) => v.key === 'version')?.value ||
|
|
44
|
-
'1.0.0';
|
|
39
|
+
const version = collection.variable?.find((v) => v.key === 'version')?.value || '1.0.0';
|
|
45
40
|
// Handle different description formats in Postman
|
|
46
41
|
const description = typeof collection.info.description === 'string'
|
|
47
42
|
? collection.info.description
|
|
@@ -160,8 +155,7 @@ export function convert(postmanCollection) {
|
|
|
160
155
|
}
|
|
161
156
|
else if ('text/plain' in content) {
|
|
162
157
|
// Preserve schema if it exists, otherwise keep an empty object
|
|
163
|
-
if (!content['text/plain'].schema ||
|
|
164
|
-
Object.keys(content['text/plain'].schema).length === 0) {
|
|
158
|
+
if (!content['text/plain'].schema || Object.keys(content['text/plain'].schema).length === 0) {
|
|
165
159
|
content['text/plain'] = {};
|
|
166
160
|
}
|
|
167
161
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"externalDocsHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/externalDocsHelper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAY,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"externalDocsHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/externalDocsHelper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAY,MAAM,UAAU,CAAA;AAe3D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,iBAAiB,GAC5B,WAAW,CAAC,2BAA2B,GAAG,SAAS,CAwBrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formDataHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/formDataHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAE7C;;;GAGG;AACH,wBAAgB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"formDataHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/formDataHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAE7C;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,WAAW,CAAC,YAAY,CA0CzF"}
|
|
@@ -16,9 +16,7 @@ export function processFormDataSchema(formdata) {
|
|
|
16
16
|
};
|
|
17
17
|
// Add description if present, handling both string and object descriptions
|
|
18
18
|
if (item.description) {
|
|
19
|
-
const descriptionText = typeof item.description === 'string'
|
|
20
|
-
? item.description
|
|
21
|
-
: item.description.content || '';
|
|
19
|
+
const descriptionText = typeof item.description === 'string' ? item.description : item.description.content || '';
|
|
22
20
|
property.description = descriptionText.replace(' [required]', '');
|
|
23
21
|
// If [required] was present, add to required array
|
|
24
22
|
if (descriptionText.includes('[required]')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itemHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/itemHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"itemHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/itemHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAU/C;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,IAAI,GAAG,SAAS,EACtB,UAAU,GAAE,MAAM,EAAO,EACzB,UAAU,GAAE,MAAW,GACtB;IACD,KAAK,EAAE,WAAW,CAAC,WAAW,CAAA;IAC9B,UAAU,EAAE,WAAW,CAAC,gBAAgB,CAAA;CACzC,CAmIA"}
|
|
@@ -3,7 +3,7 @@ import { parseMdTable } from './md-utils.js';
|
|
|
3
3
|
import { extractParameters } from './parameterHelpers.js';
|
|
4
4
|
import { extractRequestBody } from './requestBodyHelpers.js';
|
|
5
5
|
import { extractResponses } from './responseHelpers.js';
|
|
6
|
-
import { extractPathFromUrl, extractPathParameterNames, normalizePath
|
|
6
|
+
import { extractPathFromUrl, extractPathParameterNames, normalizePath } from './urlHelpers.js';
|
|
7
7
|
/**
|
|
8
8
|
* Processes a Postman collection item or item group and returns
|
|
9
9
|
* the corresponding OpenAPI paths and components.
|
|
@@ -44,11 +44,7 @@ export function processItem(item, parentTags = [], parentPath = '') {
|
|
|
44
44
|
}
|
|
45
45
|
const { request, name, response } = item;
|
|
46
46
|
const method = (typeof request === 'string' ? 'get' : request.method || 'get').toLowerCase();
|
|
47
|
-
const path = extractPathFromUrl(typeof request === 'string'
|
|
48
|
-
? request
|
|
49
|
-
: typeof request.url === 'string'
|
|
50
|
-
? request.url
|
|
51
|
-
: (request.url?.raw ?? ''));
|
|
47
|
+
const path = extractPathFromUrl(typeof request === 'string' ? request : typeof request.url === 'string' ? request.url : (request.url?.raw ?? ''));
|
|
52
48
|
// Normalize path parameters from ':param' to '{param}'
|
|
53
49
|
const normalizedPath = normalizePath(path);
|
|
54
50
|
// Extract path parameter names
|
|
@@ -113,9 +109,7 @@ export function processItem(item, parentTags = [], parentPath = '') {
|
|
|
113
109
|
};
|
|
114
110
|
operationObject.security.push(...security);
|
|
115
111
|
}
|
|
116
|
-
if (['post', 'put', 'patch'].includes(method) &&
|
|
117
|
-
typeof request !== 'string' &&
|
|
118
|
-
request.body) {
|
|
112
|
+
if (['post', 'put', 'patch'].includes(method) && typeof request !== 'string' && request.body) {
|
|
119
113
|
operationObject.requestBody = extractRequestBody(request.body);
|
|
120
114
|
}
|
|
121
115
|
if (!paths[path])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"licenseContactHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/licenseContactHelper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAY,MAAM,UAAU,CAAA;AAe3D,KAAK,UAAU,GAAG;IAChB,OAAO,CAAC,EAAE,WAAW,CAAC,aAAa,CAAA;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC,aAAa,CAAA;CACpC,CAAA;
|
|
1
|
+
{"version":3,"file":"licenseContactHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/licenseContactHelper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAY,MAAM,UAAU,CAAA;AAe3D,KAAK,UAAU,GAAG;IAChB,OAAO,CAAC,EAAE,WAAW,CAAC,aAAa,CAAA;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC,aAAa,CAAA;CACpC,CAAA;AAwCD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,iBAAiB,GAAG,UAAU,CAmBlF"}
|
|
@@ -26,8 +26,7 @@ function processLicense(collection) {
|
|
|
26
26
|
const urlVar = findVariable(collection, VARIABLE_KEYS.LICENSE.URL);
|
|
27
27
|
return {
|
|
28
28
|
name: nameVar.value,
|
|
29
|
-
...(urlVar?.value &&
|
|
30
|
-
typeof urlVar.value === 'string' && { url: urlVar.value }),
|
|
29
|
+
...(urlVar?.value && typeof urlVar.value === 'string' && { url: urlVar.value }),
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
@@ -40,12 +39,9 @@ function processContact(collection) {
|
|
|
40
39
|
if (!nameVar?.value && !urlVar?.value && !emailVar?.value)
|
|
41
40
|
return undefined;
|
|
42
41
|
return {
|
|
43
|
-
...(nameVar?.value &&
|
|
44
|
-
|
|
45
|
-
...(
|
|
46
|
-
typeof urlVar.value === 'string' && { url: urlVar.value }),
|
|
47
|
-
...(emailVar?.value &&
|
|
48
|
-
typeof emailVar.value === 'string' && { email: emailVar.value }),
|
|
42
|
+
...(nameVar?.value && typeof nameVar.value === 'string' && { name: nameVar.value }),
|
|
43
|
+
...(urlVar?.value && typeof urlVar.value === 'string' && { url: urlVar.value }),
|
|
44
|
+
...(emailVar?.value && typeof emailVar.value === 'string' && { email: emailVar.value }),
|
|
49
45
|
};
|
|
50
46
|
}
|
|
51
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logoHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/logoHelper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAEjD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,iBAAiB,EAAE,iBAAiB;;;;;
|
|
1
|
+
{"version":3,"file":"logoHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/logoHelper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAEjD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,iBAAiB,EAAE,iBAAiB;;;;;SAkB/D"}
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* and constructs an object with logo properties.
|
|
5
5
|
*/
|
|
6
6
|
export function processLogo(postmanCollection) {
|
|
7
|
-
const logoVariables = postmanCollection.variable?.filter((v) => v.key?.startsWith('x-logo.')) ||
|
|
8
|
-
[];
|
|
7
|
+
const logoVariables = postmanCollection.variable?.filter((v) => v.key?.startsWith('x-logo.')) || [];
|
|
9
8
|
if (logoVariables.length === 0)
|
|
10
9
|
return null;
|
|
11
10
|
const logo = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"md-utils.d.ts","sourceRoot":"","sources":["../../src/helpers/md-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"md-utils.d.ts","sourceRoot":"","sources":["../../src/helpers/md-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,UAAU,CAAA;AAItD;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,CAiCpD"}
|
package/dist/helpers/md-utils.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
const supHeaders = [
|
|
2
|
-
'object',
|
|
3
|
-
'name',
|
|
4
|
-
'description',
|
|
5
|
-
'example',
|
|
6
|
-
'type',
|
|
7
|
-
'required',
|
|
8
|
-
];
|
|
1
|
+
const supHeaders = ['object', 'name', 'description', 'example', 'type', 'required'];
|
|
9
2
|
/**
|
|
10
3
|
* Parses a Markdown table and returns an object representation.
|
|
11
4
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameterHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/parameterHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,UAAU,CAAA;AAG/C;;;GAGG;AACH,wBAAgB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"parameterHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/parameterHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,UAAU,CAAA;AAG/C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAAC,eAAe,EAAE,CA2DjF;AAoBD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC,eAAe,CAgCnH"}
|
|
@@ -86,15 +86,12 @@ export function createParameterObject(param, paramIn) {
|
|
|
86
86
|
}
|
|
87
87
|
else if (paramIn === 'query') {
|
|
88
88
|
// Check if the parameter is required based on description or name
|
|
89
|
-
const isRequired = param.description?.toLowerCase().includes('[required]') ||
|
|
90
|
-
(param.key && param.key.toLowerCase() === 'required');
|
|
89
|
+
const isRequired = param.description?.toLowerCase().includes('[required]') || (param.key && param.key.toLowerCase() === 'required');
|
|
91
90
|
if (isRequired) {
|
|
92
91
|
parameter.required = true;
|
|
93
92
|
// Remove '[required]' from the description
|
|
94
93
|
if (parameter.description) {
|
|
95
|
-
parameter.description = parameter.description
|
|
96
|
-
.replace(/\[required\]/gi, '')
|
|
97
|
-
.trim();
|
|
94
|
+
parameter.description = parameter.description.replace(/\[required\]/gi, '').trim();
|
|
98
95
|
}
|
|
99
96
|
}
|
|
100
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestBodyHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/requestBodyHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAiB,WAAW,EAAuB,MAAM,UAAU,CAAA;AAI/E;;;GAGG;AACH,wBAAgB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"requestBodyHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/requestBodyHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAiB,WAAW,EAAuB,MAAM,UAAU,CAAA;AAI/E;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAAC,iBAAiB,CAqBnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responseHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/responseHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAc,IAAI,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAI1D;;;;GAIG;AACH,wBAAgB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"responseHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/responseHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAc,IAAI,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAI1D;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC,eAAe,CA8ChG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/schemaHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,GAAG,GAAG,WAAW,CAAC,YAAY,CAoB7E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,WAAW,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"schemaHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/schemaHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,GAAG,GAAG,WAAW,CAAC,YAAY,CAoB7E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,WAAW,CAAC,YAAY,CAiBpE"}
|
|
@@ -10,7 +10,7 @@ export function inferSchemaFromExample(example) {
|
|
|
10
10
|
items: example.length > 0 ? inferSchemaFromExample(example[0]) : {},
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
if (typeof example === 'object' && example !== null) {
|
|
14
14
|
const properties = {};
|
|
15
15
|
for (const [key, value] of Object.entries(example)) {
|
|
16
16
|
properties[key] = inferSchemaFromExample(value);
|
|
@@ -20,11 +20,9 @@ export function inferSchemaFromExample(example) {
|
|
|
20
20
|
properties,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
}
|
|
23
|
+
return {
|
|
24
|
+
type: typeof example,
|
|
25
|
+
};
|
|
28
26
|
}
|
|
29
27
|
/**
|
|
30
28
|
* Infers the schema type of a value based on its type.
|
|
@@ -36,10 +34,10 @@ export function inferSchemaType(value) {
|
|
|
36
34
|
if (typeof value === 'number') {
|
|
37
35
|
return { type: Number.isInteger(value) ? 'integer' : 'number' };
|
|
38
36
|
}
|
|
39
|
-
|
|
37
|
+
if (typeof value === 'boolean') {
|
|
40
38
|
return { type: 'boolean' };
|
|
41
39
|
}
|
|
42
|
-
|
|
40
|
+
if (typeof value === 'string') {
|
|
43
41
|
const num = Number(value);
|
|
44
42
|
if (!isNaN(num)) {
|
|
45
43
|
return { type: Number.isInteger(num) ? 'integer' : 'number' };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/serverHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"serverHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/serverHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAkClE;;GAEG;AACH,wBAAgB,YAAY,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,WAAW,CAAC,YAAY,EAAE,CAU7F"}
|
|
@@ -14,7 +14,7 @@ function processItems(items, domains) {
|
|
|
14
14
|
try {
|
|
15
15
|
// Extract domain from URL
|
|
16
16
|
const urlMatch = url.match(/^(?:https?:\/\/)?([^/?#]+)/i);
|
|
17
|
-
if (urlMatch
|
|
17
|
+
if (urlMatch?.[1]) {
|
|
18
18
|
// Ensure we have the protocol
|
|
19
19
|
const serverUrl = urlMatch[1].startsWith('http')
|
|
20
20
|
? urlMatch[1].replace(/\/$/, '')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusCodeHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/statusCodeHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEpC;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"statusCodeHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/statusCodeHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEpC;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,CAmBhE"}
|
|
@@ -10,9 +10,7 @@ export function extractStatusCodesFromTests(item) {
|
|
|
10
10
|
if (item.event?.length) {
|
|
11
11
|
item.event.forEach((event) => {
|
|
12
12
|
if (event.listen === 'test' && event.script?.exec) {
|
|
13
|
-
const scriptLines = Array.isArray(event.script.exec)
|
|
14
|
-
? event.script.exec
|
|
15
|
-
: [event.script.exec];
|
|
13
|
+
const scriptLines = Array.isArray(event.script.exec) ? event.script.exec : [event.script.exec];
|
|
16
14
|
scriptLines.forEach((line) => {
|
|
17
15
|
const statusCode = parseStatusCodeFromLine(line);
|
|
18
16
|
if (statusCode) {
|
|
@@ -40,7 +38,7 @@ function parseStatusCodeFromLine(line) {
|
|
|
40
38
|
for (const pattern of patterns) {
|
|
41
39
|
const match = pattern.exec(line)?.at(1);
|
|
42
40
|
if (match) {
|
|
43
|
-
return parseInt(match, 10);
|
|
41
|
+
return Number.parseInt(match, 10);
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/urlHelpers.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"urlHelpers.d.ts","sourceRoot":"","sources":["../../src/helpers/urlHelpers.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAUlE;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,SAAU,MAAM,KAAG,MAAyC,CAAA;AAEtF;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAahE"}
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"export",
|
|
20
20
|
"scalar"
|
|
21
21
|
],
|
|
22
|
-
"version": "0.1.
|
|
22
|
+
"version": "0.1.28",
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=18"
|
|
25
25
|
},
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
],
|
|
39
39
|
"module": "dist/index.js",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@scalar/
|
|
42
|
-
"@scalar/
|
|
41
|
+
"@scalar/oas-utils": "0.2.105",
|
|
42
|
+
"@scalar/openapi-types": "0.1.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"vite": "^5.4.10",
|
|
46
|
-
"@scalar/build-tooling": "0.1.
|
|
46
|
+
"@scalar/build-tooling": "0.1.13"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "scalar-build-rollup",
|
|
50
|
-
"format": "scalar-format
|
|
50
|
+
"format": "scalar-format",
|
|
51
51
|
"lint:check": "eslint .",
|
|
52
52
|
"lint:fix": "eslint . --fix",
|
|
53
53
|
"test": "vitest",
|