@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
|
@@ -45,7 +45,7 @@ export const fetchRequestToHar = async ({ requestPayload, includeBody = true, ht
|
|
|
45
45
|
// Read the request body if requested
|
|
46
46
|
const bodyDetails = await (async () => {
|
|
47
47
|
if (includeBody && requestInit.body != null) {
|
|
48
|
-
const details = await processRequestBody(requestInit.body, mimeType);
|
|
48
|
+
const details = await processRequestBody(requestInit.body, _headers.get('content-type') ?? mimeType, bodySizeLimit);
|
|
49
49
|
if (details.size <= bodySizeLimit) {
|
|
50
50
|
return details;
|
|
51
51
|
}
|
|
@@ -80,7 +80,17 @@ export const fetchRequestToHar = async ({ requestPayload, includeBody = true, ht
|
|
|
80
80
|
* Because we own the RequestInit tuple we can inspect the body by type directly —
|
|
81
81
|
* no stream cloning or header sniffing required.
|
|
82
82
|
*/
|
|
83
|
-
const processRequestBody = async (body, contentType) => {
|
|
83
|
+
const processRequestBody = async (body, contentType, bodySizeLimit) => {
|
|
84
|
+
if (body instanceof Blob && contentType.toLowerCase().startsWith('multipart/form-data;')) {
|
|
85
|
+
if (body.size > bodySizeLimit) {
|
|
86
|
+
return { text: '', size: -1 };
|
|
87
|
+
}
|
|
88
|
+
// Raw uploads can contain malformed multipart data. History must still record the response.
|
|
89
|
+
const form = await new Response(body, { headers: { 'content-type': contentType } })
|
|
90
|
+
.formData()
|
|
91
|
+
.catch(() => undefined);
|
|
92
|
+
return form ? { ...extractFormDataParams(form), size: body.size } : { text: '', size: -1 };
|
|
93
|
+
}
|
|
84
94
|
// Structured form payloads become a params array so HAR viewers can render them as key/value tables
|
|
85
95
|
if (body instanceof FormData) {
|
|
86
96
|
return extractFormDataParams(body);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HarRequest } from '@scalar/snippetz';
|
|
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
|
type HarToOperationProps = {
|
|
4
4
|
/** HAR request to convert */
|
|
5
5
|
harRequest: HarRequest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"har-to-operation.d.ts","sourceRoot":"","sources":["../../../../src/mutators/operation/helpers/har-to-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,8DAA8D,CAAA;AAKpH,KAAK,mBAAmB,GAAG;IACzB,6BAA6B;IAC7B,UAAU,EAAE,UAAU,CAAA;IACtB,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,eAAe,CAAA;IAC/B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC,CAAA;AAyBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GAAI,2DAK5B,mBAAmB,KAAG,
|
|
1
|
+
{"version":3,"file":"har-to-operation.d.ts","sourceRoot":"","sources":["../../../../src/mutators/operation/helpers/har-to-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,8DAA8D,CAAA;AAKpH,KAAK,mBAAmB,GAAG;IACzB,6BAA6B;IAC7B,UAAU,EAAE,UAAU,CAAA;IACtB,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,eAAe,CAAA;IAC/B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC,CAAA;AAyBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GAAI,2DAK5B,mBAAmB,KAAG,eA0HxB,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref';
|
|
2
|
-
import { isContentTypeParameterObject } from '../../../schemas/v3.
|
|
2
|
+
import { isContentTypeParameterObject } from '../../../schemas/v3.2/strict/type-guards.js';
|
|
3
3
|
const preprocessParameters = (parameters, pathVariables, exampleKey) => {
|
|
4
4
|
parameters.forEach((param) => {
|
|
5
5
|
const resolvedParam = getResolvedRef(param);
|
|
6
|
-
if (isContentTypeParameterObject(resolvedParam)) {
|
|
6
|
+
if (!resolvedParam || isContentTypeParameterObject(resolvedParam)) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
-
setParameterDisabled(
|
|
9
|
+
setParameterDisabled(resolvedParam, exampleKey, true);
|
|
10
10
|
if (resolvedParam.in === 'path') {
|
|
11
11
|
resolvedParam.examples ||= {};
|
|
12
12
|
resolvedParam.examples[exampleKey] = {
|
|
@@ -98,6 +98,8 @@ export const harToOperation = ({ harRequest, exampleKey, baseOperation = {}, pat
|
|
|
98
98
|
}
|
|
99
99
|
// Resolve the request body in case it is a reference
|
|
100
100
|
const requestBody = getResolvedRef(baseOperation.requestBody);
|
|
101
|
+
if (!requestBody)
|
|
102
|
+
return baseOperation;
|
|
101
103
|
// Ensure the content type exists in the requestBody
|
|
102
104
|
if (!requestBody.content[mimeType]) {
|
|
103
105
|
requestBody.content[mimeType] = {
|
|
@@ -147,7 +149,9 @@ const setParameterDisabled = (param, exampleKey, disabled) => {
|
|
|
147
149
|
if (!param.examples?.[exampleKey]) {
|
|
148
150
|
return;
|
|
149
151
|
}
|
|
150
|
-
getResolvedRef(param.examples[exampleKey])
|
|
152
|
+
const example = getResolvedRef(param.examples[exampleKey]);
|
|
153
|
+
if (example)
|
|
154
|
+
example['x-disabled'] = disabled;
|
|
151
155
|
};
|
|
152
156
|
/**
|
|
153
157
|
* Finds an existing parameter in the parameters array or creates a new one.
|
|
@@ -157,7 +161,7 @@ const findOrCreateParameter = (parameters, name, inValue) => {
|
|
|
157
161
|
// Try to find existing parameter using getResolvedRef to handle references
|
|
158
162
|
for (const param of parameters) {
|
|
159
163
|
const resolved = getResolvedRef(param);
|
|
160
|
-
if (isContentTypeParameterObject(resolved)) {
|
|
164
|
+
if (!resolved || isContentTypeParameterObject(resolved)) {
|
|
161
165
|
continue;
|
|
162
166
|
}
|
|
163
167
|
// Check if parameter location matches
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ParameterObject } from '../../../schemas/v3.
|
|
2
|
-
import type { ReferenceType } from '../../../schemas/v3.
|
|
1
|
+
import type { ParameterObject } from '../../../schemas/v3.2/strict/parameter.js';
|
|
2
|
+
import type { ReferenceType } from '../../../schemas/v3.2/strict/reference.js';
|
|
3
3
|
export type MinimalParameterObject = Pick<ParameterObject, 'name' | 'in'>;
|
|
4
4
|
/**
|
|
5
5
|
* Synchronizes path parameters when a path string changes.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getPathItemOperation } from '../../helpers/for-each-path-item-operation.js';
|
|
2
2
|
import { getResolvedRef } from '../../helpers/get-resolved-ref.js';
|
|
3
3
|
import { isOpenApiDocument } from '../../schemas/type-guards.js';
|
|
4
|
-
import { isContentTypeParameterObject } from '../../schemas/v3.
|
|
4
|
+
import { isContentTypeParameterObject } from '../../schemas/v3.2/strict/type-guards.js';
|
|
5
5
|
import { fetchRequestToHar } from './helpers/fetch-request-to-har.js';
|
|
6
6
|
import { fetchResponseToHar } from './helpers/fetch-response-to-har.js';
|
|
7
7
|
import { harToOperation } from './helpers/har-to-operation.js';
|
|
@@ -21,7 +21,7 @@ export const addResponseToHistory = async (store, document, { payload, meta }) =
|
|
|
21
21
|
// Get all the variables from the operation parameters
|
|
22
22
|
const variables = operationParameters.reduce((acc, param) => {
|
|
23
23
|
const resolvedParam = getResolvedRef(param);
|
|
24
|
-
if (isContentTypeParameterObject(resolvedParam)) {
|
|
24
|
+
if (!resolvedParam || isContentTypeParameterObject(resolvedParam)) {
|
|
25
25
|
return acc;
|
|
26
26
|
}
|
|
27
27
|
if (resolvedParam.in === 'path') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/mutators/operation/operation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/mutators/operation/operation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAarE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAGlD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,eAAe,GAC1B,gBAAgB,cAAc,GAAG,IAAI,EACrC,SAAS,eAAe,CAAC,4BAA4B,CAAC,KACrD,MAAM,GAAG,SA0DX,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,cAAc,GAAG,IAAI,EAC5B,UAAU,iBAAiB,GAAG,IAAI,EAClC,mBAAmB,eAAe,CAAC,uBAAuB,CAAC,SAsB5D,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,yBAAyB,GACpC,UAAU,iBAAiB,GAAG,IAAI,EAClC,OAAO,cAAc,GAAG,IAAI,EAC5B,mEAAmE,eAAe,CAAC,6BAA6B,CAAC,KAChH,IAoGF,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,WAAW,cAAc,GAAG,IAAI,EAChC,wBAAwB,eAAe,CAAC,4BAA4B,CAAC,SAgBtE,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GACtC,WAAW,cAAc,GAAG,IAAI,EAChC,uDAAuD,eAAe,CAAC,gCAAgC,CAAC,SAuBzG,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,WAAW,cAAc,GAAG,IAAI,EAChC,sDAAsD,eAAe,CAAC,0BAA0B,CAAC,SAkDlG,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GACjC,WAAW,cAAc,GAAG,IAAI,EAChC,+DAA+D,eAAe,CAAC,0BAA0B,CAAC,SAwE3G,CAAA"}
|
|
@@ -277,6 +277,8 @@ export const deleteOperationExample = (workspace, { meta: { path, method, exampl
|
|
|
277
277
|
// Remove the example from all operation parameters
|
|
278
278
|
operation.parameters?.forEach((parameter) => {
|
|
279
279
|
const resolvedParameter = getResolvedRef(parameter);
|
|
280
|
+
if (!resolvedParameter)
|
|
281
|
+
return;
|
|
280
282
|
// Remove from content-level examples (if parameter uses content)
|
|
281
283
|
if ('content' in resolvedParameter && resolvedParameter.content) {
|
|
282
284
|
Object.values(resolvedParameter.content).forEach((mediaType) => {
|
|
@@ -326,6 +328,8 @@ export const renameOperationExample = (workspace, { meta: { path, method, exampl
|
|
|
326
328
|
const records = [];
|
|
327
329
|
operation.parameters?.forEach((parameter) => {
|
|
328
330
|
const resolvedParameter = getResolvedRef(parameter);
|
|
331
|
+
if (!resolvedParameter)
|
|
332
|
+
return;
|
|
329
333
|
if ('examples' in resolvedParameter && resolvedParameter.examples) {
|
|
330
334
|
records.push(resolvedParameter.examples);
|
|
331
335
|
}
|
|
@@ -193,5 +193,5 @@ export const deleteAllOperationParameters = (document, { meta, type }) => {
|
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
195
|
// Filter out parameters of the specified type
|
|
196
|
-
operation.parameters = operation.parameters?.filter((it) => getResolvedRef(it)
|
|
196
|
+
operation.parameters = operation.parameters?.filter((it) => getResolvedRef(it)?.in !== type) ?? [];
|
|
197
197
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AsyncApiServerVariableObject } from '@scalar/types/asyncapi/3.1';
|
|
2
2
|
import type { ServerEvents } from '../events/definitions/server.js';
|
|
3
|
-
import { type ServerObject } from '../schemas/v3.
|
|
3
|
+
import { type ServerObject } from '../schemas/v3.2/strict/openapi-document.js';
|
|
4
4
|
import type { WorkspaceDocument } from '../schemas/workspace.js';
|
|
5
5
|
/**
|
|
6
6
|
* Initializes the servers for the document or operation based on meta.
|
|
@@ -53,7 +53,7 @@ export declare const clearServers: (document: WorkspaceDocument | null, { meta }
|
|
|
53
53
|
* @param meta - Target context (document or operation)
|
|
54
54
|
* @returns the updated variable or undefined if the variable is not found
|
|
55
55
|
*/
|
|
56
|
-
export declare const updateServerVariables: (document: WorkspaceDocument | null, { index, key, value, meta }: ServerEvents["server:update:variables"]) => import("../schemas/v3.
|
|
56
|
+
export declare const updateServerVariables: (document: WorkspaceDocument | null, { index, key, value, meta }: ServerEvents["server:update:variables"]) => import("../schemas/v3.2/strict/openapi-document.js").ServerVariableObject | undefined;
|
|
57
57
|
/**
|
|
58
58
|
* Updates the selected server for the document or operation based on meta.
|
|
59
59
|
*
|
|
@@ -94,7 +94,7 @@ export declare const serverMutatorsFactory: ({ document }: {
|
|
|
94
94
|
updateServer: (payload: ServerEvents["server:update:server"]) => ServerObject | undefined;
|
|
95
95
|
deleteServer: (payload: ServerEvents["server:delete:server"]) => void;
|
|
96
96
|
clearServers: (payload: ServerEvents["server:clear:servers"]) => void;
|
|
97
|
-
updateServerVariables: (payload: ServerEvents["server:update:variables"]) => import("../schemas/v3.
|
|
97
|
+
updateServerVariables: (payload: ServerEvents["server:update:variables"]) => import("../schemas/v3.2/strict/openapi-document.js").ServerVariableObject | undefined;
|
|
98
98
|
updateSelectedServer: (payload: ServerEvents["server:update:selected"]) => string | undefined;
|
|
99
99
|
updateSelectedAsyncApiServer: (payload: ServerEvents["asyncapi-server:update:selected"]) => string | undefined;
|
|
100
100
|
updateAsyncApiServerVariables: (payload: ServerEvents["asyncapi-server:update:variables"]) => AsyncApiServerVariableObject | undefined;
|
package/dist/mutators/server.js
CHANGED
|
@@ -4,7 +4,7 @@ import { getResolvedRef } from '../helpers/get-resolved-ref.js';
|
|
|
4
4
|
import { unpackProxyObject } from '../helpers/unpack-proxy.js';
|
|
5
5
|
import { isAsyncApiDocument, isOpenApiDocument } from '../schemas/type-guards.js';
|
|
6
6
|
import { coerceValue } from '../schemas/typebox-coerce.js';
|
|
7
|
-
import { ServerObjectSchema } from '../schemas/v3.
|
|
7
|
+
import { ServerObjectSchema } from '../schemas/v3.2/strict/openapi-document.js';
|
|
8
8
|
/**
|
|
9
9
|
* Resolves the server target (document or operation) from meta.
|
|
10
10
|
* Document-level servers live on the document; operation-level servers on the operation object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../src/mutators/tag.ts"],"names":[],"mapp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A"}
|
package/dist/mutators/tag.js
CHANGED
|
@@ -112,6 +112,8 @@ export const deleteTag = (workspace, payload) => {
|
|
|
112
112
|
Object.values(document.paths ?? {}).forEach((pathItemRef) => {
|
|
113
113
|
forEachPathItemOperation(pathItemRef, (_method, operationRef) => {
|
|
114
114
|
const resolvedOperation = getResolvedRef(operationRef);
|
|
115
|
+
if (!resolvedOperation)
|
|
116
|
+
return;
|
|
115
117
|
if ('tags' in resolvedOperation) {
|
|
116
118
|
const plainTags = unpackProxyObject(resolvedOperation.tags, { depth: 1 });
|
|
117
119
|
resolvedOperation.tags = plainTags?.filter((tag) => tag !== payload.name);
|
|
@@ -122,6 +124,8 @@ export const deleteTag = (workspace, payload) => {
|
|
|
122
124
|
Object.values(document.webhooks ?? {}).forEach((pathItemRef) => {
|
|
123
125
|
forEachPathItemOperation(pathItemRef, (_method, operationRef) => {
|
|
124
126
|
const resolvedOperation = getResolvedRef(operationRef);
|
|
127
|
+
if (!resolvedOperation)
|
|
128
|
+
return;
|
|
125
129
|
const plainTags = unpackProxyObject(resolvedOperation.tags, { depth: 1 });
|
|
126
130
|
resolvedOperation.tags = plainTags?.filter((tag) => tag !== payload.name);
|
|
127
131
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WorkspaceStore } from '../../client.js';
|
|
2
2
|
import type { WorkspaceDocument } from '../../schemas.js';
|
|
3
3
|
import type { TraversedDocument, TraversedEntry, TraversedOperation, TraversedTag } from '../../schemas/navigation.js';
|
|
4
|
-
import type { OperationObject, TagObject } from '../../schemas/v3.
|
|
4
|
+
import type { OperationObject, TagObject } from '../../schemas/v3.2/strict/openapi-document.js';
|
|
5
5
|
type TraversedOrderable = TraversedDocument | TraversedTag | TraversedOperation;
|
|
6
6
|
type GetOpenapiObject<Entry extends TraversedOrderable> = Entry extends TraversedDocument ? WorkspaceDocument : Entry extends TraversedTag ? TagObject : Entry extends TraversedOperation ? OperationObject : never;
|
|
7
7
|
/** Type guard which checks if the entry has an x-scalar-order property */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-asyncapi-document.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-asyncapi-document.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAyB,gBAAgB,EAA2B,MAAM,4BAA4B,CAAA;AAKlH,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,qCAAqC,CAAA;AAOlG,OAAO,KAAK,EAKV,iBAAiB,EAGlB,MAAM,sBAAsB,CAAA;AAM7B,oFAAoF;AACpF,KAAK,wCAAwC,GAAG,gBAAgB,GAAG;IACjE,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;
|
|
1
|
+
{"version":3,"file":"traverse-asyncapi-document.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-asyncapi-document.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAyB,gBAAgB,EAA2B,MAAM,4BAA4B,CAAA;AAKlH,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,qCAAqC,CAAA;AAOlG,OAAO,KAAK,EAKV,iBAAiB,EAGlB,MAAM,sBAAsB,CAAA;AAM7B,oFAAoF;AACpF,KAAK,wCAAwC,GAAG,gBAAgB,GAAG;IACjE,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAiiBD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,GACnC,cAAc,MAAM,EACpB,UAAU,wCAAwC,EAClD,UAAU,iBAAiB,KAC1B,iBA+HF,CAAA"}
|
|
@@ -236,8 +236,8 @@ const createChannelEntry = ({ bucket, operationEntries, generateId, parentId, pa
|
|
|
236
236
|
// We skip channels that are stored as references, since the order should live on the target.
|
|
237
237
|
const channelNode = document.channels?.[bucket.channelName];
|
|
238
238
|
if (channelNode && !('$ref' in channelNode)) {
|
|
239
|
-
;
|
|
240
|
-
|
|
239
|
+
const orderedChannel = channelNode;
|
|
240
|
+
orderedChannel['x-scalar-order'] = operations.map((child) => child.id);
|
|
241
241
|
}
|
|
242
242
|
return {
|
|
243
243
|
type: 'asyncapi-channel',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AsyncApiInfoObject } from '@scalar/types/asyncapi/3.1';
|
|
2
2
|
import type { TraverseSpecOptions } from '../../navigation/types.js';
|
|
3
3
|
import type { TraversedDescription } from '../../schemas/navigation.js';
|
|
4
|
-
import type { InfoObject } from '../../schemas/v3.
|
|
4
|
+
import type { InfoObject } from '../../schemas/v3.2/strict/info.js';
|
|
5
5
|
/**
|
|
6
6
|
* Creates a hierarchical navigation structure from markdown headings in an OpenAPI or AsyncAPI description.
|
|
7
7
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type NavigationOptions } from '../../navigation/get-navigation-options.js';
|
|
2
2
|
import type { TraversedEntry } from '../../schemas/navigation.js';
|
|
3
|
-
import type { OpenApiDocument } from '../../schemas/v3.
|
|
3
|
+
import type { OpenApiDocument } from '../../schemas/v3.2/strict/openapi-document.js';
|
|
4
4
|
/**
|
|
5
5
|
* Traverses an OpenAPI Document to generate navigation structure and metadata.
|
|
6
6
|
*
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import type { OperationObject } from '../../schemas/v3.
|
|
1
|
+
import type { OperationObject } from '../../schemas/v3.2/strict/openapi-document.js';
|
|
2
2
|
/**
|
|
3
3
|
* Traverse the OpenAPI operation object and extract all example values.
|
|
4
4
|
*
|
|
5
5
|
* @param operation - The OpenAPI operation object to extract examples from
|
|
6
6
|
*/
|
|
7
7
|
export declare const traverseOperationExamples: (operation: OperationObject) => string[];
|
|
8
|
+
/**
|
|
9
|
+
* Build an example key that does not collide with any example the operation already has.
|
|
10
|
+
*
|
|
11
|
+
* Draft examples are stored in a `Set`, so reusing an existing key silently no-ops instead of
|
|
12
|
+
* creating a new entry. Callers that generate examples on the user's behalf (rather than asking
|
|
13
|
+
* for a name) use this to keep every click producing a fresh example.
|
|
14
|
+
*
|
|
15
|
+
* The base name is returned untouched when it is still free, otherwise a numeric suffix is added:
|
|
16
|
+
* `Generated`, `Generated (2)`, `Generated (3)`, ...
|
|
17
|
+
*/
|
|
18
|
+
export declare const getUniqueExampleName: (operation: OperationObject, baseName: string) => string;
|
|
8
19
|
//# sourceMappingURL=traverse-examples.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-examples.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-examples.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAE7E;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,WAAW,eAAe,aAqCnE,CAAA"}
|
|
1
|
+
{"version":3,"file":"traverse-examples.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-examples.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAE7E;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,WAAW,eAAe,aAqCnE,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAI,WAAW,eAAe,EAAE,UAAU,MAAM,KAAG,MAanF,CAAA"}
|
|
@@ -10,7 +10,7 @@ export const traverseOperationExamples = (operation) => {
|
|
|
10
10
|
// Add all examples from request bodies
|
|
11
11
|
if (operation.requestBody) {
|
|
12
12
|
const requestBody = getResolvedRef(operation.requestBody);
|
|
13
|
-
Object.values(requestBody
|
|
13
|
+
Object.values(requestBody?.content ?? {}).forEach((mediaType) => {
|
|
14
14
|
Object.keys(mediaType.examples ?? {}).forEach((key) => {
|
|
15
15
|
examples.add(key);
|
|
16
16
|
});
|
|
@@ -36,3 +36,24 @@ export const traverseOperationExamples = (operation) => {
|
|
|
36
36
|
}
|
|
37
37
|
return Array.from(examples);
|
|
38
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Build an example key that does not collide with any example the operation already has.
|
|
41
|
+
*
|
|
42
|
+
* Draft examples are stored in a `Set`, so reusing an existing key silently no-ops instead of
|
|
43
|
+
* creating a new entry. Callers that generate examples on the user's behalf (rather than asking
|
|
44
|
+
* for a name) use this to keep every click producing a fresh example.
|
|
45
|
+
*
|
|
46
|
+
* The base name is returned untouched when it is still free, otherwise a numeric suffix is added:
|
|
47
|
+
* `Generated`, `Generated (2)`, `Generated (3)`, ...
|
|
48
|
+
*/
|
|
49
|
+
export const getUniqueExampleName = (operation, baseName) => {
|
|
50
|
+
const taken = new Set(traverseOperationExamples(operation));
|
|
51
|
+
if (!taken.has(baseName)) {
|
|
52
|
+
return baseName;
|
|
53
|
+
}
|
|
54
|
+
let suffix = 2;
|
|
55
|
+
while (taken.has(`${baseName} (${suffix})`)) {
|
|
56
|
+
suffix++;
|
|
57
|
+
}
|
|
58
|
+
return `${baseName} (${suffix})`;
|
|
59
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OperationTitleSource, TagsMap, TraverseSpecOptions } from '../../navigation/types.js';
|
|
2
2
|
import type { TraversedOperation } from '../../schemas/navigation.js';
|
|
3
|
-
import type { OpenApiDocument, OperationObject } from '../../schemas/v3.
|
|
3
|
+
import type { OpenApiDocument, OperationObject } from '../../schemas/v3.2/strict/openapi-document.js';
|
|
4
4
|
export declare const isDeprecatedOperation: (operation: OperationObject) => boolean;
|
|
5
5
|
/**
|
|
6
6
|
* Traverses the paths in an OpenAPI document to build a map of operations organized by tags.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TagsMap, TraverseSpecOptions } from '../../navigation/types.js';
|
|
2
2
|
import type { TraversedSchema } from '../../schemas/navigation.js';
|
|
3
|
-
import type { OpenApiDocument } from '../../schemas/v3.
|
|
3
|
+
import type { OpenApiDocument } from '../../schemas/v3.2/strict/openapi-document.js';
|
|
4
4
|
/** Traverses the schemas in an OpenAPI document to build an array of model entries.
|
|
5
5
|
*
|
|
6
6
|
* This function processes each schema in components.schemas to:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TagsMap, TraverseSpecOptions } from '../../navigation/types.js';
|
|
2
2
|
import type { TraversedEntry } from '../../schemas/navigation.js';
|
|
3
|
-
import type { OpenApiDocument } from '../../schemas/v3.
|
|
3
|
+
import type { OpenApiDocument } from '../../schemas/v3.2/strict/openapi-document.js';
|
|
4
4
|
type Options = Pick<TraverseSpecOptions, 'tagsSorter' | 'operationsSorter' | 'generateId'>;
|
|
5
5
|
/**
|
|
6
6
|
* Traverses the tags map to create navigation entries, handling nested, grouped and ungrouped tags.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TagsMap, TraverseSpecOptions } from '../../navigation/types.js';
|
|
2
2
|
import type { TraversedWebhook } from '../../schemas/navigation.js';
|
|
3
|
-
import type { OpenApiDocument } from '../../schemas/v3.
|
|
3
|
+
import type { OpenApiDocument } from '../../schemas/v3.2/strict/openapi-document.js';
|
|
4
4
|
/** Traverses the webhooks in an OpenAPI document to build an array of webhook entries.
|
|
5
5
|
*
|
|
6
6
|
* This function processes each webhook in the document to:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
2
|
import type { WorkspaceStore } from '../../client.js';
|
|
3
3
|
import type { IdGenerator, TraversedOperation, TraversedTag, TraversedWebhook, WithParent } from '../../schemas/navigation.js';
|
|
4
|
-
import type { TagObject } from '../../schemas/v3.
|
|
5
|
-
import type { OperationObject } from '../../schemas/v3.
|
|
4
|
+
import type { TagObject } from '../../schemas/v3.2/strict/openapi-document.js';
|
|
5
|
+
import type { OperationObject } from '../../schemas/v3.2/strict/operation.js';
|
|
6
6
|
type UpdateOrderIdParams = {
|
|
7
7
|
store: WorkspaceStore;
|
|
8
8
|
generateId: IdGenerator;
|
|
@@ -4,5 +4,6 @@ export { getParentEntry } from './helpers/get-parent-entry.js';
|
|
|
4
4
|
export { type TagEntriesMap, getTagEntries } from './helpers/get-tag-entries.js';
|
|
5
5
|
export { traverseAsyncApiDocument } from './helpers/traverse-asyncapi-document.js';
|
|
6
6
|
export { traverseDocument as createNavigation } from './helpers/traverse-document.js';
|
|
7
|
+
export { getUniqueExampleName } from './helpers/traverse-examples.js';
|
|
7
8
|
export type { TraverseSpecOptions as createNavigationOptions } from './types.js';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,KAAK,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,KAAK,aAAa,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAA;AAC/E,OAAO,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAClF,YAAY,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,KAAK,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,KAAK,aAAa,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAA;AAC/E,OAAO,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAClE,YAAY,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/navigation/index.js
CHANGED
|
@@ -4,3 +4,4 @@ export { getParentEntry } from './helpers/get-parent-entry.js';
|
|
|
4
4
|
export { getTagEntries } from './helpers/get-tag-entries.js';
|
|
5
5
|
export { traverseAsyncApiDocument } from './helpers/traverse-asyncapi-document.js';
|
|
6
6
|
export { traverseDocument as createNavigation } from './helpers/traverse-document.js';
|
|
7
|
+
export { getUniqueExampleName } from './helpers/traverse-examples.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ModelsSectionLabel } from '@scalar/types/api-reference';
|
|
2
2
|
import type { IdGenerator, TraversedEntry } from '../schemas/navigation.js';
|
|
3
|
-
import type { TagObject } from '../schemas/v3.
|
|
3
|
+
import type { TagObject } from '../schemas/v3.2/strict/openapi-document.js';
|
|
4
4
|
/** Map of tagNames and their entries */
|
|
5
5
|
export type TagsMap = Map<string, {
|
|
6
6
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/persistence/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAIlE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD;;;;;GAKG;AACH,KAAK,gBAAgB,GAAG;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;GAGG;AACH,KAAK,eAAe,GAAG;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,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B,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;QAcvD;;;WAGG;uCACkC,MAAM,gBAAgB,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;QAWjF;;;WAGG;mCAC8B,MAAM,QAAQ,MAAM,KAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;QAQ5F;;;;;;;;;WASG;oCAEa,MAAM,SACb;YAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,KAC1C,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;QA0BvC,uDAAuD;4BAC7B,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;QAInD,2EAA2E;sCAC7B,gBAAgB,KAAG,OAAO,CAAC,OAAO,CAAC;;;EAQtF,CAAA"}
|
|
@@ -194,7 +194,7 @@ export const createWorkspaceStorePersistence = async () => {
|
|
|
194
194
|
* making it safe to cache and reference across slug renames.
|
|
195
195
|
*/
|
|
196
196
|
getItem: async (workspaceUid) => {
|
|
197
|
-
const workspace =
|
|
197
|
+
const workspace = await workspaceTable.getItem({ workspaceUid });
|
|
198
198
|
if (!workspace) {
|
|
199
199
|
return undefined;
|
|
200
200
|
}
|
|
@@ -223,7 +223,7 @@ export const createWorkspaceStorePersistence = async () => {
|
|
|
223
223
|
* including documents and metadata, use `getItem(workspaceUid)`.
|
|
224
224
|
*/
|
|
225
225
|
getAll: async () => {
|
|
226
|
-
return
|
|
226
|
+
return await workspaceTable.getAll();
|
|
227
227
|
},
|
|
228
228
|
/**
|
|
229
229
|
* Retrieves all workspaces for a given team UID. Uses the `teamUid`
|
|
@@ -233,7 +233,7 @@ export const createWorkspaceStorePersistence = async () => {
|
|
|
233
233
|
* canonical identifier and survives team-slug renames.
|
|
234
234
|
*/
|
|
235
235
|
getAllByTeamUid: async (teamUid) => {
|
|
236
|
-
return
|
|
236
|
+
return await workspaceTable.getRange([teamUid], 'teamUid');
|
|
237
237
|
},
|
|
238
238
|
/**
|
|
239
239
|
* Retrieves all workspaces for a given team slug. Uses the
|
|
@@ -242,7 +242,7 @@ export const createWorkspaceStorePersistence = async () => {
|
|
|
242
242
|
* `getAllByTeamUid`.
|
|
243
243
|
*/
|
|
244
244
|
getAllByTeamSlug: async (teamSlug) => {
|
|
245
|
-
return
|
|
245
|
+
return await workspaceTable.getRange([teamSlug], 'teamSlug_slug');
|
|
246
246
|
},
|
|
247
247
|
/**
|
|
248
248
|
* Saves a workspace and all of its chunks. The caller is responsible
|
|
@@ -253,7 +253,7 @@ export const createWorkspaceStorePersistence = async () => {
|
|
|
253
253
|
* attempting to persist a duplicate pair will reject the transaction.
|
|
254
254
|
*/
|
|
255
255
|
setItem: async ({ workspaceUid, teamUid = 'local', teamSlug = 'local', slug, }, value) => {
|
|
256
|
-
const workspace =
|
|
256
|
+
const workspace = await workspaceTable.addItem({ workspaceUid }, { teamUid, teamSlug, slug, name: value.name });
|
|
257
257
|
await metaTable.addItem({ workspaceUid }, { data: value.workspace.meta });
|
|
258
258
|
await Promise.all([
|
|
259
259
|
...Object.entries(value.workspace.documents ?? {}).map(([name, data]) => documentsTable.addItem({ workspaceUid, documentName: name }, { data })),
|
|
@@ -301,11 +301,11 @@ export const createWorkspaceStorePersistence = async () => {
|
|
|
301
301
|
* record, or `undefined` when the workspace does not exist.
|
|
302
302
|
*/
|
|
303
303
|
updateName: async (workspaceUid, name) => {
|
|
304
|
-
const workspace =
|
|
304
|
+
const workspace = await workspaceTable.getItem({ workspaceUid });
|
|
305
305
|
if (!workspace) {
|
|
306
306
|
return undefined;
|
|
307
307
|
}
|
|
308
|
-
return
|
|
308
|
+
return await workspaceTable.addItem({ workspaceUid }, { ...workspace, name });
|
|
309
309
|
},
|
|
310
310
|
/**
|
|
311
311
|
* Updates the mutable slug metadata for an existing workspace.
|
|
@@ -318,7 +318,7 @@ export const createWorkspaceStorePersistence = async () => {
|
|
|
318
318
|
* references continue to resolve.
|
|
319
319
|
*/
|
|
320
320
|
updateSlugs: async (workspaceUid, slugs) => {
|
|
321
|
-
const workspace =
|
|
321
|
+
const workspace = await workspaceTable.getItem({ workspaceUid });
|
|
322
322
|
if (!workspace) {
|
|
323
323
|
return undefined;
|
|
324
324
|
}
|
|
@@ -330,11 +330,11 @@ export const createWorkspaceStorePersistence = async () => {
|
|
|
330
330
|
return undefined;
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
return
|
|
333
|
+
return await workspaceTable.addItem({ workspaceUid }, {
|
|
334
334
|
...workspace,
|
|
335
335
|
teamSlug: nextTeamSlug,
|
|
336
336
|
slug: nextSlug,
|
|
337
|
-
})
|
|
337
|
+
});
|
|
338
338
|
},
|
|
339
339
|
/** Checks if a workspace with the given UID exists. */
|
|
340
340
|
has: async (workspaceUid) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexdb.d.ts","sourceRoot":"","sources":["../../src/persistence/indexdb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAW,MAAM,iBAAiB,CAAA;AAE/D;;;;;;;;;GASG;AACH,KAAK,UAAU,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,SAAS,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI;IAC3E,MAAM,EAAE,CAAC,CAAA;IACT,OAAO,EAAE,CAAC,CAAA;CACX,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,WAAW,CAAA;IACf,WAAW,EAAE,cAAc,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iEAAiE;IACjE,EAAE,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,GAAG,O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AE,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,+BAI9G;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,CAAC,CAAA;IACT,UAAU,EAAE,SAAS,SAAS,EAAE,CAAA;CACjC;UAyFS,IAAI,SAAS,MAAM,CAAC,aAAa,IAAI;;;;;;;;;+BAiEf,WAAW,EAAE,cAAc,MAAM;;;8EA6BP,OAAO,CAAC,IAAI,CAAC;kCAWpC,WAAW,EAAE,KAAG,OAAO,CAAC,MAAM,CAAC;;;;yBA4BpC,OAAO,CAAC,IAAI,CAAC;;;EAxH1C,CAAA"}
|
|
@@ -72,7 +72,9 @@ export const createIndexDbConnection = async ({ name = 'scalar-workspace-store',
|
|
|
72
72
|
}
|
|
73
73
|
catch (error) {
|
|
74
74
|
const label = migration.description ? `v${version} (${migration.description})` : `v${version}`;
|
|
75
|
-
throw new Error(`Migration ${label} failed: ${error
|
|
75
|
+
throw new Error(`Migration ${label} failed: ${error instanceof Error ? error.message : error}`, {
|
|
76
|
+
cause: error,
|
|
77
|
+
});
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
};
|
|
@@ -167,8 +169,8 @@ function createTableWrapper(name, db) {
|
|
|
167
169
|
return new Promise((resolve, reject) => {
|
|
168
170
|
const req = objectStoreOrIndex.openCursor(range);
|
|
169
171
|
req.onerror = () => reject(req.error);
|
|
170
|
-
req.onsuccess = (
|
|
171
|
-
const cursor =
|
|
172
|
+
req.onsuccess = () => {
|
|
173
|
+
const cursor = req.result;
|
|
172
174
|
if (cursor) {
|
|
173
175
|
results.push(cursor.value);
|
|
174
176
|
cursor.continue();
|
|
@@ -202,8 +204,8 @@ function createTableWrapper(name, db) {
|
|
|
202
204
|
return new Promise((resolve, reject) => {
|
|
203
205
|
const req = store.openCursor(range);
|
|
204
206
|
req.onerror = () => reject(req.error);
|
|
205
|
-
req.onsuccess = (
|
|
206
|
-
const cursor =
|
|
207
|
+
req.onsuccess = () => {
|
|
208
|
+
const cursor = req.result;
|
|
207
209
|
if (cursor) {
|
|
208
210
|
cursor.delete();
|
|
209
211
|
deletedCount++;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2-team-to-local.d.ts","sourceRoot":"","sources":["../../../src/persistence/migrations/v2-team-to-local.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"v2-team-to-local.d.ts","sourceRoot":"","sources":["../../../src/persistence/migrations/v2-team-to-local.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAoEtD,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2EAA2E;IAC3E,SAAS,EAAE,MAAM,CAAA;IACjB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,EAAE,OAAO,WAAW,CAAC,MAAM,CAAC,KAAG,MAU5E,CAAA;AAcD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,GACjC,YAAY,SAAS,iBAAiB,EAAE,KACvC,KAAK,CAAC;IAAE,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,CAkCjF,CAAA;AAiDD,eAAO,MAAM,sBAAsB,EAAE,SA2GpC,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isObjectLike } from '@scalar/helpers/object/is-object';
|
|
1
2
|
/**
|
|
2
3
|
* v2 — move to UID-based identity and collapse every workspace into the
|
|
3
4
|
* local team.
|
|
@@ -145,7 +146,7 @@ const STALE_META_KEYS = ['x-scalar-tabs', 'x-scalar-active-tab'];
|
|
|
145
146
|
* survive.
|
|
146
147
|
*/
|
|
147
148
|
const stripStaleMetaFields = (meta) => {
|
|
148
|
-
if (!meta
|
|
149
|
+
if (!isObjectLike(meta)) {
|
|
149
150
|
return meta;
|
|
150
151
|
}
|
|
151
152
|
const copy = { ...meta };
|
|
@@ -250,9 +251,7 @@ export const v2TeamToLocalMigration = {
|
|
|
250
251
|
// longer routable after collapsing into the local team (and slugs
|
|
251
252
|
// may have been suffixed on collision), so drop them here and
|
|
252
253
|
// let the client rebuild tabs from the live route.
|
|
253
|
-
const nextData = tableName === 'meta'
|
|
254
|
-
? stripStaleMetaFields(rest.data)
|
|
255
|
-
: rest.data;
|
|
254
|
+
const nextData = tableName === 'meta' ? stripStaleMetaFields(rest.data) : rest.data;
|
|
256
255
|
store.put({ ...rest, data: nextData, workspaceUid });
|
|
257
256
|
}
|
|
258
257
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Plugins defined here can extend or modify the behavior of the bundling process,
|
|
4
4
|
* such as adding lifecycle hooks or custom processing logic.
|
|
5
5
|
*/
|
|
6
|
-
import type
|
|
6
|
+
import { type LifecyclePlugin } from '@scalar/json-magic/bundle';
|
|
7
7
|
/**
|
|
8
8
|
* A lifecycle plugin that adds a `$status` property to nodes during resolution.
|
|
9
9
|
* - Sets `$status` to 'loading' when resolution starts.
|
|
@@ -86,9 +86,12 @@ export declare const restoreOriginalRefs: () => LifecyclePlugin;
|
|
|
86
86
|
export declare const normalizeAuthSchemes: () => LifecyclePlugin;
|
|
87
87
|
/**
|
|
88
88
|
* Lifecycle plugin to normalize $ref nodes:
|
|
89
|
-
* Ensures that for any
|
|
89
|
+
* Ensures that for any OpenAPI Reference Object containing a $ref, only $ref,
|
|
90
90
|
* summary, description, and $status properties are preserved.
|
|
91
91
|
* This keeps $ref references clean and predictable for downstream consumers.
|
|
92
|
+
*
|
|
93
|
+
* Schema Objects are deliberately skipped: in JSON Schema 2020-12 a $ref may
|
|
94
|
+
* carry sibling keywords, so their siblings must not be stripped.
|
|
92
95
|
*/
|
|
93
96
|
export declare const normalizeRefs: () => LifecyclePlugin;
|
|
94
97
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/bundler/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/bundler/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,2BAA2B,CAAA;AAStF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,QAAO,eAahC,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,QAAO,eAmCxC,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,QAAO,eAwCjC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,mBAAmB,QAAO,eAuBtC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,oBAAoB,QAAO,eAuBvC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,QAAO,eAyBhC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,QAAO,eAkFrC,CAAA;AAKD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAO,eAaxC,CAAA"}
|