@scalar/api-client 2.10.0 → 2.11.0

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 (156) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/components/ImportCollection/IntegrationLogo.vue.d.ts.map +1 -1
  3. package/dist/components/ImportCollection/IntegrationLogo.vue.js +1 -0
  4. package/dist/components/Server/ServerVariablesForm.vue.d.ts.map +1 -1
  5. package/dist/components/Server/ServerVariablesForm.vue.js +6 -6
  6. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
  7. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +1 -1
  8. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue2.js +14 -13
  9. package/dist/hooks/useClientConfig.d.ts +3 -3
  10. package/dist/layouts/App/create-api-client-app.d.ts +1 -1
  11. package/dist/layouts/Web/create-api-client-web.d.ts +1 -1
  12. package/dist/libs/create-client.d.ts +1 -1
  13. package/dist/store/store.d.ts +1 -1
  14. package/dist/style.css +1 -1
  15. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +4 -6
  16. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  17. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +24 -27
  18. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +3 -6
  19. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  20. package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
  21. package/dist/v2/blocks/operation-block/components/Header.vue2.js +10 -12
  22. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts.map +1 -1
  23. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.js +11 -10
  24. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +2 -5
  25. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  26. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
  27. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +45 -47
  28. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +11 -9
  29. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  30. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +179 -5
  31. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue2.js +2 -179
  32. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +201 -198
  33. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +11 -6
  34. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
  35. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js +82 -5
  36. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue2.js +2 -85
  37. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts +3 -13
  38. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts.map +1 -1
  39. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.js +16 -18
  40. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +133 -142
  41. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +1 -1
  42. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  43. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +1 -1
  44. package/dist/v2/blocks/scalar-operation-block/components/OperationBlock.vue.d.ts +2 -16
  45. package/dist/v2/blocks/scalar-operation-block/components/OperationBlock.vue.d.ts.map +1 -1
  46. package/dist/v2/blocks/scalar-operation-block/components/OperationBlock.vue.js +2 -2
  47. package/dist/v2/blocks/scalar-operation-block/components/OperationBlock.vue2.js +202 -229
  48. package/dist/v2/blocks/scalar-operation-block/components/OperationBody.vue.d.ts +3 -5
  49. package/dist/v2/blocks/scalar-operation-block/components/OperationBody.vue.d.ts.map +1 -1
  50. package/dist/v2/blocks/scalar-operation-block/components/OperationBody.vue.js +2 -2
  51. package/dist/v2/blocks/scalar-operation-block/components/OperationBody.vue2.js +81 -85
  52. package/dist/v2/blocks/scalar-operation-block/components/OperationParams.vue.d.ts +2 -5
  53. package/dist/v2/blocks/scalar-operation-block/components/OperationParams.vue.d.ts.map +1 -1
  54. package/dist/v2/blocks/scalar-operation-block/components/OperationParams.vue.js +32 -34
  55. package/dist/v2/blocks/scalar-operation-block/components/OperationTable.vue.d.ts +2 -5
  56. package/dist/v2/blocks/scalar-operation-block/components/OperationTable.vue.d.ts.map +1 -1
  57. package/dist/v2/blocks/scalar-operation-block/components/OperationTable.vue.js +2 -2
  58. package/dist/v2/blocks/scalar-operation-block/components/OperationTable.vue2.js +31 -33
  59. package/dist/v2/blocks/scalar-operation-block/components/OperationTableRow.vue.d.ts +2 -5
  60. package/dist/v2/blocks/scalar-operation-block/components/OperationTableRow.vue.d.ts.map +1 -1
  61. package/dist/v2/blocks/scalar-operation-block/components/OperationTableRow.vue.js +42 -45
  62. package/dist/v2/blocks/scalar-response-block/components/Headers.vue.d.ts +2 -2
  63. package/dist/v2/blocks/scalar-response-block/components/Headers.vue.d.ts.map +1 -1
  64. package/dist/v2/blocks/scalar-response-block/components/Headers.vue.js +9 -9
  65. package/dist/v2/blocks/scalar-response-block/components/ResponseBody.vue.d.ts.map +1 -1
  66. package/dist/v2/blocks/scalar-response-block/components/ResponseBody.vue.js +2 -2
  67. package/dist/v2/blocks/scalar-response-block/components/ResponseBody.vue2.js +18 -18
  68. package/dist/v2/blocks/scalar-response-block/components/ResponseBodyStreaming.vue.d.ts.map +1 -1
  69. package/dist/v2/blocks/scalar-response-block/components/ResponseBodyStreaming.vue.js +14 -14
  70. package/dist/v2/blocks/scalar-response-block/components/ResponseBodyVirtual.vue.d.ts.map +1 -1
  71. package/dist/v2/blocks/scalar-response-block/components/ResponseBodyVirtual.vue.js +12 -12
  72. package/dist/v2/blocks/scalar-response-block/components/ResponseCookies.vue.d.ts.map +1 -1
  73. package/dist/v2/blocks/scalar-response-block/components/ResponseCookies.vue.js +13 -13
  74. package/dist/v2/components/data-table/DataTable.vue.d.ts.map +1 -1
  75. package/dist/v2/components/data-table/DataTable.vue.js +4 -4
  76. package/dist/v2/components/data-table/DataTableInput.vue.d.ts +5 -7
  77. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  78. package/dist/v2/components/data-table/DataTableInput.vue.js +2 -2
  79. package/dist/v2/components/data-table/DataTableInput.vue2.js +32 -36
  80. package/dist/v2/components/forms/ConfirmationForm.vue.d.ts +25 -0
  81. package/dist/v2/components/forms/ConfirmationForm.vue.d.ts.map +1 -0
  82. package/dist/v2/components/forms/ConfirmationForm.vue.js +7 -0
  83. package/dist/v2/components/forms/ConfirmationForm.vue2.js +45 -0
  84. package/dist/v2/components/forms/index.d.ts +2 -0
  85. package/dist/v2/components/forms/index.d.ts.map +1 -0
  86. package/dist/v2/components/forms/index.js +4 -0
  87. package/dist/v2/components/layout/CollapsibleSection.vue.d.ts +43 -0
  88. package/dist/v2/components/layout/CollapsibleSection.vue.d.ts.map +1 -0
  89. package/dist/v2/components/layout/CollapsibleSection.vue.js +89 -0
  90. package/dist/v2/components/layout/CollapsibleSection.vue2.js +4 -0
  91. package/dist/v2/components/layout/ValueEmitter.vue.d.ts +23 -0
  92. package/dist/v2/components/layout/ValueEmitter.vue.d.ts.map +1 -0
  93. package/dist/v2/components/layout/ValueEmitter.vue.js +21 -0
  94. package/dist/v2/components/layout/ValueEmitter.vue2.js +4 -0
  95. package/dist/v2/components/layout/index.d.ts +2 -0
  96. package/dist/v2/components/layout/index.d.ts.map +1 -0
  97. package/dist/v2/components/layout/index.js +4 -0
  98. package/dist/v2/components/modals/DeleteModal.vue.d.ts +15 -0
  99. package/dist/v2/components/modals/DeleteModal.vue.d.ts.map +1 -0
  100. package/dist/v2/components/modals/DeleteModal.vue.js +31 -0
  101. package/dist/v2/components/modals/DeleteModal.vue2.js +4 -0
  102. package/dist/v2/components/modals/index.d.ts +2 -0
  103. package/dist/v2/components/modals/index.d.ts.map +1 -0
  104. package/dist/v2/components/modals/index.js +4 -0
  105. package/dist/v2/components/server/ServerDropdown.vue.d.ts +4 -2
  106. package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
  107. package/dist/v2/components/server/ServerDropdown.vue.js +31 -31
  108. package/dist/v2/components/server/ServerDropdownItem.vue.d.ts +2 -6
  109. package/dist/v2/components/server/ServerDropdownItem.vue.d.ts.map +1 -1
  110. package/dist/v2/components/server/ServerDropdownItem.vue.js +1 -1
  111. package/dist/v2/components/server/ServerDropdownItem.vue2.js +16 -16
  112. package/dist/v2/components/server/index.d.ts.map +1 -1
  113. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +6 -2
  114. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  115. package/dist/v2/components/sidebar/Sidebar.vue.js +45 -55
  116. package/dist/v2/features/app/App.vue.d.ts +2 -2
  117. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  118. package/dist/v2/features/app/App.vue.js +89 -74
  119. package/dist/v2/features/app/components/AppSidebar.vue.d.ts +6 -2
  120. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  121. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  122. package/dist/v2/features/app/components/AppSidebar.vue2.js +50 -47
  123. package/dist/v2/features/app/helpers/routes.d.ts +0 -10
  124. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  125. package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
  126. package/dist/v2/features/collection/DocumentCollection.vue2.js +75 -73
  127. package/dist/v2/features/collection/components/Authentication.vue.d.ts +13 -25
  128. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  129. package/dist/v2/features/collection/components/Authentication.vue.js +2 -2
  130. package/dist/v2/features/collection/components/Authentication.vue2.js +47 -35
  131. package/dist/v2/features/collection/components/Form.vue.d.ts +3 -7
  132. package/dist/v2/features/collection/components/Form.vue.d.ts.map +1 -1
  133. package/dist/v2/features/collection/components/Form.vue.js +28 -33
  134. package/dist/v2/features/collection/components/Servers.vue.d.ts +13 -31
  135. package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
  136. package/dist/v2/features/collection/components/Servers.vue2.js +103 -82
  137. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.d.ts.map +1 -1
  138. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js +3 -3
  139. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  140. package/dist/v2/features/modal/Modal.vue.js +3 -3
  141. package/dist/v2/features/modal/Modal.vue2.js +40 -32
  142. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  143. package/dist/v2/features/operation/Operation.vue.js +22 -28
  144. package/dist/v2/hooks/use-sidebar-state.d.ts +47 -0
  145. package/dist/v2/hooks/use-sidebar-state.d.ts.map +1 -0
  146. package/dist/v2/hooks/use-sidebar-state.js +112 -0
  147. package/dist/v2/hooks/use-workspace-client-events.d.ts.map +1 -1
  148. package/dist/v2/hooks/use-workspace-client-events.js +75 -107
  149. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  150. package/package.json +17 -17
  151. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +0 -45
  152. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +0 -1
  153. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +0 -29
  154. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +0 -1
  155. package/dist/v2/blocks/scalar-auth-selector-block/event-types.d.ts +0 -29
  156. package/dist/v2/blocks/scalar-auth-selector-block/event-types.d.ts.map +0 -1
