@scalar/api-client 2.26.2 → 2.27.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 (115) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/dist/components/Server/ServerSelector.vue.js +6 -6
  3. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +6 -6
  4. package/dist/style.css +1 -1
  5. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
  6. package/dist/v2/blocks/operation-block/helpers/build-request-body.js +29 -25
  7. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
  8. package/dist/v2/blocks/operation-block/helpers/get-example.js +15 -15
  9. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts +10 -0
  10. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts.map +1 -0
  11. package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.js +4 -0
  12. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  13. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +6 -6
  14. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  15. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
  16. package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +62 -69
  17. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  18. package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
  19. package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +7 -7
  20. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
  21. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
  22. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue2.js +31 -40
  23. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  24. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +37 -41
  25. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +3 -2
  26. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  27. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +107 -87
  28. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts +21 -0
  29. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -0
  30. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js +91 -0
  31. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue2.js +4 -0
  32. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  33. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +107 -93
  34. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  35. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +87 -65
  36. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts +36 -0
  37. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts.map +1 -0
  38. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +35 -0
  39. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts +1 -1
  40. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts.map +1 -1
  41. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.js +18 -10
  42. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts +5 -0
  43. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts.map +1 -0
  44. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js +27 -0
  45. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +3 -1
  46. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +1 -1
  47. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +1 -2
  48. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
  49. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +29 -37
  50. package/dist/v2/components/layout/CollapsibleSection.vue.js +1 -1
  51. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +2 -0
  52. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  53. package/dist/v2/components/sidebar/Sidebar.vue.js +24 -23
  54. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +2 -0
  55. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  56. package/dist/v2/components/sidebar/SidebarMenu.vue.js +30 -30
  57. package/dist/v2/features/app/App.vue.d.ts +5 -0
  58. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  59. package/dist/v2/features/app/App.vue.js +48 -46
  60. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  61. package/dist/v2/features/app/components/AppSidebar.vue.js +3 -3
  62. package/dist/v2/features/app/components/AppSidebar.vue2.js +64 -63
  63. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +11 -1
  64. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  65. package/dist/v2/features/app/helpers/create-api-client-app.js +12 -10
  66. package/dist/v2/features/app/helpers/routes.d.ts +2 -0
  67. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  68. package/dist/v2/features/app/hooks/use-theme.d.ts +42 -0
  69. package/dist/v2/features/app/hooks/use-theme.d.ts.map +1 -0
  70. package/dist/v2/features/app/hooks/use-theme.js +34 -0
  71. package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
  72. package/dist/v2/features/collection/DocumentCollection.vue.js +27 -26
  73. package/dist/v2/features/collection/WorkspaceCollection.vue.js +13 -12
  74. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  75. package/dist/v2/features/collection/components/Authentication.vue.js +2 -2
  76. package/dist/v2/features/collection/components/Authentication.vue2.js +49 -40
  77. package/dist/v2/features/collection/components/Cookies.vue.d.ts.map +1 -1
  78. package/dist/v2/features/collection/components/Cookies.vue.js +26 -13
  79. package/dist/v2/features/collection/components/Environment.vue.d.ts.map +1 -1
  80. package/dist/v2/features/collection/components/Environment.vue.js +27 -15
  81. package/dist/v2/features/collection/components/Overview.vue.d.ts.map +1 -1
  82. package/dist/v2/features/collection/components/Overview.vue.js +2 -2
  83. package/dist/v2/features/collection/components/Overview.vue2.js +68 -61
  84. package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
  85. package/dist/v2/features/collection/components/Servers.vue.js +93 -88
  86. package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
  87. package/dist/v2/features/collection/components/Settings.vue.js +19 -17
  88. package/dist/v2/features/environments/EnvironmentsList.vue.js +1 -1
  89. package/dist/v2/features/global-cookies/components/CookiesTable.vue.d.ts.map +1 -1
  90. package/dist/v2/features/global-cookies/components/CookiesTable.vue.js +2 -2
  91. package/dist/v2/features/global-cookies/components/CookiesTable.vue2.js +8 -8
  92. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  93. package/dist/v2/features/modal/Modal.vue.js +15 -15
  94. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  95. package/dist/v2/features/operation/Operation.vue.js +30 -33
  96. package/dist/v2/features/settings/CollectionSettings.vue.d.ts +10 -7
  97. package/dist/v2/features/settings/CollectionSettings.vue.d.ts.map +1 -1
  98. package/dist/v2/features/settings/CollectionSettings.vue.js +183 -149
  99. package/dist/v2/features/settings/DocumentSettings.vue.d.ts.map +1 -1
  100. package/dist/v2/features/settings/DocumentSettings.vue.js +88 -79
  101. package/dist/v2/features/settings/components/Section.vue.d.ts +2 -1
  102. package/dist/v2/features/settings/components/Section.vue.d.ts.map +1 -1
  103. package/dist/v2/features/settings/components/Section.vue.js +26 -15
  104. package/dist/v2/features/settings/helpers/get-theme-colors.d.ts +4 -3
  105. package/dist/v2/features/settings/helpers/get-theme-colors.d.ts.map +1 -1
  106. package/dist/v2/features/settings/helpers/get-theme-colors.js +6 -7
  107. package/dist/v2/helpers/handle-hotkeys.d.ts.map +1 -1
  108. package/dist/v2/helpers/handle-hotkeys.js +2 -2
  109. package/dist/v2/hooks/use-global-hot-keys.d.ts +3 -1
  110. package/dist/v2/hooks/use-global-hot-keys.d.ts.map +1 -1
  111. package/dist/v2/hooks/use-global-hot-keys.js +8 -6
  112. package/dist/v2/workspace-events.d.ts.map +1 -1
  113. package/dist/v2/workspace-events.js +13 -6
  114. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  115. package/package.json +18 -17
