@scalar/api-client 2.17.3 → 2.17.4

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 (104) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/style.css +1 -1
  3. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +15 -10
  4. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +70 -55
  6. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
  7. package/dist/v2/blocks/operation-block/helpers/build-request-body.js +12 -8
  8. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +3 -5
  9. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +1 -1
  10. package/dist/v2/blocks/operation-block/helpers/build-request-security.js +31 -31
  11. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +4 -6
  12. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
  13. package/dist/v2/blocks/operation-block/helpers/build-request.js +20 -21
  14. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
  15. package/dist/v2/blocks/operation-block/helpers/get-example.js +22 -16
  16. package/dist/v2/blocks/operation-block/helpers/send-request.js +26 -26
  17. package/dist/v2/blocks/operation-block/index.d.ts +1 -0
  18. package/dist/v2/blocks/operation-block/index.d.ts.map +1 -1
  19. package/dist/v2/blocks/operation-block/index.js +4 -2
  20. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +9 -4
  21. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  22. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
  23. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +81 -88
  24. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +4 -4
  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/operation-to-har/operation-to-har.d.ts +1 -1
  27. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  28. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +1 -1
  29. package/dist/v2/blocks/operation-code-sample/index.d.ts +1 -0
  30. package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
  31. package/dist/v2/blocks/operation-code-sample/index.js +11 -9
  32. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +3 -2
  33. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  34. package/dist/v2/blocks/request-block/RequestBlock.vue.js +2 -2
  35. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +59 -63
  36. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  37. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
  38. package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +78 -74
  39. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js +3 -3
  40. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  41. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +43 -42
  42. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  43. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +96 -86
  44. package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.d.ts +8 -0
  45. package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.d.ts.map +1 -0
  46. package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.js +33 -0
  47. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.d.ts +7 -0
  48. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.d.ts.map +1 -0
  49. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.js +13 -0
  50. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts +3 -0
  51. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
  52. package/dist/v2/blocks/scalar-auth-selector-block/index.js +8 -2
  53. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  54. package/dist/v2/components/data-table/DataTableInput.vue.js +2 -2
  55. package/dist/v2/components/data-table/DataTableInput.vue2.js +25 -24
  56. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  57. package/dist/v2/features/app/App.vue.js +34 -33
  58. package/dist/v2/features/app/helpers/routes.d.ts +2 -0
  59. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  60. package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts.map +1 -1
  61. package/dist/v2/features/app/hooks/use-workspace-client-app-events.js +29 -29
  62. package/dist/v2/features/collection/DocumentCollection.vue.js +4 -3
  63. package/dist/v2/features/collection/WorkspaceCollection.vue.js +8 -7
  64. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  65. package/dist/v2/features/collection/components/Authentication.vue.js +1 -1
  66. package/dist/v2/features/collection/components/Authentication.vue2.js +7 -6
  67. package/dist/v2/features/collection/components/Cookies.vue.js +1 -0
  68. package/dist/v2/features/collection/components/Environment.vue.js +1 -0
  69. package/dist/v2/features/collection/components/Overview.vue2.js +8 -7
  70. package/dist/v2/features/collection/components/Servers.vue.js +25 -24
  71. package/dist/v2/features/collection/components/Settings.vue.js +8 -7
  72. package/dist/v2/features/modal/Modal.vue.d.ts +6 -0
  73. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  74. package/dist/v2/features/modal/Modal.vue.js +2 -2
  75. package/dist/v2/features/modal/Modal.vue2.js +66 -62
  76. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +16 -16
  77. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
  78. package/dist/v2/features/modal/helpers/create-api-client-modal.js +36 -29
  79. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts.map +1 -1
  80. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.js +25 -12
  81. package/dist/v2/features/modal/index.d.ts +2 -1
  82. package/dist/v2/features/modal/index.d.ts.map +1 -1
  83. package/dist/v2/features/modal/index.js +3 -1
  84. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  85. package/dist/v2/features/operation/Operation.vue.js +54 -62
  86. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts +1 -1
  87. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts.map +1 -1
  88. package/dist/v2/features/operation/helpers/get-security-requirements.js +2 -2
  89. package/dist/v2/features/operation/helpers/get-selected-security.d.ts +5 -2
  90. package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -1
  91. package/dist/v2/features/operation/helpers/get-selected-security.js +11 -11
  92. package/dist/v2/features/operation/helpers/get-selected-server.d.ts +10 -0
  93. package/dist/v2/features/operation/helpers/get-selected-server.d.ts.map +1 -0
  94. package/dist/v2/features/operation/helpers/get-selected-server.js +4 -0
  95. package/dist/v2/features/operation/index.d.ts +3 -0
  96. package/dist/v2/features/operation/index.d.ts.map +1 -1
  97. package/dist/v2/features/operation/index.js +8 -2
  98. package/dist/v2/helpers/index.d.ts +3 -0
  99. package/dist/v2/helpers/index.d.ts.map +1 -0
  100. package/dist/v2/helpers/index.js +4 -0
  101. package/dist/v2/helpers/plugins.d.ts +7 -1
  102. package/dist/v2/helpers/plugins.d.ts.map +1 -1
  103. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  104. package/package.json +22 -17
@@ -1 +1 @@
1
- {"version":3,"file":"use-workspace-client-modal-events.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/modal/hooks/use-workspace-client-modal-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAuBvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AAExF;;GAEG;AACH,eAAO,MAAM,6BAA6B,GAAI,kFAO3C;IACD,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,QAAQ,EAAE,WAAW,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IAC/C,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAC3B,YAAY,EAAE,qBAAqB,CAAA;IACnC,UAAU,EAAE,UAAU,CAAA;IACtB,cAAc,EAAE,cAAc,CAAA;CAC/B,SAgEA,CAAA"}
1
+ {"version":3,"file":"use-workspace-client-modal-events.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/modal/hooks/use-workspace-client-modal-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAuBvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AAExF;;GAEG;AACH,eAAO,MAAM,6BAA6B,GAAI,kFAO3C;IACD,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,QAAQ,EAAE,WAAW,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IAC/C,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAC3B,YAAY,EAAE,qBAAqB,CAAA;IACnC,UAAU,EAAE,UAAU,CAAA;IACtB,cAAc,EAAE,cAAc,CAAA;CAC/B,SAyFA,CAAA"}
@@ -1,30 +1,43 @@
1
- import { deleteSecurityScheme as d, updateSelectedAuthTab as i, updateSecurityScheme as u, updateSelectedScopes as s, updateSelectedSecuritySchemes as y, addServer as c, updateServer as v, deleteServer as S, updateServerVariables as h, updateSelectedServer as n, addOperationParameter as R, updateOperationParameter as q, deleteOperationParameter as w, deleteAllOperationParameters as m, updateOperationRequestBodyContentType as O, updateOperationRequestBodyExample as f, addOperationRequestBodyFormRow as P, updateOperationRequestBodyFormRow as b, deleteOperationRequestBodyFormRow as k, updateSelectedClient as x } from "@scalar/workspace-store/mutators";
2
- const F = ({
1
+ import { deleteSecurityScheme as d, updateSelectedAuthTab as i, updateSecurityScheme as u, updateSelectedScopes as n, updateSelectedSecuritySchemes as h, addServer as s, updateServer as c, deleteServer as v, updateServerVariables as m, updateSelectedServer as S, addOperationParameter as y, updateOperationParameter as w, deleteOperationParameter as R, deleteAllOperationParameters as q, updateOperationRequestBodyContentType as O, updateOperationRequestBodyExample as f, addOperationRequestBodyFormRow as x, updateOperationRequestBodyFormRow as g, deleteOperationRequestBodyFormRow as P, updateSelectedClient as k } from "@scalar/workspace-store/mutators";
2
+ const E = ({
3
3
  eventBus: a,
4
4
  document: r,
5
- isSidebarOpen: o,
5
+ isSidebarOpen: l,
6
6
  sidebarState: t,
7
- modalState: l,
7
+ modalState: o,
8
8
  workspaceStore: p
9
9
  }) => {
10
- a.on("scroll-to:nav-item", ({ id: e }) => t.handleSelectItem(e)), a.on("auth:delete:security-scheme", (e) => d(r.value, e)), a.on("auth:update:active-index", (e) => i(r.value, e)), a.on("auth:update:security-scheme", (e) => u(r.value, e)), a.on("auth:update:selected-scopes", (e) => s(r.value, e)), a.on(
10
+ a.on("scroll-to:nav-item", ({ id: e }) => t.handleSelectItem(e)), a.on("auth:delete:security-scheme", (e) => d(r.value, e)), a.on("auth:update:active-index", (e) => i(r.value, e)), a.on("auth:update:security-scheme", (e) => u(r.value, e)), a.on("auth:update:selected-scopes", (e) => n(r.value, e)), a.on(
11
11
  "auth:update:selected-security-schemes",
12
- async (e) => await y(r.value, e)
13
- ), a.on("server:add:server", () => c(r.value)), a.on("server:update:server", (e) => v(r.value, e)), a.on("server:delete:server", (e) => S(r.value, e)), a.on("server:update:variables", (e) => h(r.value, e)), a.on("server:update:selected", (e) => n(r.value, e)), a.on("operation:add:parameter", (e) => R(r.value, e)), a.on("operation:update:parameter", (e) => q(r.value, e)), a.on("operation:delete:parameter", (e) => w(r.value, e)), a.on("operation:delete-all:parameters", (e) => m(r.value, e)), a.on(
12
+ async (e) => await h(r.value, e)
13
+ ), a.on("server:add:server", () => s(r.value)), a.on("server:update:server", (e) => c(r.value, e)), a.on("server:delete:server", (e) => v(r.value, e)), a.on("server:update:variables", (e) => m(r.value, e)), a.on("server:update:selected", (e) => S(r.value, e)), a.on("operation:add:parameter", (e) => y(r.value, e)), a.on("operation:update:parameter", (e) => w(r.value, e)), a.on("operation:delete:parameter", (e) => R(r.value, e)), a.on("operation:delete-all:parameters", (e) => q(r.value, e)), a.on(
14
14
  "operation:update:requestBody:contentType",
15
15
  (e) => O(r.value, e)
16
16
  ), a.on("operation:update:requestBody:value", (e) => {
17
17
  f(r.value, e);
18
18
  }), a.on("operation:add:requestBody:formRow", (e) => {
19
- P(r.value, e);
19
+ x(r.value, e);
20
20
  }), a.on(
21
21
  "operation:update:requestBody:formRow",
22
- (e) => b(r.value, e)
22
+ (e) => g(r.value, e)
23
23
  ), a.on(
24
24
  "operation:delete:requestBody:formRow",
25
- (e) => k(r.value, e)
26
- ), a.on("ui:toggle:sidebar", () => o.value = !o.value), a.on("ui:close:client-modal", () => l.hide()), a.on("workspace:update:selected-client", (e) => x(p.workspace, e));
25
+ (e) => P(r.value, e)
26
+ ), a.on("ui:toggle:sidebar", () => l.value = !l.value), a.on("ui:close:client-modal", () => o.hide()), a.on("ui:open:client-modal", (e) => {
27
+ if (!e) {
28
+ o.show();
29
+ return;
30
+ }
31
+ "id" in e && e.id ? t.handleSelectItem(e.id) : "method" in e && "path" in e && t.handleSelectItem(
32
+ t.getEntryByLocation({
33
+ document: r.value?.["x-scalar-navigation"]?.id ?? "",
34
+ path: e.path,
35
+ method: e.method,
36
+ example: e.exampleName
37
+ })?.id ?? ""
38
+ ), o.show();
39
+ }), a.on("workspace:update:selected-client", (e) => k(p.workspace, e));
27
40
  };
28
41
  export {
29
- F as useWorkspaceClientModalEvents
42
+ E as useWorkspaceClientModalEvents
30
43
  };
@@ -1,2 +1,3 @@
1
- export { createApiClientModal } from './helpers/create-api-client-modal.js';
1
+ export { type ApiClientModal, createApiClientModal } from './helpers/create-api-client-modal.js';
2
+ export { useWorkspaceClientModalEvents } from './hooks/use-workspace-client-modal-events.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/modal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/modal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AAC7F,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAA"}
@@ -1,4 +1,6 @@
1
1
  import { createApiClientModal as r } from "./helpers/create-api-client-modal.js";
2
+ import { useWorkspaceClientModalEvents as a } from "./hooks/use-workspace-client-modal-events.js";
2
3
  export {
3
- r as createApiClientModal
4
+ r as createApiClientModal,
5
+ a as useWorkspaceClientModalEvents
4
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"AA2KA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAMlE;;;;;;;GAOG;;AACH,wBAmOC"}
1
+ {"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"AA8JA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAMlE;;;;;;;GAOG;;AACH,wBAwNC"}
@@ -1,15 +1,13 @@
1
- import { defineComponent as h, computed as a, onMounted as p, watch as y, createBlock as f, createElementBlock as k, openBlock as s, unref as n, createElementVNode as S } from "vue";
2
- import { getResolvedRef as g } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
- import { useRouter as w } from "vue-router";
4
- import { getOperationHeader as B } from "./helpers/get-operation-header.js";
5
- import { getSecurityRequirements as C } from "./helpers/get-security-requirements.js";
6
- import { getSelectedSecurity as R } from "./helpers/get-selected-security.js";
7
- import x from "../../blocks/operation-block/OperationBlock.vue.js";
8
- const N = {
1
+ import { defineComponent as i, computed as o, onMounted as d, watch as p, createBlock as h, createElementBlock as v, openBlock as n, unref as l, createElementVNode as y } from "vue";
2
+ import { getResolvedRef as f } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
+ import { getOperationHeader as S } from "./helpers/get-operation-header.js";
4
+ import { getSelectedServer as k } from "./helpers/get-selected-server.js";
5
+ import g from "../../blocks/operation-block/OperationBlock.vue.js";
6
+ const w = {
9
7
  key: 1,
10
8
  class: "flex h-full w-full items-center justify-center"
11
- }, q = {}, O = /* @__PURE__ */ h({
12
- ...q,
9
+ }, B = {}, O = /* @__PURE__ */ i({
10
+ ...B,
13
11
  __name: "Operation",
14
12
  props: {
15
13
  documentSlug: {},
@@ -20,33 +18,30 @@ const N = {
20
18
  method: {},
21
19
  exampleName: {},
22
20
  environment: {},
21
+ securitySchemes: {},
23
22
  workspaceStore: {},
24
23
  activeWorkspace: {},
25
24
  plugins: {}
26
25
  },
27
- setup(e) {
28
- const o = a(
29
- () => e.path && e.method ? g(e.document?.paths?.[e.path]?.[e.method]) ?? null : null
30
- ), u = a(() => [
31
- ...e.workspaceStore.workspace?.["x-scalar-cookies"] ?? [],
32
- ...e.document?.["x-scalar-cookies"] ?? []
33
- ]), m = a(
34
- () => e.document?.servers?.find(
35
- ({ url: t }) => t === e.document?.["x-scalar-selected-server"]
36
- ) ?? null
37
- );
38
- p(() => {
39
- typeof e.document?.["x-scalar-selected-server"] > "u" && e.document?.servers?.[0]?.url && e.eventBus.emit("server:update:selected", { url: e.document.servers[0].url });
40
- }), y(
41
- o,
42
- (t) => {
43
- t && e.path && e.method && !B({
44
- operation: t,
26
+ setup(t) {
27
+ const r = o(
28
+ () => t.path && t.method ? f(t.document?.paths?.[t.path]?.[t.method]) ?? null : null
29
+ ), s = o(() => [
30
+ ...t.workspaceStore.workspace?.["x-scalar-cookies"] ?? [],
31
+ ...t.document?.["x-scalar-cookies"] ?? []
32
+ ]), u = o(() => k(t.document));
33
+ d(() => {
34
+ typeof t.document?.["x-scalar-selected-server"] > "u" && t.document?.servers?.[0]?.url && t.eventBus.emit("server:update:selected", { url: t.document.servers[0].url });
35
+ }), p(
36
+ r,
37
+ (e) => {
38
+ e && t.path && t.method && !S({
39
+ operation: e,
45
40
  name: "Accept",
46
41
  type: "header"
47
- }) && e.eventBus.emit("operation:add:parameter", {
42
+ }) && t.eventBus.emit("operation:add:parameter", {
48
43
  type: "header",
49
- meta: { method: e.method, path: e.path, exampleKey: e.exampleName ?? "default" },
44
+ meta: { method: t.method, path: t.path, exampleKey: t.exampleName ?? "default" },
50
45
  payload: {
51
46
  key: "Accept",
52
47
  value: "*/*",
@@ -56,44 +51,41 @@ const N = {
56
51
  },
57
52
  { immediate: !0 }
58
53
  );
59
- const l = a(
60
- () => C(e.document, o.value)
61
- ), c = a(
62
- () => R(e.document, o.value, l.value)
63
- ), i = a(() => e.document?.["x-scalar-set-operation-security"] ? {
54
+ const m = o(() => t.document?.["x-scalar-set-operation-security"] ? {
64
55
  type: "operation",
65
- path: e.path ?? "",
66
- method: e.method ?? "get"
56
+ path: t.path ?? "",
57
+ method: t.method ?? "get"
67
58
  } : {
68
59
  type: "document"
69
- }), d = "2.17.3", v = w();
70
- return (t, r) => t.path && t.method && t.exampleName && o.value ? (s(), f(n(x), {
60
+ }), c = "2.17.4";
61
+ return (e, a) => e.path && e.method && e.exampleName && r.value ? (n(), h(l(g), {
71
62
  key: 0,
72
- appVersion: n(d),
73
- authMeta: i.value,
74
- documentUrl: t.document?.["x-scalar-original-source-url"],
75
- environment: t.environment,
76
- eventBus: t.eventBus,
77
- exampleKey: t.exampleName,
78
- globalCookies: u.value,
63
+ appVersion: l(c),
64
+ authMeta: m.value,
65
+ documentSecurity: e.document?.security ?? [],
66
+ documentSelectedSecurity: e.document?.["x-scalar-selected-security"],
67
+ documentUrl: e.document?.["x-scalar-original-source-url"],
68
+ environment: e.environment,
69
+ eventBus: e.eventBus,
70
+ exampleKey: e.exampleName,
71
+ globalCookies: s.value,
79
72
  history: [],
80
- httpClients: t.workspaceStore.config["x-scalar-reference-config"]?.httpClients,
81
- layout: t.layout,
82
- method: t.method,
83
- operation: o.value,
84
- path: t.path,
85
- plugins: t.plugins,
86
- proxyUrl: t.workspaceStore.workspace["x-scalar-active-proxy"] ?? "",
87
- securityRequirements: l.value,
88
- securitySchemes: t.document?.components?.securitySchemes ?? {},
89
- selectedClient: t.workspaceStore.workspace["x-scalar-default-client"],
90
- selectedSecurity: c.value,
91
- server: m.value,
92
- servers: t.document?.servers ?? [],
73
+ httpClients: e.workspaceStore.config["x-scalar-reference-config"]?.httpClients,
74
+ layout: e.layout,
75
+ method: e.method,
76
+ operation: r.value,
77
+ path: e.path,
78
+ plugins: e.plugins,
79
+ proxyUrl: e.workspaceStore.workspace["x-scalar-active-proxy"] ?? "",
80
+ securitySchemes: e.securitySchemes,
81
+ selectedClient: e.workspaceStore.workspace["x-scalar-default-client"],
82
+ server: u.value,
83
+ servers: e.document?.servers ?? [],
84
+ setOperationSecurity: e.document?.["x-scalar-set-operation-security"] ?? !1,
93
85
  totalPerformedRequests: 0,
94
- "onUpdate:servers": r[0] || (r[0] = (U) => n(v).push({ name: "document.servers" }))
95
- }, null, 8, ["appVersion", "authMeta", "documentUrl", "environment", "eventBus", "exampleKey", "globalCookies", "httpClients", "layout", "method", "operation", "path", "plugins", "proxyUrl", "securityRequirements", "securitySchemes", "selectedClient", "selectedSecurity", "server", "servers"])) : (s(), k("div", N, [...r[1] || (r[1] = [
96
- S("span", { class: "text-c-3" }, "Select an operation to view details", -1)
86
+ "onUpdate:servers": a[0] || (a[0] = (C) => e.eventBus.emit("ui:route:page", { name: "document.servers" }))
87
+ }, null, 8, ["appVersion", "authMeta", "documentSecurity", "documentSelectedSecurity", "documentUrl", "environment", "eventBus", "exampleKey", "globalCookies", "httpClients", "layout", "method", "operation", "path", "plugins", "proxyUrl", "securitySchemes", "selectedClient", "server", "servers", "setOperationSecurity"])) : (n(), v("div", w, [...a[1] || (a[1] = [
88
+ y("span", { class: "text-c-3" }, "Select an operation to view details", -1)
97
89
  ])]));
98
90
  }
99
91
  });
@@ -8,5 +8,5 @@ import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/stric
8
8
  *
9
9
  * Otherwise we generally go operation -> document security.
10
10
  */
11
- export declare const getSecurityRequirements: (document: OpenApiDocument | null, operation: OperationObject | null) => Partial<Record<string, string[]>>[];
11
+ export declare const getSecurityRequirements: (documentSecurity: OpenApiDocument["security"], operationSecurity?: OperationObject["security"]) => Partial<Record<string, string[]>>[];
12
12
  //# sourceMappingURL=get-security-requirements.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-security-requirements.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/operation/helpers/get-security-requirements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AACnG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAE5F;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAAI,UAAU,eAAe,GAAG,IAAI,EAAE,WAAW,eAAe,GAAG,IAAI,wCAY1G,CAAA"}
1
+ {"version":3,"file":"get-security-requirements.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/operation/helpers/get-security-requirements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AACnG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAE5F;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAClC,kBAAkB,eAAe,CAAC,UAAU,CAAC,EAC7C,oBAAoB,eAAe,CAAC,UAAU,CAAC,wCAShD,CAAA"}
@@ -1,4 +1,4 @@
1
- const s = (i, r) => i ? JSON.stringify(r?.security) === "[{}]" && i.security?.length ? !!i.security.find((t) => JSON.stringify(t) === "{}") ? i.security : [...i.security, {}] : r?.security ?? i.security ?? [] : [];
1
+ const f = (n, s) => JSON.stringify(s) === "[{}]" && n?.length ? !!n.find((t) => JSON.stringify(t) === "{}") ? n : [...n, {}] : s ?? n ?? [];
2
2
  export {
3
- s as getSecurityRequirements
3
+ f as getSecurityRequirements
4
4
  };
@@ -1,6 +1,9 @@
1
1
  import type { OpenApiDocument, OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
- /** Get the selected security for an operation or document, with defaults to the requirements */
3
- export declare const getSelectedSecurity: (document: OpenApiDocument | null, operation: OperationObject | null, securityRequirements: NonNullable<OpenApiDocument["security"]>) => {
2
+ /**
3
+ * Get the selected security for an operation or document,
4
+ * Defaults to the first requirement if no selection is made and you pass in requirements
5
+ */
6
+ export declare const getSelectedSecurity: (documentSelectedSecurity: OpenApiDocument["x-scalar-selected-security"], operationSelectedSecurity: OperationObject["x-scalar-selected-security"], securityRequirements?: NonNullable<OpenApiDocument["security"]>, setOperationSecurity?: boolean) => {
4
7
  selectedIndex: number;
5
8
  selectedSchemes: import("@scalar/workspace-store/schemas/v3.1/strict/security-requirement").SecurityRequirementObject[];
6
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"get-selected-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/operation/helpers/get-selected-security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAIpH,gGAAgG;AAChG,eAAO,MAAM,mBAAmB,GAC9B,UAAU,eAAe,GAAG,IAAI,EAChC,WAAW,eAAe,GAAG,IAAI,EACjC,sBAAsB,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;;;CA6B/D,CAAA"}
1
+ {"version":3,"file":"get-selected-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/operation/helpers/get-selected-security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAIpH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,0BAA0B,eAAe,CAAC,4BAA4B,CAAC,EACvE,2BAA2B,eAAe,CAAC,4BAA4B,CAAC,EACxE,uBAAsB,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAM,EACnE,8BAA4B;;;CA6B7B,CAAA"}
@@ -1,19 +1,19 @@
1
- import { isAuthOptional as r } from "../../../blocks/scalar-auth-selector-block/helpers/is-auth-optional.js";
2
- const a = (e, t, s) => {
3
- const c = s[0];
4
- if (e?.["x-scalar-set-operation-security"]) {
5
- if (t?.["x-scalar-selected-security"])
6
- return t?.["x-scalar-selected-security"];
7
- } else if (e?.["x-scalar-selected-security"])
8
- return e?.["x-scalar-selected-security"];
9
- return r(s) || !c ? {
1
+ import { isAuthOptional as i } from "../../../blocks/scalar-auth-selector-block/helpers/is-auth-optional.js";
2
+ const c = (e, t, s = [], r = !1) => {
3
+ if (r) {
4
+ if (t)
5
+ return t;
6
+ } else if (e)
7
+ return e;
8
+ const f = i(s), n = s[0];
9
+ return f || !n ? {
10
10
  selectedIndex: -1,
11
11
  selectedSchemes: []
12
12
  } : {
13
13
  selectedIndex: 0,
14
- selectedSchemes: [c]
14
+ selectedSchemes: [n]
15
15
  };
16
16
  };
17
17
  export {
18
- a as getSelectedSecurity
18
+ c as getSelectedSecurity
19
19
  };
@@ -0,0 +1,10 @@
1
+ import type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace';
2
+ /**
3
+ * Get the selected server for a document,
4
+ * we can later expand this to support operation/path servers as well
5
+ *
6
+ * If x-scalar-selected-server is undefined we select the first server (this means the user has not selected a server yet)
7
+ * If the user has un-selected a server it would be an empty string
8
+ */
9
+ export declare const getSelectedServer: (document: WorkspaceDocument | null) => import("@scalar/workspace-store/schemas/v3.1/strict/server").ServerObject | null;
10
+ //# sourceMappingURL=get-selected-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-selected-server.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/operation/helpers/get-selected-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAElF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,iBAAiB,GAAG,IAAI,qFAQnE,CAAA"}
@@ -0,0 +1,4 @@
1
+ const s = (e) => typeof e?.["x-scalar-selected-server"] > "u" && e?.servers?.length ? e.servers[0] : e?.servers?.find(({ url: r }) => r === e?.["x-scalar-selected-server"]) ?? null;
2
+ export {
3
+ s as getSelectedServer
4
+ };
@@ -1,2 +1,5 @@
1
+ export { getSecurityRequirements } from './helpers/get-security-requirements.js';
2
+ export { getSelectedSecurity } from './helpers/get-selected-security.js';
3
+ export { getSelectedServer } from './helpers/get-selected-server.js';
1
4
  export { default as Operation } from './Operation.vue.js';
2
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
@@ -1,4 +1,10 @@
1
- import { default as o } from "./Operation.vue.js";
1
+ import { getSecurityRequirements as t } from "./helpers/get-security-requirements.js";
2
+ import { getSelectedSecurity as f } from "./helpers/get-selected-security.js";
3
+ import { getSelectedServer as p } from "./helpers/get-selected-server.js";
4
+ import { default as c } from "./Operation.vue.js";
2
5
  export {
3
- o as Operation
6
+ c as Operation,
7
+ t as getSecurityRequirements,
8
+ f as getSelectedSecurity,
9
+ p as getSelectedServer
4
10
  };
@@ -0,0 +1,3 @@
1
+ export { getActiveEnvironment } from './get-active-environment.js';
2
+ export type { ClientPlugin } from './plugins.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { getActiveEnvironment as n } from "./get-active-environment.js";
2
+ export {
3
+ n as getActiveEnvironment
4
+ };
@@ -2,7 +2,13 @@ import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/stric
2
2
  import type { Component } from 'vue';
3
3
  /** A type representing the hooks that a client plugin can define */
4
4
  export type ClientPluginHooks = {
5
- beforeRequest: (payload: Request) => Request | Promise<Request>;
5
+ beforeRequest: (payload: {
6
+ request: Request;
7
+ }) => {
8
+ request: Request;
9
+ } | Promise<{
10
+ request: Request;
11
+ }>;
6
12
  responseReceived: (payload: {
7
13
  response: Response;
8
14
  request: Request;
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAC5F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAEpC,oEAAoE;AACpE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/D,gBAAgB,EAAE,CAAC,OAAO,EAAE;QAC1B,QAAQ,EAAE,QAAQ,CAAA;QAClB,OAAO,EAAE,OAAO,CAAA;QAChB,SAAS,EAAE,eAAe,CAAA;KAC3B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B,CAAA;AAED,yEAAyE;AACzE,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,SAAS,CAAA;IAClB,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAA;CAC7C,CAAA;AAED;;;;GAIG;AACH,KAAK,cAAc,GAAG;KACnB,CAAC,IAAI,MAAM,iBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACpE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,SAAS,MAAM,cAAc,EAC9D,SAAS,cAAc,CAAC,CAAC,CAAC,EAC1B,UAAU,CAAC,EACX,SAAS,YAAY,EAAE,KACtB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAY3B,CAAA"}
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAC5F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAEpC,oEAAoE;AACpE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;IACtG,gBAAgB,EAAE,CAAC,OAAO,EAAE;QAC1B,QAAQ,EAAE,QAAQ,CAAA;QAClB,OAAO,EAAE,OAAO,CAAA;QAChB,SAAS,EAAE,eAAe,CAAA;KAC3B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B,CAAA;AAED,yEAAyE;AACzE,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,SAAS,CAAA;IAClB,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAA;CAC7C,CAAA;AAED;;;;GAIG;AACH,KAAK,cAAc,GAAG;KACnB,CAAC,IAAI,MAAM,iBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACpE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,SAAS,MAAM,cAAc,EAC9D,SAAS,cAAc,CAAC,CAAC,CAAC,EAC1B,UAAU,CAAC,EACX,SAAS,YAAY,EAAE,KACtB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAY3B,CAAA"}
@@ -33,7 +33,7 @@ const W = { class: "flex-center relative flex flex-1 flex-col gap-6 p-2 capitali
33
33
  }));
34
34
  }, f = (o) => {
35
35
  o?.createNew && g.name === "request" && d();
36
- }, v = "2.17.3";
36
+ }, v = "2.17.4";
37
37
  return q(() => a.hotKeys.on(f)), R(() => a.hotKeys.off(f)), (o, e) => (i(), l("div", W, [
38
38
  s("div", {
39
39
  class: y(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "rest",
19
19
  "testing"
20
20
  ],
21
- "version": "2.17.3",
21
+ "version": "2.17.4",
22
22
  "engines": {
23
23
  "node": ">=20"
24
24
  },
@@ -256,6 +256,11 @@
256
256
  "types": "./dist/v2/features/settings/index.d.ts",
257
257
  "default": "./dist/v2/features/settings/index.js"
258
258
  },
259
+ "./v2/helpers": {
260
+ "import": "./dist/v2/helpers/index.js",
261
+ "types": "./dist/v2/helpers/index.d.ts",
262
+ "default": "./dist/v2/helpers/index.js"
263
+ },
259
264
  "./views/Components/CodeSnippet": {
260
265
  "import": "./dist/views/Components/CodeSnippet/index.js",
261
266
  "types": "./dist/views/Components/CodeSnippet/index.d.ts",
@@ -322,25 +327,25 @@
322
327
  "yaml": "^2.8.0",
323
328
  "zod": "^4.1.11",
324
329
  "@scalar/analytics-client": "1.0.1",
330
+ "@scalar/components": "0.16.15",
325
331
  "@scalar/draggable": "0.3.0",
326
- "@scalar/components": "0.16.14",
327
- "@scalar/helpers": "0.2.4",
332
+ "@scalar/helpers": "0.2.5",
328
333
  "@scalar/icons": "0.5.2",
329
- "@scalar/import": "0.4.41",
330
- "@scalar/json-magic": "0.8.8",
331
- "@scalar/oas-utils": "0.6.12",
332
- "@scalar/object-utils": "1.2.18",
333
- "@scalar/openapi-parser": "0.23.9",
334
+ "@scalar/import": "0.4.42",
335
+ "@scalar/json-magic": "0.8.9",
336
+ "@scalar/oas-utils": "0.6.13",
337
+ "@scalar/openapi-parser": "0.23.10",
338
+ "@scalar/object-utils": "1.2.19",
339
+ "@scalar/postman-to-openapi": "0.3.54",
340
+ "@scalar/sidebar": "0.7.5",
334
341
  "@scalar/openapi-types": "0.5.3",
335
- "@scalar/postman-to-openapi": "0.3.53",
336
- "@scalar/sidebar": "0.7.4",
337
- "@scalar/snippetz": "0.6.1",
338
342
  "@scalar/themes": "0.13.26",
339
- "@scalar/types": "0.5.4",
340
- "@scalar/use-codemirror": "0.13.8",
341
- "@scalar/workspace-store": "0.24.2",
343
+ "@scalar/snippetz": "0.6.2",
344
+ "@scalar/use-codemirror": "0.13.9",
345
+ "@scalar/use-hooks": "0.3.4",
346
+ "@scalar/types": "0.5.5",
342
347
  "@scalar/use-toasts": "0.9.1",
343
- "@scalar/use-hooks": "0.3.3"
348
+ "@scalar/workspace-store": "0.24.3"
344
349
  },
345
350
  "devDependencies": {
346
351
  "@tailwindcss/vite": "^4.1.7",
@@ -355,8 +360,8 @@
355
360
  "vite": "7.1.11",
356
361
  "vite-svg-loader": "5.1.0",
357
362
  "vitest": "3.2.4",
358
- "@scalar/build-tooling": "0.4.1",
359
- "@scalar/galaxy": "0.5.12"
363
+ "@scalar/galaxy": "0.5.12",
364
+ "@scalar/build-tooling": "0.4.1"
360
365
  },
361
366
  "scripts": {
362
367
  "build": "scalar-build-vite",