@scalar/api-client 2.17.2 → 2.17.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/dist/style.css +1 -1
  3. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +15 -10
  4. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +70 -55
  6. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
  7. package/dist/v2/blocks/operation-block/helpers/build-request-body.js +12 -8
  8. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +3 -5
  9. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +1 -1
  10. package/dist/v2/blocks/operation-block/helpers/build-request-security.js +31 -31
  11. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +4 -6
  12. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
  13. package/dist/v2/blocks/operation-block/helpers/build-request.js +20 -21
  14. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
  15. package/dist/v2/blocks/operation-block/helpers/get-example.js +22 -16
  16. package/dist/v2/blocks/operation-block/helpers/send-request.js +26 -26
  17. package/dist/v2/blocks/operation-block/index.d.ts +1 -0
  18. package/dist/v2/blocks/operation-block/index.d.ts.map +1 -1
  19. package/dist/v2/blocks/operation-block/index.js +4 -2
  20. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +9 -4
  21. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  22. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
  23. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +81 -88
  24. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +4 -4
  25. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -1
  26. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +1 -1
  27. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  28. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +1 -1
  29. package/dist/v2/blocks/operation-code-sample/index.d.ts +1 -0
  30. package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
  31. package/dist/v2/blocks/operation-code-sample/index.js +11 -9
  32. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +3 -2
  33. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  34. package/dist/v2/blocks/request-block/RequestBlock.vue.js +2 -2
  35. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +59 -63
  36. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  37. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
  38. package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +78 -74
  39. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js +3 -3
  40. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  41. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +43 -42
  42. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  43. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +96 -86
  44. package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.d.ts +8 -0
  45. package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.d.ts.map +1 -0
  46. package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.js +33 -0
  47. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.d.ts +7 -0
  48. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.d.ts.map +1 -0
  49. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.js +13 -0
  50. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts +3 -0
  51. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
  52. package/dist/v2/blocks/scalar-auth-selector-block/index.js +8 -2
  53. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  54. package/dist/v2/components/data-table/DataTableInput.vue.js +2 -2
  55. package/dist/v2/components/data-table/DataTableInput.vue2.js +25 -24
  56. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  57. package/dist/v2/features/app/App.vue.js +34 -33
  58. package/dist/v2/features/app/helpers/routes.d.ts +2 -0
  59. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  60. package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts.map +1 -1
  61. package/dist/v2/features/app/hooks/use-workspace-client-app-events.js +29 -29
  62. package/dist/v2/features/collection/DocumentCollection.vue.js +4 -3
  63. package/dist/v2/features/collection/WorkspaceCollection.vue.js +8 -7
  64. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  65. package/dist/v2/features/collection/components/Authentication.vue.js +1 -1
  66. package/dist/v2/features/collection/components/Authentication.vue2.js +7 -6
  67. package/dist/v2/features/collection/components/Cookies.vue.js +1 -0
  68. package/dist/v2/features/collection/components/Environment.vue.js +1 -0
  69. package/dist/v2/features/collection/components/Overview.vue2.js +8 -7
  70. package/dist/v2/features/collection/components/Servers.vue.js +25 -24
  71. package/dist/v2/features/collection/components/Settings.vue.js +8 -7
  72. package/dist/v2/features/modal/Modal.vue.d.ts +6 -0
  73. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  74. package/dist/v2/features/modal/Modal.vue.js +2 -2
  75. package/dist/v2/features/modal/Modal.vue2.js +66 -62
  76. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +16 -16
  77. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
  78. package/dist/v2/features/modal/helpers/create-api-client-modal.js +36 -29
  79. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts.map +1 -1
  80. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.js +25 -12
  81. package/dist/v2/features/modal/index.d.ts +2 -1
  82. package/dist/v2/features/modal/index.d.ts.map +1 -1
  83. package/dist/v2/features/modal/index.js +3 -1
  84. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  85. package/dist/v2/features/operation/Operation.vue.js +54 -62
  86. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts +1 -1
  87. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts.map +1 -1
  88. package/dist/v2/features/operation/helpers/get-security-requirements.js +2 -2
  89. package/dist/v2/features/operation/helpers/get-selected-security.d.ts +5 -2
  90. package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -1
  91. package/dist/v2/features/operation/helpers/get-selected-security.js +11 -11
  92. package/dist/v2/features/operation/helpers/get-selected-server.d.ts +10 -0
  93. package/dist/v2/features/operation/helpers/get-selected-server.d.ts.map +1 -0
  94. package/dist/v2/features/operation/helpers/get-selected-server.js +4 -0
  95. package/dist/v2/features/operation/index.d.ts +3 -0
  96. package/dist/v2/features/operation/index.d.ts.map +1 -1
  97. package/dist/v2/features/operation/index.js +8 -2
  98. package/dist/v2/helpers/index.d.ts +3 -0
  99. package/dist/v2/helpers/index.d.ts.map +1 -0
  100. package/dist/v2/helpers/index.js +4 -0
  101. package/dist/v2/helpers/plugins.d.ts +7 -1
  102. package/dist/v2/helpers/plugins.d.ts.map +1 -1
  103. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  104. package/package.json +22 -17
@@ -9,6 +9,7 @@ import type { OpenApiDocument, ServerObject } from '@scalar/workspace-store/sche
9
9
  import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation';
10
10
  import type { ClientLayout } from '../../../hooks/index.js';
11
11
  import { type History } from '../../../v2/blocks/scalar-address-bar-block/index.js';
12
+ import type { MergedSecuritySchemes } from '../../../v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.js';
12
13
  import { type ClientPlugin } from '../../../v2/helpers/plugins.js';
13
14
  /**
14
15
  * OperationBlock
@@ -26,6 +27,10 @@ import { type ClientPlugin } from '../../../v2/helpers/plugins.js';
26
27
  declare const _default: import("vue").DefineComponent<{
27
28
  /** Event bus */
28
29
  eventBus: WorkspaceEventBus;
30
+ /** Document defined security */
31
+ documentSecurity: OpenApiDocument["security"];
32
+ /** Document selected security */
33
+ documentSelectedSecurity: OpenApiDocument["x-scalar-selected-security"];
29
34
  /** Application version */
30
35
  appVersion: string;
31
36
  /** Workspace/document cookies */
@@ -58,16 +63,14 @@ declare const _default: import("vue").DefineComponent<{
58
63
  source?: "gitbook" | "api-reference";
59
64
  /** Operation object */
60
65
  operation: OperationObject;
66
+ /** Whether to set security at the operation level */
67
+ setOperationSecurity: boolean;
61
68
  /** Currently selected example key for the current operation */
62
69
  exampleKey: string;
63
70
  /** Meta information for the auth update */
64
71
  authMeta: AuthMeta;
65
72
  /** Document defined security schemes */
66
- securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"];
67
- /** Currently selected security for the current operation */
68
- selectedSecurity: OpenApiDocument["x-scalar-selected-security"];
69
- /** Required security for the operation/document */
70
- securityRequirements: OpenApiDocument["security"];
73
+ securitySchemes: MergedSecuritySchemes;
71
74
  /** Client plugins */
72
75
  plugins: ClientPlugin[];
73
76
  /** For environment variables in the inputs */
@@ -79,6 +82,10 @@ declare const _default: import("vue").DefineComponent<{
79
82
  }, string, import("vue").PublicProps, Readonly<{
80
83
  /** Event bus */
81
84
  eventBus: WorkspaceEventBus;
85
+ /** Document defined security */
86
+ documentSecurity: OpenApiDocument["security"];
87
+ /** Document selected security */
88
+ documentSelectedSecurity: OpenApiDocument["x-scalar-selected-security"];
82
89
  /** Application version */
83
90
  appVersion: string;
84
91
  /** Workspace/document cookies */
@@ -111,16 +118,14 @@ declare const _default: import("vue").DefineComponent<{
111
118
  source?: "gitbook" | "api-reference";
112
119
  /** Operation object */
113
120
  operation: OperationObject;
121
+ /** Whether to set security at the operation level */
122
+ setOperationSecurity: boolean;
114
123
  /** Currently selected example key for the current operation */
115
124
  exampleKey: string;
116
125
  /** Meta information for the auth update */
117
126
  authMeta: AuthMeta;
118
127
  /** Document defined security schemes */
119
- securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"];
120
- /** Currently selected security for the current operation */
121
- selectedSecurity: OpenApiDocument["x-scalar-selected-security"];
122
- /** Required security for the operation/document */
123
- securityRequirements: OpenApiDocument["security"];
128
+ securitySchemes: MergedSecuritySchemes;
124
129
  /** Client plugins */
125
130
  plugins: ClientPlugin[];
126
131
  /** For environment variables in the inputs */
@@ -1 +1 @@
1
- {"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"names":[],"mappings":"AA4QA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAA;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACb,MAAM,8DAA8D,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAK5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAQ3C,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sCAAsC,CAAA;AACnE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAKxD;;;;;;;;;;;;GAYG;;IAGD,gBAAgB;cACN,iBAAiB;IAC3B,0BAA0B;gBACd,MAAM;IAClB,iCAAiC;mBAClB,aAAa,EAAE;IAC9B,2BAA2B;UACrB,MAAM;IACZ,6BAA6B;YACrB,cAAc;IACtB,mBAAmB;iBACN,gBAAgB;IAC7B,oBAAoB;YACZ,YAAY;IACpB,gCAAgC;YACxB,YAAY,GAAG,IAAI;IAC3B,gCAAgC;oBAChB,cAAc,CAAC,WAAW,CAAC,CAAC,yBAAyB,CAAC;IACtE,mDAAmD;aAC1C,YAAY,EAAE;IACvB,8BAA8B;aACrB,OAAO,EAAE;IAClB,yCAAyC;4BACjB,MAAM;IAC9B,4CAA4C;uBACzB,OAAO;IAC1B,0BAA0B;kBACZ,MAAM,GAAG,IAAI;IAC3B,mEAAmE;kBACrD,MAAM;IACpB,oBAAoB;aACX,SAAS,GAAG,eAAe;IACpC,uBAAuB;eACZ,eAAe;IAC1B,+DAA+D;gBACnD,MAAM;IAClB,2CAA2C;cACjC,QAAQ;IAClB,wCAAwC;qBACvB,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAC9E,4DAA4D;sBAC1C,eAAe,CAAC,4BAA4B,CAAC;IAC/D,mDAAmD;0BAC7B,eAAe,CAAC,UAAU,CAAC;IACjD,qBAAqB;aACZ,YAAY,EAAE;IACvB,8CAA8C;iBACjC,kBAAkB;IAC/B,yCAAyC;cAC/B,MAAM;;;;IAjDhB,gBAAgB;cACN,iBAAiB;IAC3B,0BAA0B;gBACd,MAAM;IAClB,iCAAiC;mBAClB,aAAa,EAAE;IAC9B,2BAA2B;UACrB,MAAM;IACZ,6BAA6B;YACrB,cAAc;IACtB,mBAAmB;iBACN,gBAAgB;IAC7B,oBAAoB;YACZ,YAAY;IACpB,gCAAgC;YACxB,YAAY,GAAG,IAAI;IAC3B,gCAAgC;oBAChB,cAAc,CAAC,WAAW,CAAC,CAAC,yBAAyB,CAAC;IACtE,mDAAmD;aAC1C,YAAY,EAAE;IACvB,8BAA8B;aACrB,OAAO,EAAE;IAClB,yCAAyC;4BACjB,MAAM;IAC9B,4CAA4C;uBACzB,OAAO;IAC1B,0BAA0B;kBACZ,MAAM,GAAG,IAAI;IAC3B,mEAAmE;kBACrD,MAAM;IACpB,oBAAoB;aACX,SAAS,GAAG,eAAe;IACpC,uBAAuB;eACZ,eAAe;IAC1B,+DAA+D;gBACnD,MAAM;IAClB,2CAA2C;cACjC,QAAQ;IAClB,wCAAwC;qBACvB,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAC9E,4DAA4D;sBAC1C,eAAe,CAAC,4BAA4B,CAAC;IAC/D,mDAAmD;0BAC7B,eAAe,CAAC,UAAU,CAAC;IACjD,qBAAqB;aACZ,YAAY,EAAE;IACvB,8CAA8C;iBACjC,kBAAkB;IAC/B,yCAAyC;cAC/B,MAAM;;;;AAnDlB,wBA4WC"}
1
+ {"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"names":[],"mappings":"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"}
@@ -1,27 +1,32 @@
1
- import { defineComponent as B, computed as q, ref as i, onMounted as g, onBeforeUnmount as R, watch as C, createElementBlock as S, openBlock as U, createElementVNode as k, createVNode as o, withCtx as h, unref as a } from "vue";
2
- import { AVAILABLE_CLIENTS as E } from "@scalar/types/snippetz";
3
- import { useToasts as b } from "@scalar/use-toasts";
4
- import V from "../../../components/ViewLayout/ViewLayout.vue.js";
5
- import K from "../../../components/ViewLayout/ViewLayoutContent.vue.js";
6
- import { ERRORS as O } from "../../../libs/errors.js";
7
- import { createStoreEvents as w } from "../../../store/events.js";
8
- import { buildRequest as P } from "./helpers/build-request.js";
9
- import { sendRequest as M } from "./helpers/send-request.js";
10
- import A from "./components/Header.vue.js";
11
- import { generateClientOptions as L } from "../operation-code-sample/helpers/generate-client-options.js";
12
- import T from "../request-block/RequestBlock.vue.js";
13
- import N from "../response-block/ResponseBlock.vue.js";
14
- const I = { class: "bg-b-1 flex h-full flex-col" }, $ = { class: "lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0" }, j = {
1
+ import { defineComponent as R, computed as s, ref as a, onMounted as C, onBeforeUnmount as U, watch as k, createElementBlock as E, openBlock as b, createElementVNode as O, createVNode as n, withCtx as S, unref as m } from "vue";
2
+ import { AVAILABLE_CLIENTS as V } from "@scalar/types/snippetz";
3
+ import { useToasts as K } from "@scalar/use-toasts";
4
+ import w from "../../../components/ViewLayout/ViewLayout.vue.js";
5
+ import P from "../../../components/ViewLayout/ViewLayoutContent.vue.js";
6
+ import { ERRORS as M } from "../../../libs/errors.js";
7
+ import { createStoreEvents as A } from "../../../store/events.js";
8
+ import { buildRequest as L } from "./helpers/build-request.js";
9
+ import { getSecuritySchemes as T } from "./helpers/build-request-security.js";
10
+ import { sendRequest as N } from "./helpers/send-request.js";
11
+ import I from "./components/Header.vue.js";
12
+ import { generateClientOptions as $ } from "../operation-code-sample/helpers/generate-client-options.js";
13
+ import { getSecurityRequirements as j } from "../../features/operation/helpers/get-security-requirements.js";
14
+ import { getSelectedSecurity as D } from "../../features/operation/helpers/get-selected-security.js";
15
+ import H from "../request-block/RequestBlock.vue.js";
16
+ import Q from "../response-block/ResponseBlock.vue.js";
17
+ const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0" }, G = {
15
18
  name: "OperationBlock"
16
- }, ee = /* @__PURE__ */ B({
17
- ...j,
19
+ }, ae = /* @__PURE__ */ R({
20
+ ...G,
18
21
  props: {
19
22
  eventBus: {},
23
+ documentSecurity: {},
24
+ documentSelectedSecurity: {},
20
25
  appVersion: {},
21
26
  globalCookies: { default: () => [] },
22
27
  path: {},
23
28
  method: {},
24
- httpClients: { default: () => E },
29
+ httpClients: { default: () => V },
25
30
  layout: {},
26
31
  server: {},
27
32
  selectedClient: {},
@@ -33,56 +38,65 @@ const I = { class: "bg-b-1 flex h-full flex-col" }, $ = { class: "lg:min-h-heade
33
38
  documentUrl: {},
34
39
  source: {},
35
40
  operation: {},
41
+ setOperationSecurity: { type: Boolean },
36
42
  exampleKey: {},
37
43
  authMeta: {},
38
44
  securitySchemes: {},
39
- selectedSecurity: {},
40
- securityRequirements: {},
41
45
  plugins: { default: () => [] },
42
46
  environment: {},
43
47
  proxyUrl: {}
44
48
  },
45
49
  emits: ["update:servers"],
46
- setup(t, { emit: y }) {
47
- const p = y, f = q(() => L(t.httpClients)), { toast: m } = b(), d = i(null), s = i(null), l = i(null), c = () => d.value?.abort(O.REQUEST_ABORTED), r = async () => {
48
- const [e, n] = P({
50
+ setup(t, { emit: B }) {
51
+ const g = B, q = s(() => $(t.httpClients)), c = s(
52
+ () => j(t.documentSecurity, t.operation.security)
53
+ ), d = s(
54
+ () => D(
55
+ t.documentSelectedSecurity,
56
+ t.operation["x-scalar-selected-security"],
57
+ c.value,
58
+ t.setOperationSecurity
59
+ )
60
+ ), v = s(
61
+ () => T(t.securitySchemes, d.value.selectedSchemes)
62
+ ), { toast: y } = K(), h = a(null), u = a(null), l = a(null), p = () => h.value?.abort(M.REQUEST_ABORTED), r = async () => {
63
+ const [e, o] = L({
49
64
  environment: t.environment,
50
65
  exampleKey: t.exampleKey,
51
66
  globalCookies: t.globalCookies,
52
67
  method: t.method,
53
68
  operation: t.operation,
54
69
  path: t.path,
55
- securitySchemes: t.securitySchemes,
56
- selectedSecurity: t.selectedSecurity?.selectedSchemes ?? [],
70
+ selectedSecuritySchemes: v.value,
57
71
  server: t.server,
58
72
  proxyUrl: t.proxyUrl
59
73
  });
60
74
  if (e) {
61
- m(e.message, "error");
75
+ y(e.message, "error");
62
76
  return;
63
77
  }
64
- d.value = n.controller, t.eventBus.emit("hooks:on:request:sent");
65
- const [u, v] = await M({
66
- isUsingProxy: n.isUsingProxy,
78
+ h.value = o.controller, t.eventBus.emit("hooks:on:request:sent");
79
+ const [i, f] = await N({
80
+ isUsingProxy: o.isUsingProxy,
67
81
  operation: t.operation,
68
82
  plugins: t.plugins,
69
- request: n.request
83
+ request: o.request
70
84
  });
71
- if (t.eventBus.emit("hooks:on:request:complete"), u) {
72
- m(u.message, "error");
85
+ if (t.eventBus.emit("hooks:on:request:complete"), i) {
86
+ y(i.message, "error");
73
87
  return;
74
88
  }
75
- s.value = v.response, l.value = v.request;
89
+ u.value = f.response, l.value = f.request;
76
90
  };
77
- return g(() => {
78
- t.eventBus.on("operation:send:request:hotkey", r), t.eventBus.on("operation:cancel:request", c);
79
- }), R(() => {
80
- t.eventBus.off("operation:send:request:hotkey", r), t.eventBus.off("operation:cancel:request", c);
81
- }), C([() => t.path, () => t.method, () => t.exampleKey], () => {
82
- s.value = null, l.value = null;
83
- }), (e, n) => (U(), S("div", I, [
84
- k("div", $, [
85
- o(A, {
91
+ return C(() => {
92
+ t.eventBus.on("operation:send:request:hotkey", r), t.eventBus.on("operation:cancel:request", p);
93
+ }), U(() => {
94
+ t.eventBus.off("operation:send:request:hotkey", r), t.eventBus.off("operation:cancel:request", p);
95
+ }), k([() => t.path, () => t.method, () => t.exampleKey], () => {
96
+ u.value = null, l.value = null;
97
+ }), (e, o) => (b(), E("div", z, [
98
+ O("div", F, [
99
+ n(I, {
86
100
  documentUrl: e.documentUrl,
87
101
  environment: e.environment,
88
102
  eventBus: e.eventBus,
@@ -96,16 +110,16 @@ const I = { class: "bg-b-1 flex h-full flex-col" }, $ = { class: "lg:min-h-heade
96
110
  servers: e.servers,
97
111
  source: e.source,
98
112
  onExecute: r,
99
- "onUpdate:servers": n[0] || (n[0] = (u) => p("update:servers"))
113
+ "onUpdate:servers": o[0] || (o[0] = (i) => g("update:servers"))
100
114
  }, null, 8, ["documentUrl", "environment", "eventBus", "hideClientButton", "history", "integration", "layout", "method", "path", "server", "servers", "source"])
101
115
  ]),
102
- o(V, { class: "border-t" }, {
103
- default: h(() => [
104
- o(K, { class: "flex-1" }, {
105
- default: h(() => [
106
- o(a(T), {
116
+ n(w, { class: "border-t" }, {
117
+ default: S(() => [
118
+ n(P, { class: "flex-1" }, {
119
+ default: S(() => [
120
+ n(m(H), {
107
121
  authMeta: e.authMeta,
108
- clientOptions: f.value,
122
+ clientOptions: q.value,
109
123
  environment: e.environment,
110
124
  eventBus: e.eventBus,
111
125
  exampleKey: e.exampleKey,
@@ -115,20 +129,21 @@ const I = { class: "bg-b-1 flex h-full flex-col" }, $ = { class: "lg:min-h-heade
115
129
  path: e.path,
116
130
  plugins: e.plugins,
117
131
  proxyUrl: e.proxyUrl,
118
- securityRequirements: e.securityRequirements,
132
+ securityRequirements: c.value,
119
133
  securitySchemes: e.securitySchemes,
120
134
  selectedClient: e.selectedClient,
121
- selectedSecurity: e.selectedSecurity,
135
+ selectedSecurity: d.value,
136
+ selectedSecuritySchemes: v.value,
122
137
  server: e.server
123
- }, null, 8, ["authMeta", "clientOptions", "environment", "eventBus", "exampleKey", "layout", "method", "operation", "path", "plugins", "proxyUrl", "securityRequirements", "securitySchemes", "selectedClient", "selectedSecurity", "server"]),
124
- o(a(N), {
138
+ }, null, 8, ["authMeta", "clientOptions", "environment", "eventBus", "exampleKey", "layout", "method", "operation", "path", "plugins", "proxyUrl", "securityRequirements", "securitySchemes", "selectedClient", "selectedSecurity", "selectedSecuritySchemes", "server"]),
139
+ n(m(Q), {
125
140
  appVersion: e.appVersion,
126
141
  eventBus: e.eventBus,
127
- events: a(w)(),
142
+ events: m(A)(),
128
143
  layout: e.layout,
129
144
  plugins: e.plugins,
130
145
  request: l.value,
131
- response: s.value,
146
+ response: u.value,
132
147
  totalPerformedRequests: e.totalPerformedRequests,
133
148
  onSendRequest: r
134
149
  }, null, 8, ["appVersion", "eventBus", "events", "layout", "plugins", "request", "response", "totalPerformedRequests"])
@@ -142,5 +157,5 @@ const I = { class: "bg-b-1 flex h-full flex-col" }, $ = { class: "lg:min-h-heade
142
157
  }
143
158
  });
144
159
  export {
145
- ee as default
160
+ ae as default
146
161
  };
@@ -1 +1 @@
1
- {"version":3,"file":"build-request-body.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-body.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAA;AAIjG;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,aAAa,iBAAiB,GAAG,SAAS;AAC1C,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qCAAqC;AACrC,mBAAsB,KACrB,QAAQ,GAAG,IAmDb,CAAA"}
1
+ {"version":3,"file":"build-request-body.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-body.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAA;AAIjG;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,aAAa,iBAAiB,GAAG,SAAS;AAC1C,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qCAAqC;AACrC,mBAAsB,KACrB,QAAQ,GAAG,IAwDb,CAAA"}
@@ -1,22 +1,26 @@
1
1
  import { replaceEnvVariables as i } from "@scalar/helpers/regex/replace-variables";
2
- import { getExampleFromBody as c } from "../../request-block/helpers/get-request-body-example.js";
3
- const u = (r, e = {}, l = "default") => {
2
+ import { unpackProxyObject as m } from "@scalar/workspace-store/helpers/unpack-proxy";
3
+ import { getExampleFromBody as u } from "../../request-block/helpers/get-request-body-example.js";
4
+ const b = (r, e = {}, p = "default") => {
4
5
  if (!r)
5
6
  return null;
6
- const a = r?.["x-scalar-selected-content-type"]?.[l] ?? Object.keys(r?.content ?? {})[0] ?? "application/json", t = c(r, a, l);
7
+ const a = r?.["x-scalar-selected-content-type"]?.[p] ?? Object.keys(r?.content ?? {})[0] ?? "application/json", t = u(r, a, p);
7
8
  if (!t)
8
9
  return null;
9
10
  if ((a === "multipart/form-data" || a === "application/x-www-form-urlencoded") && Array.isArray(t.value)) {
10
11
  const n = a === "multipart/form-data" ? new FormData() : new URLSearchParams();
11
- return t.value.forEach(({ name: f, value: o }) => {
12
- if (!f)
12
+ return t.value.forEach(({ name: l, value: o }) => {
13
+ if (!l)
13
14
  return;
14
- const p = i(f, e);
15
- o instanceof File && n instanceof FormData ? n.append(p, o) : typeof o == "string" && n.append(p, i(o, e));
15
+ const c = i(l, e);
16
+ if (o instanceof File && n instanceof FormData) {
17
+ const f = m(o);
18
+ n.append(c, f, f.name);
19
+ } else typeof o == "string" && n.append(c, i(o, e));
16
20
  }), n;
17
21
  }
18
22
  return typeof t.value == "object" ? i(JSON.stringify(t.value), e) : typeof t.value == "string" ? i(t.value, e) : t.value;
19
23
  };
20
24
  export {
21
- u as buildRequestBody
25
+ b as buildRequestBody
22
26
  };
@@ -1,19 +1,17 @@
1
1
  import { type XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
2
2
  import type { OpenApiDocument, SecurityRequirementObject, SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
3
  /**
4
- * Get the selected security schemes from the selected security.
4
+ * Get the selected security schemes from security requirements.
5
5
  * Takes security requirement objects and resolves them to actual security scheme objects.
6
6
  */
7
- export declare const getSelectedSecuritySchemes: (securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"], selectedSecurity: SecurityRequirementObject[]) => SecuritySchemeObject[];
7
+ export declare const getSecuritySchemes: (securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"], selectedSecurity: SecurityRequirementObject[]) => SecuritySchemeObject[];
8
8
  /**
9
9
  * Generates the headers, cookies and query params for selected security schemes
10
10
  * In the future we can add customization for where the security is applied
11
11
  */
12
12
  export declare const buildRequestSecurity: (
13
- /** Document defined security schemes */
14
- securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"],
15
13
  /** Currently selected security for the current operation */
16
- selectedSecurity: SecurityRequirementObject[],
14
+ selectedSecuritySchemes: SecuritySchemeObject[],
17
15
  /** Environment variables flattened into a key-value object */
18
16
  env?: Record<string, string>,
19
17
  /** Include this parameter to set the placeholder for empty tokens */
@@ -1 +1 @@
1
- {"version":3,"file":"build-request-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-security.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,8DAA8D,CAAA;AAGrE;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GACrC,iBAAiB,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,EAC9E,kBAAkB,yBAAyB,EAAE,KAC5C,oBAAoB,EAUd,CAAA;AAET;;;GAGG;AACH,eAAO,MAAM,oBAAoB;AAC/B,wCAAwC;AACxC,iBAAiB,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC;AAC9E,4DAA4D;AAC5D,kBAAkB,yBAAyB,EAAE;AAC7C,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qEAAqE;AACrE,8BAA0B,KACzB;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,SAAS,EAAE,eAAe,CAAA;CA0DzF,CAAA"}
1
+ {"version":3,"file":"build-request-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-security.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,8DAA8D,CAAA;AAGrE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,iBAAiB,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,EAC9E,kBAAkB,yBAAyB,EAAE,KAC5C,oBAAoB,EAUd,CAAA;AAET;;;GAGG;AACH,eAAO,MAAM,oBAAoB;AAC/B,4DAA4D;AAC5D,yBAAyB,oBAAoB,EAAE;AAC/C,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qEAAqE;AACrE,8BAA0B,KACzB;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,SAAS,EAAE,eAAe,CAAA;CAuDzF,CAAA"}
@@ -1,46 +1,46 @@
1
1
  import { isDefined as p } from "@scalar/helpers/array/is-defined";
2
- import { objectKeys as m } from "@scalar/helpers/object/object-keys";
2
+ import { objectKeys as l } from "@scalar/helpers/object/object-keys";
3
3
  import { replaceEnvVariables as s } from "@scalar/helpers/regex/replace-variables";
4
- import { getResolvedRef as d } from "@scalar/workspace-store/helpers/get-resolved-ref";
5
- import { xScalarCookieSchema as S } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
4
+ import { getResolvedRef as m } from "@scalar/workspace-store/helpers/get-resolved-ref";
5
+ import { xScalarCookieSchema as d } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
6
6
  import { coerceValue as x } from "@scalar/workspace-store/schemas/typebox-coerce";
7
- import { encode as y } from "js-base64";
8
- const k = (n, f) => f.flatMap(
9
- (r) => m(r).flatMap((i) => {
10
- const o = d(n?.[i]);
11
- return o || [];
7
+ import { encode as k } from "js-base64";
8
+ const A = (f, o) => o.flatMap(
9
+ (i) => l(i).flatMap((a) => {
10
+ const n = m(f?.[a]);
11
+ return n || [];
12
12
  })
13
- ) ?? [], g = (n, f, r = {}, i = "") => {
14
- const o = {}, u = [], l = new URLSearchParams();
15
- return k(n, f).forEach((t) => {
16
- if (t.type === "apiKey") {
17
- const e = s(t.name, r), a = s(t["x-scalar-secret-token"], r) || i;
18
- t.in === "header" && (o[e] = a), t.in === "query" && l.append(e, a), t.in === "cookie" && u.push(
19
- x(S, {
20
- name: e,
21
- value: a,
13
+ ) ?? [], B = (f, o = {}, i = "") => {
14
+ const a = {}, n = [], u = new URLSearchParams();
15
+ return f.forEach((r) => {
16
+ if (r.type === "apiKey") {
17
+ const t = s(r.name, o), e = s(r["x-scalar-secret-token"], o) || i;
18
+ r.in === "header" && (a[t] = e), r.in === "query" && u.append(t, e), r.in === "cookie" && n.push(
19
+ x(d, {
20
+ name: t,
21
+ value: e,
22
22
  path: "/"
23
23
  })
24
24
  );
25
25
  }
26
- if (t.type === "http")
27
- if (t.scheme === "basic") {
28
- const e = s(t["x-scalar-secret-username"], r), a = s(t["x-scalar-secret-password"], r), c = `${e}:${a}`;
29
- o.Authorization = `Basic ${c === ":" ? "username:password" : y(c)}`;
26
+ if (r.type === "http")
27
+ if (r.scheme === "basic") {
28
+ const t = s(r["x-scalar-secret-username"], o), e = s(r["x-scalar-secret-password"], o), c = `${t}:${e}`;
29
+ a.Authorization = `Basic ${c === ":" ? "username:password" : k(c)}`;
30
30
  } else {
31
- const e = s(t["x-scalar-secret-token"], r);
32
- o.Authorization = `Bearer ${e || i}`;
31
+ const t = s(r["x-scalar-secret-token"], o);
32
+ a.Authorization = `Bearer ${t || i}`;
33
33
  }
34
- if (t.type === "oauth2") {
35
- const e = Object.values(t.flows), a = s(
36
- e.filter(p).find((c) => c["x-scalar-secret-token"])?.["x-scalar-secret-token"] ?? "",
37
- r
34
+ if (r.type === "oauth2") {
35
+ const t = Object.values(r.flows), e = s(
36
+ t.filter(p).find((c) => c["x-scalar-secret-token"])?.["x-scalar-secret-token"] ?? "",
37
+ o
38
38
  );
39
- o.Authorization = `Bearer ${a || i}`;
39
+ a.Authorization = `Bearer ${e || i}`;
40
40
  }
41
- }), { headers: o, cookies: u, urlParams: l };
41
+ }), { headers: a, cookies: n, urlParams: u };
42
42
  };
43
43
  export {
44
- g as buildRequestSecurity,
45
- k as getSelectedSecuritySchemes
44
+ B as buildRequestSecurity,
45
+ A as getSecuritySchemes
46
46
  };
@@ -1,7 +1,7 @@
1
1
  import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
2
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
3
3
  import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
4
- import type { OpenApiDocument, SecurityRequirementObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
4
+ import type { SecuritySchemeObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
5
5
  import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation';
6
6
  import { type ErrorResponse } from '../../../../libs/errors.js';
7
7
  /**
@@ -16,7 +16,7 @@ import { type ErrorResponse } from '../../../../libs/errors.js';
16
16
  *
17
17
  * @returns A tuple containing either an error or the request object with an abort controller
18
18
  */
19
- export declare const buildRequest: ({ environment, exampleKey, globalCookies, method, operation, path, proxyUrl, server, securitySchemes, selectedSecurity, }: {
19
+ export declare const buildRequest: ({ environment, exampleKey, globalCookies, method, operation, path, proxyUrl, server, selectedSecuritySchemes, }: {
20
20
  /** For environment variables in the inputs */
21
21
  environment: XScalarEnvironment;
22
22
  /** The key of the current example */
@@ -31,12 +31,10 @@ export declare const buildRequest: ({ environment, exampleKey, globalCookies, me
31
31
  path: string;
32
32
  /** The proxy URL for cookie domain determination */
33
33
  proxyUrl: string;
34
- /** Document defined security schemes */
35
- securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"];
36
- /** Currently selected security for the current operation */
37
- selectedSecurity: SecurityRequirementObject[];
38
34
  /** The server object */
39
35
  server: ServerObject | null;
36
+ /** The selected security schemes for the current operation */
37
+ selectedSecuritySchemes: SecuritySchemeObject[];
40
38
  }) => ErrorResponse<{
41
39
  controller: AbortController;
42
40
  request: Request;
@@ -1 +1 @@
1
- {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAKnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,YAAY,EACb,MAAM,8DAA8D,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAI5F,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAO1E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,2HAW1B;IACD,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,mCAAmC;IACnC,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,uCAAuC;IACvC,MAAM,EAAE,UAAU,CAAA;IAClB,2BAA2B;IAC3B,SAAS,EAAE,eAAe,CAAA;IAC1B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,eAAe,EAAE,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAA;IAC9E,4DAA4D;IAC5D,gBAAgB,EAAE,yBAAyB,EAAE,CAAA;IAC7C,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;CAC5B,KAAG,aAAa,CAAC;IAChB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB,CAwFA,CAAA"}
1
+ {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAKnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AACtH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAI5F,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAO1E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,iHAU1B;IACD,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,mCAAmC;IACnC,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,uCAAuC;IACvC,MAAM,EAAE,UAAU,CAAA;IAClB,2BAA2B;IAC3B,SAAS,EAAE,eAAe,CAAA;IAC1B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,8DAA8D;IAC9D,uBAAuB,EAAE,oBAAoB,EAAE,CAAA;CAChD,KAAG,aAAa,CAAC;IAChB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB,CAwFA,CAAA"}
@@ -1,15 +1,15 @@
1
1
  import { replaceVariables as U } from "@scalar/helpers/regex/replace-variables";
2
- import { mergeUrls as x } from "@scalar/helpers/url/merge-urls";
3
- import { shouldUseProxy as I, redirectToProxy as T } from "@scalar/oas-utils/helpers";
4
- import { getResolvedRef as V } from "@scalar/workspace-store/helpers/get-resolved-ref";
5
- import { objectEntries as _ } from "@vueuse/core";
2
+ import { mergeUrls as L } from "@scalar/helpers/url/merge-urls";
3
+ import { shouldUseProxy as x, redirectToProxy as I } from "@scalar/oas-utils/helpers";
4
+ import { getResolvedRef as T } from "@scalar/workspace-store/helpers/get-resolved-ref";
5
+ import { objectEntries as V } from "@vueuse/core";
6
6
  import { isElectron as k } from "../../../../libs/electron.js";
7
- import { ERRORS as q, normalizeError as D } from "../../../../libs/errors.js";
8
- import { buildRequestBody as j } from "./build-request-body.js";
9
- import { buildRequestCookieHeader as z } from "./build-request-cookie-header.js";
10
- import { buildRequestParameters as F } from "./build-request-parameters.js";
11
- import { buildRequestSecurity as G } from "./build-request-security.js";
12
- const ee = ({
7
+ import { ERRORS as q, normalizeError as _ } from "../../../../libs/errors.js";
8
+ import { buildRequestBody as D } from "./build-request-body.js";
9
+ import { buildRequestCookieHeader as j } from "./build-request-cookie-header.js";
10
+ import { buildRequestParameters as z } from "./build-request-parameters.js";
11
+ import { buildRequestSecurity as F } from "./build-request-security.js";
12
+ const K = ({
13
13
  environment: y,
14
14
  exampleKey: u = "default",
15
15
  globalCookies: h,
@@ -18,22 +18,21 @@ const ee = ({
18
18
  path: a,
19
19
  proxyUrl: c,
20
20
  server: d,
21
- securitySchemes: E,
22
- selectedSecurity: C
21
+ selectedSecuritySchemes: E
23
22
  }) => {
24
23
  try {
25
24
  const e = y.variables.reduce(
26
25
  (t, o) => (t[o.name] = typeof o.value == "string" ? o.value : o.value.default, t),
27
26
  {}
28
- ), A = _(d?.variables ?? {}).reduce(
27
+ ), C = V(d?.variables ?? {}).reduce(
29
28
  (t, [o, P]) => (P.default && (t[o] = P.default), t),
30
29
  {}
31
- ), i = U(d?.url ?? "", { ...e, ...A }), H = V(m.requestBody);
30
+ ), i = U(d?.url ?? "", { ...e, ...C }), A = T(m.requestBody);
32
31
  if (!i && !a)
33
32
  throw q.URL_EMPTY;
34
- const s = F(m.parameters ?? [], e, u), S = j(H, e, u), n = G(E, C, e), r = { ...s.headers, ...n.headers }, w = new URLSearchParams([...s.urlParams, ...n.urlParams]), f = U(a, { ...e, ...s.pathVariables }), p = x(i, f, w), R = I(c, p), B = T(c, p), b = r["User-Agent"] || r["user-agent"];
33
+ const s = z(m.parameters ?? [], e, u), H = D(A, e, u), n = F(E, e), r = { ...s.headers, ...n.headers }, S = new URLSearchParams([...s.urlParams, ...n.urlParams]), f = U(a, { ...e, ...s.pathVariables }), p = L(i, f, S), R = x(c, p), w = I(c, p), b = r["User-Agent"] || r["user-agent"];
35
34
  k() && b && (r["X-Scalar-User-Agent"] = b);
36
- const l = z({
35
+ const l = j({
37
36
  paramCookies: [...s.cookies, ...n.cookies],
38
37
  globalCookies: h,
39
38
  env: e,
@@ -43,24 +42,24 @@ const ee = ({
43
42
  useCustomCookieHeader: k() || R
44
43
  });
45
44
  l && (r[l.name] = l.value);
46
- const g = new AbortController(), L = new Request(B, {
45
+ const g = new AbortController(), B = new Request(w, {
47
46
  method: v,
48
47
  headers: r,
49
48
  signal: g.signal,
50
- body: S
49
+ body: H
51
50
  });
52
51
  return [
53
52
  null,
54
53
  {
55
54
  controller: g,
56
55
  isUsingProxy: R,
57
- request: L
56
+ request: B
58
57
  }
59
58
  ];
60
59
  } catch (e) {
61
- return [D(e, q.BUILDING_REQUEST_FAILED), null];
60
+ return [_(e, q.BUILDING_REQUEST_FAILED), null];
62
61
  }
63
62
  };
64
63
  export {
65
- ee as buildRequest
64
+ K as buildRequest
66
65
  };
@@ -1 +1 @@
1
- {"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-example.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EAClB,MAAM,8DAA8D,CAAA;AAIrE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,eAAe,GAAG,iBAAiB,EAC1C,YAAY,MAAM,GAAG,SAAS,EAC9B,aAAa,MAAM,GAAG,SAAS,KAC9B,aAAa,GAAG,SA+ClB,CAAA"}
1
+ {"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-example.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EAClB,MAAM,8DAA8D,CAAA;AAIrE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,eAAe,GAAG,iBAAiB,EAC1C,YAAY,MAAM,GAAG,SAAS,EAC9B,aAAa,MAAM,GAAG,SAAS,KAC9B,aAAa,GAAG,SAuDlB,CAAA"}
@@ -1,21 +1,27 @@
1
- import { getResolvedRef as d } from "@scalar/workspace-store/helpers/get-resolved-ref";
2
- import { getResolvedRefDeep as o } from "../../operation-code-sample/helpers/get-resolved-ref-deep.js";
3
- const m = (e, s, l) => {
4
- if ("content" in e) {
5
- const t = e.content?.[l ?? Object.keys(e.content)[0] ?? ""], f = t?.examples ?? {}, c = s ?? Object.keys(f)[0] ?? "", i = o(f[c]);
6
- return typeof i < "u" ? i : typeof s > "u" && t?.example ? { value: o(t.example) } : void 0;
1
+ import { getResolvedRef as l } from "@scalar/workspace-store/helpers/get-resolved-ref";
2
+ import { getResolvedRefDeep as s } from "../../operation-code-sample/helpers/get-resolved-ref-deep.js";
3
+ const d = (n, o, u) => {
4
+ if ("content" in n) {
5
+ const t = n.content?.[u ?? Object.keys(n.content)[0] ?? ""], c = t?.examples ?? {}, f = o ?? Object.keys(c)[0] ?? "", i = s(c[f]);
6
+ return typeof i < "u" ? i : typeof o > "u" && t?.example ? { value: s(t.example) } : void 0;
7
7
  }
8
- if ("examples" in e || "example" in e) {
9
- const t = d(e.examples) ?? {}, f = s ?? Object.keys(t)[0] ?? "", c = o(t?.[f]);
10
- if (typeof c < "u")
11
- return c;
12
- if (typeof s > "u" && e.example)
13
- return { value: o(e.example) };
8
+ if ("examples" in n || "example" in n) {
9
+ const t = l(n.examples) ?? {}, c = o ?? Object.keys(t)[0] ?? "", f = s(t?.[c]);
10
+ if (typeof f < "u")
11
+ return f;
12
+ if (typeof o > "u" && n.example)
13
+ return { value: s(n.example) };
14
+ }
15
+ const e = s(n);
16
+ if ("schema" in e && e.schema) {
17
+ if ("default" in e.schema && typeof e.schema.default < "u")
18
+ return { value: e.schema.default };
19
+ if ("enum" in e.schema && e.schema.enum?.[0])
20
+ return { value: e.schema.enum[0] };
21
+ if ("examples" in e.schema && e.schema.examples?.[0])
22
+ return { value: e.schema.examples[0] };
14
23
  }
15
- const n = o(e);
16
- if ("schema" in n && n.schema && "default" in n.schema && typeof n.schema.default < "u")
17
- return { value: n.schema.default };
18
24
  };
19
25
  export {
20
- m as getExample
26
+ d as getExample
21
27
  };