@scalar/api-client 2.38.2 → 2.38.3
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 +8 -0
- package/dist/{AddressBar-B4xnl66I.js → AddressBar-CX8xiYoe.js} +4 -4
- package/dist/{AddressBar-B4xnl66I.js.map → AddressBar-CX8xiYoe.js.map} +1 -1
- package/dist/{App-BVH4lIe8.js → App-BpNPKHmM.js} +4 -4
- package/dist/{App-BVH4lIe8.js.map → App-BpNPKHmM.js.map} +1 -1
- package/dist/{App-CvClwSlM.js → App-Ckirvnv1.js} +2 -2
- package/dist/{App-CvClwSlM.js.map → App-Ckirvnv1.js.map} +1 -1
- package/dist/{CodeInput-C-igR77V.js → CodeInput-BN7uw3Bh.js} +2 -2
- package/dist/{CodeInput-C-igR77V.js.map → CodeInput-BN7uw3Bh.js.map} +1 -1
- package/dist/{Collection-4MT9WmDD.js → Collection-ChAxs3rz.js} +2 -2
- package/dist/{Collection-4MT9WmDD.js.map → Collection-ChAxs3rz.js.map} +1 -1
- package/dist/{CollectionAuthentication-MHWQpw74.js → CollectionAuthentication-BDpvv8cA.js} +5 -5
- package/dist/{CollectionAuthentication-MHWQpw74.js.map → CollectionAuthentication-BDpvv8cA.js.map} +1 -1
- package/dist/{CollectionEnvironment-Dw35vIqo.js → CollectionEnvironment-dwisJ-h5.js} +4 -4
- package/dist/{CollectionEnvironment-Dw35vIqo.js.map → CollectionEnvironment-dwisJ-h5.js.map} +1 -1
- package/dist/{CollectionOverview-TUdDIu5f.js → CollectionOverview-CJ9-Vmei.js} +3 -3
- package/dist/{CollectionOverview-TUdDIu5f.js.map → CollectionOverview-CJ9-Vmei.js.map} +1 -1
- package/dist/{CollectionServers-BrjTCfDe.js → CollectionServers-BWkIGwz4.js} +5 -5
- package/dist/{CollectionServers-BrjTCfDe.js.map → CollectionServers-BWkIGwz4.js.map} +1 -1
- package/dist/{CollectionSettings-HVSlp2Gv.js → CollectionSettings-CqUUYOym.js} +2 -2
- package/dist/{CollectionSettings-HVSlp2Gv.js.map → CollectionSettings-CqUUYOym.js.map} +1 -1
- package/dist/{CommandPalette-CL8k4CoN.js → CommandPalette-BiA0IgO8.js} +2 -2
- package/dist/{CommandPalette-CL8k4CoN.js.map → CommandPalette-BiA0IgO8.js.map} +1 -1
- package/dist/{Cookies-DbOKTi1f.js → Cookies-CNRSxP8J.js} +8 -8
- package/dist/{Cookies-DbOKTi1f.js.map → Cookies-CNRSxP8J.js.map} +1 -1
- package/dist/{DataTableInput-yaU5g-kP.js → DataTableInput-SkIUPlrB.js} +2 -2
- package/dist/{DataTableInput-yaU5g-kP.js.map → DataTableInput-SkIUPlrB.js.map} +1 -1
- package/dist/{Environment-DJatRQIg.js → Environment-D_CbZk0A.js} +5 -5
- package/dist/{Environment-DJatRQIg.js.map → Environment-D_CbZk0A.js.map} +1 -1
- package/dist/{EnvironmentModal-DBEJ4Kzj.js → EnvironmentModal-CcyqnPc2.js} +2 -2
- package/dist/{EnvironmentModal-DBEJ4Kzj.js.map → EnvironmentModal-CcyqnPc2.js.map} +1 -1
- package/dist/{Form-CSKzyHGO.js → Form-bA4bV_oA.js} +3 -3
- package/dist/{Form-CSKzyHGO.js.map → Form-bA4bV_oA.js.map} +1 -1
- package/dist/{ImportCollection-DfX1UQ5u.js → ImportCollection-BIYMxB9Q.js} +2 -2
- package/dist/{ImportCollection-DfX1UQ5u.js.map → ImportCollection-BIYMxB9Q.js.map} +1 -1
- package/dist/{MainLayout-BEFMl1ud.js → MainLayout-oMIJ5QXF.js} +3 -3
- package/dist/{MainLayout-BEFMl1ud.js.map → MainLayout-oMIJ5QXF.js.map} +1 -1
- package/dist/{Modal-sQ9vH6MN.js → Modal-DkOa_KK0.js} +2 -2
- package/dist/{Modal-sQ9vH6MN.js.map → Modal-DkOa_KK0.js.map} +1 -1
- package/dist/{Request-gscRsGQ8.js → Request-BWfYWyBa.js} +10 -10
- package/dist/{Request-gscRsGQ8.js.map → Request-BWfYWyBa.js.map} +1 -1
- package/dist/{RequestAuth-BzBfIysT.js → RequestAuth-BU6ubH-c.js} +3 -3
- package/dist/{RequestAuth-BzBfIysT.js.map → RequestAuth-BU6ubH-c.js.map} +1 -1
- package/dist/{RequestRoot-3Bj8JZD-.js → RequestRoot-7xhK5_qr.js} +7 -7
- package/dist/{RequestRoot-3Bj8JZD-.js.map → RequestRoot-7xhK5_qr.js.map} +1 -1
- package/dist/{RequestSection-HhdJj9hW.js → RequestSection-Bx8UHW-k.js} +4 -4
- package/dist/{RequestSection-HhdJj9hW.js.map → RequestSection-Bx8UHW-k.js.map} +1 -1
- package/dist/{ResponseSection-DMJ0tw8E.js → ResponseSection-CLrgLMN_.js} +3 -3
- package/dist/{ResponseSection-DMJ0tw8E.js.map → ResponseSection-CLrgLMN_.js.map} +1 -1
- package/dist/{Server-DnA_BzPS.js → Server-BS4zjUdO.js} +2 -2
- package/dist/{Server-DnA_BzPS.js.map → Server-BS4zjUdO.js.map} +1 -1
- package/dist/{Settings-CYZzdJPO.js → Settings-BuLKHzRY.js} +2 -2
- package/dist/{Settings-CYZzdJPO.js.map → Settings-BuLKHzRY.js.map} +1 -1
- package/dist/{Sidebar-C6AdX6-N.js → Sidebar-Xl9_nFXX.js} +2 -2
- package/dist/{Sidebar-C6AdX6-N.js.map → Sidebar-Xl9_nFXX.js.map} +1 -1
- package/dist/components/AddressBar/index.js +3 -3
- package/dist/components/CodeInput/index.js +1 -1
- package/dist/components/CommandPalette/index.js +1 -1
- package/dist/components/DataTable/index.js +2 -2
- package/dist/components/ImportCollection/index.js +1 -1
- package/dist/components/Server/index.js +1 -1
- package/dist/components/Sidebar/index.js +1 -1
- package/dist/components/index.js +4 -4
- package/dist/{components-CSxJTn6F.js → components-DfJHvSLM.js} +2 -2
- package/dist/{components-CSxJTn6F.js.map → components-DfJHvSLM.js.map} +1 -1
- package/dist/get-resolved-url-SybDPV0U.js +85 -0
- package/dist/get-resolved-url-SybDPV0U.js.map +1 -0
- package/dist/{get-server-url-o3On8CEr.js → get-server-url-UVN-dx79.js} +1 -1
- package/dist/{get-server-url-o3On8CEr.js.map → get-server-url-UVN-dx79.js.map} +1 -1
- package/dist/index.js +5 -5
- package/dist/layouts/App/index.js +3 -3
- package/dist/layouts/Modal/index.js +1 -1
- package/dist/layouts/Web/index.js +4 -4
- package/dist/libs/index.js +1 -1
- package/dist/{operation-block-BnMIKAOh.js → operation-block-DE-hoO03.js} +67 -17
- package/dist/operation-block-DE-hoO03.js.map +1 -0
- package/dist/{operation-code-sample-ZUTueV3v.js → operation-code-sample-xgx4qi2H.js} +22 -10
- package/dist/operation-code-sample-xgx4qi2H.js.map +1 -0
- package/dist/{request-block-DwsGy64Q.js → request-block-N7dPFyrG.js} +4 -4
- package/dist/{request-block-DwsGy64Q.js.map → request-block-N7dPFyrG.js.map} +1 -1
- package/dist/{scalar-address-bar-block--Vs6IBU1.js → scalar-address-bar-block-BbysOhkE.js} +2 -2
- package/dist/{scalar-address-bar-block--Vs6IBU1.js.map → scalar-address-bar-block-BbysOhkE.js.map} +1 -1
- package/dist/{scalar-auth-selector-block-DI3DLag9.js → scalar-auth-selector-block-Bs79QOMA.js} +12 -9
- package/dist/scalar-auth-selector-block-Bs79QOMA.js.map +1 -0
- package/dist/store/index.js +1 -1
- package/dist/{store-DpSUVhjp.js → store-DaPoVtIS.js} +15 -15
- package/dist/{store-DpSUVhjp.js.map → store-DaPoVtIS.js.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.d.ts +6 -0
- package/dist/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts +1 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts +2 -1
- package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/index.js +11 -11
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/index.js +1 -1
- package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/index.js +5 -5
- package/dist/v2/blocks/response-block/index.js +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/index.js +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/index.js +3 -3
- package/dist/v2/constants.d.ts +3 -0
- package/dist/v2/constants.d.ts.map +1 -0
- package/dist/v2/features/app/components/index.js +4 -4
- package/dist/v2/features/app/index.js +14 -14
- package/dist/v2/features/app/index.js.map +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/index.js +10 -10
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/helpers/get-selected-security.d.ts +6 -1
- package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -1
- package/dist/v2/features/operation/index.js +10 -10
- package/dist/views/Request/RequestSection/RequestAuth/index.js +3 -3
- package/dist/views/Request/RequestSection/index.js +4 -4
- package/dist/views/Request/ResponseSection/index.js +3 -3
- package/dist/views/Request/components/index.js +1 -1
- package/package.json +13 -13
- package/dist/get-resolved-url-BUCwrBzc.js +0 -30
- package/dist/get-resolved-url-BUCwrBzc.js.map +0 -1
- package/dist/operation-block-BnMIKAOh.js.map +0 -1
- package/dist/operation-code-sample-ZUTueV3v.js.map +0 -1
- package/dist/scalar-auth-selector-block-DI3DLag9.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-CSxJTn6F.js","names":[],"sources":["../src/views/Request/components/WorkspaceDropdown.vue","../src/views/Request/components/WorkspaceDropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n ScalarButton,\n ScalarDropdown,\n ScalarDropdownDivider,\n ScalarDropdownItem,\n ScalarIcon,\n ScalarListboxCheckbox,\n ScalarModal,\n useModal,\n} from '@scalar/components'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { computed, ref } from 'vue'\nimport { useRouter } from 'vue-router'\n\nimport DeleteSidebarListElement from '@/components/Sidebar/Actions/DeleteSidebarListElement.vue'\nimport EditSidebarListElement from '@/components/Sidebar/Actions/EditSidebarListElement.vue'\nimport { useWorkspace } from '@/store'\nimport { useActiveEntities } from '@/store/active-entities'\n\nconst { activeWorkspace } = useActiveEntities()\nconst { workspaces, workspaceMutators, events } = useWorkspace()\nconst { push } = useRouter()\n\nconst updateSelected = (uid: Workspace['uid']) => {\n if (uid === activeWorkspace.value?.uid) {\n return\n }\n\n push({\n name: 'workspace',\n params: {\n workspace: uid,\n },\n })\n}\n\nconst isLastWorkspace = computed(() => Object.keys(workspaces).length === 1)\n\nconst createNewWorkspace = () =>\n events.commandPalette.emit({ commandName: 'Create Workspace' })\n\nconst tempName = ref('')\nconst tempUid = ref('' as Workspace['uid'])\nconst editModal = useModal()\nconst deleteModal = useModal()\n\nconst openRenameModal = (uid: Workspace['uid']) => {\n const workspace = workspaces[uid]\n if (!workspace) {\n return\n }\n\n tempName.value = workspace.name\n tempUid.value = uid\n editModal.show()\n}\n\nconst handleWorkspaceEdit = (name: string) => {\n if (!name.trim()) {\n return\n }\n\n workspaceMutators.edit(tempUid.value, 'name', name.trim())\n editModal.hide()\n}\n\nconst openDeleteModal = (uid: Workspace['uid']) => {\n const workspace = workspaces[uid]\n if (!workspace) {\n return\n }\n\n tempName.value = workspace.name\n tempUid.value = uid\n deleteModal.show()\n}\n\nconst deleteWorkspace = async () => {\n if (!isLastWorkspace.value) {\n const deletedActiveWorkspace = activeWorkspace.value?.uid === tempUid.value\n const currentWorkspaces = { ...workspaces }\n delete currentWorkspaces[tempUid.value]\n\n workspaceMutators.delete(tempUid.value)\n\n // Switch to another workspace if the active one is deleted\n if (deletedActiveWorkspace) {\n const newWorkspaceUid = Object.keys(currentWorkspaces)[0]\n\n await push({\n name: 'workspace',\n params: {\n workspace: newWorkspaceUid,\n },\n })\n }\n }\n\n deleteModal.hide()\n}\n</script>\n\n<template>\n <div>\n <div class=\"flex w-[inherit] items-center text-base\">\n <ScalarDropdown>\n <ScalarButton\n class=\"text-c-1 hover:bg-b-2 line-clamp-1 h-full w-fit justify-start px-1.5 py-1.5 font-normal\"\n variant=\"ghost\">\n <div class=\"m-0 flex items-center gap-1.5 font-bold\">\n <h2 class=\"line-clamp-1 text-left\">\n {{ activeWorkspace?.name }}\n </h2>\n </div>\n </ScalarButton>\n\n <!-- Workspace list -->\n <template #items>\n <ScalarDropdownItem\n v-for=\"(workspace, uid) in workspaces\"\n :key=\"uid\"\n class=\"group/item flex w-full items-center gap-1.5 overflow-hidden text-ellipsis whitespace-nowrap\"\n @click.stop=\"updateSelected(workspace.uid)\">\n <ScalarListboxCheckbox :selected=\"activeWorkspace?.uid === uid\" />\n <span class=\"overflow-hidden text-ellipsis\">{{\n workspace.name\n }}</span>\n <ScalarDropdown\n placement=\"right-start\"\n teleport>\n <ScalarButton\n class=\"hover:bg-b-3 -mr-1 ml-auto aspect-square h-fit px-0.5 py-0 group-hover/item:flex\"\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\">\n <ScalarIcon\n icon=\"Ellipses\"\n size=\"sm\" />\n </ScalarButton>\n <template #items>\n <ScalarDropdownItem\n class=\"flex gap-2\"\n @mousedown=\"openRenameModal(workspace.uid)\"\n @touchend.prevent=\"openRenameModal(workspace.uid)\">\n <ScalarIcon\n class=\"inline-flex\"\n icon=\"Edit\"\n size=\"md\"\n thickness=\"1.5\" />\n <span>Rename</span>\n </ScalarDropdownItem>\n <ScalarDropdownItem\n v-if=\"!isLastWorkspace\"\n class=\"flex gap-2\"\n @mousedown.prevent=\"openDeleteModal(workspace.uid)\"\n @touchend.prevent=\"openDeleteModal(workspace.uid)\">\n <ScalarIcon\n class=\"inline-flex\"\n icon=\"Delete\"\n size=\"md\"\n thickness=\"1.5\" />\n <span>Delete</span>\n </ScalarDropdownItem>\n </template>\n </ScalarDropdown>\n </ScalarDropdownItem>\n <ScalarDropdownDivider />\n\n <!-- Add new workspace -->\n <ScalarDropdownItem\n class=\"flex items-center gap-1.5\"\n @click=\"createNewWorkspace\">\n <div class=\"flex h-4 w-4 items-center justify-center\">\n <ScalarIcon\n icon=\"Add\"\n size=\"sm\" />\n </div>\n <span>Create Workspace</span>\n </ScalarDropdownItem>\n </template>\n </ScalarDropdown>\n </div>\n <ScalarModal\n :size=\"'xxs'\"\n :state=\"deleteModal\"\n title=\"Delete workspace\">\n <DeleteSidebarListElement\n :variableName=\"tempName\"\n warningMessage=\"This cannot be undone. You're about to delete the workspace and everything inside it.\"\n @close=\"deleteModal.hide()\"\n @delete=\"deleteWorkspace\" />\n </ScalarModal>\n <ScalarModal\n :size=\"'xxs'\"\n :state=\"editModal\"\n title=\"Rename Workspace\">\n <EditSidebarListElement\n :name=\"tempName\"\n @close=\"editModal.hide()\"\n @edit=\"handleWorkspaceEdit\" />\n </ScalarModal>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport {\n ScalarButton,\n ScalarDropdown,\n ScalarDropdownDivider,\n ScalarDropdownItem,\n ScalarIcon,\n ScalarListboxCheckbox,\n ScalarModal,\n useModal,\n} from '@scalar/components'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { computed, ref } from 'vue'\nimport { useRouter } from 'vue-router'\n\nimport DeleteSidebarListElement from '@/components/Sidebar/Actions/DeleteSidebarListElement.vue'\nimport EditSidebarListElement from '@/components/Sidebar/Actions/EditSidebarListElement.vue'\nimport { useWorkspace } from '@/store'\nimport { useActiveEntities } from '@/store/active-entities'\n\nconst { activeWorkspace } = useActiveEntities()\nconst { workspaces, workspaceMutators, events } = useWorkspace()\nconst { push } = useRouter()\n\nconst updateSelected = (uid: Workspace['uid']) => {\n if (uid === activeWorkspace.value?.uid) {\n return\n }\n\n push({\n name: 'workspace',\n params: {\n workspace: uid,\n },\n })\n}\n\nconst isLastWorkspace = computed(() => Object.keys(workspaces).length === 1)\n\nconst createNewWorkspace = () =>\n events.commandPalette.emit({ commandName: 'Create Workspace' })\n\nconst tempName = ref('')\nconst tempUid = ref('' as Workspace['uid'])\nconst editModal = useModal()\nconst deleteModal = useModal()\n\nconst openRenameModal = (uid: Workspace['uid']) => {\n const workspace = workspaces[uid]\n if (!workspace) {\n return\n }\n\n tempName.value = workspace.name\n tempUid.value = uid\n editModal.show()\n}\n\nconst handleWorkspaceEdit = (name: string) => {\n if (!name.trim()) {\n return\n }\n\n workspaceMutators.edit(tempUid.value, 'name', name.trim())\n editModal.hide()\n}\n\nconst openDeleteModal = (uid: Workspace['uid']) => {\n const workspace = workspaces[uid]\n if (!workspace) {\n return\n }\n\n tempName.value = workspace.name\n tempUid.value = uid\n deleteModal.show()\n}\n\nconst deleteWorkspace = async () => {\n if (!isLastWorkspace.value) {\n const deletedActiveWorkspace = activeWorkspace.value?.uid === tempUid.value\n const currentWorkspaces = { ...workspaces }\n delete currentWorkspaces[tempUid.value]\n\n workspaceMutators.delete(tempUid.value)\n\n // Switch to another workspace if the active one is deleted\n if (deletedActiveWorkspace) {\n const newWorkspaceUid = Object.keys(currentWorkspaces)[0]\n\n await push({\n name: 'workspace',\n params: {\n workspace: newWorkspaceUid,\n },\n })\n }\n }\n\n deleteModal.hide()\n}\n</script>\n\n<template>\n <div>\n <div class=\"flex w-[inherit] items-center text-base\">\n <ScalarDropdown>\n <ScalarButton\n class=\"text-c-1 hover:bg-b-2 line-clamp-1 h-full w-fit justify-start px-1.5 py-1.5 font-normal\"\n variant=\"ghost\">\n <div class=\"m-0 flex items-center gap-1.5 font-bold\">\n <h2 class=\"line-clamp-1 text-left\">\n {{ activeWorkspace?.name }}\n </h2>\n </div>\n </ScalarButton>\n\n <!-- Workspace list -->\n <template #items>\n <ScalarDropdownItem\n v-for=\"(workspace, uid) in workspaces\"\n :key=\"uid\"\n class=\"group/item flex w-full items-center gap-1.5 overflow-hidden text-ellipsis whitespace-nowrap\"\n @click.stop=\"updateSelected(workspace.uid)\">\n <ScalarListboxCheckbox :selected=\"activeWorkspace?.uid === uid\" />\n <span class=\"overflow-hidden text-ellipsis\">{{\n workspace.name\n }}</span>\n <ScalarDropdown\n placement=\"right-start\"\n teleport>\n <ScalarButton\n class=\"hover:bg-b-3 -mr-1 ml-auto aspect-square h-fit px-0.5 py-0 group-hover/item:flex\"\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\">\n <ScalarIcon\n icon=\"Ellipses\"\n size=\"sm\" />\n </ScalarButton>\n <template #items>\n <ScalarDropdownItem\n class=\"flex gap-2\"\n @mousedown=\"openRenameModal(workspace.uid)\"\n @touchend.prevent=\"openRenameModal(workspace.uid)\">\n <ScalarIcon\n class=\"inline-flex\"\n icon=\"Edit\"\n size=\"md\"\n thickness=\"1.5\" />\n <span>Rename</span>\n </ScalarDropdownItem>\n <ScalarDropdownItem\n v-if=\"!isLastWorkspace\"\n class=\"flex gap-2\"\n @mousedown.prevent=\"openDeleteModal(workspace.uid)\"\n @touchend.prevent=\"openDeleteModal(workspace.uid)\">\n <ScalarIcon\n class=\"inline-flex\"\n icon=\"Delete\"\n size=\"md\"\n thickness=\"1.5\" />\n <span>Delete</span>\n </ScalarDropdownItem>\n </template>\n </ScalarDropdown>\n </ScalarDropdownItem>\n <ScalarDropdownDivider />\n\n <!-- Add new workspace -->\n <ScalarDropdownItem\n class=\"flex items-center gap-1.5\"\n @click=\"createNewWorkspace\">\n <div class=\"flex h-4 w-4 items-center justify-center\">\n <ScalarIcon\n icon=\"Add\"\n size=\"sm\" />\n </div>\n <span>Create Workspace</span>\n </ScalarDropdownItem>\n </template>\n </ScalarDropdown>\n </div>\n <ScalarModal\n :size=\"'xxs'\"\n :state=\"deleteModal\"\n title=\"Delete workspace\">\n <DeleteSidebarListElement\n :variableName=\"tempName\"\n warningMessage=\"This cannot be undone. You're about to delete the workspace and everything inside it.\"\n @close=\"deleteModal.hide()\"\n @delete=\"deleteWorkspace\" />\n </ScalarModal>\n <ScalarModal\n :size=\"'xxs'\"\n :state=\"editModal\"\n title=\"Rename Workspace\">\n <EditSidebarListElement\n :name=\"tempName\"\n @close=\"editModal.hide()\"\n @edit=\"handleWorkspaceEdit\" />\n </ScalarModal>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;ECoBA,MAAM,EAAE,oBAAoB,mBAAkB;EAC9C,MAAM,EAAE,YAAY,mBAAmB,WAAW,cAAa;EAC/D,MAAM,EAAE,SAAS,WAAU;EAE3B,MAAM,kBAAkB,QAA0B;AAChD,OAAI,QAAQ,gBAAgB,OAAO,IACjC;AAGF,QAAK;IACH,MAAM;IACN,QAAQ,EACN,WAAW,KACZ;IACF,CAAA;;EAGH,MAAM,kBAAkB,eAAe,OAAO,KAAK,WAAW,CAAC,WAAW,EAAC;EAE3E,MAAM,2BACJ,OAAO,eAAe,KAAK,EAAE,aAAa,oBAAoB,CAAA;EAEhE,MAAM,WAAW,IAAI,GAAE;EACvB,MAAM,UAAU,IAAI,GAAsB;EAC1C,MAAM,YAAY,UAAS;EAC3B,MAAM,cAAc,UAAS;EAE7B,MAAM,mBAAmB,QAA0B;GACjD,MAAM,YAAY,WAAW;AAC7B,OAAI,CAAC,UACH;AAGF,YAAS,QAAQ,UAAU;AAC3B,WAAQ,QAAQ;AAChB,aAAU,MAAK;;EAGjB,MAAM,uBAAuB,SAAiB;AAC5C,OAAI,CAAC,KAAK,MAAM,CACd;AAGF,qBAAkB,KAAK,QAAQ,OAAO,QAAQ,KAAK,MAAM,CAAA;AACzD,aA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AAe;MACd,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,YAAW,CAAC,MAAI;MACvB,UAAQ;;;;IAEb,YAQc,MAAA,YAAA,EAAA;KAPX,MAAM;KACN,OAAO,MAAA,UAAS;KACjB,OAAM;;4BAI0B,CAHhC,YAGgC,gCAAA;MAF7B,MAAM,SAAA;MACN,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,UAAS,CAAC,MAAI;MACrB,QAAM"}
|
|
1
|
+
{"version":3,"file":"components-DfJHvSLM.js","names":[],"sources":["../src/views/Request/components/WorkspaceDropdown.vue","../src/views/Request/components/WorkspaceDropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n ScalarButton,\n ScalarDropdown,\n ScalarDropdownDivider,\n ScalarDropdownItem,\n ScalarIcon,\n ScalarListboxCheckbox,\n ScalarModal,\n useModal,\n} from '@scalar/components'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { computed, ref } from 'vue'\nimport { useRouter } from 'vue-router'\n\nimport DeleteSidebarListElement from '@/components/Sidebar/Actions/DeleteSidebarListElement.vue'\nimport EditSidebarListElement from '@/components/Sidebar/Actions/EditSidebarListElement.vue'\nimport { useWorkspace } from '@/store'\nimport { useActiveEntities } from '@/store/active-entities'\n\nconst { activeWorkspace } = useActiveEntities()\nconst { workspaces, workspaceMutators, events } = useWorkspace()\nconst { push } = useRouter()\n\nconst updateSelected = (uid: Workspace['uid']) => {\n if (uid === activeWorkspace.value?.uid) {\n return\n }\n\n push({\n name: 'workspace',\n params: {\n workspace: uid,\n },\n })\n}\n\nconst isLastWorkspace = computed(() => Object.keys(workspaces).length === 1)\n\nconst createNewWorkspace = () =>\n events.commandPalette.emit({ commandName: 'Create Workspace' })\n\nconst tempName = ref('')\nconst tempUid = ref('' as Workspace['uid'])\nconst editModal = useModal()\nconst deleteModal = useModal()\n\nconst openRenameModal = (uid: Workspace['uid']) => {\n const workspace = workspaces[uid]\n if (!workspace) {\n return\n }\n\n tempName.value = workspace.name\n tempUid.value = uid\n editModal.show()\n}\n\nconst handleWorkspaceEdit = (name: string) => {\n if (!name.trim()) {\n return\n }\n\n workspaceMutators.edit(tempUid.value, 'name', name.trim())\n editModal.hide()\n}\n\nconst openDeleteModal = (uid: Workspace['uid']) => {\n const workspace = workspaces[uid]\n if (!workspace) {\n return\n }\n\n tempName.value = workspace.name\n tempUid.value = uid\n deleteModal.show()\n}\n\nconst deleteWorkspace = async () => {\n if (!isLastWorkspace.value) {\n const deletedActiveWorkspace = activeWorkspace.value?.uid === tempUid.value\n const currentWorkspaces = { ...workspaces }\n delete currentWorkspaces[tempUid.value]\n\n workspaceMutators.delete(tempUid.value)\n\n // Switch to another workspace if the active one is deleted\n if (deletedActiveWorkspace) {\n const newWorkspaceUid = Object.keys(currentWorkspaces)[0]\n\n await push({\n name: 'workspace',\n params: {\n workspace: newWorkspaceUid,\n },\n })\n }\n }\n\n deleteModal.hide()\n}\n</script>\n\n<template>\n <div>\n <div class=\"flex w-[inherit] items-center text-base\">\n <ScalarDropdown>\n <ScalarButton\n class=\"text-c-1 hover:bg-b-2 line-clamp-1 h-full w-fit justify-start px-1.5 py-1.5 font-normal\"\n variant=\"ghost\">\n <div class=\"m-0 flex items-center gap-1.5 font-bold\">\n <h2 class=\"line-clamp-1 text-left\">\n {{ activeWorkspace?.name }}\n </h2>\n </div>\n </ScalarButton>\n\n <!-- Workspace list -->\n <template #items>\n <ScalarDropdownItem\n v-for=\"(workspace, uid) in workspaces\"\n :key=\"uid\"\n class=\"group/item flex w-full items-center gap-1.5 overflow-hidden text-ellipsis whitespace-nowrap\"\n @click.stop=\"updateSelected(workspace.uid)\">\n <ScalarListboxCheckbox :selected=\"activeWorkspace?.uid === uid\" />\n <span class=\"overflow-hidden text-ellipsis\">{{\n workspace.name\n }}</span>\n <ScalarDropdown\n placement=\"right-start\"\n teleport>\n <ScalarButton\n class=\"hover:bg-b-3 -mr-1 ml-auto aspect-square h-fit px-0.5 py-0 group-hover/item:flex\"\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\">\n <ScalarIcon\n icon=\"Ellipses\"\n size=\"sm\" />\n </ScalarButton>\n <template #items>\n <ScalarDropdownItem\n class=\"flex gap-2\"\n @mousedown=\"openRenameModal(workspace.uid)\"\n @touchend.prevent=\"openRenameModal(workspace.uid)\">\n <ScalarIcon\n class=\"inline-flex\"\n icon=\"Edit\"\n size=\"md\"\n thickness=\"1.5\" />\n <span>Rename</span>\n </ScalarDropdownItem>\n <ScalarDropdownItem\n v-if=\"!isLastWorkspace\"\n class=\"flex gap-2\"\n @mousedown.prevent=\"openDeleteModal(workspace.uid)\"\n @touchend.prevent=\"openDeleteModal(workspace.uid)\">\n <ScalarIcon\n class=\"inline-flex\"\n icon=\"Delete\"\n size=\"md\"\n thickness=\"1.5\" />\n <span>Delete</span>\n </ScalarDropdownItem>\n </template>\n </ScalarDropdown>\n </ScalarDropdownItem>\n <ScalarDropdownDivider />\n\n <!-- Add new workspace -->\n <ScalarDropdownItem\n class=\"flex items-center gap-1.5\"\n @click=\"createNewWorkspace\">\n <div class=\"flex h-4 w-4 items-center justify-center\">\n <ScalarIcon\n icon=\"Add\"\n size=\"sm\" />\n </div>\n <span>Create Workspace</span>\n </ScalarDropdownItem>\n </template>\n </ScalarDropdown>\n </div>\n <ScalarModal\n :size=\"'xxs'\"\n :state=\"deleteModal\"\n title=\"Delete workspace\">\n <DeleteSidebarListElement\n :variableName=\"tempName\"\n warningMessage=\"This cannot be undone. You're about to delete the workspace and everything inside it.\"\n @close=\"deleteModal.hide()\"\n @delete=\"deleteWorkspace\" />\n </ScalarModal>\n <ScalarModal\n :size=\"'xxs'\"\n :state=\"editModal\"\n title=\"Rename Workspace\">\n <EditSidebarListElement\n :name=\"tempName\"\n @close=\"editModal.hide()\"\n @edit=\"handleWorkspaceEdit\" />\n </ScalarModal>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport {\n ScalarButton,\n ScalarDropdown,\n ScalarDropdownDivider,\n ScalarDropdownItem,\n ScalarIcon,\n ScalarListboxCheckbox,\n ScalarModal,\n useModal,\n} from '@scalar/components'\nimport type { Workspace } from '@scalar/oas-utils/entities/workspace'\nimport { computed, ref } from 'vue'\nimport { useRouter } from 'vue-router'\n\nimport DeleteSidebarListElement from '@/components/Sidebar/Actions/DeleteSidebarListElement.vue'\nimport EditSidebarListElement from '@/components/Sidebar/Actions/EditSidebarListElement.vue'\nimport { useWorkspace } from '@/store'\nimport { useActiveEntities } from '@/store/active-entities'\n\nconst { activeWorkspace } = useActiveEntities()\nconst { workspaces, workspaceMutators, events } = useWorkspace()\nconst { push } = useRouter()\n\nconst updateSelected = (uid: Workspace['uid']) => {\n if (uid === activeWorkspace.value?.uid) {\n return\n }\n\n push({\n name: 'workspace',\n params: {\n workspace: uid,\n },\n })\n}\n\nconst isLastWorkspace = computed(() => Object.keys(workspaces).length === 1)\n\nconst createNewWorkspace = () =>\n events.commandPalette.emit({ commandName: 'Create Workspace' })\n\nconst tempName = ref('')\nconst tempUid = ref('' as Workspace['uid'])\nconst editModal = useModal()\nconst deleteModal = useModal()\n\nconst openRenameModal = (uid: Workspace['uid']) => {\n const workspace = workspaces[uid]\n if (!workspace) {\n return\n }\n\n tempName.value = workspace.name\n tempUid.value = uid\n editModal.show()\n}\n\nconst handleWorkspaceEdit = (name: string) => {\n if (!name.trim()) {\n return\n }\n\n workspaceMutators.edit(tempUid.value, 'name', name.trim())\n editModal.hide()\n}\n\nconst openDeleteModal = (uid: Workspace['uid']) => {\n const workspace = workspaces[uid]\n if (!workspace) {\n return\n }\n\n tempName.value = workspace.name\n tempUid.value = uid\n deleteModal.show()\n}\n\nconst deleteWorkspace = async () => {\n if (!isLastWorkspace.value) {\n const deletedActiveWorkspace = activeWorkspace.value?.uid === tempUid.value\n const currentWorkspaces = { ...workspaces }\n delete currentWorkspaces[tempUid.value]\n\n workspaceMutators.delete(tempUid.value)\n\n // Switch to another workspace if the active one is deleted\n if (deletedActiveWorkspace) {\n const newWorkspaceUid = Object.keys(currentWorkspaces)[0]\n\n await push({\n name: 'workspace',\n params: {\n workspace: newWorkspaceUid,\n },\n })\n }\n }\n\n deleteModal.hide()\n}\n</script>\n\n<template>\n <div>\n <div class=\"flex w-[inherit] items-center text-base\">\n <ScalarDropdown>\n <ScalarButton\n class=\"text-c-1 hover:bg-b-2 line-clamp-1 h-full w-fit justify-start px-1.5 py-1.5 font-normal\"\n variant=\"ghost\">\n <div class=\"m-0 flex items-center gap-1.5 font-bold\">\n <h2 class=\"line-clamp-1 text-left\">\n {{ activeWorkspace?.name }}\n </h2>\n </div>\n </ScalarButton>\n\n <!-- Workspace list -->\n <template #items>\n <ScalarDropdownItem\n v-for=\"(workspace, uid) in workspaces\"\n :key=\"uid\"\n class=\"group/item flex w-full items-center gap-1.5 overflow-hidden text-ellipsis whitespace-nowrap\"\n @click.stop=\"updateSelected(workspace.uid)\">\n <ScalarListboxCheckbox :selected=\"activeWorkspace?.uid === uid\" />\n <span class=\"overflow-hidden text-ellipsis\">{{\n workspace.name\n }}</span>\n <ScalarDropdown\n placement=\"right-start\"\n teleport>\n <ScalarButton\n class=\"hover:bg-b-3 -mr-1 ml-auto aspect-square h-fit px-0.5 py-0 group-hover/item:flex\"\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\">\n <ScalarIcon\n icon=\"Ellipses\"\n size=\"sm\" />\n </ScalarButton>\n <template #items>\n <ScalarDropdownItem\n class=\"flex gap-2\"\n @mousedown=\"openRenameModal(workspace.uid)\"\n @touchend.prevent=\"openRenameModal(workspace.uid)\">\n <ScalarIcon\n class=\"inline-flex\"\n icon=\"Edit\"\n size=\"md\"\n thickness=\"1.5\" />\n <span>Rename</span>\n </ScalarDropdownItem>\n <ScalarDropdownItem\n v-if=\"!isLastWorkspace\"\n class=\"flex gap-2\"\n @mousedown.prevent=\"openDeleteModal(workspace.uid)\"\n @touchend.prevent=\"openDeleteModal(workspace.uid)\">\n <ScalarIcon\n class=\"inline-flex\"\n icon=\"Delete\"\n size=\"md\"\n thickness=\"1.5\" />\n <span>Delete</span>\n </ScalarDropdownItem>\n </template>\n </ScalarDropdown>\n </ScalarDropdownItem>\n <ScalarDropdownDivider />\n\n <!-- Add new workspace -->\n <ScalarDropdownItem\n class=\"flex items-center gap-1.5\"\n @click=\"createNewWorkspace\">\n <div class=\"flex h-4 w-4 items-center justify-center\">\n <ScalarIcon\n icon=\"Add\"\n size=\"sm\" />\n </div>\n <span>Create Workspace</span>\n </ScalarDropdownItem>\n </template>\n </ScalarDropdown>\n </div>\n <ScalarModal\n :size=\"'xxs'\"\n :state=\"deleteModal\"\n title=\"Delete workspace\">\n <DeleteSidebarListElement\n :variableName=\"tempName\"\n warningMessage=\"This cannot be undone. You're about to delete the workspace and everything inside it.\"\n @close=\"deleteModal.hide()\"\n @delete=\"deleteWorkspace\" />\n </ScalarModal>\n <ScalarModal\n :size=\"'xxs'\"\n :state=\"editModal\"\n title=\"Rename Workspace\">\n <EditSidebarListElement\n :name=\"tempName\"\n @close=\"editModal.hide()\"\n @edit=\"handleWorkspaceEdit\" />\n </ScalarModal>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;ECoBA,MAAM,EAAE,oBAAoB,mBAAkB;EAC9C,MAAM,EAAE,YAAY,mBAAmB,WAAW,cAAa;EAC/D,MAAM,EAAE,SAAS,WAAU;EAE3B,MAAM,kBAAkB,QAA0B;AAChD,OAAI,QAAQ,gBAAgB,OAAO,IACjC;AAGF,QAAK;IACH,MAAM;IACN,QAAQ,EACN,WAAW,KACZ;IACF,CAAA;;EAGH,MAAM,kBAAkB,eAAe,OAAO,KAAK,WAAW,CAAC,WAAW,EAAC;EAE3E,MAAM,2BACJ,OAAO,eAAe,KAAK,EAAE,aAAa,oBAAoB,CAAA;EAEhE,MAAM,WAAW,IAAI,GAAE;EACvB,MAAM,UAAU,IAAI,GAAsB;EAC1C,MAAM,YAAY,UAAS;EAC3B,MAAM,cAAc,UAAS;EAE7B,MAAM,mBAAmB,QAA0B;GACjD,MAAM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M,CAHJ,mBAEK,MAFL,YAEK,gBADA,MAAA,gBAAe,EAAE,KAAI,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA;;;;;IAuElC,YASc,MAAA,YAAA,EAAA;KARX,MAAM;KACN,OAAO,MAAA,YAAW;KACnB,OAAM;;4BAKwB,CAJ9B,YAI8B,kCAAA;MAH3B,cAAc,SAAA;MACf,gBAAe;MACd,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,YAAW,CAAC,MAAI;MACvB,UAAQ;;;;IAEb,YAQc,MAAA,YAAA,EAAA;KAPX,MAAM;KACN,OAAO,MAAA,UAAS;KACjB,OAAM;;4BAI0B,CAHhC,YAGgC,gCAAA;MAF7B,MAAM,SAAA;MACN,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,UAAS,CAAC,MAAI;MACrB,QAAM"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { n as getEnvironmentVariables, t as getServerUrl } from "./get-server-url-UVN-dx79.js";
|
|
2
|
+
import { mergeUrls } from "@scalar/helpers/url/merge-urls";
|
|
3
|
+
import { replaceVariables } from "@scalar/helpers/regex/replace-variables";
|
|
4
|
+
//#region src/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.ts
|
|
5
|
+
/**
|
|
6
|
+
* Reserved characters we can safely decode in query values when OpenAPI
|
|
7
|
+
* `allowReserved` is enabled.
|
|
8
|
+
*
|
|
9
|
+
* We intentionally keep percent-encodings for characters that can break query
|
|
10
|
+
* parsing (`#`, `&`, `=`, `?`, `[`, `]`) or change x-www-form-urlencoded
|
|
11
|
+
* semantics (`+`).
|
|
12
|
+
*
|
|
13
|
+
* @see https://spec.openapis.org/oas/v3.1.0.html#fixed-fields-10
|
|
14
|
+
*/
|
|
15
|
+
var DECODABLE_RESERVED_CHARACTERS_BY_PERCENT_ENCODING = {
|
|
16
|
+
"21": "!",
|
|
17
|
+
"24": "$",
|
|
18
|
+
"27": "'",
|
|
19
|
+
"28": "(",
|
|
20
|
+
"29": ")",
|
|
21
|
+
"2A": "*",
|
|
22
|
+
"2C": ",",
|
|
23
|
+
"2F": "/",
|
|
24
|
+
"3A": ":",
|
|
25
|
+
"3B": ";",
|
|
26
|
+
"40": "@"
|
|
27
|
+
};
|
|
28
|
+
var decodeReservedCharacters = (value) => value.replace(/%([0-9A-Fa-f]{2})/g, (match, code) => DECODABLE_RESERVED_CHARACTERS_BY_PERCENT_ENCODING[code.toUpperCase()] ?? match);
|
|
29
|
+
var decodeQueryKey = (key) => {
|
|
30
|
+
try {
|
|
31
|
+
return decodeURIComponent(key.replaceAll("+", "%20"));
|
|
32
|
+
} catch {
|
|
33
|
+
return key;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Decodes reserved character percent-encodings only for query keys marked with
|
|
38
|
+
* OpenAPI's `allowReserved: true`.
|
|
39
|
+
*/
|
|
40
|
+
var applyAllowReservedToUrl = (url, allowReservedQueryParameters) => {
|
|
41
|
+
if (allowReservedQueryParameters.size === 0) return url;
|
|
42
|
+
const queryStart = url.indexOf("?");
|
|
43
|
+
if (queryStart === -1) return url;
|
|
44
|
+
const hashStart = url.indexOf("#", queryStart);
|
|
45
|
+
const urlPrefix = url.slice(0, queryStart + 1);
|
|
46
|
+
const query = hashStart === -1 ? url.slice(queryStart + 1) : url.slice(queryStart + 1, hashStart);
|
|
47
|
+
const hash = hashStart === -1 ? "" : url.slice(hashStart);
|
|
48
|
+
if (!query) return url;
|
|
49
|
+
return `${urlPrefix}${query.split("&").map((segment) => {
|
|
50
|
+
if (!segment) return segment;
|
|
51
|
+
const equalsIndex = segment.indexOf("=");
|
|
52
|
+
const rawKey = equalsIndex === -1 ? segment : segment.slice(0, equalsIndex);
|
|
53
|
+
const key = decodeQueryKey(rawKey);
|
|
54
|
+
if (!allowReservedQueryParameters.has(key) || equalsIndex === -1) return segment;
|
|
55
|
+
return `${rawKey}=${decodeReservedCharacters(segment.slice(equalsIndex + 1))}`;
|
|
56
|
+
}).join("&")}${hash}`;
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/v2/blocks/operation-block/helpers/get-resolved-url.ts
|
|
60
|
+
/**
|
|
61
|
+
* Resolves and constructs the final request URL using the provided environment, server, path,
|
|
62
|
+
* path variables, and optional query parameters.
|
|
63
|
+
*
|
|
64
|
+
* - Environment variables and path variables are used to replace placeholders in the path string.
|
|
65
|
+
* - The server URL is dynamically resolved (may apply env variables).
|
|
66
|
+
* - urlParams are optionally appended as the query string.
|
|
67
|
+
*
|
|
68
|
+
* @param environment The current environment containing variable values.
|
|
69
|
+
* @param server The selected server object; can be null.
|
|
70
|
+
* @param path The raw path string from the OpenAPI document (may contain variables).
|
|
71
|
+
* @param pathVariables Map of path variable values (e.g., { petId: '5' }).
|
|
72
|
+
* @param urlParams Optional query parameters as URLSearchParams.
|
|
73
|
+
* @returns Fully resolved URL as a string.
|
|
74
|
+
*/
|
|
75
|
+
var getResolvedUrl = ({ environment, server, path, pathVariables, allowReservedQueryParameters, urlParams }) => {
|
|
76
|
+
const environmentVariables = getEnvironmentVariables(environment);
|
|
77
|
+
return applyAllowReservedToUrl(mergeUrls(getServerUrl(server, environmentVariables), replaceVariables(path, {
|
|
78
|
+
...environmentVariables,
|
|
79
|
+
...pathVariables
|
|
80
|
+
}), urlParams), allowReservedQueryParameters ?? /* @__PURE__ */ new Set());
|
|
81
|
+
};
|
|
82
|
+
//#endregion
|
|
83
|
+
export { getResolvedUrl as t };
|
|
84
|
+
|
|
85
|
+
//# sourceMappingURL=get-resolved-url-SybDPV0U.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-resolved-url-SybDPV0U.js","names":[],"sources":["../src/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url.ts","../src/v2/blocks/operation-block/helpers/get-resolved-url.ts"],"sourcesContent":["/**\n * Reserved characters we can safely decode in query values when OpenAPI\n * `allowReserved` is enabled.\n *\n * We intentionally keep percent-encodings for characters that can break query\n * parsing (`#`, `&`, `=`, `?`, `[`, `]`) or change x-www-form-urlencoded\n * semantics (`+`).\n *\n * @see https://spec.openapis.org/oas/v3.1.0.html#fixed-fields-10\n */\nconst DECODABLE_RESERVED_CHARACTERS_BY_PERCENT_ENCODING: Record<string, string> = {\n '21': '!',\n '24': '$',\n '27': \"'\",\n '28': '(',\n '29': ')',\n '2A': '*',\n '2C': ',',\n '2F': '/',\n '3A': ':',\n '3B': ';',\n '40': '@',\n}\n\nconst decodeReservedCharacters = (value: string): string =>\n value.replace(\n /%([0-9A-Fa-f]{2})/g,\n (match, code: string) => DECODABLE_RESERVED_CHARACTERS_BY_PERCENT_ENCODING[code.toUpperCase()] ?? match,\n )\n\nconst decodeQueryKey = (key: string): string => {\n try {\n return decodeURIComponent(key.replaceAll('+', '%20'))\n } catch {\n return key\n }\n}\n\n/**\n * Decodes reserved character percent-encodings only for query keys marked with\n * OpenAPI's `allowReserved: true`.\n */\nexport const applyAllowReservedToUrl = (url: string, allowReservedQueryParameters: Set<string>): string => {\n if (allowReservedQueryParameters.size === 0) {\n return url\n }\n\n const queryStart = url.indexOf('?')\n if (queryStart === -1) {\n return url\n }\n\n const hashStart = url.indexOf('#', queryStart)\n const urlPrefix = url.slice(0, queryStart + 1)\n const query = hashStart === -1 ? url.slice(queryStart + 1) : url.slice(queryStart + 1, hashStart)\n const hash = hashStart === -1 ? '' : url.slice(hashStart)\n\n if (!query) {\n return url\n }\n\n const decodedQuery = query\n .split('&')\n .map((segment) => {\n if (!segment) {\n return segment\n }\n\n const equalsIndex = segment.indexOf('=')\n const rawKey = equalsIndex === -1 ? segment : segment.slice(0, equalsIndex)\n const key = decodeQueryKey(rawKey)\n\n if (!allowReservedQueryParameters.has(key) || equalsIndex === -1) {\n return segment\n }\n\n const rawValue = segment.slice(equalsIndex + 1)\n return `${rawKey}=${decodeReservedCharacters(rawValue)}`\n })\n .join('&')\n\n return `${urlPrefix}${decodedQuery}${hash}`\n}\n","import { replaceVariables } from '@scalar/helpers/regex/replace-variables'\nimport { mergeUrls } from '@scalar/helpers/url/merge-urls'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/server'\n\nimport { applyAllowReservedToUrl } from '@/v2/blocks/operation-block/helpers/apply-allow-reserved-to-url'\nimport { getEnvironmentVariables } from '@/v2/blocks/operation-block/helpers/get-environment-variables'\nimport { getServerUrl } from '@/v2/blocks/operation-block/helpers/get-server-url'\n\n/**\n * Resolves and constructs the final request URL using the provided environment, server, path,\n * path variables, and optional query parameters.\n *\n * - Environment variables and path variables are used to replace placeholders in the path string.\n * - The server URL is dynamically resolved (may apply env variables).\n * - urlParams are optionally appended as the query string.\n *\n * @param environment The current environment containing variable values.\n * @param server The selected server object; can be null.\n * @param path The raw path string from the OpenAPI document (may contain variables).\n * @param pathVariables Map of path variable values (e.g., { petId: '5' }).\n * @param urlParams Optional query parameters as URLSearchParams.\n * @returns Fully resolved URL as a string.\n */\nexport const getResolvedUrl = ({\n environment,\n server,\n path,\n pathVariables,\n allowReservedQueryParameters,\n urlParams,\n}: {\n environment: XScalarEnvironment\n server: ServerObject | null\n path: string\n pathVariables: Record<string, string>\n allowReservedQueryParameters?: Set<string>\n urlParams?: URLSearchParams\n}) => {\n const environmentVariables = getEnvironmentVariables(environment)\n const serverUrl = getServerUrl(server, environmentVariables)\n const pathWithVariables = replaceVariables(path, { ...environmentVariables, ...pathVariables })\n const mergedUrl = mergeUrls(serverUrl, pathWithVariables, urlParams)\n return applyAllowReservedToUrl(mergedUrl, allowReservedQueryParameters ?? new Set())\n}\n"],"mappings":";;;;;;;;;;;;;;AAUA,IAAM,oDAA4E;CAChF,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACP;AAED,IAAM,4BAA4B,UAChC,MAAM,QACJ,uBACC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|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-server-url-
|
|
1
|
+
{"version":3,"file":"get-server-url-UVN-dx79.js","names":[],"sources":["../src/v2/blocks/operation-block/helpers/get-environment-variables.ts","../src/v2/blocks/operation-block/helpers/get-server-url.ts"],"sourcesContent":["import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\n\n/**\n * Flattens the environment variables array into a key-value object.\n * If a variable value is a string, use it directly; otherwise, use its default value.\n *\n * @returns An object mapping variable names to their resolved values.\n */\nexport const getEnvironmentVariables = (environment: XScalarEnvironment) => {\n return environment.variables.reduce(\n (acc, curr) => {\n acc[curr.name] = typeof curr.value === 'string' ? curr.value : curr.value.default\n return acc\n },\n {} as Record<string, string>,\n )\n}\n","import { replaceVariables } from '@scalar/helpers/regex/replace-variables'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/server'\nimport { objectEntries } from '@vueuse/core'\n\nexport const getServerUrl = (server: ServerObject | null, environmentVariables: Record<string, string>) => {\n /** Extract the server variables default values*/\n const serverVariables = objectEntries(server?.variables ?? {}).reduce(\n (acc, [name, variable]) => {\n if (variable.default) {\n acc[name] = variable.default\n }\n return acc\n },\n {} as Record<string, string>,\n )\n\n return replaceVariables(server?.url ?? '', { ...environmentVariables, ...serverVariables })\n}\n"],"mappings":";;;;;;;;;AAQA,IAAa,2BAA2B,gBAAoC;AAC1E,QAAO,YAAY,UAAU,QAC1B,KAAK,SAAS;AACb,MAAI,KAAK,QAAQ,OAAO,KAAK,UAAU,WAAW,KAAK,QAAQ,KAAK,MAAM;AAC1E,SAAO;IAET,EAAE,CACH;;;;ACXH,IAAa,gBAAgB,QAA6B,yBAAiD;;CAEzG,MAAM,kBAAkB,cAAc,QAAQ,aAAa,EAAE,CAAC,CAAC,QAC5D,KAAK,CAAC,MAAM,cAAc;AACzB,MAAI,SAAS,QACX,KAAI,QAAQ,SAAS;AAEvB,SAAO;IAET,EAAE,CACH;AAED,QAAO,iBAAiB,QAAQ,OAAO,IAAI;EAAE,GAAG;EAAsB,GAAG;EAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./CommandPalette-
|
|
2
|
-
import { r as useWorkspace } from "./store-
|
|
3
|
-
import { n as ApiClientApp_default, t as createApiClientApp } from "./App-
|
|
1
|
+
import "./CommandPalette-BiA0IgO8.js";
|
|
2
|
+
import { r as useWorkspace } from "./store-DaPoVtIS.js";
|
|
3
|
+
import { n as ApiClientApp_default, t as createApiClientApp } from "./App-BpNPKHmM.js";
|
|
4
4
|
import "./HttpMethod-rnWEgC3T.js";
|
|
5
|
-
import "./MainLayout-
|
|
5
|
+
import "./MainLayout-oMIJ5QXF.js";
|
|
6
6
|
import "./ModalClientContainer-qHsZi4wQ.js";
|
|
7
|
-
import { t as createApiClientModal } from "./Modal-
|
|
7
|
+
import { t as createApiClientModal } from "./Modal-DkOa_KK0.js";
|
|
8
8
|
export { ApiClientApp_default as ApiClientApp, createApiClientApp, createApiClientModal, useWorkspace };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../CommandPalette-
|
|
2
|
-
import { n as ApiClientApp_default, t as createApiClientApp } from "../../App-
|
|
1
|
+
import "../../CommandPalette-BiA0IgO8.js";
|
|
2
|
+
import { n as ApiClientApp_default, t as createApiClientApp } from "../../App-BpNPKHmM.js";
|
|
3
3
|
import "../../HttpMethod-rnWEgC3T.js";
|
|
4
|
-
import "../../MainLayout-
|
|
4
|
+
import "../../MainLayout-oMIJ5QXF.js";
|
|
5
5
|
export { ApiClientApp_default as ApiClientApp, createApiClientApp };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "../../CommandPalette-
|
|
2
|
-
import { D as routes, O as saveActiveWorkspace, _ as createApiClient, d as handleHotKeyDown, r as useWorkspace, w as useActiveEntities } from "../../store-
|
|
1
|
+
import "../../CommandPalette-BiA0IgO8.js";
|
|
2
|
+
import { D as routes, O as saveActiveWorkspace, _ as createApiClient, d as handleHotKeyDown, r as useWorkspace, w as useActiveEntities } from "../../store-DaPoVtIS.js";
|
|
3
3
|
import { r as useSidebar } from "../../useSidebar-DLTwHDI-.js";
|
|
4
4
|
import "../../HttpMethod-rnWEgC3T.js";
|
|
5
|
-
import { t as MainLayout_default } from "../../MainLayout-
|
|
5
|
+
import { t as MainLayout_default } from "../../MainLayout-oMIJ5QXF.js";
|
|
6
6
|
import { t as analytics } from "../../analytics-BZimCWcw.js";
|
|
7
|
-
import { t as ImportCollectionListener_default } from "../../ImportCollection-
|
|
7
|
+
import { t as ImportCollectionListener_default } from "../../ImportCollection-BIYMxB9Q.js";
|
|
8
8
|
import { KeepAlive, computed, createBlock, createCommentVNode, createElementVNode, createVNode, defineComponent, onBeforeMount, onBeforeUnmount, onMounted, openBlock, resolveDynamicComponent, unref, watch, withCtx } from "vue";
|
|
9
9
|
import { ScalarTeleportRoot, addScalarClassesToHeadless } from "@scalar/components";
|
|
10
10
|
import { getThemeStyles } from "@scalar/themes";
|
package/dist/libs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as createApiClient, c as isPostmanCollection, d as handleHotKeyDown, f as isInput, g as getEnvColor, h as parseEnvVariables, l as DEFAULT_HOTKEYS, m as isUrl, o as convertPostmanToOpenApi, p as getOpenApiDocumentDetails, s as getPostmanDocumentDetails, u as getModifiers, v as loadAllResources, x as createEventBus, y as findRequestByPathMethod } from "../store-
|
|
1
|
+
import { _ as createApiClient, c as isPostmanCollection, d as handleHotKeyDown, f as isInput, g as getEnvColor, h as parseEnvVariables, l as DEFAULT_HOTKEYS, m as isUrl, o as convertPostmanToOpenApi, p as getOpenApiDocumentDetails, s as getPostmanDocumentDetails, u as getModifiers, v as loadAllResources, x as createEventBus, y as findRequestByPathMethod } from "../store-DaPoVtIS.js";
|
|
2
2
|
import { a as ERRORS, i as normalizeHeaders, n as decodeBuffer, o as normalizeError, r as formatHeaderKey, s as prettyErrorMessage, t as createRequestOperation } from "../send-request-BsTfRiBC.js";
|
|
3
3
|
import { n as formatMs, t as formatBytes } from "../formatters-DOGXZq9R.js";
|
|
4
4
|
import { t as parseCurlCommand } from "../parse-curl-BtypQT3D.js";
|
|
@@ -3,15 +3,15 @@ import { i as isElectron } from "./set-request-cookies-BJJhsU4A.js";
|
|
|
3
3
|
import { i as isTextMediaType } from "./consts-CyGRb9dl.js";
|
|
4
4
|
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-BmmBcIzD.js";
|
|
5
5
|
import { t as OpenApiClientButton_default } from "./components-ChixwQhN.js";
|
|
6
|
-
import { C as getDefaultHeaders, _ as serializeSimpleStyle, b as deSerializeParameter, f as serializeContentValue, g as serializePipeDelimitedStyle, h as serializeFormStyleForCookies, m as serializeFormStyle, o as generateClientOptions, p as serializeDeepObjectStyle, v as serializeSpaceDelimitedStyle, w as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { C as getDefaultHeaders, T as getExample, _ as serializeSimpleStyle, b as deSerializeParameter, f as serializeContentValue, g as serializePipeDelimitedStyle, h as serializeFormStyleForCookies, m as serializeFormStyle, o as generateClientOptions, p as serializeDeepObjectStyle, v as serializeSpaceDelimitedStyle, w as APP_VERSION, x as filterGlobalCookie, y as isParamDisabled } from "./operation-code-sample-xgx4qi2H.js";
|
|
7
|
+
import { t as getResolvedUrl } from "./get-resolved-url-SybDPV0U.js";
|
|
8
|
+
import { n as getEnvironmentVariables } from "./get-server-url-UVN-dx79.js";
|
|
9
9
|
import { t as ViewLayout_default } from "./ViewLayout-BOXN0IYo.js";
|
|
10
10
|
import { t as ViewLayoutContent_default } from "./ViewLayoutContent-CvMoJYPF.js";
|
|
11
|
-
import { n as getExampleFromBody, r as getSelectedBodyContentType, t as RequestBlock_default } from "./request-block-
|
|
12
|
-
import { r as isAuthOptional } from "./scalar-auth-selector-block-
|
|
11
|
+
import { n as getExampleFromBody, r as getSelectedBodyContentType, t as RequestBlock_default } from "./request-block-N7dPFyrG.js";
|
|
12
|
+
import { r as isAuthOptional } from "./scalar-auth-selector-block-Bs79QOMA.js";
|
|
13
13
|
import { t as ResponseBlock_default } from "./response-block-DmkaDZYs.js";
|
|
14
|
-
import { t as AddressBar_default } from "./scalar-address-bar-block
|
|
14
|
+
import { t as AddressBar_default } from "./scalar-address-bar-block-BbysOhkE.js";
|
|
15
15
|
import { t as getServers } from "./get-servers-B_WNlQWB.js";
|
|
16
16
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, onBeforeUnmount, onMounted, openBlock, ref, renderList, toDisplayString, toValue, unref, watch, withCtx, withModifiers } from "vue";
|
|
17
17
|
import { ScalarButton, ScalarDropdown, ScalarDropdownDivider, ScalarDropdownItem, ScalarIcon } from "@scalar/components";
|
|
@@ -75,6 +75,11 @@ var buildRequestSecurity = (selectedSecuritySchemes, env = {}, emptyTokenPlaceho
|
|
|
75
75
|
};
|
|
76
76
|
//#endregion
|
|
77
77
|
//#region src/v2/blocks/operation-block/helpers/build-request-body.ts
|
|
78
|
+
var getMultipartEncodingContentType = (requestBody, bodyContentType, fieldName, replacedFieldName) => requestBody.content[bodyContentType]?.encoding?.[fieldName]?.contentType ?? requestBody.content[bodyContentType]?.encoding?.[replacedFieldName]?.contentType;
|
|
79
|
+
var serializeMultipartValue = (value, env) => {
|
|
80
|
+
if (typeof value === "string") return replaceEnvVariables(value, env);
|
|
81
|
+
return replaceEnvVariables(typeof value === "object" && value !== null ? JSON.stringify(unpackProxyObject(value)) : String(value), env);
|
|
82
|
+
};
|
|
78
83
|
/**
|
|
79
84
|
* Create the fetch request body
|
|
80
85
|
*/
|
|
@@ -92,14 +97,23 @@ var buildRequestBody = (requestBody, env = {}, exampleKey = "default") => {
|
|
|
92
97
|
exampleValue.forEach(({ name, value }) => {
|
|
93
98
|
if (!name) return;
|
|
94
99
|
const replacedName = replaceEnvVariables(name, env);
|
|
100
|
+
const partContentType = form instanceof FormData ? getMultipartEncodingContentType(requestBody, bodyContentType, name, replacedName) : void 0;
|
|
95
101
|
if (value instanceof File && form instanceof FormData) {
|
|
96
102
|
/**
|
|
97
103
|
* We need to unwrap the proxies to get the file name due to the
|
|
98
104
|
* "this" context in the proxy causing an illegal invocation error
|
|
99
105
|
*/
|
|
100
106
|
const unwrappedValue = unpackProxyObject(value);
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
const encodedValue = partContentType && partContentType !== unwrappedValue.type ? new File([unwrappedValue], unwrappedValue.name, {
|
|
108
|
+
type: partContentType,
|
|
109
|
+
lastModified: unwrappedValue.lastModified
|
|
110
|
+
}) : unwrappedValue;
|
|
111
|
+
form.append(replacedName, encodedValue, encodedValue.name);
|
|
112
|
+
} else if (value !== void 0 && value !== null) {
|
|
113
|
+
const serializedValue = serializeMultipartValue(value, env);
|
|
114
|
+
if (form instanceof FormData && partContentType) form.append(replacedName, new Blob([serializedValue], { type: partContentType }));
|
|
115
|
+
else form.append(replacedName, serializedValue);
|
|
116
|
+
}
|
|
103
117
|
});
|
|
104
118
|
return form;
|
|
105
119
|
}
|
|
@@ -185,6 +199,7 @@ var buildRequestParameters = (parameters = [], env = {}, exampleKey = "default")
|
|
|
185
199
|
cookies: [],
|
|
186
200
|
headers: {},
|
|
187
201
|
pathVariables: {},
|
|
202
|
+
allowReservedQueryParameters: /* @__PURE__ */ new Set(),
|
|
188
203
|
urlParams: new URLSearchParams()
|
|
189
204
|
};
|
|
190
205
|
if (parameters.length === 0) return result;
|
|
@@ -213,7 +228,7 @@ var buildRequestParameters = (parameters = [], env = {}, exampleKey = "default")
|
|
|
213
228
|
break;
|
|
214
229
|
}
|
|
215
230
|
case "query":
|
|
216
|
-
processQueryParameter(param, paramName, deSerializedValue, result.urlParams);
|
|
231
|
+
processQueryParameter(param, paramName, deSerializedValue, result.urlParams, result.allowReservedQueryParameters);
|
|
217
232
|
break;
|
|
218
233
|
case "cookie":
|
|
219
234
|
processCookieParameter(paramName, deSerializedValue, getExplode(param, true), result.cookies);
|
|
@@ -231,43 +246,64 @@ var getStyle = (param, replacedValue) => {
|
|
|
231
246
|
}
|
|
232
247
|
return param.style;
|
|
233
248
|
};
|
|
249
|
+
/** Whether the parameter allows reserved characters (from param or schema). */
|
|
250
|
+
var isAllowReserved = (param) => {
|
|
251
|
+
if ("allowReserved" in param && param.allowReserved !== void 0) return param.allowReserved;
|
|
252
|
+
if ("schema" in param && param.schema && typeof param.schema === "object" && "allowReserved" in param.schema) return param.schema.allowReserved === true;
|
|
253
|
+
return false;
|
|
254
|
+
};
|
|
255
|
+
/** When allowReserved is true, add keys to the set so reserved chars stay unescaped in the URL. */
|
|
256
|
+
var trackReservedKeys = (allowReservedQueryParameters, allowReserved, ...keys) => {
|
|
257
|
+
if (allowReserved) for (const key of keys) allowReservedQueryParameters.add(key);
|
|
258
|
+
};
|
|
234
259
|
/**
|
|
235
260
|
* Helper function to process query parameters.
|
|
236
261
|
* Extracted to reduce complexity in main function.
|
|
237
262
|
*/
|
|
238
|
-
var processQueryParameter = (param, paramName, replacedValue, urlParams) => {
|
|
263
|
+
var processQueryParameter = (param, paramName, replacedValue, urlParams, allowReservedQueryParameters) => {
|
|
239
264
|
/** If the parameter should be exploded, defaults to true for form style */
|
|
240
265
|
const explodeParam = "explode" in param && param.explode !== void 0 ? param.explode : true;
|
|
266
|
+
const allowReserved = isAllowReserved(param);
|
|
241
267
|
/** Style of the parameter, defaults to form */
|
|
242
268
|
const style = getStyle(param, replacedValue);
|
|
243
269
|
if ("content" in param && param.content) {
|
|
244
270
|
const serializedValue = serializeContentValue(replacedValue, Object.keys(param.content)[0] ?? "application/json");
|
|
245
271
|
urlParams.set(paramName, serializedValue);
|
|
272
|
+
trackReservedKeys(allowReservedQueryParameters, allowReserved, paramName);
|
|
246
273
|
return;
|
|
247
274
|
}
|
|
248
275
|
if (style === "deepObject" && explodeParam) {
|
|
249
276
|
const entries = serializeDeepObjectStyle(paramName, replacedValue);
|
|
250
|
-
for (const entry of entries)
|
|
277
|
+
for (const entry of entries) {
|
|
278
|
+
urlParams.append(entry.key, entry.value);
|
|
279
|
+
trackReservedKeys(allowReservedQueryParameters, allowReserved, entry.key);
|
|
280
|
+
}
|
|
251
281
|
return;
|
|
252
282
|
}
|
|
253
283
|
if (style === "spaceDelimited") {
|
|
254
284
|
const serialized = serializeSpaceDelimitedStyle(replacedValue);
|
|
255
285
|
const existingValue = urlParams.get(paramName);
|
|
256
286
|
urlParams.set(paramName, existingValue ? `${existingValue} ${serialized}` : serialized);
|
|
287
|
+
trackReservedKeys(allowReservedQueryParameters, allowReserved, paramName);
|
|
257
288
|
return;
|
|
258
289
|
}
|
|
259
290
|
if (style === "pipeDelimited") {
|
|
260
291
|
const serialized = serializePipeDelimitedStyle(replacedValue);
|
|
261
292
|
const existingValue = urlParams.get(paramName);
|
|
262
293
|
urlParams.set(paramName, existingValue ? `${existingValue}|${serialized}` : serialized);
|
|
294
|
+
trackReservedKeys(allowReservedQueryParameters, allowReserved, paramName);
|
|
263
295
|
return;
|
|
264
296
|
}
|
|
265
297
|
const serialized = serializeFormStyle(replacedValue, explodeParam);
|
|
266
298
|
if (Array.isArray(serialized)) for (const entry of serialized) {
|
|
267
299
|
const key = entry.key || paramName;
|
|
268
300
|
urlParams.append(key, String(entry.value));
|
|
301
|
+
trackReservedKeys(allowReservedQueryParameters, allowReserved, key);
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
urlParams.append(paramName, String(serialized));
|
|
305
|
+
trackReservedKeys(allowReservedQueryParameters, allowReserved, paramName);
|
|
269
306
|
}
|
|
270
|
-
else urlParams.append(paramName, String(serialized));
|
|
271
307
|
};
|
|
272
308
|
/**
|
|
273
309
|
* Helper function to process cookie parameters.
|
|
@@ -334,6 +370,7 @@ var buildRequest = ({ environment, exampleKey = "default", globalCookies, method
|
|
|
334
370
|
server,
|
|
335
371
|
path,
|
|
336
372
|
pathVariables: params.pathVariables,
|
|
373
|
+
allowReservedQueryParameters: params.allowReservedQueryParameters,
|
|
337
374
|
urlParams
|
|
338
375
|
});
|
|
339
376
|
if (!url) throw ERRORS.URL_EMPTY;
|
|
@@ -819,13 +856,27 @@ var getSecurityRequirements = (documentSecurity, operationSecurity) => {
|
|
|
819
856
|
};
|
|
820
857
|
//#endregion
|
|
821
858
|
//#region src/v2/features/operation/helpers/get-selected-security.ts
|
|
859
|
+
var applyDefaultScopes = (requirement, securitySchemes) => {
|
|
860
|
+
let didApplyDefaultScopes = false;
|
|
861
|
+
const hydratedRequirement = Object.fromEntries(Object.entries(requirement).map(([name, scopes]) => {
|
|
862
|
+
if (Array.isArray(scopes) && scopes.length > 0) return [name, scopes];
|
|
863
|
+
const scheme = getResolvedRef(securitySchemes[name]);
|
|
864
|
+
const defaultScopes = scheme?.type === "oauth2" ? scheme["x-default-scopes"] : void 0;
|
|
865
|
+
if (Array.isArray(defaultScopes) && defaultScopes.length > 0) {
|
|
866
|
+
didApplyDefaultScopes = true;
|
|
867
|
+
return [name, [...defaultScopes]];
|
|
868
|
+
}
|
|
869
|
+
return [name, scopes];
|
|
870
|
+
}));
|
|
871
|
+
return didApplyDefaultScopes ? hydratedRequirement : requirement;
|
|
872
|
+
};
|
|
822
873
|
/**
|
|
823
874
|
* Resolves which security selection to use for an operation.
|
|
824
875
|
* Priority: operation-level selection, then document-level selection, then a default.
|
|
825
876
|
* When neither level has a selection, returns the first security requirement unless
|
|
826
877
|
* authentication is optional or there are no requirements, in which case returns no selection.
|
|
827
878
|
*/
|
|
828
|
-
var getSelectedSecurity = (documentSelectedSecurity, operationSelectedSecurity, securityRequirements = []) => {
|
|
879
|
+
var getSelectedSecurity = (documentSelectedSecurity, operationSelectedSecurity, securityRequirements = [], securitySchemes = {}) => {
|
|
829
880
|
if (operationSelectedSecurity) return operationSelectedSecurity;
|
|
830
881
|
if (documentSelectedSecurity) return documentSelectedSecurity;
|
|
831
882
|
const isOptional = isAuthOptional(securityRequirements);
|
|
@@ -836,7 +887,7 @@ var getSelectedSecurity = (documentSelectedSecurity, operationSelectedSecurity,
|
|
|
836
887
|
};
|
|
837
888
|
return {
|
|
838
889
|
selectedIndex: 0,
|
|
839
|
-
selectedSchemes: [firstRequirement]
|
|
890
|
+
selectedSchemes: [applyDefaultScopes(firstRequirement, securitySchemes)]
|
|
840
891
|
};
|
|
841
892
|
};
|
|
842
893
|
//#endregion
|
|
@@ -1017,7 +1068,6 @@ var Operation_default = /* @__PURE__ */ defineComponent({
|
|
|
1017
1068
|
});
|
|
1018
1069
|
/** Temporarily use the old config.hiddenClients until we migrate to the new httpClients config */
|
|
1019
1070
|
const httpClients = computed(() => mapHiddenClientsConfig(toValue(__props.options)?.hiddenClients));
|
|
1020
|
-
const APP_VERSION = "2.38.2";
|
|
1021
1071
|
return (_ctx, _cache) => {
|
|
1022
1072
|
return __props.path && __props.method && __props.exampleName && operation.value ? (openBlock(), createBlock(unref(OperationBlock_default), {
|
|
1023
1073
|
key: 0,
|
|
@@ -1380,7 +1430,7 @@ var OperationBlock_default = /* @__PURE__ */ defineComponent({
|
|
|
1380
1430
|
/** Compute what the security requirements should be for an operation */
|
|
1381
1431
|
const securityRequirements = computed(() => getSecurityRequirements(__props.documentSecurity, __props.operation.security));
|
|
1382
1432
|
/** The selected security for the operation or document */
|
|
1383
|
-
const selectedSecurity = computed(() => getSelectedSecurity(__props.documentSelectedSecurity, __props.operationSelectedSecurity, securityRequirements.value));
|
|
1433
|
+
const selectedSecurity = computed(() => getSelectedSecurity(__props.documentSelectedSecurity, __props.operationSelectedSecurity, securityRequirements.value, __props.securitySchemes));
|
|
1384
1434
|
/** The above selected requirements in scheme form */
|
|
1385
1435
|
const selectedSecuritySchemes = computed(() => getSecuritySchemes(__props.securitySchemes, selectedSecurity.value.selectedSchemes));
|
|
1386
1436
|
const { toast } = useToasts();
|
|
@@ -1621,4 +1671,4 @@ var OperationBlock_default = /* @__PURE__ */ defineComponent({
|
|
|
1621
1671
|
//#endregion
|
|
1622
1672
|
export { getSelectedServer as a, combineParams as c, mapHiddenClientsConfig as i, buildRequestSecurity as l, Operation_default as n, getSelectedSecurity as o, getActiveProxyUrl as r, getSecurityRequirements as s, OperationBlock_default as t, getSecuritySchemes as u };
|
|
1623
1673
|
|
|
1624
|
-
//# sourceMappingURL=operation-block-
|
|
1674
|
+
//# sourceMappingURL=operation-block-DE-hoO03.js.map
|