@scalar/api-client 2.18.4 → 2.19.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 (226) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/components/AddressBar/AddressBar.vue2.js +5 -5
  3. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +6 -6
  4. package/dist/components/ImportCollection/DropEventListener.vue.d.ts.map +1 -1
  5. package/dist/components/ImportCollection/DropEventListener.vue.js +26 -28
  6. package/dist/components/ImportCollection/utils/get-openapi-version.d.ts.map +1 -1
  7. package/dist/components/ImportCollection/utils/import-collection.d.ts +1 -1
  8. package/dist/components/ImportCollection/utils/import-collection.d.ts.map +1 -1
  9. package/dist/components/Search/useSearch.d.ts.map +1 -1
  10. package/dist/components/Search/useSearch.js +16 -16
  11. package/dist/components/Server/index.d.ts +1 -1
  12. package/dist/components/Server/index.d.ts.map +1 -1
  13. package/dist/components/Server/index.js +6 -6
  14. package/dist/components/SideNav/SideNav.vue.js +3 -3
  15. package/dist/components/Sidebar/index.d.ts +1 -2
  16. package/dist/components/Sidebar/index.d.ts.map +1 -1
  17. package/dist/components/index.d.ts +2 -2
  18. package/dist/components/index.d.ts.map +1 -1
  19. package/dist/hooks/index.d.ts +2 -2
  20. package/dist/hooks/index.d.ts.map +1 -1
  21. package/dist/hooks/useResponseBody.d.ts +1 -1
  22. package/dist/hooks/useResponseBody.d.ts.map +1 -1
  23. package/dist/hooks/useResponseBody.js +4 -4
  24. package/dist/hooks/useSidebar.d.ts +1 -1
  25. package/dist/hooks/useSidebar.d.ts.map +1 -1
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/layouts/App/ApiClientApp.vue.js +5 -5
  29. package/dist/layouts/App/MainLayout.vue.js +4 -4
  30. package/dist/layouts/App/create-api-client-app.d.ts +12 -12
  31. package/dist/layouts/App/index.d.ts +1 -1
  32. package/dist/layouts/App/index.d.ts.map +1 -1
  33. package/dist/layouts/Web/ApiClientWeb.vue.js +6 -6
  34. package/dist/layouts/Web/create-api-client-web.d.ts +12 -12
  35. package/dist/layouts/Web/index.d.ts +1 -1
  36. package/dist/layouts/Web/index.d.ts.map +1 -1
  37. package/dist/libs/create-client.d.ts +12 -12
  38. package/dist/libs/get-request-uid-by-path-method.d.ts +1 -1
  39. package/dist/libs/get-request-uid-by-path-method.d.ts.map +1 -1
  40. package/dist/libs/hot-keys.d.ts +2 -2
  41. package/dist/libs/hot-keys.d.ts.map +1 -1
  42. package/dist/libs/importers/curl.d.ts.map +1 -1
  43. package/dist/libs/index.d.ts +14 -15
  44. package/dist/libs/index.d.ts.map +1 -1
  45. package/dist/libs/index.js +33 -33
  46. package/dist/libs/parse-curl.js +4 -4
  47. package/dist/libs/send-request/create-fetch-body.d.ts +1 -1
  48. package/dist/libs/send-request/create-fetch-body.d.ts.map +1 -1
  49. package/dist/libs/send-request/create-fetch-body.js +1 -1
  50. package/dist/libs/send-request/create-fetch-headers.d.ts.map +1 -1
  51. package/dist/libs/send-request/create-fetch-query-params.d.ts.map +1 -1
  52. package/dist/libs/send-request/create-fetch-query-params.js +2 -1
  53. package/dist/libs/send-request/index.d.ts +1 -1
  54. package/dist/libs/send-request/index.d.ts.map +1 -1
  55. package/dist/libs/send-request/index.js +4 -4
  56. package/dist/libs/send-request/set-request-cookies.d.ts.map +1 -1
  57. package/dist/libs/send-request/set-request-cookies.js +4 -4
  58. package/dist/store/active-entities.d.ts +1 -1
  59. package/dist/store/collections.d.ts +1 -1
  60. package/dist/store/collections.d.ts.map +1 -1
  61. package/dist/store/collections.js +4 -4
  62. package/dist/store/environment.d.ts +1 -1
  63. package/dist/store/environment.d.ts.map +1 -1
  64. package/dist/store/environment.js +4 -4
  65. package/dist/store/import-spec.d.ts +2 -2
  66. package/dist/store/import-spec.d.ts.map +1 -1
  67. package/dist/store/index.d.ts +1 -1
  68. package/dist/store/index.d.ts.map +1 -1
  69. package/dist/store/request-example.d.ts +1 -1
  70. package/dist/store/request-example.d.ts.map +1 -1
  71. package/dist/store/request-example.js +6 -6
  72. package/dist/store/requests.d.ts +1 -1
  73. package/dist/store/requests.d.ts.map +1 -1
  74. package/dist/store/requests.js +8 -8
  75. package/dist/store/security-schemes.d.ts +1 -1
  76. package/dist/store/security-schemes.d.ts.map +1 -1
  77. package/dist/store/security-schemes.js +4 -4
  78. package/dist/store/servers.d.ts +1 -1
  79. package/dist/store/servers.d.ts.map +1 -1
  80. package/dist/store/servers.js +4 -4
  81. package/dist/store/store.d.ts +12 -12
  82. package/dist/store/tags.d.ts +1 -1
  83. package/dist/store/tags.d.ts.map +1 -1
  84. package/dist/store/tags.js +5 -5
  85. package/dist/store/workspace.d.ts +13 -13
  86. package/dist/store/workspace.d.ts.map +1 -1
  87. package/dist/store/workspace.js +7 -7
  88. package/dist/style.css +1 -1
  89. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +4 -5
  90. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  91. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +17 -16
  92. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts +3 -3
  93. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts.map +1 -1
  94. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js +22 -22
  95. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +1 -1
  96. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js +14 -13
  97. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
  98. package/dist/v2/blocks/operation-block/helpers/build-request.js +43 -41
  99. package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.d.ts +14 -0
  100. package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.d.ts.map +1 -0
  101. package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.js +14 -0
  102. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts +25 -0
  103. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.d.ts.map +1 -0
  104. package/dist/v2/blocks/operation-block/helpers/get-resolved-url.js +17 -0
  105. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +10 -0
  106. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  107. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
  108. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +29 -25
  109. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +6 -1
  110. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -1
  111. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js +27 -23
  112. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +12 -12
  113. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +10 -1
  114. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  115. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +48 -39
  116. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
  117. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +49 -46
  118. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.d.ts +1 -1
  119. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.d.ts.map +1 -1
  120. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.js +1 -1
  121. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +6 -2
  122. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  123. package/dist/v2/blocks/request-block/RequestBlock.vue.js +2 -2
  124. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +200 -115
  125. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts +4 -4
  126. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.d.ts.map +1 -1
  127. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.js +44 -47
  128. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
  129. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js +21 -17
  130. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts +8 -20
  131. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
  132. package/dist/v2/blocks/request-block/components/RequestParams.vue.js +29 -40
  133. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +11 -18
  134. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  135. package/dist/v2/blocks/request-block/components/RequestTable.vue.js +3 -3
  136. package/dist/v2/blocks/request-block/components/RequestTable.vue2.js +30 -40
  137. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +33 -18
  138. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  139. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +106 -106
  140. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts +11 -14
  141. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts.map +1 -1
  142. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.js +43 -31
  143. package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts +41 -0
  144. package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts.map +1 -0
  145. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +25 -0
  146. package/dist/v2/blocks/request-block/helpers/group-by.d.ts +1 -1
  147. package/dist/v2/blocks/request-block/helpers/group-by.d.ts.map +1 -1
  148. package/dist/v2/blocks/request-block/helpers/group-by.js +6 -3
  149. package/dist/v2/blocks/request-block/helpers/is-param-disabled.d.ts +13 -0
  150. package/dist/v2/blocks/request-block/helpers/is-param-disabled.d.ts.map +1 -0
  151. package/dist/v2/blocks/request-block/helpers/is-param-disabled.js +7 -0
  152. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  153. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  154. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +61 -63
  155. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +1 -2
  156. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  157. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +2 -2
  158. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +2 -2
  159. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +1 -2
  160. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
  161. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +2 -2
  162. package/dist/v2/components/code-input/CodeInput.vue.d.ts +2 -0
  163. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  164. package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
  165. package/dist/v2/components/code-input/CodeInput.vue2.js +57 -51
  166. package/dist/v2/features/app/App.vue.js +6 -6
  167. package/dist/v2/features/app/app-events.d.ts +5 -9
  168. package/dist/v2/features/app/app-events.d.ts.map +1 -1
  169. package/dist/v2/features/app/app-events.js +143 -120
  170. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  171. package/dist/v2/features/app/app-state.js +69 -71
  172. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  173. package/dist/v2/features/app/components/AppSidebar.vue2.js +5 -5
  174. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  175. package/dist/v2/features/modal/Modal.vue.js +1 -1
  176. package/dist/v2/features/modal/Modal.vue2.js +21 -22
  177. package/dist/v2/features/modal/index.d.ts +1 -1
  178. package/dist/v2/features/modal/index.d.ts.map +1 -1
  179. package/dist/v2/features/modal/index.js +4 -4
  180. package/dist/v2/features/modal/modal-events.d.ts +13 -0
  181. package/dist/v2/features/modal/modal-events.d.ts.map +1 -0
  182. package/dist/v2/features/modal/modal-events.js +31 -0
  183. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  184. package/dist/v2/features/operation/Operation.vue.js +30 -43
  185. package/dist/v2/workspace-events.d.ts +25 -0
  186. package/dist/v2/workspace-events.d.ts.map +1 -0
  187. package/dist/v2/workspace-events.js +199 -0
  188. package/dist/views/Components/CodeSnippet/helpers/convert-to-har-request.d.ts.map +1 -1
  189. package/dist/views/Components/CodeSnippet/helpers/get-snippet.d.ts +1 -1
  190. package/dist/views/Components/CodeSnippet/helpers/get-snippet.d.ts.map +1 -1
  191. package/dist/views/Cookies/Cookies.vue2.js +3 -3
  192. package/dist/views/Environment/handle-drag.d.ts +1 -1
  193. package/dist/views/Environment/handle-drag.d.ts.map +1 -1
  194. package/dist/views/Request/RequestRoot.vue2.js +9 -9
  195. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue2.js +4 -4
  196. package/dist/views/Request/RequestSection/RequestCodeExample.vue2.js +4 -4
  197. package/dist/views/Request/RequestSection/RequestSection.vue2.js +5 -5
  198. package/dist/views/Request/RequestSection/helpers/update-scheme.d.ts.map +1 -1
  199. package/dist/views/Request/RequestSidebar.vue2.js +6 -6
  200. package/dist/views/Request/RequestSidebarItem.vue2.js +6 -6
  201. package/dist/views/Request/RequestSubpageHeader.vue2.js +4 -4
  202. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  203. package/dist/views/Request/ResponseSection/index.d.ts +1 -1
  204. package/dist/views/Request/ResponseSection/index.d.ts.map +1 -1
  205. package/dist/views/Request/ResponseSection/index.js +4 -4
  206. package/dist/views/Request/consts/index.d.ts +2 -3
  207. package/dist/views/Request/consts/index.d.ts.map +1 -1
  208. package/dist/views/Request/consts/new-auth-options.d.ts +1 -1
  209. package/dist/views/Request/consts/new-auth-options.d.ts.map +1 -1
  210. package/dist/views/Request/handle-drag.d.ts +1 -1
  211. package/dist/views/Request/handle-drag.d.ts.map +1 -1
  212. package/dist/views/Request/hooks/useOpenApiWatcher.d.ts.map +1 -1
  213. package/dist/views/Request/hooks/useOpenApiWatcher.js +14 -14
  214. package/dist/views/Request/libs/auth.d.ts +1 -1
  215. package/dist/views/Request/libs/auth.d.ts.map +1 -1
  216. package/dist/views/Request/libs/index.d.ts +3 -3
  217. package/dist/views/Request/libs/index.d.ts.map +1 -1
  218. package/dist/views/Request/libs/oauth2.js +1 -1
  219. package/dist/views/Request/libs/watch-mode.js +6 -6
  220. package/dist/views/Request/types/index.d.ts +1 -1
  221. package/dist/views/Request/types/index.d.ts.map +1 -1
  222. package/package.json +12 -12
  223. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts +0 -18
  224. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts.map +0 -1
  225. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.js +0 -39
  226. package/dist/v2/features/operation/helpers/get-operation-header.js +0 -12
