@scalar/api-reference 1.25.115 → 1.25.116

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 (57) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/browser/standalone.js +10903 -10880
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/Content/Lazy/Loading.vue.d.ts.map +1 -1
  5. package/dist/components/Content/Lazy/Loading.vue.js +58 -60
  6. package/dist/components/Content/Tag/TagList.vue.d.ts.map +1 -1
  7. package/dist/components/Content/Tag/TagList.vue.js +36 -38
  8. package/dist/components/Sidebar/SidebarElement.vue.d.ts.map +1 -1
  9. package/dist/components/Sidebar/SidebarElement.vue.js +1 -1
  10. package/dist/components/Sidebar/SidebarElement.vue2.js +59 -55
  11. package/dist/features/ApiClientModal/useApiClient.d.ts +18 -18
  12. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  13. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts +6 -4
  14. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
  15. package/dist/features/ExampleRequest/ExampleRequest.vue.js +2 -2
  16. package/dist/features/ExampleRequest/ExampleRequest.vue2.js +138 -119
  17. package/dist/features/ExampleRequest/helpers/filter-security-requirements.d.ts +6 -0
  18. package/dist/features/ExampleRequest/helpers/filter-security-requirements.d.ts.map +1 -0
  19. package/dist/features/ExampleRequest/helpers/filter-security-requirements.js +17 -0
  20. package/dist/features/Operation/Operation.vue.d.ts +4 -5
  21. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  22. package/dist/features/Operation/Operation.vue.js +34 -41
  23. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +6 -6
  24. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  25. package/dist/features/Operation/layouts/ClassicLayout.vue.js +4 -4
  26. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +52 -51
  27. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +6 -6
  28. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  29. package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
  30. package/dist/features/Operation/layouts/ModernLayout.vue2.js +70 -70
  31. package/dist/helpers/convert-to-har-request.d.ts +28 -0
  32. package/dist/helpers/convert-to-har-request.d.ts.map +1 -0
  33. package/dist/helpers/convert-to-har-request.js +64 -0
  34. package/dist/helpers/get-example-code.d.ts +9 -0
  35. package/dist/helpers/get-example-code.d.ts.map +1 -0
  36. package/dist/helpers/get-example-code.js +51 -0
  37. package/dist/helpers/index.d.ts +0 -3
  38. package/dist/helpers/index.d.ts.map +1 -1
  39. package/dist/hooks/useNavState.d.ts.map +1 -1
  40. package/dist/hooks/useNavState.js +26 -24
  41. package/dist/hooks/useReactiveSpec.d.ts +1 -1
  42. package/dist/index.js +66 -72
  43. package/dist/style.css +1 -1
  44. package/package.json +10 -10
  45. package/dist/features/Operation/hooks/useRequestExample.d.ts +0 -17
  46. package/dist/features/Operation/hooks/useRequestExample.d.ts.map +0 -1
  47. package/dist/features/Operation/hooks/useRequestExample.js +0 -68
  48. package/dist/helpers/convertRequestToHarRequest.d.ts +0 -7
  49. package/dist/helpers/convertRequestToHarRequest.d.ts.map +0 -1
  50. package/dist/helpers/convertRequestToHarRequest.js +0 -64
  51. package/dist/helpers/get-request.js +0 -6
  52. package/dist/helpers/getExampleCode.d.ts +0 -8
  53. package/dist/helpers/getExampleCode.d.ts.map +0 -1
  54. package/dist/helpers/getExampleCode.js +0 -16
  55. package/dist/helpers/joinWithSlash.d.ts +0 -5
  56. package/dist/helpers/joinWithSlash.d.ts.map +0 -1
  57. package/dist/helpers/joinWithSlash.js +0 -4
@@ -1,66 +1,66 @@
1
- import { defineComponent as y, openBlock as a, createBlock as s, unref as o, createSlots as C, withCtx as n, createElementVNode as t, createVNode as i, toDisplayString as c, normalizeClass as _, createTextVNode as v, createCommentVNode as m, withModifiers as q } from "vue";
1
+ import { defineComponent as v, openBlock as a, createBlock as s, unref as e, createSlots as O, withCtx as n, createElementVNode as t, createVNode as r, toDisplayString as m, normalizeClass as y, createTextVNode as _, createCommentVNode as c, withModifiers as C } from "vue";
2
2
  import b from "../../../components/OperationPath.vue.js";
