@scalar/blocks 0.8.1 → 0.9.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 +10 -0
- package/dist/code-example/components/CodeExample.vue.d.ts +2 -0
- package/dist/code-example/components/CodeExample.vue.d.ts.map +1 -1
- package/dist/code-example/components/CodeExample.vue.js +1 -1
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js +3 -0
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/code-example/helpers/generate-code-snippet.d.ts +3 -1
- package/dist/code-example/helpers/generate-code-snippet.d.ts.map +1 -1
- package/dist/code-example/helpers/generate-code-snippet.js +6 -5
- package/dist/code-example/helpers/generate-code-snippet.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts +3 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.js +30 -29
- package/dist/code-example/helpers/operation-to-har/operation-to-har.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-body.d.ts +2 -2
- package/dist/code-example/helpers/operation-to-har/process-body.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-body.js +84 -66
- package/dist/code-example/helpers/operation-to-har/process-body.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/style.css +2 -2
- package/dist/vue-styles.css +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @scalar/blocks
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#11137](https://github.com/scalar/scalar/pull/11137): Add an opt-in ASP.NET Core form naming mode through the API Reference configuration option `multipartNaming: "indexed-dot"`. The body editor, sent requests, and code samples use indexed dotted names such as `Certificates[0].name` for nested fields in multipart and URL-encoded request bodies.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#11146](https://github.com/scalar/scalar/pull/11146): Update compatible npm dependencies for AI chat, encoding, analytics, date handling, HTTP serving, and application query caching.
|
|
12
|
+
|
|
3
13
|
## 0.8.1
|
|
4
14
|
|
|
5
15
|
No changes in this release.
|
|
@@ -3,6 +3,7 @@ import { type SecuritySchemeObjectSecret } from '@scalar/workspace-store/request
|
|
|
3
3
|
import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
|
|
4
4
|
import type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
5
5
|
import type { ClientOptionGroup } from '../types';
|
|
6
|
+
import type { MultipartNaming } from '@scalar/types/api-reference';
|
|
6
7
|
export type CodeExampleProps = {
|
|
7
8
|
/** Localized status text shown when the selected example has no linked code sample. */
|
|
8
9
|
codeSampleUnavailable?: string;
|
|
@@ -125,6 +126,7 @@ export type CodeExampleProps = {
|
|
|
125
126
|
openapiVersion?: string;
|
|
126
127
|
/** Document-level JSON Schema dialect used when generating array `contains` examples. */
|
|
127
128
|
jsonSchemaDialect?: string;
|
|
129
|
+
multipartNaming?: MultipartNaming;
|
|
128
130
|
requestBodyCompositionSelection?: Record<string, number>;
|
|
129
131
|
};
|
|
130
132
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeExample.vue.d.ts","sourceRoot":"","sources":["../../../src/code-example/components/CodeExample.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CodeExample.vue.d.ts","sourceRoot":"","sources":["../../../src/code-example/components/CodeExample.vue"],"names":[],"mappings":"AA0xBA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAUvE,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CA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AC/B;;;OAGG;IACH,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,yFAAyF;IACzF,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACzD,CAAA;AAED;;;;;;;;GAQG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;;;;;YAyCN,MAAM,OAAO;IACvB,kGAAkG;qBACjF,MAAM,OAAO;YACpB,CAAC,EAAE,WAAW,EAAE,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO;EAkzB7D,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -2,7 +2,7 @@ import e from "./CodeExample.vue_vue_type_script_setup_true_lang.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
4
|
// src/code-example/components/CodeExample.vue
|
|
5
|
-
var n = /*#__PURE__*/ t(e, [["__scopeId", "data-v-
|
|
5
|
+
var n = /*#__PURE__*/ t(e, [["__scopeId", "data-v-f11de264"]]);
|
|
6
6
|
export { n as default };
|
|
7
7
|
|
|
8
8
|
//# sourceMappingURL=CodeExample.vue.js.map
|
|
@@ -65,6 +65,7 @@ var E = ["innerHTML"], D = {
|
|
|
65
65
|
globalCookies: {},
|
|
66
66
|
openapiVersion: {},
|
|
67
67
|
jsonSchemaDialect: {},
|
|
68
|
+
multipartNaming: {},
|
|
68
69
|
requestBodyCompositionSelection: {}
|
|
69
70
|
},
|
|
70
71
|
emits: ["update:exampleKey"],
|
|
@@ -100,6 +101,7 @@ var E = ["innerHTML"], D = {
|
|
|
100
101
|
example: L.value,
|
|
101
102
|
openapiVersion: f.openapiVersion,
|
|
102
103
|
jsonSchemaDialect: f.jsonSchemaDialect,
|
|
104
|
+
multipartNaming: f.multipartNaming,
|
|
103
105
|
requestBodyCompositionSelection: f.requestBodyCompositionSelection,
|
|
104
106
|
defaultDisabledParameters: !0
|
|
105
107
|
});
|
|
@@ -121,6 +123,7 @@ var E = ["innerHTML"], D = {
|
|
|
121
123
|
globalCookies: f.globalCookies,
|
|
122
124
|
openapiVersion: f.openapiVersion,
|
|
123
125
|
jsonSchemaDialect: f.jsonSchemaDialect,
|
|
126
|
+
multipartNaming: f.multipartNaming,
|
|
124
127
|
requestBodyCompositionSelection: f.requestBodyCompositionSelection
|
|
125
128
|
})), Y = a(() => !f.isWebhook && H.value?.id.startsWith("custom/") && J.value !== null && f.securitySchemes.some((e) => "x-scalar-credential-placeholders" in e) ? fe(J.value, f.securitySchemes) : void 0), X = a(() => Y.value?.content ?? J.value), Z = a(() => Y.value?.displayContent ?? X.value), Q = a(() => f.isWebhook ? Te.value : H.value?.lang), Te = a(() => {
|
|
126
129
|
if (!q.value?.postData) return "json";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeExample.vue_vue_type_script_setup_true_lang.js","names":["$slots","_unref","_openBlock","_createBlock","_withCtx","_createVNode","_createSlots","_createElementVNode","HttpMethod","_createElementBlock","_renderSlot","_createTextVNode","_toDisplayString","_normalizeClass","_Fragment","ExamplePicker","ExamplePicker_default","HttpMethod_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","CodeExample_vue_vue_type_script_setup_true_lang_default","__emit","emit","requestBodyExamples","computed","content","getResolvedRef","__props","contentType","localExampleKey","ref","resolveExampleKey","keys","preferred","watch","watchEffect","selectExample","key","customCodeSamples","getCustomCodeSamples","clients","getClients","clientCount","total","group","localSelectedClient","findClient","newClient","client","clientPickerAriaLabel","codeSampleAriaLabel","elem","visible","useExampleVisibility","externalExamples","useExternalExamples","getOperationExamples","resolvedOperation","resolveOperationExamples","showExamplePicker","webhookHar","operationToHar","error","generatedTemplate","generateCodeSnippet","resolvedCredentials","scheme","resolveCredentialPlaceholders","generatedCode","displayCode","codeBlockLanguage","webhookLanguage","secretCredentials","getSecrets","selectClient","unfreeze","freezeElement","option","shouldVirtualize","id","useId","unref","openBlock","createBlock","ScalarCard","withCtx","createVNode","ScalarCardHeader","createSlots","_cache","createElementVNode","createElementBlock","createCommentVNode","renderSlot","_ctx","ScalarCombobox","filterClientsByQuery","$event","ScalarButton","createTextVNode","toDisplayString","ScalarIconCaretDown","normalizeClass","open","ScalarCardSection","Fragment","ScalarCodeBlockCopy","ScalarVirtualText","ScalarCodeBlock","ScalarCardFooter"],"sources":["../../../src/code-example/components/CodeExample.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type CodeExampleProps = {\n /** Localized status text shown when the selected example has no linked code sample. */\n codeSampleUnavailable?: string\n /**\n * Localized purpose of the client picker. It opens the button's accessible name and the\n * selected client's title is appended, so the name still contains the visible label.\n */\n clientPickerLabel?: string\n /** Localized accessible name for the search field inside the client picker. */\n clientSearchLabel?: string\n /**\n * Localized accessible name for the focusable code sample. The selected client's title is\n * appended so the announcement also says which language the sample is in.\n */\n codeSampleLabel?: string\n /**\n * Integration type: determines if the code sample is displayed in a client environment\n * or in an API reference environment.\n */\n integration?: 'client' | 'reference'\n /**\n * List of all http clients formatted into option groups for the client selector\n */\n clientOptions: ClientOptionGroup[]\n /**\n * Pre-selected client, this will determine which client is initially selected in the dropdown.\n * Either a built-in client id (e.g. `js/fetch`) or a custom sample id (e.g. `custom/python`).\n *\n * Typed as a plain string: unioning the (large) client-id union with the `custom/...`\n * ids overflows TypeScript's union-complexity limit inside this component's `defineProps`.\n *\n * @defaults to a custom sample if one is available, otherwise shell/curl\n */\n selectedClient?: string\n /**\n * Which server from the spec to use for the code example\n */\n selectedServer?: ServerObject | null\n /**\n * The selected content type from the requestBody.content, this will determine which examples are available\n * as well as the content type of the code example\n *\n * @defaults to the first content type if not provided\n */\n selectedContentType?: string\n /**\n * Example name to use for resolving example values for parameters AND requestBody.\n *\n * This is the document-wide selection: it is honored only when this operation defines an example\n * with the same key, so picking an example on one operation syncs the rest without blanking out\n * operations that do not share that key.\n *\n * @example \"limited\"\n * ```ts\n * parameters: {\n * name: 'foobar',\n * in: 'query',\n * examples: {\n * limited: {\n * dataValue: 10,\n * }\n * }\n * },\n * body: {\n * content: {\n * 'application/json': {\n * examples: {\n * limited: {\n * dataValue: { foo: 'bar' },\n * }\n * }\n * }\n * }\n * }\n *\n * ```\n */\n selectedExample?: string\n /**\n * Event bus\n */\n eventBus: WorkspaceEventBus\n /**\n * The security schemes which are applicable to this operation\n */\n securitySchemes: SecuritySchemeObjectSecret[]\n /**\n * HTTP method of the operation\n */\n method: string\n /**\n * Path of the operation\n */\n path: string\n /**\n * De-referenced OpenAPI Operation object\n */\n operation: OperationObject\n /**\n * If true and there's no example, we will display a small card with the method and path only\n */\n fallback?: boolean\n /**\n * A method to generate the label of the block, should return an html string\n */\n generateLabel?: () => string\n /**\n * If true, render this as a webhook request example\n */\n isWebhook?: boolean\n /**\n * Workspace + document cookies\n */\n globalCookies?: XScalarCookie[]\n /**\n * When the request body schema uses oneOf/anyOf, use these selected variants\n * for the example snippet (e.g. from the schema dropdowns in the API reference).\n */\n /** Originating OpenAPI version, used for XML mapping rules. */\n openapiVersion?: string\n /** Document-level JSON Schema dialect used when generating array `contains` examples. */\n jsonSchemaDialect?: string\n requestBodyCompositionSelection?: Record<string, number>\n}\n\n/**\n * Request Example\n *\n * The core component for rendering a request example block,\n * this component does not have much of its own state but operates on props and custom events\n *\n * @event workspace:update:selected-client - Emitted when the selected client changes\n * @event workspace:update:selected-example - Emitted when the selected example changes, so other operations can sync\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardHeader,\n ScalarCardSection,\n} from '@scalar/components/card'\nimport {\n ScalarCodeBlock,\n ScalarCodeBlockCopy,\n} from '@scalar/components/code-block'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarVirtualText } from '@scalar/components/virtual-text'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getOperationExamples,\n resolveOperationExamples,\n} from '@scalar/workspace-store/helpers/operation-examples'\nimport {\n useExampleVisibility,\n useExternalExamples,\n} from '@scalar/workspace-store/helpers/use-external-examples'\nimport {\n resolveCredentialPlaceholders,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OperationObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n computed,\n ref,\n useId,\n watch,\n watchEffect,\n type ComponentPublicInstance,\n} from 'vue'\n\nimport { filterClientsByQuery } from '../helpers/filter-clients-by-query'\nimport { findClient } from '../helpers/find-client'\nimport { generateCodeSnippet } from '../helpers/generate-code-snippet'\nimport { getClients } from '../helpers/get-clients'\nimport { getCustomCodeSamples } from '../helpers/get-custom-code-samples'\nimport { getSecrets } from '../helpers/get-secrets'\nimport { operationToHar } from '../helpers/operation-to-har/operation-to-har'\nimport type {\n ClientOption,\n ClientOptionGroup,\n CustomClientOption,\n} from '../types'\nimport ExamplePicker from './ExamplePicker.vue'\nimport HttpMethod from './HttpMethod.vue'\n\nconst {\n integration,\n codeSampleUnavailable = 'No code sample available for this example.',\n clientPickerLabel = 'Change code sample language',\n clientSearchLabel = 'Search clients',\n codeSampleLabel = 'Code sample',\n clientOptions,\n selectedClient,\n selectedServer = null,\n selectedContentType,\n selectedExample,\n securitySchemes = [],\n method,\n eventBus,\n path,\n operation,\n isWebhook,\n generateLabel,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n} = defineProps<CodeExampleProps>()\n\nconst emit = defineEmits<{\n /**\n * Emitted whenever the example key actually shown for this operation changes.\n *\n * This is the resolved local key (not the raw document-wide selection), so layouts that render\n * the test-request button outside this component can open the client with the same example the\n * snippet displays.\n */\n (e: 'update:exampleKey', value: string): void\n}>()\n\ndefineSlots<{\n 'header': () => unknown\n /** Rendered at the start of the footer, only while the example picker does not need that space */\n 'footer-start'?: () => unknown\n 'footer': ({ exampleName }: { exampleName: string }) => unknown\n}>()\n\n/** Grab the examples for the given content type */\nconst requestBodyExamples = computed(() => {\n const content = getResolvedRef(operation.requestBody)?.content ?? {}\n const contentType = selectedContentType || Object.keys(content)[0]\n if (!contentType) return {}\n\n const examples = content[contentType]?.examples ?? {}\n\n return examples\n})\n\n/**\n * The example key actually shown for this operation.\n *\n * `selectedExample` is the document-wide selection that syncs across operations. We honor it only\n * when this operation actually defines that key, otherwise we keep the local example: a selection\n * on one operation should never blank out an operation that does not share the same example.\n */\nconst localExampleKey = ref('')\n\n/** Resolve the key to display, preferring the document-wide selection when this operation has it */\nconst resolveExampleKey = (preferred: string | undefined): string => {\n const keys = Object.keys(requestBodyExamples.value)\n if (preferred && keys.includes(preferred)) {\n return preferred\n }\n // Keep the current local example when it is still valid, otherwise fall back to the first one\n if (localExampleKey.value && keys.includes(localExampleKey.value)) {\n return localExampleKey.value\n }\n return keys[0] ?? ''\n}\n\n// Set the initial example from the document-wide selection, falling back to the first example.\n// This runs during setup so the server renders the same example as the browser.\nlocalExampleKey.value = resolveExampleKey(selectedExample)\n\n// Follow the document-wide selection when it changes and this operation has that example\nwatch(\n () => selectedExample,\n (preferred) => {\n localExampleKey.value = resolveExampleKey(preferred)\n },\n)\n\n/** Reset the selected example key if the content type changes and the new content type doesn't have the previously selected example */\nwatch(\n () => selectedContentType,\n () => {\n if (\n !Object.keys(requestBodyExamples.value).includes(localExampleKey.value)\n ) {\n // Re-resolve so the new content type still follows the document-wide selection when it has\n // that key, instead of always snapping back to the first example\n localExampleKey.value = resolveExampleKey(selectedExample)\n }\n },\n)\n\n// Keep the parent informed of the resolved key so a test-request button rendered outside this\n// component (e.g. the classic layout header) opens the client with the example the snippet shows\nwatchEffect(() => {\n emit('update:exampleKey', localExampleKey.value)\n})\n\n/** Select an example locally and sync the choice across the document */\nconst selectExample = (key: string) => {\n localExampleKey.value = key\n eventBus.emit('workspace:update:selected-example', key)\n}\n\n/** Grab any custom code samples from the operation */\nconst customCodeSamples = computed(() => getCustomCodeSamples(operation))\n\n/** Merge custom code samples with the client options */\nconst clients = computed(() =>\n getClients(\n customCodeSamples.value.samples,\n clientOptions,\n customCodeSamples.value.label,\n ),\n)\n\n/** Total number of available clients across all option groups */\nconst clientCount = computed(() =>\n clients.value.reduce((total, group) => total + group.options.length, 0),\n)\n\n/** The locally selected client which would include code samples from this operation only */\nconst localSelectedClient = ref<ClientOption | CustomClientOption | undefined>(\n findClient(clients.value, selectedClient),\n)\n\n/**\n * Re-resolve the local client whenever the global selection or the available\n * clients change. Watching `clients` matters when navigating between operations:\n * the stored id stays the same, but the matching option (e.g. a custom sample)\n * differs per operation, so without this the snippet could go stale.\n */\nwatch([() => selectedClient, clients], ([newClient]) => {\n const client = findClient(clients.value, newClient)\n if (client) {\n localSelectedClient.value = client\n }\n})\n\n/**\n * Accessible name for the client picker.\n *\n * On its own the button reads as its current value (\"C Libcurl\"), which never\n * says what activating it does. The visible title stays part of the name so it\n * still matches what is on screen.\n */\nconst clientPickerAriaLabel = computed(() =>\n [clientPickerLabel, localSelectedClient.value?.title]\n .filter(Boolean)\n .join(': '),\n)\n\n/**\n * Accessible name for the focusable code sample, e.g. \"Code sample: Shell cURL\".\n *\n * Screen readers announce only the name and role when focus lands on the scroller, so the\n * name tells the user both what the region is and which client it is generated for.\n */\nconst codeSampleAriaLabel = computed(() =>\n [codeSampleLabel, localSelectedClient.value?.title]\n .filter(Boolean)\n .join(': '),\n)\n\nconst elem = ref<ComponentPublicInstance | null>(null)\nconst visible = useExampleVisibility(elem)\nconst externalExamples = useExternalExamples(\n () =>\n getOperationExamples(operation, localExampleKey.value, selectedContentType),\n () => visible.value,\n)\nconst resolvedOperation = computed(() =>\n resolveOperationExamples(\n operation,\n localExampleKey.value,\n selectedContentType,\n externalExamples.resolve,\n ),\n)\n\n/** Keep the picker available because it also selects the example opened by Test Request. */\nconst showExamplePicker = computed(\n () => Object.keys(requestBodyExamples.value).length > 1,\n)\n\n/** Generate HAR data for webhook requests */\nconst webhookHar = computed(() => {\n if (!isWebhook) return null\n\n try {\n return operationToHar({\n operation: resolvedOperation.value,\n method,\n path,\n example: localExampleKey.value,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n // Only required parameters are shown in code examples; optional parameters\n // are omitted unless explicitly enabled via `x-disabled: false`.\n defaultDisabledParameters: true,\n })\n } catch (error) {\n console.error('[webhookHar]', error)\n return null\n }\n})\n\n/** Generate the code snippet for the selected example */\nconst generatedTemplate = computed<string | null>(() => {\n if (isWebhook) {\n return webhookHar.value?.postData?.text ?? ''\n }\n\n return generateCodeSnippet({\n // Only required parameters are shown in code examples; optional parameters\n // are omitted unless explicitly enabled via `x-disabled: false`.\n defaultDisabledParameters: true,\n includeDefaultHeaders: integration === 'client',\n clientId: localSelectedClient.value?.id,\n customCodeSamples: customCodeSamples.value.samples,\n operation: resolvedOperation.value,\n method,\n path,\n contentType: selectedContentType,\n server: selectedServer,\n securitySchemes,\n example: localExampleKey.value,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n })\n})\n\n/** Resolve custom templates at render time so auth changes never mutate the document. */\nconst resolvedCredentials = computed(() =>\n !isWebhook &&\n localSelectedClient.value?.id.startsWith('custom/') &&\n generatedTemplate.value !== null &&\n securitySchemes.some((scheme) => 'x-scalar-credential-placeholders' in scheme)\n ? resolveCredentialPlaceholders(generatedTemplate.value, securitySchemes)\n : undefined,\n)\n\nconst generatedCode = computed(\n () => resolvedCredentials.value?.content ?? generatedTemplate.value,\n)\n\n/** Mask inserted secrets before escaping or syntax tokenization can split their values. */\nconst displayCode = computed(\n () => resolvedCredentials.value?.displayContent ?? generatedCode.value,\n)\n\n/** The language for the code block, used for syntax highlighting */\nconst codeBlockLanguage = computed(() => {\n if (isWebhook) {\n return webhookLanguage.value\n }\n\n return localSelectedClient.value?.lang\n})\n\n/** Determine the language for webhook content based on MIME type */\nconst webhookLanguage = computed<string>(() => {\n if (!webhookHar.value?.postData) return 'json'\n\n const contentType = webhookHar.value.postData.mimeType\n if (contentType?.includes('json')) return 'json'\n if (contentType?.includes('xml')) return 'xml'\n if (contentType?.includes('yaml') || contentType?.includes('yml'))\n return 'yaml'\n if (contentType?.includes('text/plain')) return 'text'\n\n return 'json'\n})\n\n/** Block secrets from being shown in the code block */\nconst secretCredentials = computed(() =>\n resolvedCredentials.value ? [] : getSecrets(securitySchemes),\n)\n\n/** Set custom example, or update the selected HTTP client globally */\nconst selectClient = (option: ClientOption) => {\n // We need to freeze the ui to prevent scrolling as the clients change\n if (elem.value) {\n const unfreeze = freezeElement(elem.value.$el)\n setTimeout(() => {\n unfreeze()\n }, 300)\n }\n // Update to the local example\n localSelectedClient.value = option\n\n // Sync the selection globally so other operations follow along. Custom samples\n // sync too (keyed by language), so picking e.g. the Python SDK example here\n // shows the Python example on every operation that ships one.\n if (option) {\n eventBus.emit('workspace:update:selected-client', option.id)\n }\n}\n\n// Virtualize the code block if it's too large\n// This prevents the entire app from freezing up if there's a massive example\n// We set a lower threshold here as code examples can get quite large\nconst VIRTUALIZATION_THRESHOLD = 20_000\n\nconst shouldVirtualize = computed(\n () => (generatedCode.value?.length ?? 0) > VIRTUALIZATION_THRESHOLD,\n)\n\nconst id = useId()\n</script>\n<template>\n <ScalarCard\n v-if=\"\n generatedCode === null || generatedCode || externalExamples.pending.value\n \"\n ref=\"elem\"\n class=\"request-card dark-mode\">\n <!-- Header -->\n <ScalarCardHeader class=\"pr-2.5\">\n <span class=\"sr-only\">Request Example for</span>\n <HttpMethod\n as=\"span\"\n class=\"request-method\"\n :method=\"method\" />\n <span\n v-if=\"generateLabel\"\n v-html=\"generateLabel()\" />\n <slot name=\"header\" />\n <!-- Client picker -->\n <template\n v-if=\"!isWebhook && clientCount\"\n #actions>\n <!-- Multiple clients: render a dropdown to switch between them -->\n <ScalarCombobox\n v-if=\"clientCount > 1\"\n v-slot=\"{ open }\"\n class=\"max-h-80\"\n :filterFn=\"filterClientsByQuery\"\n :inputLabel=\"clientSearchLabel\"\n :modelValue=\"localSelectedClient\"\n :options=\"clients\"\n placement=\"bottom-end\"\n teleport\n @update:modelValue=\"selectClient($event as ClientOption)\">\n <ScalarButton\n :aria-label=\"clientPickerAriaLabel\"\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5 py-0 text-base font-normal\"\n data-testid=\"client-picker\"\n variant=\"ghost\">\n {{ localSelectedClient?.title }}\n <!--\n Follow this picker's own state. The `ui-open:` variant also matches any open\n Headless UI ancestor, such as an expanded operation in the classic layout.\n -->\n <ScalarIconCaretDown\n class=\"mt-px size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-180': open }\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarCombobox>\n <!-- Single client: just show its label, no need for a dropdown -->\n <span\n v-else\n class=\"text-c-2 flex h-full w-fit items-center px-0.5 py-0 text-base font-normal\"\n data-testid=\"client-picker\">\n {{ localSelectedClient?.title }}\n </span>\n </template>\n </ScalarCardHeader>\n\n <!-- Code snippet -->\n <ScalarCardSection class=\"request-editor-section custom-scroll p-0\">\n <div\n v-if=\"externalExamples.pending.value\"\n class=\"text-c-2 p-4\"\n role=\"status\">\n <template v-if=\"externalExamples.failed.value\">\n Could not load this example.\n <ScalarButton\n size=\"sm\"\n variant=\"ghost\"\n @click=\"externalExamples.retry\">\n Retry\n </ScalarButton>\n </template>\n <template v-else>Loading example…</template>\n </div>\n <div\n v-else-if=\"generatedCode === null\"\n class=\"text-c-2 p-4\"\n role=\"status\">\n {{ codeSampleUnavailable }}\n </div>\n <div\n v-else\n :id=\"`${id}-example`\"\n class=\"code-snippet group/code-block relative\">\n <ScalarCodeBlock\n v-if=\"!shouldVirtualize\"\n class=\"h-full bg-transparent\"\n :content=\"displayCode ?? ''\"\n :copyContent=\"resolvedCredentials ? (generatedCode ?? '') : undefined\"\n :hideCredentials=\"secretCredentials\"\n :label=\"codeSampleAriaLabel\"\n :lang=\"codeBlockLanguage\"\n lineNumbers />\n <template v-else>\n <ScalarCodeBlockCopy\n :aria-controls=\"`${id}-virtual-code`\"\n class=\"scalar-code-copy absolute top-2.5 right-2.5 z-1\"\n :content=\"generatedCode\"\n :lang=\"codeBlockLanguage\" />\n <ScalarVirtualText\n :id=\"`${id}-virtual-code`\"\n aria-label=\"Request code sample\"\n containerClass=\"custom-scroll scalar-code-block flex flex-1 max-h-screen\"\n contentClass=\"language-plaintext whitespace-pre font-code text-base p-2\"\n :lineHeight=\"20\"\n role=\"region\"\n :text=\"displayCode ?? ''\" />\n </template>\n </div>\n </ScalarCardSection>\n\n <!-- Footer -->\n <ScalarCardFooter\n v-if=\"showExamplePicker || $slots.footer || $slots['footer-start']\"\n class=\"request-card-footer\"\n :class=\"{\n 'request-card-footer--wraps':\n showExamplePicker || $slots['footer-start'],\n }\">\n <!-- Example picker -->\n <div\n v-if=\"showExamplePicker\"\n class=\"request-card-footer-addon\">\n <template v-if=\"Object.keys(requestBodyExamples).length\">\n <ExamplePicker\n :examples=\"requestBodyExamples\"\n :modelValue=\"localExampleKey\"\n @update:modelValue=\"selectExample\" />\n </template>\n </div>\n <!-- Otherwise the start of the footer is free for the caller -->\n <div\n v-else-if=\"$slots['footer-start']\"\n class=\"request-card-footer-start\">\n <slot name=\"footer-start\" />\n </div>\n\n <!-- Footer -->\n <slot\n :exampleName=\"localExampleKey\"\n name=\"footer\" />\n </ScalarCardFooter>\n </ScalarCard>\n\n <!-- Fallback card with just method and path in the case of no examples -->\n <ScalarCard\n v-else-if=\"fallback\"\n class=\"request-card dark-mode\">\n <!-- A single row of method, path and actions reads as a header, so it stays on the card -->\n <ScalarCardSection class=\"request-card-simple bg-transparent shadow-none\">\n <div class=\"request-header\">\n <HttpMethod\n as=\"span\"\n class=\"request-method\"\n :method=\"method\" />\n <slot name=\"header\" />\n </div>\n <div\n v-if=\"$slots.footer\"\n class=\"request-card-actions relative max-w-full\">\n <slot\n :exampleName=\"localExampleKey\"\n name=\"footer\" />\n </div>\n </ScalarCardSection>\n </ScalarCard>\n</template>\n<style scoped>\n.request-card {\n color: var(--scalar-color-1);\n font-size: var(--scalar-font-size-3);\n}\n.request-method {\n font-family: var(--scalar-font-code);\n margin-right: 6px;\n}\n.request-card-footer {\n display: flex;\n justify-content: flex-end;\n padding: 6px;\n flex-shrink: 0;\n position: relative;\n}\n/*\n * The example picker or footer-start content keeps room for itself; when the footer is too narrow\n * for everything, the end controls wrap onto a second line instead of squeezing or covering it.\n */\n.request-card-footer--wraps {\n flex-wrap: wrap;\n row-gap: 4px;\n}\n.request-card-footer-start {\n display: flex;\n align-items: center;\n flex: 1 0 auto;\n}\n/*\n * The picker asks for its example name's width, capped at 7em (about eight characters), so on a\n * narrow card the end controls wrap rather than squeeze the name out of view. The cap keeps a long\n * name truncating beside them on wider cards, as before. The picker never grows past its name, and\n * the end margin holds it at the start of the line.\n */\n.request-card-footer-addon {\n display: flex;\n align-items: center;\n\n flex: 1 1 7em;\n min-width: 0;\n max-width: max-content;\n margin-inline-end: auto;\n}\n.request-editor-section {\n display: flex;\n flex: 1;\n}\n/*\n * A long sample is drawn as virtual text with its own copy button rather than a code block, so\n * that button gets the same raised fill a code block gives its button on a card's surface.\n */\n.code-snippet > .scalar-code-copy {\n background: var(--scalar-card-surface-raised, var(--scalar-background-2));\n}\n.request-card-simple {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n\n padding: 8px 8px 8px 12px;\n\n font-size: var(--scalar-small);\n}\n.request-header {\n /* Give spare inline space to the path, while actions fill their own row after wrapping. */\n flex: 999 1 auto;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n.request-card-actions {\n flex: 1 0 auto;\n}\n.code-snippet {\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6NA,IAAM6B,KAAOD,GAmBPE,IAAsBC,QAAe;GACzC,IAAMC,IAAUC,GAAeC,EAAA,UAAU,WAAW,CAAC,EAAE,WAAW,CAAC,GAC7DC,IAAcD,EAAA,uBAAuB,OAAO,KAAKF,CAAO,CAAC,CAAC;GAKhE,OAJKG,IAEYH,EAAQG,EAAY,EAAE,YAAY,CAAC,IAF3B,CAAC;EAK5B,CAAC,GASKC,IAAkBC,EAAI,EAAE,GAGxBC,KAAqB,MAA0C;GACnE,IAAMC,IAAO,OAAO,KAAKT,EAAoB,KAAK;GAQlD,OAPIU,KAAaD,EAAK,SAASC,CAAS,IAC/BA,IAGLJ,EAAgB,SAASG,EAAK,SAASH,EAAgB,KAAK,IACvDA,EAAgB,QAElBG,EAAK,MAAM;EACpB;EA8BA,AA1BA,EAAgB,QAAQD,EAAkBJ,EAAA,eAAe,GAGzDO,QACQP,EAAA,kBACL,MAAc;GACb,EAAgB,QAAQI,EAAkBE,CAAS;EACrD,CACF,GAGAC,QACQP,EAAA,2BACA;GACJ,AACG,OAAO,KAAKJ,EAAoB,KAAK,CAAC,CAAC,SAASM,EAAgB,KAAK,MAItE,EAAgB,QAAQE,EAAkBJ,EAAA,eAAe;EAE7D,CACF,GAIAQ,SAAkB;GAChB,GAAK,qBAAqBN,EAAgB,KAAK;EACjD,CAAC;EAGD,IAAMO,MAAiB,MAAgB;GAErC,AADA,EAAgB,QAAQC,GACxBV,EAAA,SAAS,KAAK,qCAAqCU,CAAG;EACxD,GAGMC,IAAoBd,QA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AA,GAAA,EAAA,C;;;;;E,WAOtBF,EAAA,YADbhC,EAAA,GAAAC,EAoBaF,EAAA0F,CAAA,GAAA;;GAlBX,OAAM;;GAEN,SAAAvF,QAeoB,CAfpBC,EAeoBJ,EAAA8G,CAAA,GAAA,EAfD,OAAM,iDAAgD,GAAA;IACvE,SAAA3G,QAMM,CANNG,EAMM,OANNkB,GAMM,CALJpB,EAGqBG,GAAA;KAFnB,IAAG;KACH,OAAM;KACL,QAAQ0B,EAAA;I,yBACXxB,EAAsB2F,EAAA,QAAA,UAAA,CAAA,GAAA,KAAA,GAAA,EAAA,C,IAGhBrG,EAAAA,OAAO,UADfE,EAAA,GAAAO,EAMM,OANNiB,GAMM,CAHJhB,EAEkB2F,EAAA,QAAA,UAAA,EADf,aAAajE,EAAA,MAAe,GAAA,KAAA,GAAA,EAAA,C"}
|
|
1
|
+
{"version":3,"file":"CodeExample.vue_vue_type_script_setup_true_lang.js","names":["$slots","_unref","_openBlock","_createBlock","_withCtx","_createVNode","_createSlots","_createElementVNode","HttpMethod","_createElementBlock","_renderSlot","_createTextVNode","_toDisplayString","_normalizeClass","_Fragment","ExamplePicker","ExamplePicker_default","HttpMethod_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","CodeExample_vue_vue_type_script_setup_true_lang_default","__emit","emit","requestBodyExamples","computed","content","getResolvedRef","__props","contentType","localExampleKey","ref","resolveExampleKey","keys","preferred","watch","watchEffect","selectExample","key","customCodeSamples","getCustomCodeSamples","clients","getClients","clientCount","total","group","localSelectedClient","findClient","newClient","client","clientPickerAriaLabel","codeSampleAriaLabel","elem","visible","useExampleVisibility","externalExamples","useExternalExamples","getOperationExamples","resolvedOperation","resolveOperationExamples","showExamplePicker","webhookHar","operationToHar","error","generatedTemplate","generateCodeSnippet","resolvedCredentials","scheme","resolveCredentialPlaceholders","generatedCode","displayCode","codeBlockLanguage","webhookLanguage","secretCredentials","getSecrets","selectClient","unfreeze","freezeElement","option","shouldVirtualize","id","useId","unref","openBlock","createBlock","ScalarCard","withCtx","createVNode","ScalarCardHeader","createSlots","_cache","createElementVNode","createElementBlock","createCommentVNode","renderSlot","_ctx","ScalarCombobox","filterClientsByQuery","$event","ScalarButton","createTextVNode","toDisplayString","ScalarIconCaretDown","normalizeClass","open","ScalarCardSection","Fragment","ScalarCodeBlockCopy","ScalarVirtualText","ScalarCodeBlock","ScalarCardFooter"],"sources":["../../../src/code-example/components/CodeExample.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { MultipartNaming } from '@scalar/types/api-reference'\n\nexport type CodeExampleProps = {\n /** Localized status text shown when the selected example has no linked code sample. */\n codeSampleUnavailable?: string\n /**\n * Localized purpose of the client picker. It opens the button's accessible name and the\n * selected client's title is appended, so the name still contains the visible label.\n */\n clientPickerLabel?: string\n /** Localized accessible name for the search field inside the client picker. */\n clientSearchLabel?: string\n /**\n * Localized accessible name for the focusable code sample. The selected client's title is\n * appended so the announcement also says which language the sample is in.\n */\n codeSampleLabel?: string\n /**\n * Integration type: determines if the code sample is displayed in a client environment\n * or in an API reference environment.\n */\n integration?: 'client' | 'reference'\n /**\n * List of all http clients formatted into option groups for the client selector\n */\n clientOptions: ClientOptionGroup[]\n /**\n * Pre-selected client, this will determine which client is initially selected in the dropdown.\n * Either a built-in client id (e.g. `js/fetch`) or a custom sample id (e.g. `custom/python`).\n *\n * Typed as a plain string: unioning the (large) client-id union with the `custom/...`\n * ids overflows TypeScript's union-complexity limit inside this component's `defineProps`.\n *\n * @defaults to a custom sample if one is available, otherwise shell/curl\n */\n selectedClient?: string\n /**\n * Which server from the spec to use for the code example\n */\n selectedServer?: ServerObject | null\n /**\n * The selected content type from the requestBody.content, this will determine which examples are available\n * as well as the content type of the code example\n *\n * @defaults to the first content type if not provided\n */\n selectedContentType?: string\n /**\n * Example name to use for resolving example values for parameters AND requestBody.\n *\n * This is the document-wide selection: it is honored only when this operation defines an example\n * with the same key, so picking an example on one operation syncs the rest without blanking out\n * operations that do not share that key.\n *\n * @example \"limited\"\n * ```ts\n * parameters: {\n * name: 'foobar',\n * in: 'query',\n * examples: {\n * limited: {\n * dataValue: 10,\n * }\n * }\n * },\n * body: {\n * content: {\n * 'application/json': {\n * examples: {\n * limited: {\n * dataValue: { foo: 'bar' },\n * }\n * }\n * }\n * }\n * }\n *\n * ```\n */\n selectedExample?: string\n /**\n * Event bus\n */\n eventBus: WorkspaceEventBus\n /**\n * The security schemes which are applicable to this operation\n */\n securitySchemes: SecuritySchemeObjectSecret[]\n /**\n * HTTP method of the operation\n */\n method: string\n /**\n * Path of the operation\n */\n path: string\n /**\n * De-referenced OpenAPI Operation object\n */\n operation: OperationObject\n /**\n * If true and there's no example, we will display a small card with the method and path only\n */\n fallback?: boolean\n /**\n * A method to generate the label of the block, should return an html string\n */\n generateLabel?: () => string\n /**\n * If true, render this as a webhook request example\n */\n isWebhook?: boolean\n /**\n * Workspace + document cookies\n */\n globalCookies?: XScalarCookie[]\n /**\n * When the request body schema uses oneOf/anyOf, use these selected variants\n * for the example snippet (e.g. from the schema dropdowns in the API reference).\n */\n /** Originating OpenAPI version, used for XML mapping rules. */\n openapiVersion?: string\n /** Document-level JSON Schema dialect used when generating array `contains` examples. */\n jsonSchemaDialect?: string\n multipartNaming?: MultipartNaming\n requestBodyCompositionSelection?: Record<string, number>\n}\n\n/**\n * Request Example\n *\n * The core component for rendering a request example block,\n * this component does not have much of its own state but operates on props and custom events\n *\n * @event workspace:update:selected-client - Emitted when the selected client changes\n * @event workspace:update:selected-example - Emitted when the selected example changes, so other operations can sync\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardHeader,\n ScalarCardSection,\n} from '@scalar/components/card'\nimport {\n ScalarCodeBlock,\n ScalarCodeBlockCopy,\n} from '@scalar/components/code-block'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarVirtualText } from '@scalar/components/virtual-text'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getOperationExamples,\n resolveOperationExamples,\n} from '@scalar/workspace-store/helpers/operation-examples'\nimport {\n useExampleVisibility,\n useExternalExamples,\n} from '@scalar/workspace-store/helpers/use-external-examples'\nimport {\n resolveCredentialPlaceholders,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OperationObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n computed,\n ref,\n useId,\n watch,\n watchEffect,\n type ComponentPublicInstance,\n} from 'vue'\n\nimport { filterClientsByQuery } from '../helpers/filter-clients-by-query'\nimport { findClient } from '../helpers/find-client'\nimport { generateCodeSnippet } from '../helpers/generate-code-snippet'\nimport { getClients } from '../helpers/get-clients'\nimport { getCustomCodeSamples } from '../helpers/get-custom-code-samples'\nimport { getSecrets } from '../helpers/get-secrets'\nimport { operationToHar } from '../helpers/operation-to-har/operation-to-har'\nimport type {\n ClientOption,\n ClientOptionGroup,\n CustomClientOption,\n} from '../types'\nimport ExamplePicker from './ExamplePicker.vue'\nimport HttpMethod from './HttpMethod.vue'\n\nconst {\n integration,\n codeSampleUnavailable = 'No code sample available for this example.',\n clientPickerLabel = 'Change code sample language',\n clientSearchLabel = 'Search clients',\n codeSampleLabel = 'Code sample',\n clientOptions,\n selectedClient,\n selectedServer = null,\n selectedContentType,\n selectedExample,\n securitySchemes = [],\n method,\n eventBus,\n path,\n operation,\n isWebhook,\n generateLabel,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n} = defineProps<CodeExampleProps>()\n\nconst emit = defineEmits<{\n /**\n * Emitted whenever the example key actually shown for this operation changes.\n *\n * This is the resolved local key (not the raw document-wide selection), so layouts that render\n * the test-request button outside this component can open the client with the same example the\n * snippet displays.\n */\n (e: 'update:exampleKey', value: string): void\n}>()\n\ndefineSlots<{\n 'header': () => unknown\n /** Rendered at the start of the footer, only while the example picker does not need that space */\n 'footer-start'?: () => unknown\n 'footer': ({ exampleName }: { exampleName: string }) => unknown\n}>()\n\n/** Grab the examples for the given content type */\nconst requestBodyExamples = computed(() => {\n const content = getResolvedRef(operation.requestBody)?.content ?? {}\n const contentType = selectedContentType || Object.keys(content)[0]\n if (!contentType) return {}\n\n const examples = content[contentType]?.examples ?? {}\n\n return examples\n})\n\n/**\n * The example key actually shown for this operation.\n *\n * `selectedExample` is the document-wide selection that syncs across operations. We honor it only\n * when this operation actually defines that key, otherwise we keep the local example: a selection\n * on one operation should never blank out an operation that does not share the same example.\n */\nconst localExampleKey = ref('')\n\n/** Resolve the key to display, preferring the document-wide selection when this operation has it */\nconst resolveExampleKey = (preferred: string | undefined): string => {\n const keys = Object.keys(requestBodyExamples.value)\n if (preferred && keys.includes(preferred)) {\n return preferred\n }\n // Keep the current local example when it is still valid, otherwise fall back to the first one\n if (localExampleKey.value && keys.includes(localExampleKey.value)) {\n return localExampleKey.value\n }\n return keys[0] ?? ''\n}\n\n// Set the initial example from the document-wide selection, falling back to the first example.\n// This runs during setup so the server renders the same example as the browser.\nlocalExampleKey.value = resolveExampleKey(selectedExample)\n\n// Follow the document-wide selection when it changes and this operation has that example\nwatch(\n () => selectedExample,\n (preferred) => {\n localExampleKey.value = resolveExampleKey(preferred)\n },\n)\n\n/** Reset the selected example key if the content type changes and the new content type doesn't have the previously selected example */\nwatch(\n () => selectedContentType,\n () => {\n if (\n !Object.keys(requestBodyExamples.value).includes(localExampleKey.value)\n ) {\n // Re-resolve so the new content type still follows the document-wide selection when it has\n // that key, instead of always snapping back to the first example\n localExampleKey.value = resolveExampleKey(selectedExample)\n }\n },\n)\n\n// Keep the parent informed of the resolved key so a test-request button rendered outside this\n// component (e.g. the classic layout header) opens the client with the example the snippet shows\nwatchEffect(() => {\n emit('update:exampleKey', localExampleKey.value)\n})\n\n/** Select an example locally and sync the choice across the document */\nconst selectExample = (key: string) => {\n localExampleKey.value = key\n eventBus.emit('workspace:update:selected-example', key)\n}\n\n/** Grab any custom code samples from the operation */\nconst customCodeSamples = computed(() => getCustomCodeSamples(operation))\n\n/** Merge custom code samples with the client options */\nconst clients = computed(() =>\n getClients(\n customCodeSamples.value.samples,\n clientOptions,\n customCodeSamples.value.label,\n ),\n)\n\n/** Total number of available clients across all option groups */\nconst clientCount = computed(() =>\n clients.value.reduce((total, group) => total + group.options.length, 0),\n)\n\n/** The locally selected client which would include code samples from this operation only */\nconst localSelectedClient = ref<ClientOption | CustomClientOption | undefined>(\n findClient(clients.value, selectedClient),\n)\n\n/**\n * Re-resolve the local client whenever the global selection or the available\n * clients change. Watching `clients` matters when navigating between operations:\n * the stored id stays the same, but the matching option (e.g. a custom sample)\n * differs per operation, so without this the snippet could go stale.\n */\nwatch([() => selectedClient, clients], ([newClient]) => {\n const client = findClient(clients.value, newClient)\n if (client) {\n localSelectedClient.value = client\n }\n})\n\n/**\n * Accessible name for the client picker.\n *\n * On its own the button reads as its current value (\"C Libcurl\"), which never\n * says what activating it does. The visible title stays part of the name so it\n * still matches what is on screen.\n */\nconst clientPickerAriaLabel = computed(() =>\n [clientPickerLabel, localSelectedClient.value?.title]\n .filter(Boolean)\n .join(': '),\n)\n\n/**\n * Accessible name for the focusable code sample, e.g. \"Code sample: Shell cURL\".\n *\n * Screen readers announce only the name and role when focus lands on the scroller, so the\n * name tells the user both what the region is and which client it is generated for.\n */\nconst codeSampleAriaLabel = computed(() =>\n [codeSampleLabel, localSelectedClient.value?.title]\n .filter(Boolean)\n .join(': '),\n)\n\nconst elem = ref<ComponentPublicInstance | null>(null)\nconst visible = useExampleVisibility(elem)\nconst externalExamples = useExternalExamples(\n () =>\n getOperationExamples(operation, localExampleKey.value, selectedContentType),\n () => visible.value,\n)\nconst resolvedOperation = computed(() =>\n resolveOperationExamples(\n operation,\n localExampleKey.value,\n selectedContentType,\n externalExamples.resolve,\n ),\n)\n\n/** Keep the picker available because it also selects the example opened by Test Request. */\nconst showExamplePicker = computed(\n () => Object.keys(requestBodyExamples.value).length > 1,\n)\n\n/** Generate HAR data for webhook requests */\nconst webhookHar = computed(() => {\n if (!isWebhook) return null\n\n try {\n return operationToHar({\n operation: resolvedOperation.value,\n method,\n path,\n example: localExampleKey.value,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n // Only required parameters are shown in code examples; optional parameters\n // are omitted unless explicitly enabled via `x-disabled: false`.\n defaultDisabledParameters: true,\n })\n } catch (error) {\n console.error('[webhookHar]', error)\n return null\n }\n})\n\n/** Generate the code snippet for the selected example */\nconst generatedTemplate = computed<string | null>(() => {\n if (isWebhook) {\n return webhookHar.value?.postData?.text ?? ''\n }\n\n return generateCodeSnippet({\n // Only required parameters are shown in code examples; optional parameters\n // are omitted unless explicitly enabled via `x-disabled: false`.\n defaultDisabledParameters: true,\n includeDefaultHeaders: integration === 'client',\n clientId: localSelectedClient.value?.id,\n customCodeSamples: customCodeSamples.value.samples,\n operation: resolvedOperation.value,\n method,\n path,\n contentType: selectedContentType,\n server: selectedServer,\n securitySchemes,\n example: localExampleKey.value,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n })\n})\n\n/** Resolve custom templates at render time so auth changes never mutate the document. */\nconst resolvedCredentials = computed(() =>\n !isWebhook &&\n localSelectedClient.value?.id.startsWith('custom/') &&\n generatedTemplate.value !== null &&\n securitySchemes.some((scheme) => 'x-scalar-credential-placeholders' in scheme)\n ? resolveCredentialPlaceholders(generatedTemplate.value, securitySchemes)\n : undefined,\n)\n\nconst generatedCode = computed(\n () => resolvedCredentials.value?.content ?? generatedTemplate.value,\n)\n\n/** Mask inserted secrets before escaping or syntax tokenization can split their values. */\nconst displayCode = computed(\n () => resolvedCredentials.value?.displayContent ?? generatedCode.value,\n)\n\n/** The language for the code block, used for syntax highlighting */\nconst codeBlockLanguage = computed(() => {\n if (isWebhook) {\n return webhookLanguage.value\n }\n\n return localSelectedClient.value?.lang\n})\n\n/** Determine the language for webhook content based on MIME type */\nconst webhookLanguage = computed<string>(() => {\n if (!webhookHar.value?.postData) return 'json'\n\n const contentType = webhookHar.value.postData.mimeType\n if (contentType?.includes('json')) return 'json'\n if (contentType?.includes('xml')) return 'xml'\n if (contentType?.includes('yaml') || contentType?.includes('yml'))\n return 'yaml'\n if (contentType?.includes('text/plain')) return 'text'\n\n return 'json'\n})\n\n/** Block secrets from being shown in the code block */\nconst secretCredentials = computed(() =>\n resolvedCredentials.value ? [] : getSecrets(securitySchemes),\n)\n\n/** Set custom example, or update the selected HTTP client globally */\nconst selectClient = (option: ClientOption) => {\n // We need to freeze the ui to prevent scrolling as the clients change\n if (elem.value) {\n const unfreeze = freezeElement(elem.value.$el)\n setTimeout(() => {\n unfreeze()\n }, 300)\n }\n // Update to the local example\n localSelectedClient.value = option\n\n // Sync the selection globally so other operations follow along. Custom samples\n // sync too (keyed by language), so picking e.g. the Python SDK example here\n // shows the Python example on every operation that ships one.\n if (option) {\n eventBus.emit('workspace:update:selected-client', option.id)\n }\n}\n\n// Virtualize the code block if it's too large\n// This prevents the entire app from freezing up if there's a massive example\n// We set a lower threshold here as code examples can get quite large\nconst VIRTUALIZATION_THRESHOLD = 20_000\n\nconst shouldVirtualize = computed(\n () => (generatedCode.value?.length ?? 0) > VIRTUALIZATION_THRESHOLD,\n)\n\nconst id = useId()\n</script>\n<template>\n <ScalarCard\n v-if=\"\n generatedCode === null || generatedCode || externalExamples.pending.value\n \"\n ref=\"elem\"\n class=\"request-card dark-mode\">\n <!-- Header -->\n <ScalarCardHeader class=\"pr-2.5\">\n <span class=\"sr-only\">Request Example for</span>\n <HttpMethod\n as=\"span\"\n class=\"request-method\"\n :method=\"method\" />\n <span\n v-if=\"generateLabel\"\n v-html=\"generateLabel()\" />\n <slot name=\"header\" />\n <!-- Client picker -->\n <template\n v-if=\"!isWebhook && clientCount\"\n #actions>\n <!-- Multiple clients: render a dropdown to switch between them -->\n <ScalarCombobox\n v-if=\"clientCount > 1\"\n v-slot=\"{ open }\"\n class=\"max-h-80\"\n :filterFn=\"filterClientsByQuery\"\n :inputLabel=\"clientSearchLabel\"\n :modelValue=\"localSelectedClient\"\n :options=\"clients\"\n placement=\"bottom-end\"\n teleport\n @update:modelValue=\"selectClient($event as ClientOption)\">\n <ScalarButton\n :aria-label=\"clientPickerAriaLabel\"\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5 py-0 text-base font-normal\"\n data-testid=\"client-picker\"\n variant=\"ghost\">\n {{ localSelectedClient?.title }}\n <!--\n Follow this picker's own state. The `ui-open:` variant also matches any open\n Headless UI ancestor, such as an expanded operation in the classic layout.\n -->\n <ScalarIconCaretDown\n class=\"mt-px size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-180': open }\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarCombobox>\n <!-- Single client: just show its label, no need for a dropdown -->\n <span\n v-else\n class=\"text-c-2 flex h-full w-fit items-center px-0.5 py-0 text-base font-normal\"\n data-testid=\"client-picker\">\n {{ localSelectedClient?.title }}\n </span>\n </template>\n </ScalarCardHeader>\n\n <!-- Code snippet -->\n <ScalarCardSection class=\"request-editor-section custom-scroll p-0\">\n <div\n v-if=\"externalExamples.pending.value\"\n class=\"text-c-2 p-4\"\n role=\"status\">\n <template v-if=\"externalExamples.failed.value\">\n Could not load this example.\n <ScalarButton\n size=\"sm\"\n variant=\"ghost\"\n @click=\"externalExamples.retry\">\n Retry\n </ScalarButton>\n </template>\n <template v-else>Loading example…</template>\n </div>\n <div\n v-else-if=\"generatedCode === null\"\n class=\"text-c-2 p-4\"\n role=\"status\">\n {{ codeSampleUnavailable }}\n </div>\n <div\n v-else\n :id=\"`${id}-example`\"\n class=\"code-snippet group/code-block relative\">\n <ScalarCodeBlock\n v-if=\"!shouldVirtualize\"\n class=\"h-full bg-transparent\"\n :content=\"displayCode ?? ''\"\n :copyContent=\"resolvedCredentials ? (generatedCode ?? '') : undefined\"\n :hideCredentials=\"secretCredentials\"\n :label=\"codeSampleAriaLabel\"\n :lang=\"codeBlockLanguage\"\n lineNumbers />\n <template v-else>\n <ScalarCodeBlockCopy\n :aria-controls=\"`${id}-virtual-code`\"\n class=\"scalar-code-copy absolute top-2.5 right-2.5 z-1\"\n :content=\"generatedCode\"\n :lang=\"codeBlockLanguage\" />\n <ScalarVirtualText\n :id=\"`${id}-virtual-code`\"\n aria-label=\"Request code sample\"\n containerClass=\"custom-scroll scalar-code-block flex flex-1 max-h-screen\"\n contentClass=\"language-plaintext whitespace-pre font-code text-base p-2\"\n :lineHeight=\"20\"\n role=\"region\"\n :text=\"displayCode ?? ''\" />\n </template>\n </div>\n </ScalarCardSection>\n\n <!-- Footer -->\n <ScalarCardFooter\n v-if=\"showExamplePicker || $slots.footer || $slots['footer-start']\"\n class=\"request-card-footer\"\n :class=\"{\n 'request-card-footer--wraps':\n showExamplePicker || $slots['footer-start'],\n }\">\n <!-- Example picker -->\n <div\n v-if=\"showExamplePicker\"\n class=\"request-card-footer-addon\">\n <template v-if=\"Object.keys(requestBodyExamples).length\">\n <ExamplePicker\n :examples=\"requestBodyExamples\"\n :modelValue=\"localExampleKey\"\n @update:modelValue=\"selectExample\" />\n </template>\n </div>\n <!-- Otherwise the start of the footer is free for the caller -->\n <div\n v-else-if=\"$slots['footer-start']\"\n class=\"request-card-footer-start\">\n <slot name=\"footer-start\" />\n </div>\n\n <!-- Footer -->\n <slot\n :exampleName=\"localExampleKey\"\n name=\"footer\" />\n </ScalarCardFooter>\n </ScalarCard>\n\n <!-- Fallback card with just method and path in the case of no examples -->\n <ScalarCard\n v-else-if=\"fallback\"\n class=\"request-card dark-mode\">\n <!-- A single row of method, path and actions reads as a header, so it stays on the card -->\n <ScalarCardSection class=\"request-card-simple bg-transparent shadow-none\">\n <div class=\"request-header\">\n <HttpMethod\n as=\"span\"\n class=\"request-method\"\n :method=\"method\" />\n <slot name=\"header\" />\n </div>\n <div\n v-if=\"$slots.footer\"\n class=\"request-card-actions relative max-w-full\">\n <slot\n :exampleName=\"localExampleKey\"\n name=\"footer\" />\n </div>\n </ScalarCardSection>\n </ScalarCard>\n</template>\n<style scoped>\n.request-card {\n color: var(--scalar-color-1);\n font-size: var(--scalar-font-size-3);\n}\n.request-method {\n font-family: var(--scalar-font-code);\n margin-right: 6px;\n}\n.request-card-footer {\n display: flex;\n justify-content: flex-end;\n padding: 6px;\n flex-shrink: 0;\n position: relative;\n}\n/*\n * The example picker or footer-start content keeps room for itself; when the footer is too narrow\n * for everything, the end controls wrap onto a second line instead of squeezing or covering it.\n */\n.request-card-footer--wraps {\n flex-wrap: wrap;\n row-gap: 4px;\n}\n.request-card-footer-start {\n display: flex;\n align-items: center;\n flex: 1 0 auto;\n}\n/*\n * The picker asks for its example name's width, capped at 7em (about eight characters), so on a\n * narrow card the end controls wrap rather than squeeze the name out of view. The cap keeps a long\n * name truncating beside them on wider cards, as before. The picker never grows past its name, and\n * the end margin holds it at the start of the line.\n */\n.request-card-footer-addon {\n display: flex;\n align-items: center;\n\n flex: 1 1 7em;\n min-width: 0;\n max-width: max-content;\n margin-inline-end: auto;\n}\n.request-editor-section {\n display: flex;\n flex: 1;\n}\n/*\n * A long sample is drawn as virtual text with its own copy button rather than a code block, so\n * that button gets the same raised fill a code block gives its button on a card's surface.\n */\n.code-snippet > .scalar-code-copy {\n background: var(--scalar-card-surface-raised, var(--scalar-background-2));\n}\n.request-card-simple {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n\n padding: 8px 8px 8px 12px;\n\n font-size: var(--scalar-small);\n}\n.request-header {\n /* Give spare inline space to the path, while actions fill their own row after wrapping. */\n flex: 999 1 auto;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n.request-card-actions {\n flex: 1 0 auto;\n}\n.code-snippet {\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiOA,IAAM6B,KAAOD,GAmBPE,IAAsBC,QAAe;GACzC,IAAMC,IAAUC,GAAeC,EAAA,UAAU,WAAW,CAAC,EAAE,WAAW,CAAC,GAC7DC,IAAcD,EAAA,uBAAuB,OAAO,KAAKF,CAAO,CAAC,CAAC;GAKhE,OAJKG,IAEYH,EAAQG,EAAY,EAAE,YAAY,CAAC,IAF3B,CAAC;EAK5B,CAAC,GASKC,IAAkBC,EAAI,EAAE,GAGxBC,KAAqB,MAA0C;GACnE,IAAMC,IAAO,OAAO,KAAKT,EAAoB,KAAK;GAQlD,OAPIU,KAAaD,EAAK,SAASC,CAAS,IAC/BA,IAGLJ,EAAgB,SAASG,EAAK,SAASH,EAAgB,KAAK,IACvDA,EAAgB,QAElBG,EAAK,MAAM;EACpB;EA8BA,AA1BA,EAAgB,QAAQD,EAAkBJ,EAAA,eAAe,GAGzDO,QACQP,EAAA,kBACL,MAAc;GACb,EAAgB,QAAQI,EAAkBE,CAAS;EACrD,CACF,GAGAC,QACQP,EAAA,2BACA;GACJ,AACG,OAAO,KAAKJ,EAAoB,KAAK,CAAC,CAAC,SAASM,EAAgB,KAAK,MAItE,EAAgB,QAAQE,EAAkBJ,EAAA,eAAe;EAE7D,CACF,GAIAQ,SAAkB;GAChB,GAAK,qBAAqBN,EAAgB,KAAK;EACjD,CAAC;EAGD,IAAMO,MAAiB,MAAgB;GAErC,AADA,EAAgB,QAAQC,GACxBV,EAAA,SAAS,KAAK,qCAAqCU,CAAG;EACxD,GAGMC,IAAoBd,QAAee,GAAqBZ,EAAA,SAAS,CAAC,GAGlEa,IAAUhB,QACdiB,GACEH,EAAkB,MAAM,SACxBX,EAAA,eACA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GAAAC,EAoBaF,EAAA0F,CAAA,GAAA;;GAlBX,OAAM;;GAEN,SAAAvF,QAeoB,CAfpBC,EAeoBJ,EAAA8G,CAAA,GAAA,EAfD,OAAM,iDAAgD,GAAA;IACvE,SAAA3G,QAMM,CANNG,EAMM,OANNkB,GAMM,CALJpB,EAGqBG,GAAA;KAFnB,IAAG;KACH,OAAM;KACL,QAAQ0B,EAAA;I,yBACXxB,EAAsB2F,EAAA,QAAA,UAAA,CAAA,GAAA,KAAA,GAAA,EAAA,C,IAGhBrG,EAAAA,OAAO,UADfE,EAAA,GAAAO,EAMM,OANNiB,GAMM,CAHJhB,EAEkB2F,EAAA,QAAA,UAAA,EADf,aAAajE,EAAA,MAAe,GAAA,KAAA,GAAA,EAAA,C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AvailableClient } from '@scalar/snippetz';
|
|
2
|
+
import type { MultipartNaming } from '@scalar/types/api-reference';
|
|
2
3
|
import type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example';
|
|
3
4
|
import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
|
|
4
5
|
import type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation';
|
|
@@ -31,11 +32,12 @@ type GenerateCodeSnippetProps = {
|
|
|
31
32
|
/** Originating OpenAPI version, used for XML mapping rules. */
|
|
32
33
|
openapiVersion?: string;
|
|
33
34
|
jsonSchemaDialect?: string;
|
|
35
|
+
multipartNaming?: MultipartNaming;
|
|
34
36
|
requestBodyCompositionSelection?: Record<string, number>;
|
|
35
37
|
/** Whether to disable parameters by default. */
|
|
36
38
|
defaultDisabledParameters?: boolean;
|
|
37
39
|
};
|
|
38
40
|
/** Generate the code snippet for the selected example OR operation, or null when a linked sample is unavailable. */
|
|
39
|
-
export declare const generateCodeSnippet: ({ clientId, customCodeSamples, includeDefaultHeaders, operation, method, path, example, contentType, server, securitySchemes, globalCookies, openapiVersion, jsonSchemaDialect, requestBodyCompositionSelection, defaultDisabledParameters, }: GenerateCodeSnippetProps) => string | null;
|
|
41
|
+
export declare const generateCodeSnippet: ({ clientId, customCodeSamples, includeDefaultHeaders, operation, method, path, example, contentType, server, securitySchemes, globalCookies, openapiVersion, jsonSchemaDialect, multipartNaming, requestBodyCompositionSelection, defaultDisabledParameters, }: GenerateCodeSnippetProps) => string | null;
|
|
40
42
|
export {};
|
|
41
43
|
//# sourceMappingURL=generate-code-snippet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../src/code-example/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../src/code-example/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,kBAAkB,CAAA;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAElE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAA;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAA;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAEjH,OAAO,EAAE,KAAK,kBAAkB,EAAsB,MAAM,2BAA2B,CAAA;AAKvF,KAAK,wBAAwB,GAAG;IAC9B,wGAAwG;IACxG,QAAQ,EAAE,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAA;IAC1D,qFAAqF;IACrF,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,mFAAmF;IACnF,iBAAiB,EAAE,WAAW,EAAE,CAAA;IAChC,0EAA0E;IAC1E,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAA;IACd,wEAAwE;IACxE,SAAS,EAAE,eAAe,CAAA;IAC1B,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAA;IACZ,iFAAiF;IACjF,eAAe,EAAE,0BAA0B,EAAE,CAAA;IAC7C,mEAAmE;IACnE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,mCAAmC;IACnC,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;IAC/B,qFAAqF;IACrF,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,gFAAgF;IAChF,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxD,gDAAgD;IAChD,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC,CAAA;AAED,oHAAoH;AACpH,eAAO,MAAM,mBAAmB,GAAI,gQAiBjC,wBAAwB,KAAG,MAAM,GAAG,IAsDtC,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { operationToHar as n } from "./operation-to-har/operation-to-har.js";
|
|
|
4
4
|
import { CookieSerializationError as r } from "./operation-to-har/process-parameters.js";
|
|
5
5
|
import { getResolvedRef as i } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
6
6
|
// src/code-example/helpers/generate-code-snippet.ts
|
|
7
|
-
var a = ({ clientId: a, customCodeSamples: o, includeDefaultHeaders: s = !1, operation: c, method: l, path: u, example: d, contentType: f, server: p, securitySchemes: m, globalCookies: h, openapiVersion: g, jsonSchemaDialect: _,
|
|
7
|
+
var a = ({ clientId: a, customCodeSamples: o, includeDefaultHeaders: s = !1, operation: c, method: l, path: u, example: d, contentType: f, server: p, securitySchemes: m, globalCookies: h, openapiVersion: g, jsonSchemaDialect: _, multipartNaming: v, requestBodyCompositionSelection: y, defaultDisabledParameters: b }) => {
|
|
8
8
|
try {
|
|
9
9
|
if (!a) return "";
|
|
10
10
|
if (a.startsWith("custom")) {
|
|
@@ -28,10 +28,11 @@ var a = ({ clientId: a, customCodeSamples: o, includeDefaultHeaders: s = !1, ope
|
|
|
28
28
|
includeDefaultHeaders: s,
|
|
29
29
|
openapiVersion: g,
|
|
30
30
|
jsonSchemaDialect: _,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
multipartNaming: v,
|
|
32
|
+
requestBodyCompositionSelection: y,
|
|
33
|
+
defaultDisabledParameters: b
|
|
34
|
+
}), [x, S] = a.split("/"), [C, w] = t(x, S, r);
|
|
35
|
+
return C ? (console.error("[generateCodeSnippet]", C), C.message ?? "Error generating code snippet") : w;
|
|
35
36
|
} catch (e) {
|
|
36
37
|
return console.error("[generateCodeSnippet]", e), e instanceof r ? e.message : "Error generating code snippet";
|
|
37
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-code-snippet.js","names":["generateCodeSnippet","clientId","ids","getCustomClientIds","customCodeSamples","samples","index","sample","source","content","getResolvedRef","operation","mediaType","contentType","exampleKey","example","harRequest","operationToHar","targetKey","clientKey","error","payload","getSnippet","CookieSerializationError"],"sources":["../../../src/code-example/helpers/generate-code-snippet.ts"],"sourcesContent":["import type { AvailableClient, ClientId, TargetId } from '@scalar/snippetz'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation'\nimport type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport { type CustomCodeSampleId, getCustomClientIds } from './generate-client-options'\nimport { getSnippet } from './get-snippet'\nimport { operationToHar } from './operation-to-har/operation-to-har'\nimport { CookieSerializationError } from './operation-to-har/process-parameters'\n\ntype GenerateCodeSnippetProps = {\n /** The selected client/language for code generation (e.g., 'node/fetch') or a custom code sample ID. */\n clientId: AvailableClient | CustomCodeSampleId | undefined\n /** The Content-Type header value for the request body (e.g., 'application/json'). */\n contentType: string | undefined\n /** Array of custom code samples defined in the OpenAPI x-codeSamples extension. */\n customCodeSamples: XCodeSample[]\n /** The specific example value to use when generating the code snippet. */\n example: string | undefined\n /** The HTTP method for the operation (e.g., GET, POST, PUT). */\n method: string\n /** The OpenAPI operation object containing request/response details. */\n operation: OperationObject\n /** The API endpoint path (e.g., '/users/{id}'). */\n path: string\n /** Array of security schemes to apply to the request (e.g., API keys, OAuth). */\n securitySchemes: SecuritySchemeObjectSecret[]\n /** The server object defining the base URL for the API request. */\n server: ServerObject | null\n /** Workspace + document cookies */\n globalCookies?: XScalarCookie[]\n /** Whether to include default headers (e.g., Accept, Content-Type) automatically. */\n includeDefaultHeaders?: boolean\n /** Selected oneOf/anyOf variants for nested request body example generation. */\n /** Originating OpenAPI version, used for XML mapping rules. */\n openapiVersion?: string\n jsonSchemaDialect?: string\n requestBodyCompositionSelection?: Record<string, number>\n /** Whether to disable parameters by default. */\n defaultDisabledParameters?: boolean\n}\n\n/** Generate the code snippet for the selected example OR operation, or null when a linked sample is unavailable. */\nexport const generateCodeSnippet = ({\n clientId,\n customCodeSamples,\n includeDefaultHeaders = false,\n operation,\n method,\n path,\n example,\n contentType,\n server,\n securitySchemes,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n defaultDisabledParameters,\n}: GenerateCodeSnippetProps): string | null => {\n try {\n if (!clientId) {\n return ''\n }\n\n // Use the selected custom example, matched by its language-keyed id\n if (clientId.startsWith('custom')) {\n const ids = getCustomClientIds(customCodeSamples)\n const samples = customCodeSamples.filter((_, index) => ids[index] === clientId)\n if (!samples.some((sample) => sample.example !== undefined)) {\n const source = samples[0]?.source\n return typeof source === 'object' ? null : (source ?? 'Custom example not found')\n }\n\n const content = getResolvedRef(operation.requestBody)?.content ?? {}\n const mediaType = contentType ?? Object.keys(content)[0]\n const exampleKey = example ?? Object.keys(content[mediaType ?? '']?.examples ?? {})[0]\n const sample =\n samples.find((sample) => sample.example === exampleKey && sample.contentType === mediaType) ??\n samples.find((sample) => sample.example === exampleKey && sample.contentType === undefined)\n return typeof sample?.source === 'string' ? sample.source : null\n }\n\n const harRequest = operationToHar({\n operation,\n contentType,\n method,\n path,\n server,\n securitySchemes,\n example,\n globalCookies,\n includeDefaultHeaders,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n defaultDisabledParameters,\n })\n\n const [targetKey, clientKey] = clientId.split('/') as [TargetId, ClientId<TargetId>]\n\n const [error, payload] = getSnippet(targetKey, clientKey, harRequest)\n if (error) {\n console.error('[generateCodeSnippet]', error)\n return error.message ?? 'Error generating code snippet'\n }\n\n return payload\n } catch (error) {\n console.error('[generateCodeSnippet]', error)\n return error instanceof CookieSerializationError ? error.message : 'Error generating code snippet'\n }\n}\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"generate-code-snippet.js","names":["generateCodeSnippet","clientId","ids","getCustomClientIds","customCodeSamples","samples","index","sample","source","content","getResolvedRef","operation","mediaType","contentType","exampleKey","example","harRequest","operationToHar","targetKey","clientKey","error","payload","getSnippet","CookieSerializationError"],"sources":["../../../src/code-example/helpers/generate-code-snippet.ts"],"sourcesContent":["import type { AvailableClient, ClientId, TargetId } from '@scalar/snippetz'\nimport type { MultipartNaming } from '@scalar/types/api-reference'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation'\nimport type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport { type CustomCodeSampleId, getCustomClientIds } from './generate-client-options'\nimport { getSnippet } from './get-snippet'\nimport { operationToHar } from './operation-to-har/operation-to-har'\nimport { CookieSerializationError } from './operation-to-har/process-parameters'\n\ntype GenerateCodeSnippetProps = {\n /** The selected client/language for code generation (e.g., 'node/fetch') or a custom code sample ID. */\n clientId: AvailableClient | CustomCodeSampleId | undefined\n /** The Content-Type header value for the request body (e.g., 'application/json'). */\n contentType: string | undefined\n /** Array of custom code samples defined in the OpenAPI x-codeSamples extension. */\n customCodeSamples: XCodeSample[]\n /** The specific example value to use when generating the code snippet. */\n example: string | undefined\n /** The HTTP method for the operation (e.g., GET, POST, PUT). */\n method: string\n /** The OpenAPI operation object containing request/response details. */\n operation: OperationObject\n /** The API endpoint path (e.g., '/users/{id}'). */\n path: string\n /** Array of security schemes to apply to the request (e.g., API keys, OAuth). */\n securitySchemes: SecuritySchemeObjectSecret[]\n /** The server object defining the base URL for the API request. */\n server: ServerObject | null\n /** Workspace + document cookies */\n globalCookies?: XScalarCookie[]\n /** Whether to include default headers (e.g., Accept, Content-Type) automatically. */\n includeDefaultHeaders?: boolean\n /** Selected oneOf/anyOf variants for nested request body example generation. */\n /** Originating OpenAPI version, used for XML mapping rules. */\n openapiVersion?: string\n jsonSchemaDialect?: string\n multipartNaming?: MultipartNaming\n requestBodyCompositionSelection?: Record<string, number>\n /** Whether to disable parameters by default. */\n defaultDisabledParameters?: boolean\n}\n\n/** Generate the code snippet for the selected example OR operation, or null when a linked sample is unavailable. */\nexport const generateCodeSnippet = ({\n clientId,\n customCodeSamples,\n includeDefaultHeaders = false,\n operation,\n method,\n path,\n example,\n contentType,\n server,\n securitySchemes,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n defaultDisabledParameters,\n}: GenerateCodeSnippetProps): string | null => {\n try {\n if (!clientId) {\n return ''\n }\n\n // Use the selected custom example, matched by its language-keyed id\n if (clientId.startsWith('custom')) {\n const ids = getCustomClientIds(customCodeSamples)\n const samples = customCodeSamples.filter((_, index) => ids[index] === clientId)\n if (!samples.some((sample) => sample.example !== undefined)) {\n const source = samples[0]?.source\n return typeof source === 'object' ? null : (source ?? 'Custom example not found')\n }\n\n const content = getResolvedRef(operation.requestBody)?.content ?? {}\n const mediaType = contentType ?? Object.keys(content)[0]\n const exampleKey = example ?? Object.keys(content[mediaType ?? '']?.examples ?? {})[0]\n const sample =\n samples.find((sample) => sample.example === exampleKey && sample.contentType === mediaType) ??\n samples.find((sample) => sample.example === exampleKey && sample.contentType === undefined)\n return typeof sample?.source === 'string' ? sample.source : null\n }\n\n const harRequest = operationToHar({\n operation,\n contentType,\n method,\n path,\n server,\n securitySchemes,\n example,\n globalCookies,\n includeDefaultHeaders,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n defaultDisabledParameters,\n })\n\n const [targetKey, clientKey] = clientId.split('/') as [TargetId, ClientId<TargetId>]\n\n const [error, payload] = getSnippet(targetKey, clientKey, harRequest)\n if (error) {\n console.error('[generateCodeSnippet]', error)\n return error.message ?? 'Error generating code snippet'\n }\n\n return payload\n } catch (error) {\n console.error('[generateCodeSnippet]', error)\n return error instanceof CookieSerializationError ? error.message : 'Error generating code snippet'\n }\n}\n"],"mappings":";;;;;;AA+CA,IAAaA,KAAuB,EAClC,aACA,sBACA,2BAAwB,IACxB,cACA,WACA,SACA,YACA,gBACA,WACA,oBACA,kBACA,mBACA,sBACA,oBACA,oCACA,mCAC6C;CAC7C,IAAI;EACF,IAAI,CAACC,GACH,OAAO;EAIT,IAAIA,EAAS,WAAW,QAAQ,GAAG;GACjC,IAAMC,IAAMC,EAAmBC,CAAiB,GAC1CC,IAAUD,EAAkB,QAAQ,GAAG,MAAUF,EAAII,OAAWL,CAAQ;GAC9E,IAAI,CAACI,EAAQ,MAAM,MAAWE,EAAO,YAAY,KAAA,CAAS,GAAG;IAC3D,IAAMC,IAASH,EAAQ,EAAE,EAAE;IAC3B,OAAO,OAAOG,KAAW,WAAW,OAAQA,KAAU;GACxD;GAEA,IAAMC,IAAUC,EAAeC,EAAU,WAAW,CAAC,EAAE,WAAW,CAAC,GAC7DC,IAAYC,KAAe,OAAO,KAAKJ,CAAO,CAAC,CAAC,IAChDK,IAAaC,KAAW,OAAO,KAAKN,EAAQG,KAAa,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,IAC9EL,IACJF,EAAQ,MAAM,MAAWE,EAAO,YAAYO,KAAcP,EAAO,gBAAgBK,CAAS,KAC1FP,EAAQ,MAAM,MAAWE,EAAO,YAAYO,KAAcP,EAAO,gBAAgB,KAAA,CAAS;GAC5F,OAAO,OAAOA,GAAQ,UAAW,WAAWA,EAAO,SAAS;EAC9D;EAEA,IAAMS,IAAaC,EAAe;GAChC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAAC,GAEK,CAACC,GAAWC,KAAalB,EAAS,MAAM,GAAG,GAE3C,CAACmB,GAAOC,KAAWC,EAAWJ,GAAWC,GAAWH,CAAU;EAMpE,OALII,KACF,QAAQ,MAAM,yBAAyBA,CAAK,GACrCA,EAAM,WAAW,mCAGnBC;CACT,SAASD,GAAO;EAEd,OADA,QAAQ,MAAM,yBAAyBA,CAAK,GACrCA,aAAiBG,IAA2BH,EAAM,UAAU;CACrE;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MultipartNaming } from '@scalar/types/api-reference';
|
|
1
2
|
import { type SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example';
|
|
2
3
|
import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
|
|
3
4
|
import type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
@@ -41,6 +42,7 @@ export type OperationToHarProps = {
|
|
|
41
42
|
/** Originating OpenAPI version, used for version-specific serialization. */
|
|
42
43
|
openapiVersion?: string;
|
|
43
44
|
jsonSchemaDialect?: string;
|
|
45
|
+
multipartNaming?: MultipartNaming;
|
|
44
46
|
requestBodyCompositionSelection?: Record<string, number>;
|
|
45
47
|
/**
|
|
46
48
|
* Whether to disable parameters by default.
|
|
@@ -70,5 +72,5 @@ export type OperationToHarProps = {
|
|
|
70
72
|
* @see https://w3c.github.io/web-performance/specs/HAR/Overview.html
|
|
71
73
|
* @see https://spec.openapis.org/oas/v3.1.0#operation-object
|
|
72
74
|
*/
|
|
73
|
-
export declare const operationToHar: ({ includeDefaultHeaders, operation, contentType, method, path, server, example, securitySchemes, globalCookies, openapiVersion, jsonSchemaDialect, requestBodyCompositionSelection, defaultDisabledParameters, }: OperationToHarProps) => HarRequest;
|
|
75
|
+
export declare const operationToHar: ({ includeDefaultHeaders, operation, contentType, method, path, server, example, securitySchemes, globalCookies, openapiVersion, jsonSchemaDialect, multipartNaming, requestBodyCompositionSelection, defaultDisabledParameters, }: OperationToHarProps) => HarRequest;
|
|
74
76
|
//# sourceMappingURL=operation-to-har.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-to-har.d.ts","sourceRoot":"","sources":["../../../../src/code-example/helpers/operation-to-har/operation-to-har.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operation-to-har.d.ts","sourceRoot":"","sources":["../../../../src/code-example/helpers/operation-to-har/operation-to-har.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAElE,OAAO,EACL,KAAK,0BAA0B,EAIhC,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AACjH,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AASvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,+BAA+B;IAC/B,SAAS,EAAE,eAAe,CAAA;IAC1B,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAC5B,2EAA2E;IAC3E,eAAe,CAAC,EAAE,0BAA0B,EAAE,CAAA;IAC9C,mCAAmC;IACnC,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;IAC/B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;;OAGG;IACH,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxD;;;OAGG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GAAI,mOAe5B,mBAAmB,KAAG,UAgKxB,CAAA"}
|
|
@@ -7,8 +7,8 @@ import { filterGlobalCookie as a, getDefaultHeaders as o, restoreConventionalDef
|
|
|
7
7
|
import { getResolvedRef as c } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
8
8
|
import { isElectron as l } from "@scalar/helpers/general/is-electron";
|
|
9
9
|
// src/code-example/helpers/operation-to-har/operation-to-har.ts
|
|
10
|
-
var u = ({ includeDefaultHeaders: u = !1, operation: d, contentType: f, method: p, path: m, server: h = null, example: g, securitySchemes: _, globalCookies: v, openapiVersion: y, jsonSchemaDialect: b,
|
|
11
|
-
let
|
|
10
|
+
var u = ({ includeDefaultHeaders: u = !1, operation: d, contentType: f, method: p, path: m, server: h = null, example: g, securitySchemes: _, globalCookies: v, openapiVersion: y, jsonSchemaDialect: b, multipartNaming: x, requestBodyCompositionSelection: S, defaultDisabledParameters: C = !1 }) => {
|
|
11
|
+
let w = u ? o({
|
|
12
12
|
method: p,
|
|
13
13
|
operation: d,
|
|
14
14
|
exampleName: g ?? "default",
|
|
@@ -18,10 +18,10 @@ var u = ({ includeDefaultHeaders: u = !1, operation: d, contentType: f, method:
|
|
|
18
18
|
isElectron: l(),
|
|
19
19
|
appVersion: e
|
|
20
20
|
}
|
|
21
|
-
}) : {},
|
|
21
|
+
}) : {}, T = s(w), E = d["x-scalar-disable-parameters"]?.["global-cookies"]?.[g ?? "default"] ?? {}, D = {
|
|
22
22
|
method: p,
|
|
23
23
|
url: i(h, m),
|
|
24
|
-
headers: Object.entries(
|
|
24
|
+
headers: Object.entries(T).map(([e, t]) => ({
|
|
25
25
|
name: e,
|
|
26
26
|
value: t
|
|
27
27
|
})),
|
|
@@ -31,61 +31,62 @@ var u = ({ includeDefaultHeaders: u = !1, operation: d, contentType: f, method:
|
|
|
31
31
|
cookies: [],
|
|
32
32
|
headersSize: -1,
|
|
33
33
|
bodySize: -1
|
|
34
|
-
},
|
|
34
|
+
}, O = !1, k = !1;
|
|
35
35
|
if (d.parameters) {
|
|
36
36
|
let { url: e, headers: t, queryString: r, cookies: i, hasCookieStyleEntries: o, hasSerializedQuery: s } = n({
|
|
37
|
-
harRequest:
|
|
37
|
+
harRequest: D,
|
|
38
38
|
parameters: d.parameters,
|
|
39
39
|
openapiVersion: y,
|
|
40
40
|
jsonSchemaDialect: b,
|
|
41
41
|
example: g,
|
|
42
|
-
defaultDisabled:
|
|
42
|
+
defaultDisabled: C
|
|
43
43
|
}), c = v?.filter((t) => a({
|
|
44
44
|
cookie: t,
|
|
45
45
|
url: e,
|
|
46
|
-
disabledGlobalCookies:
|
|
46
|
+
disabledGlobalCookies: E
|
|
47
47
|
}))?.map((e) => ({
|
|
48
48
|
name: e.name,
|
|
49
49
|
value: e.value
|
|
50
50
|
})) ?? [];
|
|
51
|
-
|
|
51
|
+
O = o, k = s ?? !1, D.url = e, D.headers = t, D.queryString = r, D.cookies = [...c, ...i];
|
|
52
52
|
}
|
|
53
|
-
let
|
|
54
|
-
if (
|
|
53
|
+
let A = c(d.requestBody);
|
|
54
|
+
if (A?.content) {
|
|
55
55
|
let e = t({
|
|
56
|
-
requestBody:
|
|
56
|
+
requestBody: A,
|
|
57
57
|
contentType: f,
|
|
58
58
|
example: g,
|
|
59
59
|
openapiVersion: y,
|
|
60
60
|
jsonSchemaDialect: b,
|
|
61
|
-
|
|
61
|
+
multipartNaming: x,
|
|
62
|
+
requestBodyCompositionSelection: S
|
|
62
63
|
});
|
|
63
|
-
if (e && (
|
|
64
|
-
let t =
|
|
65
|
-
t && (!t.value || e.mimeType.startsWith("multipart/") && e.mimeType.includes("boundary=") && e.text !== void 0) ? t.value = e.mimeType : t ||
|
|
64
|
+
if (e && (D.postData = e, D.bodySize = e.text?.length ?? -1, e.mimeType)) {
|
|
65
|
+
let t = D.headers.find((e) => e.name.toLowerCase() === "content-type");
|
|
66
|
+
t && (!t.value || e.mimeType.startsWith("multipart/") && e.mimeType.includes("boundary=") && e.text !== void 0) ? t.value = e.mimeType : t || D.headers.push({
|
|
66
67
|
name: "Content-Type",
|
|
67
68
|
value: e.mimeType
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
|
-
let
|
|
72
|
+
let j = k || d.parameters?.some((e) => c(e)?.in === "querystring");
|
|
72
73
|
if (_) {
|
|
73
74
|
let { headers: e, queryString: t, cookies: n } = r(_);
|
|
74
|
-
|
|
75
|
+
D.headers.push(...e), D.queryString.push(...t), D.cookies.push(...n);
|
|
75
76
|
}
|
|
76
|
-
let
|
|
77
|
-
if (
|
|
78
|
-
let e =
|
|
79
|
-
|
|
77
|
+
let M = D.headers.find((e) => e.name.toLowerCase() === "cookie");
|
|
78
|
+
if (O && M && D.cookies.length) {
|
|
79
|
+
let e = D.cookies.map((e) => `${encodeURIComponent(e.name)}=${encodeURIComponent(e.value)}`).join("; ");
|
|
80
|
+
M.value = M.value ? `${M.value}; ${e}` : e, D.cookies = [];
|
|
80
81
|
}
|
|
81
|
-
if (
|
|
82
|
-
let e =
|
|
83
|
-
|
|
82
|
+
if (j && D.queryString.length) {
|
|
83
|
+
let e = D.url.indexOf("#"), t = e === -1 ? "" : D.url.slice(e), n = e === -1 ? D.url : D.url.slice(0, e), r = D.queryString.map(({ name: e, value: t }) => `${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&");
|
|
84
|
+
D.url = `${n}${n.includes("?") ? "&" : "?"}${r}${t}`, D.queryString = [];
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
-
let
|
|
87
|
-
for (let e of
|
|
88
|
-
return
|
|
86
|
+
D.postData?.mimeType === "multipart/form-data" && D.postData.params?.length && (D.headers = D.headers.filter((e) => e.name.toLowerCase() !== "content-type"));
|
|
87
|
+
let N = 0;
|
|
88
|
+
for (let e of D.headers) N += (e.name?.length ?? 0) + 2 + (e.value?.length ?? 0) + 2;
|
|
89
|
+
return D.headersSize = N, D;
|
|
89
90
|
};
|
|
90
91
|
export { u as operationToHar };
|
|
91
92
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-to-har.js","names":["operationToHar","defaultHeaders","includeDefaultHeaders","getDefaultHeaders","example","isElectron","APP_VERSION","defaultHeadersWithConventionalNames","restoreConventionalDefaultHeaderNames","disabledGlobalCookies","operation","harRequest","processServerUrl","server","path","name","value","hasCookieStyleEntries","hasSerializedQuery","processedCookieStyleEntries","processedSerializedQuery","processParameters","defaultDisabledParameters","filteredGlobalCookies","globalCookies","filterGlobalCookie","cookie","url","headers","queryString","cookies","body","getResolvedRef","postData","processBody","existingContentTypeHeader","header","hasUriReadyQuery","parameter","securitySchemes","processSecuritySchemes","cookieHeader","extraCookies","hashIndex","hash","query","headersSize","h"],"sources":["../../../../src/code-example/helpers/operation-to-har/operation-to-har.ts"],"sourcesContent":["import { isElectron } from '@scalar/helpers/general/is-electron'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n type SecuritySchemeObjectSecret,\n filterGlobalCookie,\n getDefaultHeaders,\n restoreConventionalDefaultHeaderNames,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport type { Request as HarRequest } from 'har-format'\n\nimport { APP_VERSION } from '@/constants'\n\nimport { processBody } from './process-body'\nimport { processParameters } from './process-parameters'\nimport { processSecuritySchemes } from './process-security-schemes'\nimport { processServerUrl } from './process-server-url'\n\nexport type OperationToHarProps = {\n /** OpenAPI Operation object */\n operation: OperationObject\n /** HTTP method of the operation */\n method: string\n /** Path of the operation */\n path: string\n /**\n * Name of the currently selected operation example\n *\n * Applies to both the body and the parameters\n */\n example?: string\n /**\n * Content type of the operation\n *\n * Applies to both the body and the parameters (if applicable)\n * @defaults to the first content type in the MediaTypeObject\n */\n contentType?: string\n /** OpenAPI Server object */\n server?: ServerObject | null\n /** OpenAPI SecurityScheme objects which are applicable to the operation */\n securitySchemes?: SecuritySchemeObjectSecret[]\n /** Workspace + document cookies */\n globalCookies?: XScalarCookie[]\n /**\n * Whether to include default headers (e.g., Accept, Content-Type) automatically.\n * If false, default headers will be omitted from the HAR request.\n * @default true\n */\n includeDefaultHeaders?: boolean\n /**\n * Selected oneOf/anyOf variants for nested request body example generation\n * (e.g. from the schema dropdowns in the API reference).\n */\n /** Originating OpenAPI version, used for version-specific serialization. */\n openapiVersion?: string\n jsonSchemaDialect?: string\n requestBodyCompositionSelection?: Record<string, number>\n /**\n * Whether to disable parameters by default.\n * @default false\n */\n defaultDisabledParameters?: boolean\n}\n\n/**\n * Converts an OpenAPI Operation to a HarRequest format for generating HTTP request snippets.\n *\n * This function transforms OpenAPI 3.1 operation objects into HAR (HTTP Archive) format requests,\n * which can be used to generate code snippets for various programming languages and HTTP clients.\n *\n * The conversion handles:\n * - Server URL processing and path parameter substitution\n * - Query parameter formatting based on OpenAPI parameter styles\n * - Request body processing with content type handling\n * - Security scheme integration (API keys, etc.)\n *\n * The resulting HarRequest object follows the HAR specification and includes:\n * - HTTP method and URL\n * - Headers and query parameters\n * - Request body (if present)\n * - Cookie information\n * - Size calculations for headers and body\n *\n * @see https://w3c.github.io/web-performance/specs/HAR/Overview.html\n * @see https://spec.openapis.org/oas/v3.1.0#operation-object\n */\nexport const operationToHar = ({\n includeDefaultHeaders = false,\n operation,\n contentType,\n method,\n path,\n server = null,\n example,\n securitySchemes,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n defaultDisabledParameters = false,\n}: OperationToHarProps): HarRequest => {\n const defaultHeaders = includeDefaultHeaders\n ? getDefaultHeaders({\n method,\n operation,\n exampleName: example ?? 'default',\n hideDisabledHeaders: true,\n hideOverriddenHeaders: true,\n options: { isElectron: isElectron(), appVersion: APP_VERSION },\n })\n : {}\n const defaultHeadersWithConventionalNames = restoreConventionalDefaultHeaderNames(defaultHeaders)\n\n const disabledGlobalCookies =\n operation['x-scalar-disable-parameters']?.['global-cookies']?.[example ?? 'default'] ?? {}\n\n const serverUrl = processServerUrl(server, path)\n\n // Initialize the HAR request with basic properties\n const harRequest: HarRequest = {\n method,\n url: serverUrl,\n headers: Object.entries(defaultHeadersWithConventionalNames).map(([name, value]) => ({ name, value })),\n queryString: [],\n postData: undefined,\n httpVersion: 'HTTP/1.1',\n cookies: [],\n headersSize: -1,\n bodySize: -1,\n }\n\n let hasCookieStyleEntries = false\n let hasSerializedQuery = false\n\n // Handle parameters\n if (operation.parameters) {\n const {\n url,\n headers,\n queryString,\n cookies,\n hasCookieStyleEntries: processedCookieStyleEntries,\n hasSerializedQuery: processedSerializedQuery,\n } = processParameters({\n harRequest,\n parameters: operation.parameters,\n openapiVersion,\n jsonSchemaDialect,\n example,\n defaultDisabled: defaultDisabledParameters,\n })\n\n // Correctly filter the global cookies by the processed url\n const filteredGlobalCookies =\n globalCookies\n ?.filter((cookie) => filterGlobalCookie({ cookie, url, disabledGlobalCookies }))\n ?.map((cookie) => ({ name: cookie.name, value: cookie.value })) ?? []\n\n hasCookieStyleEntries = processedCookieStyleEntries\n hasSerializedQuery = processedSerializedQuery ?? false\n harRequest.url = url\n harRequest.headers = headers\n harRequest.queryString = queryString\n harRequest.cookies = [...filteredGlobalCookies, ...cookies]\n }\n\n const body = getResolvedRef(operation.requestBody)\n\n // Handle request body\n if (body?.content) {\n const postData = processBody({\n requestBody: body,\n contentType,\n example,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n })\n\n if (postData) {\n harRequest.postData = postData\n harRequest.bodySize = postData.text?.length ?? -1\n\n // Add or update Content-Type header\n if (postData.mimeType) {\n const existingContentTypeHeader = harRequest.headers.find(\n (header) => header.name.toLowerCase() === 'content-type',\n )\n // Update existing header if it has an empty value\n if (\n existingContentTypeHeader &&\n (!existingContentTypeHeader.value ||\n (postData.mimeType.startsWith('multipart/') &&\n postData.mimeType.includes('boundary=') &&\n postData.text !== undefined))\n ) {\n existingContentTypeHeader.value = postData.mimeType\n }\n // Add new header if none exists\n else if (!existingContentTypeHeader) {\n harRequest.headers.push({\n name: 'Content-Type',\n value: postData.mimeType,\n })\n }\n }\n }\n }\n\n const hasUriReadyQuery =\n hasSerializedQuery || operation.parameters?.some((parameter) => getResolvedRef(parameter)?.in === 'querystring')\n\n // Handle security schemes\n if (securitySchemes) {\n const { headers, queryString, cookies } = processSecuritySchemes(securitySchemes)\n harRequest.headers.push(...headers)\n harRequest.queryString.push(...queryString)\n harRequest.cookies.push(...cookies)\n }\n\n // Keep authentication and global cookies in the explicit header as well, so\n // snippet generators cannot replace cookie-style parameters with their own header.\n const cookieHeader = harRequest.headers.find((header) => header.name.toLowerCase() === 'cookie')\n if (hasCookieStyleEntries && cookieHeader && harRequest.cookies.length) {\n const extraCookies = harRequest.cookies\n .map((cookie) => `${encodeURIComponent(cookie.name)}=${encodeURIComponent(cookie.value)}`)\n .join('; ')\n cookieHeader.value = cookieHeader.value ? `${cookieHeader.value}; ${extraCookies}` : extraCookies\n harRequest.cookies = []\n }\n\n // Whole-query content and serialized examples must retain their authored URI encoding.\n // Keeping all query data in the URL avoids snippet generators introducing a second question mark.\n if (hasUriReadyQuery && harRequest.queryString.length) {\n const hashIndex = harRequest.url.indexOf('#')\n const hash = hashIndex === -1 ? '' : harRequest.url.slice(hashIndex)\n const url = hashIndex === -1 ? harRequest.url : harRequest.url.slice(0, hashIndex)\n const query = harRequest.queryString\n .map(({ name, value }) => `${encodeURIComponent(name)}=${encodeURIComponent(value)}`)\n .join('&')\n harRequest.url = `${url}${url.includes('?') ? '&' : '?'}${query}${hash}`\n harRequest.queryString = []\n }\n\n // Structured multipart parts (with or without files) are encoded by the HTTP client, which owns the boundary.\n // Raw multipart text already has its boundary and must retain its Content-Type.\n if (harRequest.postData?.mimeType === 'multipart/form-data' && harRequest.postData.params?.length) {\n harRequest.headers = harRequest.headers.filter((header) => header.name.toLowerCase() !== 'content-type')\n }\n\n // Calculate headers size without allocating a large joined string\n let headersSize = 0\n for (const h of harRequest.headers) {\n // name + \": \" + value + \"\\r\\n\"\n headersSize += (h.name?.length ?? 0) + 2 + (h.value?.length ?? 0) + 2\n }\n harRequest.headersSize = headersSize\n\n return harRequest\n}\n"],"mappings":";;;;;;;;;AAwFA,IAAaA,KAAkB,EAC7B,2BAAwB,IACxB,cACA,gBACA,WACA,SACA,YAAS,MACT,YACA,oBACA,kBACA,mBACA,sBACA,oCACA,+BAA4B,SACS;CACrC,IAAMC,IAAiBC,IACnBC,EAAkB;EAChB;EACA;EACA,aAAaC,KAAW;EACxB,qBAAqB;EACrB,uBAAuB;EACvB,SAAS;GAAE,YAAYC,EAAW;GAAG,YAAYC;EAAY;CAC/D,C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AAK,GAAG;EAEX,AADA,EAAW,MAAM,GAAGW,IAAMA,EAAI,SAAS,GAAG,IAAI,MAAM,MAAMkB,IAAQD,KAClE,EAAW,cAAc,CAAC;CAC5B;CAIA,AAAIjC,EAAW,UAAU,aAAa,yBAAyBA,EAAW,SAAS,QAAQ,WACzF,EAAW,UAAUA,EAAW,QAAQ,QAAQ,MAAWyB,EAAO,KAAK,YAAY,MAAM,cAAc;CAIzG,IAAIU,IAAc;CAClB,KAAK,IAAMC,KAAKpC,EAAW,SAEzB,MAAgBoC,EAAE,MAAM,UAAU,KAAK,KAAKA,EAAE,OAAO,UAAU,KAAK;CAItE,OAFA,EAAW,cAAcD,GAElBnC;AACT"}
|
|
1
|
+
{"version":3,"file":"operation-to-har.js","names":["operationToHar","defaultHeaders","includeDefaultHeaders","getDefaultHeaders","example","isElectron","APP_VERSION","defaultHeadersWithConventionalNames","restoreConventionalDefaultHeaderNames","disabledGlobalCookies","operation","harRequest","processServerUrl","server","path","name","value","hasCookieStyleEntries","hasSerializedQuery","processedCookieStyleEntries","processedSerializedQuery","processParameters","defaultDisabledParameters","filteredGlobalCookies","globalCookies","filterGlobalCookie","cookie","url","headers","queryString","cookies","body","getResolvedRef","postData","processBody","existingContentTypeHeader","header","hasUriReadyQuery","parameter","securitySchemes","processSecuritySchemes","cookieHeader","extraCookies","hashIndex","hash","query","headersSize","h"],"sources":["../../../../src/code-example/helpers/operation-to-har/operation-to-har.ts"],"sourcesContent":["import { isElectron } from '@scalar/helpers/general/is-electron'\nimport type { MultipartNaming } from '@scalar/types/api-reference'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n type SecuritySchemeObjectSecret,\n filterGlobalCookie,\n getDefaultHeaders,\n restoreConventionalDefaultHeaderNames,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport type { Request as HarRequest } from 'har-format'\n\nimport { APP_VERSION } from '@/constants'\n\nimport { processBody } from './process-body'\nimport { processParameters } from './process-parameters'\nimport { processSecuritySchemes } from './process-security-schemes'\nimport { processServerUrl } from './process-server-url'\n\nexport type OperationToHarProps = {\n /** OpenAPI Operation object */\n operation: OperationObject\n /** HTTP method of the operation */\n method: string\n /** Path of the operation */\n path: string\n /**\n * Name of the currently selected operation example\n *\n * Applies to both the body and the parameters\n */\n example?: string\n /**\n * Content type of the operation\n *\n * Applies to both the body and the parameters (if applicable)\n * @defaults to the first content type in the MediaTypeObject\n */\n contentType?: string\n /** OpenAPI Server object */\n server?: ServerObject | null\n /** OpenAPI SecurityScheme objects which are applicable to the operation */\n securitySchemes?: SecuritySchemeObjectSecret[]\n /** Workspace + document cookies */\n globalCookies?: XScalarCookie[]\n /**\n * Whether to include default headers (e.g., Accept, Content-Type) automatically.\n * If false, default headers will be omitted from the HAR request.\n * @default true\n */\n includeDefaultHeaders?: boolean\n /**\n * Selected oneOf/anyOf variants for nested request body example generation\n * (e.g. from the schema dropdowns in the API reference).\n */\n /** Originating OpenAPI version, used for version-specific serialization. */\n openapiVersion?: string\n jsonSchemaDialect?: string\n multipartNaming?: MultipartNaming\n requestBodyCompositionSelection?: Record<string, number>\n /**\n * Whether to disable parameters by default.\n * @default false\n */\n defaultDisabledParameters?: boolean\n}\n\n/**\n * Converts an OpenAPI Operation to a HarRequest format for generating HTTP request snippets.\n *\n * This function transforms OpenAPI 3.1 operation objects into HAR (HTTP Archive) format requests,\n * which can be used to generate code snippets for various programming languages and HTTP clients.\n *\n * The conversion handles:\n * - Server URL processing and path parameter substitution\n * - Query parameter formatting based on OpenAPI parameter styles\n * - Request body processing with content type handling\n * - Security scheme integration (API keys, etc.)\n *\n * The resulting HarRequest object follows the HAR specification and includes:\n * - HTTP method and URL\n * - Headers and query parameters\n * - Request body (if present)\n * - Cookie information\n * - Size calculations for headers and body\n *\n * @see https://w3c.github.io/web-performance/specs/HAR/Overview.html\n * @see https://spec.openapis.org/oas/v3.1.0#operation-object\n */\nexport const operationToHar = ({\n includeDefaultHeaders = false,\n operation,\n contentType,\n method,\n path,\n server = null,\n example,\n securitySchemes,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n defaultDisabledParameters = false,\n}: OperationToHarProps): HarRequest => {\n const defaultHeaders = includeDefaultHeaders\n ? getDefaultHeaders({\n method,\n operation,\n exampleName: example ?? 'default',\n hideDisabledHeaders: true,\n hideOverriddenHeaders: true,\n options: { isElectron: isElectron(), appVersion: APP_VERSION },\n })\n : {}\n const defaultHeadersWithConventionalNames = restoreConventionalDefaultHeaderNames(defaultHeaders)\n\n const disabledGlobalCookies =\n operation['x-scalar-disable-parameters']?.['global-cookies']?.[example ?? 'default'] ?? {}\n\n const serverUrl = processServerUrl(server, path)\n\n // Initialize the HAR request with basic properties\n const harRequest: HarRequest = {\n method,\n url: serverUrl,\n headers: Object.entries(defaultHeadersWithConventionalNames).map(([name, value]) => ({ name, value })),\n queryString: [],\n postData: undefined,\n httpVersion: 'HTTP/1.1',\n cookies: [],\n headersSize: -1,\n bodySize: -1,\n }\n\n let hasCookieStyleEntries = false\n let hasSerializedQuery = false\n\n // Handle parameters\n if (operation.parameters) {\n const {\n url,\n headers,\n queryString,\n cookies,\n hasCookieStyleEntries: processedCookieStyleEntries,\n hasSerializedQuery: processedSerializedQuery,\n } = processParameters({\n harRequest,\n parameters: operation.parameters,\n openapiVersion,\n jsonSchemaDialect,\n example,\n defaultDisabled: defaultDisabledParameters,\n })\n\n // Correctly filter the global cookies by the processed url\n const filteredGlobalCookies =\n globalCookies\n ?.filter((cookie) => filterGlobalCookie({ cookie, url, disabledGlobalCookies }))\n ?.map((cookie) => ({ name: cookie.name, value: cookie.value })) ?? []\n\n hasCookieStyleEntries = processedCookieStyleEntries\n hasSerializedQuery = processedSerializedQuery ?? false\n harRequest.url = url\n harRequest.headers = headers\n harRequest.queryString = queryString\n harRequest.cookies = [...filteredGlobalCookies, ...cookies]\n }\n\n const body = getResolvedRef(operation.requestBody)\n\n // Handle request body\n if (body?.content) {\n const postData = processBody({\n requestBody: body,\n contentType,\n example,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n })\n\n if (postData) {\n harRequest.postData = postData\n harRequest.bodySize = postData.text?.length ?? -1\n\n // Add or update Content-Type header\n if (postData.mimeType) {\n const existingContentTypeHeader = harRequest.headers.find(\n (header) => header.name.toLowerCase() === 'content-type',\n )\n // Update existing header if it has an empty value\n if (\n existingContentTypeHeader &&\n (!existingContentTypeHeader.value ||\n (postData.mimeType.startsWith('multipart/') &&\n postData.mimeType.includes('boundary=') &&\n postData.text !== undefined))\n ) {\n existingContentTypeHeader.value = postData.mimeType\n }\n // Add new header if none exists\n else if (!existingContentTypeHeader) {\n harRequest.headers.push({\n name: 'Content-Type',\n value: postData.mimeType,\n })\n }\n }\n }\n }\n\n const hasUriReadyQuery =\n hasSerializedQuery || operation.parameters?.some((parameter) => getResolvedRef(parameter)?.in === 'querystring')\n\n // Handle security schemes\n if (securitySchemes) {\n const { headers, queryString, cookies } = processSecuritySchemes(securitySchemes)\n harRequest.headers.push(...headers)\n harRequest.queryString.push(...queryString)\n harRequest.cookies.push(...cookies)\n }\n\n // Keep authentication and global cookies in the explicit header as well, so\n // snippet generators cannot replace cookie-style parameters with their own header.\n const cookieHeader = harRequest.headers.find((header) => header.name.toLowerCase() === 'cookie')\n if (hasCookieStyleEntries && cookieHeader && harRequest.cookies.length) {\n const extraCookies = harRequest.cookies\n .map((cookie) => `${encodeURIComponent(cookie.name)}=${encodeURIComponent(cookie.value)}`)\n .join('; ')\n cookieHeader.value = cookieHeader.value ? `${cookieHeader.value}; ${extraCookies}` : extraCookies\n harRequest.cookies = []\n }\n\n // Whole-query content and serialized examples must retain their authored URI encoding.\n // Keeping all query data in the URL avoids snippet generators introducing a second question mark.\n if (hasUriReadyQuery && harRequest.queryString.length) {\n const hashIndex = harRequest.url.indexOf('#')\n const hash = hashIndex === -1 ? '' : harRequest.url.slice(hashIndex)\n const url = hashIndex === -1 ? harRequest.url : harRequest.url.slice(0, hashIndex)\n const query = harRequest.queryString\n .map(({ name, value }) => `${encodeURIComponent(name)}=${encodeURIComponent(value)}`)\n .join('&')\n harRequest.url = `${url}${url.includes('?') ? '&' : '?'}${query}${hash}`\n harRequest.queryString = []\n }\n\n // Structured multipart parts (with or without files) are encoded by the HTTP client, which owns the boundary.\n // Raw multipart text already has its boundary and must retain its Content-Type.\n if (harRequest.postData?.mimeType === 'multipart/form-data' && harRequest.postData.params?.length) {\n harRequest.headers = harRequest.headers.filter((header) => header.name.toLowerCase() !== 'content-type')\n }\n\n // Calculate headers size without allocating a large joined string\n let headersSize = 0\n for (const h of harRequest.headers) {\n // name + \": \" + value + \"\\r\\n\"\n headersSize += (h.name?.length ?? 0) + 2 + (h.value?.length ?? 0) + 2\n }\n harRequest.headersSize = headersSize\n\n return harRequest\n}\n"],"mappings":";;;;;;;;;AA0FA,IAAaA,KAAkB,EAC7B,2BAAwB,IACxB,cACA,gBACA,WACA,SACA,YAAS,MACT,YACA,oBACA,kBACA,mBACA,sBACA,oBACA,oCACA,+BAA4B,SACS;CACrC,IAAMC,IAAiBC,IACnBC,EAAkB;EAChB;EACA;EACA,aAAaC,KAAW;EACxB,qBAAqB;EACrB,uBAAuB;EACvB,SAAS;GAAE,YAAYC,EAAW;GAAG,YAAYC;EAAY;CAC/D,CAAC,IACD,CAAC,GACCC,IAAsCC,EAAsCP,CAAc,GAE1FQ,IACJC,EAAU,8BAA8B,GAAG,iBAAiB,GAAGN,KAAW,cAAc,CAAC,GAKrFO,IAAyB;EAC7B;EACA,KALgBC,EAAiBC,GAAQC,CAKpC;EACL,SAAS,OAAO,QAAQP,CAAmC,CAAC,CAAC,KAAK,CAACQ,GAAMC,QAAY;GAAE;GAAM;EAAM,EAAE;EACrG,aAAa,CAAC;EACd,UAAU,KAAA;EACV,aAAa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AAKpC,EAAW,SAEzB,MAAgBoC,EAAE,MAAM,UAAU,KAAK,KAAKA,EAAE,OAAO,UAAU,KAAK;CAItE,OAFA,EAAW,cAAcD,GAElBnC;AACT"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { RequestBodyObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
2
2
|
import type { PostData } from 'har-format';
|
|
3
3
|
import type { OperationToHarProps } from './operation-to-har';
|
|
4
|
-
type ProcessBodyProps = Pick<OperationToHarProps, 'contentType' | 'example' | 'requestBodyCompositionSelection' | 'openapiVersion' | 'jsonSchemaDialect'> & {
|
|
4
|
+
type ProcessBodyProps = Pick<OperationToHarProps, 'multipartNaming' | 'contentType' | 'example' | 'requestBodyCompositionSelection' | 'openapiVersion' | 'jsonSchemaDialect'> & {
|
|
5
5
|
requestBody: RequestBodyObject;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
8
|
* Processes the request body and returns the processed data
|
|
9
9
|
* Returns undefined if no example is found
|
|
10
10
|
*/
|
|
11
|
-
export declare const processBody: ({ requestBody, contentType, example, openapiVersion, jsonSchemaDialect, requestBodyCompositionSelection, }: ProcessBodyProps) => PostData | undefined;
|
|
11
|
+
export declare const processBody: ({ requestBody, contentType, example, openapiVersion, jsonSchemaDialect, requestBodyCompositionSelection, multipartNaming, }: ProcessBodyProps) => PostData | undefined;
|
|
12
12
|
export {};
|
|
13
13
|
//# sourceMappingURL=process-body.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-body.d.ts","sourceRoot":"","sources":["../../../../src/code-example/helpers/operation-to-har/process-body.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process-body.d.ts","sourceRoot":"","sources":["../../../../src/code-example/helpers/operation-to-har/process-body.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,8DAA8D,CAAA;AAErE,OAAO,KAAK,EAAS,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,KAAK,gBAAgB,GAAG,IAAI,CAC1B,mBAAmB,EACjB,iBAAiB,GACjB,aAAa,GACb,SAAS,GACT,iCAAiC,GACjC,gBAAgB,GAChB,mBAAmB,CACtB,GAAG;IACF,WAAW,EAAE,iBAAiB,CAAA;CAC/B,CAAA;AA0LD;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,6HAQzB,gBAAgB,KAAG,QAAQ,GAAG,SA6LhC,CAAA"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { snapshotSchema as e } from "@scalar/workspace-store/helpers/snapshot-schema";
|
|
2
|
-
import { buildRequestBody as t, coerceLeafValueToSchemaType as n, getExample as r, getExampleFromBody as i, getExampleFromSchema as a, needsMultipartEncoding as o, resolveLeafSchema as s, serializeFormPropertyWithEncoding as c, serializeMultipartArray as l, serializeMultipartBody as u } from "@scalar/workspace-store/request-example";
|
|
3
|
-
import { isXmlMediaType as
|
|
4
|
-
import { getExampleValue as
|
|
5
|
-
import { getResolvedRef as
|
|
6
|
-
import { getStreamFormat as
|
|
7
|
-
import { isFileSchema as
|
|
8
|
-
import { serializeStreamExample as
|
|
9
|
-
import { unpackProxyObject as
|
|
10
|
-
import { resolve as
|
|
11
|
-
import { isArraySchema as
|
|
2
|
+
import { buildRequestBody as t, coerceLeafValueToSchemaType as n, getExample as r, getExampleFromBody as i, getExampleFromSchema as a, needsMultipartEncoding as o, resolveLeafSchema as s, serializeFormPropertyWithEncoding as c, serializeMultipartArray as l, serializeMultipartBody as u, usesAspNetFormNaming as d } from "@scalar/workspace-store/request-example";
|
|
3
|
+
import { isXmlMediaType as f } from "@scalar/helpers/http/is-xml-media-type";
|
|
4
|
+
import { getExampleValue as p, getExplicitExampleText as m } from "@scalar/workspace-store/helpers/get-example-value";
|
|
5
|
+
import { getResolvedRef as h, mergeSiblingReferences as g } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
6
|
+
import { getStreamFormat as _ } from "@scalar/helpers/http/is-streaming-content-type";
|
|
7
|
+
import { isFileSchema as v } from "@scalar/workspace-store/helpers/is-file-schema";
|
|
8
|
+
import { serializeStreamExample as y } from "@scalar/workspace-store/helpers/serialize-stream-example";
|
|
9
|
+
import { unpackProxyObject as b } from "@scalar/workspace-store/helpers/unpack-proxy";
|
|
10
|
+
import { resolve as x } from "@scalar/workspace-store/resolve";
|
|
11
|
+
import { isArraySchema as S, isObjectSchema as C } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
|
|
12
12
|
// src/code-example/helpers/operation-to-har/process-body.ts
|
|
13
|
-
var
|
|
13
|
+
var w = (e, t, n) => ({
|
|
14
14
|
name: e,
|
|
15
15
|
value: `@${t}`,
|
|
16
16
|
fileName: t,
|
|
17
17
|
...n ? { contentType: n } : {}
|
|
18
|
-
}),
|
|
18
|
+
}), T = (e) => !!e && "type" in e && e.type === "string" && "format" in e && e.format === "binary", E = (e, t) => typeof e == "string" && e.startsWith("@") && T(t) ? e.slice(1) : void 0, D = (e, t, r, i = !1, a) => {
|
|
19
19
|
let o = [], u = Array.isArray(e) ? e.filter((e) => !e.isDisabled).map((e) => [String(e.name), e.value]) : Object.entries(e);
|
|
20
20
|
for (let [d, f] of u) {
|
|
21
21
|
if (f == null) continue;
|
|
@@ -23,7 +23,7 @@ var C = (e, t, n) => ({
|
|
|
23
23
|
if (i && !r) {
|
|
24
24
|
let t = Array.isArray(e) ? n(f, s(a, [d])) : f, r = l(d, Array.isArray(t) ? t : f, u);
|
|
25
25
|
if (r) {
|
|
26
|
-
for (let e of r) e.value instanceof File ? o.push(
|
|
26
|
+
for (let e of r) e.value instanceof File ? o.push(w(e.key, e.value.name, e.contentType ?? e.value.type)) : o.push({
|
|
27
27
|
name: e.key,
|
|
28
28
|
value: e.value,
|
|
29
29
|
...e.contentType ? { contentType: e.contentType } : {}
|
|
@@ -31,34 +31,34 @@ var C = (e, t, n) => ({
|
|
|
31
31
|
continue;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
let p = u && (u.style !== void 0 || u.explode !== void 0 || u.allowReserved !== void 0), m = p || !i ? void 0 : u?.contentType, h = i && !r ?
|
|
34
|
+
let p = u && (u.style !== void 0 || u.explode !== void 0 || u.allowReserved !== void 0), m = p || !i ? void 0 : u?.contentType, h = i && !r ? E(f, s(a, [d])) : void 0, g = r ? null : c(d, f, u);
|
|
35
35
|
if (g) for (let e of g) o.push({
|
|
36
36
|
name: e.key,
|
|
37
37
|
value: e.value
|
|
38
38
|
});
|
|
39
39
|
else if (f instanceof File) {
|
|
40
|
-
let e =
|
|
41
|
-
o.push(
|
|
42
|
-
} else if (h !== void 0) o.push(
|
|
40
|
+
let e = b(f);
|
|
41
|
+
o.push(w(d, e.name, m ?? (i ? e.type : void 0)));
|
|
42
|
+
} else if (h !== void 0) o.push(w(d, h, m));
|
|
43
43
|
else if (m && typeof f == "object") o.push({
|
|
44
44
|
name: d,
|
|
45
|
-
value: JSON.stringify(
|
|
45
|
+
value: JSON.stringify(b(f)),
|
|
46
46
|
contentType: m
|
|
47
47
|
});
|
|
48
48
|
else if (i && !r && !p && typeof f == "object" && !Array.isArray(f)) o.push({
|
|
49
49
|
name: d,
|
|
50
|
-
value: JSON.stringify(
|
|
50
|
+
value: JSON.stringify(b(f)),
|
|
51
51
|
contentType: "application/json"
|
|
52
52
|
});
|
|
53
53
|
else if (Array.isArray(f)) for (let e of f) if (e instanceof File) {
|
|
54
|
-
let t =
|
|
55
|
-
o.push(
|
|
54
|
+
let t = b(e);
|
|
55
|
+
o.push(w(d, t.name, i ? t.type : void 0));
|
|
56
56
|
} else o.push({
|
|
57
57
|
name: d,
|
|
58
58
|
value: String(e)
|
|
59
59
|
});
|
|
60
60
|
else if (typeof f == "object") {
|
|
61
|
-
let e =
|
|
61
|
+
let e = D(f, void 0, d);
|
|
62
62
|
for (let t of e) o.push({
|
|
63
63
|
name: `${d}.${t.name}`,
|
|
64
64
|
value: t.value
|
|
@@ -70,89 +70,107 @@ var C = (e, t, n) => ({
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
return o;
|
|
73
|
-
},
|
|
74
|
-
let
|
|
75
|
-
if (
|
|
76
|
-
let e = c ?? Object.keys(
|
|
73
|
+
}, O = ({ requestBody: n, contentType: s, example: c, openapiVersion: l, jsonSchemaDialect: T, requestBodyCompositionSelection: E, multipartNaming: O }) => {
|
|
74
|
+
let k = s || Object.keys(n.content)[0] || "", A = k === "other" ? "" : k, j = (e) => `@${b(e).name || "filename"}`, M = n.content[k]?.encoding, N = n.content[k], P = d(k, N, O);
|
|
75
|
+
if (N && (P || o(k, N))) {
|
|
76
|
+
let e = c ?? Object.keys(N.examples ?? {})[0] ?? "default", r = t({
|
|
77
77
|
...n,
|
|
78
|
-
"x-scalar-selected-content-type": { [e]:
|
|
79
|
-
}, e,
|
|
78
|
+
"x-scalar-selected-content-type": { [e]: k }
|
|
79
|
+
}, e, E, l, T, {
|
|
80
|
+
multipartNaming: O,
|
|
81
|
+
aspNetFilePlaceholders: P && k === "multipart/form-data"
|
|
82
|
+
});
|
|
83
|
+
if (P && r?.mode === "urlencoded") return {
|
|
84
|
+
mimeType: A,
|
|
85
|
+
params: r.value.map(({ key: e, value: t }) => ({
|
|
86
|
+
name: e,
|
|
87
|
+
value: t
|
|
88
|
+
}))
|
|
89
|
+
};
|
|
90
|
+
if (P && r?.mode === "formdata") return {
|
|
91
|
+
mimeType: A,
|
|
92
|
+
params: r.value.flatMap((e) => e.type === "file" ? [w(e.key, e.value.name, e.contentType ?? e.value.type)] : e.type === "text" ? [{
|
|
93
|
+
name: e.key,
|
|
94
|
+
value: e.value,
|
|
95
|
+
...e.contentType ? { contentType: e.contentType } : {}
|
|
96
|
+
}] : [])
|
|
97
|
+
};
|
|
80
98
|
if (r?.mode === "multipart") {
|
|
81
99
|
let e = u(r.value, r.contentType);
|
|
82
100
|
return {
|
|
83
101
|
mimeType: e.contentType,
|
|
84
|
-
text: e.chunks.map((e) => e instanceof File ?
|
|
102
|
+
text: e.chunks.map((e) => e instanceof File ? j(e) : e instanceof Blob ? "BINARY" : String(e)).join("")
|
|
85
103
|
};
|
|
86
104
|
}
|
|
87
105
|
}
|
|
88
|
-
let
|
|
89
|
-
if (
|
|
90
|
-
let e = i(n,
|
|
106
|
+
let F = k === "multipart/form-data" || k === "application/x-www-form-urlencoded";
|
|
107
|
+
if (f(k)) {
|
|
108
|
+
let e = i(n, k, c ?? "", E, l, T);
|
|
91
109
|
return e ? {
|
|
92
|
-
mimeType:
|
|
110
|
+
mimeType: A,
|
|
93
111
|
text: e.value
|
|
94
112
|
} : void 0;
|
|
95
113
|
}
|
|
96
|
-
let
|
|
97
|
-
if (
|
|
98
|
-
mimeType:
|
|
99
|
-
text:
|
|
114
|
+
let I = p(r(n, c, s)), L = m(I, k);
|
|
115
|
+
if (L !== void 0) return {
|
|
116
|
+
mimeType: A,
|
|
117
|
+
text: L
|
|
100
118
|
};
|
|
101
|
-
let
|
|
102
|
-
if (
|
|
103
|
-
let e = typeof
|
|
104
|
-
return
|
|
105
|
-
mimeType:
|
|
106
|
-
params:
|
|
119
|
+
let R = I?.value;
|
|
120
|
+
if (R !== void 0) {
|
|
121
|
+
let e = typeof R == "object" && R ? b(R) : R;
|
|
122
|
+
return F && typeof e == "object" && e ? {
|
|
123
|
+
mimeType: A,
|
|
124
|
+
params: D(e, M, void 0, k === "multipart/form-data", h(n.content[k]?.schema, g))
|
|
107
125
|
} : e instanceof File ? {
|
|
108
|
-
mimeType:
|
|
109
|
-
text:
|
|
126
|
+
mimeType: A,
|
|
127
|
+
text: j(e)
|
|
110
128
|
} : {
|
|
111
|
-
mimeType:
|
|
112
|
-
text: typeof e == "string" ? e :
|
|
129
|
+
mimeType: A,
|
|
130
|
+
text: typeof e == "string" ? e : y(e, k, !1) ?? JSON.stringify(e)
|
|
113
131
|
};
|
|
114
132
|
}
|
|
115
|
-
let
|
|
116
|
-
if (
|
|
117
|
-
let t = e(
|
|
118
|
-
if (
|
|
119
|
-
let r =
|
|
120
|
-
if (i && !("type" in i) && !("properties" in i) && !i.allOf && !i.oneOf && !i.anyOf && !i.contentSchema &&
|
|
133
|
+
let z = n.content[k], B = h(z?.schema ?? z?.itemSchema);
|
|
134
|
+
if (B !== void 0) {
|
|
135
|
+
let t = e(B);
|
|
136
|
+
if (k === "multipart/form-data" && C(t)) for (let [e, n] of Object.entries(t.properties ?? {})) {
|
|
137
|
+
let r = x.schema(n), i = r && S(r) ? x.schema(r.items) : r;
|
|
138
|
+
if (i && !("type" in i) && !("properties" in i) && !i.allOf && !i.oneOf && !i.anyOf && !i.contentSchema && v(i, !1)) {
|
|
121
139
|
let n = {
|
|
122
140
|
...i,
|
|
123
141
|
type: "string",
|
|
124
142
|
format: "binary"
|
|
125
143
|
};
|
|
126
|
-
t.properties[e] = r &&
|
|
144
|
+
t.properties[e] = r && S(r) ? {
|
|
127
145
|
...r,
|
|
128
146
|
items: n
|
|
129
147
|
} : n;
|
|
130
148
|
}
|
|
131
149
|
}
|
|
132
|
-
if (!
|
|
150
|
+
if (!F && z?.schema !== void 0 && Object.keys(t).every((e) => [
|
|
133
151
|
"__scalar_",
|
|
134
152
|
"title",
|
|
135
153
|
"description"
|
|
136
|
-
].includes(e)) && !
|
|
137
|
-
mimeType:
|
|
154
|
+
].includes(e)) && !_(k) && v(t, !1, k)) return {
|
|
155
|
+
mimeType: A,
|
|
138
156
|
text: "@filename"
|
|
139
157
|
};
|
|
140
158
|
let n = a(t, {
|
|
141
|
-
compositionSelection:
|
|
159
|
+
compositionSelection: E,
|
|
142
160
|
mode: "write",
|
|
143
161
|
openapiVersion: l,
|
|
144
|
-
jsonSchemaDialect:
|
|
145
|
-
binaryAsFile:
|
|
162
|
+
jsonSchemaDialect: T,
|
|
163
|
+
binaryAsFile: k === "multipart/form-data"
|
|
146
164
|
}, { schemaPath: ["requestBody"] });
|
|
147
|
-
if (n !== void 0) return
|
|
148
|
-
mimeType:
|
|
149
|
-
params:
|
|
165
|
+
if (n !== void 0) return F && typeof n == "object" && n ? {
|
|
166
|
+
mimeType: A,
|
|
167
|
+
params: D(n, M, void 0, k === "multipart/form-data", B)
|
|
150
168
|
} : {
|
|
151
|
-
mimeType:
|
|
152
|
-
text:
|
|
169
|
+
mimeType: A,
|
|
170
|
+
text: y(n, k, z?.schema === void 0) ?? (typeof n == "string" ? n : JSON.stringify(n))
|
|
153
171
|
};
|
|
154
172
|
}
|
|
155
173
|
};
|
|
156
|
-
export {
|
|
174
|
+
export { O as processBody };
|
|
157
175
|
|
|
158
176
|
//# sourceMappingURL=process-body.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-body.js","names":["buildFileParam","fileName","contentType","isBinarySchema","schema","getBinaryPlaceholderFileName","value","objectToFormParams","params","entries","obj","item","key","partEncoding","parentKey","encoding","isMultipart","restored","coerceLeafValueToSchemaType","resolveLeafSchema","arrayParts","serializeMultipartArray","part","hasFormStyle","explicitContentType","binaryPlaceholderFileName","styleParams","serializeFormPropertyWithEncoding","param","file","unpackProxyObject","nestedParams","processBody","_contentType","requestBody","harMimeType","formatBinaryFile","media","needsMultipartEncoding","exampleName","example","body","buildRequestBody","requestBodyCompositionSelection","openapiVersion","jsonSchemaDialect","encoded","serializeMultipartBody","chunk","isFormData","isXmlMediaType","xmlExample","getExampleFromBody","selected","getExampleValue","getExample","explicitText","getExplicitExampleText","_example","exampleValue","getResolvedRef","mergeSiblingReferences","serializeStreamExample","mediaType","contentSchema","exampleSchema","snapshotSchema","isObjectSchema","name","property","resolved","resolve","isArraySchema","isFileSchema","binary","getStreamFormat","extractedExample","getExampleFromSchema"],"sources":["../../../../src/code-example/helpers/operation-to-har/process-body.ts"],"sourcesContent":["import { getStreamFormat } from '@scalar/helpers/http/is-streaming-content-type'\nimport { isXmlMediaType } from '@scalar/helpers/http/is-xml-media-type'\nimport { getExampleValue, getExplicitExampleText } from '@scalar/workspace-store/helpers/get-example-value'\nimport { getResolvedRef, mergeSiblingReferences } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { isFileSchema } from '@scalar/workspace-store/helpers/is-file-schema'\nimport { serializeStreamExample } from '@scalar/workspace-store/helpers/serialize-stream-example'\nimport { snapshotSchema } from '@scalar/workspace-store/helpers/snapshot-schema'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n buildRequestBody,\n coerceLeafValueToSchemaType,\n getExample,\n getExampleFromBody,\n getExampleFromSchema,\n needsMultipartEncoding,\n resolveLeafSchema,\n serializeFormPropertyWithEncoding,\n serializeMultipartArray,\n serializeMultipartBody,\n} from '@scalar/workspace-store/request-example'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n MediaTypeObject,\n RequestBodyObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema, isObjectSchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport type { Param, PostData } from 'har-format'\n\nimport type { OperationToHarProps } from './operation-to-har'\n\ntype ProcessBodyProps = Pick<\n OperationToHarProps,\n 'contentType' | 'example' | 'requestBodyCompositionSelection' | 'openapiVersion' | 'jsonSchemaDialect'\n> & {\n requestBody: RequestBodyObject\n}\n\ntype MultipartEncodingMap = MediaTypeObject['encoding']\n\n/**\n * Builds a HAR param for an uploaded file. `fileName` is what snippet generators read to emit real\n * file handling (for example `files=` in Python or `new Blob` in fetch). `value` keeps the\n * `@filename` placeholder for consumers that only read the text value.\n */\nconst buildFileParam = (name: string, fileName: string, contentType?: string): Param => ({\n name,\n value: `@${fileName}`,\n fileName,\n ...(contentType ? { contentType } : {}),\n})\n\n/** True when the schema describes a binary file (`type: string, format: binary`). */\nconst isBinarySchema = (schema: SchemaObject | undefined): boolean =>\n !!schema && 'type' in schema && schema.type === 'string' && 'format' in schema && schema.format === 'binary'\n\n/**\n * Example generation turns a binary property into the `@filename` placeholder string.\n * Use the schema to tell that apart from a normal text field that happens to start with `@`.\n */\nconst getBinaryPlaceholderFileName = (value: unknown, schema: SchemaObject | undefined): string | undefined =>\n typeof value === 'string' && value.startsWith('@') && isBinarySchema(schema) ? value.slice(1) : undefined\n\n/**\n * Converts a form-data body into HAR `Param[]` entries for `multipart/form-data`\n * and `application/x-www-form-urlencoded` requests.\n *\n * Per OpenAPI 3.1.x Encoding Object, each property's serialization is governed\n * by an optional Encoding entry. When `style` / `explode` / `allowReserved` is\n * set, the value is serialized RFC6570-style and `contentType` is ignored.\n * Multipart arrays apply the encoding to each item and repeat the property name.\n * Object items default to JSON, and uploaded files retain their filename references.\n *\n * @param obj - The form-data payload, either an object keyed by property name\n * or a HAR-style `{ name, value, isDisabled }[]` array.\n * @param encoding - The `encoding` map from the Media Type Object, if any.\n * Used only at the top level (`parentKey` undefined).\n * @param parentKey - When set, we are flattening a nested object inside another\n * property; encoding is ignored and keys are joined with `.` (legacy default).\n * @param isMultipart - True for `multipart/form-data`. Gates the spec defaults\n * for object properties and array items. Urlencoded bodies retain their existing\n * serialization and flattening behavior.\n */\nconst objectToFormParams = (\n obj: object | { name: string; value: unknown; isDisabled: boolean }[],\n encoding?: MultipartEncodingMap,\n parentKey?: string,\n isMultipart = false,\n schema?: SchemaObject,\n): Param[] => {\n const params: Param[] = []\n\n /** Ensure we do not include disabled items */\n const entries: [string, unknown][] = Array.isArray(obj)\n ? obj.filter((item) => !item.isDisabled).map((item) => [String(item.name), item.value])\n : Object.entries(obj)\n\n for (const [key, value] of entries) {\n if (value === undefined || value === null) {\n continue\n }\n\n const partEncoding = parentKey ? undefined : encoding?.[key]\n\n if (isMultipart && !parentKey) {\n const restored = Array.isArray(obj) ? coerceLeafValueToSchemaType(value, resolveLeafSchema(schema, [key])) : value\n const arrayParts = serializeMultipartArray(key, Array.isArray(restored) ? restored : value, partEncoding)\n if (arrayParts) {\n for (const part of arrayParts) {\n if (part.value instanceof File) {\n params.push(buildFileParam(part.key, part.value.name, part.contentType ?? part.value.type))\n continue\n }\n params.push({\n name: part.key,\n value: part.value,\n ...(part.contentType ? { contentType: part.contentType } : {}),\n })\n }\n continue\n }\n }\n /**\n * Per OpenAPI 3.1.1: when style, explode, or allowReserved is explicitly set on the\n * encoding entry, contentType (implicit or explicit) is ignored and the value is\n * serialized as if it were a query-style parameter.\n */\n const hasFormStyle =\n partEncoding &&\n (partEncoding.style !== undefined ||\n partEncoding.explode !== undefined ||\n partEncoding.allowReserved !== undefined)\n /**\n * Per OAS 3.1.x Encoding Object: `contentType` SHALL be ignored if the request body\n * media type is not a multipart. For `application/x-www-form-urlencoded` we still\n * honor `style`/`explode`/`allowReserved` (handled above), but a `contentType`-only\n * entry has no effect — values fall through to the dotted-key flattening default.\n */\n const explicitContentType = hasFormStyle || !isMultipart ? undefined : partEncoding?.contentType\n\n /**\n * When the encoding sets style/explode/allowReserved, serialize the value RFC6570-style\n * (bracket/exploded notation) and ignore contentType. See `serializeFormPropertyWithEncoding`\n * for the per-style rules; it returns null for primitives, Files, and arrays of Files, which\n * then fall through to the dedicated branches below. HAR represents multipart and urlencoded\n * the same way via `PostData.params`, so the resulting parts work for both.\n */\n const binaryPlaceholderFileName =\n isMultipart && !parentKey ? getBinaryPlaceholderFileName(value, resolveLeafSchema(schema, [key])) : undefined\n const styleParams = parentKey ? null : serializeFormPropertyWithEncoding(key, value, partEncoding)\n if (styleParams) {\n for (const param of styleParams) {\n params.push({ name: param.key, value: param.value })\n }\n } else if (value instanceof File) {\n /**\n * File values render as `@filename` references, the conventional cURL syntax for an\n * attached file. Picked up by snippet renderers downstream (e.g. `--form 'x=@file.png'`).\n */\n const file = unpackProxyObject(value)\n params.push(buildFileParam(key, file.name, explicitContentType ?? (isMultipart ? file.type : undefined)))\n } else if (binaryPlaceholderFileName !== undefined) {\n /** A binary property filled in by example generation, so it is a file and not a text field. */\n params.push(buildFileParam(key, binaryPlaceholderFileName, explicitContentType))\n } else if (explicitContentType && typeof value === 'object') {\n /**\n * Per OAS 3.1.x Encoding Object: an explicit `encoding[key].contentType` on a\n * complex value overrides the default and emits a single part containing the value\n * JSON-stringified into that media type. Only reachable when style/explode/allowReserved\n * are unset (otherwise contentType is ignored — see the style branch above).\n */\n params.push({\n name: key,\n value: JSON.stringify(unpackProxyObject(value)),\n contentType: explicitContentType,\n })\n } else if (isMultipart && !parentKey && !hasFormStyle && typeof value === 'object' && !Array.isArray(value)) {\n /**\n * Per OpenAPI 3.x: a top-level multipart property whose value is an object (and not a File)\n * defaults to a single part encoded as application/json, rather than being flattened\n * into multiple parts with dotted keys.\n */\n params.push({\n name: key,\n value: JSON.stringify(unpackProxyObject(value)),\n contentType: 'application/json',\n })\n } else if (Array.isArray(value)) {\n for (const item of value) {\n if (item instanceof File) {\n const file = unpackProxyObject(item)\n params.push(buildFileParam(key, file.name, isMultipart ? file.type : undefined))\n } else {\n params.push({ name: key, value: String(item) })\n }\n }\n } else if (typeof value === 'object') {\n /**\n * Legacy fallback: flatten nested objects into dotted-key parts. Reached when the\n * multipart JSON-default branches above don't apply — i.e. either inside a recursive\n * call (`parentKey` set) or on `application/x-www-form-urlencoded` bodies without an\n * explicit encoding entry. Strict OAS 3.1.x would use `style: form, explode: true` as\n * the urlencoded default (inner keys become top-level params); we keep dotted keys for\n * backwards compatibility with consumers that already parse this shape.\n */\n const nestedParams = objectToFormParams(value, undefined, key)\n\n for (const param of nestedParams) {\n params.push({ name: `${key}.${param.name}`, value: param.value })\n }\n } else {\n params.push({\n name: key,\n value: String(value),\n ...(explicitContentType ? { contentType: explicitContentType } : {}),\n })\n }\n }\n\n return params\n}\n\n/**\n * Processes the request body and returns the processed data\n * Returns undefined if no example is found\n */\nexport const processBody = ({\n requestBody,\n contentType,\n example,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n}: ProcessBodyProps): PostData | undefined => {\n const _contentType = contentType || Object.keys(requestBody.content)[0] || ''\n /** Empty when \"Other\" is selected so snippets do not inject `Content-Type: other`. */\n const harMimeType = _contentType === 'other' ? '' : _contentType\n const formatBinaryFile = (file: File) => {\n const unwrappedFile = unpackProxyObject(file)\n return `@${unwrappedFile.name || 'filename'}`\n }\n const encoding = requestBody.content[_contentType]?.encoding\n\n const media = requestBody.content[_contentType]\n if (media && needsMultipartEncoding(_contentType, media)) {\n const exampleName = example ?? Object.keys(media.examples ?? {})[0] ?? 'default'\n const body = buildRequestBody(\n { ...requestBody, 'x-scalar-selected-content-type': { [exampleName]: _contentType } },\n exampleName,\n requestBodyCompositionSelection,\n openapiVersion,\n jsonSchemaDialect,\n )\n if (body?.mode === 'multipart') {\n const encoded = serializeMultipartBody(body.value, body.contentType)\n return {\n mimeType: encoded.contentType,\n // HAR text cannot embed file bytes synchronously. Keep visible file placeholders.\n text: encoded.chunks\n .map((chunk) => {\n if (chunk instanceof File) {\n return formatBinaryFile(chunk)\n }\n return chunk instanceof Blob ? 'BINARY' : String(chunk)\n })\n .join(''),\n }\n }\n }\n\n // Check if this is a form data content type\n const isFormData = _contentType === 'multipart/form-data' || _contentType === 'application/x-www-form-urlencoded'\n\n // Check if this is an XML content type\n if (isXmlMediaType(_contentType)) {\n const xmlExample = getExampleFromBody(\n requestBody,\n _contentType,\n example ?? '',\n requestBodyCompositionSelection,\n openapiVersion,\n jsonSchemaDialect,\n )\n return xmlExample ? { mimeType: harMimeType, text: xmlExample.value as string } : undefined\n }\n\n // Get the example value\n const selected = getExampleValue(getExample(requestBody, example, contentType))\n const explicitText = getExplicitExampleText(selected, _contentType)\n if (explicitText !== undefined) {\n return { mimeType: harMimeType, text: explicitText }\n }\n const _example = selected?.value\n\n // Return the provided top level example\n if (typeof _example !== 'undefined') {\n const exampleValue = _example !== null && typeof _example === 'object' ? unpackProxyObject(_example) : _example\n\n if (isFormData && typeof exampleValue === 'object' && exampleValue !== null) {\n return {\n mimeType: harMimeType,\n params: objectToFormParams(\n exampleValue,\n encoding,\n undefined,\n _contentType === 'multipart/form-data',\n getResolvedRef(requestBody.content[_contentType]?.schema, mergeSiblingReferences),\n ),\n }\n }\n\n if (exampleValue instanceof File) {\n return {\n mimeType: harMimeType,\n text: formatBinaryFile(exampleValue),\n }\n }\n\n return {\n mimeType: harMimeType,\n text:\n typeof exampleValue === 'string'\n ? exampleValue\n : (serializeStreamExample(exampleValue, _contentType, false) ?? JSON.stringify(exampleValue)),\n }\n }\n\n // Try to extract examples from the schema\n const mediaType = requestBody.content[_contentType]\n const contentSchema = getResolvedRef(mediaType?.schema ?? mediaType?.itemSchema)\n if (typeof contentSchema !== 'undefined') {\n const exampleSchema = snapshotSchema(contentSchema)\n if (_contentType === 'multipart/form-data' && isObjectSchema(exampleSchema)) {\n // Adapt upgraded upload fields only on the code example's private snapshot.\n // The generator already supports the legacy binary shape, including file arrays.\n for (const [name, property] of Object.entries(exampleSchema.properties ?? {})) {\n const resolved = resolve.schema(property)\n const file = resolved && isArraySchema(resolved) ? resolve.schema(resolved.items) : resolved\n if (\n file &&\n !('type' in file) &&\n !('properties' in file) &&\n !file.allOf &&\n !file.oneOf &&\n !file.anyOf &&\n !file.contentSchema &&\n isFileSchema(file, false)\n ) {\n const binary: SchemaObject = { ...file, type: 'string', format: 'binary' }\n exampleSchema.properties![name] =\n resolved && isArraySchema(resolved) ? { ...resolved, items: binary } : binary\n }\n }\n }\n // A migrated whole-body binary schema is empty. Do not infer files from\n // declared values, constraints, compositions, or schemas for individual stream items.\n const isEmptyBinaryBody =\n !isFormData &&\n mediaType?.schema !== undefined &&\n Object.keys(exampleSchema).every((key) => ['__scalar_', 'title', 'description'].includes(key)) &&\n !getStreamFormat(_contentType) &&\n isFileSchema(exampleSchema, false, _contentType)\n if (isEmptyBinaryBody) {\n return { mimeType: harMimeType, text: '@filename' }\n }\n const extractedExample = getExampleFromSchema(\n exampleSchema,\n {\n compositionSelection: requestBodyCompositionSelection,\n mode: 'write',\n openapiVersion,\n jsonSchemaDialect,\n binaryAsFile: _contentType === 'multipart/form-data',\n },\n {\n schemaPath: ['requestBody'],\n },\n )\n\n if (extractedExample !== undefined) {\n if (isFormData && typeof extractedExample === 'object' && extractedExample !== null) {\n return {\n mimeType: harMimeType,\n params: objectToFormParams(\n extractedExample,\n encoding,\n undefined,\n _contentType === 'multipart/form-data',\n contentSchema,\n ),\n }\n }\n\n return {\n mimeType: harMimeType,\n text:\n serializeStreamExample(extractedExample, _contentType, mediaType?.schema === undefined) ??\n (typeof extractedExample === 'string' ? extractedExample : JSON.stringify(extractedExample)),\n }\n }\n }\n\n return undefined\n}\n"],"mappings":";;;;;;;;;;;;AA6CA,IAAMA,KAAkB,GAAc,GAAkB,OAAiC;CACvF;CACA,OAAO,IAAIC;CACX;CACA,GAAIC,IAAc,EAAE,eAAY,IAAI,CAAC;AACvC,IAGMC,KAAkB,MACtB,CAAC,CAACC,KAAU,UAAUA,KAAUA,EAAO,SAAS,YAAY,YAAYA,KAAUA,EAAO,WAAW,UAMhGC,KAAgC,GAAgB,MACpD,OAAOC,KAAU,YAAYA,EAAM,WAAW,GAAG,KAAKH,EAAeC,CAAM,IAAIE,EAAM,MAAM,CAAC,IAAI,KAAA,GAsB5FC,KACJ,GACA,GACA,GACA,IAAc,IACd,MACY;CACZ,IAAMC,IAAkB,CAAC,GAGnBC,IAA+B,MAAM,QAAQC,CAAG,IAClDA,EAAI,QAAQ,MAAS,CAACC,EAAK,UAAU,CAAC,CAAC,KAAK,MAAS,CAAC,OAAOA,EAAK,IAAI,GAAGA,EAAK,KAAK,CAAC,IACpF,OAAO,QAAQD,CAAG;CAEtB,KAAK,IAAM,CAACE,GAAKN,MAAUG,GAAS;EAClC,IAAIH,KAAiC,MACnC;EAGF,IAAMO,IAAeC,IAAY,KAAA,IAAYC,IAAWH;EAExD,IAAII,KAAe,CAACF,GAAW;GAC7B,IAAMG,IAAW,MAAM,QAAQP,CAAG,IAAIQ,EAA4BZ,GAAOa,EAAkBf,GAAQ,CAACQ,CAAG,CAAC,CAAC,IAAIN,GACvGc,IAAaC,EAAwBT,GAAK,MAAM,QAAQK,CAAQ,IAAIA,IAAWX,GAAOO,CAAY;GACxG,IAAIO,GAAY;IAC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,CACF;EACF,IAGK;GACL,UAAU7B;GACV,MACE2B,EAAuBc,GAAkB3C,GAAc8B,GAAW,WAAW,KAAA,CAAS,MACrF,OAAOa,KAAqB,WAAWA,IAAmB,KAAK,UAAUA,CAAgB;EAC9F;CAEJ;AAGF"}
|
|
1
|
+
{"version":3,"file":"process-body.js","names":["buildFileParam","fileName","contentType","isBinarySchema","schema","getBinaryPlaceholderFileName","value","objectToFormParams","params","entries","obj","item","key","partEncoding","parentKey","encoding","isMultipart","restored","coerceLeafValueToSchemaType","resolveLeafSchema","arrayParts","serializeMultipartArray","part","hasFormStyle","explicitContentType","binaryPlaceholderFileName","styleParams","serializeFormPropertyWithEncoding","param","file","unpackProxyObject","nestedParams","processBody","_contentType","requestBody","harMimeType","formatBinaryFile","media","aspNetNaming","usesAspNetFormNaming","multipartNaming","needsMultipartEncoding","exampleName","example","body","buildRequestBody","requestBodyCompositionSelection","openapiVersion","jsonSchemaDialect","encoded","serializeMultipartBody","chunk","isFormData","isXmlMediaType","xmlExample","getExampleFromBody","selected","getExampleValue","getExample","explicitText","getExplicitExampleText","_example","exampleValue","getResolvedRef","mergeSiblingReferences","serializeStreamExample","mediaType","contentSchema","exampleSchema","snapshotSchema","isObjectSchema","name","property","resolved","resolve","isArraySchema","isFileSchema","binary","getStreamFormat","extractedExample","getExampleFromSchema"],"sources":["../../../../src/code-example/helpers/operation-to-har/process-body.ts"],"sourcesContent":["import { getStreamFormat } from '@scalar/helpers/http/is-streaming-content-type'\nimport { isXmlMediaType } from '@scalar/helpers/http/is-xml-media-type'\nimport { getExampleValue, getExplicitExampleText } from '@scalar/workspace-store/helpers/get-example-value'\nimport { getResolvedRef, mergeSiblingReferences } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { isFileSchema } from '@scalar/workspace-store/helpers/is-file-schema'\nimport { serializeStreamExample } from '@scalar/workspace-store/helpers/serialize-stream-example'\nimport { snapshotSchema } from '@scalar/workspace-store/helpers/snapshot-schema'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n buildRequestBody,\n coerceLeafValueToSchemaType,\n getExample,\n getExampleFromBody,\n getExampleFromSchema,\n needsMultipartEncoding,\n resolveLeafSchema,\n serializeFormPropertyWithEncoding,\n serializeMultipartArray,\n serializeMultipartBody,\n usesAspNetFormNaming,\n} from '@scalar/workspace-store/request-example'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n MediaTypeObject,\n RequestBodyObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema, isObjectSchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport type { Param, PostData } from 'har-format'\n\nimport type { OperationToHarProps } from './operation-to-har'\n\ntype ProcessBodyProps = Pick<\n OperationToHarProps,\n | 'multipartNaming'\n | 'contentType'\n | 'example'\n | 'requestBodyCompositionSelection'\n | 'openapiVersion'\n | 'jsonSchemaDialect'\n> & {\n requestBody: RequestBodyObject\n}\n\ntype MultipartEncodingMap = MediaTypeObject['encoding']\n\n/**\n * Builds a HAR param for an uploaded file. `fileName` is what snippet generators read to emit real\n * file handling (for example `files=` in Python or `new Blob` in fetch). `value` keeps the\n * `@filename` placeholder for consumers that only read the text value.\n */\nconst buildFileParam = (name: string, fileName: string, contentType?: string): Param => ({\n name,\n value: `@${fileName}`,\n fileName,\n ...(contentType ? { contentType } : {}),\n})\n\n/** True when the schema describes a binary file (`type: string, format: binary`). */\nconst isBinarySchema = (schema: SchemaObject | undefined): boolean =>\n !!schema && 'type' in schema && schema.type === 'string' && 'format' in schema && schema.format === 'binary'\n\n/**\n * Example generation turns a binary property into the `@filename` placeholder string.\n * Use the schema to tell that apart from a normal text field that happens to start with `@`.\n */\nconst getBinaryPlaceholderFileName = (value: unknown, schema: SchemaObject | undefined): string | undefined =>\n typeof value === 'string' && value.startsWith('@') && isBinarySchema(schema) ? value.slice(1) : undefined\n\n/**\n * Converts a form-data body into HAR `Param[]` entries for `multipart/form-data`\n * and `application/x-www-form-urlencoded` requests.\n *\n * Per OpenAPI 3.1.x Encoding Object, each property's serialization is governed\n * by an optional Encoding entry. When `style` / `explode` / `allowReserved` is\n * set, the value is serialized RFC6570-style and `contentType` is ignored.\n * Multipart arrays apply the encoding to each item and repeat the property name.\n * Object items default to JSON, and uploaded files retain their filename references.\n *\n * @param obj - The form-data payload, either an object keyed by property name\n * or a HAR-style `{ name, value, isDisabled }[]` array.\n * @param encoding - The `encoding` map from the Media Type Object, if any.\n * Used only at the top level (`parentKey` undefined).\n * @param parentKey - When set, we are flattening a nested object inside another\n * property; encoding is ignored and keys are joined with `.` (legacy default).\n * @param isMultipart - True for `multipart/form-data`. Gates the spec defaults\n * for object properties and array items. Urlencoded bodies retain their existing\n * serialization and flattening behavior.\n */\nconst objectToFormParams = (\n obj: object | { name: string; value: unknown; isDisabled: boolean }[],\n encoding?: MultipartEncodingMap,\n parentKey?: string,\n isMultipart = false,\n schema?: SchemaObject,\n): Param[] => {\n const params: Param[] = []\n\n /** Ensure we do not include disabled items */\n const entries: [string, unknown][] = Array.isArray(obj)\n ? obj.filter((item) => !item.isDisabled).map((item) => [String(item.name), item.value])\n : Object.entries(obj)\n\n for (const [key, value] of entries) {\n if (value === undefined || value === null) {\n continue\n }\n\n const partEncoding = parentKey ? undefined : encoding?.[key]\n\n if (isMultipart && !parentKey) {\n const restored = Array.isArray(obj) ? coerceLeafValueToSchemaType(value, resolveLeafSchema(schema, [key])) : value\n const arrayParts = serializeMultipartArray(key, Array.isArray(restored) ? restored : value, partEncoding)\n if (arrayParts) {\n for (const part of arrayParts) {\n if (part.value instanceof File) {\n params.push(buildFileParam(part.key, part.value.name, part.contentType ?? part.value.type))\n continue\n }\n params.push({\n name: part.key,\n value: part.value,\n ...(part.contentType ? { contentType: part.contentType } : {}),\n })\n }\n continue\n }\n }\n /**\n * Per OpenAPI 3.1.1: when style, explode, or allowReserved is explicitly set on the\n * encoding entry, contentType (implicit or explicit) is ignored and the value is\n * serialized as if it were a query-style parameter.\n */\n const hasFormStyle =\n partEncoding &&\n (partEncoding.style !== undefined ||\n partEncoding.explode !== undefined ||\n partEncoding.allowReserved !== undefined)\n /**\n * Per OAS 3.1.x Encoding Object: `contentType` SHALL be ignored if the request body\n * media type is not a multipart. For `application/x-www-form-urlencoded` we still\n * honor `style`/`explode`/`allowReserved` (handled above), but a `contentType`-only\n * entry has no effect — values fall through to the dotted-key flattening default.\n */\n const explicitContentType = hasFormStyle || !isMultipart ? undefined : partEncoding?.contentType\n\n /**\n * When the encoding sets style/explode/allowReserved, serialize the value RFC6570-style\n * (bracket/exploded notation) and ignore contentType. See `serializeFormPropertyWithEncoding`\n * for the per-style rules; it returns null for primitives, Files, and arrays of Files, which\n * then fall through to the dedicated branches below. HAR represents multipart and urlencoded\n * the same way via `PostData.params`, so the resulting parts work for both.\n */\n const binaryPlaceholderFileName =\n isMultipart && !parentKey ? getBinaryPlaceholderFileName(value, resolveLeafSchema(schema, [key])) : undefined\n const styleParams = parentKey ? null : serializeFormPropertyWithEncoding(key, value, partEncoding)\n if (styleParams) {\n for (const param of styleParams) {\n params.push({ name: param.key, value: param.value })\n }\n } else if (value instanceof File) {\n /**\n * File values render as `@filename` references, the conventional cURL syntax for an\n * attached file. Picked up by snippet renderers downstream (e.g. `--form 'x=@file.png'`).\n */\n const file = unpackProxyObject(value)\n params.push(buildFileParam(key, file.name, explicitContentType ?? (isMultipart ? file.type : undefined)))\n } else if (binaryPlaceholderFileName !== undefined) {\n /** A binary property filled in by example generation, so it is a file and not a text field. */\n params.push(buildFileParam(key, binaryPlaceholderFileName, explicitContentType))\n } else if (explicitContentType && typeof value === 'object') {\n /**\n * Per OAS 3.1.x Encoding Object: an explicit `encoding[key].contentType` on a\n * complex value overrides the default and emits a single part containing the value\n * JSON-stringified into that media type. Only reachable when style/explode/allowReserved\n * are unset (otherwise contentType is ignored — see the style branch above).\n */\n params.push({\n name: key,\n value: JSON.stringify(unpackProxyObject(value)),\n contentType: explicitContentType,\n })\n } else if (isMultipart && !parentKey && !hasFormStyle && typeof value === 'object' && !Array.isArray(value)) {\n /**\n * Per OpenAPI 3.x: a top-level multipart property whose value is an object (and not a File)\n * defaults to a single part encoded as application/json, rather than being flattened\n * into multiple parts with dotted keys.\n */\n params.push({\n name: key,\n value: JSON.stringify(unpackProxyObject(value)),\n contentType: 'application/json',\n })\n } else if (Array.isArray(value)) {\n for (const item of value) {\n if (item instanceof File) {\n const file = unpackProxyObject(item)\n params.push(buildFileParam(key, file.name, isMultipart ? file.type : undefined))\n } else {\n params.push({ name: key, value: String(item) })\n }\n }\n } else if (typeof value === 'object') {\n /**\n * Legacy fallback: flatten nested objects into dotted-key parts. Reached when the\n * multipart JSON-default branches above don't apply — i.e. either inside a recursive\n * call (`parentKey` set) or on `application/x-www-form-urlencoded` bodies without an\n * explicit encoding entry. Strict OAS 3.1.x would use `style: form, explode: true` as\n * the urlencoded default (inner keys become top-level params); we keep dotted keys for\n * backwards compatibility with consumers that already parse this shape.\n */\n const nestedParams = objectToFormParams(value, undefined, key)\n\n for (const param of nestedParams) {\n params.push({ name: `${key}.${param.name}`, value: param.value })\n }\n } else {\n params.push({\n name: key,\n value: String(value),\n ...(explicitContentType ? { contentType: explicitContentType } : {}),\n })\n }\n }\n\n return params\n}\n\n/**\n * Processes the request body and returns the processed data\n * Returns undefined if no example is found\n */\nexport const processBody = ({\n requestBody,\n contentType,\n example,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n multipartNaming,\n}: ProcessBodyProps): PostData | undefined => {\n const _contentType = contentType || Object.keys(requestBody.content)[0] || ''\n /** Empty when \"Other\" is selected so snippets do not inject `Content-Type: other`. */\n const harMimeType = _contentType === 'other' ? '' : _contentType\n const formatBinaryFile = (file: File) => {\n const unwrappedFile = unpackProxyObject(file)\n return `@${unwrappedFile.name || 'filename'}`\n }\n const encoding = requestBody.content[_contentType]?.encoding\n\n const media = requestBody.content[_contentType]\n const aspNetNaming = usesAspNetFormNaming(_contentType, media, multipartNaming)\n if (media && (aspNetNaming || needsMultipartEncoding(_contentType, media))) {\n const exampleName = example ?? Object.keys(media.examples ?? {})[0] ?? 'default'\n const body = buildRequestBody(\n { ...requestBody, 'x-scalar-selected-content-type': { [exampleName]: _contentType } },\n exampleName,\n requestBodyCompositionSelection,\n openapiVersion,\n jsonSchemaDialect,\n { multipartNaming, aspNetFilePlaceholders: aspNetNaming && _contentType === 'multipart/form-data' },\n )\n if (aspNetNaming && body?.mode === 'urlencoded') {\n return { mimeType: harMimeType, params: body.value.map(({ key, value }) => ({ name: key, value })) }\n }\n if (aspNetNaming && body?.mode === 'formdata') {\n return {\n mimeType: harMimeType,\n params: body.value.flatMap((part): Param[] => {\n if (part.type === 'file') {\n return [buildFileParam(part.key, part.value.name, part.contentType ?? part.value.type)]\n }\n if (part.type !== 'text') {\n return []\n }\n return [{ name: part.key, value: part.value, ...(part.contentType ? { contentType: part.contentType } : {}) }]\n }),\n }\n }\n if (body?.mode === 'multipart') {\n const encoded = serializeMultipartBody(body.value, body.contentType)\n return {\n mimeType: encoded.contentType,\n // HAR text cannot embed file bytes synchronously. Keep visible file placeholders.\n text: encoded.chunks\n .map((chunk) => {\n if (chunk instanceof File) {\n return formatBinaryFile(chunk)\n }\n return chunk instanceof Blob ? 'BINARY' : String(chunk)\n })\n .join(''),\n }\n }\n }\n\n // Check if this is a form data content type\n const isFormData = _contentType === 'multipart/form-data' || _contentType === 'application/x-www-form-urlencoded'\n\n // Check if this is an XML content type\n if (isXmlMediaType(_contentType)) {\n const xmlExample = getExampleFromBody(\n requestBody,\n _contentType,\n example ?? '',\n requestBodyCompositionSelection,\n openapiVersion,\n jsonSchemaDialect,\n )\n return xmlExample ? { mimeType: harMimeType, text: xmlExample.value as string } : undefined\n }\n\n // Get the example value\n const selected = getExampleValue(getExample(requestBody, example, contentType))\n const explicitText = getExplicitExampleText(selected, _contentType)\n if (explicitText !== undefined) {\n return { mimeType: harMimeType, text: explicitText }\n }\n const _example = selected?.value\n\n // Return the provided top level example\n if (typeof _example !== 'undefined') {\n const exampleValue = _example !== null && typeof _example === 'object' ? unpackProxyObject(_example) : _example\n\n if (isFormData && typeof exampleValue === 'object' && exampleValue !== null) {\n return {\n mimeType: harMimeType,\n params: objectToFormParams(\n exampleValue,\n encoding,\n undefined,\n _contentType === 'multipart/form-data',\n getResolvedRef(requestBody.content[_contentType]?.schema, mergeSiblingReferences),\n ),\n }\n }\n\n if (exampleValue instanceof File) {\n return {\n mimeType: harMimeType,\n text: formatBinaryFile(exampleValue),\n }\n }\n\n return {\n mimeType: harMimeType,\n text:\n typeof exampleValue === 'string'\n ? exampleValue\n : (serializeStreamExample(exampleValue, _contentType, false) ?? JSON.stringify(exampleValue)),\n }\n }\n\n // Try to extract examples from the schema\n const mediaType = requestBody.content[_contentType]\n const contentSchema = getResolvedRef(mediaType?.schema ?? mediaType?.itemSchema)\n if (typeof contentSchema !== 'undefined') {\n const exampleSchema = snapshotSchema(contentSchema)\n if (_contentType === 'multipart/form-data' && isObjectSchema(exampleSchema)) {\n // Adapt upgraded upload fields only on the code example's private snapshot.\n // The generator already supports the legacy binary shape, including file arrays.\n for (const [name, property] of Object.entries(exampleSchema.properties ?? {})) {\n const resolved = resolve.schema(property)\n const file = resolved && isArraySchema(resolved) ? resolve.schema(resolved.items) : resolved\n if (\n file &&\n !('type' in file) &&\n !('properties' in file) &&\n !file.allOf &&\n !file.oneOf &&\n !file.anyOf &&\n !file.contentSchema &&\n isFileSchema(file, false)\n ) {\n const binary: SchemaObject = { ...file, type: 'string', format: 'binary' }\n exampleSchema.properties![name] =\n resolved && isArraySchema(resolved) ? { ...resolved, items: binary } : binary\n }\n }\n }\n // A migrated whole-body binary schema is empty. Do not infer files from\n // declared values, constraints, compositions, or schemas for individual stream items.\n const isEmptyBinaryBody =\n !isFormData &&\n mediaType?.schema !== undefined &&\n Object.keys(exampleSchema).every((key) => ['__scalar_', 'title', 'description'].includes(key)) &&\n !getStreamFormat(_contentType) &&\n isFileSchema(exampleSchema, false, _contentType)\n if (isEmptyBinaryBody) {\n return { mimeType: harMimeType, text: '@filename' }\n }\n const extractedExample = getExampleFromSchema(\n exampleSchema,\n {\n compositionSelection: requestBodyCompositionSelection,\n mode: 'write',\n openapiVersion,\n jsonSchemaDialect,\n binaryAsFile: _contentType === 'multipart/form-data',\n },\n {\n schemaPath: ['requestBody'],\n },\n )\n\n if (extractedExample !== undefined) {\n if (isFormData && typeof extractedExample === 'object' && extractedExample !== null) {\n return {\n mimeType: harMimeType,\n params: objectToFormParams(\n extractedExample,\n encoding,\n undefined,\n _contentType === 'multipart/form-data',\n contentSchema,\n ),\n }\n }\n\n return {\n mimeType: harMimeType,\n text:\n serializeStreamExample(extractedExample, _contentType, mediaType?.schema === undefined) ??\n (typeof extractedExample === 'string' ? extractedExample : JSON.stringify(extractedExample)),\n }\n }\n }\n\n return undefined\n}\n"],"mappings":";;;;;;;;;;;;AAmDA,IAAMA,KAAkB,GAAc,GAAkB,OAAiC;CACvF;CACA,OAAO,IAAIC;CACX;CACA,GAAIC,IAAc,EAAE,eAAY,IAAI,CAAC;AACvC,IAGMC,KAAkB,MACtB,CAAC,CAACC,KAAU,UAAUA,KAAUA,EAAO,SAAS,YAAY,YAAYA,KAAUA,EAAO,WAAW,UAMhGC,KAAgC,GAAgB,MACpD,OAAOC,KAAU,YAAYA,EAAM,WAAW,GAAG,KAAKH,EAAeC,CAAM,IAAIE,EAAM,MAAM,CAAC,IAAI,KAAA,GAsB5FC,KACJ,GACA,GACA,GACA,IAAc,IACd,MACY;CACZ,IAAMC,IAAkB,CAAC,GAGnBC,IAA+B,MAAM,QAAQC,CAAG,IAClDA,EAAI,QAAQ,MAAS,CAACC,EAAK,UAAU,CAAC,CAAC,KAAK,MAAS,CAAC,OAAOA,EAAK,IAAI,GAAGA,EAAK,KAAK,CAAC,IACpF,OAAO,QAAQD,CAAG;CAEtB,KAAK,IAAM,CAACE,GAAKN,MAAUG,GAAS;EAClC,IAAIH,KAAiC,MACnC;EAGF,IAAMO,IAAe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EAAS,KAAK,IAAIA;GACpF,IACE5C,KACA,EAAE,UAAUA,MACZ,EAAE,gBAAgBA,MAClB,CAACA,EAAK,SACN,CAACA,EAAK,SACN,CAACA,EAAK,SACN,CAACA,EAAK,iBACN+C,EAAa/C,GAAM,EAAK,GACxB;IACA,IAAMgD,IAAuB;KAAE,GAAGhD;KAAM,MAAM;KAAU,QAAQ;IAAS;IACzE,EAAc,WAAY0C,KACxBE,KAAYE,EAAcF,CAAQ,IAAI;KAAE,GAAGA;KAAU,OAAOI;IAAO,IAAIA;GAC3E;EACF;EAUF,IALE,CAACzB,KACDc,GAAW,WAAW,KAAA,KACtB,OAAO,KAAKE,CAAa,CAAC,CAAC,OAAO,MAAQ;GAAC;GAAa;GAAS;EAAa,CAAC,CAAC,SAASxD,CAAG,CAAC,KAC7F,CAACkE,EAAgB7C,CAAY,KAC7B2C,EAAaR,GAAe,IAAOnC,CAAY,GAE/C,OAAO;GAAE,UAAUE;GAAa,MAAM;EAAY;EAEpD,IAAM4C,IAAmBC,EACvBZ,GACA;GACE,sBAAsBtB;GACtB,MAAM;GACN;GACA;GACA,cAAcb,MAAiB;EACjC,GACA,EACE,YAAY,CAAC,aAAa,EAC5B,CACF;EAEA,IAAI8C,MAAqB,KAAA,GAcvB,OAbI3B,KAAc,OAAO2B,KAAqB,YAAYA,IACjD;GACL,UAAU5C;GACV,QAAQ5B,EACNwE,GACAhE,GACA,KAAA,GACAkB,MAAiB,uBACjBkC,CACF;EACF,IAGK;GACL,UAAUhC;GACV,MACE8B,EAAuBc,GAAkB9C,GAAciC,GAAW,WAAW,KAAA,CAAS,MACrF,OAAOa,KAAqB,WAAWA,IAAmB,KAAK,UAAUA,CAAgB;EAC9F;CAEJ;AAGF"}
|
package/dist/constants.js
CHANGED
package/dist/style.css
CHANGED
|
@@ -1017,7 +1017,7 @@
|
|
|
1017
1017
|
color: var(--scalar-code-string, var(--scalar-color-blue));
|
|
1018
1018
|
}
|
|
1019
1019
|
|
|
1020
|
-
.hljs.language-
|
|
1020
|
+
.hljs.language-php .hljs-variable, .hljs.language-objectivec .hljs-meta {
|
|
1021
1021
|
color: var(--scalar-color-1);
|
|
1022
1022
|
}
|
|
1023
1023
|
|
|
@@ -5225,5 +5225,5 @@
|
|
|
5225
5225
|
opacity: .5;
|
|
5226
5226
|
}
|
|
5227
5227
|
}
|
|
5228
|
-
.request-card[data-v-aaf1efda],.request-card[data-v-5057e16b]{color:var(--scalar-color-1);font-size:var(--scalar-font-size-3)}.request-method[data-v-5057e16b]{font-family:var(--scalar-font-code);margin-right:6px}.request-card-footer[data-v-5057e16b]{flex-shrink:0;justify-content:flex-end;padding:6px;display:flex;position:relative}.request-card-footer--wraps[data-v-5057e16b]{flex-wrap:wrap;row-gap:4px}.request-card-footer-start[data-v-5057e16b]{flex:1 0 auto;align-items:center;display:flex}.request-card-footer-addon[data-v-5057e16b]{flex:7em;align-items:center;min-width:0;max-width:max-content;margin-inline-end:auto;display:flex}.request-editor-section[data-v-5057e16b]{flex:1;display:flex}.code-snippet>.scalar-code-copy[data-v-5057e16b]{background:var(--scalar-card-surface-raised,var(--scalar-background-2))}.request-card-simple[data-v-5057e16b]{font-size:var(--scalar-small);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;padding:8px 8px 8px 12px;display:flex}.request-header[data-v-5057e16b]{overflow-wrap:anywhere;flex:999 auto;min-width:0}.request-card-actions[data-v-5057e16b]{flex:1 0 auto}.code-snippet[data-v-5057e16b]{flex-direction:column;width:100%;display:flex}.property-rule[data-v-e22666da] .composition-panel>.schema-card>.schema-properties>ul>li.property.property--tree-container{padding-top:0!important}.property-heading:empty+.property-description[data-v-1b21ab2e]:last-of-type,.property-description[data-v-1b21ab2e]:first-of-type:last-of-type{margin-top:0}.property-list[data-v-1b21ab2e]{border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius);margin-top:10px}.property-list .property[data-v-1b21ab2e]:last-of-type{padding-bottom:10px}.enum-toggle-button[data-v-1b21ab2e]:hover{color:var(--scalar-color-1)}.badge.text-orange[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-orange), transparent 90%);border:#0000}.badge.text-yellow[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-yellow), transparent 90%);border:#0000}.badge.text-red[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-red), transparent 90%);border:#0000}.badge.text-purple[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-purple), transparent 90%);border:#0000}.badge.text-green[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-green), transparent 90%);border:#0000}.property-default[data-v-46973243]{font-size:var(--scalar-mini);flex-direction:column;display:flex;position:relative}.property-default[data-v-46973243]:hover:before{content:"";border-radius:var(--scalar-radius);width:100%;height:20px;position:absolute;top:0;left:0}.property-default:hover .property-default-label span[data-v-46973243]{color:var(--scalar-color-1)}.property-default-label span[data-v-46973243]{color:var(--scalar-color-2);border-bottom:var(--scalar-border-width) dotted currentColor;position:relative}.property-default-value[data-v-46973243]{font-family:var(--scalar-font-code);align-items:center;gap:8px;width:100%;padding:6px;display:flex}.property-default-value span[data-v-46973243]{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.property-default-value[data-v-46973243] svg{color:var(--scalar-color-3)}.property-default-value[data-v-46973243]:hover svg{color:var(--scalar-color-1)}.property-default-value[data-v-46973243]{background:var(--scalar-background-2);border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius)}.property-default-value-list[data-v-46973243]{background-color:var(--scalar-background-1);box-shadow:var(--scalar-shadow-1);border-radius:var(--scalar-radius-lg);border:var(--scalar-border-width) solid var(--scalar-border-color);z-index:2;flex-direction:column;gap:3px;min-width:200px;max-width:300px;padding:9px;display:none;position:absolute;top:18px;left:50%;overflow:auto;transform:translate(-50%)}.property-default:hover .property-default-value-list[data-v-46973243]{display:flex}.property-detail[data-v-8b57daa7]{display:inline-flex}.property-detail+.property-detail[data-v-8b57daa7]:before{content:"·";margin:0 .5ch;display:block}.property-detail-truncate[data-v-8b57daa7]{overflow:hidden}.property-detail-truncate>.property-detail-value[data-v-8b57daa7]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.property-detail-prefix[data-v-8b57daa7]{color:var(--scalar-color-2)}code.property-detail-value[data-v-8b57daa7]{font-family:var(--scalar-font-code);font-size:var(--scalar-font-size-3);color:var(--scalar-color-2);background:color-mix(in srgb, var(--scalar-background-2), var(--scalar-background-1));border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius);padding:0 4px}.property-example[data-v-72248a2e]{font-size:var(--scalar-mini);flex-direction:column;display:flex;position:relative}.property-example[data-v-72248a2e]:hover:before{pointer-events:none;content:"";border-radius:var(--scalar-radius);width:100%;height:20px;position:absolute;top:0;left:0}.property-example-value[data-v-72248a2e]{font-family:var(--scalar-font-code);align-items:center;gap:8px;width:100%;padding:6px;display:flex}.property-example-value span[data-v-72248a2e]{text-overflow:ellipsis;white-space:pre;display:block;overflow:hidden}.property-example-value[data-v-72248a2e] svg{color:var(--scalar-color-3)}.property-example-value[data-v-72248a2e]:hover svg{color:var(--scalar-color-1)}.property-example-value[data-v-72248a2e]{background:var(--scalar-background-2);border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius)}.property-example-value-list[data-v-72248a2e]{background-color:var(--scalar-background-1);box-shadow:var(--scalar-shadow-1);border-radius:var(--scalar-radius-lg);border:var(--scalar-border-width) solid var(--scalar-border-color);z-index:1000;flex-direction:column;gap:3px;min-width:200px;max-width:300px;padding:9px;display:none;position:absolute;top:18px;left:50%;overflow:auto;transform:translate(-50%)}.property-example-value-list-start[data-v-72248a2e]{left:0;transform:none}.property-example:hover .property-example-value-list[data-v-72248a2e]{display:flex}.property-pattern[data-v-e8f7b07b]{font-size:var(--scalar-mini);flex-direction:column;display:flex;position:relative}.property-pattern[data-v-e8f7b07b]:hover:before{content:"";border-radius:var(--scalar-radius);width:100%;height:20px;position:absolute;top:0;left:0}.property-pattern-popup[data-v-e8f7b07b]{background-color:var(--scalar-background-1);box-shadow:var(--scalar-shadow-1);border-radius:var(--scalar-radius-lg);border:var(--scalar-border-width) solid var(--scalar-border-color);z-index:1000;min-width:200px;max-width:min(500px,100vw - 32px);max-height:min(400px,100vh - 32px);padding:9px;display:none;position:absolute;top:18px;left:50%;overflow-y:auto;transform:translate(-50%)}.property-pattern:hover .property-pattern-popup[data-v-e8f7b07b],.property-pattern:focus-within .property-pattern-popup[data-v-e8f7b07b],.property-pattern.is-open .property-pattern-popup[data-v-e8f7b07b]{display:flex}.property-pattern-value[data-v-e8f7b07b]{font-family:var(--scalar-font-code);background:var(--scalar-background-2);border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius);align-items:flex-start;gap:8px;width:100%;padding:6px;display:flex}.property-pattern-value code[data-v-e8f7b07b]{font-family:var(--scalar-font-code);font-size:var(--scalar-font-size-3);color:var(--scalar-color-2);white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;text-align:left;flex:1}.property-heading[data-v-09888606]{white-space:nowrap;flex-wrap:wrap;align-items:baseline;row-gap:9px;display:flex}:is(.property-heading[data-v-09888606]:has(+.children),.property-heading[data-v-09888606]:has(+.property-rule)){margin-bottom:9px}.property-heading[data-v-09888606]>*{margin-right:9px}.property-heading[data-v-09888606]:last-child{margin-right:0}.property-name[data-v-09888606]{max-width:100%;font-family:var(--scalar-font-code);font-weight:var(--scalar-bold);font-size:var(--scalar-font-size-4);white-space:normal;overflow-wrap:break-word}.property-additional[data-v-09888606]{font-family:var(--scalar-font-code)}.property-required[data-v-09888606],.property-optional[data-v-09888606]{color:var(--scalar-color-2)}.property-required[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-orange)}.light-mode .property-required[data-v-09888606]{color:color-mix(in srgb, var(--scalar-color-orange), var(--scalar-color-1) 32%)}.property-read-only[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-blue)}.property-write-only[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-green)}.property-discriminator[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-purple)}.property-detail[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-2);align-items:center;min-width:0;display:flex}.property-const[data-v-09888606]{color:var(--scalar-color-1)}.deprecated[data-v-09888606]{text-decoration:line-through}.property[data-v-00f22f7c]{color:var(--scalar-color-1);font-size:var(--scalar-small);flex-direction:column;padding:10px;display:flex;position:relative}.property[data-v-00f22f7c]:has(>.property-rule:first-of-type):not(.property--compact){padding-top:8px;padding-bottom:8px}.property--deprecated[data-v-00f22f7c]{background:repeating-linear-gradient(-45deg, var(--scalar-background-2) 0, var(--scalar-background-2) 2px, transparent 2px, transparent 5px);background-size:100%}.property-description[data-v-00f22f7c]{line-height:1.4;font-size:var(--scalar-small);margin-top:6px}.property-description[data-v-00f22f7c]:has(+.property-rule){margin-bottom:9px}[data-v-00f22f7c] .property-description *{color:var(--scalar-color-2)!important}.property[data-v-00f22f7c]:not(:last-of-type){border-bottom:var(--scalar-border-width) solid var(--scalar-border-color)}.property-description+.children[data-v-00f22f7c],.children+.property-rule[data-v-00f22f7c]{margin-top:9px}.children[data-v-00f22f7c]{flex-direction:column;display:flex}.children .property--compact.property--level-1[data-v-00f22f7c]{padding:12px}.property-example-value[data-v-00f22f7c]{all:unset;font-family:var(--scalar-font-code);border-top:var(--scalar-border-width) solid var(--scalar-border-color);padding:6px}.property-rule[data-v-00f22f7c]{border-radius:var(--scalar-radius-lg);flex-direction:column;display:flex}.property-example[data-v-00f22f7c]{background:0 0;border:none;flex-direction:row;gap:8px;display:flex}.property-example-label[data-v-00f22f7c],.property-example-value[data-v-00f22f7c]{padding:3px 0 0}.property-example-value[data-v-00f22f7c]{background:var(--scalar-background-2);border-radius:var(--scalar-radius);border-top:0;padding:3px 4px}.property-name[data-v-00f22f7c]{font-family:var(--scalar-font-code);font-weight:var(--scalar-semibold)}.property-name-additional-properties[data-v-00f22f7c]:before,.property-name-pattern-properties[data-v-00f22f7c]:before{text-transform:uppercase;font-size:var(--scalar-micro);border-radius:var(--scalar-radius);color:var(--scalar-color-1);border:var(--scalar-border-width) solid var(--scalar-border-color);background-color:var(--scalar-background-2);margin-right:4px;padding:2px 4px;display:inline-block}.property-name-pattern-properties[data-v-00f22f7c]:before{content:"regex"}.property-name-additional-properties[data-v-00f22f7c],.property-name-pattern-properties[data-v-00f22f7c]{border:1px dashed var(--scalar-border-color);color:var(--scalar-color-accent);border-radius:var(--scalar-radius);padding:2px;display:inline-block}.error[data-v-86862f28]{background-color:var(--scalar-color-red)}.schema-card[data-v-86862f28]{font-size:var(--scalar-font-size-4);color:var(--scalar-color-1)}.schema-card-title[data-v-86862f28]{height:var(--schema-title-height);color:var(--scalar-color-2);font-weight:var(--scalar-semibold);font-size:var(--scalar-mini);border-bottom:var(--scalar-border-width) solid transparent;align-items:center;gap:4px;padding:6px 8px;display:flex}button.schema-card-title[data-v-86862f28]{cursor:pointer}button.schema-card-title[data-v-86862f28]:hover{color:var(--scalar-color-1)}.schema-properties-open>.schema-card-title[data-v-86862f28]{border-bottom:var(--scalar-border-width) solid var(--scalar-border-color);border-bottom-right-radius:0;border-bottom-left-radius:0}.schema-properties-open>.schema-properties[data-v-86862f28]{width:fit-content}.schema-card-description[data-v-86862f28]{color:var(--scalar-color-2)}.schema-card-description+.schema-properties[data-v-86862f28]{width:fit-content;margin-top:8px}.schema-card--level-0:first-of-type>.schema-card-description[data-v-86862f28]:has(+.schema-properties){border-bottom:var(--scalar-border-width) solid var(--scalar-border-color);margin-bottom:-8px;padding-bottom:8px}.schema-card--level-0~.schema-card--level-0>.schema-card-description[data-v-86862f28]:has(+.schema-properties){padding-top:8px}.schema-properties-open.schema-properties[data-v-86862f28],.schema-properties-open>.schema-card--open[data-v-86862f28]{width:100%}.schema-properties[data-v-86862f28]{border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius-lg);flex-direction:column;width:fit-content;display:flex}.schema-properties-name[data-v-86862f28]{width:100%}.schema-properties .schema-properties[data-v-86862f28]{border-radius:13.5px}.schema-properties .schema-properties.schema-properties-open[data-v-86862f28]{border-radius:var(--scalar-radius-lg)}.schema-properties-open[data-v-86862f28]{width:100%}.schema-card--compact[data-v-86862f28]{align-self:flex-start}.schema-card--compact.schema-card--open[data-v-86862f28]{align-self:initial}.schema-card-title--compact[data-v-86862f28]{color:var(--scalar-color-2);border-bottom:none;height:auto;padding:6px 10px 6px 8px}.schema-properties-open>.schema-card-title--compact[data-v-86862f28]{position:static}.property--level-0>.schema-properties>.schema-card--level-0>.schema-properties[data-v-86862f28]{border:none}.property--level-0 .schema-card--level-0:not(.schema-card--compact) .property--level-1[data-v-86862f28]{padding:0 0 8px}:not(.composition-panel)>.schema-card--compact.schema-card--level-0>.schema-properties[data-v-86862f28]{border:none}[data-v-86862f28] .schema-card-description p{font-size:var(--scalar-small,var(--scalar-paragraph));color:var(--scalar-color-2);margin-bottom:6px;display:block}.children .schema-card-description[data-v-86862f28]:first-of-type{padding-top:0}.schema-type-icon[data-v-39d4fd7f]{color:var(--scalar-color-1);display:none}.schema-type[data-v-39d4fd7f]{font-family:var(--scalar-font-code);color:var(--scalar-color-1)}
|
|
5228
|
+
.request-card[data-v-aaf1efda],.request-card[data-v-f11de264]{color:var(--scalar-color-1);font-size:var(--scalar-font-size-3)}.request-method[data-v-f11de264]{font-family:var(--scalar-font-code);margin-right:6px}.request-card-footer[data-v-f11de264]{flex-shrink:0;justify-content:flex-end;padding:6px;display:flex;position:relative}.request-card-footer--wraps[data-v-f11de264]{flex-wrap:wrap;row-gap:4px}.request-card-footer-start[data-v-f11de264]{flex:1 0 auto;align-items:center;display:flex}.request-card-footer-addon[data-v-f11de264]{flex:7em;align-items:center;min-width:0;max-width:max-content;margin-inline-end:auto;display:flex}.request-editor-section[data-v-f11de264]{flex:1;display:flex}.code-snippet>.scalar-code-copy[data-v-f11de264]{background:var(--scalar-card-surface-raised,var(--scalar-background-2))}.request-card-simple[data-v-f11de264]{font-size:var(--scalar-small);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;padding:8px 8px 8px 12px;display:flex}.request-header[data-v-f11de264]{overflow-wrap:anywhere;flex:999 auto;min-width:0}.request-card-actions[data-v-f11de264]{flex:1 0 auto}.code-snippet[data-v-f11de264]{flex-direction:column;width:100%;display:flex}.property-rule[data-v-e22666da] .composition-panel>.schema-card>.schema-properties>ul>li.property.property--tree-container{padding-top:0!important}.property-heading:empty+.property-description[data-v-1b21ab2e]:last-of-type,.property-description[data-v-1b21ab2e]:first-of-type:last-of-type{margin-top:0}.property-list[data-v-1b21ab2e]{border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius);margin-top:10px}.property-list .property[data-v-1b21ab2e]:last-of-type{padding-bottom:10px}.enum-toggle-button[data-v-1b21ab2e]:hover{color:var(--scalar-color-1)}.badge.text-orange[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-orange), transparent 90%);border:#0000}.badge.text-yellow[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-yellow), transparent 90%);border:#0000}.badge.text-red[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-red), transparent 90%);border:#0000}.badge.text-purple[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-purple), transparent 90%);border:#0000}.badge.text-green[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-green), transparent 90%);border:#0000}.property-default[data-v-46973243]{font-size:var(--scalar-mini);flex-direction:column;display:flex;position:relative}.property-default[data-v-46973243]:hover:before{content:"";border-radius:var(--scalar-radius);width:100%;height:20px;position:absolute;top:0;left:0}.property-default:hover .property-default-label span[data-v-46973243]{color:var(--scalar-color-1)}.property-default-label span[data-v-46973243]{color:var(--scalar-color-2);border-bottom:var(--scalar-border-width) dotted currentColor;position:relative}.property-default-value[data-v-46973243]{font-family:var(--scalar-font-code);align-items:center;gap:8px;width:100%;padding:6px;display:flex}.property-default-value span[data-v-46973243]{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.property-default-value[data-v-46973243] svg{color:var(--scalar-color-3)}.property-default-value[data-v-46973243]:hover svg{color:var(--scalar-color-1)}.property-default-value[data-v-46973243]{background:var(--scalar-background-2);border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius)}.property-default-value-list[data-v-46973243]{background-color:var(--scalar-background-1);box-shadow:var(--scalar-shadow-1);border-radius:var(--scalar-radius-lg);border:var(--scalar-border-width) solid var(--scalar-border-color);z-index:2;flex-direction:column;gap:3px;min-width:200px;max-width:300px;padding:9px;display:none;position:absolute;top:18px;left:50%;overflow:auto;transform:translate(-50%)}.property-default:hover .property-default-value-list[data-v-46973243]{display:flex}.property-detail[data-v-8b57daa7]{display:inline-flex}.property-detail+.property-detail[data-v-8b57daa7]:before{content:"·";margin:0 .5ch;display:block}.property-detail-truncate[data-v-8b57daa7]{overflow:hidden}.property-detail-truncate>.property-detail-value[data-v-8b57daa7]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.property-detail-prefix[data-v-8b57daa7]{color:var(--scalar-color-2)}code.property-detail-value[data-v-8b57daa7]{font-family:var(--scalar-font-code);font-size:var(--scalar-font-size-3);color:var(--scalar-color-2);background:color-mix(in srgb, var(--scalar-background-2), var(--scalar-background-1));border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius);padding:0 4px}.property-example[data-v-72248a2e]{font-size:var(--scalar-mini);flex-direction:column;display:flex;position:relative}.property-example[data-v-72248a2e]:hover:before{pointer-events:none;content:"";border-radius:var(--scalar-radius);width:100%;height:20px;position:absolute;top:0;left:0}.property-example-value[data-v-72248a2e]{font-family:var(--scalar-font-code);align-items:center;gap:8px;width:100%;padding:6px;display:flex}.property-example-value span[data-v-72248a2e]{text-overflow:ellipsis;white-space:pre;display:block;overflow:hidden}.property-example-value[data-v-72248a2e] svg{color:var(--scalar-color-3)}.property-example-value[data-v-72248a2e]:hover svg{color:var(--scalar-color-1)}.property-example-value[data-v-72248a2e]{background:var(--scalar-background-2);border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius)}.property-example-value-list[data-v-72248a2e]{background-color:var(--scalar-background-1);box-shadow:var(--scalar-shadow-1);border-radius:var(--scalar-radius-lg);border:var(--scalar-border-width) solid var(--scalar-border-color);z-index:1000;flex-direction:column;gap:3px;min-width:200px;max-width:300px;padding:9px;display:none;position:absolute;top:18px;left:50%;overflow:auto;transform:translate(-50%)}.property-example-value-list-start[data-v-72248a2e]{left:0;transform:none}.property-example:hover .property-example-value-list[data-v-72248a2e]{display:flex}.property-pattern[data-v-e8f7b07b]{font-size:var(--scalar-mini);flex-direction:column;display:flex;position:relative}.property-pattern[data-v-e8f7b07b]:hover:before{content:"";border-radius:var(--scalar-radius);width:100%;height:20px;position:absolute;top:0;left:0}.property-pattern-popup[data-v-e8f7b07b]{background-color:var(--scalar-background-1);box-shadow:var(--scalar-shadow-1);border-radius:var(--scalar-radius-lg);border:var(--scalar-border-width) solid var(--scalar-border-color);z-index:1000;min-width:200px;max-width:min(500px,100vw - 32px);max-height:min(400px,100vh - 32px);padding:9px;display:none;position:absolute;top:18px;left:50%;overflow-y:auto;transform:translate(-50%)}.property-pattern:hover .property-pattern-popup[data-v-e8f7b07b],.property-pattern:focus-within .property-pattern-popup[data-v-e8f7b07b],.property-pattern.is-open .property-pattern-popup[data-v-e8f7b07b]{display:flex}.property-pattern-value[data-v-e8f7b07b]{font-family:var(--scalar-font-code);background:var(--scalar-background-2);border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius);align-items:flex-start;gap:8px;width:100%;padding:6px;display:flex}.property-pattern-value code[data-v-e8f7b07b]{font-family:var(--scalar-font-code);font-size:var(--scalar-font-size-3);color:var(--scalar-color-2);white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;text-align:left;flex:1}.property-heading[data-v-09888606]{white-space:nowrap;flex-wrap:wrap;align-items:baseline;row-gap:9px;display:flex}:is(.property-heading[data-v-09888606]:has(+.children),.property-heading[data-v-09888606]:has(+.property-rule)){margin-bottom:9px}.property-heading[data-v-09888606]>*{margin-right:9px}.property-heading[data-v-09888606]:last-child{margin-right:0}.property-name[data-v-09888606]{max-width:100%;font-family:var(--scalar-font-code);font-weight:var(--scalar-bold);font-size:var(--scalar-font-size-4);white-space:normal;overflow-wrap:break-word}.property-additional[data-v-09888606]{font-family:var(--scalar-font-code)}.property-required[data-v-09888606],.property-optional[data-v-09888606]{color:var(--scalar-color-2)}.property-required[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-orange)}.light-mode .property-required[data-v-09888606]{color:color-mix(in srgb, var(--scalar-color-orange), var(--scalar-color-1) 32%)}.property-read-only[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-blue)}.property-write-only[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-green)}.property-discriminator[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-purple)}.property-detail[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-2);align-items:center;min-width:0;display:flex}.property-const[data-v-09888606]{color:var(--scalar-color-1)}.deprecated[data-v-09888606]{text-decoration:line-through}.property[data-v-00f22f7c]{color:var(--scalar-color-1);font-size:var(--scalar-small);flex-direction:column;padding:10px;display:flex;position:relative}.property[data-v-00f22f7c]:has(>.property-rule:first-of-type):not(.property--compact){padding-top:8px;padding-bottom:8px}.property--deprecated[data-v-00f22f7c]{background:repeating-linear-gradient(-45deg, var(--scalar-background-2) 0, var(--scalar-background-2) 2px, transparent 2px, transparent 5px);background-size:100%}.property-description[data-v-00f22f7c]{line-height:1.4;font-size:var(--scalar-small);margin-top:6px}.property-description[data-v-00f22f7c]:has(+.property-rule){margin-bottom:9px}[data-v-00f22f7c] .property-description *{color:var(--scalar-color-2)!important}.property[data-v-00f22f7c]:not(:last-of-type){border-bottom:var(--scalar-border-width) solid var(--scalar-border-color)}.property-description+.children[data-v-00f22f7c],.children+.property-rule[data-v-00f22f7c]{margin-top:9px}.children[data-v-00f22f7c]{flex-direction:column;display:flex}.children .property--compact.property--level-1[data-v-00f22f7c]{padding:12px}.property-example-value[data-v-00f22f7c]{all:unset;font-family:var(--scalar-font-code);border-top:var(--scalar-border-width) solid var(--scalar-border-color);padding:6px}.property-rule[data-v-00f22f7c]{border-radius:var(--scalar-radius-lg);flex-direction:column;display:flex}.property-example[data-v-00f22f7c]{background:0 0;border:none;flex-direction:row;gap:8px;display:flex}.property-example-label[data-v-00f22f7c],.property-example-value[data-v-00f22f7c]{padding:3px 0 0}.property-example-value[data-v-00f22f7c]{background:var(--scalar-background-2);border-radius:var(--scalar-radius);border-top:0;padding:3px 4px}.property-name[data-v-00f22f7c]{font-family:var(--scalar-font-code);font-weight:var(--scalar-semibold)}.property-name-additional-properties[data-v-00f22f7c]:before,.property-name-pattern-properties[data-v-00f22f7c]:before{text-transform:uppercase;font-size:var(--scalar-micro);border-radius:var(--scalar-radius);color:var(--scalar-color-1);border:var(--scalar-border-width) solid var(--scalar-border-color);background-color:var(--scalar-background-2);margin-right:4px;padding:2px 4px;display:inline-block}.property-name-pattern-properties[data-v-00f22f7c]:before{content:"regex"}.property-name-additional-properties[data-v-00f22f7c],.property-name-pattern-properties[data-v-00f22f7c]{border:1px dashed var(--scalar-border-color);color:var(--scalar-color-accent);border-radius:var(--scalar-radius);padding:2px;display:inline-block}.error[data-v-86862f28]{background-color:var(--scalar-color-red)}.schema-card[data-v-86862f28]{font-size:var(--scalar-font-size-4);color:var(--scalar-color-1)}.schema-card-title[data-v-86862f28]{height:var(--schema-title-height);color:var(--scalar-color-2);font-weight:var(--scalar-semibold);font-size:var(--scalar-mini);border-bottom:var(--scalar-border-width) solid transparent;align-items:center;gap:4px;padding:6px 8px;display:flex}button.schema-card-title[data-v-86862f28]{cursor:pointer}button.schema-card-title[data-v-86862f28]:hover{color:var(--scalar-color-1)}.schema-properties-open>.schema-card-title[data-v-86862f28]{border-bottom:var(--scalar-border-width) solid var(--scalar-border-color);border-bottom-right-radius:0;border-bottom-left-radius:0}.schema-properties-open>.schema-properties[data-v-86862f28]{width:fit-content}.schema-card-description[data-v-86862f28]{color:var(--scalar-color-2)}.schema-card-description+.schema-properties[data-v-86862f28]{width:fit-content;margin-top:8px}.schema-card--level-0:first-of-type>.schema-card-description[data-v-86862f28]:has(+.schema-properties){border-bottom:var(--scalar-border-width) solid var(--scalar-border-color);margin-bottom:-8px;padding-bottom:8px}.schema-card--level-0~.schema-card--level-0>.schema-card-description[data-v-86862f28]:has(+.schema-properties){padding-top:8px}.schema-properties-open.schema-properties[data-v-86862f28],.schema-properties-open>.schema-card--open[data-v-86862f28]{width:100%}.schema-properties[data-v-86862f28]{border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius-lg);flex-direction:column;width:fit-content;display:flex}.schema-properties-name[data-v-86862f28]{width:100%}.schema-properties .schema-properties[data-v-86862f28]{border-radius:13.5px}.schema-properties .schema-properties.schema-properties-open[data-v-86862f28]{border-radius:var(--scalar-radius-lg)}.schema-properties-open[data-v-86862f28]{width:100%}.schema-card--compact[data-v-86862f28]{align-self:flex-start}.schema-card--compact.schema-card--open[data-v-86862f28]{align-self:initial}.schema-card-title--compact[data-v-86862f28]{color:var(--scalar-color-2);border-bottom:none;height:auto;padding:6px 10px 6px 8px}.schema-properties-open>.schema-card-title--compact[data-v-86862f28]{position:static}.property--level-0>.schema-properties>.schema-card--level-0>.schema-properties[data-v-86862f28]{border:none}.property--level-0 .schema-card--level-0:not(.schema-card--compact) .property--level-1[data-v-86862f28]{padding:0 0 8px}:not(.composition-panel)>.schema-card--compact.schema-card--level-0>.schema-properties[data-v-86862f28]{border:none}[data-v-86862f28] .schema-card-description p{font-size:var(--scalar-small,var(--scalar-paragraph));color:var(--scalar-color-2);margin-bottom:6px;display:block}.children .schema-card-description[data-v-86862f28]:first-of-type{padding-top:0}.schema-type-icon[data-v-39d4fd7f]{color:var(--scalar-color-1);display:none}.schema-type[data-v-39d4fd7f]{font-family:var(--scalar-font-code);color:var(--scalar-color-1)}
|
|
5229
5229
|
/*$vite$:1*/
|
package/dist/vue-styles.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.request-card[data-v-aaf1efda],.request-card[data-v-5057e16b]{color:var(--scalar-color-1);font-size:var(--scalar-font-size-3)}.request-method[data-v-5057e16b]{font-family:var(--scalar-font-code);margin-right:6px}.request-card-footer[data-v-5057e16b]{flex-shrink:0;justify-content:flex-end;padding:6px;display:flex;position:relative}.request-card-footer--wraps[data-v-5057e16b]{flex-wrap:wrap;row-gap:4px}.request-card-footer-start[data-v-5057e16b]{flex:1 0 auto;align-items:center;display:flex}.request-card-footer-addon[data-v-5057e16b]{flex:7em;align-items:center;min-width:0;max-width:max-content;margin-inline-end:auto;display:flex}.request-editor-section[data-v-5057e16b]{flex:1;display:flex}.code-snippet>.scalar-code-copy[data-v-5057e16b]{background:var(--scalar-card-surface-raised,var(--scalar-background-2))}.request-card-simple[data-v-5057e16b]{font-size:var(--scalar-small);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;padding:8px 8px 8px 12px;display:flex}.request-header[data-v-5057e16b]{overflow-wrap:anywhere;flex:999 auto;min-width:0}.request-card-actions[data-v-5057e16b]{flex:1 0 auto}.code-snippet[data-v-5057e16b]{flex-direction:column;width:100%;display:flex}.property-rule[data-v-e22666da] .composition-panel>.schema-card>.schema-properties>ul>li.property.property--tree-container{padding-top:0!important}.property-heading:empty+.property-description[data-v-1b21ab2e]:last-of-type,.property-description[data-v-1b21ab2e]:first-of-type:last-of-type{margin-top:0}.property-list[data-v-1b21ab2e]{border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius);margin-top:10px}.property-list .property[data-v-1b21ab2e]:last-of-type{padding-bottom:10px}.enum-toggle-button[data-v-1b21ab2e]:hover{color:var(--scalar-color-1)}.badge.text-orange[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-orange), transparent 90%);border:#0000}.badge.text-yellow[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-yellow), transparent 90%);border:#0000}.badge.text-red[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-red), transparent 90%);border:#0000}.badge.text-purple[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-purple), transparent 90%);border:#0000}.badge.text-green[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-green), transparent 90%);border:#0000}.property-default[data-v-46973243]{font-size:var(--scalar-mini);flex-direction:column;display:flex;position:relative}.property-default[data-v-46973243]:hover:before{content:"";border-radius:var(--scalar-radius);width:100%;height:20px;position:absolute;top:0;left:0}.property-default:hover .property-default-label span[data-v-46973243]{color:var(--scalar-color-1)}.property-default-label span[data-v-46973243]{color:var(--scalar-color-2);border-bottom:var(--scalar-border-width) dotted currentColor;position:relative}.property-default-value[data-v-46973243]{font-family:var(--scalar-font-code);align-items:center;gap:8px;width:100%;padding:6px;display:flex}.property-default-value span[data-v-46973243]{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.property-default-value[data-v-46973243] svg{color:var(--scalar-color-3)}.property-default-value[data-v-46973243]:hover svg{color:var(--scalar-color-1)}.property-default-value[data-v-46973243]{background:var(--scalar-background-2);border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius)}.property-default-value-list[data-v-46973243]{background-color:var(--scalar-background-1);box-shadow:var(--scalar-shadow-1);border-radius:var(--scalar-radius-lg);border:var(--scalar-border-width) solid var(--scalar-border-color);z-index:2;flex-direction:column;gap:3px;min-width:200px;max-width:300px;padding:9px;display:none;position:absolute;top:18px;left:50%;overflow:auto;transform:translate(-50%)}.property-default:hover .property-default-value-list[data-v-46973243]{display:flex}.property-detail[data-v-8b57daa7]{display:inline-flex}.property-detail+.property-detail[data-v-8b57daa7]:before{content:"·";margin:0 .5ch;display:block}.property-detail-truncate[data-v-8b57daa7]{overflow:hidden}.property-detail-truncate>.property-detail-value[data-v-8b57daa7]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.property-detail-prefix[data-v-8b57daa7]{color:var(--scalar-color-2)}code.property-detail-value[data-v-8b57daa7]{font-family:var(--scalar-font-code);font-size:var(--scalar-font-size-3);color:var(--scalar-color-2);background:color-mix(in srgb, var(--scalar-background-2), var(--scalar-background-1));border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius);padding:0 4px}.property-example[data-v-72248a2e]{font-size:var(--scalar-mini);flex-direction:column;display:flex;position:relative}.property-example[data-v-72248a2e]:hover:before{pointer-events:none;content:"";border-radius:var(--scalar-radius);width:100%;height:20px;position:absolute;top:0;left:0}.property-example-value[data-v-72248a2e]{font-family:var(--scalar-font-code);align-items:center;gap:8px;width:100%;padding:6px;display:flex}.property-example-value span[data-v-72248a2e]{text-overflow:ellipsis;white-space:pre;display:block;overflow:hidden}.property-example-value[data-v-72248a2e] svg{color:var(--scalar-color-3)}.property-example-value[data-v-72248a2e]:hover svg{color:var(--scalar-color-1)}.property-example-value[data-v-72248a2e]{background:var(--scalar-background-2);border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius)}.property-example-value-list[data-v-72248a2e]{background-color:var(--scalar-background-1);box-shadow:var(--scalar-shadow-1);border-radius:var(--scalar-radius-lg);border:var(--scalar-border-width) solid var(--scalar-border-color);z-index:1000;flex-direction:column;gap:3px;min-width:200px;max-width:300px;padding:9px;display:none;position:absolute;top:18px;left:50%;overflow:auto;transform:translate(-50%)}.property-example-value-list-start[data-v-72248a2e]{left:0;transform:none}.property-example:hover .property-example-value-list[data-v-72248a2e]{display:flex}.property-pattern[data-v-e8f7b07b]{font-size:var(--scalar-mini);flex-direction:column;display:flex;position:relative}.property-pattern[data-v-e8f7b07b]:hover:before{content:"";border-radius:var(--scalar-radius);width:100%;height:20px;position:absolute;top:0;left:0}.property-pattern-popup[data-v-e8f7b07b]{background-color:var(--scalar-background-1);box-shadow:var(--scalar-shadow-1);border-radius:var(--scalar-radius-lg);border:var(--scalar-border-width) solid var(--scalar-border-color);z-index:1000;min-width:200px;max-width:min(500px,100vw - 32px);max-height:min(400px,100vh - 32px);padding:9px;display:none;position:absolute;top:18px;left:50%;overflow-y:auto;transform:translate(-50%)}.property-pattern:hover .property-pattern-popup[data-v-e8f7b07b],.property-pattern:focus-within .property-pattern-popup[data-v-e8f7b07b],.property-pattern.is-open .property-pattern-popup[data-v-e8f7b07b]{display:flex}.property-pattern-value[data-v-e8f7b07b]{font-family:var(--scalar-font-code);background:var(--scalar-background-2);border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius);align-items:flex-start;gap:8px;width:100%;padding:6px;display:flex}.property-pattern-value code[data-v-e8f7b07b]{font-family:var(--scalar-font-code);font-size:var(--scalar-font-size-3);color:var(--scalar-color-2);white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;text-align:left;flex:1}.property-heading[data-v-09888606]{white-space:nowrap;flex-wrap:wrap;align-items:baseline;row-gap:9px;display:flex}:is(.property-heading[data-v-09888606]:has(+.children),.property-heading[data-v-09888606]:has(+.property-rule)){margin-bottom:9px}.property-heading[data-v-09888606]>*{margin-right:9px}.property-heading[data-v-09888606]:last-child{margin-right:0}.property-name[data-v-09888606]{max-width:100%;font-family:var(--scalar-font-code);font-weight:var(--scalar-bold);font-size:var(--scalar-font-size-4);white-space:normal;overflow-wrap:break-word}.property-additional[data-v-09888606]{font-family:var(--scalar-font-code)}.property-required[data-v-09888606],.property-optional[data-v-09888606]{color:var(--scalar-color-2)}.property-required[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-orange)}.light-mode .property-required[data-v-09888606]{color:color-mix(in srgb, var(--scalar-color-orange), var(--scalar-color-1) 32%)}.property-read-only[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-blue)}.property-write-only[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-green)}.property-discriminator[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-purple)}.property-detail[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-2);align-items:center;min-width:0;display:flex}.property-const[data-v-09888606]{color:var(--scalar-color-1)}.deprecated[data-v-09888606]{text-decoration:line-through}.property[data-v-00f22f7c]{color:var(--scalar-color-1);font-size:var(--scalar-small);flex-direction:column;padding:10px;display:flex;position:relative}.property[data-v-00f22f7c]:has(>.property-rule:first-of-type):not(.property--compact){padding-top:8px;padding-bottom:8px}.property--deprecated[data-v-00f22f7c]{background:repeating-linear-gradient(-45deg, var(--scalar-background-2) 0, var(--scalar-background-2) 2px, transparent 2px, transparent 5px);background-size:100%}.property-description[data-v-00f22f7c]{line-height:1.4;font-size:var(--scalar-small);margin-top:6px}.property-description[data-v-00f22f7c]:has(+.property-rule){margin-bottom:9px}[data-v-00f22f7c] .property-description *{color:var(--scalar-color-2)!important}.property[data-v-00f22f7c]:not(:last-of-type){border-bottom:var(--scalar-border-width) solid var(--scalar-border-color)}.property-description+.children[data-v-00f22f7c],.children+.property-rule[data-v-00f22f7c]{margin-top:9px}.children[data-v-00f22f7c]{flex-direction:column;display:flex}.children .property--compact.property--level-1[data-v-00f22f7c]{padding:12px}.property-example-value[data-v-00f22f7c]{all:unset;font-family:var(--scalar-font-code);border-top:var(--scalar-border-width) solid var(--scalar-border-color);padding:6px}.property-rule[data-v-00f22f7c]{border-radius:var(--scalar-radius-lg);flex-direction:column;display:flex}.property-example[data-v-00f22f7c]{background:0 0;border:none;flex-direction:row;gap:8px;display:flex}.property-example-label[data-v-00f22f7c],.property-example-value[data-v-00f22f7c]{padding:3px 0 0}.property-example-value[data-v-00f22f7c]{background:var(--scalar-background-2);border-radius:var(--scalar-radius);border-top:0;padding:3px 4px}.property-name[data-v-00f22f7c]{font-family:var(--scalar-font-code);font-weight:var(--scalar-semibold)}.property-name-additional-properties[data-v-00f22f7c]:before,.property-name-pattern-properties[data-v-00f22f7c]:before{text-transform:uppercase;font-size:var(--scalar-micro);border-radius:var(--scalar-radius);color:var(--scalar-color-1);border:var(--scalar-border-width) solid var(--scalar-border-color);background-color:var(--scalar-background-2);margin-right:4px;padding:2px 4px;display:inline-block}.property-name-pattern-properties[data-v-00f22f7c]:before{content:"regex"}.property-name-additional-properties[data-v-00f22f7c],.property-name-pattern-properties[data-v-00f22f7c]{border:1px dashed var(--scalar-border-color);color:var(--scalar-color-accent);border-radius:var(--scalar-radius);padding:2px;display:inline-block}.error[data-v-86862f28]{background-color:var(--scalar-color-red)}.schema-card[data-v-86862f28]{font-size:var(--scalar-font-size-4);color:var(--scalar-color-1)}.schema-card-title[data-v-86862f28]{height:var(--schema-title-height);color:var(--scalar-color-2);font-weight:var(--scalar-semibold);font-size:var(--scalar-mini);border-bottom:var(--scalar-border-width) solid transparent;align-items:center;gap:4px;padding:6px 8px;display:flex}button.schema-card-title[data-v-86862f28]{cursor:pointer}button.schema-card-title[data-v-86862f28]:hover{color:var(--scalar-color-1)}.schema-properties-open>.schema-card-title[data-v-86862f28]{border-bottom:var(--scalar-border-width) solid var(--scalar-border-color);border-bottom-right-radius:0;border-bottom-left-radius:0}.schema-properties-open>.schema-properties[data-v-86862f28]{width:fit-content}.schema-card-description[data-v-86862f28]{color:var(--scalar-color-2)}.schema-card-description+.schema-properties[data-v-86862f28]{width:fit-content;margin-top:8px}.schema-card--level-0:first-of-type>.schema-card-description[data-v-86862f28]:has(+.schema-properties){border-bottom:var(--scalar-border-width) solid var(--scalar-border-color);margin-bottom:-8px;padding-bottom:8px}.schema-card--level-0~.schema-card--level-0>.schema-card-description[data-v-86862f28]:has(+.schema-properties){padding-top:8px}.schema-properties-open.schema-properties[data-v-86862f28],.schema-properties-open>.schema-card--open[data-v-86862f28]{width:100%}.schema-properties[data-v-86862f28]{border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius-lg);flex-direction:column;width:fit-content;display:flex}.schema-properties-name[data-v-86862f28]{width:100%}.schema-properties .schema-properties[data-v-86862f28]{border-radius:13.5px}.schema-properties .schema-properties.schema-properties-open[data-v-86862f28]{border-radius:var(--scalar-radius-lg)}.schema-properties-open[data-v-86862f28]{width:100%}.schema-card--compact[data-v-86862f28]{align-self:flex-start}.schema-card--compact.schema-card--open[data-v-86862f28]{align-self:initial}.schema-card-title--compact[data-v-86862f28]{color:var(--scalar-color-2);border-bottom:none;height:auto;padding:6px 10px 6px 8px}.schema-properties-open>.schema-card-title--compact[data-v-86862f28]{position:static}.property--level-0>.schema-properties>.schema-card--level-0>.schema-properties[data-v-86862f28]{border:none}.property--level-0 .schema-card--level-0:not(.schema-card--compact) .property--level-1[data-v-86862f28]{padding:0 0 8px}:not(.composition-panel)>.schema-card--compact.schema-card--level-0>.schema-properties[data-v-86862f28]{border:none}[data-v-86862f28] .schema-card-description p{font-size:var(--scalar-small,var(--scalar-paragraph));color:var(--scalar-color-2);margin-bottom:6px;display:block}.children .schema-card-description[data-v-86862f28]:first-of-type{padding-top:0}.schema-type-icon[data-v-39d4fd7f]{color:var(--scalar-color-1);display:none}.schema-type[data-v-39d4fd7f]{font-family:var(--scalar-font-code);color:var(--scalar-color-1)}
|
|
1
|
+
.request-card[data-v-aaf1efda],.request-card[data-v-f11de264]{color:var(--scalar-color-1);font-size:var(--scalar-font-size-3)}.request-method[data-v-f11de264]{font-family:var(--scalar-font-code);margin-right:6px}.request-card-footer[data-v-f11de264]{flex-shrink:0;justify-content:flex-end;padding:6px;display:flex;position:relative}.request-card-footer--wraps[data-v-f11de264]{flex-wrap:wrap;row-gap:4px}.request-card-footer-start[data-v-f11de264]{flex:1 0 auto;align-items:center;display:flex}.request-card-footer-addon[data-v-f11de264]{flex:7em;align-items:center;min-width:0;max-width:max-content;margin-inline-end:auto;display:flex}.request-editor-section[data-v-f11de264]{flex:1;display:flex}.code-snippet>.scalar-code-copy[data-v-f11de264]{background:var(--scalar-card-surface-raised,var(--scalar-background-2))}.request-card-simple[data-v-f11de264]{font-size:var(--scalar-small);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;padding:8px 8px 8px 12px;display:flex}.request-header[data-v-f11de264]{overflow-wrap:anywhere;flex:999 auto;min-width:0}.request-card-actions[data-v-f11de264]{flex:1 0 auto}.code-snippet[data-v-f11de264]{flex-direction:column;width:100%;display:flex}.property-rule[data-v-e22666da] .composition-panel>.schema-card>.schema-properties>ul>li.property.property--tree-container{padding-top:0!important}.property-heading:empty+.property-description[data-v-1b21ab2e]:last-of-type,.property-description[data-v-1b21ab2e]:first-of-type:last-of-type{margin-top:0}.property-list[data-v-1b21ab2e]{border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius);margin-top:10px}.property-list .property[data-v-1b21ab2e]:last-of-type{padding-bottom:10px}.enum-toggle-button[data-v-1b21ab2e]:hover{color:var(--scalar-color-1)}.badge.text-orange[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-orange), transparent 90%);border:#0000}.badge.text-yellow[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-yellow), transparent 90%);border:#0000}.badge.text-red[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-red), transparent 90%);border:#0000}.badge.text-purple[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-purple), transparent 90%);border:#0000}.badge.text-green[data-v-7a577ad4]{background:color-mix(in srgb, var(--scalar-color-green), transparent 90%);border:#0000}.property-default[data-v-46973243]{font-size:var(--scalar-mini);flex-direction:column;display:flex;position:relative}.property-default[data-v-46973243]:hover:before{content:"";border-radius:var(--scalar-radius);width:100%;height:20px;position:absolute;top:0;left:0}.property-default:hover .property-default-label span[data-v-46973243]{color:var(--scalar-color-1)}.property-default-label span[data-v-46973243]{color:var(--scalar-color-2);border-bottom:var(--scalar-border-width) dotted currentColor;position:relative}.property-default-value[data-v-46973243]{font-family:var(--scalar-font-code);align-items:center;gap:8px;width:100%;padding:6px;display:flex}.property-default-value span[data-v-46973243]{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.property-default-value[data-v-46973243] svg{color:var(--scalar-color-3)}.property-default-value[data-v-46973243]:hover svg{color:var(--scalar-color-1)}.property-default-value[data-v-46973243]{background:var(--scalar-background-2);border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius)}.property-default-value-list[data-v-46973243]{background-color:var(--scalar-background-1);box-shadow:var(--scalar-shadow-1);border-radius:var(--scalar-radius-lg);border:var(--scalar-border-width) solid var(--scalar-border-color);z-index:2;flex-direction:column;gap:3px;min-width:200px;max-width:300px;padding:9px;display:none;position:absolute;top:18px;left:50%;overflow:auto;transform:translate(-50%)}.property-default:hover .property-default-value-list[data-v-46973243]{display:flex}.property-detail[data-v-8b57daa7]{display:inline-flex}.property-detail+.property-detail[data-v-8b57daa7]:before{content:"·";margin:0 .5ch;display:block}.property-detail-truncate[data-v-8b57daa7]{overflow:hidden}.property-detail-truncate>.property-detail-value[data-v-8b57daa7]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.property-detail-prefix[data-v-8b57daa7]{color:var(--scalar-color-2)}code.property-detail-value[data-v-8b57daa7]{font-family:var(--scalar-font-code);font-size:var(--scalar-font-size-3);color:var(--scalar-color-2);background:color-mix(in srgb, var(--scalar-background-2), var(--scalar-background-1));border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius);padding:0 4px}.property-example[data-v-72248a2e]{font-size:var(--scalar-mini);flex-direction:column;display:flex;position:relative}.property-example[data-v-72248a2e]:hover:before{pointer-events:none;content:"";border-radius:var(--scalar-radius);width:100%;height:20px;position:absolute;top:0;left:0}.property-example-value[data-v-72248a2e]{font-family:var(--scalar-font-code);align-items:center;gap:8px;width:100%;padding:6px;display:flex}.property-example-value span[data-v-72248a2e]{text-overflow:ellipsis;white-space:pre;display:block;overflow:hidden}.property-example-value[data-v-72248a2e] svg{color:var(--scalar-color-3)}.property-example-value[data-v-72248a2e]:hover svg{color:var(--scalar-color-1)}.property-example-value[data-v-72248a2e]{background:var(--scalar-background-2);border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius)}.property-example-value-list[data-v-72248a2e]{background-color:var(--scalar-background-1);box-shadow:var(--scalar-shadow-1);border-radius:var(--scalar-radius-lg);border:var(--scalar-border-width) solid var(--scalar-border-color);z-index:1000;flex-direction:column;gap:3px;min-width:200px;max-width:300px;padding:9px;display:none;position:absolute;top:18px;left:50%;overflow:auto;transform:translate(-50%)}.property-example-value-list-start[data-v-72248a2e]{left:0;transform:none}.property-example:hover .property-example-value-list[data-v-72248a2e]{display:flex}.property-pattern[data-v-e8f7b07b]{font-size:var(--scalar-mini);flex-direction:column;display:flex;position:relative}.property-pattern[data-v-e8f7b07b]:hover:before{content:"";border-radius:var(--scalar-radius);width:100%;height:20px;position:absolute;top:0;left:0}.property-pattern-popup[data-v-e8f7b07b]{background-color:var(--scalar-background-1);box-shadow:var(--scalar-shadow-1);border-radius:var(--scalar-radius-lg);border:var(--scalar-border-width) solid var(--scalar-border-color);z-index:1000;min-width:200px;max-width:min(500px,100vw - 32px);max-height:min(400px,100vh - 32px);padding:9px;display:none;position:absolute;top:18px;left:50%;overflow-y:auto;transform:translate(-50%)}.property-pattern:hover .property-pattern-popup[data-v-e8f7b07b],.property-pattern:focus-within .property-pattern-popup[data-v-e8f7b07b],.property-pattern.is-open .property-pattern-popup[data-v-e8f7b07b]{display:flex}.property-pattern-value[data-v-e8f7b07b]{font-family:var(--scalar-font-code);background:var(--scalar-background-2);border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius);align-items:flex-start;gap:8px;width:100%;padding:6px;display:flex}.property-pattern-value code[data-v-e8f7b07b]{font-family:var(--scalar-font-code);font-size:var(--scalar-font-size-3);color:var(--scalar-color-2);white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;text-align:left;flex:1}.property-heading[data-v-09888606]{white-space:nowrap;flex-wrap:wrap;align-items:baseline;row-gap:9px;display:flex}:is(.property-heading[data-v-09888606]:has(+.children),.property-heading[data-v-09888606]:has(+.property-rule)){margin-bottom:9px}.property-heading[data-v-09888606]>*{margin-right:9px}.property-heading[data-v-09888606]:last-child{margin-right:0}.property-name[data-v-09888606]{max-width:100%;font-family:var(--scalar-font-code);font-weight:var(--scalar-bold);font-size:var(--scalar-font-size-4);white-space:normal;overflow-wrap:break-word}.property-additional[data-v-09888606]{font-family:var(--scalar-font-code)}.property-required[data-v-09888606],.property-optional[data-v-09888606]{color:var(--scalar-color-2)}.property-required[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-orange)}.light-mode .property-required[data-v-09888606]{color:color-mix(in srgb, var(--scalar-color-orange), var(--scalar-color-1) 32%)}.property-read-only[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-blue)}.property-write-only[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-green)}.property-discriminator[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-purple)}.property-detail[data-v-09888606]{font-size:var(--scalar-mini);color:var(--scalar-color-2);align-items:center;min-width:0;display:flex}.property-const[data-v-09888606]{color:var(--scalar-color-1)}.deprecated[data-v-09888606]{text-decoration:line-through}.property[data-v-00f22f7c]{color:var(--scalar-color-1);font-size:var(--scalar-small);flex-direction:column;padding:10px;display:flex;position:relative}.property[data-v-00f22f7c]:has(>.property-rule:first-of-type):not(.property--compact){padding-top:8px;padding-bottom:8px}.property--deprecated[data-v-00f22f7c]{background:repeating-linear-gradient(-45deg, var(--scalar-background-2) 0, var(--scalar-background-2) 2px, transparent 2px, transparent 5px);background-size:100%}.property-description[data-v-00f22f7c]{line-height:1.4;font-size:var(--scalar-small);margin-top:6px}.property-description[data-v-00f22f7c]:has(+.property-rule){margin-bottom:9px}[data-v-00f22f7c] .property-description *{color:var(--scalar-color-2)!important}.property[data-v-00f22f7c]:not(:last-of-type){border-bottom:var(--scalar-border-width) solid var(--scalar-border-color)}.property-description+.children[data-v-00f22f7c],.children+.property-rule[data-v-00f22f7c]{margin-top:9px}.children[data-v-00f22f7c]{flex-direction:column;display:flex}.children .property--compact.property--level-1[data-v-00f22f7c]{padding:12px}.property-example-value[data-v-00f22f7c]{all:unset;font-family:var(--scalar-font-code);border-top:var(--scalar-border-width) solid var(--scalar-border-color);padding:6px}.property-rule[data-v-00f22f7c]{border-radius:var(--scalar-radius-lg);flex-direction:column;display:flex}.property-example[data-v-00f22f7c]{background:0 0;border:none;flex-direction:row;gap:8px;display:flex}.property-example-label[data-v-00f22f7c],.property-example-value[data-v-00f22f7c]{padding:3px 0 0}.property-example-value[data-v-00f22f7c]{background:var(--scalar-background-2);border-radius:var(--scalar-radius);border-top:0;padding:3px 4px}.property-name[data-v-00f22f7c]{font-family:var(--scalar-font-code);font-weight:var(--scalar-semibold)}.property-name-additional-properties[data-v-00f22f7c]:before,.property-name-pattern-properties[data-v-00f22f7c]:before{text-transform:uppercase;font-size:var(--scalar-micro);border-radius:var(--scalar-radius);color:var(--scalar-color-1);border:var(--scalar-border-width) solid var(--scalar-border-color);background-color:var(--scalar-background-2);margin-right:4px;padding:2px 4px;display:inline-block}.property-name-pattern-properties[data-v-00f22f7c]:before{content:"regex"}.property-name-additional-properties[data-v-00f22f7c],.property-name-pattern-properties[data-v-00f22f7c]{border:1px dashed var(--scalar-border-color);color:var(--scalar-color-accent);border-radius:var(--scalar-radius);padding:2px;display:inline-block}.error[data-v-86862f28]{background-color:var(--scalar-color-red)}.schema-card[data-v-86862f28]{font-size:var(--scalar-font-size-4);color:var(--scalar-color-1)}.schema-card-title[data-v-86862f28]{height:var(--schema-title-height);color:var(--scalar-color-2);font-weight:var(--scalar-semibold);font-size:var(--scalar-mini);border-bottom:var(--scalar-border-width) solid transparent;align-items:center;gap:4px;padding:6px 8px;display:flex}button.schema-card-title[data-v-86862f28]{cursor:pointer}button.schema-card-title[data-v-86862f28]:hover{color:var(--scalar-color-1)}.schema-properties-open>.schema-card-title[data-v-86862f28]{border-bottom:var(--scalar-border-width) solid var(--scalar-border-color);border-bottom-right-radius:0;border-bottom-left-radius:0}.schema-properties-open>.schema-properties[data-v-86862f28]{width:fit-content}.schema-card-description[data-v-86862f28]{color:var(--scalar-color-2)}.schema-card-description+.schema-properties[data-v-86862f28]{width:fit-content;margin-top:8px}.schema-card--level-0:first-of-type>.schema-card-description[data-v-86862f28]:has(+.schema-properties){border-bottom:var(--scalar-border-width) solid var(--scalar-border-color);margin-bottom:-8px;padding-bottom:8px}.schema-card--level-0~.schema-card--level-0>.schema-card-description[data-v-86862f28]:has(+.schema-properties){padding-top:8px}.schema-properties-open.schema-properties[data-v-86862f28],.schema-properties-open>.schema-card--open[data-v-86862f28]{width:100%}.schema-properties[data-v-86862f28]{border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:var(--scalar-radius-lg);flex-direction:column;width:fit-content;display:flex}.schema-properties-name[data-v-86862f28]{width:100%}.schema-properties .schema-properties[data-v-86862f28]{border-radius:13.5px}.schema-properties .schema-properties.schema-properties-open[data-v-86862f28]{border-radius:var(--scalar-radius-lg)}.schema-properties-open[data-v-86862f28]{width:100%}.schema-card--compact[data-v-86862f28]{align-self:flex-start}.schema-card--compact.schema-card--open[data-v-86862f28]{align-self:initial}.schema-card-title--compact[data-v-86862f28]{color:var(--scalar-color-2);border-bottom:none;height:auto;padding:6px 10px 6px 8px}.schema-properties-open>.schema-card-title--compact[data-v-86862f28]{position:static}.property--level-0>.schema-properties>.schema-card--level-0>.schema-properties[data-v-86862f28]{border:none}.property--level-0 .schema-card--level-0:not(.schema-card--compact) .property--level-1[data-v-86862f28]{padding:0 0 8px}:not(.composition-panel)>.schema-card--compact.schema-card--level-0>.schema-properties[data-v-86862f28]{border:none}[data-v-86862f28] .schema-card-description p{font-size:var(--scalar-small,var(--scalar-paragraph));color:var(--scalar-color-2);margin-bottom:6px;display:block}.children .schema-card-description[data-v-86862f28]:first-of-type{padding-top:0}.schema-type-icon[data-v-39d4fd7f]{color:var(--scalar-color-1);display:none}.schema-type[data-v-39d4fd7f]{font-family:var(--scalar-font-code);color:var(--scalar-color-1)}
|
|
2
2
|
/*$vite$:1*/
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"blocks",
|
|
18
18
|
"docs"
|
|
19
19
|
],
|
|
20
|
-
"version": "0.
|
|
20
|
+
"version": "0.9.0",
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=22"
|
|
23
23
|
},
|
|
@@ -62,18 +62,18 @@
|
|
|
62
62
|
"CHANGELOG.md"
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@scalar/components": "0.35.
|
|
65
|
+
"@scalar/components": "0.35.5",
|
|
66
66
|
"@scalar/helpers": "0.19.0",
|
|
67
67
|
"@scalar/icons": "0.7.11",
|
|
68
68
|
"@scalar/localization": "0.2.15",
|
|
69
|
-
"@scalar/snippetz": "0.10.
|
|
70
|
-
"@scalar/themes": "0.21.
|
|
71
|
-
"@scalar/types": "0.
|
|
69
|
+
"@scalar/snippetz": "0.10.22",
|
|
70
|
+
"@scalar/themes": "0.21.1",
|
|
71
|
+
"@scalar/types": "0.32.0",
|
|
72
72
|
"@scalar/use-hooks": "0.4.29",
|
|
73
|
-
"@scalar/workspace-store": "0.
|
|
73
|
+
"@scalar/workspace-store": "0.76.0",
|
|
74
74
|
"@types/har-format": "^1.2.16",
|
|
75
75
|
"@vueuse/core": "15.0.0",
|
|
76
|
-
"js-base64": "^3.9.
|
|
76
|
+
"js-base64": "^3.9.7",
|
|
77
77
|
"vue": "^3.5.45"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
@@ -85,11 +85,11 @@
|
|
|
85
85
|
"@tailwindcss/vite": "^4.3.5",
|
|
86
86
|
"@vitejs/plugin-vue": "^6.0.11",
|
|
87
87
|
"@vue/test-utils": "2.6.0",
|
|
88
|
-
"jsdom": "
|
|
88
|
+
"jsdom": "31.0.1",
|
|
89
89
|
"storybook": "10.6.7",
|
|
90
90
|
"tailwindcss": "^4.3.5",
|
|
91
91
|
"vite": "8.3.8",
|
|
92
|
-
"vitest": "5.1.
|
|
92
|
+
"vitest": "5.1.1",
|
|
93
93
|
"vue-router": "5.5.1",
|
|
94
94
|
"vue-tsc": "3.3.11"
|
|
95
95
|
},
|