Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@scalar/oas-utils

Package Overview
Dependencies
Maintainers
8
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scalar/oas-utils - npm Package Compare versions

Comparing version 0.2.18 to 0.2.19

6

CHANGELOG.md
# @scalar/oas-utils
## 0.2.19
### Patch Changes
- bf2895e: feat(api-client): add multiple auth to api client
## 0.2.18

@@ -4,0 +10,0 @@

26

dist/entities/workspace/collection/collection.d.ts

@@ -233,16 +233,4 @@ import { z } from 'zod';

}>>>;
/**
* The currently selected security scheme key
* TODO eventually we will need to maintain one per request + collection but this will do for now
*/
selectedSecuritySchemes: z.ZodDefault<z.ZodArray<z.ZodObject<{
uid: z.ZodString;
flowKey: z.ZodOptional<z.ZodEnum<["implicit", "clientCredentials", "password", "authorizationCode"]>>;
}, "strip", z.ZodTypeAny, {
uid: string;
flowKey?: "implicit" | "password" | "clientCredentials" | "authorizationCode" | undefined;
}, {
uid: string;
flowKey?: "implicit" | "password" | "clientCredentials" | "authorizationCode" | undefined;
}>, "many">>;
/** A dictionary which maps the openapi spec name keys to the security-scheme UID's for lookup */
securitySchemeDict: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
/** The currently selected server */

@@ -288,6 +276,3 @@ selectedServerUid: z.ZodDefault<z.ZodString>;

};
selectedSecuritySchemes: {
uid: string;
flowKey?: "implicit" | "password" | "clientCredentials" | "authorizationCode" | undefined;
}[];
securitySchemeDict: Record<string, string>;
selectedServerUid: string;

@@ -331,6 +316,3 @@ childUids: string[];

} | undefined;
selectedSecuritySchemes?: {
uid: string;
flowKey?: "implicit" | "password" | "clientCredentials" | "authorizationCode" | undefined;
}[] | undefined;
securitySchemeDict?: Record<string, string> | undefined;
selectedServerUid?: string | undefined;

@@ -337,0 +319,0 @@ childUids?: string[] | undefined;

@@ -113,20 +113,4 @@ import { z } from 'zod';

spec: specSchema.optional().default({}),
/**
* The currently selected security scheme key
* TODO eventually we will need to maintain one per request + collection but this will do for now
*/
selectedSecuritySchemes: z
.array(z.object({
uid: z.string(),
// Wasn't sure how to extract the keys from another schema so hard coded these for now
flowKey: z
.enum([
'implicit',
'clientCredentials',
'password',
'authorizationCode',
])
.optional(),
}))
.default([]),
/** A dictionary which maps the openapi spec name keys to the security-scheme UID's for lookup */
securitySchemeDict: z.record(z.string(), z.string()).optional().default({}),
/** The currently selected server */

@@ -133,0 +117,0 @@ selectedServerUid: z.string().default(''),

export { securityRequirement } from './security-requirement.js';
export { createSecurityScheme } from './security-schemes.js';
export { createSecurityScheme, securitySchemeApiKeyIn } from './security-schemes.js';

@@ -1,223 +0,235 @@

