@scalar/api-client 2.37.0 → 2.38.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 (46) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/style.css +1 -1
  3. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  4. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +87 -78
  5. package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
  6. package/dist/v2/blocks/operation-block/components/Header.vue2.js +5 -5
  7. package/dist/v2/blocks/operation-block/helpers/response-cache.d.ts +30 -0
  8. package/dist/v2/blocks/operation-block/helpers/response-cache.d.ts.map +1 -0
  9. package/dist/v2/blocks/operation-block/helpers/response-cache.js +12 -0
  10. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  11. package/dist/v2/blocks/request-block/RequestBlock.vue.js +2 -2
  12. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +83 -80
  13. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  14. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
  15. package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +65 -61
  16. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.d.ts +3 -1
  17. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.d.ts.map +1 -1
  18. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.js +42 -32
  19. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  20. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts +4 -7
  21. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts.map +1 -1
  22. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +27 -7
  23. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +2 -0
  24. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  25. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +23 -21
  26. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  27. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +19 -14
  28. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  29. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +72 -66
  30. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +4 -4
  31. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +1 -1
  32. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  33. package/dist/v2/components/sidebar/SidebarMenu.vue.js +24 -22
  34. package/dist/v2/features/app/app-events.js +2 -2
  35. package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts +1 -1
  36. package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.js +3 -3
  37. package/dist/v2/features/collection/components/Form.vue.d.ts +1 -0
  38. package/dist/v2/features/collection/components/Form.vue.d.ts.map +1 -1
  39. package/dist/v2/features/collection/components/Form.vue.js +23 -23
  40. package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
  41. package/dist/v2/features/collection/components/Servers.vue.js +5 -4
  42. package/dist/v2/features/operation/Operation.vue.js +1 -1
  43. package/dist/v2/features/settings/components/Section.vue.d.ts.map +1 -1
  44. package/dist/v2/features/settings/components/Section.vue.js +10 -10
  45. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  46. package/package.json +11 -11
@@ -1,27 +1,27 @@
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 x, 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";
1
+ import { defineComponent as X, computed as n, ref as J, useId as s, watch as W, createBlock as q, openBlock as v, withCtx as C, createElementVNode as K, withDirectives as m, createElementBlock as x, createVNode as d, unref as y, vShow as c, mergeProps as f, toHandlers as b, Fragment as Y, renderList as Z, createCommentVNode as D, resolveDynamicComponent as _, toDisplayString as ee } from "vue";
2
+ import { ScalarErrorBoundary as te } from "@scalar/components";
3
3
  import { canMethodHaveBody as w } from "@scalar/helpers/http/can-method-have-body";
4
- import { REGEX as te } from "@scalar/helpers/regex/regex-helpers";
4
+ import { REGEX as ae } from "@scalar/helpers/regex/regex-helpers";
5
5
  import { getResolvedRef as R } 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";
6
+ import { unpackProxyObject as le } from "@scalar/workspace-store/helpers/unpack-proxy";
7
+ import ne from "../../../components/SectionFilter.vue.js";
8
+ import oe from "../../../components/ViewLayout/ViewLayoutSection.vue.js";
9
+ import { filterGlobalCookie as re } from "../operation-block/helpers/filter-global-cookies.js";
10
+ import { getExample as ue } from "../operation-block/helpers/get-example.js";
11
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";
12
+ import se from "./components/RequestBody.vue.js";
13
+ import me from "./components/RequestCodeSnippet.vue.js";
14
14
  import S from "./components/RequestParams.vue.js";
15
- import { createParameterHandlers as k } 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
- import { groupBy as D } from "./helpers/group-by.js";
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"], Be = {
15
+ import { createParameterHandlers as g } from "./helpers/create-parameter-handlers.js";
16
+ import { getDefaultHeaders as de } from "./helpers/get-default-headers.js";
17
+ import { getParameterSchema as ce } from "./helpers/get-parameter-schema.js";
18
+ import { groupBy as E } from "./helpers/group-by.js";
19
+ import { isParamDisabled as ve } from "./helpers/is-param-disabled.js";
20
+ import ye from "../scalar-auth-selector-block/components/AuthSelector.vue.js";
21
+ const he = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg:pr-24" }, fe = ["for"], Be = ["id", "placeholder", "value"], xe = {
22
22
  key: 2,
