@scalar/workspace-store 0.40.0 → 0.40.2
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 +13 -0
- package/dist/navigation/get-navigation-options.js +1 -1
- package/dist/navigation/get-navigation-options.js.map +2 -2
- package/dist/navigation/helpers/traverse-examples.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-examples.js +0 -12
- package/dist/navigation/helpers/traverse-examples.js.map +2 -2
- package/dist/schemas/extensions/security/index.d.ts +1 -0
- package/dist/schemas/extensions/security/index.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @scalar/workspace-store
|
|
2
2
|
|
|
3
|
+
## 0.40.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#8468](https://github.com/scalar/scalar/pull/8468): fix: ignore response examples when generating navigation
|
|
8
|
+
|
|
9
|
+
## 0.40.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#8424](https://github.com/scalar/scalar/pull/8424): feat: export XScalarCredentialsLocation
|
|
14
|
+
- [#8445](https://github.com/scalar/scalar/pull/8445): fix: generate unique id for models
|
|
15
|
+
|
|
3
16
|
## 0.40.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -61,7 +61,7 @@ const getNavigationOptions = (documentName, options) => {
|
|
|
61
61
|
name: props.name
|
|
62
62
|
})}`;
|
|
63
63
|
}
|
|
64
|
-
return `${prefixTag}model/${slug(props.name)}`;
|
|
64
|
+
return `${prefixTag}model/${slug(props.name, true)}`;
|
|
65
65
|
}
|
|
66
66
|
if (props.type === "example") {
|
|
67
67
|
return `${props.parentId}/example/${slug(props.name)}`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/navigation/get-navigation-options.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport { slug } from 'github-slugger'\n\nimport type { TraverseSpecOptions } from '@/navigation/types'\nimport type { IdGenerator } from '@/schemas/navigation'\n\nexport type NavigationOptions =\n | Partial<\n Pick<\n ApiReferenceConfigurationRaw,\n | 'generateHeadingSlug'\n | 'generateTagSlug'\n | 'generateOperationSlug'\n | 'generateWebhookSlug'\n | 'generateModelSlug'\n | 'operationsSorter'\n | 'tagsSorter'\n | 'hideModels'\n >\n >\n | undefined\n\n/**\n * Returns options for traversing an OpenAPI document, allowing customization of\n * how IDs and slugs are generated for tags, headings, models, operations, and webhooks.\n * The returned options can be influenced by the provided DocumentConfiguration\n */\nexport const getNavigationOptions = (documentName: string, options?: NavigationOptions): TraverseSpecOptions => {\n const generateId: IdGenerator = (props) => {\n const documentId = `${slug(documentName)}`\n\n // -------- Default text id generation logic --------\n if (props.type === 'text') {\n if (options?.generateHeadingSlug) {\n return options?.generateHeadingSlug({ slug: props.slug })\n }\n\n if (props.slug) {\n return `${documentId}/description/${props.slug}`\n }\n\n return `${documentId}/`\n }\n\n // -------- Default tag id generation logic --------\n if (props.type === 'tag') {\n if (options?.generateTagSlug) {\n return `${documentId}/tag/${options.generateTagSlug(props.tag)}`\n }\n\n return `${documentId}/tag/${slug(props.tag.name ?? '')}`\n }\n\n // -------- Default operation id generation logic --------\n if (props.type === 'operation') {\n const prefixTag = props.parentTag\n ? `${generateId({\n type: 'tag',\n tag: props.parentTag.tag,\n parentId: props.parentTag.id,\n })}/`\n : `${documentId}/`\n\n if (options?.generateOperationSlug) {\n return `${prefixTag}${options.generateOperationSlug({\n path: props.path,\n operationId: props.operation.operationId,\n method: props.method.toUpperCase(),\n summary: props.operation.summary,\n })}`\n }\n\n return `${prefixTag}${props.method.toUpperCase()}${props.path}`\n }\n\n // -------- Default webhook id generation logic --------\n if (props.type === 'webhook') {\n const prefixTag = props.parentTag\n ? `${generateId({\n type: 'tag',\n parentId: props.parentTag.id,\n tag: props.parentTag.tag,\n })}/`\n : `${documentId}/`\n\n if (options?.generateWebhookSlug) {\n return `${prefixTag}webhook/${options.generateWebhookSlug({\n name: props.name,\n method: props.method?.toUpperCase(),\n })}`\n }\n\n return `${prefixTag}webhook/${props.method?.toUpperCase()}/${slug(props.name)}`\n }\n\n // -------- Default model id generation logic --------\n if (props.type === 'model') {\n if (!props.name) {\n return `${documentId}/models`\n }\n\n const prefixTag = props.parentTag\n ? `${generateId({\n type: 'tag',\n parentId: props.parentTag.id,\n tag: props.parentTag.tag,\n })}/`\n : `${documentId}/`\n\n if (options?.generateModelSlug) {\n return `${prefixTag}model/${options.generateModelSlug({\n name: props.name,\n })}`\n }\n\n return `${prefixTag}model/${slug(props.name)}`\n }\n\n if (props.type === 'example') {\n return `${props.parentId}/example/${slug(props.name)}`\n }\n\n if (props.type === 'document') {\n // -------- Default document id generation logic --------\n return documentId\n }\n\n console.warn('[WARNING]: unhandled id generation for navigation item:', props)\n return 'unknown-id'\n }\n\n return {\n hideModels: options?.hideModels ?? false,\n operationsSorter: options?.operationsSorter,\n tagsSorter: options?.tagsSorter,\n generateId,\n }\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,YAAY;AA0Bd,MAAM,uBAAuB,CAAC,cAAsB,YAAqD;AAC9G,QAAM,aAA0B,CAAC,UAAU;AACzC,UAAM,aAAa,GAAG,KAAK,YAAY,CAAC;AAGxC,QAAI,MAAM,SAAS,QAAQ;AACzB,UAAI,SAAS,qBAAqB;AAChC,eAAO,SAAS,oBAAoB,EAAE,MAAM,MAAM,KAAK,CAAC;AAAA,MAC1D;AAEA,UAAI,MAAM,MAAM;AACd,eAAO,GAAG,UAAU,gBAAgB,MAAM,IAAI;AAAA,MAChD;AAEA,aAAO,GAAG,UAAU;AAAA,IACtB;AAGA,QAAI,MAAM,SAAS,OAAO;AACxB,UAAI,SAAS,iBAAiB;AAC5B,eAAO,GAAG,UAAU,QAAQ,QAAQ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W;AAAA,QACZ,MAAM;AAAA,QACN,UAAU,MAAM,UAAU;AAAA,QAC1B,KAAK,MAAM,UAAU;AAAA,MACvB,CAAC,CAAC,MACF,GAAG,UAAU;AAEjB,UAAI,SAAS,mBAAmB;AAC9B,eAAO,GAAG,SAAS,SAAS,QAAQ,kBAAkB;AAAA,UACpD,MAAM,MAAM;AAAA,QACd,CAAC,CAAC;AAAA,MACJ;AAEA,aAAO,GAAG,SAAS,SAAS,KAAK,MAAM,IAAI,CAAC;AAAA,
|
|
4
|
+
"sourcesContent": ["import type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport { slug } from 'github-slugger'\n\nimport type { TraverseSpecOptions } from '@/navigation/types'\nimport type { IdGenerator } from '@/schemas/navigation'\n\nexport type NavigationOptions =\n | Partial<\n Pick<\n ApiReferenceConfigurationRaw,\n | 'generateHeadingSlug'\n | 'generateTagSlug'\n | 'generateOperationSlug'\n | 'generateWebhookSlug'\n | 'generateModelSlug'\n | 'operationsSorter'\n | 'tagsSorter'\n | 'hideModels'\n >\n >\n | undefined\n\n/**\n * Returns options for traversing an OpenAPI document, allowing customization of\n * how IDs and slugs are generated for tags, headings, models, operations, and webhooks.\n * The returned options can be influenced by the provided DocumentConfiguration\n */\nexport const getNavigationOptions = (documentName: string, options?: NavigationOptions): TraverseSpecOptions => {\n const generateId: IdGenerator = (props) => {\n const documentId = `${slug(documentName)}`\n\n // -------- Default text id generation logic --------\n if (props.type === 'text') {\n if (options?.generateHeadingSlug) {\n return options?.generateHeadingSlug({ slug: props.slug })\n }\n\n if (props.slug) {\n return `${documentId}/description/${props.slug}`\n }\n\n return `${documentId}/`\n }\n\n // -------- Default tag id generation logic --------\n if (props.type === 'tag') {\n if (options?.generateTagSlug) {\n return `${documentId}/tag/${options.generateTagSlug(props.tag)}`\n }\n\n return `${documentId}/tag/${slug(props.tag.name ?? '')}`\n }\n\n // -------- Default operation id generation logic --------\n if (props.type === 'operation') {\n const prefixTag = props.parentTag\n ? `${generateId({\n type: 'tag',\n tag: props.parentTag.tag,\n parentId: props.parentTag.id,\n })}/`\n : `${documentId}/`\n\n if (options?.generateOperationSlug) {\n return `${prefixTag}${options.generateOperationSlug({\n path: props.path,\n operationId: props.operation.operationId,\n method: props.method.toUpperCase(),\n summary: props.operation.summary,\n })}`\n }\n\n return `${prefixTag}${props.method.toUpperCase()}${props.path}`\n }\n\n // -------- Default webhook id generation logic --------\n if (props.type === 'webhook') {\n const prefixTag = props.parentTag\n ? `${generateId({\n type: 'tag',\n parentId: props.parentTag.id,\n tag: props.parentTag.tag,\n })}/`\n : `${documentId}/`\n\n if (options?.generateWebhookSlug) {\n return `${prefixTag}webhook/${options.generateWebhookSlug({\n name: props.name,\n method: props.method?.toUpperCase(),\n })}`\n }\n\n return `${prefixTag}webhook/${props.method?.toUpperCase()}/${slug(props.name)}`\n }\n\n // -------- Default model id generation logic --------\n if (props.type === 'model') {\n if (!props.name) {\n return `${documentId}/models`\n }\n\n const prefixTag = props.parentTag\n ? `${generateId({\n type: 'tag',\n parentId: props.parentTag.id,\n tag: props.parentTag.tag,\n })}/`\n : `${documentId}/`\n\n if (options?.generateModelSlug) {\n return `${prefixTag}model/${options.generateModelSlug({\n name: props.name,\n })}`\n }\n\n return `${prefixTag}model/${slug(props.name, true)}`\n }\n\n if (props.type === 'example') {\n return `${props.parentId}/example/${slug(props.name)}`\n }\n\n if (props.type === 'document') {\n // -------- Default document id generation logic --------\n return documentId\n }\n\n console.warn('[WARNING]: unhandled id generation for navigation item:', props)\n return 'unknown-id'\n }\n\n return {\n hideModels: options?.hideModels ?? false,\n operationsSorter: options?.operationsSorter,\n tagsSorter: options?.tagsSorter,\n generateId,\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,YAAY;AA0Bd,MAAM,uBAAuB,CAAC,cAAsB,YAAqD;AAC9G,QAAM,aAA0B,CAAC,UAAU;AACzC,UAAM,aAAa,GAAG,KAAK,YAAY,CAAC;AAGxC,QAAI,MAAM,SAAS,QAAQ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AAA,UACZ,QAAQ,MAAM,QAAQ,YAAY;AAAA,QACpC,CAAC,CAAC;AAAA,MACJ;AAEA,aAAO,GAAG,SAAS,WAAW,MAAM,QAAQ,YAAY,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC;AAAA,IAC/E;AAGA,QAAI,MAAM,SAAS,SAAS;AAC1B,UAAI,CAAC,MAAM,MAAM;AACf,eAAO,GAAG,UAAU;AAAA,MACtB;AAEA,YAAM,YAAY,MAAM,YACpB,GAAG,WAAW;AAAA,QACZ,MAAM;AAAA,QACN,UAAU,MAAM,UAAU;AAAA,QAC1B,KAAK,MAAM,UAAU;AAAA,MACvB,CAAC,CAAC,MACF,GAAG,UAAU;AAEjB,UAAI,SAAS,mBAAmB;AAC9B,eAAO,GAAG,SAAS,SAAS,QAAQ,kBAAkB;AAAA,UACpD,MAAM,MAAM;AAAA,QACd,CAAC,CAAC;AAAA,MACJ;AAEA,aAAO,GAAG,SAAS,SAAS,KAAK,MAAM,MAAM,IAAI,CAAC;AAAA,IACpD;AAEA,QAAI,MAAM,SAAS,WAAW;AAC5B,aAAO,GAAG,MAAM,QAAQ,YAAY,KAAK,MAAM,IAAI,CAAC;AAAA,IACtD;AAEA,QAAI,MAAM,SAAS,YAAY;AAE7B,aAAO;AAAA,IACT;AAEA,YAAQ,KAAK,2DAA2D,KAAK;AAC7E,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,YAAY,SAAS,cAAc;AAAA,IACnC,kBAAkB,SAAS;AAAA,IAC3B,YAAY,SAAS;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -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,
|
|
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"}
|
|
@@ -26,18 +26,6 @@ const traverseOperationExamples = (operation) => {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
if (operation.responses) {
|
|
30
|
-
Object.values(operation.responses).forEach((response) => {
|
|
31
|
-
const resolvedResponse = getResolvedRef(response) ?? {};
|
|
32
|
-
if ("content" in resolvedResponse && resolvedResponse.content) {
|
|
33
|
-
Object.values(resolvedResponse.content ?? {}).forEach((mediaType) => {
|
|
34
|
-
Object.keys(mediaType.examples ?? {}).forEach((key) => {
|
|
35
|
-
examples.add(key);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
29
|
return Array.from(examples);
|
|
42
30
|
};
|
|
43
31
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation/helpers/traverse-examples.ts"],
|
|
4
|
-
"sourcesContent": ["import { getResolvedRef } from '@/helpers/get-resolved-ref'\nimport type { OperationObject } from '@/schemas/v3.1/strict/openapi-document'\n\n/**\n * Traverse the OpenAPI operation object and extract all example values.\n *\n * @param operation - The OpenAPI operation object to extract examples from\n */\nexport const traverseOperationExamples = (operation: OperationObject) => {\n // Add all examples from draft examples\n const examples = new Set<string>(operation['x-draft-examples'] ?? [])\n\n // Add all examples from request bodies\n if (operation.requestBody) {\n const requestBody = getResolvedRef(operation.requestBody)\n\n Object.values(requestBody.content ?? {}).forEach((mediaType) => {\n Object.keys(mediaType.examples ?? {}).forEach((key) => {\n examples.add(key)\n })\n })\n }\n\n // Add all examples from parameters\n if (operation.parameters) {\n operation.parameters.forEach((_parameter) => {\n const parameter = getResolvedRef(_parameter) ?? {}\n\n if ('content' in parameter && parameter.content) {\n Object.values(parameter.content).forEach((mediaType) => {\n Object.keys(mediaType.examples ?? {}).forEach((key) => {\n examples.add(key)\n })\n })\n }\n\n if ('examples' in parameter && parameter.examples) {\n Object.keys(parameter.examples ?? {}).forEach((key) => {\n examples.add(key)\n })\n }\n })\n }\n\n
|
|
5
|
-
"mappings": "AAAA,SAAS,sBAAsB;AAQxB,MAAM,4BAA4B,CAAC,cAA+B;AAEvE,QAAM,WAAW,IAAI,IAAY,UAAU,kBAAkB,KAAK,CAAC,CAAC;AAGpE,MAAI,UAAU,aAAa;AACzB,UAAM,cAAc,eAAe,UAAU,WAAW;AAExD,WAAO,OAAO,YAAY,WAAW,CAAC,CAAC,EAAE,QAAQ,CAAC,cAAc;AAC9D,aAAO,KAAK,UAAU,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ;AACrD,iBAAS,IAAI,GAAG;AAAA,MAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAGA,MAAI,UAAU,YAAY;AACxB,cAAU,WAAW,QAAQ,CAAC,eAAe;AAC3C,YAAM,YAAY,eAAe,UAAU,KAAK,CAAC;AAEjD,UAAI,aAAa,aAAa,UAAU,SAAS;AAC/C,eAAO,OAAO,UAAU,OAAO,EAAE,QAAQ,CAAC,cAAc;AACtD,iBAAO,KAAK,UAAU,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ;AACrD,qBAAS,IAAI,GAAG;AAAA,UAClB,CAAC;AAAA,QACH,CAAC;AAAA,MACH;AAEA,UAAI,cAAc,aAAa,UAAU,UAAU;AACjD,eAAO,KAAK,UAAU,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ;AACrD,mBAAS,IAAI,GAAG;AAAA,QAClB,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;
|
|
4
|
+
"sourcesContent": ["import { getResolvedRef } from '@/helpers/get-resolved-ref'\nimport type { OperationObject } from '@/schemas/v3.1/strict/openapi-document'\n\n/**\n * Traverse the OpenAPI operation object and extract all example values.\n *\n * @param operation - The OpenAPI operation object to extract examples from\n */\nexport const traverseOperationExamples = (operation: OperationObject) => {\n // Add all examples from draft examples\n const examples = new Set<string>(operation['x-draft-examples'] ?? [])\n\n // Add all examples from request bodies\n if (operation.requestBody) {\n const requestBody = getResolvedRef(operation.requestBody)\n\n Object.values(requestBody.content ?? {}).forEach((mediaType) => {\n Object.keys(mediaType.examples ?? {}).forEach((key) => {\n examples.add(key)\n })\n })\n }\n\n // Add all examples from parameters\n if (operation.parameters) {\n operation.parameters.forEach((_parameter) => {\n const parameter = getResolvedRef(_parameter) ?? {}\n\n if ('content' in parameter && parameter.content) {\n Object.values(parameter.content).forEach((mediaType) => {\n Object.keys(mediaType.examples ?? {}).forEach((key) => {\n examples.add(key)\n })\n })\n }\n\n if ('examples' in parameter && parameter.examples) {\n Object.keys(parameter.examples ?? {}).forEach((key) => {\n examples.add(key)\n })\n }\n })\n }\n\n return Array.from(examples)\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,sBAAsB;AAQxB,MAAM,4BAA4B,CAAC,cAA+B;AAEvE,QAAM,WAAW,IAAI,IAAY,UAAU,kBAAkB,KAAK,CAAC,CAAC;AAGpE,MAAI,UAAU,aAAa;AACzB,UAAM,cAAc,eAAe,UAAU,WAAW;AAExD,WAAO,OAAO,YAAY,WAAW,CAAC,CAAC,EAAE,QAAQ,CAAC,cAAc;AAC9D,aAAO,KAAK,UAAU,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ;AACrD,iBAAS,IAAI,GAAG;AAAA,MAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAGA,MAAI,UAAU,YAAY;AACxB,cAAU,WAAW,QAAQ,CAAC,eAAe;AAC3C,YAAM,YAAY,eAAe,UAAU,KAAK,CAAC;AAEjD,UAAI,aAAa,aAAa,UAAU,SAAS;AAC/C,eAAO,OAAO,UAAU,OAAO,EAAE,QAAQ,CAAC,cAAc;AACtD,iBAAO,KAAK,UAAU,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ;AACrD,qBAAS,IAAI,GAAG;AAAA,UAClB,CAAC;AAAA,QACH,CAAC;AAAA,MACH;AAEA,UAAI,cAAc,aAAa,UAAU,UAAU;AACjD,eAAO,KAAK,UAAU,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ;AACrD,mBAAS,IAAI,GAAG;AAAA,QAClB,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO,MAAM,KAAK,QAAQ;AAC5B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
export type { XScalarCredentialsLocation } from './x-scalar-credentials-location.js';
|
|
1
2
|
export type { XScalarAuthUrl, XScalarSecretClientId, XScalarSecretClientSecret, XScalarSecretHTTP, XScalarSecretRedirectUri, XScalarSecretRefreshToken, XScalarSecretToken, XScalarTokenUrl, } from './x-scalar-security-secrets.js';
|
|
2
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/security/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,GAChB,MAAM,6BAA6B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/security/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AACjF,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,GAChB,MAAM,6BAA6B,CAAA"}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"openapi",
|
|
17
17
|
"scalar"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.40.
|
|
19
|
+
"version": "0.40.2",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=22"
|
|
22
22
|
},
|
|
@@ -138,13 +138,13 @@
|
|
|
138
138
|
"type-fest": "^5.3.1",
|
|
139
139
|
"vue": "^3.5.26",
|
|
140
140
|
"yaml": "^2.8.0",
|
|
141
|
-
"@scalar/code-highlight": "0.3.0",
|
|
142
141
|
"@scalar/helpers": "0.4.1",
|
|
143
|
-
"@scalar/
|
|
142
|
+
"@scalar/code-highlight": "0.3.0",
|
|
143
|
+
"@scalar/json-magic": "0.12.3",
|
|
144
144
|
"@scalar/openapi-upgrader": "0.2.0",
|
|
145
145
|
"@scalar/snippetz": "0.7.4",
|
|
146
146
|
"@scalar/types": "0.7.3",
|
|
147
|
-
"@scalar/
|
|
147
|
+
"@scalar/object-utils": "1.3.2"
|
|
148
148
|
},
|
|
149
149
|
"devDependencies": {
|
|
150
150
|
"@google-cloud/storage": "7.16.0",
|