3
3
  import { useConfig as k } from "../../../hooks/useConfig.js";
4
- import { ScalarIcon as g, ScalarIconButton as E, ScalarMarkdown as S } from "@scalar/components";
5
- import { useClipboard as B } from "@scalar/use-hooks/useClipboard";
6
- import R from "../components/OperationParameters.vue.js";
7
- import V from "../components/OperationResponses.vue.js";
8
- import w from "../../../components/Section/SectionAccordion.vue.js";
9
- import I from "../../../components/HttpMethod/HttpMethod.vue.js";
10
- import N from "../../../components/Anchor/Anchor.vue.js";
11
- import { isOperationDeprecated as O, getOperationStability as u, getOperationStabilityColor as T } from "../../../helpers/operation.js";
12
- import $ from "../../../components/Badge/Badge.vue.js";
4
+ import { ScalarIcon as g, ScalarIconButton as S, ScalarMarkdown as B } from "@scalar/components";
5
+ import { useClipboard as R } from "@scalar/use-hooks/useClipboard";
6
+ import w from "../components/OperationParameters.vue.js";
7
+ import I from "../components/OperationResponses.vue.js";
8
+ import N from "../../../components/Section/SectionAccordion.vue.js";
9
+ import T from "../../../components/HttpMethod/HttpMethod.vue.js";
10
+ import V from "../../../components/Anchor/Anchor.vue.js";
11
+ import { isOperationDeprecated as $, getOperationStability as f, getOperationStabilityColor as q } from "../../../helpers/operation.js";
12
+ import E from "../../../components/Badge/Badge.vue.js";
13
13
  import z from "../../TestRequestButton/TestRequestButton.vue.js";
14
14
  import A from "../../ExampleResponses/ExampleResponses.vue.js";
15
15
  import D from "../../ExampleRequest/ExampleRequest.vue.js";