@@ -1,7 +1,181 @@
1
- import o from "./AuthSelector.vue2.js";
2
- /* empty css */
3
- import t from "../../../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9d69981c"]]);
1
+ import { defineComponent as $, useId as M, ref as f, computed as S, createBlock as b, openBlock as r, unref as n, withCtx as c, createVNode as m, createCommentVNode as x, createElementBlock as p, Fragment as g, createElementVNode as u, createTextVNode as k, toDisplayString as y, withModifiers as N, normalizeClass as T } from "vue";
2
+ import { useModal as q, ScalarComboboxMultiselect as j, ScalarButton as E, ScalarListboxCheckbox as z, ScalarIconButton as U } from "@scalar/components";
3
+ import { ScalarIconCaretDown as L, ScalarIconTrash as F } from "@scalar/icons";
4
+ import { getResolvedRef as P } from "@scalar/workspace-store/helpers/get-resolved-ref";
5
+ import G from "./DeleteRequestAuthModal.vue.js";
6
+ import { getSecuritySchemeOptions as H, formatComplexScheme as J, formatScheme as K } from "../helpers/security-scheme.js";
7
+ import Q from "./RequestAuthDataTable.vue.js";
8
+ import W from "../../../components/layout/CollapsibleSection.vue.js";
9
+ const X = ["id"], Y = { class: "min-w-0 flex-1 truncate" }, oe = /* @__PURE__ */ $({
10
+ __name: "AuthSelector",
11
+ props: {
12
+ environment: {},
13
+ eventBus: {},
14
+ isReadOnly: { type: Boolean, default: !1 },
15
+ isStatic: { type: Boolean, default: !1 },
16
+ meta: {},
17
+ security: {},
18
+ securitySchemes: {},
19
+ selectedSecurity: {},
20
+ server: {},
21
+ title: {}
22
+ },
23
+ setup(a, { expose: I }) {
24
+ const C = M(), O = f(null), B = f(!1), d = q(), o = f(null), h = S(() => {
25
+ if (!a.security?.length)
26
+ return null;
27
+ const e = a.security.some(
28
+ (l) => Object.keys(l).length > 1
29
+ ), s = a.security.some(
30
+ (l) => Object.keys(l).length === 0
31
+ ) && !e;
32
+ return {
33
+ icon: s ? "Unlock" : "Lock",
34
+ text: s ? "Optional" : "Required"
35
+ };
36
+ }), R = S(
37
+ () => H(a.security ?? [], a.securitySchemes ?? {}, a.isReadOnly)
38
+ ), i = S(() => {
39
+ const e = a.selectedSecurity?.selectedSchemes;
40
+ return e?.length ? e.flatMap((t) => {
41
+ const s = Object.keys(t);
42
+ if (s.length === 0)
43
+ return [];
44
+ if (s.length > 1)
45
+ return J(t);
46
+ const l = s[0];
47
+ if (!l)
48
+ return [];
49
+ const v = P(a.securitySchemes?.[l]);
50
+ return v ? K({
51
+ name: l,
52
+ type: v.type,
53
+ value: t
54
+ }) : [];
55
+ }) : [];
56
+ }), w = (e) => {
57
+ B.value && e.stopPropagation(), O.value?.$el.click();
58
+ }, V = (e) => {
59
+ const t = e.filter((l) => l.payload === void 0).map((l) => l.value), s = e.filter((l) => l.payload !== void 0).map((l) => ({
60
+ name: l.label,
61
+ scheme: l.payload
62
+ }));
63
+ a.eventBus.emit("auth:update:selected-security-schemes", {
64
+ selectedRequirements: t,
65
+ newSchemes: s,
66
+ meta: a.meta
67
+ });
68
+ }, D = (e) => {
69
+ o.value = { label: e.label, payload: e.value }, d.show();
70
+ }, A = () => {
71
+ o.value && (a.eventBus.emit("auth:delete:security-scheme", {
72
+ names: Object.keys(o.value.payload)
73
+ }), o.value = null, d.hide());
74
+ };
75
+ return I({
76
+ authIndicator: h,
77
+ selectedSchemeOptions: i,
78
+ schemeOptions: R
79
+ }), (e, t) => (r(), b(n(W), {
80
+ class: "group/params relative",
81
+ isStatic: e.isStatic,
82
+ itemCount: i.value.length,
83
+ "onUpdate:modelValue": t[1] || (t[1] = (s) => B.value = s)
84
+ }, {
85
+ title: c(() => [
86
+ u("div", {
87
+ id: n(C),
88
+ class: "inline-flex items-center gap-0.5 leading-[20px]"
89
+ }, [
90
+ u("span", null, y(e.title), 1),
91
+ h.value ? (r(), p("span", {
92
+ key: 0,
93
+ class: T(["text-c-3 hover:bg-b-3 hover:text-c-1 -mr-1 cursor-pointer rounded px-1 py-0.5 text-xs leading-[normal]", { "text-c-1": h.value.text === "Required" }]),
94
+ "data-testid": "auth-indicator",
95
+ onClick: w
96
+ }, y(h.value.text), 3)) : x("", !0)
97
+ ], 8, X)
98
+ ]),
99
+ actions: c(() => [
100
+ m(n(j), {
101
+ class: "w-72 text-xs",
102
+ modelValue: i.value,
103
+ multiple: "",
104
+ options: R.value,
105
+ placement: "bottom-end",
106
+ teleport: "",
107
+ onDelete: D,
108
+ "onUpdate:modelValue": V
109
+ }, {
110
+ option: c(({ option: s, selected: l }) => [
111
+ m(n(z), {
112
+ multiselect: "",
113
+ selected: l
114
+ }, null, 8, ["selected"]),
115
+ u("div", Y, y(s.label), 1),
116
+ s.isDeletable ?? !e.isReadOnly ? (r(), b(n(U), {
117
+ key: 0,
118
+ class: "-m-0.5 shrink-0 p-0.5 opacity-0 group-hover/item:opacity-100",
119
+ icon: n(F),
120
+ label: `Delete ${s.label}`,
121
+ size: "xs",
122
+ onClick: N((v) => D(s), ["stop"])
123
+ }, null, 8, ["icon", "label", "onClick"])) : x("", !0)
124
+ ]),
125
+ default: c(() => [
126
+ m(n(E), {
127
+ ref_key: "comboboxButtonRef",
128
+ ref: O,
129
+ "aria-describedby": n(C),
130
+ class: "group/combobox-button hover:text-c-1 text-c-2 flex h-fit w-full items-center gap-1 px-0.75 py-0.25 text-base font-normal",
131
+ variant: "ghost"
132
+ }, {
133
+ default: c(() => [
134
+ i.value.length === 1 ? (r(), p(g, { key: 0 }, [
135
+ t[2] || (t[2] = u("span", { class: "sr-only" }, "Selected Auth Type:", -1)),
136
+ k(" " + y(i.value[0]?.label), 1)
137
+ ], 64)) : i.value.length > 1 ? (r(), p(g, { key: 1 }, [
138
+ t[3] || (t[3] = k(" Multiple ", -1)),
139
+ t[4] || (t[4] = u("span", { class: "sr-only" }, "Auth Types Selected", -1))
140
+ ], 64)) : (r(), p(g, { key: 2 }, [
141
+ t[5] || (t[5] = u("span", { class: "sr-only" }, "Select", -1)),
142
+ t[6] || (t[6] = k(" Auth Type ", -1))
143
+ ], 64)),
144
+ m(n(L), {
145
+ class: "size-3 shrink-0 transition-transform duration-100 group-aria-expanded/combobox-button:rotate-180",
146
+ weight: "bold"
147
+ })
148
+ ]),
149
+ _: 1
150
+ }, 8, ["aria-describedby"])
151
+ ]),
152
+ _: 1
153
+ }, 8, ["modelValue", "options"])
154
+ ]),
155
+ default: c(() => [
156
+ m(Q, {
157
+ activeAuthIndex: e.selectedSecurity?.selectedIndex ?? 0,
158
+ environment: e.environment,
159
+ eventBus: e.eventBus,
160
+ isStatic: e.isStatic,
161
+ meta: e.meta,
162
+ securitySchemes: e.securitySchemes,
163
+ selectedSchemeOptions: i.value,
164
+ server: e.server
165
+ }, null, 8, ["activeAuthIndex", "environment", "eventBus", "isStatic", "meta", "securitySchemes", "selectedSchemeOptions", "server"]),
166
+ o.value ? (r(), b(G, {
167
+ key: 0,
168
+ label: o.value.label,
169
+ scheme: o.value,
170
+ state: n(d),
171
+ onClose: t[0] || (t[0] = (s) => n(d).hide()),
172
+ onDelete: A
173
+ }, null, 8, ["label", "scheme", "state"])) : x("", !0)
174
+ ]),
175
+ _: 1
176
+ }, 8, ["isStatic", "itemCount"]));
177
+ }
178
+ });
5
179
  export {
6
- m as default
180
+ oe as default
7
181
  };
