@scalar/oas-utils
Advanced tools
Comparing version 0.2.71 to 0.2.72
# @scalar/oas-utils | ||
## 0.2.72 | ||
### Patch Changes | ||
- 4bcaa75: feat: support `format: object-id` in getExampleFromSchema | ||
- 9eb6650: feat: add support for the x-defaultClientId extension | ||
- c98a99c: feat: allow to pass a base URL to makeUrlAbsolute | ||
## 0.2.71 | ||
@@ -4,0 +12,0 @@ |
/** | ||
* Pass an URL or a relative URL and get an absolute URL | ||
*/ | ||
export declare const makeUrlAbsolute: (url?: string) => string | undefined; | ||
export declare const makeUrlAbsolute: (url?: string, baseUrl?: string) => string | undefined; | ||
//# sourceMappingURL=makeUrlAbsolute.d.ts.map |
/** | ||
* Pass an URL or a relative URL and get an absolute URL | ||
*/ | ||
const makeUrlAbsolute = (url) => { | ||
const makeUrlAbsolute = (url, baseUrl) => { | ||
if (!url || | ||
url.startsWith('http://') || | ||
url.startsWith('https://') || | ||
typeof window === 'undefined') | ||
(typeof window === 'undefined' && !baseUrl)) { | ||
return url; | ||
const baseUrl = window.location.href; | ||
} | ||
const base = baseUrl || window.location.href; | ||
// Remove any query parameters or hash from the base URL | ||
const cleanBaseUrl = baseUrl.split('?')[0]?.split('#')[0]; | ||
const cleanBaseUrl = base.split('?')[0]?.split('#')[0]; | ||
// For base URLs with a path component, we want to remove the last path segment | ||
@@ -14,0 +15,0 @@ // if it doesn't end with a slash |
@@ -32,2 +32,3 @@ /** Hard limit for rendering circular references */ | ||
'uuid': '123e4567-e89b-12d3-a456-426614174000', | ||
'object-id': '6592008029c8c3e4dc76256c', | ||
}; | ||
@@ -34,0 +35,0 @@ /** |
@@ -41,2 +41,6 @@ import { securitySchemeSchema, authExampleFromSchema } from '../entities/spec/security.js'; | ||
} | ||
// Handle x-defaultClientId | ||
if ('x-defaultClientId' in flow && | ||
typeof flow['x-defaultClientId'] === 'string') | ||
payload['x-scalar-client-id'] = flow['x-defaultClientId']; | ||
return payload; | ||
@@ -43,0 +47,0 @@ } |
@@ -19,3 +19,3 @@ { | ||
], | ||
"version": "0.2.71", | ||
"version": "0.2.72", | ||
"engines": { | ||
@@ -111,5 +111,5 @@ "node": ">=18" | ||
"@scalar/object-utils": "1.1.12", | ||
"@scalar/openapi-types": "0.1.5", | ||
"@scalar/themes": "0.9.47", | ||
"@scalar/types": "0.0.19" | ||
"@scalar/types": "0.0.19", | ||
"@scalar/openapi-types": "0.1.5" | ||
}, | ||
@@ -116,0 +116,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
384994
8045