@@ -1,4 +1,4 @@
1
- import { defineComponent as U, useId as $, ref as p, computed as S, createBlock as x, openBlock as c, unref as s, withCtx as r, createVNode as m, createCommentVNode as b, createElementBlock as v, Fragment as g, createElementVNode as u, createTextVNode as k, toDisplayString as y, withModifiers as q, normalizeClass as M } from "vue";
1
+ import { defineComponent as U, useId as $, ref as y, computed as S, createBlock as p, openBlock as c, unref as s, withCtx as r, createVNode as m, createCommentVNode as x, createElementBlock as v, Fragment as b, createElementVNode as u, createTextVNode as g, toDisplayString as f, withModifiers as q, normalizeClass as M } from "vue";
2
2
  import { useModal as N, ScalarComboboxMultiselect as T, ScalarButton as j, ScalarListboxCheckbox as z, ScalarIconButton as E } from "@scalar/components";
3
3
  import { ScalarIconCaretDown as L, ScalarIconTrash as P } from "@scalar/icons";
4
4
  import { getResolvedRef as F } from "@scalar/workspace-store/helpers/get-resolved-ref";
@@ -22,8 +22,8 @@ const Z = ["id"], _ = { class: "min-w-0 flex-1 truncate" }, ue = /* @__PURE__ */
22
22
  server: {},
23
23
  title: {}
24
24
  },