23
23
  class: "text-c-1 flex h-8 items-center"
24
- }, xe = ["id", "role"], Te = /* @__PURE__ */ z({
24
+ }, be = ["id", "role"], $e = /* @__PURE__ */ X({
25
25
  __name: "RequestBlock",
26
26
  props: {
27
27
  authMeta: { default: () => ({ type: "document" }) },
@@ -49,24 +49,24 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
49
49
  path: e.path,
50
50
  exampleKey: e.exampleKey
51
51
  })), r = n(
52
- () => D(
52
+ () => E(
53
53
  e.operation.parameters?.map((t) => R(t)) ?? [],
54
54
  "in",
55
55
  (t) => {
56
- const a = re(t, e.exampleKey, void 0);
56
+ const a = ue(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: de(t),
61
+ schema: ce(t),
62
62
  isRequired: t.required,
63
- isDisabled: ce(t, a),
63
+ isDisabled: ve(t, a),
64
64
  originalParameter: t
65
65
  };
66
66
  }
67
67
  )
68
68
  ), I = n(
69
- () => D(
69
+ () => E(
70
70
  r.value.header?.map((t) => ({
71
71
  ...t,
72
72
  name: t.name.toLowerCase()
@@ -74,7 +74,7 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
74
74
  "name"
75
75
  )
76
76
  ), N = n(
77
- () => me({ method: e.method, operation: e.operation, exampleKey: e.exampleKey })
77
+ () => de({ method: e.method, operation: e.operation, exampleKey: e.exampleKey })
78
78
  ), A = n(() => {
79
79
  const t = e.operation["x-scalar-disable-parameters"]?.["default-headers"]?.[e.exampleKey] ?? {};
80
80
  return N.value.map((a) => {
@@ -88,7 +88,7 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
88
88
  isDisabled: t[a.name.toLowerCase()] ?? !1
89
89
  };
90
90
  });
91
- }), p = n(() => [
91
+ }), O = n(() => [
92
92
  ...A.value,
93
93
  ...r.value.header ?? []
94
94
  ]), V = n(() => {
@@ -99,7 +99,7 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
99
99
  pathVariables: {}
100
100
  }), a = e.operation["x-scalar-disable-parameters"]?.["global-cookies"]?.[e.exampleKey] ?? {};
101
101
  return e.globalCookies?.filter(
102
- (l) => oe({
102
+ (l) => re({
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)
@@ -116,7 +116,7 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
116
116
  }), P = n(() => [
117
117
  ...V.value ?? [],
118
118
  ...r.value.cookie ?? []
119
- ]), i = X("All"), T = [
119
+ ]), u = J("All"), T = [
120
120
  "Auth",
121
121
  "Variables",
122
122
  "Cookies",
@@ -131,47 +131,49 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
131
131
  Headers: s(),
132
132
  Query: s(),
133
133
  Body: s()
134
- }, O = n(() => {
134
+ }, p = n(() => {
135
135
  const t = /* @__PURE__ */ new Set(["All", ...T]);
136
136
  return r.value.path?.length || t.delete("Variables"), w(e.method) || t.delete("Body"), H.value && t.delete("Auth"), [...t];
137
- }), u = n(
137
+ }), i = n(
138
138
  () => Object.fromEntries(
139
- O.value.map((t) => [t, $[t]])
139
+ p.value.map((t) => [t, $[t]])
140
140
  )
141
141
  ), H = n(
142
- () => e.layout === "modal" && !e.operation.security && !Object.keys(e.securitySchemes ?? {}).length
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(
142
+ () => e.layout === "modal" && !Object.keys(e.securitySchemes ?? {}).length
143
+ ), L = n(
144
+ () => e.layout !== "modal" || !!(e.securityRequirements?.length || e.selectedSecurity.selectedSchemes.length)
145
+ ), F = n(() => e.operation.summary ? e.operation.summary : e.path.replace(ae.PROTOCOL, "") || "Request Name"), h = (t) => u.value === "All" || u.value === t;
146
+ W(
145
147
  () => e.method,
146
148
  (t) => {
147
- i.value === "Body" && !w(t) && (i.value = "All");
149
+ u.value === "Body" && !w(t) && (u.value = "All");
148
150
  }
149
151
  );
150
- const F = (t) => {
152
+ const G = (t) => {
151
153
  const a = t.target.value;
152
154
  e.eventBus.emit("operation:update:meta", {
153
155
  meta: o.value,
154
156
  payload: { summary: a.trim() }
155
157
  });
156
158
  }, B = n(() => ({
157
- path: k("path", e.eventBus, o.value, {
159
+ path: g("path", e.eventBus, o.value, {
158
160
  context: r.value.path ?? []
159
161
  }),
160
- cookie: k("cookie", e.eventBus, o.value, {
162
+ cookie: g("cookie", e.eventBus, o.value, {
161
163
  context: P.value ?? [],
162
164
  globalParameters: V.value.length
163
165
  }),
164
- header: k("header", e.eventBus, o.value, {
165
- context: p.value,
166
+ header: g("header", e.eventBus, o.value, {
167
+ context: O.value,
166
168
  defaultParameters: A.value.length
167
169
  }),
168
- query: k("query", e.eventBus, o.value, {
170
+ query: g("query", e.eventBus, o.value, {
169
171
  context: r.value.query ?? []
170
172
  })
171
- })), G = (t) => e.eventBus.emit("operation:update:requestBody:contentType", {
173
+ })), Q = (t) => e.eventBus.emit("operation:update:requestBody:contentType", {
172
174
  payload: { contentType: t.value },
173
175
  meta: o.value
174
- }), Q = ({
176
+ }), M = ({
175
177
  payload: t,
176
178
  contentType: a
177
179
  }) => {
@@ -187,7 +189,7 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
187
189
  debounceKey: l
188
190
  }
189
191
  );
190
- }, M = ({
192
+ }, j = ({
191
193
  payload: t,
192
194
  contentType: a
193
195
  }) => {
@@ -195,7 +197,7 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
195
197
  e.eventBus.emit(
196
198
  "operation:update:requestBody:formValue",
197
199
  {
198
- payload: t.map((g) => ae(g, { depth: 1 })),
200
+ payload: t.map((k) => le(k, { depth: 1 })),
199
201
  contentType: a,
200
202
  meta: o.value
201
203
  },
@@ -203,42 +205,43 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
203
205
  debounceKey: l
204
206
  }
205
207
  );
206
- }, U = s(), j = (t) => e.eventBus.emit("operation:update:extension", { payload: t, meta: o.value });
207
- return (t, a) => (v(), q(ne, {
208
+ }, U = s(), z = (t) => e.eventBus.emit("operation:update:extension", { payload: t, meta: o.value });
209
+ return (t, a) => (v(), q(oe, {
208
210
  "aria-label": `Request: ${e.operation.summary}`
209
211
  }, {
210
212
  title: C(() => [
211
- K("div", ye, [
213
+ K("div", he, [
212
214
  e.layout !== "modal" ? (v(), x("label", {
213
215
  key: 0,
214
216
  class: "pointer-events-auto absolute top-0 left-0 h-full w-full cursor-text opacity-0",
215
217
  for: y(U)
216
- }, null, 8, he)) : E("", !0),
218
+ }, null, 8, fe)) : D("", !0),
217
219
  e.layout !== "modal" ? (v(), x("input", {
218
220
  key: 1,
219
221
  id: y(U),
220
222
  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
- placeholder: L.value,
223
+ placeholder: F.value,
222
224
  value: e.operation.summary,
223
- onBlur: F
224
- }, null, 40, fe)) : (v(), x("span", Be, _(e.operation.summary), 1))
225
+ onBlur: G
226
+ }, null, 40, Be)) : (v(), x("span", xe, ee(e.operation.summary), 1))
225
227
  ]),
226
- d(le, {
227
- modelValue: i.value,
228
- "onUpdate:modelValue": a[0] || (a[0] = (l) => i.value = l),
229
- filterIds: u.value,
230
- filters: O.value
228
+ d(ne, {
229
+ modelValue: u.value,
230
+ "onUpdate:modelValue": a[0] || (a[0] = (l) => u.value = l),
231
+ filterIds: i.value,
232
+ filters: p.value
231
233
  }, null, 8, ["modelValue", "filterIds", "filters"])
232
234
  ]),
233
235
  default: C(() => [
234
236
  K("div", {
235
- id: u.value.All,
237
+ id: i.value.All,
236
238
  class: "request-section-content custom-scroll relative flex flex-1 flex-col",
237
- role: i.value === "All" ? "tabpanel" : "none"
239
+ role: u.value === "All" ? "tabpanel" : "none"
238
240
  }, [
239
- m(d(y(ve), {
240
- id: u.value.Auth,
241
+ m(d(y(ye), {
242
+ id: i.value.Auth,
241
243
  createAnySecurityScheme: e.layout !== "modal",
244
+ defaultOpen: L.value,
242
245
  environment: e.environment,
243
246
  eventBus: e.eventBus,
244
247
  meta: e.authMeta,
@@ -249,11 +252,11 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
249
252
  selectedSecuritySchemes: e.selectedSecuritySchemes,
250
253
  server: e.server,
251
254
  title: "Authentication"
252
- }, null, 8, ["id", "createAnySecurityScheme", "environment", "eventBus", "meta", "proxyUrl", "securityRequirements", "securitySchemes", "selectedSecurity", "selectedSecuritySchemes", "server"]), [
255
+ }, null, 8, ["id", "createAnySecurityScheme", "defaultOpen", "environment", "eventBus", "meta", "proxyUrl", "securityRequirements", "securitySchemes", "selectedSecurity", "selectedSecuritySchemes", "server"]), [
253
256
  [c, h("Auth") && !H.value]
254
257
  ]),
255
258
  m(d(S, f({
256
- id: u.value.Variables,
259
+ id: i.value.Variables,
257
260
  environment: e.environment,
258
261
  eventBus: e.eventBus,
259
262
  exampleKey: e.exampleKey,
@@ -264,7 +267,7 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
264
267
  [c, h("Variables") && r.value.path?.length]
265
268
  ]),
266
269
  m(d(S, f({
267
- id: u.value.Cookies,
270
+ id: i.value.Cookies,
268
271
  environment: e.environment,
269
272
  eventBus: e.eventBus,
270
273
  exampleKey: e.exampleKey,
@@ -275,17 +278,17 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
275
278
  [c, h("Cookies")]
276
279
  ]),
277
280
  m(d(S, f({
278
- id: u.value.Headers,
281
+ id: i.value.Headers,
279
282
  environment: e.environment,
280
283
  eventBus: e.eventBus,
281
284
  exampleKey: e.exampleKey,
282
- rows: p.value ?? [],
285
+ rows: O.value ?? [],
283
286
  title: "Headers"
284
287
  }, b(B.value.header)), null, 16, ["id", "environment", "eventBus", "exampleKey", "rows"]), [
285
288
  [c, h("Headers")]
286
289
  ]),
287
290
  m(d(S, f({
288
- id: u.value.Query,
291
+ id: i.value.Query,
289
292
  environment: e.environment,
290
293
  eventBus: e.eventBus,
291
294
  exampleKey: e.exampleKey,
@@ -294,31 +297,31 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
294
297
  }, b(B.value.query)), null, 16, ["id", "environment", "eventBus", "exampleKey", "rows"]), [
295
298
  [c, h("Query")]
296
299
  ]),
297
- m(d(ue, {
298
- id: u.value.Body,
300
+ m(d(se, {
301
+ id: i.value.Body,
299
302
  environment: e.environment,
300
303
  exampleKey: e.exampleKey,
301
304
  requestBody: y(R)(e.operation.requestBody),
302
305
  title: "Request Body",
303
- "onUpdate:contentType": G,
304
- "onUpdate:formValue": M,
305
- "onUpdate:value": Q
306
+ "onUpdate:contentType": Q,
307
+ "onUpdate:formValue": j,
308
+ "onUpdate:value": M
306
309
  }, null, 8, ["id", "environment", "exampleKey", "requestBody"]), [
307
310
  [c, h("Body") && y(w)(e.method)]
308
311
  ]),
309
- (v(!0), x(W, null, Y(e.plugins, (l, g) => (v(), q(y(ee), { key: g }, {
312
+ (v(!0), x(Y, null, Z(e.plugins, (l, k) => (v(), q(y(te), { key: k }, {
310
313
  default: C(() => [
311
- l?.components?.request ? m((v(), q(Z(l.components.request.component), f({
314
+ l?.components?.request ? m((v(), q(_(l.components.request.component), f({
312
315
  key: 0,
313
316
  operation: e.operation
314
- }, { ref_for: !0 }, l.components.request.additionalProps, { "onOperation:update:extension": j }), null, 16, ["operation"])), [
315
- [c, i.value === "All"]
316
- ]) : E("", !0)
317
+ }, { ref_for: !0 }, l.components.request.additionalProps, { "onOperation:update:extension": z }), null, 16, ["operation"])), [
318
+ [c, u.value === "All"]
319
+ ]) : D("", !0)
317
320
  ]),
318
321
  _: 2
319
322
  }, 1024))), 128)),
320
323
  a[1] || (a[1] = K("div", { class: "flex grow" }, null, -1)),
321
- m(d(se, {
324
+ m(d(me, {
322
325
  clientOptions: e.clientOptions,
323
326
  eventBus: e.eventBus,
324
327
  globalCookies: e.globalCookies,
@@ -331,14 +334,14 @@ const ye = { class: "group pointer-events-none flex flex-1 items-center gap-1 lg
331
334
  selectedContentType: y(R)(e.operation.requestBody)?.["x-scalar-selected-content-type"]?.[e.exampleKey],
332
335
  selectedServer: e.server ?? void 0
333
336
  }, null, 8, ["clientOptions", "eventBus", "globalCookies", "method", "operation", "path", "securitySchemes", "selectedClient", "selectedContentType", "selectedServer"]), [
334
- [c, i.value === "All"]
337
+ [c, u.value === "All"]
335
338
  ])
336
- ], 8, xe)
339
+ ], 8, be)
337
340
  ]),
338
341
  _: 1
339
342
  }, 8, ["aria-label"]));
340
343
  }
341
344
  });
342
345
  export {
343
- Te as default
346
+ $e as default
344
347
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RequestBody.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/components/RequestBody.vue"],"names":[],"mappings":"AAwQA,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;AA4eF,QAAA,MAAM,YAAY;;;;;;;;;;;eAve4B,MAAM;;;;;;;;;;;;;;;;;;eAAN,MAAM;;;;;;;kFA0elD,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":"AAqRA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,8DAA8D,CAAA;AAgBrE,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;AAsfF,QAAA,MAAM,YAAY;;;;;;;;;;;eAjf4B,MAAM;;;;;;;;;;;;;;;;;;eAAN,MAAM;;;;;;;kFAoflD,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 m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-fd127758"]]);
4
+ const d = /* @__PURE__ */ t(o, [["__scopeId", "data-v-0fdec6da"]]);
5
5
  export {
6
- m as default
6
+ d as default
7
7
  };
@@ -1,25 +1,26 @@
1
- import { defineComponent as h, computed as d, createBlock as p, openBlock as u, unref as t, withCtx as a, createVNode as i, createElementVNode as f, toDisplayString as v, createElementBlock as y, Fragment as E, createTextVNode as T } from "vue";
1
+ import { defineComponent as q, computed as d, createBlock as p, openBlock as i, unref as t, withCtx as r, createVNode as u, createElementVNode as c, toDisplayString as v, createElementBlock as y, Fragment as E, createTextVNode as T } from "vue";
2
2
  import { ScalarListbox as F, ScalarButton as x, ScalarIcon as w } from "@scalar/components";
3
3
  import { CONTENT_TYPES as k } from "@scalar/helpers/consts/content-types";
4
- import { objectEntries as q } from "@scalar/helpers/object/object-entries";
5
- import { unpackProxyObject as C } from "@scalar/workspace-store/helpers/unpack-proxy";
6
- import { getSelectedBodyContentType as D } from "../../operation-block/helpers/get-selected-body-content-type.js";
7
- import U from "./RequestBodyForm.vue.js";
8
- import { getFileName as V } from "../helpers/files.js";
9
- import { getExampleFromBody as $ } from "../helpers/get-request-body-example.js";
10
- import z from "../../../components/layout/CollapsibleSection.vue.js";
11
- import O from "../../../components/data-table/DataTable.vue.js";
12
- import K from "../../../components/data-table/DataTableHeader.vue.js";
13
- import I from "../../../components/data-table/DataTableRow.vue.js";
14
- import L from "../../../components/code-input/CodeInput.vue.js";
15
- import { useFileDialog as M } from "../../../../hooks/useFileDialog.js";
16
- const P = {
4
+ import { objectEntries as D } from "@scalar/helpers/object/object-entries";
5
+ import { unpackProxyObject as B } from "@scalar/workspace-store/helpers/unpack-proxy";
6
+ import { resolve as U } from "@scalar/workspace-store/resolve";
7
+ import { getSelectedBodyContentType as $ } from "../../operation-block/helpers/get-selected-body-content-type.js";
8
+ import z from "./RequestBodyForm.vue.js";
9
+ import { getFileName as C } from "../helpers/files.js";
10
+ import { getExampleFromBody as O } from "../helpers/get-request-body-example.js";
11
+ import K from "../../../components/layout/CollapsibleSection.vue.js";
12
+ import I from "../../../components/data-table/DataTable.vue.js";
13
+ import L from "../../../components/data-table/DataTableHeader.vue.js";
14
+ import M from "../../../components/data-table/DataTableRow.vue.js";
15
+ import P from "../../../components/code-input/CodeInput.vue.js";
16
+ import { useFileDialog as R } from "../../../../hooks/useFileDialog.js";
17
+ const J = {
17
18
  key: 0,
18
19
  class: "text-c-3 flex min-h-10 w-full items-center justify-center border-t p-2 text-sm"
19
- }, R = {
20
+ }, W = {
20
21
  key: 1,
21
22
  class: "flex items-center justify-center overflow-hidden border-t p-1.5"
22
- }, J = { class: "text-c-2 w-full max-w-full overflow-hidden rounded border px-1.5 py-1 text-xs whitespace-nowrap" }, re = /* @__PURE__ */ h({
23
+ }, Y = { class: "text-c-2 w-full max-w-full overflow-hidden rounded border px-1.5 py-1 text-xs whitespace-nowrap" }, me = /* @__PURE__ */ q({
23
24
  __name: "RequestBody",
24
25
  props: {
25
26
  requestBody: {},
@@ -28,26 +29,26 @@ const P = {
28
29
  environment: {}
29
30
  },
30
31
  emits: ["update:contentType", "update:value", "update:formValue"],
31
- setup(r, { emit: B }) {
32
- const m = B, N = {
32
+ setup(a, { emit: V }) {
33
+ const m = V, h = {
33
34
  "application/json": "json",
34
35
  "application/xml": "xml",
35
36
  "application/yaml": "yaml"
36
37
  }, o = d(
37
- () => D(r.requestBody, r.exampleKey) ?? "none"
38
- ), c = q(k).map(([n, e]) => ({
38
+ () => $(a.requestBody, a.exampleKey) ?? "none"
39
+ ), f = D(k).map(([n, e]) => ({
39
40
  id: n,
40
41
  label: e
41
42
  })), b = d({
42
- get: () => c.find(
43
+ get: () => f.find(
43
44
  (e) => e.id === o.value
44
- ) ?? c.at(-1),
45
+ ) ?? f.at(-1),
45
46
  set: (n) => {
46
47
  m("update:contentType", { value: n.id });
47
48
  }
48
49
  });
49
50
  function S(n) {
50
- const { open: e } = M({
51
+ const { open: e } = R({
51
52
  onChange: (l) => {
52
53
  const g = l?.[0];
53
54
  g && n(g);
@@ -58,40 +59,42 @@ const P = {
58
59
  e();
59
60
  }
60
61
  const s = d(
61
- () => r.requestBody && $(r.requestBody, o.value, r.exampleKey)
62
- ), j = d(() => {
62
+ () => a.requestBody && O(a.requestBody, o.value, a.exampleKey)
63
+ ), N = d(() => {
63
64
  if (!s.value)
64
65
  return "";
65
66
  const n = s.value.value;
66
67
  return typeof n == "string" ? n : JSON.stringify(n, null, 2);
67
- });
68
- return (n, e) => (u(), p(t(z), null, {
69
- title: a(() => [
70
- T(v(r.title), 1)
68
+ }), j = d(() => U.schema(
69
+ a.requestBody?.content?.[o.value]?.schema
70
+ ));
71
+ return (n, e) => (i(), p(t(K), null, {
72
+ title: r(() => [
73
+ T(v(a.title), 1)
71
74
  ]),
72
- default: a(() => [
73
- i(t(O), {
75
+ default: r(() => [
76
+ u(t(I), {
74
77
  columns: [""],
75
78
  presentational: ""
76
79
  }, {
77
- default: a(() => [
78
- i(t(K), { class: "relative col-span-full flex h-8 cursor-pointer items-center justify-between border-r-0 !p-0" }, {
79
- default: a(() => [
80
- i(t(F), {
80
+ default: r(() => [
81
+ u(t(L), { class: "relative col-span-full flex h-8 cursor-pointer items-center justify-between border-r-0 !p-0" }, {
82
+ default: r(() => [
83
+ u(t(F), {
81
84
  modelValue: b.value,
82
85
  "onUpdate:modelValue": e[0] || (e[0] = (l) => b.value = l),
83
- options: t(c),
86
+ options: t(f),
84
87
  teleport: ""
85
88
  }, {
86
- default: a(() => [
87
- i(t(x), {
89
+ default: r(() => [
90
+ u(t(x), {
88
91
  class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-3 font-normal",
89
92
  fullWidth: "",
90
93
  variant: "ghost"
91
94
  }, {
92
- default: a(() => [
93
- f("span", null, v(t(k)[o.value] ?? o.value), 1),
94
- i(t(w), {
95
+ default: r(() => [
96
+ c("span", null, v(t(k)[o.value] ?? o.value), 1),
97
+ u(t(w), {
95
98
  icon: "ChevronDown",
96
99
  size: "md"
97
100
  })
@@ -104,14 +107,14 @@ const P = {
104
107
  ]),
105
108
  _: 1
106
109
  }),
107
- i(t(I), null, {
108
- default: a(() => [
109
- o.value === "none" ? (u(), y("div", P, [...e[5] || (e[5] = [
110
- f("span", null, "No Body", -1)
111
- ])])) : o.value === "application/octet-stream" ? (u(), y("div", R, [
112
- t(V)(t(C)(s.value?.value)) !== void 0 ? (u(), y(E, { key: 0 }, [
113
- f("span", J, v(t(V)(t(C)(s.value?.value))), 1),
114
- i(t(x), {
110
+ u(t(M), null, {
111
+ default: r(() => [
112
+ o.value === "none" ? (i(), y("div", J, [...e[5] || (e[5] = [
113
+ c("span", null, "No Body", -1)
114
+ ])])) : o.value === "application/octet-stream" ? (i(), y("div", W, [
115
+ t(C)(t(B)(s.value?.value)) !== void 0 ? (i(), y(E, { key: 0 }, [
116
+ c("span", Y, v(t(C)(t(B)(s.value?.value))), 1),
117
+ u(t(x), {
115
118
  class: "bg-b-2 hover:bg-b-3 text-c-2 ml-1 border-0 shadow-none",
116
119
  size: "sm",
117
120
  variant: "outlined",
@@ -120,12 +123,12 @@ const P = {
120
123
  contentType: o.value
121
124
  }))
122
125
  }, {
123
- default: a(() => [...e[6] || (e[6] = [
126
+ default: r(() => [...e[6] || (e[6] = [
124
127
  T(" Delete ", -1)
125
128
  ])]),
126
129
  _: 1
127
130
  })
128
- ], 64)) : (u(), p(t(x), {
131
+ ], 64)) : (i(), p(t(x), {
129
132
  key: 1,
130
133
  class: "bg-b-2 hover:bg-b-3 text-c-2 border-0 shadow-none",
131
134
  size: "sm",
@@ -137,9 +140,9 @@ const P = {
137
140
  })
138
141
  ))
139
142
  }, {
140
- default: a(() => [
141
- e[7] || (e[7] = f("span", null, "Select File", -1)),
142
- i(t(w), {
143
+ default: r(() => [
144
+ e[7] || (e[7] = c("span", null, "Select File", -1)),
145
+ u(t(w), {
143
146
  class: "ml-1",
144
147
  icon: "Upload",
145
148
  size: "xs",
@@ -148,24 +151,25 @@ const P = {
148
151
  ]),
149
152
  _: 1
150
153
  }))
151
- ])) : o.value === "multipart/form-data" || o.value === "application/x-www-form-urlencoded" ? (u(), p(U, {
154
+ ])) : o.value === "multipart/form-data" || o.value === "application/x-www-form-urlencoded" ? (i(), p(z, {
152
155
  key: 2,
153
- environment: r.environment,
156
+ bodySchema: j.value,
157
+ environment: a.environment,
154
158
  example: s.value,
155
159
  selectedContentType: o.value,
156
160
  "onUpdate:formValue": e[3] || (e[3] = (l) => m("update:formValue", {
157
161
  payload: l,
158
162
  contentType: o.value
159
163
  }))
160
- }, null, 8, ["environment", "example", "selectedContentType"])) : (u(), p(t(L), {
164
+ }, null, 8, ["bodySchema", "environment", "example", "selectedContentType"])) : (i(), p(t(P), {
161
165
  key: 3,
162
166
  class: "border-t px-3",
163
167
  content: "",
164
- environment: r.environment,
165
- language: N[o.value] ?? "plaintext",
168
+ environment: a.environment,
169
+ language: h[o.value] ?? "plaintext",
166
170
  lineNumbers: "",
167
171
  lint: "",
168
- modelValue: j.value,
172
+ modelValue: N.value,
169
173
  "onUpdate:modelValue": e[4] || (e[4] = (l) => m("update:value", {
170
174
  payload: l,
171
175
  contentType: o.value
@@ -183,5 +187,5 @@ const P = {
183
187
  }
184
188
  });
185
189
  export {
186
- re as default
190
+ me as default
187
191
  };
@@ -1,7 +1,9 @@
1
1
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
2
- import type { ExampleObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ import type { ExampleObject, SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
3
  type __VLS_Props = {
4
4
  example: ExampleObject | undefined | null;
5
+ /** Resolved schema for the form body so the table can show enums and validation per field */
6
+ bodySchema?: SchemaObject;
5
7
  selectedContentType: string;
6
8
  environment: XScalarEnvironment;
7
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RequestBodyForm.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/components/RequestBodyForm.vue"],"names":[],"mappings":"AAqHA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAOjG,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CAAA;IACzC,mBAAmB,EAAE,MAAM,CAAA;IAC3B,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAC;AA0KF,QAAA,MAAM,YAAY;;;;;;;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"RequestBodyForm.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/components/RequestBodyForm.vue"],"names":[],"mappings":"AAoIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACb,MAAM,8DAA8D,CAAA;AAQrE,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CAAA;IACzC,6FAA6F;IAC7F,UAAU,CAAC,EAAE,YAAY,CAAA;IACzB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAC;AAmLF,QAAA,MAAM,YAAY;;;;;;;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}