@scalar/workspace-store 0.59.0 → 0.61.0
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 +61 -0
- package/README.md +6 -0
- package/dist/channel-example/build-connection-url.d.ts.map +1 -1
- package/dist/channel-example/build-connection-url.js +3 -3
- package/dist/channel-example/dedupe-requirements.d.ts +1 -1
- package/dist/channel-example/get-async-api-protocols.js +2 -2
- package/dist/channel-example/get-asyncapi-security-requirements.d.ts +1 -1
- package/dist/channel-example/get-channel-connection-security.d.ts +1 -1
- package/dist/channel-example/get-channel-operations.d.ts.map +1 -1
- package/dist/channel-example/get-channel-operations.js +4 -1
- package/dist/channel-example/get-channel-parameters.d.ts.map +1 -1
- package/dist/channel-example/get-channel-parameters.js +3 -1
- package/dist/channel-example/resolve-channel.d.ts.map +1 -1
- package/dist/channel-example/resolve-channel.js +2 -0
- package/dist/channel-example/resolve-operation-channel.d.ts.map +1 -1
- package/dist/channel-example/resolve-operation-channel.js +4 -0
- package/dist/channel-example/resolve-operation-with-traits.js +2 -2
- package/dist/channel-example/servers.d.ts.map +1 -1
- package/dist/channel-example/servers.js +3 -1
- package/dist/channel-example/types.d.ts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +3 -3
- package/dist/entities/auth/schema.d.ts +470 -20
- package/dist/entities/auth/schema.d.ts.map +1 -1
- package/dist/entities/auth/schema.js +2 -2
- package/dist/events/definitions/auth.d.ts +2 -2
- package/dist/events/definitions/document.d.ts +1 -1
- package/dist/events/definitions/operation.d.ts +3 -2
- package/dist/events/definitions/operation.d.ts.map +1 -1
- package/dist/events/definitions/server.d.ts +1 -1
- package/dist/events/old-definitions.d.ts +1 -1
- package/dist/helpers/create-chunk-writer.d.ts +6 -0
- package/dist/helpers/create-chunk-writer.d.ts.map +1 -0
- package/dist/helpers/create-chunk-writer.js +44 -0
- package/dist/helpers/dynamic-ref.d.ts +13 -2
- package/dist/helpers/dynamic-ref.d.ts.map +1 -1
- package/dist/helpers/dynamic-ref.js +20 -7
- package/dist/helpers/encode-chunk-name.d.ts +3 -0
- package/dist/helpers/encode-chunk-name.d.ts.map +1 -0
- package/dist/helpers/encode-chunk-name.js +9 -0
- package/dist/helpers/for-each-path-item-operation.d.ts +2 -2
- package/dist/helpers/get-first-server.d.ts +1 -1
- package/dist/helpers/get-resolved-ref.d.ts +6 -1
- package/dist/helpers/get-resolved-ref.d.ts.map +1 -1
- package/dist/helpers/get-resolved-ref.js +3 -10
- package/dist/helpers/is-non-optional-security-requirement.d.ts +1 -1
- package/dist/helpers/merge-object.d.ts +2 -2
- package/dist/helpers/merge-object.d.ts.map +1 -1
- package/dist/helpers/merge-object.js +2 -5
- package/dist/mutators/auth.d.ts +1 -1
- package/dist/mutators/auth.d.ts.map +1 -1
- package/dist/mutators/auth.js +15 -6
- package/dist/mutators/index.d.ts +10 -10
- package/dist/mutators/operation/body.js +2 -2
- package/dist/mutators/operation/helpers/fetch-request-to-har.d.ts.map +1 -1
- package/dist/mutators/operation/helpers/fetch-request-to-har.js +12 -2
- package/dist/mutators/operation/helpers/har-to-operation.d.ts +1 -1
- package/dist/mutators/operation/helpers/har-to-operation.d.ts.map +1 -1
- package/dist/mutators/operation/helpers/har-to-operation.js +9 -5
- package/dist/mutators/operation/helpers/sync-path-parameters.d.ts +2 -2
- package/dist/mutators/operation/history.js +2 -2
- package/dist/mutators/operation/operation.d.ts.map +1 -1
- package/dist/mutators/operation/operation.js +4 -0
- package/dist/mutators/operation/parameters.js +1 -1
- package/dist/mutators/server.d.ts +3 -3
- package/dist/mutators/server.js +1 -1
- package/dist/mutators/tag.d.ts.map +1 -1
- package/dist/mutators/tag.js +4 -0
- package/dist/navigation/helpers/get-openapi-object.d.ts +1 -1
- package/dist/navigation/helpers/traverse-asyncapi-document.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-asyncapi-document.js +2 -2
- package/dist/navigation/helpers/traverse-description.d.ts +1 -1
- package/dist/navigation/helpers/traverse-document.d.ts +1 -1
- package/dist/navigation/helpers/traverse-examples.d.ts +12 -1
- package/dist/navigation/helpers/traverse-examples.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-examples.js +22 -1
- package/dist/navigation/helpers/traverse-paths.d.ts +1 -1
- package/dist/navigation/helpers/traverse-schemas.d.ts +1 -1
- package/dist/navigation/helpers/traverse-tags.d.ts +1 -1
- package/dist/navigation/helpers/traverse-webhooks.d.ts +1 -1
- package/dist/navigation/helpers/update-order-ids.d.ts +2 -2
- package/dist/navigation/index.d.ts +1 -0
- package/dist/navigation/index.d.ts.map +1 -1
- package/dist/navigation/index.js +1 -0
- package/dist/navigation/types.d.ts +1 -1
- package/dist/persistence/index.d.ts.map +1 -1
- package/dist/persistence/index.js +10 -10
- package/dist/persistence/indexdb.d.ts.map +1 -1
- package/dist/persistence/indexdb.js +7 -5
- package/dist/persistence/migrations/v2-team-to-local.d.ts.map +1 -1
- package/dist/persistence/migrations/v2-team-to-local.js +3 -4
- package/dist/plugins/bundler/index.d.ts +5 -2
- package/dist/plugins/bundler/index.d.ts.map +1 -1
- package/dist/plugins/bundler/index.js +24 -26
- package/dist/request-example/builder/body/build-request-body.d.ts +2 -1
- package/dist/request-example/builder/body/build-request-body.d.ts.map +1 -1
- package/dist/request-example/builder/body/build-request-body.js +65 -4
- package/dist/request-example/builder/body/encode-multipart-body.d.ts +9 -0
- package/dist/request-example/builder/body/encode-multipart-body.d.ts.map +1 -0
- package/dist/request-example/builder/body/encode-multipart-body.js +29 -0
- package/dist/request-example/builder/body/get-request-body-example.d.ts +1 -1
- package/dist/request-example/builder/body/get-selected-body-content-type.d.ts +1 -1
- package/dist/request-example/builder/body/schema-value-coercion.d.ts +1 -1
- package/dist/request-example/builder/body/schema-value-coercion.js +1 -1
- package/dist/request-example/builder/body/serialize-form-property.d.ts +1 -1
- package/dist/request-example/builder/body/serialize-multipart-array.d.ts +16 -0
- package/dist/request-example/builder/body/serialize-multipart-array.d.ts.map +1 -0
- package/dist/request-example/builder/body/serialize-multipart-array.js +37 -0
- package/dist/request-example/builder/build-request.d.ts.map +1 -1
- package/dist/request-example/builder/build-request.js +12 -7
- package/dist/request-example/builder/header/build-request-parameters.d.ts +1 -1
- package/dist/request-example/builder/header/build-request-parameters.d.ts.map +1 -1
- package/dist/request-example/builder/header/build-request-parameters.js +7 -1
- package/dist/request-example/builder/header/de-serialize-parameter.d.ts +1 -1
- package/dist/request-example/builder/header/de-serialize-parameter.d.ts.map +1 -1
- package/dist/request-example/builder/header/de-serialize-parameter.js +17 -6
- package/dist/request-example/builder/header/is-param-disabled.d.ts +1 -1
- package/dist/request-example/builder/header/serialize-parameter.d.ts.map +1 -1
- package/dist/request-example/builder/header/serialize-parameter.js +13 -14
- package/dist/request-example/builder/helpers/get-example-from-schema.d.ts +9 -1
- package/dist/request-example/builder/helpers/get-example-from-schema.d.ts.map +1 -1
- package/dist/request-example/builder/helpers/get-example-from-schema.js +255 -20
- package/dist/request-example/builder/helpers/get-example.d.ts +1 -1
- package/dist/request-example/builder/helpers/get-example.js +2 -2
- package/dist/request-example/builder/helpers/get-resolved-url.d.ts +1 -1
- package/dist/request-example/builder/helpers/get-server-variables.d.ts +1 -1
- package/dist/request-example/builder/index.d.ts +1 -0
- package/dist/request-example/builder/index.d.ts.map +1 -1
- package/dist/request-example/builder/index.js +1 -0
- package/dist/request-example/builder/request-factory.d.ts +2 -2
- package/dist/request-example/builder/security/broker-scheme-types.d.ts.map +1 -1
- package/dist/request-example/builder/security/broker-scheme-types.js +2 -2
- package/dist/request-example/builder/security/build-request-security.d.ts.map +1 -1
- package/dist/request-example/builder/security/build-request-security.js +3 -4
- package/dist/request-example/builder/security/secret-types.d.ts +13 -4
- package/dist/request-example/builder/security/secret-types.d.ts.map +1 -1
- package/dist/request-example/context/get-request-example-context.d.ts +3 -3
- package/dist/request-example/context/get-request-example-context.js +1 -1
- package/dist/request-example/context/headers.d.ts +1 -1
- package/dist/request-example/context/headers.js +1 -1
- package/dist/request-example/context/helpers/combine-params.d.ts +1 -1
- package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts +16 -3
- package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/request-example/context/security/extract-security-scheme-secrets.js +21 -19
- package/dist/request-example/context/security/get-security-requirements.d.ts +2 -2
- package/dist/request-example/context/security/get-security-schemes.d.ts +1 -1
- package/dist/request-example/context/security/get-selected-security.d.ts +1 -1
- package/dist/request-example/context/security/is-auth-optional.d.ts +1 -1
- package/dist/request-example/context/security/merge-security.d.ts +3 -3
- package/dist/request-example/context/security/merge-security.d.ts.map +1 -1
- package/dist/request-example/context/security/merge-security.js +40 -11
- package/dist/request-example/context/servers.d.ts +2 -2
- package/dist/request-example/functions.d.ts.map +1 -1
- package/dist/request-example/index.d.ts +1 -1
- package/dist/request-example/index.d.ts.map +1 -1
- package/dist/request-example/index.js +1 -1
- package/dist/resolve.d.ts +1 -1
- package/dist/resolve.js +1 -1
- package/dist/schemas/extensions/document/x-scalar-default-request-body-view.d.ts +23 -0
- package/dist/schemas/extensions/document/x-scalar-default-request-body-view.d.ts.map +1 -0
- package/dist/schemas/extensions/document/x-scalar-default-request-body-view.js +23 -0
- package/dist/schemas/navigation.d.ts +4 -4
- package/dist/schemas/navigation.js +1 -1
- package/dist/schemas/reference-config/index.d.ts +94 -4
- package/dist/schemas/reference-config/index.d.ts.map +1 -1
- package/dist/schemas/reference-config/settings.d.ts +95 -5
- package/dist/schemas/reference-config/settings.d.ts.map +1 -1
- package/dist/schemas/reference-config/settings.js +1 -1
- package/dist/schemas/type-guards.d.ts +1 -1
- package/dist/schemas/v3.1/openapi/index.d.ts +2 -0
- package/dist/schemas/v3.1/openapi/index.d.ts.map +1 -1
- package/dist/schemas/v3.1/openapi/index.js +13 -1
- package/dist/schemas/v3.1/strict/openapi-document.d.ts +284 -1
- package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/openapi-document.js +2 -1
- package/dist/schemas/v3.1/strict/security-scheme.d.ts +13 -1
- package/dist/schemas/v3.1/strict/security-scheme.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/security-scheme.js +11 -1
- package/dist/schemas/v3.2/openapi/index.d.ts +2 -0
- package/dist/schemas/v3.2/openapi/index.d.ts.map +1 -1
- package/dist/schemas/v3.2/openapi/index.js +13 -1
- package/dist/schemas/v3.2/strict/oauth-flow.d.ts +23 -1
- package/dist/schemas/v3.2/strict/oauth-flow.d.ts.map +1 -1
- package/dist/schemas/v3.2/strict/oauth-flow.js +6 -1
- package/dist/schemas/v3.2/strict/oauthflows.d.ts +20 -0
- package/dist/schemas/v3.2/strict/oauthflows.d.ts.map +1 -1
- package/dist/schemas/v3.2/strict/openapi-document.d.ts +1439 -141
- package/dist/schemas/v3.2/strict/openapi-document.d.ts.map +1 -1
- package/dist/schemas/v3.2/strict/openapi-document.js +2 -1
- package/dist/schemas/v3.2/strict/security-scheme.d.ts +29 -6
- package/dist/schemas/v3.2/strict/security-scheme.d.ts.map +1 -1
- package/dist/schemas/v3.2/strict/security-scheme.js +16 -3
- package/dist/schemas/workspace-specification/index.d.ts +1 -1
- package/dist/schemas/workspace.d.ts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +23 -20
- package/package.json +9 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EncryptionSchemeType, SaslSchemeType } from '../../../request-example/builder/security/broker-scheme-types.js';
|
|
2
2
|
import type { XScalarAuthUrl, XScalarCredentialsLocation, XScalarSecretClientCertificate, XScalarSecretClientId, XScalarSecretClientSecret, XScalarSecretHTTP, XScalarSecretPrivateKey, XScalarSecretRedirectUri, XScalarSecretRefreshToken, XScalarSecretServiceName, XScalarSecretToken, XScalarTokenUrl } from '../../../schemas/extensions/security/index.js';
|
|
3
|
-
import type { OAuthFlowAuthorizationCode, OAuthFlowClientCredentials, OAuthFlowImplicit, OAuthFlowPassword } from '../../../schemas/v3.
|
|
4
|
-
import type { ApiKeyObject, HttpObject, OAuth2Object, OpenIdConnectObject } from '../../../schemas/v3.
|
|
3
|
+
import type { OAuthFlowAuthorizationCode, OAuthFlowClientCredentials, OAuthFlowImplicit, OAuthFlowPassword } from '../../../schemas/v3.2/strict/oauth-flow.js';
|
|
4
|
+
import type { ApiKeyObject, HttpObject, MutualTlsObject, OAuth2Object, OpenIdConnectObject } from '../../../schemas/v3.2/strict/security-scheme.js';
|
|
5
5
|
type OAuthFlowCommonSecret = XScalarSecretClientId & XScalarSecretToken & XScalarSecretRefreshToken & XScalarAuthUrl & XScalarTokenUrl;
|
|
6
6
|
export type OAuthFlowImplicitSecret = OAuthFlowImplicit & OAuthFlowCommonSecret & XScalarSecretRedirectUri;
|
|
7
7
|
export type OAuthFlowPasswordSecret = OAuthFlowPassword & OAuthFlowCommonSecret & XScalarSecretHTTP & XScalarSecretClientSecret & XScalarCredentialsLocation;
|
|
@@ -13,8 +13,17 @@ export type OAuthFlowsObjectSecret = {
|
|
|
13
13
|
clientCredentials?: OAuthFlowClientCredentialsSecret;
|
|
14
14
|
authorizationCode?: OAuthFlowAuthorizationCodeSecret;
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
/** AsyncAPI API keys occupy broker credentials instead of an HTTP parameter. */
|
|
17
|
+
export type BrokerApiKeyObject = {
|
|
18
|
+
type: 'apiKey';
|
|
19
|
+
in: 'user' | 'password';
|
|
20
|
+
name?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
};
|
|
23
|
+
export type ApiKeyObjectSecret = (ApiKeyObject | BrokerApiKeyObject) & XScalarSecretToken;
|
|
17
24
|
export type HttpObjectSecret = HttpObject & XScalarSecretHTTP & XScalarSecretToken;
|
|
25
|
+
/** Mutual TLS: the client certificate is presented at the TLS layer, so there is no secret to enter. */
|
|
26
|
+
export type MutualTlsObjectSecret = MutualTlsObject;
|
|
18
27
|
export type OAuth2ObjectSecret = Omit<OAuth2Object, 'flows'> & {
|
|
19
28
|
flows: OAuthFlowsObjectSecret;
|
|
20
29
|
};
|
|
@@ -37,6 +46,6 @@ export type X509ObjectSecret = AsyncApiBrokerScheme<'X509'> & XScalarSecretClien
|
|
|
37
46
|
export type EncryptionObjectSecret = AsyncApiBrokerScheme<EncryptionSchemeType> & XScalarSecretToken;
|
|
38
47
|
/** AsyncAPI GSSAPI (Kerberos) scheme: the service name the client authenticates against. */
|
|
39
48
|
export type GssapiObjectSecret = AsyncApiBrokerScheme<'gssapi'> & XScalarSecretServiceName;
|
|
40
|
-
export type SecuritySchemeObjectSecret = ApiKeyObjectSecret | HttpObjectSecret | OpenIdConnectObjectSecret | OAuth2ObjectSecret | SaslObjectSecret | X509ObjectSecret | EncryptionObjectSecret | GssapiObjectSecret;
|
|
49
|
+
export type SecuritySchemeObjectSecret = ApiKeyObjectSecret | HttpObjectSecret | MutualTlsObjectSecret | OpenIdConnectObjectSecret | OAuth2ObjectSecret | SaslObjectSecret | X509ObjectSecret | EncryptionObjectSecret | GssapiObjectSecret;
|
|
41
50
|
export {};
|
|
42
51
|
//# sourceMappingURL=secret-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret-types.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/security/secret-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAA;AAClH,OAAO,KAAK,EACV,cAAc,EACd,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,eAAe,EAChB,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"secret-types.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/security/secret-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAA;AAClH,OAAO,KAAK,EACV,cAAc,EACd,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,eAAe,EAChB,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,eAAe,EACf,YAAY,EACZ,mBAAmB,EACpB,MAAM,uCAAuC,CAAA;AAE9C,KAAK,qBAAqB,GAAG,qBAAqB,GAChD,kBAAkB,GAClB,yBAAyB,GACzB,cAAc,GACd,eAAe,CAAA;AAEjB,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG,qBAAqB,GAAG,wBAAwB,CAAA;AAE1G,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GACrD,qBAAqB,GACrB,iBAAiB,GACjB,yBAAyB,GACzB,0BAA0B,CAAA;AAE5B,MAAM,MAAM,gCAAgC,GAAG,0BAA0B,GACvE,qBAAqB,GACrB,yBAAyB,GACzB,0BAA0B,CAAA;AAE5B,MAAM,MAAM,gCAAgC,GAAG,0BAA0B,GACvE,qBAAqB,GACrB,yBAAyB,GACzB,wBAAwB,GACxB,0BAA0B,CAAA;AAE5B,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,EAAE,uBAAuB,CAAA;IAClC,QAAQ,CAAC,EAAE,uBAAuB,CAAA;IAClC,iBAAiB,CAAC,EAAE,gCAAgC,CAAA;IACpD,iBAAiB,CAAC,EAAE,gCAAgC,CAAA;CACrD,CAAA;AAED,gFAAgF;AAChF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,QAAQ,CAAA;IACd,EAAE,EAAE,MAAM,GAAG,UAAU,CAAA;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,YAAY,GAAG,kBAAkB,CAAC,GAAG,kBAAkB,CAAA;AACzF,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,iBAAiB,GAAG,kBAAkB,CAAA;AAClF,wGAAwG;AACxG,MAAM,MAAM,qBAAqB,GAAG,eAAe,CAAA;AACnD,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG;IAAE,KAAK,EAAE,sBAAsB,CAAA;CAAE,CAAA;AAChG,MAAM,MAAM,yBAAyB,GAAG,mBAAmB,GAAG;IAAE,KAAK,CAAC,EAAE,sBAAsB,CAAA;CAAE,CAAA;AAEhG;;;GAGG;AACH,KAAK,oBAAoB,CAAC,CAAC,SAAS,MAAM,IAAI;IAC5C,IAAI,EAAE,CAAC,CAAA;IACP,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,wFAAwF;AACxF,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,cAAc,CAAC,GAAG,iBAAiB,CAAA;AAEvF,2EAA2E;AAC3E,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,MAAM,CAAC,GAAG,8BAA8B,GAAG,uBAAuB,CAAA;AAEtH,wFAAwF;AACxF,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,CAAC,oBAAoB,CAAC,GAAG,kBAAkB,CAAA;AAEpG,4FAA4F;AAC5F,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,QAAQ,CAAC,GAAG,wBAAwB,CAAA;AAE1F,MAAM,MAAM,0BAA0B,GAClC,kBAAkB,GAClB,gBAAgB,GAChB,qBAAqB,GACrB,yBAAyB,GACzB,kBAAkB,GAClB,gBAAgB,GAChB,gBAAgB,GAChB,sBAAsB,GACtB,kBAAkB,CAAA"}
|
|
@@ -8,9 +8,9 @@ import { type MergedSecuritySchemes } from '../../request-example/context/securi
|
|
|
8
8
|
import type { RequestExampleMeta, Result } from '../../request-example/types.js';
|
|
9
9
|
import type { XScalarEnvironment } from '../../schemas/extensions/document/x-scalar-environments.js';
|
|
10
10
|
import type { XScalarCookie } from '../../schemas/extensions/general/x-scalar-cookies.js';
|
|
11
|
-
import type { OperationObject } from '../../schemas/v3.
|
|
12
|
-
import type { SecurityRequirementObject } from '../../schemas/v3.
|
|
13
|
-
import type { ServerObject } from '../../schemas/v3.
|
|
11
|
+
import type { OperationObject } from '../../schemas/v3.2/strict/operation.js';
|
|
12
|
+
import type { SecurityRequirementObject } from '../../schemas/v3.2/strict/security-requirement.js';
|
|
13
|
+
import type { ServerObject } from '../../schemas/v3.2/strict/server.js';
|
|
14
14
|
import type { WorkspaceDocument } from '../../schemas/workspace.js';
|
|
15
15
|
export type BuildRequestExampleContext = {
|
|
16
16
|
operation: OperationObject;
|
|
@@ -79,7 +79,7 @@ export const getRequestExampleContext = (workspaceStore, documentName, requestEx
|
|
|
79
79
|
const selectedSecurity = getSelectedSecurity(documentSelectedSecurity, operationSelectedSecurity, securityRequirements, securitySchemes, options.authentication?.preferredSecurityScheme);
|
|
80
80
|
/** The above selected requirements in scheme form */
|
|
81
81
|
const selectedSecuritySchemes = getSecuritySchemes(securitySchemes, selectedSecurity.selectedSchemes[selectedSecurity.selectedIndex] ?? {});
|
|
82
|
-
const serverMeta = !isWebhook && operation.servers != null
|
|
82
|
+
const serverMeta = !isWebhook && options.servers == null && operation.servers != null
|
|
83
83
|
? { type: 'operation', path: path ?? '', method: method ?? 'get' }
|
|
84
84
|
: { type: 'document' };
|
|
85
85
|
const authMeta = operationSelectedSecurity !== undefined
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
|
-
import type { OperationObject } from '@scalar/workspace-store/schemas/v3.
|
|
2
|
+
import type { OperationObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
3
3
|
/**
|
|
4
4
|
* Restores conventional casing for well-known default headers.
|
|
5
5
|
*
|
|
@@ -28,7 +28,7 @@ const getEnabledOperationHeaderParameterNames = (operation, exampleName) => {
|
|
|
28
28
|
const names = new Set();
|
|
29
29
|
for (const ref of operation.parameters ?? []) {
|
|
30
30
|
const param = getResolvedRef(ref);
|
|
31
|
-
if (param.in !== 'header') {
|
|
31
|
+
if (!param || param.in !== 'header') {
|
|
32
32
|
continue;
|
|
33
33
|
}
|
|
34
34
|
const rawExample = 'examples' in param && param.examples?.[exampleName] ? param.examples[exampleName] : undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OperationObject, PathItemObject } from '@scalar/workspace-store/schemas/v3.
|
|
1
|
+
import type { OperationObject, PathItemObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
2
2
|
/** Combine pathItem and operation parameters into a single, dereferenced parameter array */
|
|
3
3
|
export declare const combineParams: (pathParams?: PathItemObject["parameters"], operationParams?: OperationObject["parameters"]) => OperationObject["parameters"];
|
|
4
4
|
//# sourceMappingURL=combine-params.d.ts.map
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import type { SecurityScheme } from '@scalar/types/entities';
|
|
2
2
|
import type { AuthStore } from '@scalar/workspace-store/entities/auth';
|
|
3
3
|
import type { DeepPartial } from '@scalar/workspace-store/helpers/overrides-proxy';
|
|
4
|
-
import type { SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.
|
|
5
|
-
import type { SecuritySchemeObjectSecret } from '../../../request-example/builder/security/secret-types.js';
|
|
4
|
+
import type { SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
5
|
+
import type { BrokerApiKeyObject, EncryptionObjectSecret, SaslObjectSecret, SecuritySchemeObjectSecret } from '../../../request-example/builder/security/secret-types.js';
|
|
6
6
|
/** A combined scheme that includes both the auth store secrets and a deep partial of the config auth */
|
|
7
7
|
export type ConfigAuthScheme = SecuritySchemeObject & DeepPartial<SecurityScheme>;
|
|
8
|
+
type BrokerSchemeType = SaslObjectSecret['type'] | EncryptionObjectSecret['type'] | 'X509' | 'gssapi';
|
|
9
|
+
type BrokerAuthScheme = {
|
|
10
|
+
[T in BrokerSchemeType]: {
|
|
11
|
+
type: T;
|
|
12
|
+
description?: string;
|
|
13
|
+
username?: string;
|
|
14
|
+
password?: string;
|
|
15
|
+
token?: string;
|
|
16
|
+
};
|
|
17
|
+
}[BrokerSchemeType];
|
|
8
18
|
/** Extract the secrets from the config and the auth store */
|
|
9
|
-
export declare const extractSecuritySchemeSecrets: (scheme:
|
|
19
|
+
export declare const extractSecuritySchemeSecrets: (scheme: ConfigAuthScheme | BrokerAuthScheme | (BrokerApiKeyObject & {
|
|
20
|
+
value?: string;
|
|
21
|
+
}), authStore: AuthStore, name: string, documentSlug: string, oauth2RedirectUri?: string) => SecuritySchemeObjectSecret;
|
|
22
|
+
export {};
|
|
10
23
|
//# sourceMappingURL=extract-security-scheme-secrets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-security-scheme-secrets.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/extract-security-scheme-secrets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"extract-security-scheme-secrets.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/extract-security-scheme-secrets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAA2C,MAAM,uCAAuC,CAAA;AAC/G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;AAQlF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAExG,OAAO,KAAK,EAEV,kBAAkB,EAClB,sBAAsB,EAStB,gBAAgB,EAChB,0BAA0B,EAE3B,MAAM,iDAAiD,CAAA;AAExD,wGAAwG;AACxG,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,CAAA;AAEjF,KAAK,gBAAgB,GAAG,gBAAgB,CAAC,MAAM,CAAC,GAAG,sBAAsB,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,QAAQ,CAAA;AACrG,KAAK,gBAAgB,GAAG;KACrB,CAAC,IAAI,gBAAgB,GAAG;QACvB,IAAI,EAAE,CAAC,CAAA;QACP,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,KAAK,CAAC,EAAE,MAAM,CAAA;KACf;CACF,CAAC,gBAAgB,CAAC,CAAA;AAgMnB,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,GAEvC,QAAQ,gBAAgB,GAAG,gBAAgB,GAAG,CAAC,kBAAkB,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EACvF,WAAW,SAAS,EACpB,MAAM,MAAM,EACZ,cAAc,MAAM,EACpB,oBAAoB,MAAM,KACzB,0BA4HF,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isObject } from '@scalar/helpers/object/is-object';
|
|
2
2
|
import { objectEntries } from '@scalar/helpers/object/object-entries';
|
|
3
|
-
import { isEncryptionSchemeType, isSaslSchemeType } from '../../../request-example/builder/security/broker-scheme-types.js';
|
|
4
3
|
/**
|
|
5
4
|
* Maps x-scalar-secret fields to their corresponding input field names.
|
|
6
5
|
* This allows us to fall back to config values when auth store secrets are not available.
|
|
@@ -35,7 +34,7 @@ const mergeFlowSecrets = (properties, configSecrets, authStoreSecrets = {}, oaut
|
|
|
35
34
|
}));
|
|
36
35
|
/** Secret extensions are not part of the strict scheme types, so they are read the same way the OAuth flows read theirs */
|
|
37
36
|
const documentSecret = (scheme, property) => {
|
|
38
|
-
const value = scheme
|
|
37
|
+
const value = property in scheme ? Reflect.get(scheme, property) : undefined;
|
|
39
38
|
return typeof value === 'string' ? value : '';
|
|
40
39
|
};
|
|
41
40
|
const extractRefreshTokenSecret = (authStoreSecrets = {}) => {
|
|
@@ -133,10 +132,6 @@ export const extractSecuritySchemeSecrets = (
|
|
|
133
132
|
// Include the config fields
|
|
134
133
|
scheme, authStore, name, documentSlug, oauth2RedirectUri) => {
|
|
135
134
|
const secrets = authStore.getAuthSecrets(documentSlug, name);
|
|
136
|
-
// AsyncAPI broker schemes live outside the OpenAPI `SecuritySchemeObject` union, so their type
|
|
137
|
-
// (and any config credential fields) are read through this alias. Captured before the OpenAPI
|
|
138
|
-
// branches below, where `scheme` gets narrowed to `never` once all four OpenAPI types are handled.
|
|
139
|
-
const brokerScheme = scheme;
|
|
140
135
|
// Handle API Key security schemes
|
|
141
136
|
if (scheme.type === 'apiKey') {
|
|
142
137
|
const storeSecrets = secrets?.type === 'apiKey' ? secrets : undefined;
|
|
@@ -197,36 +192,43 @@ scheme, authStore, name, documentSlug, oauth2RedirectUri) => {
|
|
|
197
192
|
}
|
|
198
193
|
// SASL-style schemes (userPassword, plain, scramSha256, scramSha512): username + password,
|
|
199
194
|
// with the same config fallbacks as HTTP basic.
|
|
200
|
-
if (
|
|
201
|
-
|
|
195
|
+
if (scheme.type === 'userPassword' ||
|
|
196
|
+
scheme.type === 'plain' ||
|
|
197
|
+
scheme.type === 'scramSha256' ||
|
|
198
|
+
scheme.type === 'scramSha512') {
|
|
199
|
+
const storeSecrets = secrets?.type === scheme.type ? secrets : undefined;
|
|
202
200
|
return {
|
|
203
|
-
...
|
|
204
|
-
|
|
205
|
-
'x-scalar-secret-
|
|
201
|
+
...scheme,
|
|
202
|
+
type: scheme.type,
|
|
203
|
+
'x-scalar-secret-username': storeSecrets?.['x-scalar-secret-username'] || scheme.username || '',
|
|
204
|
+
'x-scalar-secret-password': storeSecrets?.['x-scalar-secret-password'] || scheme.password || '',
|
|
206
205
|
};
|
|
207
206
|
}
|
|
208
207
|
// X509: a client certificate + private key pair (PEM), stored in the auth store only.
|
|
209
|
-
if (
|
|
208
|
+
if (scheme.type === 'X509') {
|
|
210
209
|
const storeSecrets = secrets?.type === 'X509' ? secrets : undefined;
|
|
211
210
|
return {
|
|
212
|
-
...
|
|
211
|
+
...scheme,
|
|
212
|
+
type: scheme.type,
|
|
213
213
|
'x-scalar-secret-client-certificate': storeSecrets?.['x-scalar-secret-client-certificate'] || '',
|
|
214
214
|
'x-scalar-secret-private-key': storeSecrets?.['x-scalar-secret-private-key'] || '',
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
217
|
// Encryption schemes (symmetricEncryption, asymmetricEncryption): a single key value in the token slot.
|
|
218
|
-
if (
|
|
219
|
-
const storeSecrets = secrets?.type ===
|
|
218
|
+
if (scheme.type === 'symmetricEncryption' || scheme.type === 'asymmetricEncryption') {
|
|
219
|
+
const storeSecrets = secrets?.type === scheme.type ? secrets : undefined;
|
|
220
220
|
return {
|
|
221
|
-
...
|
|
222
|
-
|
|
221
|
+
...scheme,
|
|
222
|
+
type: scheme.type,
|
|
223
|
+
'x-scalar-secret-token': storeSecrets?.['x-scalar-secret-token'] || scheme.token || '',
|
|
223
224
|
};
|
|
224
225
|
}
|
|
225
226
|
// GSSAPI (Kerberos): the service name the client authenticates against.
|
|
226
|
-
if (
|
|
227
|
+
if (scheme.type === 'gssapi') {
|
|
227
228
|
const storeSecrets = secrets?.type === 'gssapi' ? secrets : undefined;
|
|
228
229
|
return {
|
|
229
|
-
...
|
|
230
|
+
...scheme,
|
|
231
|
+
type: scheme.type,
|
|
230
232
|
'x-scalar-secret-service-name': storeSecrets?.['x-scalar-secret-service-name'] || '',
|
|
231
233
|
};
|
|
232
234
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.
|
|
2
|
-
import type { OperationObject } from '@scalar/workspace-store/schemas/v3.
|
|
1
|
+
import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
2
|
+
import type { OperationObject } from '@scalar/workspace-store/schemas/v3.2/strict/operation';
|
|
3
3
|
/**
|
|
4
4
|
* Compute what the security requirements should be for a request
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SecuritySchemeObjectSecret } from '../../../request-example/builder/security/secret-types.js';
|
|
2
2
|
import type { MergedSecuritySchemes } from '../../../request-example/context/security/merge-security.js';
|
|
3
|
-
import type { SecurityRequirementObject } from '../../../schemas/v3.
|
|
3
|
+
import type { SecurityRequirementObject } from '../../../schemas/v3.2/strict/security-requirement.js';
|
|
4
4
|
/**
|
|
5
5
|
* Get the selected security schemes from security requirements.
|
|
6
6
|
* Takes security requirement objects and resolves them to actual security scheme objects.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AuthenticationConfiguration } from '@scalar/types/api-reference';
|
|
2
2
|
import type { SelectedSecurity } from '@scalar/workspace-store/entities/auth';
|
|
3
|
-
import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.
|
|
3
|
+
import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
4
4
|
type DefaultScopeScheme = {
|
|
5
5
|
type?: string;
|
|
6
6
|
'x-default-scopes'?: string[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.
|
|
1
|
+
import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
2
2
|
/** Determines if the authentication is optional */
|
|
3
3
|
export declare const isAuthOptional: (securityRequirements: NonNullable<OpenApiDocument["security"]>) => boolean;
|
|
4
4
|
//# sourceMappingURL=is-auth-optional.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AuthenticationConfiguration } from '@scalar/types/api-reference';
|
|
2
2
|
import type { AsyncApiComponentsObject } from '@scalar/types/asyncapi/3.1';
|
|
3
3
|
import type { AuthStore } from '@scalar/workspace-store/entities/auth';
|
|
4
|
-
import { type ComponentsObject } from '@scalar/workspace-store/schemas/v3.
|
|
4
|
+
import { type ComponentsObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
5
5
|
import type { SecuritySchemeObjectSecret } from '../../../request-example/builder/security/secret-types.js';
|
|
6
6
|
/** Document security merged with the config security schemes */
|
|
7
7
|
export type MergedSecuritySchemes = Record<string, SecuritySchemeObjectSecret>;
|
|
@@ -10,8 +10,8 @@ export type MergedSecuritySchemes = Record<string, SecuritySchemeObjectSecret>;
|
|
|
10
10
|
*
|
|
11
11
|
* AsyncAPI keeps its security schemes in the same `components.securitySchemes` slot and shares the
|
|
12
12
|
* `http`/`apiKey`/`oauth2`/`openIdConnect` shapes with OpenAPI, so we accept either spec's schemes
|
|
13
|
-
* here.
|
|
14
|
-
* AsyncAPI
|
|
13
|
+
* here. HTTP schemes are coerced into the OpenAPI shape, while broker credentials retain their
|
|
14
|
+
* AsyncAPI type and location.
|
|
15
15
|
*/
|
|
16
16
|
export declare const mergeSecurity: (documentSecuritySchemes: ComponentsObject["securitySchemes"] | NonNullable<AsyncApiComponentsObject["securitySchemes"]>, configSecuritySchemes: AuthenticationConfiguration["securitySchemes"], authStore: AuthStore, documentName: string, oauth2RedirectUri?: string) => MergedSecuritySchemes;
|
|
17
17
|
//# sourceMappingURL=merge-security.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-security.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/merge-security.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"merge-security.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/merge-security.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,KAAK,EAAE,wBAAwB,EAAgC,MAAM,4BAA4B,CAAA;AACxG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AAKtE,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,8DAA8D,CAAA;AAGrE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAIjG,gEAAgE;AAChE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAA;AA0E9E;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GACxB,yBACI,gBAAgB,CAAC,iBAAiB,CAAC,GACnC,WAAW,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,CAAM,EACjE,uBAAuB,2BAA2B,CAAC,iBAAiB,CAAM,EAC1E,WAAW,SAAS,EACpB,cAAc,MAAM,EACpB,oBAAoB,MAAM,KACzB,qBA4DF,CAAA"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { isObjectLike } from '@scalar/helpers/object/is-object';
|
|
1
2
|
import { objectEntries } from '@scalar/helpers/object/object-entries';
|
|
3
|
+
import { Type } from '@scalar/typebox';
|
|
2
4
|
import { deepClone } from '@scalar/workspace-store/helpers/deep-clone';
|
|
3
5
|
import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref';
|
|
4
6
|
import { mergeObjects } from '@scalar/workspace-store/helpers/merge-object';
|
|
5
7
|
import { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce';
|
|
6
|
-
import { SecuritySchemeObjectSchema, } from '@scalar/workspace-store/schemas/v3.
|
|
8
|
+
import { SecuritySchemeObjectSchema, } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
9
|
+
import { isEncryptionSchemeType, isSaslSchemeType } from '../../../request-example/builder/security/broker-scheme-types.js';
|
|
7
10
|
import { extractSecuritySchemeSecrets } from './extract-security-scheme-secrets.js';
|
|
8
11
|
const hasAvailableScopes = (flow) => {
|
|
9
12
|
const resolved = getResolvedRef(flow);
|
|
10
|
-
return
|
|
13
|
+
return resolved !== null && typeof resolved === 'object' && 'availableScopes' in resolved;
|
|
11
14
|
};
|
|
12
15
|
/**
|
|
13
16
|
* Rename each AsyncAPI OAuth2 flow's `availableScopes` map onto OpenAPI's `scopes`.
|
|
@@ -31,7 +34,10 @@ const normalizeAsyncApiOAuthFlows = (flows) => {
|
|
|
31
34
|
return [flowKey, flowValue];
|
|
32
35
|
}
|
|
33
36
|
// Prefer an OpenAPI-native `scopes` map if one is somehow already present, so we never drop it.
|
|
34
|
-
const
|
|
37
|
+
const resolved = getResolvedRef(flowValue);
|
|
38
|
+
if (!isObjectLike(resolved))
|
|
39
|
+
return [flowKey, flowValue];
|
|
40
|
+
const { availableScopes, scopes: existingScopes, ...rest } = resolved;
|
|
35
41
|
return [flowKey, { ...rest, scopes: existingScopes ?? availableScopes ?? {} }];
|
|
36
42
|
}));
|
|
37
43
|
};
|
|
@@ -48,6 +54,10 @@ const normalizeAsyncApiSecurityScheme = (scheme) => {
|
|
|
48
54
|
if (!(scheme && typeof scheme === 'object' && 'type' in scheme)) {
|
|
49
55
|
return scheme;
|
|
50
56
|
}
|
|
57
|
+
// HTTP authentication scheme names are case-insensitive, but the strict schema uses lowercase literals.
|
|
58
|
+
if (scheme.type === 'http' && 'scheme' in scheme && typeof scheme.scheme === 'string') {
|
|
59
|
+
return { ...scheme, scheme: scheme.scheme.toLowerCase() };
|
|
60
|
+
}
|
|
51
61
|
if (scheme.type === 'httpApiKey') {
|
|
52
62
|
return { ...scheme, type: 'apiKey' };
|
|
53
63
|
}
|
|
@@ -64,8 +74,8 @@ const normalizeAsyncApiSecurityScheme = (scheme) => {
|
|
|
64
74
|
*
|
|
65
75
|
* AsyncAPI keeps its security schemes in the same `components.securitySchemes` slot and shares the
|
|
66
76
|
* `http`/`apiKey`/`oauth2`/`openIdConnect` shapes with OpenAPI, so we accept either spec's schemes
|
|
67
|
-
* here.
|
|
68
|
-
* AsyncAPI
|
|
77
|
+
* here. HTTP schemes are coerced into the OpenAPI shape, while broker credentials retain their
|
|
78
|
+
* AsyncAPI type and location.
|
|
69
79
|
*/
|
|
70
80
|
export const mergeSecurity = (documentSecuritySchemes = {}, configSecuritySchemes = {}, authStore, documentName, oauth2RedirectUri) => {
|
|
71
81
|
/** Resolve any refs in the document security schemes */
|
|
@@ -77,18 +87,37 @@ export const mergeSecurity = (documentSecuritySchemes = {}, configSecurityScheme
|
|
|
77
87
|
return acc;
|
|
78
88
|
}, {});
|
|
79
89
|
/** Merge the config security schemes into the document security schemes */
|
|
80
|
-
const mergedSchemes = mergeObjects(resolvedDocumentSecuritySchemes, configSecuritySchemes)
|
|
90
|
+
const mergedSchemes = mergeObjects(resolvedDocumentSecuritySchemes, configSecuritySchemes);
|
|
81
91
|
/** Convert the config secrets to the new secret extensions */
|
|
82
92
|
return objectEntries(mergedSchemes).reduce((acc, [name, value]) => {
|
|
83
93
|
// Fold AsyncAPI-only types (e.g. `httpApiKey`) onto their OpenAPI equivalents before coercing,
|
|
84
94
|
// so the downstream apiKey/http/oauth2 machinery recognises them instead of rejecting the type.
|
|
85
95
|
const scheme = normalizeAsyncApiSecurityScheme(value);
|
|
86
|
-
//
|
|
96
|
+
// Broker schemes have no OpenAPI equivalent. Validate their shared fields separately so
|
|
97
|
+
// coercion cannot turn a broker credential into an HTTP authentication scheme.
|
|
98
|
+
const type = isObjectLike(scheme) && typeof scheme.type === 'string' ? scheme.type : undefined;
|
|
99
|
+
if (isSaslSchemeType(type) || isEncryptionSchemeType(type) || type === 'X509' || type === 'gssapi') {
|
|
100
|
+
const broker = coerceValue(Type.Object({
|
|
101
|
+
description: Type.Optional(Type.String()),
|
|
102
|
+
username: Type.Optional(Type.String()),
|
|
103
|
+
password: Type.Optional(Type.String()),
|
|
104
|
+
token: Type.Optional(Type.String()),
|
|
105
|
+
}), scheme);
|
|
106
|
+
acc[name] = extractSecuritySchemeSecrets({ ...broker, type }, authStore, name, documentName, oauth2RedirectUri);
|
|
107
|
+
return acc;
|
|
108
|
+
}
|
|
109
|
+
if (isObjectLike(scheme) && scheme.type === 'apiKey' && (scheme.in === 'user' || scheme.in === 'password')) {
|
|
110
|
+
const broker = coerceValue(Type.Object({
|
|
111
|
+
description: Type.Optional(Type.String()),
|
|
112
|
+
name: Type.Optional(Type.String()),
|
|
113
|
+
value: Type.Optional(Type.String()),
|
|
114
|
+
}), scheme);
|
|
115
|
+
acc[name] = extractSecuritySchemeSecrets({ ...broker, type: 'apiKey', in: scheme.in }, authStore, name, documentName, oauth2RedirectUri);
|
|
116
|
+
return acc;
|
|
117
|
+
}
|
|
118
|
+
// We coerce in case the scheme is missing any key fields like type.
|
|
87
119
|
const coerced = coerceValue(SecuritySchemeObjectSchema, scheme);
|
|
88
|
-
|
|
89
|
-
// `coerced` has already laundered the value into the OpenAPI shape (including any AsyncAPI scheme),
|
|
90
|
-
// so we narrow here to restore the extra fields without re-widening the type.
|
|
91
|
-
const merged = { ...coerced, ...scheme };
|
|
120
|
+
const merged = { ...(isObjectLike(scheme) ? scheme : {}), ...coerced };
|
|
92
121
|
acc[name] = extractSecuritySchemeSecrets(merged, authStore, name, documentName, oauth2RedirectUri);
|
|
93
122
|
return acc;
|
|
94
123
|
}, {});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ServerObject } from '@scalar/workspace-store/schemas/v3.
|
|
1
|
+
import type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
2
2
|
import type { WorkspaceDocument } from '../../schemas.js';
|
|
3
|
-
import type { OperationObject } from '../../schemas/v3.
|
|
3
|
+
import type { OperationObject } from '../../schemas/v3.2/strict/operation.js';
|
|
4
4
|
/**
|
|
5
5
|
* Server processing options containing base URLs for resolving relative server URLs.
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/request-example/functions.ts"],"names":[],"mappings":"AAsJA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAnCN,MAAM;;;;kBAMR,MAAM;;;;kBAMJ,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAihBoC,CAAA;AAEjE,kHAAkH;AAClH,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,gBAAgB,CAAA;AAE/D,eAAO,MAAM,yBAAyB,GAAI,MAAM,mBAAmB,KAAG,
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/request-example/functions.ts"],"names":[],"mappings":"AAsJA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAnCN,MAAM;;;;kBAMR,MAAM;;;;kBAMJ,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAihBoC,CAAA;AAEjE,kHAAkH;AAClH,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,gBAAgB,CAAA;AAE/D,eAAO,MAAM,yBAAyB,GAAI,MAAM,mBAAmB,KAAG,MAAwC,CAAA;AAE9G,qFAAqF;AACrF,eAAO,MAAM,6BAA6B,EAAE,SAAS,mBAAmB,EASvE,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAoC,mBAAmB,EAAE,CAAA;AAC5F,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,IAAI,IAAI,mBACtB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { ApiKeyObjectSecret, BuildRequestData, BuildRequestFailureCode, BuildRequestResult, EncryptionObjectSecret, GssapiObjectSecret, HttpObjectSecret, OAuth2ObjectSecret, OAuthFlowAuthorizationCodeSecret, OAuthFlowClientCredentialsSecret, OAuthFlowImplicitSecret, OAuthFlowPasswordSecret, OAuthFlowsObjectSecret, OpenIdConnectObjectSecret, RequestPayload, ResolveRequestFactoryUrlError, ResolveRequestFactoryUrlResult, SaslObjectSecret, SecuritySchemeObjectSecret, X509ObjectSecret, } from './builder/index.js';
|
|
2
|
-
export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, type RequestFactory, type SerializedFormProperty, buildDottedNestedRowPredicate, buildRequest, buildRequestSecurity, coerceLeafValueToSchemaType, coerceUntypedValue, deSerializeParameter, deSerializeSchemaValue, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSchemaExampleFromBody, getSelectedBodyContentType, getServerVariables, isEncryptionSchemeType, isParamDisabled, isSaslSchemeType, requestFactory, resolveExecutableRequestUrl, resolveLeafSchema, resolveRequestFactoryUrl, serializeContentValue, serializeDeepObjectStyle, serializeFormPropertyWithEncoding, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
|
|
2
|
+
export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, type RequestFactory, type SerializedFormProperty, buildDottedNestedRowPredicate, buildRequest, buildRequestSecurity, coerceLeafValueToSchemaType, coerceUntypedValue, deSerializeParameter, deSerializeSchemaValue, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSchemaExampleFromBody, getSelectedBodyContentType, getServerVariables, isEncryptionSchemeType, isParamDisabled, isSaslSchemeType, requestFactory, resolveExecutableRequestUrl, resolveLeafSchema, resolveRequestFactoryUrl, serializeContentValue, serializeDeepObjectStyle, serializeFormPropertyWithEncoding, serializeFormStyle, serializeFormStyleForCookies, serializeMultipartArray, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
|
|
3
3
|
export type { MergedSecuritySchemes } from './context/index.js';
|
|
4
4
|
export { type BuildRequestExampleContext, combineParams, filterDisabledDefaultHeaders, getActiveEnvironment, getActiveProxyUrl, getDefaultHeaders, getRequestExampleContext, getSecurityRequirements, getSecuritySchemes, getSelectedSecurity, getSelectedServer, getServers, isAuthOptional, mergeSecurity, restoreConventionalDefaultHeaderNames, restoreConventionalHeaderName, } from './context/index.js';
|
|
5
5
|
export { CONTEXT_FUNCTION_NAMES, type ContextFunctionEntry, type ContextFunctionName, POPULAR_CONTEXT_FUNCTION_KEYS, contextFunctions, getContextFunctionComment, isContextFunctionName, } from './functions.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request-example/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,6BAA6B,EAC7B,8BAA8B,EAC9B,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,6BAA6B,EAC7B,YAAY,EACZ,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,2BAA2B,EAC3B,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,iCAAiC,EACjC,kBAAkB,EAClB,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,WAAW,CAAA;AAClB,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EACL,KAAK,0BAA0B,EAC/B,aAAa,EACb,4BAA4B,EAC5B,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,aAAa,EACb,qCAAqC,EACrC,6BAA6B,GAC9B,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,6BAA6B,EAC7B,gBAAgB,EAChB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAA;AACjE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request-example/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,6BAA6B,EAC7B,8BAA8B,EAC9B,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,6BAA6B,EAC7B,YAAY,EACZ,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,2BAA2B,EAC3B,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,iCAAiC,EACjC,kBAAkB,EAClB,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,WAAW,CAAA;AAClB,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EACL,KAAK,0BAA0B,EAC/B,aAAa,EACb,4BAA4B,EAC5B,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,aAAa,EACb,qCAAqC,EACrC,6BAA6B,GAC9B,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,6BAA6B,EAC7B,gBAAgB,EAChB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAA;AACjE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, buildDottedNestedRowPredicate, buildRequest, buildRequestSecurity, coerceLeafValueToSchemaType, coerceUntypedValue, deSerializeParameter, deSerializeSchemaValue, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSchemaExampleFromBody, getSelectedBodyContentType, getServerVariables, isEncryptionSchemeType, isParamDisabled, isSaslSchemeType, requestFactory, resolveExecutableRequestUrl, resolveLeafSchema, resolveRequestFactoryUrl, serializeContentValue, serializeDeepObjectStyle, serializeFormPropertyWithEncoding, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
|
|
1
|
+
export { BUILD_REQUEST_FAILED, INVALID_REQUEST_FACTORY_URL, MISSING_REQUEST_SERVER_BASE, buildDottedNestedRowPredicate, buildRequest, buildRequestSecurity, coerceLeafValueToSchemaType, coerceUntypedValue, deSerializeParameter, deSerializeSchemaValue, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSchemaExampleFromBody, getSelectedBodyContentType, getServerVariables, isEncryptionSchemeType, isParamDisabled, isSaslSchemeType, requestFactory, resolveExecutableRequestUrl, resolveLeafSchema, resolveRequestFactoryUrl, serializeContentValue, serializeDeepObjectStyle, serializeFormPropertyWithEncoding, serializeFormStyle, serializeFormStyleForCookies, serializeMultipartArray, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
|
|
2
2
|
export { combineParams, filterDisabledDefaultHeaders, getActiveEnvironment, getActiveProxyUrl, getDefaultHeaders, getRequestExampleContext, getSecurityRequirements, getSecuritySchemes, getSelectedSecurity, getSelectedServer, getServers, isAuthOptional, mergeSecurity, restoreConventionalDefaultHeaderNames, restoreConventionalHeaderName, } from './context/index.js';
|
|
3
3
|
export { CONTEXT_FUNCTION_NAMES, POPULAR_CONTEXT_FUNCTION_KEYS, contextFunctions, getContextFunctionComment, isContextFunctionName, } from './functions.js';
|
|
4
4
|
export { createVariablesStoreForRequest } from './variable-store/index.js';
|
package/dist/resolve.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MaybeRefSchemaObject, SchemaObject } from './schemas/v3.
|
|
1
|
+
import type { MaybeRefSchemaObject, SchemaObject } from './schemas/v3.2/strict/schema.js';
|
|
2
2
|
type ResolvedSchema<T> = T extends undefined ? undefined : SchemaObject & {
|
|
3
3
|
$ref?: string;
|
|
4
4
|
};
|
package/dist/resolve.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Type } from '@scalar/typebox';
|
|
|
2
2
|
import { getResolvedRef, mergeSiblingReferences } from './helpers/get-resolved-ref.js';
|
|
3
3
|
import { compose } from './schemas/compose.js';
|
|
4
4
|
import { coerceValue } from './schemas/typebox-coerce.js';
|
|
5
|
-
import { SchemaObjectSchema } from './schemas/v3.
|
|
5
|
+
import { SchemaObjectSchema } from './schemas/v3.2/strict/openapi-document.js';
|
|
6
6
|
export const resolve = {
|
|
7
7
|
schema: (schema) => {
|
|
8
8
|
if (schema === undefined) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema for the x-scalar-default-request-body-view extension on an OpenAPI document.
|
|
3
|
+
*
|
|
4
|
+
* Sets the initial view of the request body editor for structured (JSON/YAML) bodies.
|
|
5
|
+
* Use `form` to open the schema-driven form view by default, or `raw` for the code editor.
|
|
6
|
+
* When the body cannot be shown as a form, Scalar falls back to `raw` automatically.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```yaml
|
|
10
|
+
* x-scalar-default-request-body-view: form
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare const XScalarDefaultRequestBodyViewSchema: import("@scalar/typebox").TObject<{
|
|
14
|
+
'x-scalar-default-request-body-view': import("@scalar/typebox").TOptional<import("@scalar/typebox").TUnion<[import("@scalar/typebox").TLiteral<"form">, import("@scalar/typebox").TLiteral<"raw">]>>;
|
|
15
|
+
}>;
|
|
16
|
+
export type XScalarDefaultRequestBodyView = {
|
|
17
|
+
/** Initial request body editor view for structured bodies. Defaults to `raw`. */
|
|
18
|
+
'x-scalar-default-request-body-view'?: 'form' | 'raw';
|
|
19
|
+
};
|
|
20
|
+
export declare const XScalarDefaultRequestBodyView: import("@scalar/validation").ObjectSchema<{
|
|
21
|
+
'x-scalar-default-request-body-view': import("@scalar/validation").OptionalSchema<import("@scalar/validation").UnionSchema<readonly [import("@scalar/validation").LiteralSchema<"form">, import("@scalar/validation").LiteralSchema<"raw">]>>;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=x-scalar-default-request-body-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x-scalar-default-request-body-view.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/document/x-scalar-default-request-body-view.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mCAAmC;;EAE9C,CAAA;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,iFAAiF;IACjF,oCAAoC,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;CACtD,CAAA;AAED,eAAO,MAAM,6BAA6B;;EAQzC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Type } from '@scalar/typebox';
|
|
2
|
+
import { literal, object, optional, union } from '@scalar/validation';
|
|
3
|
+
/**
|
|
4
|
+
* Schema for the x-scalar-default-request-body-view extension on an OpenAPI document.
|
|
5
|
+
*
|
|
6
|
+
* Sets the initial view of the request body editor for structured (JSON/YAML) bodies.
|
|
7
|
+
* Use `form` to open the schema-driven form view by default, or `raw` for the code editor.
|
|
8
|
+
* When the body cannot be shown as a form, Scalar falls back to `raw` automatically.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```yaml
|
|
12
|
+
* x-scalar-default-request-body-view: form
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export const XScalarDefaultRequestBodyViewSchema = Type.Object({
|
|
16
|
+
'x-scalar-default-request-body-view': Type.Optional(Type.Union([Type.Literal('form'), Type.Literal('raw')])),
|
|
17
|
+
});
|
|
18
|
+
export const XScalarDefaultRequestBodyView = object({
|
|
19
|
+
'x-scalar-default-request-body-view': optional(union([literal('form'), literal('raw')])),
|
|
20
|
+
}, {
|
|
21
|
+
typeName: 'XScalarDefaultRequestBodyView',
|
|
22
|
+
typeComment: 'Initial request body editor view for structured bodies (form or raw)',
|
|
23
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
2
|
import { type TLiteral } from '@scalar/typebox';
|
|
3
3
|
import type { AsyncApiInfoObject } from '@scalar/types/asyncapi/3.1';
|
|
4
|
-
import type { InfoObject } from '../schemas/v3.
|
|
5
|
-
import type { OperationObject } from '../schemas/v3.
|
|
6
|
-
import type { SchemaObject } from '../schemas/v3.
|
|
7
|
-
import type { TagObject } from '../schemas/v3.
|
|
4
|
+
import type { InfoObject } from '../schemas/v3.2/strict/info.js';
|
|
5
|
+
import type { OperationObject } from '../schemas/v3.2/strict/operation.js';
|
|
6
|
+
import type { SchemaObject } from '../schemas/v3.2/strict/schema.js';
|
|
7
|
+
import type { TagObject } from '../schemas/v3.2/strict/tag.js';
|
|
8
8
|
export declare const NavigationBaseSchemaDefinition: import("@scalar/typebox").TObject<{
|
|
9
9
|
id: import("@scalar/typebox").TString;
|
|
10
10
|
title: import("@scalar/typebox").TString;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTTP_METHODS } from '@scalar/helpers/http/http-methods';
|
|
2
2
|
import { Type } from '@scalar/typebox';
|
|
3
3
|
import { compose } from '../schemas/compose.js';
|
|
4
|
-
import { TraversedEntryObjectRef } from '../schemas/v3.
|
|
4
|
+
import { TraversedEntryObjectRef } from '../schemas/v3.2/strict/ref-definitions.js';
|
|
5
5
|
export const NavigationBaseSchemaDefinition = Type.Object({
|
|
6
6
|
id: Type.String(),
|
|
7
7
|
title: Type.String(),
|