25
- setup(e, { expose: I }) {
26
- const C = $(), B = p(null), O = p(!1), d = N(), o = p(null), h = S(() => {
25
+ setup(e, { expose: D }) {
26
+ const k = $(), C = y(null), B = y(!1), d = N(), o = y(null), h = S(() => {
27
27
  if (!e.securityRequirements?.length)
28
28
  return null;
29
29
  const l = J(e.securityRequirements);
@@ -31,7 +31,7 @@ const Z = ["id"], _ = { class: "min-w-0 flex-1 truncate" }, ue = /* @__PURE__ */
31
31
  icon: l ? "Unlock" : "Lock",
32
32
  text: l ? "Optional" : "Required"
33
33
  };
34
- }), R = S(
34
+ }), O = S(
35
35
  () => K(
36
36
  e.securityRequirements ?? [],
37
37
  e.securitySchemes ?? {},
@@ -46,18 +46,14 @@ const Z = ["id"], _ = { class: "min-w-0 flex-1 truncate" }, ue = /* @__PURE__ */
46
46
  if (a.length > 1)
47
47
  return Q(t);
48
48
  const n = a[0];
49
- if (!n)
50
- return [];
51
- const f = F(e.securitySchemes?.[n]);
52
- return f ? W({
49
+ return n ? F(e.securitySchemes?.[n]) ? W({
53
50
  name: n,
54
- type: f.type,
55
51
  value: t
56
- }) : [];
52
+ }) : [] : [];
57
53
  }) : [];
58
- }), w = (l) => {
59
- O.value && l.stopPropagation(), B.value?.$el.click();
60
- }, A = (l) => {
54
+ }), I = (l) => {
55
+ B.value && l.stopPropagation(), C.value?.$el.click();
56
+ }, w = (l) => {
61
57
  const t = l.filter((n) => n.payload === void 0).map((n) => G(n.value, { depth: 2 })), a = l.filter((n) => n.payload !== void 0).map((n) => ({
62
58
  name: n.label,
63
59
  scheme: n.payload
@@ -67,35 +63,35 @@ const Z = ["id"], _ = { class: "min-w-0 flex-1 truncate" }, ue = /* @__PURE__ */
67
63
  newSchemes: a,
68
64
  meta: e.meta
69
65
  });
70
- }, D = (l) => {
66
+ }, R = (l) => {
71
67
  o.value = { label: l.label, payload: l.value }, d.show();
72
- }, V = () => {
68
+ }, A = () => {
73
69
  o.value && (e.eventBus.emit("auth:delete:security-scheme", {
74
70
  names: Object.keys(o.value.payload)
75
71
  }), o.value = null, d.hide());
76
72
  };
77
- return I({
73
+ return D({
78
74
  authIndicator: h,
79
75
  selectedSchemeOptions: i,
80
- schemeOptions: R
81
- }), (l, t) => (c(), x(s(Y), {
76
+ schemeOptions: O
77
+ }), (l, t) => (c(), p(s(Y), {
82
78
  class: "group/params relative",
83
79
  isStatic: e.isStatic,
84
80
  itemCount: i.value.length,
85
- "onUpdate:modelValue": t[1] || (t[1] = (a) => O.value = a)
81
+ "onUpdate:modelValue": t[1] || (t[1] = (a) => B.value = a)
86
82
  }, {
87
83
  title: r(() => [
88
84
  u("div", {
89
- id: s(C),
85
+ id: s(k),
90
86
  class: "inline-flex items-center gap-0.5 leading-[20px]"
91
87
  }, [
92
- u("span", null, y(e.title), 1),
88
+ u("span", null, f(e.title), 1),
93
89
  h.value ? (c(), v("span", {
94
90
  key: 0,
95
91
  class: M(["text-c-3 hover:bg-b-3 hover:text-c-1 -my-0.5 -mr-1 cursor-pointer rounded px-1 py-0.5 leading-[normal] font-normal", { "text-c-1": h.value.text === "Required" }]),
96
92
  "data-testid": "auth-indicator",
97
- onClick: w
98
- }, y(h.value.text), 3)) : b("", !0)
93
+ onClick: I
94
+ }, f(h.value.text), 3)) : x("", !0)
99
95
  ], 8, Z)
100
96
  ]),
101
97
  actions: r(() => [
@@ -103,45 +99,45 @@ const Z = ["id"], _ = { class: "min-w-0 flex-1 truncate" }, ue = /* @__PURE__ */
103
99
  class: "w-72 text-xs",
104
100
  modelValue: i.value,
105
101
  multiple: "",
106
- options: R.value,
102
+ options: O.value,
107
103
  placement: "bottom-end",
108
104
  teleport: "",
109
- onDelete: D,
110
- "onUpdate:modelValue": A
105
+ onDelete: R,
106
+ "onUpdate:modelValue": w
111
107
  }, {
112
108
  option: r(({ option: a, selected: n }) => [
113
109
  m(s(z), {
114
110
  multiselect: "",
115
111
  selected: n
116
112
  }, null, 8, ["selected"]),
117
- u("div", _, y(a.label), 1),
118
- a.isDeletable ? (c(), x(s(E), {
113
+ u("div", _, f(a.label), 1),
114
+ a.isDeletable ? (c(), p(s(E), {
119
115
  key: 0,
120
116
  class: "-m-0.5 shrink-0 p-0.5 opacity-0 group-hover/item:opacity-100",
121
117
  icon: s(P),
122
118
  label: `Delete ${a.label}`,
123
119
  size: "xs",
124
- onClick: q((f) => D(a), ["stop"])
125
- }, null, 8, ["icon", "label", "onClick"])) : b("", !0)
120
+ onClick: q((V) => R(a), ["stop"])
121
+ }, null, 8, ["icon", "label", "onClick"])) : x("", !0)
126
122
  ]),
127
123
  default: r(() => [
128
124
  m(s(j), {
129
125
  ref_key: "comboboxButtonRef",
130
- ref: B,
131
- "aria-describedby": s(C),
126
+ ref: C,
127
+ "aria-describedby": s(k),
132
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",
133
129
  variant: "ghost"
134
130
  }, {
135
131
  default: r(() => [
136
- i.value.length === 1 ? (c(), v(g, { key: 0 }, [
132
+ i.value.length === 1 ? (c(), v(b, { key: 0 }, [
137
133
  t[2] || (t[2] = u("span", { class: "sr-only" }, "Selected Auth Type:", -1)),
138
- k(" " + y(i.value[0]?.label), 1)
139
- ], 64)) : i.value.length > 1 ? (c(), v(g, { key: 1 }, [
140
- t[3] || (t[3] = k(" Multiple ", -1)),
134
+ g(" " + f(i.value[0]?.label), 1)
135
+ ], 64)) : i.value.length > 1 ? (c(), v(b, { key: 1 }, [
136
+ t[3] || (t[3] = g(" Multiple ", -1)),
141
137
  t[4] || (t[4] = u("span", { class: "sr-only" }, "Auth Types Selected", -1))
142
- ], 64)) : (c(), v(g, { key: 2 }, [
138
+ ], 64)) : (c(), v(b, { key: 2 }, [
143
139
  t[5] || (t[5] = u("span", { class: "sr-only" }, "Select", -1)),
144
- t[6] || (t[6] = k(" Auth Type ", -1))
140
+ t[6] || (t[6] = g(" Auth Type ", -1))
145
141
  ], 64)),
146
142
  m(s(L), {
147
143
  class: "size-3 shrink-0 transition-transform duration-100 group-aria-expanded/combobox-button:rotate-180",
@@ -166,14 +162,14 @@ const Z = ["id"], _ = { class: "min-w-0 flex-1 truncate" }, ue = /* @__PURE__ */
166
162
  selectedSchemeOptions: i.value,
167
163
  server: e.server
168
164
  }, null, 8, ["activeAuthIndex", "environment", "eventBus", "isStatic", "meta", "proxyUrl", "securitySchemes", "selectedSchemeOptions", "server"]),
169
- o.value ? (c(), x(H, {
165
+ o.value ? (c(), p(H, {
170
166
  key: 0,
171
167
  label: o.value.label,
172
168
  scheme: o.value,
173
169
  state: s(d),
174
170
  onClose: t[0] || (t[0] = (a) => s(d).hide()),
175
- onDelete: V
176
- }, null, 8, ["label", "scheme", "state"])) : b("", !0)
171
+ onDelete: A
172
+ }, null, 8, ["label", "scheme", "state"])) : x("", !0)
177
173
  ]),
178
174
  _: 1
179
175
  }, 8, ["isStatic", "itemCount"]));
@@ -1,17 +1,18 @@
1
1
  import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
2
2
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
3
3
  import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
4
- import type { OAuthFlowsObjectSecret } from '../../../../v2/blocks/scalar-auth-selector-block/helpers/secret-types';
4
+ import type { OAuthFlowsObjectSecret, SecuritySchemeObjectSecret } from '../../../../v2/blocks/scalar-auth-selector-block/helpers/secret-types';
5
5
  type __VLS_Props = {
6
6
  /** Current environment configuration */
7
7
  environment: XScalarEnvironment;
8
8
  /** OAuth flows */
9
9
  flows: OAuthFlowsObjectSecret;
10
- /** Current environment configuration */
11
10
  /** Type of the OAuth flow */
12
11
  type: keyof OAuthFlowsObjectSecret;
13
12
  /** Selected scopes */
14
13
  selectedScopes: string[];
14
+ /** Security scheme */
15
+ scheme: SecuritySchemeObjectSecret;
15
16
  /** Current server configuration */
16
17
  server: ServerObject | null;
17
18
  /** Proxy URL */
@@ -1 +1 @@
1
- {"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue"],"names":[],"mappings":"AAkWA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAGnH,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,8DAA8D,CAAA;AAMrE,OAAO,KAAK,EAIV,sBAAsB,EACvB,MAAM,6DAA6D,CAAA;AAIpE,KAAK,WAAW,GAAG;IACjB,wCAAwC;IACxC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,kBAAkB;IAClB,KAAK,EAAE,sBAAsB,CAAA;IAC7B,wCAAwC;IACxC,6BAA6B;IAC7B,IAAI,EAAE,MAAM,sBAAsB,CAAA;IAClC,sBAAsB;IACtB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,mCAAmC;IACnC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,2CAA2C;IAC3C,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AAyrBF,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue"],"names":[],"mappings":"AAiYA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAGnH,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,8DAA8D,CAAA;AAMrE,OAAO,KAAK,EAIV,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,6DAA6D,CAAA;AAIpE,KAAK,WAAW,GAAG;IACjB,wCAAwC;IACxC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,kBAAkB;IAClB,KAAK,EAAE,sBAAsB,CAAA;IAC7B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,sBAAsB,CAAA;IAClC,sBAAsB;IACtB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,sBAAsB;IACtB,MAAM,EAAE,0BAA0B,CAAA;IAClC,mCAAmC;IACnC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,2CAA2C;IAC3C,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AA6uBF,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1,19 +1,20 @@
1
- import { defineComponent as b, computed as w, watch as L, createElementBlock as x, openBlock as c, Fragment as V, createVNode as r, unref as o, withCtx as l, createTextVNode as s, createElementVNode as U, createBlock as f, createCommentVNode as v } from "vue";
2
- import { useLoadingState as O, ScalarButton as S } from "@scalar/components";
3
- import { pkceOptions as P } from "@scalar/oas-utils/entities/spec";
4
- import { useToasts as R } from "@scalar/use-toasts";
5
- import F from "./OAuthScopesInput.vue.js";
1
+ import { defineComponent as P, computed as C, ref as R, watch as I, createElementBlock as p, openBlock as m, Fragment as V, createVNode as r, unref as o, withCtx as l, createTextVNode as d, createElementVNode as S, createBlock as f, createCommentVNode as v } from "vue";
2
+ import { useLoadingState as L, ScalarButton as k } from "@scalar/components";
3
+ import { pkceOptions as F } from "@scalar/oas-utils/entities/spec";
4
+ import { useToasts as A } from "@scalar/use-toasts";
5
+ import N from "./OAuthScopesInput.vue.js";
6
6
  /* empty css */
7
- import { authorizeOauth2 as A } from "../helpers/oauth.js";
8
- import i from "./RequestAuthDataTableInput.vue.js";
7
+ import { authorizeOauth2 as h } from "../helpers/oauth.js";
8
+ import c from "./RequestAuthDataTableInput.vue.js";
9
9
  import u from "../../../../components/DataTable/DataTableRow.vue.js";
10
- const I = { class: "flex h-8 items-center justify-end gap-2 border-t" }, N = { class: "flex h-8 w-full items-center justify-end border-t" }, Y = /* @__PURE__ */ b({
10
+ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { class: "flex h-8 w-full items-center justify-end border-t" }, q = /* @__PURE__ */ P({
11
11
  __name: "OAuth2",
12
12
  props: {
13
13
  environment: {},
14
14
  flows: {},
15
15
  type: {},
16
16
  selectedScopes: {},
17
+ scheme: {},
17
18
  server: {},
18
19
  proxyUrl: {},
19
20
  name: {},
@@ -21,60 +22,66 @@ const I = { class: "flex h-8 items-center justify-end gap-2 border-t" }, N = { c
21
22
  },
22
23
  emits: ["update:selectedScopes"],
23
24
  setup(t, { emit: g }) {
24
- const C = g, p = O(), { toast: T } = R(), a = w(() => t.flows[t.type]), k = w(
25
- () => t.selectedScopes.filter((d) => d in (a.value.scopes ?? {}))
26
- ), y = (d) => t.eventBus.emit("auth:update:security-scheme", {
25
+ const z = g, y = L(), { toast: B } = A(), a = C(() => t.flows[t.type]), U = C(
26
+ () => t.selectedScopes.filter((s) => s in (a.value.scopes ?? {}))
27
+ ), x = (s) => {
28
+ if (t.scheme.type === "openIdConnect")
29
+ return i(s);
30
+ t.eventBus.emit("auth:update:security-scheme", {
31
+ payload: {
32
+ type: t.scheme.type,
33
+ flows: {
34
+ [t.type]: s
35
+ }
36
+ },
37
+ name: t.name
38
+ });
39
+ }, i = (s) => t.eventBus.emit("auth:update:security-scheme-secrets", {
27
40
  payload: {
28
- type: "oauth2",
29
- flows: {
30
- [t.type]: d
31
- }
41
+ type: t.scheme.type,
42
+ [t.type]: s
32
43
  },
33
44
  name: t.name
34
- }), m = (d) => t.eventBus.emit("auth:update:security-scheme-secrets", {
35
- payload: {
36
- type: "oauth2",
37
- [t.type]: d
38
- },
45
+ }), T = () => t.eventBus.emit("auth:clear:security-scheme-secrets", {
39
46
  name: t.name
40
- });
41
- L(
47
+ }), w = R(!1);
48
+ I(
42
49
  () => a.value["x-scalar-secret-redirect-uri"],
43
- (d) => {
44
- d || typeof window > "u" || !("x-scalar-secret-redirect-uri" in a.value) || m({
45
- "x-scalar-secret-redirect-uri": window.location.origin + window.location.pathname
46
- });
50
+ (s) => {
51
+ w.value || s || typeof window > "u" || !("x-scalar-secret-redirect-uri" in a.value) || (w.value = !0, i({
52
+ "x-scalar-secret-redirect-uri": window.location.origin
53
+ }));
47
54
  },
48
55
  { immediate: !0 }
49
56
  );
50
- const z = async () => {
51
- if (p.isLoading)
57
+ const b = async () => {
58
+ if (y.isLoading)
52
59
  return;
53
- p.start();
54
- const [d, e] = await A(
60
+ y.start();
61
+ const [s, e] = await h(
55
62
  t.flows,
56
63
  t.type,
57
- k.value,
64
+ U.value,
58
65
  t.server,
59
66
  t.proxyUrl
60
67
  );
61
- await p.clear(), e ? m({ "x-scalar-secret-token": e }) : (console.error(d), T(d?.message ?? "Failed to authorize", "error"));
62
- }, B = (d) => y({
63
- "x-scalar-credentials-location": d === "body" ? "body" : "header"
68
+ await y.clear(), e ? i({ "x-scalar-secret-token": e }) : (console.error(s), B(s?.message ?? "Failed to authorize", "error"));
69
+ }, O = (s) => x({
70
+ "x-scalar-credentials-location": s === "body" ? "body" : "header"
64
71
  });
65
- return (d, e) => a.value["x-scalar-secret-token"] ? (c(), x(V, { key: 0 }, [
72
+ return (s, e) => a.value["x-scalar-secret-token"] ? (m(), p(V, { key: 0 }, [
66
73
  r(o(u), null, {
67
74
  default: l(() => [
68
- r(i, {
75
+ r(c, {
69
76
  class: "border-r-transparent",
70
77
  environment: t.environment,
71
78
  modelValue: a.value["x-scalar-secret-token"],
72
79
  placeholder: "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT",
73
80
  type: "password",
74
- "onUpdate:modelValue": e[0] || (e[0] = (n) => m({ "x-scalar-secret-token": n }))
81
+ "onUpdate:modelValue": e[0] || (e[0] = (n) => i({ "x-scalar-secret-token": n }))
75
82
  }, {
76
83
  default: l(() => [...e[12] || (e[12] = [
77
- s(" Access Token ", -1)
84
+ d(" Access Token ", -1)
78
85
  ])]),
79
86
  _: 1
80
87
  }, 8, ["environment", "modelValue"])
@@ -83,16 +90,16 @@ const I = { class: "flex h-8 items-center justify-end gap-2 border-t" }, N = { c
83
90
  }),
84
91
  r(o(u), { class: "min-w-full" }, {
85
92
  default: l(() => [
86
- U("div", I, [
87
- r(o(S), {
93
+ S("div", j, [
94
+ r(o(k), {
88
95
  class: "mr-1 p-0 px-2 py-0.5",
89
- loader: o(p),
96
+ loader: o(y),
90
97
  size: "sm",
91
98
  variant: "outlined",
92
- onClick: e[1] || (e[1] = () => m({ "x-scalar-secret-token": "" }))
99
+ onClick: e[1] || (e[1] = () => i({ "x-scalar-secret-token": "" }))
93
100
  }, {
94
101
  default: l(() => [...e[13] || (e[13] = [
95
- s(" Clear ", -1)
102
+ d(" Clear ", -1)
96
103
  ])]),
97
104
  _: 1
98
105
  }, 8, ["loader"])
@@ -100,65 +107,65 @@ const I = { class: "flex h-8 items-center justify-end gap-2 border-t" }, N = { c
100
107
  ]),
101
108
  _: 1
102
109
  })
103
- ], 64)) : (c(), x(V, { key: 1 }, [
110
+ ], 64)) : (m(), p(V, { key: 1 }, [
104
111
  r(o(u), null, {
105
112
  default: l(() => [
106
- "authorizationUrl" in a.value ? (c(), f(i, {
113
+ "authorizationUrl" in a.value ? (m(), f(c, {
107
114
  key: 0,
108
115
  containerClass: "border-r-0",
109
116
  environment: t.environment,
110
117
  modelValue: a.value.authorizationUrl,
111
118
  placeholder: "https://galaxy.scalar.com/authorize",
112
- "onUpdate:modelValue": e[2] || (e[2] = (n) => y({ authorizationUrl: n }))
119
+ "onUpdate:modelValue": e[2] || (e[2] = (n) => x({ authorizationUrl: n }))
113
120
  }, {
114
121
  default: l(() => [...e[14] || (e[14] = [
115
- s(" Auth URL ", -1)
122
+ d(" Auth URL ", -1)
116
123
  ])]),
117
124
  _: 1
118
125
  }, 8, ["environment", "modelValue"])) : v("", !0),
119
- "tokenUrl" in a.value ? (c(), f(i, {
126
+ "tokenUrl" in a.value ? (m(), f(c, {
120
127
  key: 1,
121
128
  environment: t.environment,
122
129
  modelValue: a.value.tokenUrl,
123
130
  placeholder: "https://galaxy.scalar.com/token",
124
- "onUpdate:modelValue": e[3] || (e[3] = (n) => y({ tokenUrl: n }))
131
+ "onUpdate:modelValue": e[3] || (e[3] = (n) => x({ tokenUrl: n }))
125
132
  }, {
126
133
  default: l(() => [...e[15] || (e[15] = [
127
- s(" Token URL ", -1)
134
+ d(" Token URL ", -1)
128
135
  ])]),
129
136
  _: 1
130
137
  }, 8, ["environment", "modelValue"])) : v("", !0)
131
138
  ]),
132
139
  _: 1
133
140
  }),
134
- "x-scalar-secret-redirect-uri" in a.value ? (c(), f(o(u), { key: 0 }, {
141
+ "x-scalar-secret-redirect-uri" in a.value ? (m(), f(o(u), { key: 0 }, {
135
142
  default: l(() => [
136
- r(i, {
143
+ r(c, {
137
144
  environment: t.environment,
138
145
  modelValue: a.value["x-scalar-secret-redirect-uri"],
139
146
  placeholder: "https://galaxy.scalar.com/callback",
140
- "onUpdate:modelValue": e[4] || (e[4] = (n) => m({ "x-scalar-secret-redirect-uri": n }))
147
+ "onUpdate:modelValue": e[4] || (e[4] = (n) => i({ "x-scalar-secret-redirect-uri": n }))
141
148
  }, {
142
149
  default: l(() => [...e[16] || (e[16] = [
143
- s(" Redirect URL ", -1)
150
+ d(" Redirect URL ", -1)
144
151
  ])]),
145
152
  _: 1
146
153
  }, 8, ["environment", "modelValue"])
147
154
  ]),
148
155
  _: 1
149
156
  })) : v("", !0),
150
- "x-scalar-secret-username" in a.value && "x-scalar-secret-password" in a.value ? (c(), x(V, { key: 1 }, [
157
+ "x-scalar-secret-username" in a.value && "x-scalar-secret-password" in a.value ? (m(), p(V, { key: 1 }, [
151
158
  r(o(u), null, {
152
159
  default: l(() => [
153
- r(i, {
160
+ r(c, {
154
161
  class: "text-c-2",
155
162
  environment: t.environment,
156
163
  modelValue: a.value["x-scalar-secret-username"],
157
164
  placeholder: "janedoe",
158
- "onUpdate:modelValue": e[5] || (e[5] = (n) => m({ "x-scalar-secret-username": n }))
165
+ "onUpdate:modelValue": e[5] || (e[5] = (n) => i({ "x-scalar-secret-username": n }))
159
166
  }, {
160
167
  default: l(() => [...e[17] || (e[17] = [
161
- s(" Username ", -1)
168
+ d(" Username ", -1)
162
169
  ])]),
163
170
  _: 1
164
171
  }, 8, ["environment", "modelValue"])
@@ -167,15 +174,15 @@ const I = { class: "flex h-8 items-center justify-end gap-2 border-t" }, N = { c
167
174
  }),
168
175
  r(o(u), null, {
169
176
  default: l(() => [
170
- r(i, {
177
+ r(c, {
171
178
  environment: t.environment,
172
179
  modelValue: a.value["x-scalar-secret-password"],
173
180
  placeholder: "********",
174
181
  type: "password",
175
- "onUpdate:modelValue": e[6] || (e[6] = (n) => m({ "x-scalar-secret-password": n }))
182
+ "onUpdate:modelValue": e[6] || (e[6] = (n) => i({ "x-scalar-secret-password": n }))
176
183
  }, {
177
184
  default: l(() => [...e[18] || (e[18] = [
178
- s(" Password ", -1)
185
+ d(" Password ", -1)
179
186
  ])]),
180
187
  _: 1
181
188
  }, 8, ["environment", "modelValue"])
@@ -185,68 +192,68 @@ const I = { class: "flex h-8 items-center justify-end gap-2 border-t" }, N = { c
185
192
  ], 64)) : v("", !0),
186
193
  r(o(u), null, {
187
194
  default: l(() => [
188
- r(i, {
195
+ r(c, {
189
196
  environment: t.environment,
190
197
  modelValue: a.value["x-scalar-secret-client-id"],
191
198
  placeholder: "12345",
192
- "onUpdate:modelValue": e[7] || (e[7] = (n) => m({ "x-scalar-secret-client-id": n }))
199
+ "onUpdate:modelValue": e[7] || (e[7] = (n) => i({ "x-scalar-secret-client-id": n }))
193
200
  }, {
194
201
  default: l(() => [...e[19] || (e[19] = [
195
- s(" Client ID ", -1)
202
+ d(" Client ID ", -1)
196
203
  ])]),
197
204
  _: 1
198
205
  }, 8, ["environment", "modelValue"])
199
206
  ]),
200
207
  _: 1
201
208
  }),
202
- "x-scalar-secret-client-secret" in a.value ? (c(), f(o(u), { key: 2 }, {
209
+ "x-scalar-secret-client-secret" in a.value ? (m(), f(o(u), { key: 2 }, {
203
210
  default: l(() => [
204
- r(i, {
211
+ r(c, {
205
212
  environment: t.environment,
206
213
  modelValue: a.value["x-scalar-secret-client-secret"],
207
214
  placeholder: "XYZ123",
208
215
  type: "password",
209
- "onUpdate:modelValue": e[8] || (e[8] = (n) => m({ "x-scalar-secret-client-secret": n }))
216
+ "onUpdate:modelValue": e[8] || (e[8] = (n) => i({ "x-scalar-secret-client-secret": n }))
210
217
  }, {
211
218
  default: l(() => [...e[20] || (e[20] = [
212
- s(" Client Secret ", -1)
219
+ d(" Client Secret ", -1)
213
220
  ])]),
214
221
  _: 1
215
222
  }, 8, ["environment", "modelValue"])
216
223
  ]),
217
224
  _: 1
218
225
  })) : v("", !0),
219
- "x-usePkce" in a.value ? (c(), f(o(u), { key: 3 }, {
226
+ "x-usePkce" in a.value ? (m(), f(o(u), { key: 3 }, {
220
227
  default: l(() => [
221
- r(i, {
222
- enum: o(P),
228
+ r(c, {
229
+ enum: o(F),
223
230
  environment: t.environment,
224
231
  modelValue: a.value["x-usePkce"],
225
232
  readOnly: "",
226
- "onUpdate:modelValue": e[9] || (e[9] = (n) => y({
233
+ "onUpdate:modelValue": e[9] || (e[9] = (n) => x({
227
234
  "x-usePkce": n
228
235
  }))
229
236
  }, {
230
237
  default: l(() => [...e[21] || (e[21] = [
231
- s(" Use PKCE ", -1)
238
+ d(" Use PKCE ", -1)
232
239
  ])]),
233
240
  _: 1
234
241
  }, 8, ["enum", "environment", "modelValue"])
235
242
  ]),
236
243
  _: 1
237
244
  })) : v("", !0),
238
- t.type !== "implicit" ? (c(), f(o(u), { key: 4 }, {
245
+ t.type !== "implicit" ? (m(), f(o(u), { key: 4 }, {
239
246
  default: l(() => [
240
- r(i, {
247
+ r(c, {
241
248
  enum: ["header", "body"],
242
249
  environment: t.environment,
243
250
  modelValue: a.value["x-scalar-credentials-location"] || "header",
244
251
  placeholder: "header",
245
252
  readOnly: "",
246
- "onUpdate:modelValue": e[10] || (e[10] = (n) => B(n))
253
+ "onUpdate:modelValue": e[10] || (e[10] = (n) => O(n))
247
254
  }, {
248
255
  default: l(() => [...e[22] || (e[22] = [
249
- s(" Credentials Location ", -1)
256
+ d(" Credentials Location ", -1)
250
257
  ])]),
251
258
  _: 1
252
259
  }, 8, ["environment", "modelValue"])
@@ -255,27 +262,40 @@ const I = { class: "flex h-8 items-center justify-end gap-2 border-t" }, N = { c
255
262
  })) : v("", !0),
256
263
  r(o(u), null, {
257
264
  default: l(() => [
258
- r(F, {
265
+ r(N, {
259
266
  flow: a.value,
260
267
  flowType: t.type,
261
- selectedScopes: k.value,
262
- "onUpdate:selectedScopes": e[11] || (e[11] = (n) => C("update:selectedScopes", n))
268
+ selectedScopes: U.value,
269
+ "onUpdate:selectedScopes": e[11] || (e[11] = (n) => z("update:selectedScopes", n))
263
270
  }, null, 8, ["flow", "flowType", "selectedScopes"])
264
271
  ]),
265
272
  _: 1
266
273
  }),
267
274
  r(o(u), { class: "min-w-full" }, {
268
275
  default: l(() => [
269
- U("div", N, [
270
- r(o(S), {
271
- class: "mr-0.75 p-0 px-2 py-0.5",
272
- loader: o(p),
276
+ S("div", E, [
277
+ t.scheme.type === "openIdConnect" ? (m(), f(o(k), {
278
+ key: 0,
279
+ class: "mr-1 p-0 px-2 py-0.5",
280
+ loader: o(y),
273
281
  size: "sm",
274
282
  variant: "outlined",
275
- onClick: z
283
+ onClick: T
276
284
  }, {
277
285
  default: l(() => [...e[23] || (e[23] = [
278
- s(" Authorize ", -1)
286
+ d(" Clear ", -1)
287
+ ])]),
288
+ _: 1
289
+ }, 8, ["loader"])) : v("", !0),
290
+ r(o(k), {
291
+ class: "mr-0.75 p-0 px-2 py-0.5",
292
+ loader: o(y),
293
+ size: "sm",
294
+ variant: "outlined",
295
+ onClick: b
296
+ }, {
297
+ default: l(() => [...e[24] || (e[24] = [
298
+ d(" Authorize ", -1)
279
299
  ])]),
280
300
  _: 1
281
301
  }, 8, ["loader"])
@@ -287,5 +307,5 @@ const I = { class: "flex h-8 items-center justify-end gap-2 border-t" }, N = { c
287
307
  }
288
308
  });
289
309
  export {
290
- Y as default
310
+ q as default
291
311
  };
@@ -0,0 +1,21 @@
1
+ import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
2
+ import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
3
+ import { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
4
+ type __VLS_Props = {
5
+ /** Current environment configuration */
6
+ environment: XScalarEnvironment;
7
+ /** Event bus for authentication updates */
8
+ eventBus: WorkspaceEventBus;
9
+ /** Get the static border class */
10
+ getStaticBorderClass: () => string | false;
11
+ /** Name of the security scheme */
12
+ name: string;
13
+ /** Proxy URL */
14
+ proxyUrl: string;
15
+ /** OpenID Connect scheme */
16
+ scheme: OpenIdConnectObject;
17
+ };
18
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
21
+ //# sourceMappingURL=OpenIDConnect.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenIDConnect.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"names":[],"mappings":"AA4GA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,8DAA8D,CAAA;AAQvG,KAAK,WAAW,GAAG;IACf,wCAAwC;IACxC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,2CAA2C;IAC3C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,kCAAkC;IAClC,oBAAoB,EAAE,MAAM,MAAM,GAAG,KAAK,CAAA;IAC1C,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,4BAA4B;IAC5B,MAAM,EAAE,mBAAmB,CAAA;CAC5B,CAAC;AA0KJ,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}