import type { ValueOf } from 'type-fest';
import { z } from 'zod';
declare const securitySchemeOauth2: z.ZodObject<{
type: z.ZodLiteral<"oauth2">;
export declare const securitySchemeApiKeyIn: readonly ["query", "header", "cookie"];
declare const securitySchemeApiKey: z.ZodObject<z.objectUtil.extendShape<{
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/** The name key that links a security requirement to a security object */
nameKey: z.ZodDefault<z.ZodOptional<z.ZodString>>;
description: z.ZodOptional<z.ZodString>;
}, {
type: z.ZodLiteral<"apiKey">;
/** REQUIRED. The name of the header, query or cookie parameter to be used. */
name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/** REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie". */
in: z.ZodDefault<z.ZodOptional<z.ZodEnum<["query", "header", "cookie"]>>>;
value: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {
type: "apiKey";
value: string;
uid: string;
nameKey: string;
name: string;
in: "query" | "header" | "cookie";
description?: string | undefined;
}, {
type: "apiKey";
value?: string | undefined;
uid?: string | undefined;
nameKey?: string | undefined;
description?: string | undefined;
name?: string | undefined;
in?: "query" | "header" | "cookie" | undefined;
}>;
export type SecuritySchemeApiKey = z.infer<typeof securitySchemeApiKey>;
declare const securitySchemeOauth2: z.ZodObject<z.objectUtil.extendShape<{
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/** The name key that links a security requirement to a security object */
nameKey: z.ZodDefault<z.ZodOptional<z.ZodString>>;
description: z.ZodOptional<z.ZodString>;
}, {
type: z.ZodLiteral<"oauth2">;
/** REQUIRED. An object containing configuration information for the flow types supported. */
flows: z.ZodDefault<z.ZodOptional<z.ZodObject<{
/** Configuration for the OAuth Implicit flow */
implicit: z.ZodOptional<z.ZodObject<{
authorizationUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
refreshUrl: z.ZodOptional<z.ZodString>;
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
authorizationUrl: string;
selectedScopes: string[];
token: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
authorizationUrl?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
}>>;
/** Configuration for the OAuth Resource Owner Password flow */
password: z.ZodOptional<z.ZodObject<{
tokenUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
refreshUrl: z.ZodOptional<z.ZodString>;
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
/** Username */
value: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/** Password */
secondValue: z.ZodDefault<z.ZodOptional<z.ZodString>>;
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
clientSecret: z.ZodDefault<z.ZodOptional<z.ZodString>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
value: string;
secondValue: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
value?: string | undefined;
secondValue?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
}>>;
/** Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0. */
clientCredentials: z.ZodOptional<z.ZodObject<{
tokenUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
refreshUrl: z.ZodOptional<z.ZodString>;
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
clientSecret: z.ZodDefault<z.ZodOptional<z.ZodString>>;
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
}>>;
/** Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.*/
authorizationCode: z.ZodOptional<z.ZodObject<{
authorizationUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
tokenUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
refreshUrl: z.ZodOptional<z.ZodString>;
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
clientSecret: z.ZodDefault<z.ZodOptional<z.ZodString>>;
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
authorizationUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
authorizationUrl?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
implicit?: {
authorizationUrl: string;
selectedScopes: string[];
token: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
password?: {
value: string;
secondValue: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
clientCredentials?: {
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
authorizationCode?: {
authorizationUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
flow: z.ZodDefault<z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.objectUtil.extendShape<{
/**
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a
* URL. The OAuth2 standard requires the use of TLS.
*/
refreshUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/**
* REQUIRED. The available scopes for the OAuth2 security scheme. A map
* between the scope name and a short description for it. The map MAY be empty.
*/
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
/** User selected scopes per flow */
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, {
implicit?: {
authorizationUrl?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
} | undefined;
password?: {
value?: string | undefined;
secondValue?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
clientCredentials?: {
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
authorizationCode?: {
authorizationUrl?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
}>>>;
type: z.ZodLiteral<"implicit">;
authorizationUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
redirectUri: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {
type: "implicit";
refreshUrl: string;
selectedScopes: string[];
token: string;
authorizationUrl: string;
redirectUri: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
type: "implicit";
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
authorizationUrl?: string | undefined;
redirectUri?: string | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
/**
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a
* URL. The OAuth2 standard requires the use of TLS.
*/
refreshUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/**
* REQUIRED. The available scopes for the OAuth2 security scheme. A map
* between the scope name and a short description for it. The map MAY be empty.
*/
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
/** User selected scopes per flow */
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, {
type: z.ZodLiteral<"password">;
tokenUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/** Username */
value: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/** Password */
secondValue: z.ZodDefault<z.ZodOptional<z.ZodString>>;
clientSecret: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {
type: "password";
value: string;
secondValue: string;
refreshUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
type: "password";
value?: string | undefined;
secondValue?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
/**
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a
* URL. The OAuth2 standard requires the use of TLS.
*/
refreshUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/**
* REQUIRED. The available scopes for the OAuth2 security scheme. A map
* between the scope name and a short description for it. The map MAY be empty.
*/
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
/** User selected scopes per flow */
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, {
type: z.ZodLiteral<"clientCredentials">;
tokenUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
clientSecret: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {
type: "clientCredentials";
refreshUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
type: "clientCredentials";
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
/**
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a
* URL. The OAuth2 standard requires the use of TLS.
*/
refreshUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/**
* REQUIRED. The available scopes for the OAuth2 security scheme. A map
* between the scope name and a short description for it. The map MAY be empty.
*/
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
/** User selected scopes per flow */
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, {
type: z.ZodLiteral<"authorizationCode">;
authorizationUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
redirectUri: z.ZodDefault<z.ZodOptional<z.ZodString>>;
tokenUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
clientSecret: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {
type: "authorizationCode";
refreshUrl: string;
selectedScopes: string[];
token: string;
authorizationUrl: string;
redirectUri: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
type: "authorizationCode";
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
authorizationUrl?: string | undefined;
redirectUri?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
}>]>>>;
clientId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
redirectUri: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
}>, "strip", z.ZodTypeAny, {
type: "oauth2";
uid: string;
flows: {
implicit?: {
authorizationUrl: string;
selectedScopes: string[];
token: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
password?: {
value: string;
secondValue: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
clientCredentials?: {
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
authorizationCode?: {
authorizationUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
nameKey: string;
flow: {
type: "implicit";
refreshUrl: string;
selectedScopes: string[];
token: string;
authorizationUrl: string;
redirectUri: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | {
type: "password";
value: string;
secondValue: string;
refreshUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | {
type: "clientCredentials";
refreshUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | {
type: "authorizationCode";
refreshUrl: string;
selectedScopes: string[];
token: string;
authorizationUrl: string;
redirectUri: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
};
clientId: string;
redirectUri: string;
description?: string | undefined;

@@ -227,51 +239,51 @@ }, {

uid?: string | undefined;
nameKey?: string | undefined;
description?: string | undefined;
flows?: {
implicit?: {
authorizationUrl?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
} | undefined;
password?: {
value?: string | undefined;
secondValue?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
clientCredentials?: {
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
authorizationCode?: {
authorizationUrl?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
flow?: {
type: "implicit";
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
authorizationUrl?: string | undefined;
redirectUri?: string | undefined;
} | {
type: "password";
value?: string | undefined;
secondValue?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | {
type: "clientCredentials";
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | {
type: "authorizationCode";
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
authorizationUrl?: string | undefined;
redirectUri?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
clientId?: string | undefined;
redirectUri?: string | undefined;
}>;
export type SecuritySchemeOauth2 = z.infer<typeof securitySchemeOauth2>;
export type SelectedSchemeOauth2 = {
scheme: SecuritySchemeOauth2;
flow: ValueOf<Required<SecuritySchemeOauth2['flows']>>;
};
declare const securityScheme: z.ZodUnion<[z.ZodObject<{
type: z.ZodLiteral<"apiKey">;
declare const securityScheme: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/** The name key that links a security requirement to a security object */
nameKey: z.ZodDefault<z.ZodOptional<z.ZodString>>;
description: z.ZodOptional<z.ZodString>;
}, {
type: z.ZodLiteral<"apiKey">;
/** REQUIRED. The name of the header, query or cookie parameter to be used. */

@@ -282,6 +294,7 @@ name: z.ZodDefault<z.ZodOptional<z.ZodString>>;

value: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
}>, "strip", z.ZodTypeAny, {
type: "apiKey";
value: string;
uid: string;
nameKey: string;
name: string;

@@ -294,9 +307,13 @@ in: "query" | "header" | "cookie";

uid?: string | undefined;
nameKey?: string | undefined;
description?: string | undefined;
name?: string | undefined;
in?: "query" | "header" | "cookie" | undefined;
}>, z.ZodObject<{
type: z.ZodLiteral<"http">;
}>, z.ZodObject<z.objectUtil.extendShape<{
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/** The name key that links a security requirement to a security object */
nameKey: z.ZodDefault<z.ZodOptional<z.ZodString>>;
description: z.ZodOptional<z.ZodString>;
}, {
type: z.ZodLiteral<"http">;
/**

@@ -317,6 +334,7 @@ * REQUIRED. The name of the HTTP Authorization scheme to be used in the Authorization header as defined in

secondValue: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
}>, "strip", z.ZodTypeAny, {
type: "http";
value: string;
uid: string;
nameKey: string;
scheme: "basic" | "bearer";

@@ -330,2 +348,3 @@ bearerFormat: string;

uid?: string | undefined;
nameKey?: string | undefined;
description?: string | undefined;

@@ -335,222 +354,204 @@ scheme?: "basic" | "bearer" | undefined;

secondValue?: string | undefined;
}>, z.ZodObject<{
type: z.ZodLiteral<"oauth2">;
}>, z.ZodObject<z.objectUtil.extendShape<{
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/** The name key that links a security requirement to a security object */
nameKey: z.ZodDefault<z.ZodOptional<z.ZodString>>;
description: z.ZodOptional<z.ZodString>;
}, {
type: z.ZodLiteral<"oauth2">;
/** REQUIRED. An object containing configuration information for the flow types supported. */
flows: z.ZodDefault<z.ZodOptional<z.ZodObject<{
/** Configuration for the OAuth Implicit flow */
implicit: z.ZodOptional<z.ZodObject<{
authorizationUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
refreshUrl: z.ZodOptional<z.ZodString>;
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
authorizationUrl: string;
selectedScopes: string[];
token: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
authorizationUrl?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
}>>;
/** Configuration for the OAuth Resource Owner Password flow */
password: z.ZodOptional<z.ZodObject<{
tokenUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
refreshUrl: z.ZodOptional<z.ZodString>;
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
/** Username */
value: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/** Password */
secondValue: z.ZodDefault<z.ZodOptional<z.ZodString>>;
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
clientSecret: z.ZodDefault<z.ZodOptional<z.ZodString>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
value: string;
secondValue: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
value?: string | undefined;
secondValue?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
}>>;
/** Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0. */
clientCredentials: z.ZodOptional<z.ZodObject<{
tokenUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
refreshUrl: z.ZodOptional<z.ZodString>;
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
clientSecret: z.ZodDefault<z.ZodOptional<z.ZodString>>;
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
}>>;
/** Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.*/
authorizationCode: z.ZodOptional<z.ZodObject<{
authorizationUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
tokenUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
refreshUrl: z.ZodOptional<z.ZodString>;
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
clientSecret: z.ZodDefault<z.ZodOptional<z.ZodString>>;
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
authorizationUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
authorizationUrl?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
implicit?: {
authorizationUrl: string;
selectedScopes: string[];
token: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
password?: {
value: string;
secondValue: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
clientCredentials?: {
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
authorizationCode?: {
authorizationUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
flow: z.ZodDefault<z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.objectUtil.extendShape<{
/**
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a
* URL. The OAuth2 standard requires the use of TLS.
*/
refreshUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/**
* REQUIRED. The available scopes for the OAuth2 security scheme. A map
* between the scope name and a short description for it. The map MAY be empty.
*/
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
/** User selected scopes per flow */
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, {
implicit?: {
authorizationUrl?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
} | undefined;
password?: {
value?: string | undefined;
secondValue?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
clientCredentials?: {
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
authorizationCode?: {
authorizationUrl?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
}>>>;
type: z.ZodLiteral<"implicit">;
authorizationUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
redirectUri: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {
type: "implicit";
refreshUrl: string;
selectedScopes: string[];
token: string;
authorizationUrl: string;
redirectUri: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
type: "implicit";
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
authorizationUrl?: string | undefined;
redirectUri?: string | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
/**
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a
* URL. The OAuth2 standard requires the use of TLS.
*/
refreshUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/**
* REQUIRED. The available scopes for the OAuth2 security scheme. A map
* between the scope name and a short description for it. The map MAY be empty.
*/
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
/** User selected scopes per flow */
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, {
type: z.ZodLiteral<"password">;
tokenUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/** Username */
value: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/** Password */
secondValue: z.ZodDefault<z.ZodOptional<z.ZodString>>;
clientSecret: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {
type: "password";
value: string;
secondValue: string;
refreshUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
type: "password";
value?: string | undefined;
secondValue?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
/**
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a
* URL. The OAuth2 standard requires the use of TLS.
*/
refreshUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/**
* REQUIRED. The available scopes for the OAuth2 security scheme. A map
* between the scope name and a short description for it. The map MAY be empty.
*/
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
/** User selected scopes per flow */
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, {
type: z.ZodLiteral<"clientCredentials">;
tokenUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
clientSecret: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {
type: "clientCredentials";
refreshUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
type: "clientCredentials";
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
/**
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a
* URL. The OAuth2 standard requires the use of TLS.
*/
refreshUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/**
* REQUIRED. The available scopes for the OAuth2 security scheme. A map
* between the scope name and a short description for it. The map MAY be empty.
*/
scopes: z.ZodOptional<z.ZodUnion<[z.ZodMap<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>;
/** User selected scopes per flow */
selectedScopes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
token: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, {
type: z.ZodLiteral<"authorizationCode">;
authorizationUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
redirectUri: z.ZodDefault<z.ZodOptional<z.ZodString>>;
tokenUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
clientSecret: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {
type: "authorizationCode";
refreshUrl: string;
selectedScopes: string[];
token: string;
authorizationUrl: string;
redirectUri: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
}, {
type: "authorizationCode";
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
authorizationUrl?: string | undefined;
redirectUri?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
}>]>>>;
clientId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
redirectUri: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
}>, "strip", z.ZodTypeAny, {
type: "oauth2";
uid: string;
flows: {
implicit?: {
authorizationUrl: string;
selectedScopes: string[];
token: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
password?: {
value: string;
secondValue: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
clientCredentials?: {
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
authorizationCode?: {
authorizationUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
nameKey: string;
flow: {
type: "implicit";
refreshUrl: string;
selectedScopes: string[];
token: string;
authorizationUrl: string;
redirectUri: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | {
type: "password";
value: string;
secondValue: string;
refreshUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | {
type: "clientCredentials";
refreshUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | {
type: "authorizationCode";
refreshUrl: string;
selectedScopes: string[];
token: string;
authorizationUrl: string;
redirectUri: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
};
clientId: string;
redirectUri: string;
description?: string | undefined;

@@ -560,45 +561,49 @@ }, {

uid?: string | undefined;
nameKey?: string | undefined;
description?: string | undefined;
flows?: {
implicit?: {
authorizationUrl?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
} | undefined;
password?: {
value?: string | undefined;
secondValue?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
clientCredentials?: {
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
authorizationCode?: {
authorizationUrl?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
flow?: {
type: "implicit";
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
authorizationUrl?: string | undefined;
redirectUri?: string | undefined;
} | {
type: "password";
value?: string | undefined;
secondValue?: string | undefined;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | {
type: "clientCredentials";
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | {
type: "authorizationCode";
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
selectedScopes?: string[] | undefined;
token?: string | undefined;
authorizationUrl?: string | undefined;
redirectUri?: string | undefined;
tokenUrl?: string | undefined;
clientSecret?: string | undefined;
} | undefined;
clientId?: string | undefined;
redirectUri?: string | undefined;
}>, z.ZodObject<{
type: z.ZodLiteral<"openIdConnect">;
}>, z.ZodObject<z.objectUtil.extendShape<{
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/** The name key that links a security requirement to a security object */
nameKey: z.ZodDefault<z.ZodOptional<z.ZodString>>;
description: z.ZodOptional<z.ZodString>;
}, {
type: z.ZodLiteral<"openIdConnect">;
/**

@@ -609,5 +614,6 @@ * REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the

openIdConnectUrl: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
}>, "strip", z.ZodTypeAny, {
type: "openIdConnect";
uid: string;
nameKey: string;
openIdConnectUrl: string;

@@ -618,2 +624,3 @@ description?: string | undefined;

uid?: string | undefined;
nameKey?: string | undefined;
description?: string | undefined;

@@ -634,2 +641,3 @@ openIdConnectUrl?: string | undefined;

uid: string;
nameKey: string;
name: string;

@@ -642,2 +650,3 @@ in: "query" | "header" | "cookie";

uid: string;
nameKey: string;
scheme: "basic" | "bearer";

@@ -650,40 +659,41 @@ bearerFormat: string;

uid: string;
flows: {
implicit?: {
authorizationUrl: string;
selectedScopes: string[];
token: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
password?: {
value: string;
secondValue: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
clientCredentials?: {
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
authorizationCode?: {
authorizationUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
refreshUrl?: string | undefined;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | undefined;
nameKey: string;
flow: {
type: "implicit";
refreshUrl: string;
selectedScopes: string[];
token: string;
authorizationUrl: string;
redirectUri: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | {
type: "password";
value: string;
secondValue: string;
refreshUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | {
type: "clientCredentials";
refreshUrl: string;
selectedScopes: string[];
token: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
} | {
type: "authorizationCode";
refreshUrl: string;
selectedScopes: string[];
token: string;
authorizationUrl: string;
redirectUri: string;
tokenUrl: string;
clientSecret: string;
scopes?: Map<string, string | undefined> | Record<string, string | undefined> | {} | undefined;
};
clientId: string;
redirectUri: string;
description?: string | undefined;

@@ -693,2 +703,3 @@ } | {

uid: string;
nameKey: string;
openIdConnectUrl: string;

@@ -695,0 +706,0 @@ description?: string | undefined;

import { z } from 'zod';
import { nanoidSchema } from '../shared/utility.js';
import { deepMerge } from '../../../helpers/deepMerge.js';
/** The uid here is actually the name key, called uid to re-use our mutators */
const uid = z.string().optional().default('default');
/* A description for security scheme. CommonMark syntax MAY be used for rich text representation. */
const description = z.string().optional();
/** A generic string value used for filling in fields */
const value = z.string().optional().default('');
const securitySchemeApiKey = z.object({
/** Some common properties used in all security schemes */
const commonProps = z.object({
uid: nanoidSchema,
/** The name key that links a security requirement to a security object */
nameKey: z.string().optional().default(''),
/* A description for security scheme. CommonMark syntax MAY be used for rich text representation. */
description: z.string().optional(),
});
const securitySchemeApiKeyIn = ['query', 'header', 'cookie'];
const securitySchemeApiKey = commonProps.extend({
type: z.literal('apiKey'),
uid,
description,
/** REQUIRED. The name of the header, query or cookie parameter to be used. */
name: z.string().optional().default('default'),
name: z.string().optional().default(''),
/** REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie". */
in: z.enum(['query', 'header', 'cookie']).optional().default('header'),
in: z.enum(securitySchemeApiKeyIn).optional().default('header'),
value,
});
const securitySchemeHttp = z.object({
const securitySchemeHttp = commonProps.extend({
type: z.literal('http'),
uid,
description,
/**

@@ -47,3 +49,3 @@ * REQUIRED. The name of the HTTP Authorization scheme to be used in the Authorization header as defined in

*/
const authorizationUrl = z.string().optional().default('https://scalar.com');
const authorizationUrl = z.string().optional().default('');
/**

@@ -53,89 +55,68 @@ * REQUIRED. The token URL to be used for this flow. This MUST be in the

*/
const tokenUrl = z.string().optional().default('https://scalar.com');
/**
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a
* URL. The OAuth2 standard requires the use of TLS.
*/
const refreshUrl = z.string().optional();
/**
* REQUIRED. The available scopes for the OAuth2 security scheme. A map
* between the scope name and a short description for it. The map MAY be empty.
*/
const scopes = z
.union([
z.map(z.string(), z.string().optional()),
z.record(z.string(), z.string().optional()),
z.object({}),
])
.optional();
/** User selected scopes per flow */
const selectedScopes = z.array(z.string()).optional().default([]);
const tokenUrl = z.string().optional().default('');
/** Common properties used across all oauth2 flows */
const oauthCommon = z.object({
/**
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a
* URL. The OAuth2 standard requires the use of TLS.
*/
refreshUrl: z.string().optional().default(''),
/**
* REQUIRED. The available scopes for the OAuth2 security scheme. A map
* between the scope name and a short description for it. The map MAY be empty.
*/
scopes: z
.union([
z.map(z.string(), z.string().optional()),
z.record(z.string(), z.string().optional()),
z.object({}),
])
.optional(),
/** User selected scopes per flow */
selectedScopes: z.array(z.string()).optional().default([]),
token: value,
});
const oauthFlowSchema = z
.object({
.discriminatedUnion('type', [
/** Configuration for the OAuth Implicit flow */
implicit: z
.object({
oauthCommon.extend({
type: z.literal('implicit'),
authorizationUrl,
refreshUrl,
scopes,
selectedScopes,
token: value,
})
.optional(),
redirectUri: z.string().optional().default(''),
}),
/** Configuration for the OAuth Resource Owner Password flow */
password: z
.object({
oauthCommon.extend({
type: z.literal('password'),
tokenUrl,
refreshUrl,
scopes,
/** Username */
value: value,
value,
/** Password */
secondValue: value,
selectedScopes,
clientSecret: value,
token: value,
})
.optional(),
}),
/** Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0. */
clientCredentials: z
.object({
oauthCommon.extend({
type: z.literal('clientCredentials'),
tokenUrl,
refreshUrl,
scopes,
clientSecret: value,
selectedScopes,
token: value,
})
.optional(),
}),
/** Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.*/
authorizationCode: z
.object({
oauthCommon.extend({
type: z.literal('authorizationCode'),
authorizationUrl,
redirectUri: z.string().optional().default(''),
tokenUrl,
refreshUrl,
scopes,
clientSecret: value,
selectedScopes,
token: value,
})
.optional(),
})
}),
])
.optional()
.default({
implicit: {},
});
const securitySchemeOauth2 = z.object({
.default({ type: 'implicit' });
const securitySchemeOauth2 = commonProps.extend({
type: z.literal('oauth2'),
uid,
description,
/** REQUIRED. An object containing configuration information for the flow types supported. */
flows: oauthFlowSchema,
flow: oauthFlowSchema,
clientId: value,
redirectUri: z.string().optional().default(''),
});
const securitySchemeOpenId = z.object({
const securitySchemeOpenId = commonProps.extend({
type: z.literal('openIdConnect'),
uid,
description,
/**

@@ -154,5 +135,8 @@ * REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the

/** Create Security Scheme with defaults */
const createSecurityScheme = (payload) => deepMerge(securityScheme.parse({ type: payload.type }), payload);
// securityScheme.parse(payload)
const createSecurityScheme = (payload) => deepMerge(securityScheme.parse(
// Ensure we set the flow type as well
'flow' in payload && payload?.flow?.type
? { type: payload.type, flow: { type: payload.flow.type } }
: { type: payload.type }), payload);
export { createSecurityScheme };
export { createSecurityScheme, securitySchemeApiKeyIn };

@@ -34,4 +34,4 @@ import { z } from 'zod';

}, "strip", z.ZodTypeAny, {
uid: string;
default: string;
uid: string;
value?: string | undefined;

@@ -42,5 +42,5 @@ description?: string | undefined;

value?: string | undefined;
default?: string | undefined;
uid?: string | undefined;
description?: string | undefined;
default?: string | undefined;
enum?: string[] | undefined;

@@ -53,4 +53,4 @@ }>>>>;

variables?: Record<string, {
uid: string;
default: string;
uid: string;
value?: string | undefined;

@@ -66,5 +66,5 @@ description?: string | undefined;

value?: string | undefined;
default?: string | undefined;
uid?: string | undefined;
description?: string | undefined;
default?: string | undefined;
enum?: string[] | undefined;

@@ -87,4 +87,4 @@ }> | null | undefined;

variables?: Record<string, {
uid: string;
default: string;
uid: string;
value?: string | undefined;

@@ -91,0 +91,0 @@ description?: string | undefined;

@@ -25,4 +25,4 @@ import { z } from 'zod';

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -39,4 +39,4 @@ required?: boolean | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -62,4 +62,4 @@ enum?: string[] | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -113,4 +113,4 @@ required?: boolean | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -127,4 +127,4 @@ required?: boolean | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -147,4 +147,4 @@ enum?: string[] | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -164,4 +164,4 @@ required?: boolean | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -193,4 +193,4 @@ enum?: string[] | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -218,4 +218,4 @@ required?: boolean | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -259,4 +259,4 @@ enum?: string[] | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -273,4 +273,4 @@ required?: boolean | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -308,4 +308,4 @@ enum?: string[] | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -322,4 +322,4 @@ required?: boolean | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -357,4 +357,4 @@ enum?: string[] | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -371,4 +371,4 @@ required?: boolean | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -406,4 +406,4 @@ enum?: string[] | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -420,4 +420,4 @@ required?: boolean | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -440,4 +440,4 @@ enum?: string[] | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -457,4 +457,4 @@ required?: boolean | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -474,4 +474,4 @@ required?: boolean | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -491,4 +491,4 @@ required?: boolean | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -507,4 +507,4 @@ required?: boolean | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -524,4 +524,4 @@ enum?: string[] | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -541,4 +541,4 @@ enum?: string[] | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -558,4 +558,4 @@ enum?: string[] | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -584,4 +584,4 @@ enum?: string[] | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -601,4 +601,4 @@ required?: boolean | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -618,4 +618,4 @@ required?: boolean | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -635,4 +635,4 @@ required?: boolean | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -660,4 +660,4 @@ required?: boolean | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -687,4 +687,4 @@ required?: boolean | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -704,4 +704,4 @@ enum?: string[] | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -721,4 +721,4 @@ enum?: string[] | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -738,4 +738,4 @@ enum?: string[] | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -762,4 +762,4 @@ enum?: string[] | undefined;

value?: string | number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
key?: string | undefined;

@@ -797,4 +797,4 @@ enum?: string[] | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -814,4 +814,4 @@ required?: boolean | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -831,4 +831,4 @@ required?: boolean | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -848,4 +848,4 @@ required?: boolean | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -873,4 +873,4 @@ required?: boolean | undefined;

maximum?: number | undefined;
description?: string | undefined;
default?: any;
description?: string | undefined;
enum?: string[] | undefined;

@@ -877,0 +877,0 @@ required?: boolean | undefined;

@@ -7,5 +7,3 @@ import type { AxiosResponse } from 'axios';

export type ResponseInstance = AxiosResponse & {
/**
* Time in ms the request took
*/
/** Time in ms the request took */
duration: number;

@@ -75,2 +73,6 @@ };

security: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>>, "many">>;
/** Security schemes which have been created specifically for this request */
securitySchemeUids: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>>;
/** The currently selected security schemes at the request level */
selectedSecuritySchemeUids: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
/**

@@ -103,2 +105,4 @@ * The request body applicable for this operation. The requestBody is fully supported in HTTP methods where the

} | null;
securitySchemeUids: string[];
selectedSecuritySchemeUids: string[];
history: any[];

@@ -131,2 +135,4 @@ description?: string | undefined;

operationId?: string | undefined;
securitySchemeUids?: (string | undefined)[] | undefined;
selectedSecuritySchemeUids?: (string | undefined)[] | undefined;
requestBody?: any;

@@ -164,2 +170,4 @@ history?: any[] | undefined;

} | null;
securitySchemeUids: string[];
selectedSecuritySchemeUids: string[];
history: any[];

@@ -166,0 +174,0 @@ description?: string | undefined;

@@ -49,2 +49,6 @@ import { z } from 'zod';

security: z.array(securityRequirement).optional(),
/** Security schemes which have been created specifically for this request */
securitySchemeUids: z.array(nanoidSchema).optional().default([]),
/** The currently selected security schemes at the request level */
selectedSecuritySchemeUids: z.array(nanoidSchema).default([]),
/**

@@ -51,0 +55,0 @@ * The request body applicable for this operation. The requestBody is fully supported in HTTP methods where the

@@ -20,4 +20,4 @@ import { type Request } from '../entities/workspace/spec/index.js';

variables?: Record<string, {
uid: string;
default: string;
uid: string;
value?: string | undefined;

@@ -65,6 +65,3 @@ description?: string | undefined;

};
selectedSecuritySchemes: {
uid: string;
flowKey?: "implicit" | "password" | "clientCredentials" | "authorizationCode" | undefined;
}[];
securitySchemeDict: Record<string, string>;
selectedServerUid: string;

@@ -71,0 +68,0 @@ childUids: string[];

@@ -122,13 +122,2 @@ import { tagObjectSchema } from '../entities/workspace/spec/spec.js';

const servers = unparsedServers.map((server) => createServer(server));
// Select initial security
const firstSecurityKey = Object.keys((schema?.components?.securitySchemes || schema?.securityDefinitions) ?? {})?.[0];
const firstScheme = (schema?.components?.securitySchemes ||
schema?.securityDefinitions)?.[firstSecurityKey ?? ''];
// In the case of oauth2 we need to select the flow as well
const flowKey = firstScheme?.type === 'oauth2'
? Object.keys(firstScheme.flows ?? {})[0]
: undefined;
const selectedSecuritySchemes = firstSecurityKey
? [{ uid: firstSecurityKey, ...(flowKey ? { flowKey } : {}) }]
: [];
const collection = createCollection({

@@ -143,3 +132,2 @@ spec: {

},
selectedSecuritySchemes,
selectedServerUid: servers[0].uid,

@@ -146,0 +134,0 @@ // We default to having all the requests in the root folder

@@ -19,3 +19,3 @@ {

],
"version": "0.2.18",
"version": "0.2.19",
"engines": {

@@ -22,0 +22,0 @@ "node": ">=18"

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc