@scalar/api-client 2.26.1 → 2.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/dist/components/Server/ServerSelector.vue.js +6 -6
  3. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +6 -6
  4. package/dist/style.css +1 -1
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +1 -1
  6. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  7. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +48 -43
  8. package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
  9. package/dist/v2/blocks/operation-block/components/Header.vue2.js +10 -10
  10. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
  11. package/dist/v2/blocks/operation-block/helpers/build-request-body.js +29 -25
  12. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
  13. package/dist/v2/blocks/operation-block/helpers/get-example.js +15 -15
  14. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts +10 -0
  15. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts.map +1 -0
  16. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.js +4 -0
  17. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +1 -1
  18. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
  19. package/dist/v2/blocks/operation-block/helpers/send-request.js +1 -1
  20. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +1 -1
  21. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  22. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  23. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +101 -100
  24. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  25. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
  26. package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +62 -69
  27. package/dist/v2/blocks/request-block/components/RequestParams.vue.js +6 -6
  28. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +36 -2
  29. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  30. package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
  31. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +38 -3
  32. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  33. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  34. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +1 -1
  35. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
  36. package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
  37. package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +68 -69
  38. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
  39. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
  40. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue2.js +31 -40
  41. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -1
  42. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js +35 -41
  43. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  44. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +37 -41
  45. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +3 -2
  46. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  47. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +107 -87
  48. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts +21 -0
  49. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -0
  50. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js +91 -0
  51. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue2.js +4 -0
  52. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  53. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +107 -93
  54. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  55. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +87 -65
  56. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts +36 -0
  57. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts.map +1 -0
  58. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +35 -0
  59. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts +1 -1
  60. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts.map +1 -1
  61. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.js +18 -10
  62. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts +5 -0
  63. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts.map +1 -0
  64. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js +27 -0
  65. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +3 -1
  66. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +1 -1
  67. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +1 -2
  68. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
  69. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +29 -37
  70. package/dist/v2/components/layout/CollapsibleSection.vue.js +1 -1
  71. package/dist/v2/components/modals/ModalClientContainer.vue.d.ts +2 -2
  72. package/dist/v2/components/modals/ModalClientContainer.vue.d.ts.map +1 -1
  73. package/dist/v2/components/modals/ModalClientContainer.vue.js +1 -1
  74. package/dist/v2/components/modals/ModalClientContainer.vue2.js +45 -42
  75. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +2 -0
  76. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  77. package/dist/v2/components/sidebar/Sidebar.vue.js +25 -24
  78. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +2 -0
  79. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  80. package/dist/v2/components/sidebar/SidebarMenu.vue.js +30 -30
  81. package/dist/v2/features/app/App.vue.d.ts +6 -1
  82. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  83. package/dist/v2/features/app/App.vue.js +48 -46
  84. package/dist/v2/features/app/app-events.d.ts +1 -1
  85. package/dist/v2/features/app/app-events.d.ts.map +1 -1
  86. package/dist/v2/features/app/app-events.js +95 -56
  87. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  88. package/dist/v2/features/app/components/AppSidebar.vue.js +3 -3
  89. package/dist/v2/features/app/components/AppSidebar.vue2.js +111 -105
  90. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +12 -2
  91. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  92. package/dist/v2/features/app/helpers/create-api-client-app.js +12 -10
  93. package/dist/v2/features/app/helpers/routes.d.ts +3 -1
  94. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  95. package/dist/v2/features/app/hooks/use-theme.d.ts +42 -0
  96. package/dist/v2/features/app/hooks/use-theme.d.ts.map +1 -0
  97. package/dist/v2/features/app/hooks/use-theme.js +34 -0
  98. package/dist/v2/features/app/index.d.ts +0 -1
  99. package/dist/v2/features/app/index.d.ts.map +1 -1
  100. package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
  101. package/dist/v2/features/collection/DocumentCollection.vue.js +27 -26
  102. package/dist/v2/features/collection/WorkspaceCollection.vue.js +13 -12
  103. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  104. package/dist/v2/features/collection/components/Authentication.vue.js +2 -2
  105. package/dist/v2/features/collection/components/Authentication.vue2.js +49 -40
  106. package/dist/v2/features/collection/components/Cookies.vue.d.ts.map +1 -1
  107. package/dist/v2/features/collection/components/Cookies.vue.js +26 -13
  108. package/dist/v2/features/collection/components/Environment.vue.d.ts.map +1 -1
  109. package/dist/v2/features/collection/components/Environment.vue.js +27 -15
  110. package/dist/v2/features/collection/components/Overview.vue.d.ts.map +1 -1
  111. package/dist/v2/features/collection/components/Overview.vue.js +2 -2
  112. package/dist/v2/features/collection/components/Overview.vue2.js +68 -61
  113. package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
  114. package/dist/v2/features/collection/components/Servers.vue.js +93 -88
  115. package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
  116. package/dist/v2/features/collection/components/Settings.vue.js +19 -17
  117. package/dist/v2/features/environments/EnvironmentsList.vue.js +1 -1
  118. package/dist/v2/features/global-cookies/components/CookiesTable.vue.d.ts.map +1 -1
  119. package/dist/v2/features/global-cookies/components/CookiesTable.vue.js +2 -2
  120. package/dist/v2/features/global-cookies/components/CookiesTable.vue2.js +8 -8
  121. package/dist/v2/features/modal/Modal.vue.d.ts +1 -1
  122. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  123. package/dist/v2/features/modal/Modal.vue.js +15 -15
  124. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +1 -1
  125. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
  126. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  127. package/dist/v2/features/operation/Operation.vue.js +31 -34
  128. package/dist/v2/features/settings/CollectionSettings.vue.d.ts +10 -7
  129. package/dist/v2/features/settings/CollectionSettings.vue.d.ts.map +1 -1
  130. package/dist/v2/features/settings/CollectionSettings.vue.js +183 -149
  131. package/dist/v2/features/settings/DocumentSettings.vue.d.ts.map +1 -1
  132. package/dist/v2/features/settings/DocumentSettings.vue.js +88 -79
  133. package/dist/v2/features/settings/components/Section.vue.d.ts +2 -1
  134. package/dist/v2/features/settings/components/Section.vue.d.ts.map +1 -1
  135. package/dist/v2/features/settings/components/Section.vue.js +26 -15
  136. package/dist/v2/features/settings/helpers/get-theme-colors.d.ts +4 -3
  137. package/dist/v2/features/settings/helpers/get-theme-colors.d.ts.map +1 -1
  138. package/dist/v2/features/settings/helpers/get-theme-colors.js +6 -7
  139. package/dist/v2/helpers/handle-hotkeys.d.ts.map +1 -1
  140. package/dist/v2/helpers/handle-hotkeys.js +2 -2
  141. package/dist/v2/helpers/index.d.ts +0 -1
  142. package/dist/v2/helpers/index.d.ts.map +1 -1
  143. package/dist/v2/hooks/use-global-hot-keys.d.ts +3 -1
  144. package/dist/v2/hooks/use-global-hot-keys.d.ts.map +1 -1
  145. package/dist/v2/hooks/use-global-hot-keys.js +8 -6
  146. package/dist/v2/workspace-events.d.ts.map +1 -1
  147. package/dist/v2/workspace-events.js +10 -0
  148. package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
  149. package/dist/views/Request/RequestSidebar.vue.js +2 -2
  150. package/dist/views/Request/RequestSidebar.vue2.js +139 -155
  151. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  152. package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
  153. package/dist/views/Request/RequestSidebarItem.vue2.js +104 -101
  154. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  155. package/package.json +20 -18
  156. package/dist/v2/helpers/plugins.d.ts +0 -65
  157. package/dist/v2/helpers/plugins.d.ts.map +0 -1
  158. package/dist/v2/helpers/plugins.js +0 -11