16
- const L = { class: "operation-title" }, M = { class: "operation-details" }, P = { class: "endpoint-label" }, U = { class: "endpoint-label-path" }, j = { class: "endpoint-label-name" }, F = { class: "endpoint-content" }, G = { class: "operation-details-card" }, H = { class: "operation-details-card-item" }, J = { class: "operation-details-card-item" }, de = /* @__PURE__ */ y({
16
+ const L = { class: "operation-title" }, M = { class: "operation-details" }, P = { class: "endpoint-label" }, U = { class: "endpoint-label-path" }, j = { class: "endpoint-label-name" }, F = { class: "endpoint-content" }, G = { class: "operation-details-card" }, H = { class: "operation-details-card-item" }, J = { class: "operation-details-card-item" }, mo = /* @__PURE__ */ v({
17
17
  __name: "ClassicLayout",
18
18
  props: {
19
19
  id: {},
20
- requestEntity: {},
20
+ collection: {},
21
+ server: {},
21
22
  operation: {},
22
- request: {},
23
- secretCredentials: {}
23
+ transformedOperation: {}
24
24
  },
25
25
  setup(K) {
26
- const { copyToClipboard: f } = B(), h = k();
27
- return (e, p) => {
26
+ const { copyToClipboard: u } = R(), h = k();
27
+ return (o, p) => {
28
28
  var l;
29
- return a(), s(o(w), {
30
- id: e.id,
29
+ return a(), s(e(N), {
30
+ id: o.id,
31
31
  class: "reference-endpoint",
32
32
  transparent: ""
33
- }, C({
33
+ }, O({
34
34
  title: n(() => [
35
35
  t("h3", L, [
36
36
  t("div", M, [
37
- i(o(I), {
37
+ r(e(T), {
38
38
  class: "endpoint-type",
39
- method: e.operation.httpVerb,
39
+ method: o.operation.method,
40
40
  short: ""
41
41
  }, null, 8, ["method"]),
42
- i(o(N), {
43
- id: e.id ?? "",
42
+ r(e(V), {
43
+ id: o.id ?? "",
44
44
  class: "endpoint-anchor"
45
45
  }, {
46
46
  default: n(() => [
47
47
  t("div", P, [
48
48
  t("div", U, [
49
- i(b, {
50
- deprecated: o(O)(e.operation),
51
- path: e.operation.path
49
+ r(b, {
50
+ deprecated: e($)(o.transformedOperation),
51
+ path: o.operation.path
52
52
  }, null, 8, ["deprecated", "path"])
53
53
  ]),
54
- t("div", j, c(e.operation.name), 1),
55
- o(u)(e.operation) ? (a(), s(o($), {
54
+ t("div", j, m(o.transformedOperation.name), 1),
55
+ e(f)(o.transformedOperation) ? (a(), s(e(E), {
56
56
  key: 0,
57
- class: _(o(T)(e.operation))
57
+ class: y(e(q)(o.transformedOperation))
58
58
  }, {
59
59
  default: n(() => [
60
- v(c(o(u)(e.operation)), 1)
60
+ _(m(e(f)(o.transformedOperation)), 1)
61
61
  ]),
62
62
  _: 1
63
- }, 8, ["class"])) : m("", !0)
63
+ }, 8, ["class"])) : c("", !0)
64
64
  ])
65
65
  ]),
66
66
  _: 1
@@ -68,25 +68,25 @@ const L = { class: "operation-title" }, M = { class: "operation-details" }, P =
68
68
  ])
69
69
  ])
70
70
  ]),
71
- actions: n(({ active: r }) => {
71
+ actions: n(({ active: i }) => {
72
72
  var d;
73
73
  return [
74
- r ? (a(), s(o(z), {
74
+ i ? (a(), s(e(z), {
75
75
  key: 0,
76
- operation: e.requestEntity
77
- }, null, 8, ["operation"])) : (d = o(h)) != null && d.hideTestRequestButton ? m("", !0) : (a(), s(o(g), {
76
+ operation: o.operation
77
+ }, null, 8, ["operation"])) : (d = e(h)) != null && d.hideTestRequestButton ? c("", !0) : (a(), s(e(g), {
78
78
  key: 1,
79
79
  class: "endpoint-try-hint",
80
80
  icon: "Play",
81
81
  thickness: "1.75px"
82
82
  })),
83
- i(o(E), {
83
+ r(e(S), {
84
84
  class: "endpoint-copy",
85
85
  icon: "Clipboard",
86
86
  label: "Copy endpoint URL",
87
87
  size: "xs",
88
88
  variant: "ghost",
89
- onClick: p[0] || (p[0] = q((Q) => o(f)(e.operation.path), ["stop"]))
89
+ onClick: p[0] || (p[0] = C((Q) => e(u)(o.operation.path), ["stop"]))
90
90
  })
91
91
  ];
92
92
  }),
@@ -94,32 +94,33 @@ const L = { class: "operation-title" }, M = { class: "operation-details" }, P =
94
94
  t("div", F, [
95
95
  t("div", G, [
96
96
  t("div", H, [
97
- i(R, { operation: e.requestEntity }, null, 8, ["operation"])
97
+ r(w, { operation: o.operation }, null, 8, ["operation"])
98
98
  ]),
99
99
  t("div", J, [
100
- i(V, {
100
+ r(I, {
101
101
  collapsableItems: !1,
102
- operation: e.operation
102
+ operation: o.transformedOperation
103
103
  }, null, 8, ["operation"])
104
104
  ])
105
105
  ]),
106
- i(o(A), { operation: e.operation }, null, 8, ["operation"]),
107
- i(o(D), {
108
- operation: e.operation,
109
- request: e.request,
110
- secretCredentials: e.secretCredentials
111
- }, null, 8, ["operation", "request", "secretCredentials"])
106
+ r(e(A), { operation: o.transformedOperation }, null, 8, ["operation"]),
107
+ r(e(D), {
108
+ collection: o.collection,
109
+ operation: o.operation,
110
+ server: o.server,
111
+ transformedOperation: o.transformedOperation
112
+ }, null, 8, ["collection", "operation", "server", "transformedOperation"])
112
113
  ])
113
114
  ]),
114
115
  _: 2
115
116
  }, [
116
- (l = e.requestEntity) != null && l.description ? {
117
+ (l = o.operation) != null && l.description ? {
117
118
  name: "description",
118
119
  fn: n(() => {
119
- var r;
120
+ var i;
120
121
  return [
121
- i(o(S), {
122
- value: (r = e.requestEntity) == null ? void 0 : r.description,
122
+ r(e(B), {
123
+ value: (i = o.operation) == null ? void 0 : i.description,
123
124
  withImages: ""
124
125
  }, null, 8, ["value"])
125
126
  ];
@@ -131,5 +132,5 @@ const L = { class: "operation-title" }, M = { class: "operation-details" }, P =
131
132
  }
132
133
  });
133
134
  export {
134
- de as default
135
+ mo as default
135
136
  };
@@ -1,12 +1,12 @@
1
- import type { Request as RequestEntity } from '@scalar/oas-utils/entities/spec';
1
+ import type { Collection, Operation, Server } from '@scalar/oas-utils/entities/spec';
2
2
  import type { TransformedOperation } from '@scalar/types/legacy';
3
3
  type __VLS_Props = {
4
4
  id?: string;
5
- /** @deprecated Use `requestEntity` instead */
6
- operation: TransformedOperation;
7
- requestEntity?: RequestEntity;
8
- request: Request | null;
9
- secretCredentials: string[];
5
+ collection: Collection;
6
+ server: Server | undefined;
7
+ operation: Operation;
8
+ /** @deprecated Use `operation` instead */
9
+ transformedOperation: TransformedOperation;
10
10
  };
11
11
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
12
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ModernLayout.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/layouts/ModernLayout.vue"],"names":[],"mappings":"AAoIA,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAQhE,KAAK,WAAW,GAAG;IACjB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,8CAA8C;IAC9C,SAAS,EAAE,oBAAoB,CAAA;IAC/B,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IACvB,iBAAiB,EAAE,MAAM,EAAE,CAAA;CAC5B,CAAC;;AAwNF,wBAOG"}
1
+ {"version":3,"file":"ModernLayout.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/layouts/ModernLayout.vue"],"names":[],"mappings":"AA4IA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,MAAM,EACP,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAQhE,KAAK,WAAW,GAAG;IACjB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,SAAS,EAAE,SAAS,CAAA;IACpB,0CAA0C;IAC1C,oBAAoB,EAAE,oBAAoB,CAAA;CAC3C,CAAC;;AA0NF,wBAOG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./ModernLayout.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ec5acf12"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-04e2a492"]]);
5
5
  export {
6
- e as default
6
+ m as default
7
7
  };
@@ -1,55 +1,57 @@
1
- import { defineComponent as c, openBlock as n, createBlock as l, unref as o, withCtx as r, createVNode as t, normalizeClass as p, createTextVNode as s, toDisplayString as m, createCommentVNode as h, createElementVNode as i } from "vue";
2
- import C from "../../../components/OperationPath.vue.js";
3
- import { getOperationStability as d, getOperationStabilityColor as y, isOperationDeprecated as q } from "../../../helpers/operation.js";
4
- import { ScalarMarkdown as S, ScalarErrorBoundary as u } from "@scalar/components";
1
+ import { defineComponent as c, openBlock as i, createBlock as l, unref as o, withCtx as t, createVNode as r, normalizeClass as p, createTextVNode as m, toDisplayString as d, createCommentVNode as O, createElementVNode as a } from "vue";
2
+ import h from "../../../components/OperationPath.vue.js";
3
+ import { getOperationStability as s, getOperationStabilityColor as v, isOperationDeprecated as S } from "../../../helpers/operation.js";
4
+ import { ScalarMarkdown as C, ScalarErrorBoundary as f } from "@scalar/components";
5
5
  import _ from "../components/OperationParameters.vue.js";
6
- import E from "../components/OperationResponses.vue.js";
6
+ import y from "../components/OperationResponses.vue.js";
7
7
  import g from "../../../components/Section/Section.vue.js";
8
- import v from "../../../components/Section/SectionContent.vue.js";
9
- import b from "../../../components/Badge/Badge.vue.js";
10
- import k from "../../../components/Section/SectionHeader.vue.js";
11
- import B from "../../../components/Anchor/Anchor.vue.js";
8
+ import b from "../../../components/Section/SectionContent.vue.js";
9
+ import k from "../../../components/Badge/Badge.vue.js";
10
+ import B from "../../../components/Section/SectionHeader.vue.js";
11
+ import E from "../../../components/Anchor/Anchor.vue.js";
12
12
  import N from "../../../components/Section/SectionColumns.vue.js";
13
- import f from "../../../components/Section/SectionColumn.vue.js";
14
- import O from "../../ExampleRequest/ExampleRequest.vue.js";
15
- import V from "../../TestRequestButton/TestRequestButton.vue.js";
16
- import w from "../../ExampleResponses/ExampleResponses.vue.js";
17
- const R = { class: "operation-details" }, D = { class: "examples" }, Y = /* @__PURE__ */ c({
13
+ import u from "../../../components/Section/SectionColumn.vue.js";
14
+ import V from "../../ExampleRequest/ExampleRequest.vue.js";
15
+ import w from "../../TestRequestButton/TestRequestButton.vue.js";
16
+ import R from "../../ExampleResponses/ExampleResponses.vue.js";
17
+ const q = { class: "operation-details" }, D = { class: "examples" }, Y = /* @__PURE__ */ c({
18
18
  __name: "ModernLayout",
19
19
  props: {
20
20
  id: {},
21
+ collection: {},
22
+ server: {},
21
23
  operation: {},
22
- requestEntity: {},
23
- request: {},
24
- secretCredentials: {}
24
+ transformedOperation: {}
25
25
  },
26
26
  setup(M) {
27
- return (e, T) => (n(), l(o(g), {
27
+ return (e, T) => (i(), l(o(g), {
28
28
  id: e.id,
29
- label: e.operation.name
29
+ label: e.transformedOperation.name
30
30
  }, {
31
- default: r(() => [
32
- t(o(v), null, {
33
- default: r(() => [
34
- o(d)(e.operation) ? (n(), l(o(b), {
31
+ default: t(() => [
32
+ r(o(b), null, {
33
+ default: t(() => [
34
+ o(s)(e.transformedOperation) ? (i(), l(o(k), {
35
35
  key: 0,
36
- class: p(o(y)(e.operation))
36
+ class: p(o(v)(e.transformedOperation))
37
37
  }, {
38
- default: r(() => [
39
- s(m(o(d)(e.operation)), 1)
38
+ default: t(() => [
39
+ m(d(o(s)(e.transformedOperation)), 1)
40
40
  ]),
41
41
  _: 1
42
- }, 8, ["class"])) : h("", !0),
43
- i("div", {
44
- class: p(o(q)(e.operation) ? "deprecated" : "")
42
+ }, 8, ["class"])) : O("", !0),
43
+ a("div", {
44
+ class: p(
45
+ o(S)(e.transformedOperation) ? "deprecated" : ""
46
+ )
45
47
  }, [
46
- t(o(k), { level: 3 }, {
47
- default: r(() => [
48
- t(o(B), {
48
+ r(o(B), { level: 3 }, {
49
+ default: t(() => [
50
+ r(o(E), {
49
51
  id: e.id ?? ""
50
52
  }, {
51
- default: r(() => [
52
- s(m(e.operation.name), 1)
53
+ default: t(() => [
54
+ m(d(e.transformedOperation.name), 1)
53
55
  ]),
54
56
  _: 1
55
57
  }, 8, ["id"])
@@ -57,57 +59,55 @@ const R = { class: "operation-details" }, D = { class: "examples" }, Y = /* @__P
57
59
  _: 1
58
60
  })
59
61
  ], 2),
60
- t(o(N), null, {
61
- default: r(() => [
62
- t(o(f), null, {
63
- default: r(() => {
64
- var a;
65
- return [
66
- i("div", R, [
67
- t(o(S), {
68
- value: (a = e.requestEntity) == null ? void 0 : a.description,
69
- withImages: ""
70
- }, null, 8, ["value"]),
71
- t(_, { operation: e.requestEntity }, null, 8, ["operation"]),
72
- t(E, { operation: e.operation }, null, 8, ["operation"])
73
- ])
74
- ];
75
- }),
62
+ r(o(N), null, {
63
+ default: t(() => [
64
+ r(o(u), null, {
65
+ default: t(() => [
66
+ a("div", q, [
67
+ r(o(C), {
68
+ value: e.operation.description,
69
+ withImages: ""
70
+ }, null, 8, ["value"]),
71
+ r(_, { operation: e.operation }, null, 8, ["operation"]),
72
+ r(y, { operation: e.transformedOperation }, null, 8, ["operation"])
73
+ ])
74
+ ]),
76
75
  _: 1
77
76
  }),
78
- t(o(f), null, {
79
- default: r(() => [
80
- i("div", D, [
81
- t(o(u), null, {
82
- default: r(() => [
83
- t(o(O), {
77
+ r(o(u), null, {
78
+ default: t(() => [
79
+ a("div", D, [
80
+ r(o(f), null, {
81
+ default: t(() => [
82
+ r(o(V), {
83
+ collection: e.collection,
84
84
  fallback: "",
85
85
  operation: e.operation,
86
- request: e.request,
87
- secretCredentials: e.secretCredentials
86
+ server: e.server,
87
+ transformedOperation: e.transformedOperation
88
88
  }, {
89
- header: r(() => {
90
- var a;
89
+ header: t(() => {
90
+ var n;
91
91
  return [
92
- t(C, {
92
+ r(h, {
93
93
  class: "example-path",
94
- deprecated: (a = e.operation.information) == null ? void 0 : a.deprecated,
95
- path: e.operation.path
94
+ deprecated: (n = e.transformedOperation.information) == null ? void 0 : n.deprecated,
95
+ path: e.transformedOperation.path
96
96
  }, null, 8, ["deprecated", "path"])
97
97
  ];
98
98
  }),
99
- footer: r(() => [
100
- t(o(V), { operation: e.requestEntity }, null, 8, ["operation"])
99
+ footer: t(() => [
100
+ r(o(w), { operation: e.operation }, null, 8, ["operation"])
101
101
  ]),
102
102
  _: 1
103
- }, 8, ["operation", "request", "secretCredentials"])
103
+ }, 8, ["collection", "operation", "server", "transformedOperation"])
104
104
  ]),
105
105
  _: 1
106
106
  }),
107
- t(o(u), null, {
108
- default: r(() => [
109
- t(o(w), {
110
- operation: e.operation,
107
+ r(o(f), null, {
108
+ default: t(() => [
109
+ r(o(R), {
110
+ operation: e.transformedOperation,
111
111
  style: { "margin-top": "12px" }
112
112
  }, null, 8, ["operation"])
113
113
  ]),
@@ -0,0 +1,28 @@
1
+ import type { Operation, RequestExample } from '@scalar/oas-utils/entities/spec';
2
+ import type { HarRequest } from '@scalar/snippetz';
3
+ type Props = {
4
+ baseUrl: string | undefined;
5
+ body?: RequestExample['body'];
6
+ cookies: {
7
+ key: string;
8
+ value: string;
9
+ enabled: boolean;
10
+ }[];
11
+ headers: {
12
+ key: string;
13
+ value: string;
14
+ enabled: boolean;
15
+ }[];
16
+ query: {
17
+ key: string;
18
+ value: string;
19
+ enabled: boolean;
20
+ }[];
21
+ } & Pick<Operation, 'method' | 'path'>;
22
+ /**
23
+ * Takes in a regular request object and returns a HAR request
24
+ * We also Titlecase the headers and remove accept header if it's *
25
+ */
26
+ export declare const convertToHarRequest: ({ baseUrl, method, body, path, cookies, headers, query, }: Props) => HarRequest;
27
+ export {};
28
+ //# sourceMappingURL=convert-to-har-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-to-har-request.d.ts","sourceRoot":"","sources":["../../src/helpers/convert-to-har-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAEhF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,IAAI,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IAC7B,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;IAC3D,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;IAC3D,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;CAC1D,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,GAAG,MAAM,CAAC,CAAA;AAEtC;;;GAGG;AACH,eAAO,MAAM,mBAAmB,8DAQ7B,KAAK,KAAG,UA4GV,CAAA"}
@@ -0,0 +1,64 @@
1
+ import { combineUrlAndPath as S } from "@scalar/oas-utils/helpers";
2
+ const w = ({
3
+ baseUrl: u = "",
4
+ method: g,
5
+ body: r,
6
+ path: h,
7
+ cookies: s,
8
+ headers: o,
9
+ query: m
10
+ }) => {
11
+ var p, c, l;
12
+ const D = S(u, h), i = {
13
+ method: g.toUpperCase(),
14
+ url: D.toString(),
15
+ httpVersion: "HTTP/1.1",
16
+ headers: [],
17
+ queryString: [],
18
+ cookies: [],
19
+ headersSize: -1,
20
+ bodySize: -1
21
+ };
22
+ if (s.length && (i.cookies = s.filter((e) => e.enabled).map(({ key: e, value: t }) => ({
23
+ name: e,
24
+ value: t
25
+ }))), o.length && (i.headers = o.filter(
26
+ (e) => e.enabled && !(e.key.toLowerCase() === "accept" && e.value === "*/*")
27
+ ).map(({ key: e, value: t }) => ({
28
+ name: e.replace(/\b\w/g, (a) => a.toUpperCase()),
29
+ value: t
30
+ }))), m.length && (i.queryString = m.filter((e) => e.enabled).map(({ key: e, value: t }) => ({
31
+ name: e,
32
+ value: t
33
+ }))), r)
34
+ try {
35
+ const e = ((p = o.find((t) => t.key.toLowerCase() === "content-type")) == null ? void 0 : p.value) || "application/json";
36
+ if (r.activeBody === "formData" && r.formData) {
37
+ const t = {};
38
+ r.formData.value.forEach(({ key: a, value: f, file: n }) => {
39
+ n ? t[a] = {
40
+ type: "file",
41
+ text: "BINARY",
42
+ name: a || "blob",
43
+ size: n.size,
44
+ fileName: n.name,
45
+ mimeType: n.type || "application/octet-stream"
46
+ } : t[a] ? (Array.isArray(t[a]) || (t[a] = [t[a]]), t[a].push(f)) : t[a] = f;
47
+ }), ((c = r.formData) == null ? void 0 : c.encoding) === "urlencoded" ? i.postData = {
48
+ mimeType: e,
49
+ text: new URLSearchParams(t).toString()
50
+ } : i.postData = {
51
+ mimeType: e,
52
+ text: JSON.stringify(t)
53
+ };
54
+ } else r.activeBody === "raw" && r.raw && (i.postData = {
55
+ mimeType: e,
56
+ text: ((l = r.raw) == null ? void 0 : l.value) ?? ""
57
+ });
58
+ } catch {
59
+ }
60
+ return i;
61
+ };
62
+ export {
63
+ w as convertToHarRequest
64
+ };
@@ -0,0 +1,9 @@
1
+ import type { Operation, RequestExample, SecurityScheme, Server } from '@scalar/oas-utils/entities/spec';
2
+ import { type ClientId as SnippetzClientId, type TargetId as SnippetzTargetId } from '@scalar/snippetz';
3
+ export type TargetId = SnippetzTargetId;
4
+ export type ClientId<T extends SnippetzTargetId> = SnippetzClientId<T>;
5
+ /**
6
+ * Returns a code example for given operation
7
+ */
8
+ export declare function getExampleCode<T extends SnippetzTargetId>(operation: Operation, example: RequestExample, target: TargetId | string, client: ClientId<T> | string, server: Server | undefined, securitySchemes?: SecurityScheme[]): Promise<string | undefined>;
9
+ //# sourceMappingURL=get-example-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-example-code.d.ts","sourceRoot":"","sources":["../../src/helpers/get-example-code.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,cAAc,EACd,MAAM,EACP,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,KAAK,QAAQ,IAAI,gBAAgB,EACjC,KAAK,QAAQ,IAAI,gBAAgB,EAElC,MAAM,kBAAkB,CAAA;AAIzB,MAAM,MAAM,QAAQ,GAAG,gBAAgB,CAAA;AACvC,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,gBAAgB,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAA;AAItE;;GAEG;AACH,wBAAsB,cAAc,CAAC,CAAC,SAAS,gBAAgB,EAC7D,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,QAAQ,GAAG,MAAM,EACzB,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,EAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,eAAe,GAAE,cAAc,EAAO,+BAoEvC"}
@@ -0,0 +1,51 @@
1
+ import { buildRequestSecurity as b } from "@scalar/api-client/libs/send-request";
2
+ import { snippetz as i } from "@scalar/snippetz";
3
+ import { convertToHarRequest as l } from "./convert-to-har-request.js";
4
+ const E = "YOUR_SECRET_TOKEN";
5
+ async function q(n, r, t, u, a, p = []) {
6
+ const s = b(
7
+ p,
8
+ {},
9
+ E
10
+ ), m = [
11
+ ...r.parameters.headers,
12
+ ...Object.entries(s.headers).map(([e, o]) => ({
13
+ key: e,
14
+ value: o,
15
+ enabled: !0
16
+ }))
17
+ ], d = [
18
+ ...r.parameters.cookies,
19
+ ...s.cookies.map((e) => ({
20
+ key: e.name,
21
+ value: e.value,
22
+ enabled: !0
23
+ }))
24
+ ], y = [
25
+ ...r.parameters.query,
26
+ ...Array.from(s.urlParams.entries()).map(([e, o]) => ({
27
+ key: e,
28
+ value: o,
29
+ enabled: !0
30
+ }))
31
+ ], h = await l({
32
+ baseUrl: a == null ? void 0 : a.url,
33
+ method: n.method,
34
+ path: n.path,
35
+ body: r.body,
36
+ cookies: d,
37
+ headers: m,
38
+ query: y
39
+ }), c = t == null ? void 0 : t.replace(
40
+ "javascript",
41
+ "js"
42
+ );
43
+ return i().hasPlugin(c, u) ? i().print(
44
+ c,
45
+ u,
46
+ h
47
+ ) : "";
48
+ }
49
+ export {
50
+ q as getExampleCode
51
+ };
@@ -1,8 +1,6 @@
1
1
  export * from './createEmptySpecification.js';
2
2
  export * from './deepMerge.js';
3
3
  export * from './operation.js';
4
- export * from './getExampleCode.js';
5
- export * from './convertRequestToHarRequest.js';
6
4
  export * from './getHeadingsFromMarkdown.js';
7
5
  export * from './getLowestHeadingLevel.js';
8
6
  export * from './getModels.js';
@@ -11,7 +9,6 @@ export * from './hasModels.js';
11
9
  export * from './hasSecuritySchemes.js';
12
10
  export * from './hasWebhooks.js';
13
11
  export * from './isMacOs.js';
14
- export * from './joinWithSlash.js';
15
12
  export * from './mapFromObject.js';
16
13
  export * from './mergeAllObjects.js';
17
14
  export * from './parse.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,iBAAiB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useNavState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNavState.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAI9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAqF3C;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;IAsDpB,mCAAmC;4BACX,MAAM;IAG9B;;;;OAIG;+BAnF0B,MAAM;IAqFnC;;;;;OAKG;oCApGY,MAAM;IAsGrB;;;OAGG;uCA9HY,MAAM;IAgIrB,0DAA0D;;6BAjC5B;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;yBA5BrC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;4BATb,OAAO;gCAyBH,oBAAoB,aAAa,GAAG;iCA9GrC,MAAM;;oBAuGjB,GAAG;;;;CAiE3B,CAAA"}
1
+ {"version":3,"file":"useNavState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNavState.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAI9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAwF3C;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;IAsDpB,mCAAmC;4BACX,MAAM;IAG9B;;;;OAIG;+BAnF0B,MAAM;IAqFnC;;;;;OAKG;oCApGY,MAAM;IAsGrB;;;OAGG;uCAjIY,MAAM;IAmIrB,0DAA0D;;6BAjC5B;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;yBA5BrC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;4BATb,OAAO;gCAyBH,oBAAoB,aAAa,GAAG;iCAjHrC,MAAM;;oBA0GjB,GAAG;;;;CAiE3B,CAAA"}