@scalar/api-client 2.39.0 → 2.39.1

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/hooks/useClientConfig.d.ts +18 -0
  3. package/dist/hooks/useClientConfig.d.ts.map +1 -1
  4. package/dist/style.css +14 -14
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +2 -0
  6. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  7. package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
  8. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +6 -2
  9. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
  10. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts +3 -1
  11. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
  12. package/dist/v2/blocks/operation-block/helpers/build-request-body.js +2 -2
  13. package/dist/v2/blocks/operation-block/helpers/build-request-body.js.map +1 -1
  14. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +3 -1
  15. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
  16. package/dist/v2/blocks/operation-block/helpers/build-request.js +2 -2
  17. package/dist/v2/blocks/operation-block/helpers/build-request.js.map +1 -1
  18. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +5 -0
  19. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  20. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
  21. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js.map +1 -1
  22. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js +6 -3
  23. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js.map +1 -1
  24. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +3 -1
  25. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -1
  26. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js +3 -2
  27. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js.map +1 -1
  28. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts +5 -1
  29. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +1 -1
  30. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +51 -25
  31. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js.map +1 -1
  32. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +6 -1
  33. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  34. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +3 -2
  35. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js.map +1 -1
  36. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts +2 -2
  37. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
  38. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +5 -3
  39. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js.map +1 -1
  40. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +1 -0
  41. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  42. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  43. package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
  44. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +4 -1
  45. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
  46. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts +2 -0
  47. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  48. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
  49. package/dist/v2/blocks/request-block/components/RequestBody.vue.js.map +1 -1
  50. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +3 -2
  51. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
  52. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +2 -1
  53. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
  54. package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts +1 -1
  55. package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts.map +1 -1
  56. package/dist/v2/blocks/request-block/helpers/get-request-body-example.js +6 -2
  57. package/dist/v2/blocks/request-block/helpers/get-request-body-example.js.map +1 -1
  58. package/dist/v2/constants.js +1 -1
  59. package/dist/v2/features/app/helpers/routes.d.ts +2 -0
  60. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  61. package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
  62. package/dist/v2/features/collection/DocumentCollection.vue.js.map +1 -1
  63. package/dist/v2/features/collection/DocumentCollection.vue.script.js +71 -48
  64. package/dist/v2/features/collection/DocumentCollection.vue.script.js.map +1 -1
  65. package/dist/v2/features/modal/Modal.vue.d.ts +3 -1
  66. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  67. package/dist/v2/features/modal/Modal.vue.js.map +1 -1
  68. package/dist/v2/features/modal/Modal.vue.script.js +4 -0
  69. package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
  70. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
  71. package/dist/v2/features/modal/helpers/create-api-client-modal.js +3 -0
  72. package/dist/v2/features/modal/helpers/create-api-client-modal.js.map +1 -1
  73. package/dist/v2/features/modal/modal-events.d.ts +2 -1
  74. package/dist/v2/features/modal/modal-events.d.ts.map +1 -1
  75. package/dist/v2/features/modal/modal-events.js +3 -1
  76. package/dist/v2/features/modal/modal-events.js.map +1 -1
  77. package/dist/v2/features/operation/Operation.vue.d.ts +4 -0
  78. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  79. package/dist/v2/features/operation/Operation.vue.js.map +1 -1
  80. package/dist/v2/features/operation/Operation.vue.script.js +4 -1
  81. package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
  82. package/dist/v2/helpers/download-document.d.ts +2 -0
  83. package/dist/v2/helpers/download-document.d.ts.map +1 -0
  84. package/dist/v2/helpers/download-document.js +42 -0
  85. package/dist/v2/helpers/download-document.js.map +1 -0
  86. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.script.js +1 -1
  87. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"AA4OA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAO/D;;;;;;;GAOG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAEd,6CAA6C;cACnC,UAAU,CAAC,SAAS,CAAC;;IAD/B,6CAA6C;cACnC,UAAU,CAAC,SAAS,CAAC;iGAuR/B,CAAC"}
