@scalar/oas-utils 0.6.47 → 0.8.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
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @scalar/oas-utils
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#8290](https://github.com/scalar/scalar/pull/8290): chore: update deps
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
#### Updated Dependencies
|
|
12
|
+
|
|
13
|
+
- **@scalar/themes@0.14.2**
|
|
14
|
+
- [#8290](https://github.com/scalar/scalar/pull/8290): chore: update deps
|
|
15
|
+
|
|
16
|
+
- **@scalar/workspace-store@0.35.1**
|
|
17
|
+
- [#8290](https://github.com/scalar/scalar/pull/8290): chore: update deps
|
|
18
|
+
|
|
19
|
+
## 0.7.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- [#8234](https://github.com/scalar/scalar/pull/8234): support operation level authentication and servers
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
#### Updated Dependencies
|
|
28
|
+
|
|
29
|
+
- **@scalar/themes@0.14.1**
|
|
30
|
+
- [#8276](https://github.com/scalar/scalar/pull/8276): feat(components): standardize form inputs to have a height of 40px
|
|
31
|
+
|
|
32
|
+
- **@scalar/workspace-store@0.35.0**
|
|
33
|
+
- [#8234](https://github.com/scalar/scalar/pull/8234): support operation level authentication and servers
|
|
34
|
+
|
|
35
|
+
## 0.6.48
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
#### Updated Dependencies
|
|
40
|
+
|
|
41
|
+
- **@scalar/types@0.6.8**
|
|
42
|
+
- [#8274](https://github.com/scalar/scalar/pull/8274): feat(agent): add config to hide search api
|
|
43
|
+
|
|
44
|
+
- **@scalar/workspace-store@0.34.4**
|
|
45
|
+
|
|
3
46
|
## 0.6.47
|
|
4
47
|
|
|
5
48
|
### Patch Changes
|
|
@@ -533,15 +533,13 @@ const transformCollectionToDocument = (documentName, collection, dataRecords) =>
|
|
|
533
533
|
// Preserve scalar extensions
|
|
534
534
|
"x-scalar-icon": collection["x-scalar-icon"],
|
|
535
535
|
// Convert legacy record-based environment variables to the new array format
|
|
536
|
-
"x-scalar-environments": transformLegacyEnvironments(collection["x-scalar-environments"])
|
|
537
|
-
// useCollectionSecurity → x-scalar-set-operation-security
|
|
538
|
-
"x-scalar-set-operation-security": collection.useCollectionSecurity ?? false
|
|
536
|
+
"x-scalar-environments": transformLegacyEnvironments(collection["x-scalar-environments"])
|
|
539
537
|
};
|
|
540
538
|
if (tagGroups.length > 0) {
|
|
541
539
|
document["x-tagGroups"] = tagGroups;
|
|
542
540
|
}
|
|
543
541
|
if (collection["x-scalar-active-environment"]) {
|
|
544
|
-
document["x-scalar-
|
|
542
|
+
document["x-scalar-active-environment"] = collection["x-scalar-active-environment"];
|
|
545
543
|
}
|
|
546
544
|
if (selectedServerUrl) {
|
|
547
545
|
document["x-scalar-selected-server"] = selectedServerUrl;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/migrations/migrate-to-indexdb.ts"],
|
|
4
|
-
"sourcesContent": ["import { CONTENT_TYPES } from '@scalar/helpers/consts/content-types'\nimport { extractConfigSecrets, removeSecretFields } from '@scalar/helpers/general/extract-config-secrets'\nimport { circularToRefs } from '@scalar/helpers/object/circular-to-refs'\nimport { objectEntries } from '@scalar/helpers/object/object-entries'\nimport { extractServerFromPath } from '@scalar/helpers/url/extract-server-from-path'\nimport { type ThemeId, presets } from '@scalar/themes'\nimport type { Oauth2Flow } from '@scalar/types/entities'\nimport { createWorkspaceStore } from '@scalar/workspace-store/client'\nimport { type Auth, AuthSchema } from '@scalar/workspace-store/entities/auth'\nimport { createWorkspaceStorePersistence } from '@scalar/workspace-store/persistence'\nimport {\n type XScalarEnvironments,\n xScalarEnvironmentSchema,\n} from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { xScalarCookieSchema } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type { XTagGroup } from '@scalar/workspace-store/schemas/extensions/tag'\nimport type { InMemoryWorkspace } from '@scalar/workspace-store/schemas/inmemory-workspace'\nimport { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce'\nimport {\n OpenAPIDocumentSchema,\n type OpenApiDocument,\n type OperationObject,\n type ParameterObject,\n type ParameterWithContentObject,\n type ParameterWithSchemaObject,\n type PathItemObject,\n type RequestBodyObject,\n type ServerObject,\n type TagObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { WorkspaceDocument, WorkspaceExtensions, WorkspaceMeta } from '@scalar/workspace-store/schemas/workspace'\nimport { ColorModeSchema } from '@scalar/workspace-store/schemas/workspace'\nimport GithubSlugger from 'github-slugger'\n\nimport type { RequestParameter } from '@/entities/spec/parameters'\nimport { migrator } from '@/migrations/migrator'\nimport type { v_2_5_0 } from '@/migrations/v-2.5.0/types.generated'\n\nconst DRAFTS_DOCUMENT_NAME = 'drafts'\n\n/**\n * Migrates localStorage data to IndexedDB workspace structure.\n *\n * Called early in app initialization (app-state.ts) before workspace data loads.\n * Idempotent and non-destructive - runs when legacy data exists but IndexedDB is empty.\n *\n * Flow:\n * 1. Check if migration needed (has legacy data + IndexedDB is empty)\n * 2. Run existing migrations to get latest data structure\n * 3. Transform to new workspace format\n * 4. Save to IndexedDB\n *\n * Old data is preserved for rollback. Typically completes in < 1 second.\n */\nexport const migrateLocalStorageToIndexDb = async () => {\n const { close, workspace: workspacePersistence } = await createWorkspaceStorePersistence()\n\n try {\n const shouldMigrate = await shouldMigrateToIndexDb(workspacePersistence)\n\n if (!shouldMigrate) {\n console.info('\u2139\uFE0F No migration needed - IndexedDB already has workspaces or no legacy data exists')\n return\n }\n\n console.info('\uD83D\uDE80 Starting migration from localStorage to IndexedDB...')\n\n // Step 1: Run existing migrations to get latest data structure\n const legacyData = migrator()\n\n console.info(\n `\uD83D\uDCE6 Found legacy data: ${legacyData.arrays.workspaces.length} workspace(s), ${legacyData.arrays.collections.length} collection(s)`,\n )\n\n // Step 2: Transform to new workspace structure\n const workspaces = await transformLegacyDataToWorkspace(legacyData)\n\n // Step 3: Save to IndexedDB\n await Promise.all(\n workspaces.map((workspace) =>\n workspacePersistence.setItem(\n { namespace: 'local', slug: workspace.slug },\n {\n name: workspace.name,\n workspace: workspace.workspace,\n teamUid: 'local',\n },\n ),\n ),\n )\n\n console.info(`\u2705 Successfully migrated ${workspaces.length} workspace(s) to IndexedDB`)\n } catch (error) {\n console.error('\u274C Migration failed:', error)\n } finally {\n close()\n }\n}\n\n/**\n * Checks if migration is needed by verifying IndexedDB state and presence of legacy data.\n *\n * Migration is needed when:\n * 1. Legacy data exists in localStorage (workspace, collection, or request keys)\n * 2. AND IndexedDB has no workspaces yet\n *\n * This approach is more reliable than using a flag because:\n * - If IndexedDB is cleared, migration will run again automatically\n * - No risk of flag getting out of sync with actual data state\n * - Handles edge cases like partial migrations or database corruption\n */\nexport const shouldMigrateToIndexDb = async (\n workspacePersistence: Awaited<ReturnType<typeof createWorkspaceStorePersistence>>['workspace'],\n): Promise<boolean> => {\n // Check if there is any old data in localStorage\n const hasLegacyData =\n localStorage.getItem('workspace') !== null ||\n localStorage.getItem('collection') !== null ||\n localStorage.getItem('request') !== null\n\n if (!hasLegacyData) {\n return false\n }\n\n // Check if IndexedDB already has workspaces\n const existingWorkspaces = await workspacePersistence.getAll()\n const hasIndexDbData = existingWorkspaces.length > 0\n\n // Only migrate if we have legacy data but no IndexedDB data\n return !hasIndexDbData\n}\n\n/**\n * Transforms legacy localStorage data into IndexedDB workspace structure.\n *\n * Transformations:\n * - Collections \u2192 Documents (collections were OpenAPI specs)\n * - Environments \u2192 x-scalar-environments in meta\n * - Cookies \u2192 x-scalar-cookies in meta\n * - Workspace properties \u2192 meta extensions (activeEnvironmentId, proxyUrl, themeId)\n *\n * Creates a default workspace if none exist. Falls back to collection uid if info.title is missing.\n */\nexport const transformLegacyDataToWorkspace = async (legacyData: {\n arrays: v_2_5_0['DataArray']\n records: v_2_5_0['DataRecord']\n}) =>\n await Promise.all(\n legacyData.arrays.workspaces.map(async (workspace) => {\n /** Grab auth from the collections */\n const workspaceAuth: InMemoryWorkspace['auth'] = {}\n\n /** Create a slugger instance per workspace to handle duplicate document names */\n const documentSlugger = new GithubSlugger()\n\n /** Each collection becomes a document in the new system and grab the auth as well */\n const documents: { name: string; document: OpenApiDocument }[] = workspace.collections.flatMap((uid) => {\n const collection = legacyData.records.collections[uid]\n if (!collection) {\n return []\n }\n\n const documentName = collection.info?.title || 'api'\n const { document, auth } = transformCollectionToDocument(documentName, collection, legacyData.records)\n\n // Normalize document name to match the store (lowercase \"Drafts\" \u2192 \"drafts\")\n const normalizedName = documentName === 'Drafts' ? 'drafts' : documentName\n\n // Use GitHubSlugger to ensure unique document names\n const uniqueName = documentSlugger.slug(normalizedName, false)\n\n workspaceAuth[uniqueName] = auth\n\n return { name: uniqueName, document }\n })\n\n const meta: WorkspaceMeta = {}\n const extensions: WorkspaceExtensions = {}\n\n // Add environment\n const environmentEntries = Object.entries(workspace.environments)\n if (environmentEntries.length > 0) {\n extensions['x-scalar-environments'] = {\n default: coerceValue(xScalarEnvironmentSchema, {\n variables: environmentEntries.map(([name, value]) => ({\n name,\n value,\n })),\n }),\n }\n }\n\n // Add cookies to meta\n if (workspace.cookies.length > 0) {\n extensions['x-scalar-cookies'] = workspace.cookies.flatMap((uid) => {\n const cookie = legacyData.records.cookies[uid]\n return cookie ? coerceValue(xScalarCookieSchema, cookie) : []\n })\n }\n\n // Add proxy URL if present\n if (workspace.proxyUrl) {\n meta['x-scalar-active-proxy'] = workspace.proxyUrl\n }\n\n // Add theme if present\n if (workspace.themeId) {\n // We use theme slugs on the new system so we need to transform the id to the slug\n meta['x-scalar-theme'] = transformThemeIdToSlug(workspace.themeId)\n }\n\n // Set color mode\n if (localStorage.getItem('colorMode')) {\n meta['x-scalar-color-mode'] = coerceValue(ColorModeSchema, localStorage.getItem('colorMode'))\n }\n\n const store = createWorkspaceStore({\n meta,\n })\n\n await Promise.all(\n documents.map(async ({ name, document }) => {\n await store.addDocument({\n name,\n document,\n })\n // Note: we are breaking the relationship between the document and the originial source url\n }),\n )\n\n // Try to always set the drafts / route\n if (!(DRAFTS_DOCUMENT_NAME in store.workspace.documents)) {\n await store.addDocument({\n name: DRAFTS_DOCUMENT_NAME,\n document: {\n openapi: '3.1.0',\n info: {\n title: 'Drafts',\n version: '1.0.0',\n },\n paths: {\n '/': {\n get: {},\n },\n },\n 'x-scalar-icon': 'interface-edit-tool-pencil',\n },\n })\n }\n\n const drafts = store.workspace.documents[DRAFTS_DOCUMENT_NAME]\n\n if (drafts) {\n // Make sure the drafts document has a GET / route cuz that's the first route we navigate the user to\n drafts.paths ??= {}\n drafts.paths['/'] ??= {}\n drafts.paths['/']['get'] ??= {}\n }\n\n store.buildSidebar(DRAFTS_DOCUMENT_NAME)\n // save the document to the store so we don't see the document as dirty\n await store.saveDocument(DRAFTS_DOCUMENT_NAME)\n\n // Load the auth into the store\n store.auth.load(workspaceAuth)\n\n // Load the extensions into the store\n objectEntries(extensions).forEach(([key, value]) => {\n store.update(key, value)\n })\n\n return {\n slug: workspace.uid.toString(), // Convert to string to convert it to a simple string type\n name: workspace.name || 'Untitled Workspace',\n workspace: store.exportWorkspace(),\n }\n }),\n )\n\n/**\n * Converts a ThemeId to its corresponding theme slug.\n * If the themeId is 'none', return it as is.\n * Otherwise, look up the slug in the presets object.\n */\nconst transformThemeIdToSlug = (themeId: ThemeId): string => {\n if (themeId === 'none') {\n return themeId\n }\n return presets[themeId]?.slug ?? 'default'\n}\n\n/**\n * Converts legacy environment variables from record format to the new array format.\n *\n * Legacy format: { variables: { API_URL: 'https://...', API_KEY: 'secret' } }\n * New format: { variables: [{ name: 'API_URL', value: 'https://...' }, { name: 'API_KEY', value: 'secret' }] }\n */\nconst transformLegacyEnvironments = (\n environments: v_2_5_0['Collection']['x-scalar-environments'],\n): XScalarEnvironments | undefined => {\n const entries = Object.entries(environments || {})\n if (entries.length === 0) {\n return undefined\n }\n\n return Object.fromEntries(\n entries.map(([envName, env]) => [\n envName,\n coerceValue(xScalarEnvironmentSchema, {\n color: env.color,\n variables: Object.entries(env.variables || {}).map(([name, value]) => ({\n name,\n value: typeof value === 'string' ? value : value.default || '',\n })),\n }),\n ]),\n )\n}\n\n/**\n * Transforms legacy requests and request examples into OpenAPI paths.\n *\n * Each request becomes an operation in the paths object.\n * Request examples are merged into parameter examples and request body examples.\n *\n * Also extracts servers from paths that contain full URLs (e.g., \"https://api.example.com/users\")\n * and returns them separately for deduplication at the document level.\n */\nconst transformRequestsToPaths = (\n collection: v_2_5_0['Collection'],\n dataRecords: v_2_5_0['DataRecord'],\n): { paths: Record<string, PathItemObject>; extractedServers: ServerObject[] } => {\n const paths = Object.create(null) as Record<string, PathItemObject>\n const extractedServers: ServerObject[] = []\n\n for (const requestUid of collection.requests || []) {\n const request = dataRecords.requests[requestUid]\n if (!request) {\n continue\n }\n\n const {\n path,\n method,\n uid: _uid,\n type: _type,\n selectedServerUid: _selectedServerUid,\n examples,\n servers,\n selectedSecuritySchemeUids: _selectedSecuritySchemeUids,\n parameters = [],\n requestBody,\n ...rest\n } = request\n\n let normalizedPath = path || '/'\n\n /**\n * Extract server from path if it contains a full URL.\n * This handles legacy data where users may have entered full URLs as paths.\n */\n const extractedServerUrl = extractServerFromPath(normalizedPath)\n if (extractedServerUrl?.length === 2) {\n const [serverUrl, remainingPath] = extractedServerUrl\n extractedServers.push({ url: serverUrl })\n normalizedPath = remainingPath\n\n /**\n * Handle edge case where the path after server is empty or just \"/\"\n * Example: \"https://api.example.com\" \u2192 \"\" \u2192 \"/\"\n */\n if (!normalizedPath) {\n normalizedPath = '/'\n }\n // Handle double slashes from malformed URLs like \"https://api.example.com//users\"\n else if (normalizedPath.startsWith('//')) {\n normalizedPath = normalizedPath.slice(1)\n }\n }\n\n // Normalize relative paths to start with a leading slash. OpenAPI paths must start with \"/\" per the spec\n if (!normalizedPath.startsWith('/')) {\n normalizedPath = `/${normalizedPath}`\n }\n\n // Initialize path object if it doesn't exist\n if (!paths[normalizedPath]) {\n paths[normalizedPath] = {}\n }\n\n /** Start building the OAS operation object */\n const partialOperation: OperationObject = {\n ...rest,\n }\n\n // Get request examples for this request\n const requestExamples = (examples || []).flatMap((exampleUid) => {\n const example = dataRecords.requestExamples[exampleUid]\n return example ? [example] : []\n })\n\n // Merge examples into parameters\n const mergedParameters = mergeExamplesIntoParameters(parameters, requestExamples)\n if (mergedParameters.length > 0) {\n partialOperation.parameters = mergedParameters\n }\n\n // Merge examples into request body\n const mergedRequestBody = mergeExamplesIntoRequestBody(requestBody, requestExamples)\n if (mergedRequestBody) {\n partialOperation.requestBody = mergedRequestBody\n }\n\n // Add server overrides if present\n if (servers && servers.length > 0) {\n partialOperation.servers = servers.flatMap((serverUid) => {\n const server = dataRecords.servers[serverUid]\n if (!server) {\n return []\n }\n const { uid: _, ...rest } = server\n return [rest]\n })\n }\n\n const pathItem = paths[normalizedPath]\n if (pathItem) {\n pathItem[method] = partialOperation\n }\n }\n\n return { paths, extractedServers }\n}\n\n/**\n * The legacy data model uses plural \"headers\"/\"cookies\" for parameter categories,\n * but OpenAPI uses singular \"header\"/\"cookie\" for the `in` field. This mapping\n * normalizes the legacy names to their OpenAPI equivalents.\n */\nconst PARAM_TYPE_TO_IN: Record<string, string> = {\n path: 'path',\n query: 'query',\n headers: 'header',\n cookies: 'cookie',\n}\n\n/**\n * Ensures unique example names by appending #2, #3, etc. when duplicates are found.\n * Does not use slugification - preserves the original name with a numeric suffix.\n */\nconst ensureUniqueExampleName = (baseName: string, usedNames: Set<string>): string => {\n let uniqueName = baseName\n let counter = 2\n\n while (usedNames.has(uniqueName)) {\n uniqueName = `${baseName} #${counter}`\n counter++\n }\n\n usedNames.add(uniqueName)\n return uniqueName\n}\n\n/**\n * Merges request example values into OpenAPI parameter objects.\n *\n * In the legacy data model, parameter values live on individual RequestExample\n * objects (one per \"example\" tab in the UI). OpenAPI instead stores examples\n * directly on each Parameter object via the `examples` map.\n */\nconst mergeExamplesIntoParameters = (\n parameters: RequestParameter[],\n requestExamples: v_2_5_0['RequestExample'][],\n): ParameterObject[] => {\n /**\n * We track parameters and their collected examples together in a single map\n * keyed by `{in}:{name}` (e.g. \"query:page\") to avoid a second lookup pass.\n */\n const paramEntries = new Map<\n string,\n { param: ParameterObject; examples: Record<string, { value: string; 'x-disabled': boolean }> }\n >()\n\n // Seed with the operation's existing parameters so they are preserved even if\n // no request example references them.\n for (const param of parameters) {\n // Build a type-safe ParameterObject by explicitly mapping properties\n // The old RequestParameter type uses z.unknown() for schema/content/examples,\n // but these values come from validated OpenAPI documents and are already in the correct format.\n // We use type assertions (via unknown) to bridge from the old loose types to the new strict types.\n // This is safe because the data has already been validated by the Zod schema.\n\n // Build either ParameterWithSchemaObject or ParameterWithContentObject\n let paramObject: ParameterObject\n\n // Param with Content Type\n if (param.content && typeof param.content === 'object') {\n paramObject = {\n name: param.name,\n in: param.in,\n required: param.required ?? param.in === 'path',\n deprecated: param.deprecated ?? false,\n content: param.content as ParameterWithContentObject['content'],\n ...(param.description && { description: param.description }),\n } satisfies ParameterWithContentObject\n }\n\n // Param with Schema Type\n else {\n paramObject = {\n name: param.name,\n in: param.in,\n required: param.required ?? param.in === 'path',\n deprecated: param.deprecated ?? false,\n ...(param.description && { description: param.description }),\n ...(param.schema ? { schema: param.schema as ParameterWithSchemaObject['schema'] } : {}),\n ...(param.style && { style: param.style }),\n ...(param.explode !== undefined && { explode: param.explode }),\n ...(param.example !== undefined && { example: param.example }),\n ...(param.examples &&\n typeof param.examples === 'object' && {\n examples: param.examples as ParameterWithSchemaObject['examples'],\n }),\n } satisfies ParameterWithSchemaObject\n }\n\n paramEntries.set(`${param.in}:${param.name}`, {\n param: paramObject,\n examples: {},\n })\n }\n\n const paramTypes = Object.keys(PARAM_TYPE_TO_IN)\n const usedExampleNames = new Set<string>()\n\n for (const requestExample of requestExamples) {\n const baseName = requestExample.name || 'Example'\n const exampleName = ensureUniqueExampleName(baseName, usedExampleNames)\n\n for (const paramType of paramTypes) {\n const inValue = PARAM_TYPE_TO_IN[paramType]\n const items = requestExample.parameters?.[paramType as keyof typeof requestExample.parameters] || []\n\n for (const item of items) {\n const key = `${inValue}:${item.key}`\n\n // Lets not save any params without a key\n if (!item.key) {\n continue\n }\n\n const lowerKey = item.key.toLowerCase()\n\n /**\n * Lazily create a parameter stub when one does not already exist\n * Path parameters are always required per the OpenAPI spec\n *\n * We do not add Accept: *\\/*\n * We do not add any Content-Type headers that are auto added in the client\n */\n if (\n !paramEntries.has(key) &&\n (lowerKey !== 'content-type' || !CONTENT_TYPES[item.value as keyof typeof CONTENT_TYPES]) &&\n (lowerKey !== 'accept' || item.value !== '*/*')\n ) {\n paramEntries.set(key, {\n param: {\n name: item.key,\n in: (inValue as ParameterObject['in']) ?? 'query',\n required: inValue === 'path',\n deprecated: false,\n schema: { type: 'string' },\n },\n examples: {},\n })\n }\n\n // We have skipped the content-type or accept headers above\n const param = paramEntries.get(key)\n if (!param) {\n continue\n }\n\n param.examples[exampleName] = {\n value: item.value,\n 'x-disabled': !item.enabled,\n }\n }\n }\n }\n\n // Build the final parameter list, only attaching `examples` when there are any\n return Array.from(paramEntries.values()).map(({ param, examples }) => {\n if (Object.keys(examples).length > 0) {\n ;(param as ParameterWithSchemaObject).examples = examples\n }\n return param\n })\n}\n\n/** Maps legacy raw body encoding names (e.g. \"json\", \"xml\") to their corresponding MIME content types */\nconst RAW_ENCODING_TO_CONTENT_TYPE: Record<string, string> = {\n json: 'application/json',\n xml: 'application/xml',\n yaml: 'application/yaml',\n edn: 'application/edn',\n text: 'text/plain',\n html: 'text/html',\n javascript: 'application/javascript',\n}\n\n/**\n * Extracts the content type and example value from a single request example body.\n *\n * The legacy data model stored body content in one of three shapes:\n * - `raw` \u2014 text-based body with an encoding hint (json, xml, etc.)\n * - `formData` \u2014 key/value pairs with either multipart or URL-encoded encoding\n * - `binary` \u2014 file upload with no inline content\n */\nconst extractBodyExample = (\n body: v_2_5_0['RequestExample']['body'],\n): { contentType: string; value: unknown } | undefined => {\n if (!body?.activeBody) {\n return undefined\n }\n\n // Raw text body \u2014 resolve the short encoding name to a full MIME type\n if (body.activeBody === 'raw' && body.raw) {\n return {\n contentType: RAW_ENCODING_TO_CONTENT_TYPE[body.raw.encoding] || 'text/plain',\n value: body.raw.value,\n }\n }\n\n // Form data \u2014 distinguish between multipart (file uploads) and URL-encoded\n if (body.activeBody === 'formData' && body.formData) {\n return {\n contentType: body.formData.encoding === 'form-data' ? 'multipart/form-data' : 'application/x-www-form-urlencoded',\n value: body.formData.value.flatMap((param) =>\n param.key\n ? {\n name: param.key,\n value: param.value,\n isDisabled: !param.enabled,\n }\n : [],\n ),\n }\n }\n\n // Binary uploads have no inline content to migrate\n if (body.activeBody === 'binary') {\n return { contentType: 'binary', value: {} }\n }\n\n return undefined\n}\n\n/**\n * Merges request examples into request body examples.\n *\n * The v2.5.0 data model stored request examples separately from the\n * operation's requestBody. In the new model, examples live directly inside\n * `requestBody.content[contentType].examples`. This function bridges the two\n * by grouping examples by content type in a single pass and writing them into\n * the requestBody structure.\n *\n * Returns the original requestBody unchanged when no examples have body content.\n */\nconst mergeExamplesIntoRequestBody = (\n requestBody: RequestBodyObject,\n requestExamples: v_2_5_0['RequestExample'][],\n): RequestBodyObject => {\n /**\n * Single pass: extract each example body and bucket it by content type.\n * Using a plain object as the inner value (instead of a nested Map) avoids\n * a second conversion step when assigning to the result.\n */\n const groupedByContentType = new Map<string, Record<string, { value: unknown }>>()\n\n /** We track the selected content type for each example */\n const selectedContentTypes = {} as Record<string, string>\n\n const usedExampleNames = new Set<string>()\n\n for (const example of requestExamples) {\n const extracted = extractBodyExample(example.body)\n if (!extracted) {\n continue\n }\n\n const baseName = example.name || 'Example'\n const name = ensureUniqueExampleName(baseName, usedExampleNames)\n const group = groupedByContentType.get(extracted.contentType)\n\n if (group) {\n group[name] = { value: extracted.value }\n } else {\n groupedByContentType.set(extracted.contentType, { [name]: { value: extracted.value } })\n }\n\n selectedContentTypes[name] = extracted.contentType\n }\n\n // Nothing to merge \u2014 return early so we do not mutate the requestBody\n if (groupedByContentType.size === 0) {\n return requestBody\n }\n\n // Ensure the requestBody and its content map exist before writing\n const result = requestBody ?? {}\n result.content ??= {}\n\n for (const [contentType, examples] of groupedByContentType) {\n result.content[contentType] ??= {}\n result.content[contentType].examples = examples\n }\n\n // Add the x-scalar-selected-content-type mapping\n if (Object.keys(selectedContentTypes).length > 0) {\n result['x-scalar-selected-content-type'] = selectedContentTypes\n }\n\n return result\n}\n\n/**\n * Transforms legacy tags into OpenAPI tags and tag groups.\n *\n * Legacy structure:\n * - Tags can have children (nested tags)\n * - Top-level parent tags become tag groups\n * - Child tags and standalone tags become regular tags\n */\nconst transformLegacyTags = (\n collection: v_2_5_0['Collection'],\n dataRecords: v_2_5_0['DataRecord'],\n): { tags: TagObject[]; tagGroups: Array<{ name: string; tags: string[] }> } => {\n const tags: TagObject[] = []\n const tagGroups: XTagGroup[] = []\n\n /**\n * Identifies which tags are top-level (appear in collection.children).\n * Top-level parent tags become tag groups, others become regular tags.\n */\n const topLevelTagUids = new Set(collection.children.filter((uid) => dataRecords.tags[uid] !== undefined))\n\n /**\n * Identifies which tags have children.\n * Only top-level parent tags become tag groups.\n */\n const parentTagUids = new Set(\n collection.tags.filter((uid) => {\n const tag = dataRecords.tags[uid]\n return tag?.children && tag.children.length > 0\n }),\n )\n\n /**\n * Process each tag to create either a tag group or a regular tag.\n */\n for (const tagUid of collection.tags) {\n const tag = dataRecords.tags[tagUid]\n if (!tag) {\n continue\n }\n\n const isTopLevelParent = topLevelTagUids.has(tagUid) && parentTagUids.has(tagUid)\n\n if (isTopLevelParent) {\n /**\n * Top-level parent tags become tag groups.\n * Resolve child tag names, filtering out any missing children.\n */\n const childTagNames = tag.children\n .map((childUid) => dataRecords.tags[childUid]?.name)\n .filter((name): name is string => name !== undefined)\n\n if (childTagNames.length > 0) {\n tagGroups.push({\n name: tag.name,\n tags: childTagNames,\n })\n }\n } else {\n /**\n * All other tags (child tags and standalone tags) become regular tags.\n * Preserve optional fields from the legacy tag.\n */\n const tagObject: TagObject = { name: tag.name }\n\n if (tag.description) {\n tagObject.description = tag.description\n }\n if (tag.externalDocs) {\n tagObject.externalDocs = tag.externalDocs\n }\n\n tags.push(tagObject)\n }\n }\n\n return { tags, tagGroups }\n}\n\n/** Transforms a collection and everything it includes into a WorkspaceDocument + auth */\nconst transformCollectionToDocument = (\n documentName: string,\n collection: v_2_5_0['Collection'],\n dataRecords: v_2_5_0['DataRecord'],\n): { document: WorkspaceDocument; auth: Auth } => {\n // Resolve selectedServerUid \u2192 server URL for x-scalar-selected-server\n const selectedServerUrl =\n collection.selectedServerUid && dataRecords.servers[collection.selectedServerUid]\n ? dataRecords.servers[collection.selectedServerUid]?.url\n : undefined\n\n // Transform tags: separate parent tags (groups) from child tags\n const { tags, tagGroups } = transformLegacyTags(collection, dataRecords)\n\n // Transform requests into paths and extract servers from full URLs\n const { paths, extractedServers } = transformRequestsToPaths(collection, dataRecords)\n\n /**\n * Merge and deduplicate servers:\n * 1. Start with existing collection servers\n * 2. Add extracted servers from paths\n * 3. Deduplicate by URL (keep first occurrence)\n */\n const existingServers = collection.servers.flatMap((uid) => {\n const server = dataRecords.servers[uid]\n if (!server) {\n return []\n }\n\n const { uid: _, ...rest } = server\n return [rest]\n })\n\n const allServers = [...existingServers, ...extractedServers]\n const seenUrls = new Set<string>()\n const deduplicatedServers = allServers.filter((server) => {\n if (seenUrls.has(server.url)) {\n return false\n }\n seenUrls.add(server.url)\n return true\n })\n\n const document: Record<string, unknown> = {\n openapi: collection.openapi || '3.1.0',\n info: collection.info || {\n title: documentName,\n version: '1.0',\n },\n servers: deduplicatedServers,\n paths,\n /**\n * Preserve all component types from the collection and merge with transformed security schemes.\n * OpenAPI components object supports: schemas, responses, parameters, examples,\n * requestBodies, headers, securitySchemes, links, callbacks, pathItems\n */\n components: {\n // Preserve existing components from the collection (schemas, responses, parameters, etc.)\n ...(collection.components || {}),\n // Merge security schemes (transformed from UIDs) with any existing security schemes\n securitySchemes: {\n ...((collection.components as Record<string, unknown>)?.securitySchemes || {}),\n ...collection.securitySchemes.reduce((acc, uid) => {\n const securityScheme = dataRecords.securitySchemes[uid]\n if (!securityScheme) {\n return acc\n }\n\n const { uid: _uid, nameKey: _nameKey, ...publicSecurityScheme } = removeSecretFields(securityScheme)\n\n // Clean the flows\n if (securityScheme.type === 'oauth2') {\n const selectedScopes = new Set<string>()\n\n return {\n ...acc,\n [securityScheme.nameKey]: {\n ...publicSecurityScheme,\n flows: objectEntries(securityScheme.flows).reduce(\n (acc, [key, flow]) => {\n if (!flow) {\n return acc\n }\n\n // Store any selected scopes from the config\n if ('selectedScopes' in flow && Array.isArray(flow.selectedScopes)) {\n flow.selectedScopes?.forEach((scope) => selectedScopes.add(scope))\n }\n\n acc[key] = removeSecretFields(flow) as Oauth2Flow\n return acc\n },\n {} as Record<string, Oauth2Flow>,\n ),\n 'x-default-scopes': Array.from(selectedScopes),\n },\n }\n }\n\n return {\n ...acc,\n [securityScheme.nameKey]: publicSecurityScheme,\n }\n }, {}),\n },\n },\n security: collection.security || [],\n tags,\n webhooks: collection.webhooks,\n externalDocs: collection.externalDocs,\n\n // Preserve scalar extensions\n 'x-scalar-icon': collection['x-scalar-icon'],\n\n // Convert legacy record-based environment variables to the new array format\n 'x-scalar-environments': transformLegacyEnvironments(collection['x-scalar-environments']),\n\n // useCollectionSecurity \u2192 x-scalar-set-operation-security\n 'x-scalar-set-operation-security': collection.useCollectionSecurity ?? false,\n }\n\n // Add x-tagGroups if there are any parent tags\n if (tagGroups.length > 0) {\n document['x-tagGroups'] = tagGroups\n }\n\n // x-scalar-active-environment \u2192 x-scalar-client-config-active-environment\n if (collection['x-scalar-active-environment']) {\n document['x-scalar-client-config-active-environment'] = collection['x-scalar-active-environment']\n }\n\n // selectedServerUid \u2192 x-scalar-selected-server (resolved to URL)\n if (selectedServerUrl) {\n document['x-scalar-selected-server'] = selectedServerUrl\n }\n\n // documentUrl \u2192 x-scalar-original-source-url\n if (collection.documentUrl) {\n document['x-scalar-original-source-url'] = collection.documentUrl\n }\n\n // Break any circular JS object references before coercion.\n // The legacy client dereferenced $refs inline, creating circular object graphs\n // that would cause JSON serialization and schema validation to fail.\n const safeDocument = circularToRefs(document, {\n '$ref-value': '',\n '$global': false,\n 'summary': 'This ref was re-created from a circular schema reference',\n })\n\n return {\n document: coerceValue(OpenAPIDocumentSchema, safeDocument),\n auth: coerceValue(AuthSchema, {\n secrets: collection.securitySchemes.reduce((acc, uid) => {\n const securityScheme = dataRecords.securitySchemes[uid]\n if (!securityScheme) {\n return acc\n }\n\n // Oauth 2\n if (securityScheme.type === 'oauth2') {\n return {\n ...acc,\n [securityScheme.nameKey]: {\n type: securityScheme.type,\n ...objectEntries(securityScheme.flows).reduce(\n (acc, [key, flow]) => {\n if (!flow) {\n return acc\n }\n\n acc[key] = extractConfigSecrets(flow)\n return acc\n },\n {} as Record<string, Record<string, string>>,\n ),\n },\n }\n }\n\n // The rest\n return {\n ...acc,\n [securityScheme.nameKey]: {\n type: securityScheme.type,\n ...extractConfigSecrets(securityScheme),\n },\n }\n }, {}),\n selected: {},\n }),\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB,0BAA0B;AACzD,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;AACtC,SAAuB,eAAe;AAEtC,SAAS,4BAA4B;AACrC,SAAoB,kBAAkB;AACtC,SAAS,uCAAuC;AAChD;AAAA,EAEE;AAAA,OACK;AACP,SAAS,2BAA2B;AAGpC,SAAS,mBAAmB;AAC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AO;AAAA,UACL,GAAG;AAAA,UACH,CAAC,eAAe,OAAO,GAAG;AAAA,YACxB,MAAM,eAAe;AAAA,YACrB,GAAG,qBAAqB,cAAc;AAAA,UACxC;AAAA,QACF;AAAA,MACF,GAAG,CAAC,CAAC;AAAA,MACL,UAAU,CAAC;AAAA,IACb,CAAC;AAAA,EACH;AACF;",
|
|
4
|
+
"sourcesContent": ["import { CONTENT_TYPES } from '@scalar/helpers/consts/content-types'\nimport { extractConfigSecrets, removeSecretFields } from '@scalar/helpers/general/extract-config-secrets'\nimport { circularToRefs } from '@scalar/helpers/object/circular-to-refs'\nimport { objectEntries } from '@scalar/helpers/object/object-entries'\nimport { extractServerFromPath } from '@scalar/helpers/url/extract-server-from-path'\nimport { type ThemeId, presets } from '@scalar/themes'\nimport type { Oauth2Flow } from '@scalar/types/entities'\nimport { createWorkspaceStore } from '@scalar/workspace-store/client'\nimport { type Auth, AuthSchema } from '@scalar/workspace-store/entities/auth'\nimport { createWorkspaceStorePersistence } from '@scalar/workspace-store/persistence'\nimport {\n type XScalarEnvironments,\n xScalarEnvironmentSchema,\n} from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { xScalarCookieSchema } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type { XTagGroup } from '@scalar/workspace-store/schemas/extensions/tag'\nimport type { InMemoryWorkspace } from '@scalar/workspace-store/schemas/inmemory-workspace'\nimport { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce'\nimport {\n OpenAPIDocumentSchema,\n type OpenApiDocument,\n type OperationObject,\n type ParameterObject,\n type ParameterWithContentObject,\n type ParameterWithSchemaObject,\n type PathItemObject,\n type RequestBodyObject,\n type ServerObject,\n type TagObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { WorkspaceDocument, WorkspaceExtensions, WorkspaceMeta } from '@scalar/workspace-store/schemas/workspace'\nimport { ColorModeSchema } from '@scalar/workspace-store/schemas/workspace'\nimport GithubSlugger from 'github-slugger'\n\nimport type { RequestParameter } from '@/entities/spec/parameters'\nimport { migrator } from '@/migrations/migrator'\nimport type { v_2_5_0 } from '@/migrations/v-2.5.0/types.generated'\n\nconst DRAFTS_DOCUMENT_NAME = 'drafts'\n\n/**\n * Migrates localStorage data to IndexedDB workspace structure.\n *\n * Called early in app initialization (app-state.ts) before workspace data loads.\n * Idempotent and non-destructive - runs when legacy data exists but IndexedDB is empty.\n *\n * Flow:\n * 1. Check if migration needed (has legacy data + IndexedDB is empty)\n * 2. Run existing migrations to get latest data structure\n * 3. Transform to new workspace format\n * 4. Save to IndexedDB\n *\n * Old data is preserved for rollback. Typically completes in < 1 second.\n */\nexport const migrateLocalStorageToIndexDb = async () => {\n const { close, workspace: workspacePersistence } = await createWorkspaceStorePersistence()\n\n try {\n const shouldMigrate = await shouldMigrateToIndexDb(workspacePersistence)\n\n if (!shouldMigrate) {\n console.info('\u2139\uFE0F No migration needed - IndexedDB already has workspaces or no legacy data exists')\n return\n }\n\n console.info('\uD83D\uDE80 Starting migration from localStorage to IndexedDB...')\n\n // Step 1: Run existing migrations to get latest data structure\n const legacyData = migrator()\n\n console.info(\n `\uD83D\uDCE6 Found legacy data: ${legacyData.arrays.workspaces.length} workspace(s), ${legacyData.arrays.collections.length} collection(s)`,\n )\n\n // Step 2: Transform to new workspace structure\n const workspaces = await transformLegacyDataToWorkspace(legacyData)\n\n // Step 3: Save to IndexedDB\n await Promise.all(\n workspaces.map((workspace) =>\n workspacePersistence.setItem(\n { namespace: 'local', slug: workspace.slug },\n {\n name: workspace.name,\n workspace: workspace.workspace,\n teamUid: 'local',\n },\n ),\n ),\n )\n\n console.info(`\u2705 Successfully migrated ${workspaces.length} workspace(s) to IndexedDB`)\n } catch (error) {\n console.error('\u274C Migration failed:', error)\n } finally {\n close()\n }\n}\n\n/**\n * Checks if migration is needed by verifying IndexedDB state and presence of legacy data.\n *\n * Migration is needed when:\n * 1. Legacy data exists in localStorage (workspace, collection, or request keys)\n * 2. AND IndexedDB has no workspaces yet\n *\n * This approach is more reliable than using a flag because:\n * - If IndexedDB is cleared, migration will run again automatically\n * - No risk of flag getting out of sync with actual data state\n * - Handles edge cases like partial migrations or database corruption\n */\nexport const shouldMigrateToIndexDb = async (\n workspacePersistence: Awaited<ReturnType<typeof createWorkspaceStorePersistence>>['workspace'],\n): Promise<boolean> => {\n // Check if there is any old data in localStorage\n const hasLegacyData =\n localStorage.getItem('workspace') !== null ||\n localStorage.getItem('collection') !== null ||\n localStorage.getItem('request') !== null\n\n if (!hasLegacyData) {\n return false\n }\n\n // Check if IndexedDB already has workspaces\n const existingWorkspaces = await workspacePersistence.getAll()\n const hasIndexDbData = existingWorkspaces.length > 0\n\n // Only migrate if we have legacy data but no IndexedDB data\n return !hasIndexDbData\n}\n\n/**\n * Transforms legacy localStorage data into IndexedDB workspace structure.\n *\n * Transformations:\n * - Collections \u2192 Documents (collections were OpenAPI specs)\n * - Environments \u2192 x-scalar-environments in meta\n * - Cookies \u2192 x-scalar-cookies in meta\n * - Workspace properties \u2192 meta extensions (activeEnvironmentId, proxyUrl, themeId)\n *\n * Creates a default workspace if none exist. Falls back to collection uid if info.title is missing.\n */\nexport const transformLegacyDataToWorkspace = async (legacyData: {\n arrays: v_2_5_0['DataArray']\n records: v_2_5_0['DataRecord']\n}) =>\n await Promise.all(\n legacyData.arrays.workspaces.map(async (workspace) => {\n /** Grab auth from the collections */\n const workspaceAuth: InMemoryWorkspace['auth'] = {}\n\n /** Create a slugger instance per workspace to handle duplicate document names */\n const documentSlugger = new GithubSlugger()\n\n /** Each collection becomes a document in the new system and grab the auth as well */\n const documents: { name: string; document: OpenApiDocument }[] = workspace.collections.flatMap((uid) => {\n const collection = legacyData.records.collections[uid]\n if (!collection) {\n return []\n }\n\n const documentName = collection.info?.title || 'api'\n const { document, auth } = transformCollectionToDocument(documentName, collection, legacyData.records)\n\n // Normalize document name to match the store (lowercase \"Drafts\" \u2192 \"drafts\")\n const normalizedName = documentName === 'Drafts' ? 'drafts' : documentName\n\n // Use GitHubSlugger to ensure unique document names\n const uniqueName = documentSlugger.slug(normalizedName, false)\n\n workspaceAuth[uniqueName] = auth\n\n return { name: uniqueName, document }\n })\n\n const meta: WorkspaceMeta = {}\n const extensions: WorkspaceExtensions = {}\n\n // Add environment\n const environmentEntries = Object.entries(workspace.environments)\n if (environmentEntries.length > 0) {\n extensions['x-scalar-environments'] = {\n default: coerceValue(xScalarEnvironmentSchema, {\n variables: environmentEntries.map(([name, value]) => ({\n name,\n value,\n })),\n }),\n }\n }\n\n // Add cookies to meta\n if (workspace.cookies.length > 0) {\n extensions['x-scalar-cookies'] = workspace.cookies.flatMap((uid) => {\n const cookie = legacyData.records.cookies[uid]\n return cookie ? coerceValue(xScalarCookieSchema, cookie) : []\n })\n }\n\n // Add proxy URL if present\n if (workspace.proxyUrl) {\n meta['x-scalar-active-proxy'] = workspace.proxyUrl\n }\n\n // Add theme if present\n if (workspace.themeId) {\n // We use theme slugs on the new system so we need to transform the id to the slug\n meta['x-scalar-theme'] = transformThemeIdToSlug(workspace.themeId)\n }\n\n // Set color mode\n if (localStorage.getItem('colorMode')) {\n meta['x-scalar-color-mode'] = coerceValue(ColorModeSchema, localStorage.getItem('colorMode'))\n }\n\n const store = createWorkspaceStore({\n meta,\n })\n\n await Promise.all(\n documents.map(async ({ name, document }) => {\n await store.addDocument({\n name,\n document,\n })\n // Note: we are breaking the relationship between the document and the originial source url\n }),\n )\n\n // Try to always set the drafts / route\n if (!(DRAFTS_DOCUMENT_NAME in store.workspace.documents)) {\n await store.addDocument({\n name: DRAFTS_DOCUMENT_NAME,\n document: {\n openapi: '3.1.0',\n info: {\n title: 'Drafts',\n version: '1.0.0',\n },\n paths: {\n '/': {\n get: {},\n },\n },\n 'x-scalar-icon': 'interface-edit-tool-pencil',\n },\n })\n }\n\n const drafts = store.workspace.documents[DRAFTS_DOCUMENT_NAME]\n\n if (drafts) {\n // Make sure the drafts document has a GET / route cuz that's the first route we navigate the user to\n drafts.paths ??= {}\n drafts.paths['/'] ??= {}\n drafts.paths['/']['get'] ??= {}\n }\n\n store.buildSidebar(DRAFTS_DOCUMENT_NAME)\n // save the document to the store so we don't see the document as dirty\n await store.saveDocument(DRAFTS_DOCUMENT_NAME)\n\n // Load the auth into the store\n store.auth.load(workspaceAuth)\n\n // Load the extensions into the store\n objectEntries(extensions).forEach(([key, value]) => {\n store.update(key, value)\n })\n\n return {\n slug: workspace.uid.toString(), // Convert to string to convert it to a simple string type\n name: workspace.name || 'Untitled Workspace',\n workspace: store.exportWorkspace(),\n }\n }),\n )\n\n/**\n * Converts a ThemeId to its corresponding theme slug.\n * If the themeId is 'none', return it as is.\n * Otherwise, look up the slug in the presets object.\n */\nconst transformThemeIdToSlug = (themeId: ThemeId): string => {\n if (themeId === 'none') {\n return themeId\n }\n return presets[themeId]?.slug ?? 'default'\n}\n\n/**\n * Converts legacy environment variables from record format to the new array format.\n *\n * Legacy format: { variables: { API_URL: 'https://...', API_KEY: 'secret' } }\n * New format: { variables: [{ name: 'API_URL', value: 'https://...' }, { name: 'API_KEY', value: 'secret' }] }\n */\nconst transformLegacyEnvironments = (\n environments: v_2_5_0['Collection']['x-scalar-environments'],\n): XScalarEnvironments | undefined => {\n const entries = Object.entries(environments || {})\n if (entries.length === 0) {\n return undefined\n }\n\n return Object.fromEntries(\n entries.map(([envName, env]) => [\n envName,\n coerceValue(xScalarEnvironmentSchema, {\n color: env.color,\n variables: Object.entries(env.variables || {}).map(([name, value]) => ({\n name,\n value: typeof value === 'string' ? value : value.default || '',\n })),\n }),\n ]),\n )\n}\n\n/**\n * Transforms legacy requests and request examples into OpenAPI paths.\n *\n * Each request becomes an operation in the paths object.\n * Request examples are merged into parameter examples and request body examples.\n *\n * Also extracts servers from paths that contain full URLs (e.g., \"https://api.example.com/users\")\n * and returns them separately for deduplication at the document level.\n */\nconst transformRequestsToPaths = (\n collection: v_2_5_0['Collection'],\n dataRecords: v_2_5_0['DataRecord'],\n): { paths: Record<string, PathItemObject>; extractedServers: ServerObject[] } => {\n const paths = Object.create(null) as Record<string, PathItemObject>\n const extractedServers: ServerObject[] = []\n\n for (const requestUid of collection.requests || []) {\n const request = dataRecords.requests[requestUid]\n if (!request) {\n continue\n }\n\n const {\n path,\n method,\n uid: _uid,\n type: _type,\n selectedServerUid: _selectedServerUid,\n examples,\n servers,\n selectedSecuritySchemeUids: _selectedSecuritySchemeUids,\n parameters = [],\n requestBody,\n ...rest\n } = request\n\n let normalizedPath = path || '/'\n\n /**\n * Extract server from path if it contains a full URL.\n * This handles legacy data where users may have entered full URLs as paths.\n */\n const extractedServerUrl = extractServerFromPath(normalizedPath)\n if (extractedServerUrl?.length === 2) {\n const [serverUrl, remainingPath] = extractedServerUrl\n extractedServers.push({ url: serverUrl })\n normalizedPath = remainingPath\n\n /**\n * Handle edge case where the path after server is empty or just \"/\"\n * Example: \"https://api.example.com\" \u2192 \"\" \u2192 \"/\"\n */\n if (!normalizedPath) {\n normalizedPath = '/'\n }\n // Handle double slashes from malformed URLs like \"https://api.example.com//users\"\n else if (normalizedPath.startsWith('//')) {\n normalizedPath = normalizedPath.slice(1)\n }\n }\n\n // Normalize relative paths to start with a leading slash. OpenAPI paths must start with \"/\" per the spec\n if (!normalizedPath.startsWith('/')) {\n normalizedPath = `/${normalizedPath}`\n }\n\n // Initialize path object if it doesn't exist\n if (!paths[normalizedPath]) {\n paths[normalizedPath] = {}\n }\n\n /** Start building the OAS operation object */\n const partialOperation: OperationObject = {\n ...rest,\n }\n\n // Get request examples for this request\n const requestExamples = (examples || []).flatMap((exampleUid) => {\n const example = dataRecords.requestExamples[exampleUid]\n return example ? [example] : []\n })\n\n // Merge examples into parameters\n const mergedParameters = mergeExamplesIntoParameters(parameters, requestExamples)\n if (mergedParameters.length > 0) {\n partialOperation.parameters = mergedParameters\n }\n\n // Merge examples into request body\n const mergedRequestBody = mergeExamplesIntoRequestBody(requestBody, requestExamples)\n if (mergedRequestBody) {\n partialOperation.requestBody = mergedRequestBody\n }\n\n // Add server overrides if present\n if (servers && servers.length > 0) {\n partialOperation.servers = servers.flatMap((serverUid) => {\n const server = dataRecords.servers[serverUid]\n if (!server) {\n return []\n }\n const { uid: _, ...rest } = server\n return [rest]\n })\n }\n\n const pathItem = paths[normalizedPath]\n if (pathItem) {\n pathItem[method] = partialOperation\n }\n }\n\n return { paths, extractedServers }\n}\n\n/**\n * The legacy data model uses plural \"headers\"/\"cookies\" for parameter categories,\n * but OpenAPI uses singular \"header\"/\"cookie\" for the `in` field. This mapping\n * normalizes the legacy names to their OpenAPI equivalents.\n */\nconst PARAM_TYPE_TO_IN: Record<string, string> = {\n path: 'path',\n query: 'query',\n headers: 'header',\n cookies: 'cookie',\n}\n\n/**\n * Ensures unique example names by appending #2, #3, etc. when duplicates are found.\n * Does not use slugification - preserves the original name with a numeric suffix.\n */\nconst ensureUniqueExampleName = (baseName: string, usedNames: Set<string>): string => {\n let uniqueName = baseName\n let counter = 2\n\n while (usedNames.has(uniqueName)) {\n uniqueName = `${baseName} #${counter}`\n counter++\n }\n\n usedNames.add(uniqueName)\n return uniqueName\n}\n\n/**\n * Merges request example values into OpenAPI parameter objects.\n *\n * In the legacy data model, parameter values live on individual RequestExample\n * objects (one per \"example\" tab in the UI). OpenAPI instead stores examples\n * directly on each Parameter object via the `examples` map.\n */\nconst mergeExamplesIntoParameters = (\n parameters: RequestParameter[],\n requestExamples: v_2_5_0['RequestExample'][],\n): ParameterObject[] => {\n /**\n * We track parameters and their collected examples together in a single map\n * keyed by `{in}:{name}` (e.g. \"query:page\") to avoid a second lookup pass.\n */\n const paramEntries = new Map<\n string,\n { param: ParameterObject; examples: Record<string, { value: string; 'x-disabled': boolean }> }\n >()\n\n // Seed with the operation's existing parameters so they are preserved even if\n // no request example references them.\n for (const param of parameters) {\n // Build a type-safe ParameterObject by explicitly mapping properties\n // The old RequestParameter type uses z.unknown() for schema/content/examples,\n // but these values come from validated OpenAPI documents and are already in the correct format.\n // We use type assertions (via unknown) to bridge from the old loose types to the new strict types.\n // This is safe because the data has already been validated by the Zod schema.\n\n // Build either ParameterWithSchemaObject or ParameterWithContentObject\n let paramObject: ParameterObject\n\n // Param with Content Type\n if (param.content && typeof param.content === 'object') {\n paramObject = {\n name: param.name,\n in: param.in,\n required: param.required ?? param.in === 'path',\n deprecated: param.deprecated ?? false,\n content: param.content as ParameterWithContentObject['content'],\n ...(param.description && { description: param.description }),\n } satisfies ParameterWithContentObject\n }\n\n // Param with Schema Type\n else {\n paramObject = {\n name: param.name,\n in: param.in,\n required: param.required ?? param.in === 'path',\n deprecated: param.deprecated ?? false,\n ...(param.description && { description: param.description }),\n ...(param.schema ? { schema: param.schema as ParameterWithSchemaObject['schema'] } : {}),\n ...(param.style && { style: param.style }),\n ...(param.explode !== undefined && { explode: param.explode }),\n ...(param.example !== undefined && { example: param.example }),\n ...(param.examples &&\n typeof param.examples === 'object' && {\n examples: param.examples as ParameterWithSchemaObject['examples'],\n }),\n } satisfies ParameterWithSchemaObject\n }\n\n paramEntries.set(`${param.in}:${param.name}`, {\n param: paramObject,\n examples: {},\n })\n }\n\n const paramTypes = Object.keys(PARAM_TYPE_TO_IN)\n const usedExampleNames = new Set<string>()\n\n for (const requestExample of requestExamples) {\n const baseName = requestExample.name || 'Example'\n const exampleName = ensureUniqueExampleName(baseName, usedExampleNames)\n\n for (const paramType of paramTypes) {\n const inValue = PARAM_TYPE_TO_IN[paramType]\n const items = requestExample.parameters?.[paramType as keyof typeof requestExample.parameters] || []\n\n for (const item of items) {\n const key = `${inValue}:${item.key}`\n\n // Lets not save any params without a key\n if (!item.key) {\n continue\n }\n\n const lowerKey = item.key.toLowerCase()\n\n /**\n * Lazily create a parameter stub when one does not already exist\n * Path parameters are always required per the OpenAPI spec\n *\n * We do not add Accept: *\\/*\n * We do not add any Content-Type headers that are auto added in the client\n */\n if (\n !paramEntries.has(key) &&\n (lowerKey !== 'content-type' || !CONTENT_TYPES[item.value as keyof typeof CONTENT_TYPES]) &&\n (lowerKey !== 'accept' || item.value !== '*/*')\n ) {\n paramEntries.set(key, {\n param: {\n name: item.key,\n in: (inValue as ParameterObject['in']) ?? 'query',\n required: inValue === 'path',\n deprecated: false,\n schema: { type: 'string' },\n },\n examples: {},\n })\n }\n\n // We have skipped the content-type or accept headers above\n const param = paramEntries.get(key)\n if (!param) {\n continue\n }\n\n param.examples[exampleName] = {\n value: item.value,\n 'x-disabled': !item.enabled,\n }\n }\n }\n }\n\n // Build the final parameter list, only attaching `examples` when there are any\n return Array.from(paramEntries.values()).map(({ param, examples }) => {\n if (Object.keys(examples).length > 0) {\n ;(param as ParameterWithSchemaObject).examples = examples\n }\n return param\n })\n}\n\n/** Maps legacy raw body encoding names (e.g. \"json\", \"xml\") to their corresponding MIME content types */\nconst RAW_ENCODING_TO_CONTENT_TYPE: Record<string, string> = {\n json: 'application/json',\n xml: 'application/xml',\n yaml: 'application/yaml',\n edn: 'application/edn',\n text: 'text/plain',\n html: 'text/html',\n javascript: 'application/javascript',\n}\n\n/**\n * Extracts the content type and example value from a single request example body.\n *\n * The legacy data model stored body content in one of three shapes:\n * - `raw` \u2014 text-based body with an encoding hint (json, xml, etc.)\n * - `formData` \u2014 key/value pairs with either multipart or URL-encoded encoding\n * - `binary` \u2014 file upload with no inline content\n */\nconst extractBodyExample = (\n body: v_2_5_0['RequestExample']['body'],\n): { contentType: string; value: unknown } | undefined => {\n if (!body?.activeBody) {\n return undefined\n }\n\n // Raw text body \u2014 resolve the short encoding name to a full MIME type\n if (body.activeBody === 'raw' && body.raw) {\n return {\n contentType: RAW_ENCODING_TO_CONTENT_TYPE[body.raw.encoding] || 'text/plain',\n value: body.raw.value,\n }\n }\n\n // Form data \u2014 distinguish between multipart (file uploads) and URL-encoded\n if (body.activeBody === 'formData' && body.formData) {\n return {\n contentType: body.formData.encoding === 'form-data' ? 'multipart/form-data' : 'application/x-www-form-urlencoded',\n value: body.formData.value.flatMap((param) =>\n param.key\n ? {\n name: param.key,\n value: param.value,\n isDisabled: !param.enabled,\n }\n : [],\n ),\n }\n }\n\n // Binary uploads have no inline content to migrate\n if (body.activeBody === 'binary') {\n return { contentType: 'binary', value: {} }\n }\n\n return undefined\n}\n\n/**\n * Merges request examples into request body examples.\n *\n * The v2.5.0 data model stored request examples separately from the\n * operation's requestBody. In the new model, examples live directly inside\n * `requestBody.content[contentType].examples`. This function bridges the two\n * by grouping examples by content type in a single pass and writing them into\n * the requestBody structure.\n *\n * Returns the original requestBody unchanged when no examples have body content.\n */\nconst mergeExamplesIntoRequestBody = (\n requestBody: RequestBodyObject,\n requestExamples: v_2_5_0['RequestExample'][],\n): RequestBodyObject => {\n /**\n * Single pass: extract each example body and bucket it by content type.\n * Using a plain object as the inner value (instead of a nested Map) avoids\n * a second conversion step when assigning to the result.\n */\n const groupedByContentType = new Map<string, Record<string, { value: unknown }>>()\n\n /** We track the selected content type for each example */\n const selectedContentTypes = {} as Record<string, string>\n\n const usedExampleNames = new Set<string>()\n\n for (const example of requestExamples) {\n const extracted = extractBodyExample(example.body)\n if (!extracted) {\n continue\n }\n\n const baseName = example.name || 'Example'\n const name = ensureUniqueExampleName(baseName, usedExampleNames)\n const group = groupedByContentType.get(extracted.contentType)\n\n if (group) {\n group[name] = { value: extracted.value }\n } else {\n groupedByContentType.set(extracted.contentType, { [name]: { value: extracted.value } })\n }\n\n selectedContentTypes[name] = extracted.contentType\n }\n\n // Nothing to merge \u2014 return early so we do not mutate the requestBody\n if (groupedByContentType.size === 0) {\n return requestBody\n }\n\n // Ensure the requestBody and its content map exist before writing\n const result = requestBody ?? {}\n result.content ??= {}\n\n for (const [contentType, examples] of groupedByContentType) {\n result.content[contentType] ??= {}\n result.content[contentType].examples = examples\n }\n\n // Add the x-scalar-selected-content-type mapping\n if (Object.keys(selectedContentTypes).length > 0) {\n result['x-scalar-selected-content-type'] = selectedContentTypes\n }\n\n return result\n}\n\n/**\n * Transforms legacy tags into OpenAPI tags and tag groups.\n *\n * Legacy structure:\n * - Tags can have children (nested tags)\n * - Top-level parent tags become tag groups\n * - Child tags and standalone tags become regular tags\n */\nconst transformLegacyTags = (\n collection: v_2_5_0['Collection'],\n dataRecords: v_2_5_0['DataRecord'],\n): { tags: TagObject[]; tagGroups: Array<{ name: string; tags: string[] }> } => {\n const tags: TagObject[] = []\n const tagGroups: XTagGroup[] = []\n\n /**\n * Identifies which tags are top-level (appear in collection.children).\n * Top-level parent tags become tag groups, others become regular tags.\n */\n const topLevelTagUids = new Set(collection.children.filter((uid) => dataRecords.tags[uid] !== undefined))\n\n /**\n * Identifies which tags have children.\n * Only top-level parent tags become tag groups.\n */\n const parentTagUids = new Set(\n collection.tags.filter((uid) => {\n const tag = dataRecords.tags[uid]\n return tag?.children && tag.children.length > 0\n }),\n )\n\n /**\n * Process each tag to create either a tag group or a regular tag.\n */\n for (const tagUid of collection.tags) {\n const tag = dataRecords.tags[tagUid]\n if (!tag) {\n continue\n }\n\n const isTopLevelParent = topLevelTagUids.has(tagUid) && parentTagUids.has(tagUid)\n\n if (isTopLevelParent) {\n /**\n * Top-level parent tags become tag groups.\n * Resolve child tag names, filtering out any missing children.\n */\n const childTagNames = tag.children\n .map((childUid) => dataRecords.tags[childUid]?.name)\n .filter((name): name is string => name !== undefined)\n\n if (childTagNames.length > 0) {\n tagGroups.push({\n name: tag.name,\n tags: childTagNames,\n })\n }\n } else {\n /**\n * All other tags (child tags and standalone tags) become regular tags.\n * Preserve optional fields from the legacy tag.\n */\n const tagObject: TagObject = { name: tag.name }\n\n if (tag.description) {\n tagObject.description = tag.description\n }\n if (tag.externalDocs) {\n tagObject.externalDocs = tag.externalDocs\n }\n\n tags.push(tagObject)\n }\n }\n\n return { tags, tagGroups }\n}\n\n/** Transforms a collection and everything it includes into a WorkspaceDocument + auth */\nconst transformCollectionToDocument = (\n documentName: string,\n collection: v_2_5_0['Collection'],\n dataRecords: v_2_5_0['DataRecord'],\n): { document: WorkspaceDocument; auth: Auth } => {\n // Resolve selectedServerUid \u2192 server URL for x-scalar-selected-server\n const selectedServerUrl =\n collection.selectedServerUid && dataRecords.servers[collection.selectedServerUid]\n ? dataRecords.servers[collection.selectedServerUid]?.url\n : undefined\n\n // Transform tags: separate parent tags (groups) from child tags\n const { tags, tagGroups } = transformLegacyTags(collection, dataRecords)\n\n // Transform requests into paths and extract servers from full URLs\n const { paths, extractedServers } = transformRequestsToPaths(collection, dataRecords)\n\n /**\n * Merge and deduplicate servers:\n * 1. Start with existing collection servers\n * 2. Add extracted servers from paths\n * 3. Deduplicate by URL (keep first occurrence)\n */\n const existingServers = collection.servers.flatMap((uid) => {\n const server = dataRecords.servers[uid]\n if (!server) {\n return []\n }\n\n const { uid: _, ...rest } = server\n return [rest]\n })\n\n const allServers = [...existingServers, ...extractedServers]\n const seenUrls = new Set<string>()\n const deduplicatedServers = allServers.filter((server) => {\n if (seenUrls.has(server.url)) {\n return false\n }\n seenUrls.add(server.url)\n return true\n })\n\n const document: Record<string, unknown> = {\n openapi: collection.openapi || '3.1.0',\n info: collection.info || {\n title: documentName,\n version: '1.0',\n },\n servers: deduplicatedServers,\n paths,\n /**\n * Preserve all component types from the collection and merge with transformed security schemes.\n * OpenAPI components object supports: schemas, responses, parameters, examples,\n * requestBodies, headers, securitySchemes, links, callbacks, pathItems\n */\n components: {\n // Preserve existing components from the collection (schemas, responses, parameters, etc.)\n ...(collection.components || {}),\n // Merge security schemes (transformed from UIDs) with any existing security schemes\n securitySchemes: {\n ...((collection.components as Record<string, unknown>)?.securitySchemes || {}),\n ...collection.securitySchemes.reduce((acc, uid) => {\n const securityScheme = dataRecords.securitySchemes[uid]\n if (!securityScheme) {\n return acc\n }\n\n const { uid: _uid, nameKey: _nameKey, ...publicSecurityScheme } = removeSecretFields(securityScheme)\n\n // Clean the flows\n if (securityScheme.type === 'oauth2') {\n const selectedScopes = new Set<string>()\n\n return {\n ...acc,\n [securityScheme.nameKey]: {\n ...publicSecurityScheme,\n flows: objectEntries(securityScheme.flows).reduce(\n (acc, [key, flow]) => {\n if (!flow) {\n return acc\n }\n\n // Store any selected scopes from the config\n if ('selectedScopes' in flow && Array.isArray(flow.selectedScopes)) {\n flow.selectedScopes?.forEach((scope) => selectedScopes.add(scope))\n }\n\n acc[key] = removeSecretFields(flow) as Oauth2Flow\n return acc\n },\n {} as Record<string, Oauth2Flow>,\n ),\n 'x-default-scopes': Array.from(selectedScopes),\n },\n }\n }\n\n return {\n ...acc,\n [securityScheme.nameKey]: publicSecurityScheme,\n }\n }, {}),\n },\n },\n security: collection.security || [],\n tags,\n webhooks: collection.webhooks,\n externalDocs: collection.externalDocs,\n\n // Preserve scalar extensions\n 'x-scalar-icon': collection['x-scalar-icon'],\n\n // Convert legacy record-based environment variables to the new array format\n 'x-scalar-environments': transformLegacyEnvironments(collection['x-scalar-environments']),\n }\n\n // Add x-tagGroups if there are any parent tags\n if (tagGroups.length > 0) {\n document['x-tagGroups'] = tagGroups\n }\n\n // x-scalar-active-environment\n if (collection['x-scalar-active-environment']) {\n document['x-scalar-active-environment'] = collection['x-scalar-active-environment']\n }\n\n // selectedServerUid \u2192 x-scalar-selected-server (resolved to URL)\n if (selectedServerUrl) {\n document['x-scalar-selected-server'] = selectedServerUrl\n }\n\n // documentUrl \u2192 x-scalar-original-source-url\n if (collection.documentUrl) {\n document['x-scalar-original-source-url'] = collection.documentUrl\n }\n\n // Break any circular JS object references before coercion.\n // The legacy client dereferenced $refs inline, creating circular object graphs\n // that would cause JSON serialization and schema validation to fail.\n const safeDocument = circularToRefs(document, {\n '$ref-value': '',\n '$global': false,\n 'summary': 'This ref was re-created from a circular schema reference',\n })\n\n return {\n document: coerceValue(OpenAPIDocumentSchema, safeDocument),\n auth: coerceValue(AuthSchema, {\n secrets: collection.securitySchemes.reduce((acc, uid) => {\n const securityScheme = dataRecords.securitySchemes[uid]\n if (!securityScheme) {\n return acc\n }\n\n // Oauth 2\n if (securityScheme.type === 'oauth2') {\n return {\n ...acc,\n [securityScheme.nameKey]: {\n type: securityScheme.type,\n ...objectEntries(securityScheme.flows).reduce(\n (acc, [key, flow]) => {\n if (!flow) {\n return acc\n }\n\n acc[key] = extractConfigSecrets(flow)\n return acc\n },\n {} as Record<string, Record<string, string>>,\n ),\n },\n }\n }\n\n // The rest\n return {\n ...acc,\n [securityScheme.nameKey]: {\n type: securityScheme.type,\n ...extractConfigSecrets(securityScheme),\n },\n }\n }, {}),\n selected: {},\n }),\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB,0BAA0B;AACzD,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;AACtC,SAAuB,eAAe;AAEtC,SAAS,4BAA4B;AACrC,SAAoB,kBAAkB;AACtC,SAAS,uCAAuC;AAChD;AAAA,EAEE;AAAA,OACK;AACP,SAAS,2BAA2B;AAGpC,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,OAUK;AAEP,SAAS,uBAAuB;AAChC,OAAO,mBAAmB;AAG1B,SAAS,gBAAgB;AAGzB,MAAM,uBAAuB;AAgBtB,MAAM,+BAA+B,YAAY;AACtD,QAAM,EAAE,OAAO,WAAW,qBAAqB,IAAI,MAAM,gCAAgC;AAEzF,MAAI;AACF,UAAM,gBAAgB,MAAM,uBAAuB,oBAAoB;AAEvE,QAAI,CAAC,eAAe;AAClB,cAAQ,KAAK,+FAAqF;AAClG;AAAA,IACF;AAEA,YAAQ,KAAK,gEAAyD;AAGtE,UAAM,aAAa,SAAS;AAE5B,YAAQ;AAAA,MACN,gCAAyB,WAAW,OAAO,WAAW,MAAM,kBAAkB,WAAW,OAAO,YAAY,MAAM;AAAA,IACpH;AAGA,UAAM,aAAa,MAAM,+BAA+B,UAAU;AAGlE,UAAM,QAAQ;AAAA,MACZ,WAAW;AAAA,QAAI,CAAC,cACd,qBAAqB;AAAA,UACnB,EAAE,WAAW,SAAS,MAAM,UAAU,KAAK;AAAA,UAC3C;AAAA,YACE,MAAM,UAAU;AAAA,YAChB,WAAW,UAAU;AAAA,YACrB,SAAS;AAAA,UACX;AAAA,QACF;AAAA,MACF;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I,CAAC,gBAAgB;AACnB,iBAAO;AAAA,QACT;AAGA,YAAI,eAAe,SAAS,UAAU;AACpC,iBAAO;AAAA,YACL,GAAG;AAAA,YACH,CAAC,eAAe,OAAO,GAAG;AAAA,cACxB,MAAM,eAAe;AAAA,cACrB,GAAG,cAAc,eAAe,KAAK,EAAE;AAAA,gBACrC,CAACA,MAAK,CAAC,KAAK,IAAI,MAAM;AACpB,sBAAI,CAAC,MAAM;AACT,2BAAOA;AAAA,kBACT;AAEA,kBAAAA,KAAI,GAAG,IAAI,qBAAqB,IAAI;AACpC,yBAAOA;AAAA,gBACT;AAAA,gBACA,CAAC;AAAA,cACH;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAGA,eAAO;AAAA,UACL,GAAG;AAAA,UACH,CAAC,eAAe,OAAO,GAAG;AAAA,YACxB,MAAM,eAAe;AAAA,YACrB,GAAG,qBAAqB,cAAc;AAAA,UACxC;AAAA,QACF;AAAA,MACF,GAAG,CAAC,CAAC;AAAA,MACL,UAAU,CAAC;AAAA,IACb,CAAC;AAAA,EACH;AACF;",
|
|
6
6
|
"names": ["rest", "acc"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"specification",
|
|
17
17
|
"yaml"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.
|
|
19
|
+
"version": "0.8.0",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=20"
|
|
22
22
|
},
|
|
@@ -91,13 +91,13 @@
|
|
|
91
91
|
"vue": "^3.5.26",
|
|
92
92
|
"yaml": "^2.8.0",
|
|
93
93
|
"zod": "^4.3.5",
|
|
94
|
-
"@scalar/openapi-types": "0.5.3",
|
|
95
94
|
"@scalar/helpers": "0.2.16",
|
|
96
|
-
"@scalar/object-utils": "1.2.30",
|
|
97
95
|
"@scalar/json-magic": "0.11.5",
|
|
98
|
-
"@scalar/
|
|
99
|
-
"@scalar/
|
|
100
|
-
"@scalar/
|
|
96
|
+
"@scalar/object-utils": "1.2.30",
|
|
97
|
+
"@scalar/openapi-types": "0.5.3",
|
|
98
|
+
"@scalar/themes": "0.14.2",
|
|
99
|
+
"@scalar/workspace-store": "0.35.1",
|
|
100
|
+
"@scalar/types": "0.6.8"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@types/node": "^22.19.3",
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
"vite": "^7.3.1",
|
|
106
106
|
"vitest": "4.0.16",
|
|
107
107
|
"zod-to-ts": "github:amritk/zod-to-ts#build",
|
|
108
|
-
"@scalar/openapi-parser": "0.24.
|
|
109
|
-
"@scalar/
|
|
110
|
-
"@scalar/
|
|
108
|
+
"@scalar/openapi-parser": "0.24.15",
|
|
109
|
+
"@scalar/build-tooling": "0.4.1",
|
|
110
|
+
"@scalar/openapi-types": "0.5.3"
|
|
111
111
|
},
|
|
112
112
|
"scripts": {
|
|
113
113
|
"build": "scalar-build-esbuild",
|