@scalar/workspace-store 0.60.0 → 0.62.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 +68 -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.d.ts.map +1 -1
- package/dist/client.js +10 -4
- package/dist/entities/auth/schema.d.ts +640 -200
- 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-deep.d.ts +1 -1
- package/dist/helpers/get-resolved-ref-deep.d.ts.map +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 +9 -4
- 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 +41 -5
- 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 +14 -8
- 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 +2 -1
- 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/navigation.d.ts +4 -4
- package/dist/schemas/navigation.js +1 -1
- package/dist/schemas/reference-config/index.d.ts +128 -40
- package/dist/schemas/reference-config/index.d.ts.map +1 -1
- package/dist/schemas/reference-config/settings.d.ts +129 -41
- 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.map +1 -1
- package/dist/schemas/v3.1/openapi/index.js +11 -1
- package/dist/schemas/v3.1/strict/callback.d.ts +1 -1
- package/dist/schemas/v3.1/strict/components.d.ts +11 -11
- package/dist/schemas/v3.1/strict/encoding.d.ts +1 -1
- package/dist/schemas/v3.1/strict/header.d.ts +2 -2
- package/dist/schemas/v3.1/strict/media-type.d.ts +2 -2
- package/dist/schemas/v3.1/strict/openapi-document.d.ts +1470 -1260
- package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/operation.d.ts +3 -3
- package/dist/schemas/v3.1/strict/parameter.d.ts +2 -2
- package/dist/schemas/v3.1/strict/path-item.d.ts +10 -10
- package/dist/schemas/v3.1/strict/paths.d.ts +1 -1
- package/dist/schemas/v3.1/strict/reference.d.ts +14 -2
- package/dist/schemas/v3.1/strict/reference.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/reference.js +13 -1
- package/dist/schemas/v3.1/strict/response.d.ts +2 -2
- package/dist/schemas/v3.1/strict/responses.d.ts +1 -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 +16 -1
- package/dist/schemas/v3.2/strict/callback.d.ts +1 -1
- package/dist/schemas/v3.2/strict/components.d.ts +12 -12
- package/dist/schemas/v3.2/strict/encoding.d.ts +1 -1
- package/dist/schemas/v3.2/strict/header.d.ts +2 -2
- package/dist/schemas/v3.2/strict/media-type.d.ts +3 -3
- 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 +2839 -1541
- 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/operation.d.ts +3 -3
- package/dist/schemas/v3.2/strict/parameter.d.ts +2 -2
- package/dist/schemas/v3.2/strict/path-item.d.ts +12 -12
- package/dist/schemas/v3.2/strict/paths.d.ts +1 -1
- package/dist/schemas/v3.2/strict/reference.d.ts +14 -2
- package/dist/schemas/v3.2/strict/reference.d.ts.map +1 -1
- package/dist/schemas/v3.2/strict/reference.js +13 -1
- package/dist/schemas/v3.2/strict/response.d.ts +2 -2
- package/dist/schemas/v3.2/strict/responses.d.ts +1 -1
- package/dist/schemas/v3.2/strict/security-scheme.d.ts +31 -8
- package/dist/schemas/v3.2/strict/security-scheme.d.ts.map +1 -1
- package/dist/schemas/v3.2/strict/security-scheme.js +17 -4
- package/dist/schemas/workspace-specification/index.d.ts +1 -1
- package/dist/schemas/workspace.d.ts +1 -1
- package/dist/server.d.ts +28 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +41 -27
- package/package.json +10 -10
|
@@ -16,7 +16,7 @@ export declare const ResponseObjectSchemaDefinition: import("@scalar/typebox").T
|
|
|
16
16
|
$status: import("@scalar/typebox").TOptional<import("@scalar/typebox").TUnion<[import("@scalar/typebox").TLiteral<"loading">, import("@scalar/typebox").TLiteral<"error">]>>;
|
|
17
17
|
$global: import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
|
|
18
18
|
}>]>, import("@scalar/typebox").TObject<{
|
|
19
|
-
'$ref-value': import("@scalar/typebox").TRef<"HeaderObject"
|
|
19
|
+
'$ref-value': import("@scalar/typebox").TOptional<import("@scalar/typebox").TRef<"HeaderObject">>;
|
|
20
20
|
}>]>]>>>;
|
|
21
21
|
/** A map containing descriptions of potential response payloads. The key is a media type or media type range and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. "text/plain" overrides "text/*" */
|
|
22
22
|
content: import("@scalar/typebox").TOptional<import("@scalar/typebox").TRecord<import("@scalar/typebox").TString, import("@scalar/typebox").TRef<"MediaTypeObject">>>;
|
|
@@ -29,7 +29,7 @@ export declare const ResponseObjectSchemaDefinition: import("@scalar/typebox").T
|
|
|
29
29
|
$status: import("@scalar/typebox").TOptional<import("@scalar/typebox").TUnion<[import("@scalar/typebox").TLiteral<"loading">, import("@scalar/typebox").TLiteral<"error">]>>;
|
|
30
30
|
$global: import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
|
|
31
31
|
}>]>, import("@scalar/typebox").TObject<{
|
|
32
|
-
'$ref-value': import("@scalar/typebox").TRef<"LinkObject"
|
|
32
|
+
'$ref-value': import("@scalar/typebox").TOptional<import("@scalar/typebox").TRef<"LinkObject">>;
|
|
33
33
|
}>]>]>>>;
|
|
34
34
|
}>;
|
|
35
35
|
/**
|
|
@@ -17,7 +17,7 @@ export declare const ResponsesObjectSchemaDefinition: import("@scalar/typebox").
|
|
|
17
17
|
$status: import("@scalar/typebox").TOptional<import("@scalar/typebox").TUnion<[import("@scalar/typebox").TLiteral<"loading">, import("@scalar/typebox").TLiteral<"error">]>>;
|
|
18
18
|
$global: import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
|
|
19
19
|
}>]>, import("@scalar/typebox").TObject<{
|
|
20
|
-
'$ref-value': import("@scalar/typebox").TRef<"ResponseObject"
|
|
20
|
+
'$ref-value': import("@scalar/typebox").TOptional<import("@scalar/typebox").TRef<"ResponseObject">>;
|
|
21
21
|
}>]>]>>;
|
|
22
22
|
/**
|
|
23
23
|
* A container for the expected responses of an operation. The container maps a HTTP response code to the expected response.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type XScalarIgnore } from '../../../schemas/extensions/document/x-scalar-ignore.js';
|
|
1
2
|
import { type XDefaultScopes } from '../../../schemas/extensions/security/x-default-scopes.js';
|
|
2
3
|
import type { OAuthFlowsObject } from '../../../schemas/v3.2/strict/oauthflows.js';
|
|
3
4
|
type Description = {
|
|
@@ -5,7 +6,7 @@ type Description = {
|
|
|
5
6
|
description?: string;
|
|
6
7
|
/** Declares this security scheme to be deprecated. Consumers SHOULD refrain from usage of the declared scheme. Added in OpenAPI 3.2. */
|
|
7
8
|
deprecated?: boolean;
|
|
8
|
-
};
|
|
9
|
+
} & XScalarIgnore;
|
|
9
10
|
export type ApiKeyObject = Description & {
|
|
10
11
|
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
11
12
|
type: 'apiKey';
|
|
@@ -22,12 +23,16 @@ export type HttpObject = Description & {
|
|
|
22
23
|
/** A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. */
|
|
23
24
|
bearerFormat?: string;
|
|
24
25
|
};
|
|
26
|
+
export type MutualTlsObject = Description & {
|
|
27
|
+
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
28
|
+
type: 'mutualTLS';
|
|
29
|
+
};
|
|
25
30
|
export type OAuth2Object = Description & {
|
|
26
31
|
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
27
32
|
type: 'oauth2';
|
|
28
33
|
/** REQUIRED. An object containing configuration information for the flow types supported. */
|
|
29
34
|
flows: OAuthFlowsObject;
|
|
30
|
-
/** URL to the OAuth2 authorization server metadata (RFC8414).
|
|
35
|
+
/** URL to the OAuth2 authorization server metadata (RFC8414). Use HTTPS, or HTTP for local development URLs. Added in OpenAPI 3.2. */
|
|
31
36
|
oauth2MetadataUrl?: string;
|
|
32
37
|
} & XDefaultScopes;
|
|
33
38
|
export type OpenIdConnectObject = Description & {
|
|
@@ -41,55 +46,73 @@ export type OpenIdConnectObject = Description & {
|
|
|
41
46
|
*
|
|
42
47
|
* Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, client credentials and authorization code) as defined in RFC6749, and [[OpenID-Connect-Core]]. Please note that as of 2020, the implicit flow is about to be deprecated by OAuth 2.0 Security Best Current Practice. Recommended for most use cases is Authorization Code Grant flow with PKCE.
|
|
43
48
|
*/
|
|
44
|
-
export declare const SecuritySchemeObjectSchemaDefinition: import("@scalar/typebox").TUnion<[import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TObject<{
|
|
49
|
+
export declare const SecuritySchemeObjectSchemaDefinition: import("@scalar/typebox").TUnion<[import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TObject<{
|
|
45
50
|
/** A description for security scheme. CommonMark syntax MAY be used for rich text representation. */
|
|
46
51
|
description: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
|
|
47
52
|
/** Declares this security scheme to be deprecated. Consumers SHOULD refrain from usage of the declared scheme. Added in OpenAPI 3.2. */
|
|
48
53
|
deprecated: import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
|
|
49
54
|
}>, import("@scalar/typebox").TObject<{
|
|
55
|
+
'x-scalar-ignore': import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
|
|
56
|
+
}>]>, import("@scalar/typebox").TObject<{
|
|
50
57
|
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
51
58
|
type: import("@scalar/typebox").TLiteral<"apiKey">;
|
|
52
59
|
/** REQUIRED. The name of the header, query or cookie parameter to be used. */
|
|
53
60
|
name: import("@scalar/typebox").TString;
|
|
54
61
|
/** REQUIRED. The location of the API key. Valid values are "query", "header", or "cookie". */
|
|
55
62
|
in: import("@scalar/typebox").TUnion<[import("@scalar/typebox").TLiteral<"query">, import("@scalar/typebox").TLiteral<"header">, import("@scalar/typebox").TLiteral<"cookie">]>;
|
|
56
|
-
}>]>, import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TObject<{
|
|
63
|
+
}>]>, import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TObject<{
|
|
57
64
|
/** A description for security scheme. CommonMark syntax MAY be used for rich text representation. */
|
|
58
65
|
description: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
|
|
59
66
|
/** Declares this security scheme to be deprecated. Consumers SHOULD refrain from usage of the declared scheme. Added in OpenAPI 3.2. */
|
|
60
67
|
deprecated: import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
|
|
61
68
|
}>, import("@scalar/typebox").TObject<{
|
|
69
|
+
'x-scalar-ignore': import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
|
|
70
|
+
}>]>, import("@scalar/typebox").TObject<{
|
|
62
71
|
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
63
72
|
type: import("@scalar/typebox").TLiteral<"http">;
|
|
64
73
|
/** REQUIRED. The name of the HTTP Authentication scheme to be used in the Authorization header as defined in RFC7235. The values used SHOULD be registered in the IANA Authentication Scheme registry. The value is case-insensitive, as defined in RFC7235. */
|
|
65
74
|
scheme: import("@scalar/typebox").TUnion<[import("@scalar/typebox").TLiteral<"basic">, import("@scalar/typebox").TLiteral<"bearer">]>;
|
|
66
75
|
/** A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. */
|
|
67
76
|
bearerFormat: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
|
|
68
|
-
}>]>, import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TObject<{
|
|
77
|
+
}>]>, import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TObject<{
|
|
78
|
+
/** A description for security scheme. CommonMark syntax MAY be used for rich text representation. */
|
|
79
|
+
description: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
|
|
80
|
+
/** Declares this security scheme to be deprecated. Consumers SHOULD refrain from usage of the declared scheme. Added in OpenAPI 3.2. */
|
|
81
|
+
deprecated: import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
|
|
82
|
+
}>, import("@scalar/typebox").TObject<{
|
|
83
|
+
'x-scalar-ignore': import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
|
|
84
|
+
}>]>, import("@scalar/typebox").TObject<{
|
|
85
|
+
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
86
|
+
type: import("@scalar/typebox").TLiteral<"mutualTLS">;
|
|
87
|
+
}>]>, import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TObject<{
|
|
69
88
|
/** A description for security scheme. CommonMark syntax MAY be used for rich text representation. */
|
|
70
89
|
description: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
|
|
71
90
|
/** Declares this security scheme to be deprecated. Consumers SHOULD refrain from usage of the declared scheme. Added in OpenAPI 3.2. */
|
|
72
91
|
deprecated: import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
|
|
73
92
|
}>, import("@scalar/typebox").TObject<{
|
|
93
|
+
'x-scalar-ignore': import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
|
|
94
|
+
}>]>, import("@scalar/typebox").TObject<{
|
|
74
95
|
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
75
96
|
type: import("@scalar/typebox").TLiteral<"oauth2">;
|
|
76
97
|
/** REQUIRED. An object containing configuration information for the flow types supported. */
|
|
77
98
|
flows: import("@scalar/typebox").TRef<"OAuthFlowsObject">;
|
|
78
|
-
/** URL to the OAuth2 authorization server metadata (RFC8414).
|
|
99
|
+
/** URL to the OAuth2 authorization server metadata (RFC8414). Use HTTPS, or HTTP for local development URLs. Added in OpenAPI 3.2. */
|
|
79
100
|
oauth2MetadataUrl: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
|
|
80
101
|
}>, import("@scalar/typebox").TObject<{
|
|
81
102
|
'x-default-scopes': import("@scalar/typebox").TOptional<import("@scalar/typebox").TArray<import("@scalar/typebox").TString>>;
|
|
82
|
-
}>]>, import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TObject<{
|
|
103
|
+
}>]>, import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TObject<{
|
|
83
104
|
/** A description for security scheme. CommonMark syntax MAY be used for rich text representation. */
|
|
84
105
|
description: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
|
|
85
106
|
/** Declares this security scheme to be deprecated. Consumers SHOULD refrain from usage of the declared scheme. Added in OpenAPI 3.2. */
|
|
86
107
|
deprecated: import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
|
|
87
108
|
}>, import("@scalar/typebox").TObject<{
|
|
109
|
+
'x-scalar-ignore': import("@scalar/typebox").TOptional<import("@scalar/typebox").TBoolean>;
|
|
110
|
+
}>]>, import("@scalar/typebox").TObject<{
|
|
88
111
|
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
89
112
|
type: import("@scalar/typebox").TLiteral<"openIdConnect">;
|
|
90
113
|
/** REQUIRED. Well-known URL to discover the [[OpenID-Connect-Discovery]] provider metadata. */
|
|
91
114
|
openIdConnectUrl: import("@scalar/typebox").TString;
|
|
92
115
|
}>]>]>;
|
|
93
|
-
export type SecuritySchemeObject = ApiKeyObject | HttpObject | OAuth2Object | OpenIdConnectObject;
|
|
116
|
+
export type SecuritySchemeObject = ApiKeyObject | HttpObject | MutualTlsObject | OAuth2Object | OpenIdConnectObject;
|
|
94
117
|
export {};
|
|
95
118
|
//# sourceMappingURL=security-scheme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-scheme.d.ts","sourceRoot":"","sources":["../../../../src/schemas/v3.2/strict/security-scheme.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,gDAAgD,CAAA;AAC1G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"security-scheme.d.ts","sourceRoot":"","sources":["../../../../src/schemas/v3.2/strict/security-scheme.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,+CAA+C,CAAA;AACvG,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,gDAAgD,CAAA;AAC1G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAexE,KAAK,WAAW,GAAG;IACjB,qGAAqG;IACrG,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,wIAAwI;IACxI,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,GAAG,aAAa,CAAA;AAcjB,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACvC,4HAA4H;IAC5H,IAAI,EAAE,QAAQ,CAAA;IACd,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAA;IACZ,8FAA8F;IAC9F,EAAE,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAA;CAClC,CAAA;AAcD,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IACrC,4HAA4H;IAC5H,IAAI,EAAE,MAAM,CAAA;IACZ,gQAAgQ;IAChQ,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC1B,uMAAuM;IACvM,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAUD,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG;IAC1C,4HAA4H;IAC5H,IAAI,EAAE,WAAW,CAAA;CAClB,CAAA;AAeD,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACvC,4HAA4H;IAC5H,IAAI,EAAE,QAAQ,CAAA;IACd,6FAA6F;IAC7F,KAAK,EAAE,gBAAgB,CAAA;IACvB,sIAAsI;IACtI,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,GAAG,cAAc,CAAA;AAYlB,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,4HAA4H;IAC5H,IAAI,EAAE,eAAe,CAAA;IACrB,+FAA+F;IAC/F,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,oCAAoC;IAlH7C,qGAAqG;;IAErG,wIAAwI;;;;;IAgBxI,4HAA4H;;IAE5H,8EAA8E;;IAE9E,8FAA8F;;;IAtB9F,qGAAqG;;IAErG,wIAAwI;;;;;IAqCxI,4HAA4H;;IAE5H,gQAAgQ;;IAEhQ,uMAAuM;;;IA3CvM,qGAAqG;;IAErG,wIAAwI;;;;;IA0DxI,4HAA4H;;;IA5D5H,qGAAqG;;IAErG,wIAAwI;;;;;IAuExI,4HAA4H;;IAE5H,6FAA6F;;IAE7F,sIAAsI;;;;;IA7EtI,qGAAqG;;IAErG,wIAAwI;;;;;IA6FxI,4HAA4H;;IAE5H,+FAA+F;;MAuBjG,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,UAAU,GAAG,eAAe,GAAG,YAAY,GAAG,mBAAmB,CAAA"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { Type } from '@scalar/typebox';
|
|
2
2
|
import { compose } from '../../../schemas/compose.js';
|
|
3
|
+
import { XScalarIgnoreSchema } from '../../../schemas/extensions/document/x-scalar-ignore.js';
|
|
3
4
|
import { XDefaultScopesSchema } from '../../../schemas/extensions/security/x-default-scopes.js';
|
|
4
5
|
import { OAuthFlowsObjectRef } from '../../../schemas/v3.2/strict/ref-definitions.js';
|
|
5
|
-
|
|
6
|
+
// Shared base for every security scheme: a description plus the ignore extension, so any
|
|
7
|
+
// scheme can be hidden from the auth UI with `x-scalar-ignore`. See documentation/openapi.md.
|
|
8
|
+
const DescriptionSchema = compose(Type.Object({
|
|
6
9
|
/** A description for security scheme. CommonMark syntax MAY be used for rich text representation. */
|
|
7
10
|
description: Type.Optional(Type.String()),
|
|
8
11
|
/** Declares this security scheme to be deprecated. Consumers SHOULD refrain from usage of the declared scheme. Added in OpenAPI 3.2. */
|
|
9
12
|
deprecated: Type.Optional(Type.Boolean()),
|
|
10
|
-
});
|
|
13
|
+
}), XScalarIgnoreSchema);
|
|
11
14
|
const ApiKeySchema = compose(DescriptionSchema, Type.Object({
|
|
12
15
|
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
13
16
|
type: Type.Literal('apiKey'),
|
|
@@ -24,12 +27,16 @@ const HttpSchema = compose(DescriptionSchema, Type.Object({
|
|
|
24
27
|
/** A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. */
|
|
25
28
|
bearerFormat: Type.Optional(Type.String()),
|
|
26
29
|
}));
|
|
30
|
+
const MutualTlsSchema = compose(DescriptionSchema, Type.Object({
|
|
31
|
+
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
32
|
+
type: Type.Literal('mutualTLS'),
|
|
33
|
+
}));
|
|
27
34
|
const OAuth2 = compose(DescriptionSchema, Type.Object({
|
|
28
35
|
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2", "openIdConnect". */
|
|
29
36
|
type: Type.Literal('oauth2'),
|
|
30
37
|
/** REQUIRED. An object containing configuration information for the flow types supported. */
|
|
31
38
|
flows: OAuthFlowsObjectRef,
|
|
32
|
-
/** URL to the OAuth2 authorization server metadata (RFC8414).
|
|
39
|
+
/** URL to the OAuth2 authorization server metadata (RFC8414). Use HTTPS, or HTTP for local development URLs. Added in OpenAPI 3.2. */
|
|
33
40
|
oauth2MetadataUrl: Type.Optional(Type.String()),
|
|
34
41
|
}), XDefaultScopesSchema);
|
|
35
42
|
const OpenIdConnect = compose(DescriptionSchema, Type.Object({
|
|
@@ -43,4 +50,10 @@ const OpenIdConnect = compose(DescriptionSchema, Type.Object({
|
|
|
43
50
|
*
|
|
44
51
|
* Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, client credentials and authorization code) as defined in RFC6749, and [[OpenID-Connect-Core]]. Please note that as of 2020, the implicit flow is about to be deprecated by OAuth 2.0 Security Best Current Practice. Recommended for most use cases is Authorization Code Grant flow with PKCE.
|
|
45
52
|
*/
|
|
46
|
-
export const SecuritySchemeObjectSchemaDefinition = Type.Union([
|
|
53
|
+
export const SecuritySchemeObjectSchemaDefinition = Type.Union([
|
|
54
|
+
ApiKeySchema,
|
|
55
|
+
HttpSchema,
|
|
56
|
+
MutualTlsSchema,
|
|
57
|
+
OAuth2,
|
|
58
|
+
OpenIdConnect,
|
|
59
|
+
]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PartialDeep } from 'type-fest';
|
|
2
|
-
import type { OpenApiDocument } from '../../schemas/v3.
|
|
2
|
+
import type { OpenApiDocument } from '../../schemas/v3.2/strict/openapi-document.js';
|
|
3
3
|
import { type WorkspaceMeta } from '../../schemas/workspace.js';
|
|
4
4
|
import { type Info } from '../../schemas/workspace-specification/info.js';
|
|
5
5
|
export declare const WorkspaceSpecificationSchema: import("@scalar/typebox").TIntersect<[import("@scalar/typebox").TObject<{
|
|
@@ -6,7 +6,7 @@ import { type XScalarCookies } from '../schemas/extensions/general/x-scalar-cook
|
|
|
6
6
|
import { type XScalarOrder } from '../schemas/extensions/general/x-scalar-order.js';
|
|
7
7
|
import { type XScalarActiveProxy } from '../schemas/extensions/workspace/x-scalar-active-proxy.js';
|
|
8
8
|
import { type XScalarTabs } from '../schemas/extensions/workspace/x-scalar-tabs.js';
|
|
9
|
-
import type { OpenAPIExtensions, OpenApiDocument } from './v3.
|
|
9
|
+
import type { OpenAPIExtensions, OpenApiDocument } from './v3.2/strict/openapi-document.js';
|
|
10
10
|
export type WorkspaceDocumentMeta = Omit<OpenAPIExtensions, 'x-original-oas-version' | 'x-scalar-original-source-url' | 'x-scalar-original-document-hash'>;
|
|
11
11
|
export type WorkspaceDocument = OpenApiDocument | AsyncApiDocument;
|
|
12
12
|
export declare const ColorModeSchema: import("@scalar/typebox").TUnion<[import("@scalar/typebox").TLiteral<"system">, import("@scalar/typebox").TLiteral<"light">, import("@scalar/typebox").TLiteral<"dark">]>;
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NavigationOptions } from './navigation/get-navigation-options.js';
|
|
2
|
-
import { type OpenApiDocument, type OperationObject, type PathsObject } from './schemas/v3.
|
|
2
|
+
import { type OpenApiDocument, type OperationObject, type PathsObject } from './schemas/v3.2/strict/openapi-document.js';
|
|
3
3
|
import type { Workspace, WorkspaceDocumentMeta, WorkspaceMeta } from './schemas/workspace.js';
|
|
4
4
|
export declare const WORKSPACE_FILE_NAME = "scalar-workspace.json";
|
|
5
5
|
type WorkspaceDocumentMetaInput = {
|
|
@@ -178,6 +178,33 @@ export type ServerWorkspaceStore = {
|
|
|
178
178
|
* @returns The resolved chunk, or `undefined` when not found
|
|
179
179
|
*/
|
|
180
180
|
get: (pointer: string) => unknown;
|
|
181
|
+
/**
|
|
182
|
+
* Returns a document whole, with local references resolving, for rendering on the server.
|
|
183
|
+
*
|
|
184
|
+
* `getWorkspace()` hands back the sparse document: every component and operation is a reference
|
|
185
|
+
* to a chunk, which is what the browser wants so it can load only what a page needs. A server
|
|
186
|
+
* render wants the opposite — the complete document, read through one reference, with `$ref-value`
|
|
187
|
+
* resolving locally and nothing fetched. That is the document the store built its navigation and
|
|
188
|
+
* chunks from, so this is that object rather than a second copy: it shares the components and
|
|
189
|
+
* operations the chunks are written from, and carries the same metadata and navigation as the
|
|
190
|
+
* sparse document.
|
|
191
|
+
*
|
|
192
|
+
* It is a magic proxy, never reactive, so reading it costs a property lookup and a pointer
|
|
193
|
+
* resolution. Use `getRaw` to serialize it: `$ref-value` is enumerable on the proxy and would
|
|
194
|
+
* inline every referenced value beside its `$ref`.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```ts
|
|
198
|
+
* const document = store.getResolvedDocument('petstore')
|
|
199
|
+
*
|
|
200
|
+
* // A real operation, not a chunk reference
|
|
201
|
+
* document?.paths?.['/pets']?.get
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* @param name - The document name it was added under
|
|
205
|
+
* @returns The resolved document, or `undefined` when no document has that name
|
|
206
|
+
*/
|
|
207
|
+
getResolvedDocument: (name: string) => ServerWorkspace['documents'][string] | undefined;
|
|
181
208
|
};
|
|
182
209
|
/**
|
|
183
210
|
* Create server state workspace store
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"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"}
|
package/dist/server.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
1
|
import { cwd } from 'node:process';
|
|
3
2
|
import { upgrade as upgradeAsyncApi } from '@scalar/asyncapi-upgrader';
|
|
3
|
+
import { isHttpMethod } from '@scalar/helpers/http/is-http-method';
|
|
4
4
|
import { parseJsonPointerSegments } from '@scalar/helpers/json/parse-json-pointer-segments';
|
|
5
5
|
import { getValueAtPath } from '@scalar/helpers/object/get-value-at-path';
|
|
6
6
|
import { preventPollution } from '@scalar/helpers/object/prevent-pollution';
|
|
7
7
|
import { extensions as bundleExtensions } from '@scalar/json-magic/bundle';
|
|
8
8
|
import { fetchUrls, readFiles } from '@scalar/json-magic/bundle/plugins/node';
|
|
9
9
|
import { escapeJsonPointer } from '@scalar/json-magic/helpers/escape-json-pointer';
|
|
10
|
+
import { unescapeJsonPointer } from '@scalar/json-magic/helpers/unescape-json-pointer';
|
|
10
11
|
import { createMagicProxy, getRaw } from '@scalar/json-magic/magic-proxy';
|
|
11
12
|
import { upgrade } from '@scalar/openapi-upgrader';
|
|
12
13
|
import { asyncApiObjectSchema } from '@scalar/schemas/asyncapi/3.1';
|
|
13
14
|
import { coerce } from '@scalar/validation';
|
|
15
|
+
import { createChunkWriter } from './helpers/create-chunk-writer.js';
|
|
14
16
|
import { deepClone } from './helpers/deep-clone.js';
|
|
17
|
+
import { encodeChunkName } from './helpers/encode-chunk-name.js';
|
|
15
18
|
import { forEachPathItemOperation, getResolvedPathItem } from './helpers/for-each-path-item-operation.js';
|
|
16
19
|
import { keyOf } from './helpers/general.js';
|
|
17
20
|
import { getResolvedRef } from './helpers/get-resolved-ref.js';
|
|
@@ -20,10 +23,9 @@ import { createNavigation, traverseAsyncApiDocument } from './navigation/index.j
|
|
|
20
23
|
import { extensions } from './schemas/extensions.js';
|
|
21
24
|
import { isAsyncApiDocument } from './schemas/type-guards.js';
|
|
22
25
|
import { coerceValue } from './schemas/typebox-coerce.js';
|
|
23
|
-
import { OpenAPIDocumentSchema, } from './schemas/v3.
|
|
26
|
+
import { OpenAPIDocumentSchema, } from './schemas/v3.2/strict/openapi-document.js';
|
|
24
27
|
const DEFAULT_ASSETS_FOLDER = 'assets';
|
|
25
28
|
export const WORKSPACE_FILE_NAME = 'scalar-workspace.json';
|
|
26
|
-
const httpMethods = new Set(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']);
|
|
27
29
|
/**
|
|
28
30
|
* Wraps a document so local `$ref`s resolve while the store inspects it.
|
|
29
31
|
*
|
|
@@ -100,11 +102,14 @@ const preserveBundledExternals = (source, target) => {
|
|
|
100
102
|
*/
|
|
101
103
|
export function filterHttpMethodsOnly(paths) {
|
|
102
104
|
const result = {};
|
|
103
|
-
// Todo: skip extension properties
|
|
104
105
|
for (const [path, pathItemRef] of Object.entries(paths)) {
|
|
106
|
+
// Paths Object extensions can contain objects that resemble HTTP operations.
|
|
107
|
+
if (path.startsWith('x-')) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
105
110
|
const filteredMethods = {};
|
|
106
111
|
forEachPathItemOperation(pathItemRef, (method, operation) => {
|
|
107
|
-
if (
|
|
112
|
+
if (isHttpMethod(method)) {
|
|
108
113
|
// Unwrapped because the caller hands us a resolved document. A magic proxy enumerates a
|
|
109
114
|
// virtual `$ref-value`, so storing one would inline every referenced component beside its
|
|
110
115
|
// `$ref` when the chunk is written — and a self-referential schema would never finish
|
|
@@ -153,10 +158,7 @@ export function externalizeComponentReferences(document, meta) {
|
|
|
153
158
|
Object.keys(component).forEach((name) => {
|
|
154
159
|
const ref = meta.mode === 'ssr'
|
|
155
160
|
? `${meta.baseUrl}/${meta.name}/components/${type}/${name}#`
|
|
156
|
-
:
|
|
157
|
-
// by generateWorkspaceChunks, and so a key like `../../evil` cannot point outside the
|
|
158
|
-
// chunks directory.
|
|
159
|
-
`./chunks/${meta.name}/components/${escapeJsonPointer(type)}/${escapeJsonPointer(name)}.json#`;
|
|
161
|
+
: `./chunks/${encodeChunkName(meta.name)}/components/${encodeChunkName(type)}/${encodeChunkName(name)}.json#`;
|
|
160
162
|
result[type][name] = { '$ref': ref, $global: true };
|
|
161
163
|
});
|
|
162
164
|
});
|
|
@@ -179,10 +181,10 @@ export function externalizePathReferences(document, meta) {
|
|
|
179
181
|
result[path] = {};
|
|
180
182
|
const escapedPath = escapeJsonPointer(path);
|
|
181
183
|
keyOf(pathItemRecord).forEach((type) => {
|
|
182
|
-
if (
|
|
184
|
+
if (isHttpMethod(type)) {
|
|
183
185
|
const ref = meta.mode === 'ssr'
|
|
184
186
|
? `${meta.baseUrl}/${meta.name}/operations/${escapedPath}/${type}#`
|
|
185
|
-
: `./chunks/${meta.name}/operations/${
|
|
187
|
+
: `./chunks/${encodeChunkName(meta.name)}/operations/${encodeChunkName(path)}/${type}.json#`;
|
|
186
188
|
result[path][type] = { '$ref': ref, $global: true };
|
|
187
189
|
}
|
|
188
190
|
else if (type !== '$ref' && type !== '$ref-value') {
|
|
@@ -256,6 +258,13 @@ export async function createServerWorkspaceStore(workspaceProps) {
|
|
|
256
258
|
* for that document.
|
|
257
259
|
*/
|
|
258
260
|
const assets = {};
|
|
261
|
+
/**
|
|
262
|
+
* Each document whole, for `getResolvedDocument`.
|
|
263
|
+
*
|
|
264
|
+
* Written at the same point as `workspace.documents`, after everything that can throw, so a failed
|
|
265
|
+
* add leaves neither map with a half-processed entry.
|
|
266
|
+
*/
|
|
267
|
+
const resolvedDocuments = {};
|
|
259
268
|
/**
|
|
260
269
|
* Adds an AsyncAPI document to the workspace.
|
|
261
270
|
*
|
|
@@ -304,6 +313,9 @@ export async function createServerWorkspaceStore(workspaceProps) {
|
|
|
304
313
|
// checks OpenAPI first — so leaving `openapi` in place would hand an OpenAPI renderer a
|
|
305
314
|
// navigation tree of channel entries. The document is stored as the type it was read as.
|
|
306
315
|
delete workspace.documents[name]['openapi'];
|
|
316
|
+
// Nothing was externalized, so the stored document already is the whole document; it only needs
|
|
317
|
+
// its references resolving to be rendered from.
|
|
318
|
+
resolvedDocuments[name] = resolveLocalReferences(workspace.documents[name]);
|
|
307
319
|
};
|
|
308
320
|
/**
|
|
309
321
|
* Adds a new document to the workspace.
|
|
@@ -362,6 +374,13 @@ export async function createServerWorkspaceStore(workspaceProps) {
|
|
|
362
374
|
paths,
|
|
363
375
|
[extensions.document.navigation]: navigation,
|
|
364
376
|
};
|
|
377
|
+
// The same document without the externalization, for server rendering. A shallow spread, so the
|
|
378
|
+
// components and operations are the objects the chunks are written from rather than copies.
|
|
379
|
+
resolvedDocuments[meta.name] = resolveLocalReferences({
|
|
380
|
+
...documentMeta,
|
|
381
|
+
...documentV3,
|
|
382
|
+
[extensions.document.navigation]: navigation,
|
|
383
|
+
});
|
|
365
384
|
};
|
|
366
385
|
/**
|
|
367
386
|
* Adds a new document to the workspace asynchronously.
|
|
@@ -415,32 +434,26 @@ export async function createServerWorkspaceStore(workspaceProps) {
|
|
|
415
434
|
}
|
|
416
435
|
// Write the workspace document
|
|
417
436
|
const basePath = `${cwd()}/${workspaceProps.directory ?? DEFAULT_ASSETS_FOLDER}`;
|
|
418
|
-
await
|
|
419
|
-
|
|
420
|
-
await fs.writeFile(`${basePath}/${WORKSPACE_FILE_NAME}`, JSON.stringify(workspace));
|
|
421
|
-
// Write the chunks
|
|
437
|
+
const writeChunk = await createChunkWriter(basePath);
|
|
438
|
+
await writeChunk([WORKSPACE_FILE_NAME], workspace);
|
|
422
439
|
for (const [name, { components, operations }] of Object.entries(assets)) {
|
|
423
|
-
// Write the components chunks
|
|
424
440
|
if (components) {
|
|
425
441
|
for (const [type, component] of Object.entries(components)) {
|
|
426
|
-
// Escape the component type and key the same way operation paths are escaped. Component
|
|
427
|
-
// keys come from the OpenAPI document, so a key like `../../evil` would otherwise let a
|
|
428
|
-
// document write chunk files outside the assets directory. escapeJsonPointer turns every
|
|
429
|
-
// `/` into `~1`, collapsing the value into a single safe path segment.
|
|
430
|
-
const componentPath = `${basePath}/chunks/${name}/components/${escapeJsonPointer(type)}`;
|
|
431
|
-
await fs.mkdir(componentPath, { recursive: true });
|
|
432
442
|
for (const [key, value] of Object.entries(component)) {
|
|
433
|
-
await
|
|
443
|
+
await writeChunk(['chunks', encodeChunkName(name), 'components', encodeChunkName(type), `${encodeChunkName(key)}.json`], value);
|
|
434
444
|
}
|
|
435
445
|
}
|
|
436
446
|
}
|
|
437
|
-
// Write the operations chunks
|
|
438
447
|
if (operations) {
|
|
439
448
|
for (const [path, methods] of Object.entries(operations)) {
|
|
440
|
-
const operationPath = `${basePath}/chunks/${name}/operations/${path}`;
|
|
441
|
-
await fs.mkdir(operationPath, { recursive: true });
|
|
442
449
|
for (const [method, operation] of Object.entries(methods)) {
|
|
443
|
-
await
|
|
450
|
+
await writeChunk([
|
|
451
|
+
'chunks',
|
|
452
|
+
encodeChunkName(name),
|
|
453
|
+
'operations',
|
|
454
|
+
encodeChunkName(unescapeJsonPointer(path)),
|
|
455
|
+
`${encodeChunkName(method)}.json`,
|
|
456
|
+
], operation);
|
|
444
457
|
}
|
|
445
458
|
}
|
|
446
459
|
}
|
|
@@ -449,6 +462,7 @@ export async function createServerWorkspaceStore(workspaceProps) {
|
|
|
449
462
|
getWorkspace: () => {
|
|
450
463
|
return workspace;
|
|
451
464
|
},
|
|
465
|
+
getResolvedDocument: (name) => resolvedDocuments[name],
|
|
452
466
|
get: (pointer) => {
|
|
453
467
|
const pointerPath = (() => {
|
|
454
468
|
if (pointer.startsWith('#')) {
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"openapi",
|
|
17
17
|
"scalar"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.
|
|
19
|
+
"version": "0.62.0",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=22"
|
|
22
22
|
},
|
|
@@ -143,19 +143,19 @@
|
|
|
143
143
|
"CHANGELOG.md"
|
|
144
144
|
],
|
|
145
145
|
"dependencies": {
|
|
146
|
+
"@scalar/asyncapi-upgrader": "0.1.10",
|
|
147
|
+
"@scalar/helpers": "0.12.0",
|
|
148
|
+
"@scalar/json-magic": "0.14.0",
|
|
149
|
+
"@scalar/openapi-upgrader": "0.2.17",
|
|
150
|
+
"@scalar/schemas": "0.10.0",
|
|
151
|
+
"@scalar/snippetz": "0.9.31",
|
|
146
152
|
"@scalar/typebox": "0.1.3",
|
|
153
|
+
"@scalar/types": "0.20.0",
|
|
154
|
+
"@scalar/validation": "0.6.3",
|
|
147
155
|
"js-base64": "^3.9.2",
|
|
148
156
|
"type-fest": "^5.8.0",
|
|
149
157
|
"vue": "^3.5.40",
|
|
150
|
-
"yaml": "^2.9.0"
|
|
151
|
-
"@scalar/asyncapi-upgrader": "0.1.9",
|
|
152
|
-
"@scalar/helpers": "0.11.3",
|
|
153
|
-
"@scalar/json-magic": "0.13.4",
|
|
154
|
-
"@scalar/openapi-upgrader": "0.2.15",
|
|
155
|
-
"@scalar/schemas": "0.9.0",
|
|
156
|
-
"@scalar/snippetz": "0.9.30",
|
|
157
|
-
"@scalar/validation": "0.6.3",
|
|
158
|
-
"@scalar/types": "0.19.0"
|
|
158
|
+
"yaml": "^2.9.0"
|
|
159
159
|
},
|
|
160
160
|
"devDependencies": {
|
|
161
161
|
"@google-cloud/storage": "7.21.0",
|