@@ -1,181 +1,4 @@
1
- import { defineComponent as T, useId as $, ref as f, computed as b, createBlock as x, openBlock as r, unref as a, withCtx as u, createVNode as m, createCommentVNode as S, createElementVNode as i, createElementBlock as h, Fragment as g, createTextVNode as k, toDisplayString as p, withModifiers as L, normalizeClass as M } from "vue";
2
- import { useModal as N, ScalarComboboxMultiselect as j, ScalarButton as z, ScalarListboxCheckbox as U, ScalarIconButton as E } from "@scalar/components";
3
- import { ScalarIconCaretDown as F, ScalarIconTrash as P } from "@scalar/icons";
4
- import { isDefined as G } from "@scalar/oas-utils/helpers";
5
- import { getResolvedRef as H } from "@scalar/workspace-store/helpers/get-resolved-ref";
6
- import J from "./DeleteRequestAuthModal.vue.js";
7
- import { formatComplexScheme as K, formatScheme as Q, getSecuritySchemeOptions as W } from "../helpers/security-scheme.js";
8
- import X from "./RequestAuthDataTable.vue.js";
9
- import Y from "../../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
10
- import { useLayout as Z } from "../../../../hooks/useLayout.js";
11
- const _ = ["id"], ee = { class: "flex flex-1" }, te = { class: "min-w-0 flex-1 truncate" }, de = /* @__PURE__ */ T({
12
- __name: "AuthSelector",
13
- props: {
14
- environment: {},
15
- envVariables: {},
16
- layout: {},
17
- security: {},
18
- selectedSecurity: {},
19
- securitySchemes: {},
20
- server: {},
21
- title: {},
22
- eventBus: {},
23
- meta: {}
24
- },
25
- setup(l, { expose: A }) {
26
- const { layout: C } = Z(), B = $(), V = f(null), d = N(), n = f(null), O = f(!1), y = b(() => {
27
- if (!l.security?.length)
28
- return null;
29
- const e = !l.security.some(
30
- (v) => Object.keys(v).length > 1
31
- ) && l.security.some((v) => Object.keys(v).length === 0);
32
- return { icon: e ? "Unlock" : "Lock", text: e ? "Optional" : "Required" };
33
- }), s = b(() => l.selectedSecurity?.["x-schemes"].length ? l.selectedSecurity["x-schemes"].map((t) => {
34
- const e = Object.keys(t);
35
- if (e.length > 1)
36
- return K(t);
37
- const o = e[0];
38
- if (!o)
39
- return;
40
- const c = H(l.securitySchemes?.[o]);
41
- if (c)
42
- return Q({ name: o, type: c.type, value: t });
43
- }).filter(G) : []);
44
- function w({
45
- label: t,
46
- value: e
47
- }) {
48
- n.value = { label: t, payload: e }, d.show();
49
- }
50
- const R = b(() => W(
51
- l.security ?? [],
52
- l.securitySchemes ?? {},
53
- C === "modal" || l.layout === "reference"
54
- )), D = (t) => {
55
- O.value && t.stopPropagation(), V.value?.$el.click();
56
- }, I = (t) => {
57
- l.eventBus.emit("auth:update:selected-security-schemes", {
58
- // Only include updated schemes
59
- selectedRequirements: t.filter((e) => e.payload === void 0).map((e) => e.value),
60
- // Only include created schemes
61
- newSchemes: t.filter((e) => e.payload !== void 0).map((e) => ({
62
- name: e.label,
63
- scheme: e.payload
64
- })),
65
- meta: l.meta
66
- });
67
- }, q = () => {
68
- n.value && (l.eventBus.emit("auth:delete:security-scheme", {
69
- names: Object.keys(n.value.payload)
70
- }), n.value = null, d.hide());
71
- };
72
- return A({
73
- authIndicator: y,
74
- selectedSchemeOptions: s,
75
- schemeOptions: R
76
- }), (t, e) => (r(), x(a(Y), {
77
- class: "group/params relative",
78
- itemCount: s.value.length,
79
- layout: t.layout,
80
- "onUpdate:modelValue": e[1] || (e[1] = (o) => O.value = o)
81
- }, {
82
- title: u(() => [
83
- i("div", {
84
- id: a(B),
85
- class: "inline-flex items-center gap-0.5 leading-[20px]"
86
- }, [
87
- i("span", null, p(t.title), 1),
88
- y.value ? (r(), h("span", {
89
- key: 0,
90
- class: M(["text-c-3 hover:bg-b-3 hover:text-c-1 -mr-1 cursor-pointer rounded px-1 py-0.5 text-xs leading-[normal]", { "text-c-1": y.value.text === "Required" }]),
91
- "data-testid": "auth-indicator",
92
- onClick: D
93
- }, p(y.value.text), 3)) : S("", !0)
94
- ], 8, _)
95
- ]),
96
- actions: u(() => [
97
- i("div", ee, [
98
- m(a(j), {
99
- class: "w-72 text-xs",
100
- modelValue: s.value,
101
- multiple: "",
102
- options: R.value,
103
- placement: "bottom-end",
104
- teleport: "",
105
- onDelete: w,
106
- "onUpdate:modelValue": I
107
- }, {
108
- option: u(({ option: o, selected: c }) => [
109
- m(a(U), {
110
- multiselect: "",
111
- selected: c
112
- }, null, 8, ["selected"]),
113
- i("div", te, p(o.label), 1),
114
- o.isDeletable ?? (a(C) !== "modal" && t.layout !== "reference") ? (r(), x(a(E), {
115
- key: 0,
116
- class: "-m-0.5 shrink-0 p-0.5 opacity-0 group-hover/item:opacity-100",
117
- icon: a(P),
118
- label: `Delete ${o.label}`,
119
- size: "xs",
120
- onClick: L((v) => w(o), ["stop"])
121
- }, null, 8, ["icon", "label", "onClick"])) : S("", !0)
122
- ]),
123
- default: u(() => [
124
- m(a(z), {
125
- ref_key: "comboboxButtonRef",
126
- ref: V,
127
- "aria-describedby": a(B),
128
- class: "group/combobox-button hover:text-c-1 text-c-2 flex h-fit w-full items-center gap-1 px-0.75 py-0.25 text-base font-normal transition-transform",
129
- variant: "ghost"
130
- }, {
131
- default: u(() => [
132
- s.value.length === 1 ? (r(), h(g, { key: 0 }, [
133
- e[2] || (e[2] = i("span", { class: "sr-only" }, "Selected Auth Type:", -1)),
134
- k(" " + p(s.value[0]?.label), 1)
135
- ], 64)) : s.value.length > 1 ? (r(), h(g, { key: 1 }, [
136
- e[3] || (e[3] = k(" Multiple ", -1)),
137
- e[4] || (e[4] = i("span", { class: "sr-only" }, "Auth Types Selected", -1))
138
- ], 64)) : (r(), h(g, { key: 2 }, [
139
- e[5] || (e[5] = i("span", { class: "sr-only" }, "Select", -1)),
140
- e[6] || (e[6] = k(" Auth Type ", -1))
141
- ], 64)),
142
- m(a(F), {
143
- class: "size-3 shrink-0 transition-transform duration-100 group-aria-expanded/combobox-button:rotate-180",
144
- weight: "bold"
145
- })
146
- ]),
147
- _: 1
148
- }, 8, ["aria-describedby"])
149
- ]),
150
- _: 1
151
- }, 8, ["modelValue", "options"])
152
- ])
153
- ]),
154
- default: u(() => [
155
- m(X, {
156
- envVariables: t.envVariables,
157
- environment: t.environment,
158
- layout: t.layout,
159
- securitySchemes: t.securitySchemes,
160
- selectedSchemeOptions: s.value,
161
- server: t.server,
162
- meta: t.meta,
163
- activeAuthIndex: t.selectedSecurity?.["x-selected-index"] ?? 0,
164
- eventBus: t.eventBus
165
- }, null, 8, ["envVariables", "environment", "layout", "securitySchemes", "selectedSchemeOptions", "server", "meta", "activeAuthIndex", "eventBus"]),
166
- n.value ? (r(), x(J, {
167
- key: 0,
168
- label: n.value.label,
169
- scheme: n.value,
170
- state: a(d),
171
- onClose: e[0] || (e[0] = (o) => a(d).hide()),
172
- onDelete: q
173
- }, null, 8, ["label", "scheme", "state"])) : S("", !0)
174
- ]),
175
- _: 1
176
- }, 8, ["itemCount", "layout"]));
177
- }
178
- });
1
+ import f from "./AuthSelector.vue.js";
179
2
  export {
180
- de as default
3
+ f as default
181
4
  };