1
+ {"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"AA+OA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAO/D;;;;;;;GAOG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAEd,6CAA6C;cACnC,UAAU,CAAC,SAAS,CAAC;IAC/B,sEAAsE;sCACpC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;IAHxD,6CAA6C;cACnC,UAAU,CAAC,SAAS,CAAC;IAC/B,sEAAsE;sCACpC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;iGAyRxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.vue.js","names":[],"sources":["../../../../src/v2/features/operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Operation example page\n *\n * Displays an operation with a specific example selected\n * - View example request data\n * - Modify example request data\n * - Send example request\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type { AuthMeta, ServerMeta } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { computed, toValue } from 'vue'\n\nimport { OperationBlock } from '@/v2/blocks/operation-block'\nimport type { ExtendedScalarCookie } from '@/v2/blocks/request-block/RequestBlock.vue'\nimport { APP_VERSION } from '@/v2/constants'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { mapHiddenClientsConfig } from '@/v2/features/modal/helpers/map-hidden-clients-config'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\nimport { combineParams } from '@/v2/features/operation/helpers/combine-params'\nimport { getSelectedServer } from '@/v2/features/operation/helpers/get-selected-server'\nimport { getActiveProxyUrl } from '@/v2/helpers/get-active-proxy-url'\nimport { getServers } from '@/v2/helpers/get-servers'\n\nconst {\n document,\n layout,\n eventBus,\n path,\n method,\n environment,\n exampleName,\n options,\n securitySchemes,\n workspaceStore,\n plugins,\n documentSlug,\n} = defineProps<\n RouteProps & {\n /** Subset of config options for the modal */\n options?: ModalProps['options']\n }\n>()\n\n/** Grab the path item object from the document */\nconst pathItem = computed(() => {\n if (!path) {\n return null\n }\n return getResolvedRef(document?.paths?.[path])\n})\n\n/** Find the operation and augment with any path parameters */\nconst operation = computed(() => {\n if (!path || !method) {\n return null\n }\n\n const operation = getResolvedRef(document?.paths?.[path]?.[method])\n if (!operation) {\n return null\n }\n\n if (!pathItem.value) {\n return operation\n }\n\n // We combine any path parameters with the operation parameters\n const parameters = combineParams(\n pathItem.value.parameters,\n operation.parameters,\n )\n return { ...operation, parameters }\n})\n\n/** Combine the workspace and document cookies */\nconst globalCookies = computed(() => [\n ...((workspaceStore.workspace?.['x-scalar-cookies'] ?? []).map((it) => ({\n ...it,\n location: 'workspace',\n })) satisfies ExtendedScalarCookie[]),\n ...((document?.['x-scalar-cookies'] ?? []).map((it) => ({\n ...it,\n location: 'document',\n })) satisfies ExtendedScalarCookie[]),\n])\n\n/** Compute the servers for the operation */\nconst servers = computed(() => {\n /**\n * Gather all the servers from the config, operation, pathItem, and document\n */\n const _servers =\n toValue(options)?.servers ??\n operation.value?.servers ??\n // pathItem.value?.servers ?? TODO: add support for pathItem servers\n document?.servers\n\n return getServers(_servers, {\n baseServerUrl: toValue(options)?.baseServerURL,\n documentUrl: document?.['x-scalar-original-source-url'],\n })\n})\n\n/** Selected server URL from the same source as servers: operation, then document (config has no stored selection so use document selection) */\nconst selectedServerUrl = computed(() => {\n if (toValue(options)?.servers != null) {\n return document?.['x-scalar-selected-server']\n }\n if (operation.value?.servers != null) {\n return operation.value['x-scalar-selected-server']\n }\n return document?.['x-scalar-selected-server']\n})\n\n/** Selected server for the operation (document-level or operation-level servers) */\nconst selectedServer = computed(() =>\n getSelectedServer(servers.value, selectedServerUrl.value),\n)\n\nconst serverMeta = computed<ServerMeta>(() => {\n if (operation.value?.servers != null) {\n return { type: 'operation', path: path ?? '', method: method ?? 'get' }\n }\n return { type: 'document' }\n})\n\nconst documentSelectedSecurity = computed<SelectedSecurity | undefined>(() => {\n return workspaceStore.auth.getAuthSelectedSchemas({\n type: 'document',\n documentName: documentSlug,\n })\n})\n\nconst operationSelectedSecurity = computed<SelectedSecurity | undefined>(() => {\n return workspaceStore.auth.getAuthSelectedSchemas({\n type: 'operation',\n documentName: documentSlug,\n path: path ?? '',\n method: method ?? 'get',\n })\n})\n\n/** Select document vs operation meta based on the extension */\nconst authMeta = computed<AuthMeta>(() => {\n if (operationSelectedSecurity.value !== undefined) {\n return {\n type: 'operation',\n path: path ?? '',\n method: method ?? 'get',\n }\n }\n\n return { type: 'document' }\n})\n\n/** Combine environments from document and workspace into a unique array of environment names */\nconst environments = computed(() => {\n return Array.from(\n new Set(\n Object.keys({\n ...document?.['x-scalar-environments'],\n ...workspaceStore.workspace['x-scalar-environments'],\n }),\n ),\n )\n})\n\n/** Temporarily use the old config.hiddenClients until we migrate to the new httpClients config */\nconst httpClients = computed(() =>\n mapHiddenClientsConfig(toValue(options)?.hiddenClients),\n)\n</script>\n\n<template>\n <!-- Operation exists -->\n <template v-if=\"path && method && exampleName && operation\">\n <OperationBlock\n :activeEnvironment=\"\n workspaceStore.workspace['x-scalar-active-environment']\n \"\n :appVersion=\"APP_VERSION\"\n :authMeta\n :documentSecurity=\"document?.security ?? []\"\n :documentSelectedSecurity=\"documentSelectedSecurity\"\n :documentUrl=\"document?.['x-scalar-original-source-url']\"\n :environment\n :environments\n :eventBus\n :exampleKey=\"exampleName\"\n :globalCookies\n :hideClientButton=\"toValue(options)?.hideClientButton ?? false\"\n :history=\"workspaceStore.history.getHistory(documentSlug, path, method)\"\n :httpClients\n :layout\n :method\n :operation\n :operationSelectedSecurity=\"operationSelectedSecurity\"\n :path\n :plugins=\"plugins\"\n :proxyUrl=\"\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout,\n ) ?? ''\n \"\n :securitySchemes\n :selectedClient=\"workspaceStore.workspace['x-scalar-default-client']\"\n :server=\"selectedServer\"\n :serverMeta\n :servers />\n </template>\n\n <!-- Empty state -->\n <div\n v-else\n class=\"flex h-full w-full items-center justify-center\">\n <span class=\"text-c-3\">Select an operation to view details</span>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"Operation.vue.js","names":[],"sources":["../../../../src/v2/features/operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Operation example page\n *\n * Displays an operation with a specific example selected\n * - View example request data\n * - Modify example request data\n * - Send example request\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type { AuthMeta, ServerMeta } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { computed, toValue } from 'vue'\n\nimport { OperationBlock } from '@/v2/blocks/operation-block'\nimport type { ExtendedScalarCookie } from '@/v2/blocks/request-block/RequestBlock.vue'\nimport { APP_VERSION } from '@/v2/constants'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { mapHiddenClientsConfig } from '@/v2/features/modal/helpers/map-hidden-clients-config'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\nimport { combineParams } from '@/v2/features/operation/helpers/combine-params'\nimport { getSelectedServer } from '@/v2/features/operation/helpers/get-selected-server'\nimport { getActiveProxyUrl } from '@/v2/helpers/get-active-proxy-url'\nimport { getServers } from '@/v2/helpers/get-servers'\n\nconst {\n document,\n layout,\n eventBus,\n path,\n method,\n environment,\n exampleName,\n options,\n securitySchemes,\n workspaceStore,\n plugins,\n documentSlug,\n} = defineProps<\n RouteProps & {\n /** Subset of config options for the modal */\n options?: ModalProps['options']\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n }\n>()\n\n/** Grab the path item object from the document */\nconst pathItem = computed(() => {\n if (!path) {\n return null\n }\n return getResolvedRef(document?.paths?.[path])\n})\n\n/** Find the operation and augment with any path parameters */\nconst operation = computed(() => {\n if (!path || !method) {\n return null\n }\n\n const operation = getResolvedRef(document?.paths?.[path]?.[method])\n if (!operation) {\n return null\n }\n\n if (!pathItem.value) {\n return operation\n }\n\n // We combine any path parameters with the operation parameters\n const parameters = combineParams(\n pathItem.value.parameters,\n operation.parameters,\n )\n return { ...operation, parameters }\n})\n\n/** Combine the workspace and document cookies */\nconst globalCookies = computed(() => [\n ...((workspaceStore.workspace?.['x-scalar-cookies'] ?? []).map((it) => ({\n ...it,\n location: 'workspace',\n })) satisfies ExtendedScalarCookie[]),\n ...((document?.['x-scalar-cookies'] ?? []).map((it) => ({\n ...it,\n location: 'document',\n })) satisfies ExtendedScalarCookie[]),\n])\n\n/** Compute the servers for the operation */\nconst servers = computed(() => {\n /**\n * Gather all the servers from the config, operation, pathItem, and document\n */\n const _servers =\n toValue(options)?.servers ??\n operation.value?.servers ??\n // pathItem.value?.servers ?? TODO: add support for pathItem servers\n document?.servers\n\n return getServers(_servers, {\n baseServerUrl: toValue(options)?.baseServerURL,\n documentUrl: document?.['x-scalar-original-source-url'],\n })\n})\n\n/** Selected server URL from the same source as servers: operation, then document (config has no stored selection so use document selection) */\nconst selectedServerUrl = computed(() => {\n if (toValue(options)?.servers != null) {\n return document?.['x-scalar-selected-server']\n }\n if (operation.value?.servers != null) {\n return operation.value['x-scalar-selected-server']\n }\n return document?.['x-scalar-selected-server']\n})\n\n/** Selected server for the operation (document-level or operation-level servers) */\nconst selectedServer = computed(() =>\n getSelectedServer(servers.value, selectedServerUrl.value),\n)\n\nconst serverMeta = computed<ServerMeta>(() => {\n if (operation.value?.servers != null) {\n return { type: 'operation', path: path ?? '', method: method ?? 'get' }\n }\n return { type: 'document' }\n})\n\nconst documentSelectedSecurity = computed<SelectedSecurity | undefined>(() => {\n return workspaceStore.auth.getAuthSelectedSchemas({\n type: 'document',\n documentName: documentSlug,\n })\n})\n\nconst operationSelectedSecurity = computed<SelectedSecurity | undefined>(() => {\n return workspaceStore.auth.getAuthSelectedSchemas({\n type: 'operation',\n documentName: documentSlug,\n path: path ?? '',\n method: method ?? 'get',\n })\n})\n\n/** Select document vs operation meta based on the extension */\nconst authMeta = computed<AuthMeta>(() => {\n if (operationSelectedSecurity.value !== undefined) {\n return {\n type: 'operation',\n path: path ?? '',\n method: method ?? 'get',\n }\n }\n\n return { type: 'document' }\n})\n\n/** Combine environments from document and workspace into a unique array of environment names */\nconst environments = computed(() => {\n return Array.from(\n new Set(\n Object.keys({\n ...document?.['x-scalar-environments'],\n ...workspaceStore.workspace['x-scalar-environments'],\n }),\n ),\n )\n})\n\n/** Temporarily use the old config.hiddenClients until we migrate to the new httpClients config */\nconst httpClients = computed(() =>\n mapHiddenClientsConfig(toValue(options)?.hiddenClients),\n)\n</script>\n\n<template>\n <!-- Operation exists -->\n <template v-if=\"path && method && exampleName && operation\">\n <OperationBlock\n :activeEnvironment=\"\n workspaceStore.workspace['x-scalar-active-environment']\n \"\n :appVersion=\"APP_VERSION\"\n :authMeta\n :documentSecurity=\"document?.security ?? []\"\n :documentSelectedSecurity=\"documentSelectedSecurity\"\n :documentUrl=\"document?.['x-scalar-original-source-url']\"\n :environment\n :environments\n :eventBus\n :exampleKey=\"exampleName\"\n :globalCookies\n :hideClientButton=\"toValue(options)?.hideClientButton ?? false\"\n :history=\"workspaceStore.history.getHistory(documentSlug, path, method)\"\n :httpClients\n :layout\n :method\n :operation\n :operationSelectedSecurity=\"operationSelectedSecurity\"\n :path\n :plugins=\"plugins\"\n :proxyUrl=\"\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout,\n ) ?? ''\n \"\n :requestBodyCompositionSelection\n :securitySchemes\n :selectedClient=\"workspaceStore.workspace['x-scalar-default-client']\"\n :server=\"selectedServer\"\n :serverMeta\n :servers />\n </template>\n\n <!-- Empty state -->\n <div\n v-else\n class=\"flex h-full w-full items-center justify-center\">\n <span class=\"text-c-3\">Select an operation to view details</span>\n </div>\n</template>\n"],"mappings":""}
@@ -33,7 +33,8 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
33
33
  fetchRegistryDocument: { type: Function },
34
34
  telemetry: { type: Boolean },
35
35
  onUpdateTelemetry: { type: Function },
36
- options: {}
36
+ options: {},
37
+ requestBodyCompositionSelection: {}
37
38
  },
38
39
  setup(__props) {
39
40
  /** Grab the path item object from the document */
@@ -140,6 +141,7 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
140
141
  path: __props.path,
141
142
  plugins: __props.plugins,
142
143
  proxyUrl: unref(getActiveProxyUrl)(__props.workspaceStore.workspace["x-scalar-active-proxy"], __props.layout) ?? "",
144
+ requestBodyCompositionSelection: __props.requestBodyCompositionSelection,
143
145
  securitySchemes: __props.securitySchemes,
144
146
  selectedClient: __props.workspaceStore.workspace["x-scalar-default-client"],
145
147
  server: selectedServer.value,
@@ -167,6 +169,7 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
167
169
  "path",
168
170
  "plugins",
169
171
  "proxyUrl",
172
+ "requestBodyCompositionSelection",
170
173
  "securitySchemes",
171
174
  "selectedClient",
172
175
  "server",
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.vue.script.js","names":[],"sources":["../../../../src/v2/features/operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Operation example page\n *\n * Displays an operation with a specific example selected\n * - View example request data\n * - Modify example request data\n * - Send example request\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type { AuthMeta, ServerMeta } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { computed, toValue } from 'vue'\n\nimport { OperationBlock } from '@/v2/blocks/operation-block'\nimport type { ExtendedScalarCookie } from '@/v2/blocks/request-block/RequestBlock.vue'\nimport { APP_VERSION } from '@/v2/constants'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { mapHiddenClientsConfig } from '@/v2/features/modal/helpers/map-hidden-clients-config'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\nimport { combineParams } from '@/v2/features/operation/helpers/combine-params'\nimport { getSelectedServer } from '@/v2/features/operation/helpers/get-selected-server'\nimport { getActiveProxyUrl } from '@/v2/helpers/get-active-proxy-url'\nimport { getServers } from '@/v2/helpers/get-servers'\n\nconst {\n document,\n layout,\n eventBus,\n path,\n method,\n environment,\n exampleName,\n options,\n securitySchemes,\n workspaceStore,\n plugins,\n documentSlug,\n} = defineProps<\n RouteProps & {\n /** Subset of config options for the modal */\n options?: ModalProps['options']\n }\n>()\n\n/** Grab the path item object from the document */\nconst pathItem = computed(() => {\n if (!path) {\n return null\n }\n return getResolvedRef(document?.paths?.[path])\n})\n\n/** Find the operation and augment with any path parameters */\nconst operation = computed(() => {\n if (!path || !method) {\n return null\n }\n\n const operation = getResolvedRef(document?.paths?.[path]?.[method])\n if (!operation) {\n return null\n }\n\n if (!pathItem.value) {\n return operation\n }\n\n // We combine any path parameters with the operation parameters\n const parameters = combineParams(\n pathItem.value.parameters,\n operation.parameters,\n )\n return { ...operation, parameters }\n})\n\n/** Combine the workspace and document cookies */\nconst globalCookies = computed(() => [\n ...((workspaceStore.workspace?.['x-scalar-cookies'] ?? []).map((it) => ({\n ...it,\n location: 'workspace',\n })) satisfies ExtendedScalarCookie[]),\n ...((document?.['x-scalar-cookies'] ?? []).map((it) => ({\n ...it,\n location: 'document',\n })) satisfies ExtendedScalarCookie[]),\n])\n\n/** Compute the servers for the operation */\nconst servers = computed(() => {\n /**\n * Gather all the servers from the config, operation, pathItem, and document\n */\n const _servers =\n toValue(options)?.servers ??\n operation.value?.servers ??\n // pathItem.value?.servers ?? TODO: add support for pathItem servers\n document?.servers\n\n return getServers(_servers, {\n baseServerUrl: toValue(options)?.baseServerURL,\n documentUrl: document?.['x-scalar-original-source-url'],\n })\n})\n\n/** Selected server URL from the same source as servers: operation, then document (config has no stored selection so use document selection) */\nconst selectedServerUrl = computed(() => {\n if (toValue(options)?.servers != null) {\n return document?.['x-scalar-selected-server']\n }\n if (operation.value?.servers != null) {\n return operation.value['x-scalar-selected-server']\n }\n return document?.['x-scalar-selected-server']\n})\n\n/** Selected server for the operation (document-level or operation-level servers) */\nconst selectedServer = computed(() =>\n getSelectedServer(servers.value, selectedServerUrl.value),\n)\n\nconst serverMeta = computed<ServerMeta>(() => {\n if (operation.value?.servers != null) {\n return { type: 'operation', path: path ?? '', method: method ?? 'get' }\n }\n return { type: 'document' }\n})\n\nconst documentSelectedSecurity = computed<SelectedSecurity | undefined>(() => {\n return workspaceStore.auth.getAuthSelectedSchemas({\n type: 'document',\n documentName: documentSlug,\n })\n})\n\nconst operationSelectedSecurity = computed<SelectedSecurity | undefined>(() => {\n return workspaceStore.auth.getAuthSelectedSchemas({\n type: 'operation',\n documentName: documentSlug,\n path: path ?? '',\n method: method ?? 'get',\n })\n})\n\n/** Select document vs operation meta based on the extension */\nconst authMeta = computed<AuthMeta>(() => {\n if (operationSelectedSecurity.value !== undefined) {\n return {\n type: 'operation',\n path: path ?? '',\n method: method ?? 'get',\n }\n }\n\n return { type: 'document' }\n})\n\n/** Combine environments from document and workspace into a unique array of environment names */\nconst environments = computed(() => {\n return Array.from(\n new Set(\n Object.keys({\n ...document?.['x-scalar-environments'],\n ...workspaceStore.workspace['x-scalar-environments'],\n }),\n ),\n )\n})\n\n/** Temporarily use the old config.hiddenClients until we migrate to the new httpClients config */\nconst httpClients = computed(() =>\n mapHiddenClientsConfig(toValue(options)?.hiddenClients),\n)\n</script>\n\n<template>\n <!-- Operation exists -->\n <template v-if=\"path && method && exampleName && operation\">\n <OperationBlock\n :activeEnvironment=\"\n workspaceStore.workspace['x-scalar-active-environment']\n \"\n :appVersion=\"APP_VERSION\"\n :authMeta\n :documentSecurity=\"document?.security ?? []\"\n :documentSelectedSecurity=\"documentSelectedSecurity\"\n :documentUrl=\"document?.['x-scalar-original-source-url']\"\n :environment\n :environments\n :eventBus\n :exampleKey=\"exampleName\"\n :globalCookies\n :hideClientButton=\"toValue(options)?.hideClientButton ?? false\"\n :history=\"workspaceStore.history.getHistory(documentSlug, path, method)\"\n :httpClients\n :layout\n :method\n :operation\n :operationSelectedSecurity=\"operationSelectedSecurity\"\n :path\n :plugins=\"plugins\"\n :proxyUrl=\"\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout,\n ) ?? ''\n \"\n :securitySchemes\n :selectedClient=\"workspaceStore.workspace['x-scalar-default-client']\"\n :server=\"selectedServer\"\n :serverMeta\n :servers />\n </template>\n\n <!-- Empty state -->\n <div\n v-else\n class=\"flex h-full w-full items-center justify-center\">\n <span class=\"text-c-3\">Select an operation to view details</span>\n </div>\n</template>\n"],"mappings":"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"}
1
+ {"version":3,"file":"Operation.vue.script.js","names":[],"sources":["../../../../src/v2/features/operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Operation example page\n *\n * Displays an operation with a specific example selected\n * - View example request data\n * - Modify example request data\n * - Send example request\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type { AuthMeta, ServerMeta } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { computed, toValue } from 'vue'\n\nimport { OperationBlock } from '@/v2/blocks/operation-block'\nimport type { ExtendedScalarCookie } from '@/v2/blocks/request-block/RequestBlock.vue'\nimport { APP_VERSION } from '@/v2/constants'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { mapHiddenClientsConfig } from '@/v2/features/modal/helpers/map-hidden-clients-config'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\nimport { combineParams } from '@/v2/features/operation/helpers/combine-params'\nimport { getSelectedServer } from '@/v2/features/operation/helpers/get-selected-server'\nimport { getActiveProxyUrl } from '@/v2/helpers/get-active-proxy-url'\nimport { getServers } from '@/v2/helpers/get-servers'\n\nconst {\n document,\n layout,\n eventBus,\n path,\n method,\n environment,\n exampleName,\n options,\n securitySchemes,\n workspaceStore,\n plugins,\n documentSlug,\n} = defineProps<\n RouteProps & {\n /** Subset of config options for the modal */\n options?: ModalProps['options']\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n }\n>()\n\n/** Grab the path item object from the document */\nconst pathItem = computed(() => {\n if (!path) {\n return null\n }\n return getResolvedRef(document?.paths?.[path])\n})\n\n/** Find the operation and augment with any path parameters */\nconst operation = computed(() => {\n if (!path || !method) {\n return null\n }\n\n const operation = getResolvedRef(document?.paths?.[path]?.[method])\n if (!operation) {\n return null\n }\n\n if (!pathItem.value) {\n return operation\n }\n\n // We combine any path parameters with the operation parameters\n const parameters = combineParams(\n pathItem.value.parameters,\n operation.parameters,\n )\n return { ...operation, parameters }\n})\n\n/** Combine the workspace and document cookies */\nconst globalCookies = computed(() => [\n ...((workspaceStore.workspace?.['x-scalar-cookies'] ?? []).map((it) => ({\n ...it,\n location: 'workspace',\n })) satisfies ExtendedScalarCookie[]),\n ...((document?.['x-scalar-cookies'] ?? []).map((it) => ({\n ...it,\n location: 'document',\n })) satisfies ExtendedScalarCookie[]),\n])\n\n/** Compute the servers for the operation */\nconst servers = computed(() => {\n /**\n * Gather all the servers from the config, operation, pathItem, and document\n */\n const _servers =\n toValue(options)?.servers ??\n operation.value?.servers ??\n // pathItem.value?.servers ?? TODO: add support for pathItem servers\n document?.servers\n\n return getServers(_servers, {\n baseServerUrl: toValue(options)?.baseServerURL,\n documentUrl: document?.['x-scalar-original-source-url'],\n })\n})\n\n/** Selected server URL from the same source as servers: operation, then document (config has no stored selection so use document selection) */\nconst selectedServerUrl = computed(() => {\n if (toValue(options)?.servers != null) {\n return document?.['x-scalar-selected-server']\n }\n if (operation.value?.servers != null) {\n return operation.value['x-scalar-selected-server']\n }\n return document?.['x-scalar-selected-server']\n})\n\n/** Selected server for the operation (document-level or operation-level servers) */\nconst selectedServer = computed(() =>\n getSelectedServer(servers.value, selectedServerUrl.value),\n)\n\nconst serverMeta = computed<ServerMeta>(() => {\n if (operation.value?.servers != null) {\n return { type: 'operation', path: path ?? '', method: method ?? 'get' }\n }\n return { type: 'document' }\n})\n\nconst documentSelectedSecurity = computed<SelectedSecurity | undefined>(() => {\n return workspaceStore.auth.getAuthSelectedSchemas({\n type: 'document',\n documentName: documentSlug,\n })\n})\n\nconst operationSelectedSecurity = computed<SelectedSecurity | undefined>(() => {\n return workspaceStore.auth.getAuthSelectedSchemas({\n type: 'operation',\n documentName: documentSlug,\n path: path ?? '',\n method: method ?? 'get',\n })\n})\n\n/** Select document vs operation meta based on the extension */\nconst authMeta = computed<AuthMeta>(() => {\n if (operationSelectedSecurity.value !== undefined) {\n return {\n type: 'operation',\n path: path ?? '',\n method: method ?? 'get',\n }\n }\n\n return { type: 'document' }\n})\n\n/** Combine environments from document and workspace into a unique array of environment names */\nconst environments = computed(() => {\n return Array.from(\n new Set(\n Object.keys({\n ...document?.['x-scalar-environments'],\n ...workspaceStore.workspace['x-scalar-environments'],\n }),\n ),\n )\n})\n\n/** Temporarily use the old config.hiddenClients until we migrate to the new httpClients config */\nconst httpClients = computed(() =>\n mapHiddenClientsConfig(toValue(options)?.hiddenClients),\n)\n</script>\n\n<template>\n <!-- Operation exists -->\n <template v-if=\"path && method && exampleName && operation\">\n <OperationBlock\n :activeEnvironment=\"\n workspaceStore.workspace['x-scalar-active-environment']\n \"\n :appVersion=\"APP_VERSION\"\n :authMeta\n :documentSecurity=\"document?.security ?? []\"\n :documentSelectedSecurity=\"documentSelectedSecurity\"\n :documentUrl=\"document?.['x-scalar-original-source-url']\"\n :environment\n :environments\n :eventBus\n :exampleKey=\"exampleName\"\n :globalCookies\n :hideClientButton=\"toValue(options)?.hideClientButton ?? false\"\n :history=\"workspaceStore.history.getHistory(documentSlug, path, method)\"\n :httpClients\n :layout\n :method\n :operation\n :operationSelectedSecurity=\"operationSelectedSecurity\"\n :path\n :plugins=\"plugins\"\n :proxyUrl=\"\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout,\n ) ?? ''\n \"\n :requestBodyCompositionSelection\n :securitySchemes\n :selectedClient=\"workspaceStore.workspace['x-scalar-default-client']\"\n :server=\"selectedServer\"\n :serverMeta\n :servers />\n </template>\n\n <!-- Empty state -->\n <div\n v-else\n class=\"flex h-full w-full items-center justify-center\">\n <span class=\"text-c-3\">Select an operation to view details</span>\n </div>\n</template>\n"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ export declare function downloadAsFile(content: string, filename: string, mimeType?: string): void;
2
+ //# sourceMappingURL=download-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-document.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/download-document.ts"],"names":[],"mappings":"AAiBA,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,SAAqB,GAAG,IAAI,CAkBrG"}
@@ -0,0 +1,42 @@
1
+ //#region src/v2/helpers/download-document.ts
2
+ /**
3
+ * Triggers a file download in the browser for the given content.
4
+ * Creates a blob, programmatically clicks a temporary link, then revokes the object URL.
5
+ *
6
+ * @param content - The string content to download (e.g. JSON or YAML).
7
+ * @param filename - The name of the file to save (e.g. "my-api.json").
8
+ * @param mimeType - Optional MIME type for the blob. Defaults to "application/json".
9
+ */
10
+ function createClickEvent() {
11
+ try {
12
+ return new MouseEvent("click", {
13
+ bubbles: true,
14
+ cancelable: true,
15
+ view: window
16
+ });
17
+ } catch {
18
+ return new MouseEvent("click", {
19
+ bubbles: true,
20
+ cancelable: true
21
+ });
22
+ }
23
+ }
24
+ function downloadAsFile(content, filename, mimeType = "application/json") {
25
+ const blob = new Blob([content], { type: mimeType });
26
+ const url = URL.createObjectURL(blob);
27
+ const link = document.createElement("a");
28
+ link.href = url;
29
+ link.download = filename;
30
+ link.style.display = "none";
31
+ link.setAttribute("aria-hidden", "true");
32
+ document.body.appendChild(link);
33
+ link.dispatchEvent(createClickEvent());
34
+ setTimeout(() => {
35
+ URL.revokeObjectURL(url);
36
+ document.body.removeChild(link);
37
+ }, 100);
38
+ }
39
+ //#endregion
40
+ export { downloadAsFile };
41
+
42
+ //# sourceMappingURL=download-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-document.js","names":[],"sources":["../../../src/v2/helpers/download-document.ts"],"sourcesContent":["/**\n * Triggers a file download in the browser for the given content.\n * Creates a blob, programmatically clicks a temporary link, then revokes the object URL.\n *\n * @param content - The string content to download (e.g. JSON or YAML).\n * @param filename - The name of the file to save (e.g. \"my-api.json\").\n * @param mimeType - Optional MIME type for the blob. Defaults to \"application/json\".\n */\nfunction createClickEvent(): MouseEvent {\n try {\n return new MouseEvent('click', { bubbles: true, cancelable: true, view: window })\n } catch {\n // Fallback for test environments where `view` is not a valid Window.\n return new MouseEvent('click', { bubbles: true, cancelable: true })\n }\n}\n\nexport function downloadAsFile(content: string, filename: string, mimeType = 'application/json'): void {\n const blob = new Blob([content], { type: mimeType })\n const url = URL.createObjectURL(blob)\n const link = document.createElement('a')\n link.href = url\n link.download = filename\n link.style.display = 'none'\n link.setAttribute('aria-hidden', 'true')\n document.body.appendChild(link)\n\n // This is necessary as link.click() does not work on the latest Firefox.\n link.dispatchEvent(createClickEvent())\n\n // For Firefox it is necessary to delay revoking the ObjectURL.\n setTimeout(() => {\n URL.revokeObjectURL(url)\n document.body.removeChild(link)\n }, 100)\n}\n"],"mappings":";;;;;;;;;AAQA,SAAS,mBAA+B;AACtC,KAAI;AACF,SAAO,IAAI,WAAW,SAAS;GAAE,SAAS;GAAM,YAAY;GAAM,MAAM;GAAQ,CAAC;SAC3E;AAEN,SAAO,IAAI,WAAW,SAAS;GAAE,SAAS;GAAM,YAAY;GAAM,CAAC;;;AAIvE,SAAgB,eAAe,SAAiB,UAAkB,WAAW,oBAA0B;CACrG,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,MAAM,UAAU,CAAC;CACpD,MAAM,MAAM,IAAI,gBAAgB,KAAK;CACrC,MAAM,OAAO,SAAS,cAAc,IAAI;AACxC,MAAK,OAAO;AACZ,MAAK,WAAW;AAChB,MAAK,MAAM,UAAU;AACrB,MAAK,aAAa,eAAe,OAAO;AACxC,UAAS,KAAK,YAAY,KAAK;AAG/B,MAAK,cAAc,kBAAkB,CAAC;AAGtC,kBAAiB;AACf,MAAI,gBAAgB,IAAI;AACxB,WAAS,KAAK,YAAY,KAAK;IAC9B,IAAI"}
@@ -45,7 +45,7 @@ var ResponseEmpty_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
45
45
  const handleHotKey = (event) => {
46
46
  if (event?.createNew && route.name === "request") addRequest();
47
47
  };
48
- const packageVersion = "2.39.0";
48
+ const packageVersion = "2.39.1";
49
49
  onMounted(() => events.hotKeys.on(handleHotKey));
50
50
  onBeforeUnmount(() => events.hotKeys.off(handleHotKey));
51
51
  return (_ctx, _cache) => {
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "rest",
19
19
  "testing"
20
20
  ],
21
- "version": "2.39.0",
21
+ "version": "2.39.1",
22
22
  "engines": {
23
23
  "node": ">=22"
24
24
  },
@@ -347,24 +347,24 @@
347
347
  "whatwg-mimetype": "4.0.0",
348
348
  "yaml": "^2.8.0",
349
349
  "zod": "^4.3.5",
350
- "@scalar/components": "0.21.0",
351
- "@scalar/helpers": "0.4.2",
350
+ "@scalar/components": "0.21.1",
352
351
  "@scalar/draggable": "0.4.1",
353
- "@scalar/icons": "0.6.4",
352
+ "@scalar/icons": "0.7.0",
353
+ "@scalar/helpers": "0.4.2",
354
354
  "@scalar/import": "0.5.3",
355
+ "@scalar/oas-utils": "0.10.12",
355
356
  "@scalar/json-magic": "0.12.4",
356
- "@scalar/oas-utils": "0.10.11",
357
357
  "@scalar/object-utils": "1.3.3",
358
358
  "@scalar/openapi-types": "0.6.1",
359
359
  "@scalar/postman-to-openapi": "0.6.0",
360
- "@scalar/sidebar": "0.8.13",
361
- "@scalar/snippetz": "0.7.6",
360
+ "@scalar/sidebar": "0.8.14",
361
+ "@scalar/snippetz": "0.7.7",
362
362
  "@scalar/themes": "0.15.1",
363
- "@scalar/use-codemirror": "0.14.10",
364
- "@scalar/types": "0.7.4",
365
- "@scalar/use-toasts": "0.10.1",
363
+ "@scalar/types": "0.7.5",
366
364
  "@scalar/use-hooks": "0.4.1",
367
- "@scalar/workspace-store": "0.41.0"
365
+ "@scalar/use-toasts": "0.10.1",
366
+ "@scalar/workspace-store": "0.41.1",
367
+ "@scalar/use-codemirror": "0.14.10"
368
368
  },
369
369
  "devDependencies": {
370
370
  "@tailwindcss/vite": "^4.2.0",
@@ -379,8 +379,8 @@
379
379
  "vite": "8.0.0",
380
380
  "vite-svg-loader": "5.1.1",
381
381
  "vitest": "4.1.0",
382
- "@scalar/galaxy": "0.6.1",
383
- "@scalar/pre-post-request-scripts": "0.3.13"
382
+ "@scalar/pre-post-request-scripts": "0.3.14",
383
+ "@scalar/galaxy": "0.6.1"
384
384
  },
385
385
  "scripts": {
386
386
  "build": "vite build && vue-tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",