@@ -1,27 +1,27 @@
1
- import { defineComponent as j, computed as n, ref as z, useId as s, watch as X, createBlock as C, openBlock as d, withCtx as q, createElementVNode as K, withDirectives as c, createElementBlock as x, createVNode as m, unref as v, vShow as y, mergeProps as B, toHandlers as b, Fragment as J, renderList as W, createCommentVNode as E, resolveDynamicComponent as Y, toDisplayString as Z } from "vue";
2
- import { ScalarErrorBoundary as _ } from "@scalar/components";
1
+ import { defineComponent as z, computed as n, ref as X, useId as s, watch as J, createBlock as q, openBlock as v, withCtx as C, createElementVNode as K, withDirectives as m, createElementBlock as B, createVNode as d, unref as y, vShow as c, mergeProps as f, toHandlers as b, Fragment as W, renderList as Y, createCommentVNode as E, resolveDynamicComponent as Z, toDisplayString as _ } from "vue";
2
+ import { ScalarErrorBoundary as ee } from "@scalar/components";
3
3
  import { canMethodHaveBody as w } from "@scalar/helpers/http/can-method-have-body";
4
- import { REGEX as ee } from "@scalar/helpers/regex/regex-helpers";
5
- import { getResolvedRef as R } from "@scalar/workspace-store/helpers/get-resolved-ref";
6
- import { unpackProxyObject as te } from "@scalar/workspace-store/helpers/unpack-proxy";
7
- import ae from "../../../components/SectionFilter.vue.js";
8
- import le from "../../../components/ViewLayout/ViewLayoutSection.vue.js";
9
- import { filterGlobalCookie as ne } from "../operation-block/helpers/filter-global-cookies.js";
10
- import { getExample as oe } from "../operation-block/helpers/get-example.js";
11
- import { getResolvedUrl as re } from "../operation-block/helpers/get-resolved-url.js";
12
- import ie from "./components/RequestBody.vue.js";
13
- import ue from "./components/RequestCodeSnippet.vue.js";
4
+ import { REGEX as te } from "@scalar/helpers/regex/regex-helpers";
5
+ import { getResolvedRef as p } from "@scalar/workspace-store/helpers/get-resolved-ref";
6
+ import { unpackProxyObject as ae } from "@scalar/workspace-store/helpers/unpack-proxy";
7
+ import le from "../../../components/SectionFilter.vue.js";
8
+ import ne from "../../../components/ViewLayout/ViewLayoutSection.vue.js";
9
+ import { filterGlobalCookie as oe } from "../operation-block/helpers/filter-global-cookies.js";
10
+ import { getExample as re } from "../operation-block/helpers/get-example.js";
11
+ import { getResolvedUrl as ie } from "../operation-block/helpers/get-resolved-url.js";
12
+ import ue from "./components/RequestBody.vue.js";
13
+ import se from "./components/RequestCodeSnippet.vue.js";
14
14
  import k from "./components/RequestParams.vue.js";
15
- import { createParameterHandlers as S } from "./helpers/create-parameter-handlers.js";
16
- import { getDefaultHeaders as se } from "./helpers/get-default-headers.js";
17
- import { getParameterSchema as me } from "./helpers/get-parameter-schema.js";
15
+ import { createParameterHandlers as g } from "./helpers/create-parameter-handlers.js";
16
+ import { getDefaultHeaders as me } from "./helpers/get-default-headers.js";
17
+ import { getParameterSchema as de } from "./helpers/get-parameter-schema.js";
18
18
  import { groupBy as D } from "./helpers/group-by.js";
19
- import { isParamDisabled as de } from "./helpers/is-param-disabled.js";
20
- import ce from "../scalar-auth-selector-block/components/AuthSelector.vue.js";
21
- const ve = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:pr-24" }, ye = ["for"], he = ["id", "placeholder", "value"], fe = {
19
+ import { isParamDisabled as ce } from "./helpers/is-param-disabled.js";
20
+ import ve from "../scalar-auth-selector-block/components/AuthSelector.vue.js";
21
+ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:pr-24" }, he = ["for"], fe = ["id", "placeholder", "value"], xe = {
22
22
  key: 2,
23
23
  class: "text-c-1 flex h-8 items-center"
24
- }, xe = ["id", "role"], Ne = /* @__PURE__ */ j({
24
+ }, Be = ["id", "role"], Te = /* @__PURE__ */ z({
25
25
  __name: "RequestBlock",
26
26
  props: {
27
27
  authMeta: { default: () => ({ type: "document" }) },
@@ -44,38 +44,38 @@ const ve = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
44
44
  server: {}
45
45
  },
46
46
  setup(e) {
47
- const r = n(() => ({
47
+ const o = n(() => ({
48
48
  method: e.method,
49
49
  path: e.path,
50
50
  exampleKey: e.exampleKey
51
- })), o = n(
51
+ })), r = n(
52
52
  () => D(
53
- e.operation.parameters?.map((t) => R(t)) ?? [],
53
+ e.operation.parameters?.map((t) => p(t)) ?? [],
54
54
  "in",
55
55
  (t) => {
56
- const a = oe(t, e.exampleKey, void 0);
56
+ const a = re(t, e.exampleKey, void 0);
57
57
  return {
58
58
  name: t.name,
59
59
  value: a?.value ?? "",
60
60
  description: t.description,
61
- schema: me(t),
61
+ schema: de(t),
62
62
  isRequired: t.required,
63
- isDisabled: de(t, a),
63
+ isDisabled: ce(t, a),
64
64
  originalParameter: t
65
65
  };
66
66
  }
67
67
  )
68
68
  ), I = n(
69
69
  () => D(
70
- o.value.header?.map((t) => ({
70
+ r.value.header?.map((t) => ({
71
71
  ...t,
72
72
  name: t.name.toLowerCase()
73
73
  })) ?? [],
74
74
  "name"
75
75
  )
76
76
  ), N = n(
77
- () => se({ method: e.method, operation: e.operation, exampleKey: e.exampleKey })
78
- ), V = n(() => {
77
+ () => me({ method: e.method, operation: e.operation, exampleKey: e.exampleKey })
78
+ ), R = n(() => {
79
79
  const t = e.operation["x-scalar-disable-parameters"]?.["default-headers"]?.[e.exampleKey] ?? {};
80
80
  return N.value.map((a) => {
81
81
  const l = I.value[a.name.toLowerCase()]?.[0];
@@ -89,17 +89,17 @@ const ve = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
89
89
  };
90
90
  });
91
91
  }), A = n(() => [
92
- ...V.value,
93
- ...o.value.header ?? []
94
- ]), P = n(() => {
95
- const t = re({
92
+ ...R.value,
93
+ ...r.value.header ?? []
94
+ ]), V = n(() => {
95
+ const t = ie({
96
96
  environment: e.environment,
97
97
  server: e.server,
98
98
  path: e.path,
99
99
  pathVariables: {}
100
100
  }), a = e.operation["x-scalar-disable-parameters"]?.["global-cookies"]?.[e.exampleKey] ?? {};
101
101
  return e.globalCookies?.filter(
102
- (l) => ne({
102
+ (l) => oe({
103
103
  cookie: l,
104
104
  url: t,
105
105
  // Do not filter global cookies for the default cookies section (it's already filtered in the buildRequestCookieHeader function)
@@ -109,14 +109,14 @@ const ve = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
109
109
  ).map((l) => ({
110
110
  name: l.name,
111
111
  value: l.value,
112
- globalRoute: l.location === "document" ? "document.cookies" : "workspace.cookies",
112
+ globalRoute: l.location === "document" ? { page: "document", path: "cookies" } : { page: "workspace", path: "cookies" },
113
113
  isReadonly: !0,
114
114
  isDisabled: a[l.name.toLowerCase()] ?? !1
115
115
  })) ?? [];
116
- }), H = n(() => [
117
- ...P.value ?? [],
118
- ...o.value.cookie ?? []
119
- ]), i = z("All"), T = [
116
+ }), P = n(() => [
117
+ ...V.value ?? [],
118
+ ...r.value.cookie ?? []
119
+ ]), i = X("All"), T = [
120
120
  "Auth",
121
121
  "Variables",
122
122
  "Cookies",
@@ -133,15 +133,15 @@ const ve = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
133
133
  Body: s()
134
134
  }, O = n(() => {
135
135
  const t = /* @__PURE__ */ new Set(["All", ...T]);
136
- return o.value.path?.length || t.delete("Variables"), w(e.method) || t.delete("Body"), U.value && t.delete("Auth"), [...t];
136
+ return r.value.path?.length || t.delete("Variables"), w(e.method) || t.delete("Body"), H.value && t.delete("Auth"), [...t];
137
137
  }), u = n(
138
138
  () => Object.fromEntries(
139
139
  O.value.map((t) => [t, $[t]])
140
140
  )
141
- ), U = n(
141
+ ), H = n(
142
142
  () => e.layout === "modal" && !e.operation.security && !Object.keys(e.securitySchemes ?? {}).length
143
- ), L = n(() => e.operation.summary ? e.operation.summary : e.path.replace(ee.PROTOCOL, "") || "Request Name"), h = (t) => i.value === "All" || i.value === t;
144
- X(
143
+ ), L = n(() => e.operation.summary ? e.operation.summary : e.path.replace(te.PROTOCOL, "") || "Request Name"), h = (t) => i.value === "All" || i.value === t;
144
+ J(
145
145
  () => e.method,
146
146
  (t) => {
147
147
  i.value === "Body" && !w(t) && (i.value = "All");
@@ -150,27 +150,27 @@ const ve = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
150
150
  const F = (t) => {
151
151
  const a = t.target.value;
152
152
  e.eventBus.emit("operation:update:summary", {
153
- meta: r.value,
153
+ meta: o.value,
154
154
  payload: { summary: a }
155
155
  });
156
- }, f = n(() => ({
157
- path: S("path", e.eventBus, r.value, {
158
- context: o.value.path ?? []
156
+ }, x = n(() => ({
157
+ path: g("path", e.eventBus, o.value, {
158
+ context: r.value.path ?? []
159
159
  }),
160
- cookie: S("cookie", e.eventBus, r.value, {
161
- context: H.value ?? [],
162
- globalParameters: P.value.length
160
+ cookie: g("cookie", e.eventBus, o.value, {
161
+ context: P.value ?? [],
162
+ globalParameters: V.value.length
163
163
  }),
164
- header: S("header", e.eventBus, r.value, {
164
+ header: g("header", e.eventBus, o.value, {
165
165
  context: A.value,
166
- defaultParameters: V.value.length
166
+ defaultParameters: R.value.length
167
167
  }),
168
- query: S("query", e.eventBus, r.value, {
169
- context: o.value.query ?? []
168
+ query: g("query", e.eventBus, o.value, {
169
+ context: r.value.query ?? []
170
170
  })
171
171
  })), G = (t) => e.eventBus.emit("operation:update:requestBody:contentType", {
172
172
  payload: { contentType: t.value },
173
- meta: r.value
173
+ meta: o.value
174
174
  }), Q = ({
175
175
  payload: t,
176
176
  contentType: a
@@ -181,7 +181,7 @@ const ve = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
181
181
  {
182
182
  payload: t,
183
183
  contentType: a,
184
- meta: r.value
184
+ meta: o.value
185
185
  },
186
186
  {
187
187
  debounceKey: l
@@ -195,48 +195,48 @@ const ve = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
195
195
  e.eventBus.emit(
196
196
  "operation:update:requestBody:formValue",
197
197
  {
198
- payload: t.map((g) => te(g, { depth: 1 })),
198
+ payload: t.map((S) => ae(S, { depth: 1 })),
199
199
  contentType: a,
200
- meta: r.value
200
+ meta: o.value
201
201
  },
202
202
  {
203
203
  debounceKey: l
204
204
  }
205
205
  );
206
- }, p = s();
207
- return (t, a) => (d(), C(le, {
206
+ }, U = s(), j = (t) => e.eventBus.emit("operation:update:extension", { payload: t, meta: o.value });
207
+ return (t, a) => (v(), q(ne, {
208
208
  "aria-label": `Request: ${e.operation.summary}`
209
209
  }, {
210
- title: q(() => [
211
- K("div", ve, [
212
- e.layout !== "modal" ? (d(), x("label", {
210
+ title: C(() => [
211
+ K("div", ye, [
212
+ e.layout !== "modal" ? (v(), B("label", {
213
213
  key: 0,
214
214
  class: "pointer-events-auto absolute top-0 left-0 h-full w-full cursor-text opacity-0",
215
- for: v(p)
216
- }, null, 8, ye)) : E("", !0),
217
- e.layout !== "modal" ? (d(), x("input", {
215
+ for: y(U)
216
+ }, null, 8, he)) : E("", !0),
217
+ e.layout !== "modal" ? (v(), B("input", {
218
218
  key: 1,
219
- id: v(p),
219
+ id: y(U),
220
220
  class: "text-c-1 group-hover-input pointer-events-auto relative z-10 -ml-0.5 h-8 w-full rounded pl-1.25 has-[:focus-visible]:outline md:-ml-1.25",
221
221
  placeholder: L.value,
222
222
  value: e.operation.summary,
223
223
  onInput: F
224
- }, null, 40, he)) : (d(), x("span", fe, Z(e.operation.summary), 1))
224
+ }, null, 40, fe)) : (v(), B("span", xe, _(e.operation.summary), 1))
225
225
  ]),
226
- m(ae, {
226
+ d(le, {
227
227
  modelValue: i.value,
228
228
  "onUpdate:modelValue": a[0] || (a[0] = (l) => i.value = l),
229
229
  filterIds: u.value,
230
230
  filters: O.value
231
231
  }, null, 8, ["modelValue", "filterIds", "filters"])
232
232
  ]),
233
- default: q(() => [
233
+ default: C(() => [
234
234
  K("div", {
235
235
  id: u.value.All,
236
236
  class: "request-section-content custom-scroll relative flex flex-1 flex-col",
237
237
  role: i.value === "All" ? "tabpanel" : "none"
238
238
  }, [
239
- c(m(v(ce), {
239
+ m(d(y(ve), {
240
240
  id: u.value.Auth,
241
241
  environment: e.environment,
242
242
  eventBus: e.eventBus,
@@ -249,74 +249,75 @@ const ve = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
249
249
  server: e.server,
250
250
  title: "Authentication"
251
251
  }, null, 8, ["id", "environment", "eventBus", "meta", "proxyUrl", "securityRequirements", "securitySchemes", "selectedSecurity", "selectedSecuritySchemes", "server"]), [
252
- [y, h("Auth") && !U.value]
252
+ [c, h("Auth") && !H.value]
253
253
  ]),
254
- c(m(k, B({
254
+ m(d(k, f({
255
255
  id: u.value.Variables,
256
256
  environment: e.environment,
257
257
  eventBus: e.eventBus,
258
258
  exampleKey: e.exampleKey,
259
- rows: o.value.path ?? [],
259
+ rows: r.value.path ?? [],
260
260
  showAddRowPlaceholder: !1,
261
261
  title: "Variables"
262
- }, b(f.value.path)), null, 16, ["id", "environment", "eventBus", "exampleKey", "rows"]), [
263
- [y, h("Variables") && o.value.path?.length]
262
+ }, b(x.value.path)), null, 16, ["id", "environment", "eventBus", "exampleKey", "rows"]), [
263
+ [c, h("Variables") && r.value.path?.length]
264
264
  ]),
265
- c(m(k, B({
265
+ m(d(k, f({
266
266
  id: u.value.Cookies,
267
267
  environment: e.environment,
268
268
  eventBus: e.eventBus,
269
269
  exampleKey: e.exampleKey,
270
- rows: H.value ?? [],
270
+ rows: P.value ?? [],
271
271
  showAddRowPlaceholder: !0,
272
272
  title: "Cookies"
273
- }, b(f.value.cookie)), null, 16, ["id", "environment", "eventBus", "exampleKey", "rows"]), [
274
- [y, h("Cookies")]
273
+ }, b(x.value.cookie)), null, 16, ["id", "environment", "eventBus", "exampleKey", "rows"]), [
274
+ [c, h("Cookies")]
275
275
  ]),
276
- c(m(k, B({
276
+ m(d(k, f({
277
277
  id: u.value.Headers,
278
278
  environment: e.environment,
279
279
  eventBus: e.eventBus,
280
280
  exampleKey: e.exampleKey,
281
281
  rows: A.value ?? [],
282
282
  title: "Headers"
283
- }, b(f.value.header)), null, 16, ["id", "environment", "eventBus", "exampleKey", "rows"]), [
284
- [y, h("Headers")]
283
+ }, b(x.value.header)), null, 16, ["id", "environment", "eventBus", "exampleKey", "rows"]), [
284
+ [c, h("Headers")]
285
285
  ]),
286
- c(m(k, B({
286
+ m(d(k, f({
287
287
  id: u.value.Query,
288
288
  environment: e.environment,
289
289
  eventBus: e.eventBus,
290
290
  exampleKey: e.exampleKey,
291
- rows: o.value.query ?? [],
291
+ rows: r.value.query ?? [],
292
292
  title: "Query Parameters"
293
- }, b(f.value.query)), null, 16, ["id", "environment", "eventBus", "exampleKey", "rows"]), [
294
- [y, h("Query")]
293
+ }, b(x.value.query)), null, 16, ["id", "environment", "eventBus", "exampleKey", "rows"]), [
294
+ [c, h("Query")]
295
295
  ]),
296
- c(m(ie, {
296
+ m(d(ue, {
297
297
  id: u.value.Body,
298
298
  environment: e.environment,
299
299
  exampleKey: e.exampleKey,
300
- requestBody: v(R)(e.operation.requestBody),
300
+ requestBody: y(p)(e.operation.requestBody),
301
301
  title: "Request Body",
302
302
  "onUpdate:contentType": G,
303
303
  "onUpdate:formValue": M,
304
304
  "onUpdate:value": Q
305
305
  }, null, 8, ["id", "environment", "exampleKey", "requestBody"]), [
306
- [y, h("Body") && v(w)(e.method)]
306
+ [c, h("Body") && y(w)(e.method)]
307
307
  ]),
308
- (d(!0), x(J, null, W(e.plugins, (l, g) => (d(), C(v(_), { key: g }, {
309
- default: q(() => [
310
- l?.components?.request ? (d(), C(Y(l.components.request), {
308
+ (v(!0), B(W, null, Y(e.plugins, (l, S) => (v(), q(y(ee), { key: S }, {
309
+ default: C(() => [
310
+ l?.components?.request ? m((v(), q(Z(l.components.request.component), f({
311
311
  key: 0,
312
- operation: e.operation,
313
- selectedExample: e.exampleKey
314
- }, null, 8, ["operation", "selectedExample"])) : E("", !0)
312
+ operation: e.operation
313
+ }, { ref_for: !0 }, l.components.request.additionalProps, { "onOperation:update:extension": j }), null, 16, ["operation"])), [
314
+ [c, i.value === "All"]
315
+ ]) : E("", !0)
315
316
  ]),
316
317
  _: 2
317
318
  }, 1024))), 128)),
318
319
  a[1] || (a[1] = K("div", { class: "flex grow" }, null, -1)),
319
- c(m(ue, {
320
+ m(d(se, {
320
321
  clientOptions: e.clientOptions,
321
322
  eventBus: e.eventBus,
322
323
  globalCookies: e.globalCookies,
@@ -326,17 +327,17 @@ const ve = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
326
327
  path: e.path,
327
328
  securitySchemes: e.selectedSecuritySchemes,
328
329
  selectedClient: e.selectedClient,
329
- selectedContentType: v(R)(e.operation.requestBody)?.["x-scalar-selected-content-type"]?.[e.exampleKey],
330
+ selectedContentType: y(p)(e.operation.requestBody)?.["x-scalar-selected-content-type"]?.[e.exampleKey],
330
331
  selectedServer: e.server ?? void 0
331
332
  }, null, 8, ["clientOptions", "eventBus", "globalCookies", "method", "operation", "path", "securitySchemes", "selectedClient", "selectedContentType", "selectedServer"]), [
332
- [y, i.value === "All"]
333
+ [c, i.value === "All"]
333
334
  ])
334
- ], 8, xe)
335
+ ], 8, Be)
335
336
  ]),
336
337
  _: 1
337
338
  }, 8, ["aria-label"]));
338
339
  }
339
340
  });
340
341
  export {
341
- Ne as default
342
+ Te as default
342
343
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RequestBody.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/components/RequestBody.vue"],"names":[],"mappings":"AA+RA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8DAA8D,CAAA;AAgBrG,KAAK,WAAW,GAAG;IACjB,mBAAmB;IACnB,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAA;IAClB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,2BAA2B;IAC3B,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAC;AAugBF,QAAA,MAAM,YAAY;;;;;;;;;;;eAlgB4B,MAAM;;;;;;;;;;;;;;;;;;eAAN,MAAM;;;;;;;kFAqgBlD,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"RequestBody.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/components/RequestBody.vue"],"names":[],"mappings":"AAkRA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8DAA8D,CAAA;AAiBrG,KAAK,WAAW,GAAG;IACjB,mBAAmB;IACnB,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAA;IAClB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,2BAA2B;IAC3B,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAC;AAyfF,QAAA,MAAM,YAAY;;;;;;;;;;;eApf4B,MAAM;;;;;;;;;;;;;;;;;;eAAN,MAAM;;;;;;;kFAuflD,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1,7 +1,7 @@
1
1
  import o from "./RequestBody.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../../../_virtual/_plugin-vue_export-helper.js";
4
- const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-0a6f7696"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-3d420065"]]);
5
5
  export {
6
- f as default
6
+ p as default
7
7
  };
@@ -1,9 +1,10 @@
1
- import { defineComponent as F, computed as d, watch as q, createBlock as p, openBlock as u, unref as t, withCtx as i, createVNode as r, createElementVNode as c, toDisplayString as v, createElementBlock as y, Fragment as O, createTextVNode as T } from "vue";
2
- import { ScalarListbox as S, ScalarButton as x, ScalarIcon as k } from "@scalar/components";
1
+ import { defineComponent as j, computed as s, createBlock as d, openBlock as u, unref as t, withCtx as a, createVNode as r, createElementVNode as c, toDisplayString as v, createElementBlock as y, Fragment as S, createTextVNode as T } from "vue";
2
+ import { ScalarListbox as D, ScalarButton as x, ScalarIcon as k } from "@scalar/components";
3
3
  import { unpackProxyObject as B } from "@scalar/workspace-store/helpers/unpack-proxy";
4
- import D from "./RequestBodyForm.vue.js";
4
+ import { getSelectedBodyContentType as O } from "../../operation-block/helpers/get-selected-body-content-type.js";
5
+ import U from "./RequestBodyForm.vue.js";
5
6
  import { getFileName as V } from "../helpers/files.js";
6
- import { getExampleFromBody as U } from "../helpers/get-request-body-example.js";
7
+ import { getExampleFromBody as q } from "../helpers/get-request-body-example.js";
7
8
  import E from "../../../components/layout/CollapsibleSection.vue.js";
8
9
  import L from "../../../components/data-table/DataTable.vue.js";
9
10
  import M from "../../../components/data-table/DataTableHeader.vue.js";
@@ -16,7 +17,7 @@ const R = {
16
17
  }, I = {
17
18
  key: 1,
18
19
  class: "flex items-center justify-center overflow-hidden border-t p-1.5"
19
- }, J = { class: "text-c-2 w-full max-w-full overflow-hidden rounded border px-1.5 py-1 text-xs whitespace-nowrap" }, ne = /* @__PURE__ */ F({
20
+ }, J = { class: "text-c-2 w-full max-w-full overflow-hidden rounded border px-1.5 py-1 text-xs whitespace-nowrap" }, ne = /* @__PURE__ */ j({
20
21
  __name: "RequestBody",
21
22
  props: {
22
23
  requestBody: {},
@@ -25,8 +26,8 @@ const R = {
25
26
  environment: {}
26
27
  },
27
28
  emits: ["update:contentType", "update:value", "update:formValue"],
28
- setup(l, { emit: C }) {
29
- const s = C, N = {
29
+ setup(i, { emit: C }) {
30
+ const p = C, N = {
30
31
  "application/json": "json",
31
32
  "application/xml": "xml",
32
33
  "application/yaml": "yaml"
@@ -40,72 +41,64 @@ const R = {
40
41
  "application/edn": "EDN",
41
42
  other: "Other",
42
43
  none: "None"
43
- }, n = d(
44
- () => l.requestBody?.["x-scalar-selected-content-type"]?.[l.exampleKey] ?? Object.keys(l.requestBody?.content ?? {})[0] ?? "none"
45
- );
46
- q(
47
- () => l.requestBody?.["x-scalar-selected-content-type"]?.[l.exampleKey],
48
- (o) => {
49
- o || s("update:contentType", { value: n.value });
50
- },
51
- { immediate: !0 }
52
- );
53
- const f = Object.entries(b).map(([o, e]) => ({
54
- id: o,
44
+ }, o = s(
45
+ () => O(i.requestBody, i.exampleKey) ?? "none"
46
+ ), f = Object.entries(b).map(([n, e]) => ({
47
+ id: n,
55
48
  label: e
56
- })), g = d({
49
+ })), g = s({
57
50
  get: () => f.find(
58
- (e) => e.id === n.value
51
+ (e) => e.id === o.value
59
52
  ) ?? f.at(-1),
60
- set: (o) => {
61
- s("update:contentType", { value: o.id });
53
+ set: (n) => {
54
+ p("update:contentType", { value: n.id });
62
55
  }
63
56
  });
64
- function h(o) {
57
+ function F(n) {
65
58
  const { open: e } = K({
66
- onChange: (a) => {
67
- const w = a?.[0];
68
- w && o(w);
59
+ onChange: (l) => {
60
+ const w = l?.[0];
61
+ w && n(w);
69
62
  },
70
63
  multiple: !1,
71
64
  accept: "*/*"
72
65
  });
73
66
  e();
74
67
  }
75
- const m = d(
76
- () => l.requestBody && U(l.requestBody, n.value, l.exampleKey)
77
- ), j = d(() => {
68
+ const m = s(
69
+ () => i.requestBody && q(i.requestBody, o.value, i.exampleKey)
70
+ ), h = s(() => {
78
71
  if (!m.value)
79
72
  return "";
80
- const o = m.value.value;
81
- return typeof o == "string" ? o : JSON.stringify(o, null, 2);
73
+ const n = m.value.value;
74
+ return typeof n == "string" ? n : JSON.stringify(n, null, 2);
82
75
  });
83
- return (o, e) => (u(), p(t(E), null, {
84
- title: i(() => [
85
- T(v(l.title), 1)
76
+ return (n, e) => (u(), d(t(E), null, {
77
+ title: a(() => [
78
+ T(v(i.title), 1)
86
79
  ]),
87
- default: i(() => [
80
+ default: a(() => [
88
81
  r(t(L), {
89
82
  columns: [""],
90
83
  presentational: ""
91
84
  }, {
92
- default: i(() => [
85
+ default: a(() => [
93
86
  r(t(M), { class: "relative col-span-full flex h-8 cursor-pointer items-center justify-between border-r-0 !p-0" }, {
94
- default: i(() => [
95
- r(t(S), {
87
+ default: a(() => [
88
+ r(t(D), {
96
89
  modelValue: g.value,
97
- "onUpdate:modelValue": e[0] || (e[0] = (a) => g.value = a),
90
+ "onUpdate:modelValue": e[0] || (e[0] = (l) => g.value = l),
98
91
  options: t(f),
99
92
  teleport: ""
100
93
  }, {
101
- default: i(() => [
94
+ default: a(() => [
102
95
  r(t(x), {
103
96
  class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-3 font-normal",
104
97
  fullWidth: "",
105
98
  variant: "ghost"
106
99
  }, {
107
- default: i(() => [
108
- c("span", null, v(b[n.value] ?? n.value), 1),
100
+ default: a(() => [
101
+ c("span", null, v(b[o.value] ?? o.value), 1),
109
102
  r(t(k), {
110
103
  icon: "ChevronDown",
111
104
  size: "md"
@@ -120,39 +113,39 @@ const R = {
120
113
  _: 1
121
114
  }),
122
115
  r(t($), null, {
123
- default: i(() => [
124
- n.value === "none" ? (u(), y("div", R, [...e[5] || (e[5] = [
116
+ default: a(() => [
117
+ o.value === "none" ? (u(), y("div", R, [...e[5] || (e[5] = [
125
118
  c("span", null, "No Body", -1)
126
- ])])) : n.value === "application/octet-stream" ? (u(), y("div", I, [
127
- t(V)(t(B)(m.value?.value)) !== void 0 ? (u(), y(O, { key: 0 }, [
119
+ ])])) : o.value === "application/octet-stream" ? (u(), y("div", I, [
120
+ t(V)(t(B)(m.value?.value)) !== void 0 ? (u(), y(S, { key: 0 }, [
128
121
  c("span", J, v(t(V)(t(B)(m.value?.value))), 1),
129
122
  r(t(x), {
130
123
  class: "bg-b-2 hover:bg-b-3 text-c-2 ml-1 border-0 shadow-none",
131
124
  size: "sm",
132
125
  variant: "outlined",
133
- onClick: e[1] || (e[1] = (a) => s("update:value", {
126
+ onClick: e[1] || (e[1] = (l) => p("update:value", {
134
127
  payload: void 0,
135
- contentType: n.value
128
+ contentType: o.value
136
129
  }))
137
130
  }, {
138
- default: i(() => [...e[6] || (e[6] = [
131
+ default: a(() => [...e[6] || (e[6] = [
139
132
  T(" Delete ", -1)
140
133
  ])]),
141
134
  _: 1
142
135
  })
143
- ], 64)) : (u(), p(t(x), {
136
+ ], 64)) : (u(), d(t(x), {
144
137
  key: 1,
145
138
  class: "bg-b-2 hover:bg-b-3 text-c-2 border-0 shadow-none",
146
139
  size: "sm",
147
140
  variant: "outlined",
148
- onClick: e[2] || (e[2] = () => h(
149
- (a) => s("update:value", {
150
- payload: a,
151
- contentType: n.value
141
+ onClick: e[2] || (e[2] = () => F(
142
+ (l) => p("update:value", {
143
+ payload: l,
144
+ contentType: o.value
152
145
  })
153
146
  ))
154
147
  }, {
155
- default: i(() => [
148
+ default: a(() => [
156
149
  e[7] || (e[7] = c("span", null, "Select File", -1)),
157
150
  r(t(k), {
158
151
  class: "ml-1",
@@ -163,27 +156,27 @@ const R = {
163
156
  ]),
164
157
  _: 1
165
158
  }))
166
- ])) : n.value === "multipart/form-data" || n.value === "application/x-www-form-urlencoded" ? (u(), p(D, {
159
+ ])) : o.value === "multipart/form-data" || o.value === "application/x-www-form-urlencoded" ? (u(), d(U, {
167
160
  key: 2,
168
- environment: l.environment,
161
+ environment: i.environment,
169
162
  example: m.value,
170
- selectedContentType: n.value,
171
- "onUpdate:formValue": e[3] || (e[3] = (a) => s("update:formValue", {
172
- payload: a,
173
- contentType: n.value
163
+ selectedContentType: o.value,
164
+ "onUpdate:formValue": e[3] || (e[3] = (l) => p("update:formValue", {
165
+ payload: l,
166
+ contentType: o.value
174
167
  }))
175
- }, null, 8, ["environment", "example", "selectedContentType"])) : (u(), p(t(z), {
168
+ }, null, 8, ["environment", "example", "selectedContentType"])) : (u(), d(t(z), {
176
169
  key: 3,
177
170
  class: "border-t px-3",
178
171
  content: "",
179
- environment: l.environment,
180
- language: N[n.value] ?? "plaintext",
172
+ environment: i.environment,
173
+ language: N[o.value] ?? "plaintext",
181
174
  lineNumbers: "",
182
175
  lint: "",
183
- modelValue: j.value,
184
- "onUpdate:modelValue": e[4] || (e[4] = (a) => s("update:value", {
185
- payload: a,
186
- contentType: n.value
176
+ modelValue: h.value,
177
+ "onUpdate:modelValue": e[4] || (e[4] = (l) => p("update:value", {
178
+ payload: l,
179
+ contentType: o.value
187
180
  }))
188
181
  }, null, 8, ["environment", "language", "modelValue"]))
189
182
  ]),