@scalar/api-client 2.2.7 → 2.2.9

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 (149) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
  3. package/dist/components/CodeInput/CodeInput.vue.js +2 -2
  4. package/dist/components/CodeInput/CodeInput.vue2.js +65 -65
  5. package/dist/components/CodeInput/codeVariableWidget.d.ts +6 -4
  6. package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -1
  7. package/dist/components/CodeInput/codeVariableWidget.js +72 -68
  8. package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
  9. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +108 -106
  10. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +1 -1
  11. package/dist/components/CommandPalette/TheCommandPalette.vue.js +2 -2
  12. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +12 -12
  13. package/dist/components/DataTable/DataTable.vue.d.ts.map +1 -1
  14. package/dist/components/DataTable/DataTable.vue.js +20 -15
  15. package/dist/components/DataTable/DataTableCell.vue.d.ts.map +1 -1
  16. package/dist/components/DataTable/DataTableCell.vue.js +16 -11
  17. package/dist/components/DataTable/DataTableHeader.vue.d.ts.map +1 -1
  18. package/dist/components/DataTable/DataTableHeader.vue.js +11 -12
  19. package/dist/components/DataTable/DataTableInput.vue.d.ts +2 -1
  20. package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
  21. package/dist/components/DataTable/DataTableInput.vue.js +3 -3
  22. package/dist/components/DataTable/DataTableInput.vue2.js +9 -9
  23. package/dist/components/DataTable/index.js +14 -14
  24. package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.d.ts.map +1 -1
  25. package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +87 -67
  26. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
  27. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +2 -2
  28. package/dist/components/Sidebar/SidebarList.vue.d.ts.map +1 -1
  29. package/dist/components/Sidebar/SidebarList.vue.js +4 -4
  30. package/dist/components/Sidebar/SidebarListElement.vue.d.ts +8 -4
  31. package/dist/components/Sidebar/SidebarListElement.vue.d.ts.map +1 -1
  32. package/dist/components/Sidebar/SidebarListElement.vue.js +1 -1
  33. package/dist/components/Sidebar/SidebarListElement.vue2.js +52 -32
  34. package/dist/components/Sidebar/SidebarListElementActions.vue.d.ts +3 -0
  35. package/dist/components/Sidebar/SidebarListElementActions.vue.d.ts.map +1 -1
  36. package/dist/components/Sidebar/SidebarListElementActions.vue.js +43 -31
  37. package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
  38. package/dist/components/TopNav/TopNav.vue.js +32 -31
  39. package/dist/layouts/App/create-api-client-app.d.ts +49 -42
  40. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  41. package/dist/layouts/Modal/create-api-client-modal.d.ts +103 -89
  42. package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
  43. package/dist/layouts/Modal/create-api-client-modal.js +31 -19
  44. package/dist/layouts/Web/create-api-client-web.d.ts +49 -42
  45. package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
  46. package/dist/libs/create-client.d.ts +50 -44
  47. package/dist/libs/create-client.d.ts.map +1 -1
  48. package/dist/libs/env-helpers.d.ts +9 -0
  49. package/dist/libs/env-helpers.d.ts.map +1 -0
  50. package/dist/libs/env-helpers.js +4 -0
  51. package/dist/libs/environment-parser.d.ts +3 -4
  52. package/dist/libs/environment-parser.d.ts.map +1 -1
  53. package/dist/libs/environment-parser.js +5 -4
  54. package/dist/libs/index.d.ts +2 -0
  55. package/dist/libs/index.d.ts.map +1 -1
  56. package/dist/libs/index.js +28 -22
  57. package/dist/libs/postman.d.ts +11 -0
  58. package/dist/libs/postman.d.ts.map +1 -0
  59. package/dist/libs/postman.js +39 -0
  60. package/dist/libs/send-request/send-request.d.ts +5 -2
  61. package/dist/libs/send-request/send-request.d.ts.map +1 -1
  62. package/dist/libs/send-request/send-request.js +106 -104
  63. package/dist/routes.d.ts +11 -0
  64. package/dist/routes.d.ts.map +1 -1
  65. package/dist/routes.js +13 -7
  66. package/dist/store/active-entities.d.ts +18 -11
  67. package/dist/store/active-entities.d.ts.map +1 -1
  68. package/dist/store/active-entities.js +108 -69
  69. package/dist/store/collections.d.ts +17 -15
  70. package/dist/store/collections.d.ts.map +1 -1
  71. package/dist/store/collections.js +62 -41
  72. package/dist/store/environment.d.ts +4 -4
  73. package/dist/store/import-spec.d.ts +2 -2
  74. package/dist/store/import-spec.d.ts.map +1 -1
  75. package/dist/store/index.d.ts +1 -0
  76. package/dist/store/index.d.ts.map +1 -1
  77. package/dist/store/index.js +7 -3
  78. package/dist/store/requests.d.ts +4 -4
  79. package/dist/store/router-params.d.ts +1 -1
  80. package/dist/store/router-params.d.ts.map +1 -1
  81. package/dist/store/router-params.js +7 -7
  82. package/dist/store/store.d.ts +49 -42
  83. package/dist/store/store.d.ts.map +1 -1
  84. package/dist/store/store.js +76 -72
  85. package/dist/store/workspace.d.ts +12 -12
  86. package/dist/store/workspace.d.ts.map +1 -1
  87. package/dist/style.css +1 -1
  88. package/dist/types/index.d.ts +2 -0
  89. package/dist/types/index.d.ts.map +1 -0
  90. package/dist/types/index.js +1 -0
  91. package/dist/types/vue.d.ts +10 -0
  92. package/dist/types/vue.d.ts.map +1 -0
  93. package/dist/views/Cookies/Cookies.vue.d.ts.map +1 -1
  94. package/dist/views/Cookies/Cookies.vue2.js +75 -70
  95. package/dist/views/Environment/Environment.vue.d.ts.map +1 -1
  96. package/dist/views/Environment/Environment.vue2.js +308 -152
  97. package/dist/views/Environment/EnvironmentColorModal.vue.d.ts.map +1 -1
  98. package/dist/views/Environment/EnvironmentColorModal.vue.js +20 -18
  99. package/dist/views/Environment/EnvironmentColors.vue.d.ts +4 -1
  100. package/dist/views/Environment/EnvironmentColors.vue.d.ts.map +1 -1
  101. package/dist/views/Environment/EnvironmentColors.vue.js +83 -58
  102. package/dist/views/Environment/EnvironmentModal.vue.d.ts +7 -0
  103. package/dist/views/Environment/EnvironmentModal.vue.d.ts.map +1 -1
  104. package/dist/views/Environment/EnvironmentModal.vue.js +119 -37
  105. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts +4 -5
  106. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
  107. package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +73 -63
  108. package/dist/views/Request/Request.vue.d.ts.map +1 -1
  109. package/dist/views/Request/Request.vue.js +2 -2
  110. package/dist/views/Request/Request.vue2.js +60 -61
  111. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts +1 -0
  112. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
  113. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +185 -187
  114. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts +1 -0
  115. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts.map +1 -1
  116. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.js +27 -24
  117. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
  118. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +1 -1
  119. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +35 -187
  120. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts +7 -0
  121. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts.map +1 -0
  122. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.js +7 -0
  123. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue2.js +207 -0
  124. package/dist/views/Request/RequestSection/{RequestAuthDataTableInput.vue.d.ts → RequestAuth/RequestAuthDataTableInput.vue.d.ts} +2 -2
  125. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTableInput.vue.d.ts.map +1 -0
  126. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTableInput.vue.js +43 -0
  127. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.d.ts +1 -0
  128. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.d.ts.map +1 -1
  129. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.js +5 -134
  130. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue2.js +176 -2
  131. package/dist/views/Request/RequestSection/RequestAuth/index.d.ts +2 -0
  132. package/dist/views/Request/RequestSection/RequestAuth/index.d.ts.map +1 -0
  133. package/dist/views/Request/RequestSection/RequestAuth/index.js +4 -0
  134. package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
  135. package/dist/views/Request/RequestSidebar.vue.js +3 -3
  136. package/dist/views/Request/RequestSidebar.vue2.js +139 -117
  137. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  138. package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
  139. package/dist/views/Request/RequestSidebarItem.vue2.js +32 -38
  140. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  141. package/dist/views/Request/libs/auth.d.ts.map +1 -1
  142. package/dist/views/Request/libs/auth.js +3 -3
  143. package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
  144. package/dist/views/Servers/Servers.vue.d.ts.map +1 -1
  145. package/dist/views/Servers/Servers.vue2.js +9 -8
  146. package/package.json +19 -8
  147. package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.d.ts.map +0 -1
  148. package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.js +0 -46
  149. /package/dist/views/Request/RequestSection/{RequestAuthDataTableInput.vue2.js → RequestAuth/RequestAuthDataTableInput.vue2.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { defineComponent as K, ref as R, computed as B, watch as P, onMounted as X, onBeforeUnmount as Y, openBlock as b, createElementBlock as Z, Fragment as _, createElementVNode as ee, normalizeClass as N, unref as s, createVNode as d, withCtx as O, createBlock as g, createCommentVNode as I } from "vue";
1
+ import { defineComponent as K, ref as y, computed as N, watch as P, onMounted as X, onBeforeUnmount as Y, openBlock as h, createElementBlock as Z, Fragment as _, createElementVNode as ee, normalizeClass as O, unref as s, createVNode as d, withCtx as g, createBlock as I, createCommentVNode as T } from "vue";
2
2
  import te from "../../components/ImportCurl/ImportCurlModal.vue.js";
3
3
  import oe from "../../components/ViewLayout/ViewLayout.vue.js";
4
4
  import re from "../../components/ViewLayout/ViewLayoutContent.vue.js";
@@ -20,48 +20,47 @@ const He = /* @__PURE__ */ K({
20
20
  __name: "Request",
21
21
  emits: ["newTab"],
22
22
  setup(Re) {
23
- const T = ye(), { toast: w } = de(), {
23
+ const M = ye(), { toast: w } = de(), {
24
24
  activeCollection: x,
25
25
  activeExample: v,
26
- activeEnvironment: M,
27
- activeRequest: q,
26
+ activeEnvironment: U,
27
+ activeRequest: R,
28
28
  activeWorkspace: a,
29
29
  activeServer: A
30
30
  } = ue(), {
31
31
  cookies: H,
32
32
  isReadOnly: l,
33
33
  modalState: n,
34
- requestHistory: U,
34
+ requestHistory: k,
35
35
  securitySchemes: L,
36
36
  requestMutators: $,
37
- serverMutators: W,
38
- servers: j,
37
+ serverMutators: j,
38
+ servers: W,
39
39
  events: p
40
- } = T, u = R(!l), k = R(), e = R(), h = R(""), z = ve(), D = B(
41
- () => U.findLast((o) => {
42
- var t;
43
- return o.request.uid === ((t = v.value) == null ? void 0 : t.uid);
40
+ } = M, u = y(!l), E = y(), t = y(), q = y(""), z = ve(), D = N(
41
+ () => k.findLast((o) => {
42
+ var e;
43
+ return o.request.uid === ((e = v.value) == null ? void 0 : e.uid);
44
44
  })
45
45
  ), { mediaQueries: F } = ce();
46
46
  P(F.md, (o) => u.value = o);
47
- const E = B(
47
+ const V = N(
48
48
  () => {
49
- var o, t;
50
- return (l ? (o = x.value) == null ? void 0 : o.selectedSecuritySchemeUids : (t = q.value) == null ? void 0 : t.selectedSecuritySchemeUids) ?? [];
49
+ var o, e;
50
+ return (l ? (o = x.value) == null ? void 0 : o.selectedSecuritySchemeUids : (e = R.value) == null ? void 0 : e.selectedSecuritySchemeUids) ?? [];
51
51
  }
52
52
  ), C = async () => {
53
- var S;
54
- if (!q.value || !v.value || !x.value)
53
+ if (!R.value || !v.value || !x.value)
55
54
  return;
56
- const o = me.parse(((S = M.value) == null ? void 0 : S.value) || "{}");
57
- o.error && console.error("INVALID ENVIRONMENT!");
58
- const t = o.error || typeof o.data != "object" ? {} : o.data ?? {}, r = a.value.cookies.map((y) => H[y]), [i, m] = fe({
59
- request: q.value,
55
+ const o = typeof U.value == "object" ? U.value.value : "{}", e = me.parse(o);
56
+ e.error && console.error("INVALID ENVIRONMENT!");
57
+ const r = e.error || typeof e.data != "object" ? {} : e.data ?? {}, f = a.value.cookies.map((S) => H[S]), [i, m] = fe({
58
+ request: R.value,
60
59
  example: v.value,
61
- selectedSecuritySchemeUids: E.value,
60
+ selectedSecuritySchemeUids: V.value,
62
61
  proxyUrl: a.value.proxyUrl ?? "",
63
- environment: t,
64
- globalCookies: r,
62
+ environment: r,
63
+ globalCookies: f,
65
64
  status: p.requestStatus,
66
65
  securitySchemes: L,
67
66
  server: A.value
@@ -70,96 +69,96 @@ const He = /* @__PURE__ */ K({
70
69
  w(i.message, "error");
71
70
  return;
72
71
  }
73
- k.value = m.controller;
74
- const [c, f] = await m.sendRequest();
75
- c ? w(c.message, "error") : U.push(f);
72
+ E.value = m.controller;
73
+ const [c, b] = await m.sendRequest();
74
+ c ? w(c.message, "error") : k.push(b);
76
75
  }, Q = async () => {
77
76
  var o;
78
- return (o = k.value) == null ? void 0 : o.abort(Se.REQUEST_ABORTED);
77
+ return (o = E.value) == null ? void 0 : o.abort(Se.REQUEST_ABORTED);
79
78
  };
80
79
  X(() => {
81
80
  p.executeRequest.on(C), p.cancelRequest.on(Q);
82
81
  }), ie(), Y(() => p.executeRequest.off(C));
83
82
  function J({ requestName: o }) {
84
- var r, i, m, c;
85
- if (!e.value) return;
86
- if (e.value.servers) {
87
- const f = Object.values(j).find(
88
- (S) => {
89
- var y, V;
90
- return S.url === ((V = (y = e == null ? void 0 : e.value) == null ? void 0 : y.servers) == null ? void 0 : V[0]);
83
+ var r, f, i, m;
84
+ if (!t.value) return;
85
+ if (t.value.servers) {
86
+ const c = Object.values(W).find(
87
+ (b) => {
88
+ var S, B;
89
+ return b.url === ((B = (S = t == null ? void 0 : t.value) == null ? void 0 : S.servers) == null ? void 0 : B[0]);
91
90
  }
92
91
  );
93
- f ? h.value = f.uid : h.value = W.add(
94
- { url: e.value.servers[0] },
92
+ c ? q.value = c.uid : q.value = j.add(
93
+ { url: t.value.servers[0] },
95
94
  a.value.collections[0]
96
95
  ).uid;
97
96
  }
98
- const t = $.add(
97
+ const e = $.add(
99
98
  {
100
99
  summary: o,
101
- path: (r = e == null ? void 0 : e.value) == null ? void 0 : r.path,
102
- method: (i = e == null ? void 0 : e.value) == null ? void 0 : i.method,
103
- parameters: (m = e == null ? void 0 : e.value) == null ? void 0 : m.parameters,
104
- selectedServerUid: h.value,
105
- requestBody: (c = e == null ? void 0 : e.value) == null ? void 0 : c.requestBody
100
+ path: (r = t == null ? void 0 : t.value) == null ? void 0 : r.path,
101
+ method: (f = t == null ? void 0 : t.value) == null ? void 0 : f.method,
102
+ parameters: (i = t == null ? void 0 : t.value) == null ? void 0 : i.parameters,
103
+ selectedServerUid: q.value,
104
+ requestBody: (m = t == null ? void 0 : t.value) == null ? void 0 : m.requestBody
106
105
  },
107
106
  a.value.collections[0]
108
107
  );
109
- t && z.push(
110
- `/workspace/${a.value.uid}/request/${t.uid}`
108
+ e && z.push(
109
+ `/workspace/${a.value.uid}/request/${e.uid}`
111
110
  ), n.hide();
112
111
  }
113
112
  function G(o) {
114
- e.value = se(o), n.show();
113
+ t.value = se(o), n.show();
115
114
  }
116
- return (o, t) => (b(), Z(_, null, [
115
+ return (o, e) => (h(), Z(_, null, [
117
116
  ee("div", {
118
- class: N(["flex flex-1 flex-col pt-0 h-full bg-b-1 relative z-0 overflow-hidden", {
117
+ class: O(["flex flex-1 flex-col pt-0 h-full bg-b-1 relative z-0 overflow-hidden", {
119
118
  "!mr-0 !mb-0 !border-0": s(l)
120
119
  }])
121
120
  }, [
122
121
  d(le, {
123
122
  modelValue: u.value,
124
- "onUpdate:modelValue": t[0] || (t[0] = (r) => u.value = r),
123
+ "onUpdate:modelValue": e[0] || (e[0] = (r) => u.value = r),
125
124
  isReadonly: s(l),
126
- onHideModal: t[1] || (t[1] = () => s(n).hide()),
125
+ onHideModal: e[1] || (e[1] = () => s(n).hide()),
127
126
  onImportCurl: G
128
127
  }, null, 8, ["modelValue", "isReadonly"]),
129
128
  d(oe, null, {
130
- default: O(() => [
129
+ default: g(() => [
131
130
  d(pe, {
132
131
  isReadonly: s(l),
133
132
  showSidebar: u.value,
134
- onNewTab: t[2] || (t[2] = (r) => o.$emit("newTab", r)),
135
- "onUpdate:showSidebar": t[3] || (t[3] = (r) => u.value = r)
133
+ onNewTab: e[2] || (e[2] = (r) => o.$emit("newTab", r)),
134
+ "onUpdate:showSidebar": e[3] || (e[3] = (r) => u.value = r)
136
135
  }, null, 8, ["isReadonly", "showSidebar"]),
137
- s(v) ? (b(), g(re, {
136
+ s(v) ? (h(), I(re, {
138
137
  key: 0,
139
- class: N(["flex-1", [u.value ? "sidebar-active-hide-layout" : ""]])
138
+ class: O(["flex-1", [u.value ? "sidebar-active-hide-layout" : ""]])
140
139
  }, {
141
- default: O(() => {
140
+ default: g(() => {
142
141
  var r;
143
142
  return [
144
- d(ae, { selectedSecuritySchemeUids: E.value }, null, 8, ["selectedSecuritySchemeUids"]),
143
+ d(ae, { selectedSecuritySchemeUids: V.value }, null, 8, ["selectedSecuritySchemeUids"]),
145
144
  d(ne, {
146
145
  response: (r = D.value) == null ? void 0 : r.response
147
146
  }, null, 8, ["response"])
148
147
  ];
149
148
  }),
150
149
  _: 1
151
- }, 8, ["class"])) : I("", !0)
150
+ }, 8, ["class"])) : T("", !0)
152
151
  ]),
153
152
  _: 1
154
153
  })
155
154
  ], 2),
156
- e.value ? (b(), g(te, {
155
+ t.value ? (h(), I(te, {
157
156
  key: 0,
158
- parsedCurl: e.value,
157
+ parsedCurl: t.value,
159
158
  state: s(n),
160
- onClose: t[4] || (t[4] = (r) => s(n).hide()),
159
+ onClose: e[4] || (e[4] = (r) => s(n).hide()),
161
160
  onImportCurl: J
162
- }, null, 8, ["parsedCurl", "state"])) : I("", !0)
161
+ }, null, 8, ["parsedCurl", "state"])) : T("", !0)
163
162
  ], 64));
164
163
  }
165
164
  });
@@ -2,6 +2,7 @@ import { type Oauth2Flow, type SecuritySchemeOauth2 } from '@scalar/oas-utils/en
2
2
  type __VLS_Props = {
3
3
  scheme: SecuritySchemeOauth2;
4
4
  flow: Oauth2Flow;
5
+ layout?: 'client' | 'reference';
5
6
  };
6
7
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
8
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/OAuth2.vue"],"names":[],"mappings":"AAyOA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,oBAAoB,EAE1B,MAAM,iCAAiC,CAAA;AAOxC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,oBAAoB,CAAA;IAC5B,IAAI,EAAE,UAAU,CAAA;CACjB,CAAC;;AAwdF,wBAMG"}
1
+ {"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/OAuth2.vue"],"names":[],"mappings":"AAuOA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,oBAAoB,EAE1B,MAAM,iCAAiC,CAAA;AAQxC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,oBAAoB,CAAA;IAC5B,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAA;CAChC,CAAC;;AA6dF,wBAMG"}
@@ -1,232 +1,230 @@
1
- import { defineComponent as T, openBlock as i, createElementBlock as k, Fragment as y, createVNode as d, unref as a, withCtx as o, createTextVNode as s, createElementVNode as V, createBlock as m, createCommentVNode as f } from "vue";
2
- import { useActiveEntities as P } from "../../../../store/active-entities.js";
3
- import n from "../RequestAuthDataTableInput.vue.js";
4
- import { useLoadingState as A, ScalarButton as U } from "@scalar/components";
5
- import { pkceOptions as B } from "@scalar/oas-utils/entities/spec";
6
- import { useToasts as F } from "@scalar/use-toasts";
7
- import O from "./OAuthScopesInput.vue.js";
8
- import u from "../../../../components/DataTable/DataTableRow.vue.js";
9
- import { authorizeOauth2 as E } from "../../libs/oauth2.js";
10
- import { useWorkspace as I } from "../../../../store/store.js";
11
- const R = { class: "h-8 flex items-center justify-self-end" }, b = { class: "h-8 flex items-center justify-self-end" }, Y = /* @__PURE__ */ T({
1
+ import { defineComponent as T, openBlock as s, createElementBlock as w, Fragment as y, createVNode as a, unref as r, withCtx as o, createTextVNode as d, createElementVNode as V, createBlock as m, createCommentVNode as i } from "vue";
2
+ import { useActiveEntities as L } from "../../../../store/active-entities.js";
3
+ import { useLoadingState as P, ScalarButton as U } from "@scalar/components";
4
+ import { pkceOptions as R } from "@scalar/oas-utils/entities/spec";
5
+ import { useToasts as A } from "@scalar/use-toasts";
6
+ import B from "./OAuthScopesInput.vue.js";
7
+ import f from "./RequestAuthDataTableInput.vue.js";
8
+ import n from "../../../../components/DataTable/DataTableRow.vue.js";
9
+ import { authorizeOauth2 as F } from "../../libs/oauth2.js";
10
+ import { useWorkspace as b } from "../../../../store/store.js";
11
+ const I = { class: "h-8 flex items-center justify-self-end" }, O = { class: "h-8 flex items-center justify-end border-t-1/2 w-full" }, Y = /* @__PURE__ */ T({
12
12
  __name: "OAuth2",
13
13
  props: {
14
14
  scheme: {},
15
- flow: {}
15
+ flow: {},
16
+ layout: { default: "client" }
16
17
  },
17
- setup(w) {
18
- const p = A(), { toast: $ } = F(), { activeCollection: g, activeServer: v, activeWorkspace: S } = P(), { isReadOnly: z, securitySchemeMutators: h } = I(), r = (l, e) => h.edit(w.scheme.uid, l, e), C = async () => {
18
+ setup(k) {
19
+ const p = P(), { toast: g } = A(), { activeCollection: $, activeServer: v, activeWorkspace: S } = L(), { securitySchemeMutators: z } = b(), u = (l, e) => z.edit(k.scheme.uid, l, e), C = async () => {
19
20
  var t;
20
- if (p.isLoading || !((t = g.value) != null && t.uid)) return;
21
+ if (p.isLoading || !((t = $.value) != null && t.uid)) return;
21
22
  p.startLoading();
22
- const [l, e] = await E(
23
- w.flow,
23
+ const [l, e] = await F(
24
+ k.flow,
24
25
  v.value,
25
26
  S.value.proxyUrl
26
27
  ).finally(() => p.stopLoading());
27
- e ? r(`flows.${w.flow.type}.token`, e) : (console.error(l), $((l == null ? void 0 : l.message) ?? "Failed to authorize", "error"));
28
+ e ? u(`flows.${k.flow.type}.token`, e) : (console.error(l), g((l == null ? void 0 : l.message) ?? "Failed to authorize", "error"));
28
29
  };
29
- return (l, e) => l.flow.token ? (i(), k(y, { key: 0 }, [
30
- d(a(u), null, {
31
- default: o(() => [
32
- d(n, {
33
- id: "oauth2-access-token",
34
- class: "border-r-transparent",
35
- modelValue: l.flow.token,
36
- placeholder: "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT",
37
- type: "password",
38
- "onUpdate:modelValue": e[0] || (e[0] = (t) => r(`flows.${l.flow.type}.token`, t))
39
- }, {
40
- default: o(() => e[10] || (e[10] = [
41
- s(" Access Token ")
42
- ])),
43
- _: 1
44
- }, 8, ["modelValue"])
45
- ]),
46
- _: 1
47
- }),
48
- d(a(u), { class: "min-w-full" }, {
49
- default: o(() => [
50
- V("div", R, [
51
- d(a(U), {
52
- class: "p-0 py-0.5 px-2 mr-1",
53
- loading: a(p),
54
- size: "sm",
55
- variant: "outlined",
56
- onClick: e[1] || (e[1] = (t) => r(`flows.${l.flow.type}.token`, ""))
30
+ return (l, e) => (s(), w(y, null, [
31
+ l.flow.token ? (s(), w(y, { key: 0 }, [
32
+ a(r(n), null, {
33
+ default: o(() => [
34
+ a(f, {
35
+ class: "border-r-transparent",
36
+ modelValue: l.flow.token,
37
+ placeholder: "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT",
38
+ type: "password",
39
+ "onUpdate:modelValue": e[0] || (e[0] = (t) => u(`flows.${l.flow.type}.token`, t))
57
40
  }, {
58
- default: o(() => e[11] || (e[11] = [
59
- s(" Clear ")
41
+ default: o(() => e[10] || (e[10] = [
42
+ d(" Access Token ")
60
43
  ])),
61
44
  _: 1
62
- }, 8, ["loading"])
63
- ])
64
- ]),
65
- _: 1
66
- })
67
- ], 64)) : (i(), k(y, { key: 1 }, [
68
- a(z) ? f("", !0) : (i(), m(a(u), { key: 0 }, {
69
- default: o(() => [
70
- "authorizationUrl" in l.flow ? (i(), m(n, {
71
- key: 0,
72
- id: `oauth2-authorization-url-${l.scheme.uid}`,
73
- modelValue: l.flow.authorizationUrl,
74
- placeholder: "https://galaxy.scalar.com/authorize",
75
- "onUpdate:modelValue": e[2] || (e[2] = (t) => r(`flows.${l.flow.type}.authorizationUrl`, t))
76
- }, {
77
- default: o(() => e[12] || (e[12] = [
78
- s(" Auth Url ")
79
- ])),
80
- _: 1
81
- }, 8, ["id", "modelValue"])) : f("", !0),
82
- "tokenUrl" in l.flow ? (i(), m(n, {
83
- key: 1,
84
- id: `oauth2-token-url-${l.scheme.uid}`,
85
- modelValue: l.flow.tokenUrl,
86
- placeholder: "https://galaxy.scalar.com/token",
87
- "onUpdate:modelValue": e[3] || (e[3] = (t) => r(`flows.${l.flow.type}.tokenUrl`, t))
88
- }, {
89
- default: o(() => e[13] || (e[13] = [
90
- s(" Token Url ")
91
- ])),
45
+ }, 8, ["modelValue"])
46
+ ]),
47
+ _: 1
48
+ }),
49
+ a(r(n), { class: "min-w-full" }, {
50
+ default: o(() => [
51
+ V("div", I, [
52
+ a(r(U), {
53
+ class: "p-0 py-0.5 px-2 mr-1",
54
+ loading: r(p),
55
+ size: "sm",
56
+ variant: "outlined",
57
+ onClick: e[1] || (e[1] = (t) => u(`flows.${l.flow.type}.token`, ""))
58
+ }, {
59
+ default: o(() => e[11] || (e[11] = [
60
+ d(" Clear ")
61
+ ])),
62
+ _: 1
63
+ }, 8, ["loading"])
64
+ ])
65
+ ]),
66
+ _: 1
67
+ })
68
+ ], 64)) : (s(), w(y, { key: 1 }, [
69
+ a(r(n), null, {
70
+ default: o(() => [
71
+ "authorizationUrl" in l.flow ? (s(), m(f, {
72
+ key: 0,
73
+ modelValue: l.flow.authorizationUrl,
74
+ placeholder: "https://galaxy.scalar.com/authorize",
75
+ "onUpdate:modelValue": e[2] || (e[2] = (t) => u(`flows.${l.flow.type}.authorizationUrl`, t))
76
+ }, {
77
+ default: o(() => e[12] || (e[12] = [
78
+ d(" Auth URL ")
79
+ ])),
80
+ _: 1
81
+ }, 8, ["modelValue"])) : i("", !0),
82
+ "tokenUrl" in l.flow ? (s(), m(f, {
83
+ key: 1,
84
+ modelValue: l.flow.tokenUrl,
85
+ placeholder: "https://galaxy.scalar.com/token",
86
+ "onUpdate:modelValue": e[3] || (e[3] = (t) => u(`flows.${l.flow.type}.tokenUrl`, t))
87
+ }, {
88
+ default: o(() => e[13] || (e[13] = [
89
+ d(" Token URL ")
90
+ ])),
91
+ _: 1
92
+ }, 8, ["modelValue"])) : i("", !0)
93
+ ]),
94
+ _: 1
95
+ }),
96
+ "x-scalar-redirect-uri" in l.flow ? (s(), m(r(n), { key: 0 }, {
97
+ default: o(() => [
98
+ a(f, {
99
+ modelValue: l.flow["x-scalar-redirect-uri"],
100
+ placeholder: "https://galaxy.scalar.com/callback",
101
+ "onUpdate:modelValue": e[4] || (e[4] = (t) => u(`flows.${l.flow.type}.x-scalar-redirect-uri`, t))
102
+ }, {
103
+ default: o(() => e[14] || (e[14] = [
104
+ d(" Redirect URL ")
105
+ ])),
106
+ _: 1
107
+ }, 8, ["modelValue"])
108
+ ]),
109
+ _: 1
110
+ })) : i("", !0),
111
+ l.flow.type === "password" ? (s(), w(y, { key: 1 }, [
112
+ a(r(n), null, {
113
+ default: o(() => [
114
+ a(f, {
115
+ class: "text-c-2",
116
+ modelValue: l.flow.username,
117
+ placeholder: "janedoe",
118
+ "onUpdate:modelValue": e[5] || (e[5] = (t) => u(`flows.${l.flow.type}.username`, t))
119
+ }, {
120
+ default: o(() => e[15] || (e[15] = [
121
+ d(" Username ")
122
+ ])),
123
+ _: 1
124
+ }, 8, ["modelValue"])
125
+ ]),
92
126
  _: 1
93
- }, 8, ["id", "modelValue"])) : f("", !0)
94
- ]),
95
- _: 1
96
- })),
97
- "x-scalar-redirect-uri" in l.flow ? (i(), m(a(u), { key: 1 }, {
98
- default: o(() => [
99
- d(n, {
100
- id: `oauth2-redirect-uri-${l.scheme.uid}`,
101
- modelValue: l.flow["x-scalar-redirect-uri"],
102
- placeholder: "https://galaxy.scalar.com/callback",
103
- "onUpdate:modelValue": e[4] || (e[4] = (t) => r(`flows.${l.flow.type}.x-scalar-redirect-uri`, t))
104
- }, {
105
- default: o(() => e[14] || (e[14] = [
106
- s(" Redirect Url ")
107
- ])),
127
+ }),
128
+ a(r(n), null, {
129
+ default: o(() => [
130
+ a(f, {
131
+ modelValue: l.flow.password,
132
+ placeholder: "********",
133
+ type: "password",
134
+ "onUpdate:modelValue": e[6] || (e[6] = (t) => u(`flows.${l.flow.type}.password`, t))
135
+ }, {
136
+ default: o(() => e[16] || (e[16] = [
137
+ d(" Password ")
138
+ ])),
139
+ _: 1
140
+ }, 8, ["modelValue"])
141
+ ]),
108
142
  _: 1
109
- }, 8, ["id", "modelValue"])
110
- ]),
111
- _: 1
112
- })) : f("", !0),
113
- l.flow.type === "password" ? (i(), k(y, { key: 2 }, [
114
- d(a(u), null, {
143
+ })
144
+ ], 64)) : i("", !0),
145
+ a(r(n), null, {
115
146
  default: o(() => [
116
- d(n, {
117
- id: `oauth2-password-username-${l.scheme.uid}`,
118
- class: "text-c-2",
119
- modelValue: l.flow.username,
120
- placeholder: "ScalarEnjoyer01",
121
- "onUpdate:modelValue": e[5] || (e[5] = (t) => r(`flows.${l.flow.type}.username`, t))
147
+ a(f, {
148
+ modelValue: l.flow["x-scalar-client-id"],
149
+ placeholder: "12345",
150
+ "onUpdate:modelValue": e[7] || (e[7] = (t) => u(`flows.${l.flow.type}.x-scalar-client-id`, t))
122
151
  }, {
123
- default: o(() => e[15] || (e[15] = [
124
- s(" Username ")
152
+ default: o(() => e[17] || (e[17] = [
153
+ d(" Client ID ")
125
154
  ])),
126
155
  _: 1
127
- }, 8, ["id", "modelValue"])
156
+ }, 8, ["modelValue"])
128
157
  ]),
129
158
  _: 1
130
159
  }),
131
- d(a(u), null, {
160
+ "clientSecret" in l.flow ? (s(), m(r(n), { key: 2 }, {
132
161
  default: o(() => [
133
- d(n, {
134
- id: `oauth2-password-password-${l.scheme.uid}`,
135
- modelValue: l.flow.password,
136
- placeholder: "xxxxxx",
162
+ a(f, {
163
+ modelValue: l.flow.clientSecret,
164
+ placeholder: "XYZ123",
137
165
  type: "password",
138
- "onUpdate:modelValue": e[6] || (e[6] = (t) => r(`flows.${l.flow.type}.password`, t))
166
+ "onUpdate:modelValue": e[8] || (e[8] = (t) => u(`flows.${l.flow.type}.clientSecret`, t))
139
167
  }, {
140
- default: o(() => e[16] || (e[16] = [
141
- s(" Password ")
168
+ default: o(() => e[18] || (e[18] = [
169
+ d(" Client Secret ")
142
170
  ])),
143
171
  _: 1
144
- }, 8, ["id", "modelValue"])
172
+ }, 8, ["modelValue"])
145
173
  ]),
146
174
  _: 1
147
- })
148
- ], 64)) : f("", !0),
149
- d(a(u), null, {
150
- default: o(() => [
151
- d(n, {
152
- id: `oauth2-client-id-${l.scheme.uid}`,
153
- modelValue: l.flow["x-scalar-client-id"],
154
- placeholder: "12345",
155
- "onUpdate:modelValue": e[7] || (e[7] = (t) => r(`flows.${l.flow.type}.x-scalar-client-id`, t))
156
- }, {
157
- default: o(() => e[17] || (e[17] = [
158
- s(" Client ID ")
159
- ])),
160
- _: 1
161
- }, 8, ["id", "modelValue"])
162
- ]),
163
- _: 1
164
- }),
165
- "clientSecret" in l.flow ? (i(), m(a(u), { key: 3 }, {
166
- default: o(() => [
167
- d(n, {
168
- id: `oauth2-client-secret-${l.scheme.uid}`,
169
- modelValue: l.flow.clientSecret,
170
- placeholder: "XYZ123",
171
- type: "password",
172
- "onUpdate:modelValue": e[8] || (e[8] = (t) => r(`flows.${l.flow.type}.clientSecret`, t))
173
- }, {
174
- default: o(() => e[18] || (e[18] = [
175
- s(" Client Secret ")
176
- ])),
177
- _: 1
178
- }, 8, ["id", "modelValue"])
179
- ]),
180
- _: 1
181
- })) : f("", !0),
182
- "x-usePkce" in l.flow ? (i(), m(a(u), { key: 4 }, {
183
- default: o(() => [
184
- d(n, {
185
- id: `oauth2-use-pkce-${l.scheme.uid}`,
186
- enum: a(B),
187
- modelValue: l.flow["x-usePkce"],
188
- readOnly: "",
189
- "onUpdate:modelValue": e[9] || (e[9] = (t) => r(
190
- `flows.${l.flow.type}.x-usePkce`,
191
- t
192
- ))
193
- }, {
194
- default: o(() => e[19] || (e[19] = [
195
- s(" Use PKCE ")
196
- ])),
197
- _: 1
198
- }, 8, ["id", "enum", "modelValue"])
199
- ]),
200
- _: 1
201
- })) : f("", !0),
202
- Object.keys(l.flow.scopes ?? {}).length ? (i(), m(a(u), { key: 5 }, {
203
- default: o(() => [
204
- d(O, {
205
- flow: l.flow,
206
- updateScheme: r
207
- }, null, 8, ["flow"])
208
- ]),
209
- _: 1
210
- })) : f("", !0),
211
- d(a(u), { class: "min-w-full" }, {
175
+ })) : i("", !0),
176
+ "x-usePkce" in l.flow ? (s(), m(r(n), { key: 3 }, {
177
+ default: o(() => [
178
+ a(f, {
179
+ enum: r(R),
180
+ modelValue: l.flow["x-usePkce"],
181
+ readOnly: "",
182
+ "onUpdate:modelValue": e[9] || (e[9] = (t) => u(
183
+ `flows.${l.flow.type}.x-usePkce`,
184
+ t
185
+ ))
186
+ }, {
187
+ default: o(() => e[19] || (e[19] = [
188
+ d(" Use PKCE ")
189
+ ])),
190
+ _: 1
191
+ }, 8, ["enum", "modelValue"])
192
+ ]),
193
+ _: 1
194
+ })) : i("", !0),
195
+ Object.keys(l.flow.scopes ?? {}).length ? (s(), m(r(n), { key: 4 }, {
196
+ default: o(() => [
197
+ a(B, {
198
+ flow: l.flow,
199
+ layout: l.layout,
200
+ updateScheme: u
201
+ }, null, 8, ["flow", "layout"])
202
+ ]),
203
+ _: 1
204
+ })) : i("", !0)
205
+ ], 64)),
206
+ l.flow.token ? i("", !0) : (s(), m(r(n), {
207
+ key: 2,
208
+ class: "min-w-full"
209
+ }, {
212
210
  default: o(() => [
213
- V("div", b, [
214
- d(a(U), {
211
+ V("div", O, [
212
+ a(r(U), {
215
213
  class: "p-0 py-0.5 px-2 mr-1",
216
- loading: a(p),
214
+ loading: r(p),
217
215
  size: "sm",
218
216
  variant: "outlined",
219
217
  onClick: C
220
218
  }, {
221
219
  default: o(() => e[20] || (e[20] = [
222
- s(" Authorize ")
220
+ d(" Authorize ")
223
221
  ])),
224
222
  _: 1
225
223
  }, 8, ["loading"])
226
224
  ])
227
225
  ]),
228
226
  _: 1
229
- })
227
+ }))
230
228
  ], 64));
231
229
  }
232
230
  });