@@ -1,4 +1,4 @@
1
- import { defineComponent as $, computed as o, ref as b, watch as D, useId as I, createBlock as u, createCommentVNode as d, openBlock as s, unref as a, withCtx as n, createVNode as r, createSlots as N, createElementVNode as x, createElementBlock as g, renderSlot as p, createTextVNode as W, toDisplayString as R } from "vue";
1
+ import { defineComponent as $, computed as o, ref as b, watch as D, useId as I, createBlock as u, createCommentVNode as d, openBlock as s, unref as a, withCtx as n, createVNode as r, createSlots as N, createElementVNode as g, createElementBlock as x, renderSlot as y, createTextVNode as W, toDisplayString as R } from "vue";
2
2
  import { ScalarCard as S, ScalarCardHeader as z, ScalarCombobox as U, ScalarButton as A, ScalarCardSection as T, ScalarCodeBlock as F, ScalarVirtualText as M, ScalarCardFooter as K } from "@scalar/components";
3
3
  import { freezeElement as Z } from "@scalar/helpers/dom/freeze-element";
4
4
  import { ScalarIconCaretDown as G } from "@scalar/icons";
@@ -18,6 +18,7 @@ const te = ["innerHTML"], le = ["id"], ae = {
18
18
  ...ne,
19
19
  __name: "OperationCodeSample",
20
20
  props: {
21
+ integration: {},
21
22
  clientOptions: {},
22
23
  selectedClient: {},
23
24
  selectedServer: { default: null },
@@ -30,7 +31,8 @@ const te = ["innerHTML"], le = ["id"], ae = {
30
31
  operation: {},
31
32
  fallback: { type: Boolean },
32
33
  generateLabel: { type: Function },
33
- isWebhook: { type: Boolean }
34
+ isWebhook: { type: Boolean },
35
+ globalCookies: {}
34
36
  },
35
37
  setup(e) {
36
38
  const i = o(() => {
@@ -50,7 +52,7 @@ const te = ["innerHTML"], le = ["id"], ae = {
50
52
  l && (c.value = l);
51
53
  }
52
54
  );
53
- const y = o(() => {
55
+ const k = o(() => {
54
56
  if (!e.isWebhook) return null;
55
57
  try {
56
58
  return P({
@@ -62,7 +64,8 @@ const te = ["innerHTML"], le = ["id"], ae = {
62
64
  } catch (t) {
63
65
  return console.error("[webhookHar]", t), null;
64
66
  }
65
- }), h = o(() => e.isWebhook ? y.value?.postData?.text ?? "" : _({
67
+ }), h = o(() => e.isWebhook ? k.value?.postData?.text ?? "" : _({
68
+ includeDefaultHeaders: e.integration === "client",
66
69
  clientId: c.value?.id,
67
70
  customCodeSamples: C.value,
68
71
  operation: e.operation,
@@ -71,42 +74,43 @@ const te = ["innerHTML"], le = ["id"], ae = {
71
74
  contentType: e.selectedContentType,
72
75
  server: e.selectedServer,
73
76
  securitySchemes: e.securitySchemes,
74
- example: m.value
77
+ example: m.value,
78
+ globalCookies: e.globalCookies
75
79
  })), B = o(() => e.isWebhook ? w.value : c.value?.lang), w = o(() => {
76
- if (!y.value?.postData) return "json";
77
- const t = y.value.postData.mimeType;
80
+ if (!k.value?.postData) return "json";
81
+ const t = k.value.postData.mimeType;
78
82
  return t?.includes("json") ? "json" : t?.includes("xml") ? "xml" : t?.includes("yaml") || t?.includes("yml") ? "yaml" : t?.includes("text/plain") ? "text" : "json";
79
- }), O = o(() => Y(e.securitySchemes)), k = b(null), j = (t) => {
80
- if (k.value) {
81
- const l = Z(k.value.$el);
83
+ }), H = o(() => Y(e.securitySchemes)), p = b(null), O = (t) => {
84
+ if (p.value) {
85
+ const l = Z(p.value.$el);
82
86
  setTimeout(() => {
83
87
  l();
84
88
  }, 300);
85
89
  }
86
90
  c.value = t, t && !t.id.startsWith("custom") && e.eventBus.emit("workspace:update:selected-client", t.id);
87
- }, E = 2e4, H = o(
88
- () => (h.value.length ?? 0) > E
91
+ }, j = 2e4, E = o(
92
+ () => (h.value.length ?? 0) > j
89
93
  ), L = I();
90
94
  return (t, l) => h.value ? (s(), u(a(S), {
91
95
  key: 0,
92
96
  ref_key: "elem",
93
- ref: k,
97
+ ref: p,
94
98
  class: "request-card dark-mode"
95
99
  }, {
96
100
  default: n(() => [
97
101
  r(a(z), { class: "pr-2.5" }, N({
98
102
  default: n(() => [
99
- l[2] || (l[2] = x("span", { class: "sr-only" }, "Request Example for", -1)),
103
+ l[2] || (l[2] = g("span", { class: "sr-only" }, "Request Example for", -1)),
100
104
  r(V, {
101
105
  as: "span",
102
106
  class: "request-method",
103
107
  method: e.method
104
108
  }, null, 8, ["method"]),
105
- e.generateLabel ? (s(), g("span", {
109
+ e.generateLabel ? (s(), x("span", {
106
110
  key: 0,
107
111
  innerHTML: e.generateLabel()
108
112
  }, null, 8, te)) : d("", !0),
109
- p(t.$slots, "header", {}, void 0, !0)
113
+ y(t.$slots, "header", {}, void 0, !0)
110
114
  ]),
111
115
  _: 2
112
116
  }, [
@@ -119,7 +123,7 @@ const te = ["innerHTML"], le = ["id"], ae = {
119
123
  options: f.value,
120
124
  placement: "bottom-end",
121
125
  teleport: "",
122
- "onUpdate:modelValue": l[0] || (l[0] = (v) => j(v))
126
+ "onUpdate:modelValue": l[0] || (l[0] = (v) => O(v))
123
127
  }, {
124
128
  default: n(() => [
125
129
  r(a(A), {
@@ -145,11 +149,11 @@ const te = ["innerHTML"], le = ["id"], ae = {
145
149
  ]), 1024),
146
150
  r(a(T), { class: "request-editor-section custom-scroll p-0" }, {
147
151
  default: n(() => [
148
- x("div", {
152
+ g("div", {
149
153
  id: `${a(L)}-example`,
150
154
  class: "code-snippet"
151
155
  }, [
152
- H.value ? (s(), u(a(M), {
156
+ E.value ? (s(), u(a(M), {
153
157
  key: 1,
154
158
  containerClass: "custom-scroll scalar-code-block border rounded-b flex flex-1 max-h-screen",
155
159
  contentClass: "language-plaintext whitespace-pre font-code text-base",
@@ -159,7 +163,7 @@ const te = ["innerHTML"], le = ["id"], ae = {
159
163
  key: 0,
160
164
  class: "bg-b-2 !min-h-full -outline-offset-2",
161
165
  content: h.value,
162
- hideCredentials: O.value,
166
+ hideCredentials: H.value,
163
167
  lang: B.value,
164
168
  lineNumbers: ""
165
169
  }, null, 8, ["content", "hideCredentials", "lang"]))
@@ -172,7 +176,7 @@ const te = ["innerHTML"], le = ["id"], ae = {
172
176
  class: "request-card-footer bg-b-3"
173
177
  }, {
174
178
  default: n(() => [
175
- Object.keys(i.value).length > 1 ? (s(), g("div", ae, [
179
+ Object.keys(i.value).length > 1 ? (s(), x("div", ae, [
176
180
  Object.keys(i.value).length ? (s(), u(ee, {
177
181
  key: 0,
178
182
  modelValue: m.value,
@@ -180,7 +184,7 @@ const te = ["innerHTML"], le = ["id"], ae = {
180
184
  examples: i.value
181
185
  }, null, 8, ["modelValue", "examples"])) : d("", !0)
182
186
  ])) : d("", !0),
183
- p(t.$slots, "footer", {}, void 0, !0)
187
+ y(t.$slots, "footer", {}, void 0, !0)
184
188
  ]),
185
189
  _: 3
186
190
  })) : d("", !0)
@@ -193,15 +197,15 @@ const te = ["innerHTML"], le = ["id"], ae = {
193
197
  default: n(() => [
194
198
  r(a(T), { class: "request-card-simple" }, {
195
199
  default: n(() => [
196
- x("div", oe, [
200
+ g("div", oe, [
197
201
  r(V, {
198
202
  as: "span",
199
203
  class: "request-method",
200
204
  method: e.method
201
205
  }, null, 8, ["method"]),
202
- p(t.$slots, "header", {}, void 0, !0)
206
+ y(t.$slots, "header", {}, void 0, !0)
203
207
  ]),
204
- p(t.$slots, "footer", {}, void 0, !0)
208
+ y(t.$slots, "footer", {}, void 0, !0)
205
209
  ]),
206
210
  _: 3
207
211
  })
@@ -1,5 +1,6 @@
1
1
  import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
2
  import type { AvailableClient } from '@scalar/snippetz';
3
+ import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
3
4
  import type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation';
4
5
  import type { OperationObject, SecuritySchemeObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
5
6
  import { type CustomCodeSampleId } from './generate-client-options.js';
@@ -22,8 +23,12 @@ type GenerateCodeSnippetProps = {
22
23
  securitySchemes: SecuritySchemeObject[];
23
24
  /** The server object defining the base URL for the API request. */
24
25
  server: ServerObject | null;
26
+ /** Workspace + document cookies */
27
+ globalCookies?: XScalarCookie[];
28
+ /** Whether to include default headers (e.g., Accept, Content-Type) automatically. */
29
+ includeDefaultHeaders?: boolean;
25
30
  };
26
31
  /** Generate the code snippet for the selected example OR operation */
27
- export declare const generateCodeSnippet: ({ clientId, customCodeSamples, operation, method, path, example, contentType, server, securitySchemes, }: GenerateCodeSnippetProps) => string;
32
+ export declare const generateCodeSnippet: ({ clientId, customCodeSamples, includeDefaultHeaders, operation, method, path, example, contentType, server, securitySchemes, globalCookies, }: GenerateCodeSnippetProps) => string;
28
33
  export {};
29
34
  //# sourceMappingURL=generate-code-snippet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,kBAAkB,CAAA;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAA;AACvF,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAKrE,OAAO,EAAE,KAAK,kBAAkB,EAAoB,MAAM,2BAA2B,CAAA;AAErF,KAAK,wBAAwB,GAAG;IAC9B,wGAAwG;IACxG,QAAQ,EAAE,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAA;IAC1D,qFAAqF;IACrF,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,mFAAmF;IACnF,iBAAiB,EAAE,WAAW,EAAE,CAAA;IAChC,0EAA0E;IAC1E,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,gEAAgE;IAChE,MAAM,EAAE,UAAU,CAAA;IAClB,wEAAwE;IACxE,SAAS,EAAE,eAAe,CAAA;IAC1B,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAA;IACZ,iFAAiF;IACjF,eAAe,EAAE,oBAAoB,EAAE,CAAA;IACvC,mEAAmE;IACnE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;CAC5B,CAAA;AAED,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,GAAI,0GAUjC,wBAAwB,KAAG,MAqC7B,CAAA"}
1
+ {"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,kBAAkB,CAAA;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAA;AACvF,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAKrE,OAAO,EAAE,KAAK,kBAAkB,EAAoB,MAAM,2BAA2B,CAAA;AAErF,KAAK,wBAAwB,GAAG;IAC9B,wGAAwG;IACxG,QAAQ,EAAE,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAA;IAC1D,qFAAqF;IACrF,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,mFAAmF;IACnF,iBAAiB,EAAE,WAAW,EAAE,CAAA;IAChC,0EAA0E;IAC1E,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,gEAAgE;IAChE,MAAM,EAAE,UAAU,CAAA;IAClB,wEAAwE;IACxE,SAAS,EAAE,eAAe,CAAA;IAC1B,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAA;IACZ,iFAAiF;IACjF,eAAe,EAAE,oBAAoB,EAAE,CAAA;IACvC,mEAAmE;IACnE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,mCAAmC;IACnC,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;IAC/B,qFAAqF;IACrF,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AAED,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,GAAI,gJAYjC,wBAAwB,KAAG,MAuC7B,CAAA"}
@@ -1,36 +1,40 @@
1
- import { operationToHar as C } from "./operation-to-har/operation-to-har.js";
2
- import { getSnippet as y } from "../../../../views/Components/CodeSnippet/helpers/get-snippet.js";
3
- import { generateCustomId as S } from "./generate-client-options.js";
4
- const E = ({
1
+ import { operationToHar as y } from "./operation-to-har/operation-to-har.js";
2
+ import { getSnippet as S } from "../../../../views/Components/CodeSnippet/helpers/get-snippet.js";
3
+ import { generateCustomId as h } from "./generate-client-options.js";
4
+ const q = ({
5
5
  clientId: e,
6
6
  customCodeSamples: o,
7
- operation: n,
8
- method: p,
9
- path: s,
10
- example: a,
11
- contentType: i,
12
- server: g,
13
- securitySchemes: m
7
+ includeDefaultHeaders: n = !1,
8
+ operation: p,
9
+ method: s,
10
+ path: a,
11
+ example: i,
12
+ contentType: g,
13
+ server: m,
14
+ securitySchemes: u,
15
+ globalCookies: c
14
16
  }) => {
15
17
  try {
16
18
  if (!e)
17
19
  return "";
18
20
  if (e.startsWith("custom"))
19
- return o.find((d) => S(d) === e)?.source ?? "Custom example not found";
20
- const r = C({
21
- operation: n,
22
- contentType: i,
23
- method: p,
24
- path: s,
25
- server: g,
26
- securitySchemes: m,
27
- example: a
28
- }), [u, c] = e.split("/"), [t, f] = y(u, c, r);
29
- return t ? (console.error("[generateCodeSnippet]", t), t.message ?? "Error generating code snippet") : f;
21
+ return o.find((l) => h(l) === e)?.source ?? "Custom example not found";
22
+ const r = y({
23
+ operation: p,
24
+ contentType: g,
25
+ method: s,
26
+ path: a,
27
+ server: m,
28
+ securitySchemes: u,
29
+ example: i,
30
+ globalCookies: c,
31
+ includeDefaultHeaders: n
32
+ }), [f, d] = e.split("/"), [t, C] = S(f, d, r);
33
+ return t ? (console.error("[generateCodeSnippet]", t), t.message ?? "Error generating code snippet") : C;
30
34
  } catch (r) {
31
35
  return console.error("[generateCodeSnippet]", r), "Error generating code snippet";
32
36
  }
33
37
  };
34
38
  export {
35
- E as generateCodeSnippet
39
+ q as generateCodeSnippet
36
40
  };
@@ -2,7 +2,7 @@ import { isDefined as v } from "@scalar/helpers/array/is-defined";
2
2
  import { getRaw as E } from "@scalar/json-magic/magic-proxy";
3
3
  import { getResolvedRef as m } from "@scalar/workspace-store/helpers/get-resolved-ref";
4
4
  import { unpackOverridesProxy as N } from "@scalar/workspace-store/helpers/overrides-proxy";
5
- const D = 10, P = 10, M = "propertyName*", j = (/* @__PURE__ */ new Date()).toISOString(), q = j.split("T")[0], k = j.split("T")[1].split(".")[0], C = {
5
+ const D = 10, P = 10, M = "additionalProperty", j = (/* @__PURE__ */ new Date()).toISOString(), q = j.split("T")[0], k = j.split("T")[1].split(".")[0], I = {
6
6
  "date-time": j,
7
7
  date: q,
8
8
  email: "hello@example.com",
@@ -29,7 +29,7 @@ const D = 10, P = 10, M = "propertyName*", j = (/* @__PURE__ */ new Date()).toIS
29
29
  uri: "https://example.com",
30
30
  uuid: "123e4567-e89b-12d3-a456-426614174000",
31
31
  "object-id": "6592008029c8c3e4dc76256c"
32
- }, R = (t, i = !1, o = "") => "type" in t && t.type === "string" && "format" in t && t.format === "binary" ? "@filename" : i && "format" in t && t.format ? C[t.format] ?? o : o, A = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), I = (t) => {
32
+ }, w = (t, i = !1, o = "") => "type" in t && t.type === "string" && "format" in t && t.format === "binary" ? "@filename" : i && "format" in t && t.format ? I[t.format] ?? o : o, A = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), _ = (t) => {
33
33
  if (!t)
34
34
  return;
35
35
  const i = S.get(t);
@@ -47,14 +47,14 @@ const D = 10, P = 10, M = "propertyName*", j = (/* @__PURE__ */ new Date()).toIS
47
47
  return i;
48
48
  const l = E(N(t)), d = A.get(l) ?? /* @__PURE__ */ new Map();
49
49
  return d && d.set(o, i), A.set(l, d), i;
50
- }, _ = (t) => !!(t.allOf || t.oneOf || t.anyOf), F = (t, i, o, l) => {
50
+ }, C = (t) => !!(t.allOf || t.oneOf || t.anyOf), F = (t, i, o, l) => {
51
51
  if (t.deprecated || l?.mode === "write" && t.readOnly || l?.mode === "read" && t.writeOnly)
52
52
  return !0;
53
- if (l?.omitEmptyAndOptionalProperties !== !0 || "type" in t && (t.type === "object" || t.type === "array") || _(t) || "examples" in t && Array.isArray(t.examples) && t.examples.length > 0 || "example" in t && t.example !== void 0 || "default" in t && t.default !== void 0 || "const" in t && t.const !== void 0 || "enum" in t && Array.isArray(t.enum) && t.enum.length > 0)
53
+ if (l?.omitEmptyAndOptionalProperties !== !0 || "type" in t && (t.type === "object" || t.type === "array") || C(t) || "examples" in t && Array.isArray(t.examples) && t.examples.length > 0 || "example" in t && t.example !== void 0 || "default" in t && t.default !== void 0 || "const" in t && t.const !== void 0 || "enum" in t && Array.isArray(t.enum) && t.enum.length > 0)
54
54
  return !1;
55
- const r = o ?? t.title ?? "", e = I(i);
55
+ const r = o ?? t.title ?? "", e = _(i);
56
56
  return !(e ? e.has(r) : !1);
57
- }, w = (t, i) => Array.isArray(t) && Array.isArray(i) ? [...t, ...i] : t && typeof t == "object" && i && typeof i == "object" ? { ...t, ...i } : i, L = (t, i, o, l, d) => {
57
+ }, R = (t, i) => Array.isArray(t) && Array.isArray(i) ? [...t, ...i] : t && typeof t == "object" && i && typeof i == "object" ? { ...t, ...i } : i, L = (t, i, o, l, d) => {
58
58
  const r = {};
59
59
  if ("properties" in t && t.properties) {
60
60
  const e = Object.keys(t.properties), n = o > 3 ? Math.min(P, e.length) : e.length;
@@ -83,7 +83,7 @@ const D = 10, P = 10, M = "propertyName*", j = (/* @__PURE__ */ new Date()).toIS
83
83
  }));
84
84
  }
85
85
  if ("additionalProperties" in t && t.additionalProperties) {
86
- const e = m(t.additionalProperties), n = t.additionalProperties === !0 || typeof t.additionalProperties == "object" && Object.keys(t.additionalProperties).length === 0, p = typeof e == "object" && "x-additionalPropertiesName" in e && typeof e["x-additionalPropertiesName"] == "string" && e["x-additionalPropertiesName"].trim().length > 0 ? `${e["x-additionalPropertiesName"].trim()}*` : M;
86
+ const e = m(t.additionalProperties), n = t.additionalProperties === !0 || typeof t.additionalProperties == "object" && Object.keys(t.additionalProperties).length === 0, p = typeof e == "object" && "x-additionalPropertiesName" in e && typeof e["x-additionalPropertiesName"] == "string" && e["x-additionalPropertiesName"].trim().length > 0 ? e["x-additionalPropertiesName"].trim() : M;
87
87
  r[p] = n ? "anything" : typeof e == "object" ? c(e, i, {
88
88
  level: o + 1,
89
89
  seen: l
@@ -113,7 +113,7 @@ const D = 10, P = 10, M = "propertyName*", j = (/* @__PURE__ */ new Date()).toIS
113
113
  parentSchema: t,
114
114
  seen: l
115
115
  });
116
- e = w(e, p);
116
+ e = R(e, p);
117
117
  }
118
118
  e && typeof e == "object" && Object.assign(r, e);
119
119
  }
@@ -173,7 +173,7 @@ const D = 10, P = 10, M = "propertyName*", j = (/* @__PURE__ */ new Date()).toIS
173
173
  if ("type" in t && t.type && !Array.isArray(t.type))
174
174
  switch (t.type) {
175
175
  case "string":
176
- return R(t, i, o ?? "");
176
+ return w(t, i, o ?? "");
177
177
  case "boolean":
178
178
  return !0;
179
179
  case "integer":
@@ -193,7 +193,7 @@ const D = 10, P = 10, M = "propertyName*", j = (/* @__PURE__ */ new Date()).toIS
193
193
  if (l)
194
194
  switch (l) {
195
195
  case "string":
196
- return R(t, i, o ?? "");
196
+ return w(t, i, o ?? "");
197
197
  case "boolean":
198
198
  return !0;
199
199
  case "integer":
@@ -223,7 +223,7 @@ const D = 10, P = 10, M = "propertyName*", j = (/* @__PURE__ */ new Date()).toIS
223
223
  return;
224
224
  const n = E(N(e));
225
225
  if (r.has(n))
226
- return "[Circular Reference]";
226
+ return;
227
227
  r.add(n);
228
228
  const p = z(i), x = A.get(n)?.get(p);
229
229
  if (typeof x < "u")
@@ -286,7 +286,7 @@ const D = 10, P = 10, M = "propertyName*", j = (/* @__PURE__ */ new Date()).toIS
286
286
  parentSchema: e,
287
287
  seen: r
288
288
  });
289
- f === void 0 ? f = b : f && typeof f == "object" && b && typeof b == "object" ? f = w(f, b) : b !== void 0 && (f = b);
289
+ f === void 0 ? f = b : f && typeof f == "object" && b && typeof b == "object" ? f = R(f, b) : b !== void 0 && (f = b);
290
290
  }
291
291
  return r.delete(n), a(e, f ?? null, p);
292
292
  }
@@ -1,4 +1,5 @@
1
1
  import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
+ import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
2
3
  import type { OperationObject, SecuritySchemeObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
4
  import type { Request as HarRequest } from 'har-format';
4
5
  export type OperationToHarProps = {
@@ -25,6 +26,14 @@ export type OperationToHarProps = {
25
26
  server?: ServerObject | null;
26
27
  /** OpenAPI SecurityScheme objects which are applicable to the operation */
27
28
  securitySchemes?: SecuritySchemeObject[];
29
+ /** Workspace + document cookies */
30
+ globalCookies?: XScalarCookie[];
31
+ /**
32
+ * Whether to include default headers (e.g., Accept, Content-Type) automatically.
33
+ * If false, default headers will be omitted from the HAR request.
34
+ * @default true
35
+ */
36
+ includeDefaultHeaders?: boolean;
28
37
  };
29
38
  /**
30
39
  * Converts an OpenAPI Operation to a HarRequest format for generating HTTP request snippets.
@@ -48,5 +57,5 @@ export type OperationToHarProps = {
48
57
  * @see https://w3c.github.io/web-performance/specs/HAR/Overview.html
49
58
  * @see https://spec.openapis.org/oas/v3.1.0#operation-object
50
59
  */
51
- export declare const operationToHar: ({ operation, contentType, method, path, server, example, securitySchemes, }: OperationToHarProps) => HarRequest;
60
+ export declare const operationToHar: ({ includeDefaultHeaders, operation, contentType, method, path, server, example, securitySchemes, globalCookies, }: OperationToHarProps) => HarRequest;
52
61
  //# sourceMappingURL=operation-to-har.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation-to-har.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AACrE,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAOvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,+BAA+B;IAC/B,SAAS,EAAE,eAAe,CAAA;IAC1B,mCAAmC;IACnC,MAAM,EAAE,UAAU,CAAA;IAClB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAC5B,2EAA2E;IAC3E,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAA;CACzC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GAAI,6EAQ5B,mBAAmB,KAAG,UAgFxB,CAAA"}
1
+ {"version":3,"file":"operation-to-har.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AACrE,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAUvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,+BAA+B;IAC/B,SAAS,EAAE,eAAe,CAAA;IAC1B,mCAAmC;IACnC,MAAM,EAAE,UAAU,CAAA;IAClB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAC5B,2EAA2E;IAC3E,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAA;IACxC,mCAAmC;IACnC,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;IAC/B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GAAI,mHAU5B,mBAAmB,KAAG,UAgGxB,CAAA"}
@@ -1,21 +1,30 @@
1
- import { getResolvedRef as f } from "@scalar/workspace-store/helpers/get-resolved-ref";
2
- import { processBody as y } from "./process-body.js";
3
- import { processParameters as l } from "./process-parameters.js";
4
- import { processSecuritySchemes as S } from "./process-security-schemes.js";
5
- import { processServerUrl as g } from "./process-server-url.js";
6
- const b = ({
1
+ import { getResolvedRef as k } from "@scalar/workspace-store/helpers/get-resolved-ref";
2
+ import { filterGlobalCookie as q } from "../../../operation-block/helpers/filter-global-cookies.js";
3
+ import { getDefaultHeaders as T } from "../../../request-block/helpers/get-default-headers.js";
4
+ import { processBody as C } from "./process-body.js";
5
+ import { processParameters as H } from "./process-parameters.js";
6
+ import { processSecuritySchemes as z } from "./process-security-schemes.js";
7
+ import { processServerUrl as D } from "./process-server-url.js";
8
+ const w = ({
9
+ includeDefaultHeaders: f = !1,
7
10
  operation: t,
8
- contentType: i,
9
- method: h,
10
- path: a,
11
- server: n,
12
- example: p,
13
- securitySchemes: m
11
+ contentType: l,
12
+ method: n,
13
+ path: p,
14
+ server: c = null,
15
+ example: a,
16
+ securitySchemes: d,
17
+ globalCookies: h
14
18
  }) => {
15
- const e = {
16
- method: h,
17
- url: a,
18
- headers: [],
19
+ const y = f ? T({
20
+ method: n,
21
+ operation: t,
22
+ exampleKey: a ?? "default",
23
+ hideDisabledHeaders: !0
24
+ }).filter((e) => !e.isOverridden) : [], g = t["x-scalar-disable-parameters"]?.["global-cookies"]?.[a ?? "default"] ?? {}, v = D(c, p), r = {
25
+ method: n,
26
+ url: v,
27
+ headers: y.map((e) => ({ name: e.name, value: e.defaultValue })),
19
28
  queryString: [],
20
29
  postData: void 0,
21
30
  httpVersion: "HTTP/1.1",
@@ -23,37 +32,37 @@ const b = ({
23
32
  headersSize: -1,
24
33
  bodySize: -1
25
34
  };
26
- if (n?.url && (e.url = g(n, a)), t.parameters) {
27
- const { url: r, headers: o, queryString: s, cookies: c } = l({
28
- harRequest: e,
35
+ if (t.parameters) {
36
+ const { url: e, headers: s, queryString: o, cookies: S } = H({
37
+ harRequest: r,
29
38
  parameters: t.parameters,
30
- example: p,
31
- contentType: i
32
- });
33
- e.url = r, e.headers = o, e.queryString = s, e.cookies = c;
39
+ example: a,
40
+ contentType: l
41
+ }), b = h?.filter((i) => q({ cookie: i, url: e, disabledGlobalCookies: g }))?.map((i) => ({ name: i.name, value: i.value })) ?? [];
42
+ r.url = e, r.headers = s, r.queryString = o, r.cookies = [...b, ...S];
34
43
  }
35
- const u = f(t.requestBody);
36
- if (u?.content) {
37
- const r = y({ requestBody: u, contentType: i, example: p });
38
- if (r && (e.postData = r, e.bodySize = r.text?.length ?? -1, r.mimeType)) {
39
- const o = e.headers.find(
40
- (s) => s.name.toLowerCase() === "content-type"
44
+ const m = k(t.requestBody);
45
+ if (m?.content) {
46
+ const e = C({ requestBody: m, contentType: l, example: a });
47
+ if (e && (r.postData = e, r.bodySize = e.text?.length ?? -1, e.mimeType)) {
48
+ const s = r.headers.find(
49
+ (o) => o.name.toLowerCase() === "content-type"
41
50
  );
42
- o && !o.value ? o.value = r.mimeType : o || e.headers.push({
51
+ s && !s.value ? s.value = e.mimeType : s || r.headers.push({
43
52
  name: "Content-Type",
44
- value: r.mimeType
53
+ value: e.mimeType
45
54
  });
46
55
  }
47
56
  }
48
- if (m) {
49
- const { headers: r, queryString: o, cookies: s } = S(m);
50
- e.headers.push(...r), e.queryString.push(...o), e.cookies.push(...s);
57
+ if (d) {
58
+ const { headers: e, queryString: s, cookies: o } = z(d);
59
+ r.headers.push(...e), r.queryString.push(...s), r.cookies.push(...o);
51
60
  }
52
- let d = 0;
53
- for (const r of e.headers)
54
- d += (r.name?.length ?? 0) + 2 + (r.value?.length ?? 0) + 2;
55
- return e.headersSize = d, e;
61
+ let u = 0;
62
+ for (const e of r.headers)
63
+ u += (e.name?.length ?? 0) + 2 + (e.value?.length ?? 0) + 2;
64
+ return r.headersSize = u, r;
56
65
  };
57
66
  export {
58
- b as operationToHar
67
+ w as operationToHar
59
68
  };
@@ -1 +1 @@
1
- {"version":3,"file":"process-parameters.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,8DAA8D,CAAA;AAEpH,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAIvD,KAAK,mBAAmB,GAAG;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAC9B,WAAW,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;IACtC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;CAC/B,CAAA;AA8DD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,mDAK/B;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IACzC,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACjC,KAAG,mBAsNH,CAAA"}
1
+ {"version":3,"file":"process-parameters.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,8DAA8D,CAAA;AAEpH,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAKvD,KAAK,mBAAmB,GAAG;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAC9B,WAAW,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;IACtC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;CAC/B,CAAA;AAuED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,mDAK/B;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IACzC,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACjC,KAAG,mBAqNH,CAAA"}