@scalar/api-client 2.0.33 → 2.0.35

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 (89) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/components/CodeInput/CodeInput.vue.js +2 -2
  3. package/dist/components/CommandPalette/CommandPaletteCollection.vue.d.ts.map +1 -1
  4. package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +39 -31
  5. package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts.map +1 -1
  6. package/dist/components/CommandPalette/CommandPaletteExample.vue.js +65 -55
  7. package/dist/components/CommandPalette/CommandPaletteFolder.vue.d.ts.map +1 -1
  8. package/dist/components/CommandPalette/CommandPaletteFolder.vue.js +53 -44
  9. package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
  10. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +42 -34
  11. package/dist/components/CommandPalette/CommandPaletteRequest.vue.d.ts.map +1 -1
  12. package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +126 -70
  13. package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.d.ts.map +1 -1
  14. package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.js +37 -29
  15. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
  16. package/dist/components/CommandPalette/TheCommandPalette.vue.js +4 -4
  17. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +97 -85
  18. package/dist/components/CommandPalette/handleKeyDown.d.ts +2 -0
  19. package/dist/components/CommandPalette/handleKeyDown.d.ts.map +1 -0
  20. package/dist/components/CommandPalette/handleKeyDown.js +7 -0
  21. package/dist/components/DataTable/DataTableInput.vue.d.ts +7 -0
  22. package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
  23. package/dist/components/DataTable/DataTableInput.vue.js +3 -3
  24. package/dist/components/DataTable/DataTableInput.vue2.js +33 -31
  25. package/dist/components/DataTable/DataTableInputSelect.vue.d.ts +19 -3
  26. package/dist/components/DataTable/DataTableInputSelect.vue.d.ts.map +1 -1
  27. package/dist/components/DataTable/DataTableInputSelect.vue.js +37 -35
  28. package/dist/components/DataTable/index.d.ts +1 -0
  29. package/dist/components/DataTable/index.d.ts.map +1 -1
  30. package/dist/components/DataTable/index.js +6 -4
  31. package/dist/components/Form/Form.vue.js +1 -1
  32. package/dist/components/Search/SearchButton.vue.d.ts.map +1 -1
  33. package/dist/components/Search/SearchButton.vue.js +14 -16
  34. package/dist/components/SideNav/SideHelp.vue.d.ts +3 -0
  35. package/dist/components/SideNav/SideHelp.vue.d.ts.map +1 -0
  36. package/dist/components/SideNav/SideHelp.vue.js +125 -0
  37. package/dist/components/SideNav/SideHelp.vue2.js +4 -0
  38. package/dist/components/SideNav/SideNav.vue.d.ts.map +1 -1
  39. package/dist/components/SideNav/SideNav.vue.js +3 -3
  40. package/dist/components/SideNav/SideNav.vue2.js +28 -24
  41. package/dist/components/Sidebar/SidebarButton.vue.js +1 -1
  42. package/dist/components/Sidebar/SidebarList.vue.d.ts.map +1 -1
  43. package/dist/components/Sidebar/SidebarList.vue.js +1 -1
  44. package/dist/components/Sidebar/SidebarListElement.vue.d.ts.map +1 -1
  45. package/dist/components/Sidebar/SidebarListElement.vue.js +1 -1
  46. package/dist/components/Sidebar/SidebarListElement.vue2.js +9 -9
  47. package/dist/constants.d.ts +0 -4
  48. package/dist/constants.d.ts.map +1 -1
  49. package/dist/constants.js +2 -2
  50. package/dist/layouts/App/create-api-client-app.d.ts +512 -603
  51. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  52. package/dist/layouts/Modal/api-client-modal.d.ts +1036 -1218
  53. package/dist/layouts/Modal/api-client-modal.d.ts.map +1 -1
  54. package/dist/libs/create-client.d.ts +513 -603
  55. package/dist/libs/create-client.d.ts.map +1 -1
  56. package/dist/libs/create-client.js +58 -68
  57. package/dist/libs/local-storage.js +5 -5
  58. package/dist/libs/sendRequest.d.ts +3 -5
  59. package/dist/libs/sendRequest.d.ts.map +1 -1
  60. package/dist/libs/sendRequest.js +73 -67
  61. package/dist/store/workspace.d.ts +1037 -1219
  62. package/dist/store/workspace.d.ts.map +1 -1
  63. package/dist/store/workspace.js +350 -277
  64. package/dist/style.css +1 -1
  65. package/dist/views/Request/Request.vue.d.ts.map +1 -1
  66. package/dist/views/Request/Request.vue.js +1 -1
  67. package/dist/views/Request/Request.vue2.js +101 -102
  68. package/dist/views/Request/RequestSection/RequestAuth.vue.d.ts.map +1 -1
  69. package/dist/views/Request/RequestSection/RequestAuth.vue.js +270 -177
  70. package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
  71. package/dist/views/Request/RequestSection/RequestSection.vue.js +52 -42
  72. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
  73. package/dist/views/Request/RequestSidebarItemMenu.vue.js +141 -104
  74. package/dist/views/Request/components/OAuth2.vue.d.ts +3 -9
  75. package/dist/views/Request/components/OAuth2.vue.d.ts.map +1 -1
  76. package/dist/views/Request/components/OAuth2.vue.js +141 -112
  77. package/dist/views/Request/components/OAuthScopesInput.vue.d.ts +2 -6
  78. package/dist/views/Request/components/OAuthScopesInput.vue.d.ts.map +1 -1
  79. package/dist/views/Request/components/OAuthScopesInput.vue.js +35 -39
  80. package/dist/views/Request/consts/index.d.ts +2 -0
  81. package/dist/views/Request/consts/index.d.ts.map +1 -0
  82. package/dist/views/Request/consts/index.js +5 -0
  83. package/dist/views/Request/consts/new-auth-options.d.ts +92 -0
  84. package/dist/views/Request/consts/new-auth-options.d.ts.map +1 -0
  85. package/dist/views/Request/consts/new-auth-options.js +83 -0
  86. package/dist/views/Request/libs/oauth2.d.ts +3 -16
  87. package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
  88. package/dist/views/Request/libs/oauth2.js +28 -31
  89. package/package.json +9 -5
@@ -1 +1 @@
1
- {"version":3,"file":"RequestSidebarItemMenu.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Request/RequestSidebarItemMenu.vue"],"names":[],"mappings":"AA8IA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACf,MAAM,2CAA2C,CAAA;;UAO1C,OAAO,GAAG,cAAc;;UAAxB,OAAO,GAAG,cAAc;;AA2VhC,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"RequestSidebarItemMenu.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Request/RequestSidebarItemMenu.vue"],"names":[],"mappings":"AA0MA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACf,MAAM,2CAA2C,CAAA;;UAO1C,OAAO,GAAG,cAAc;;UAAxB,OAAO,GAAG,cAAc;;AAkdhC,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,117 +1,154 @@
1
- import { defineComponent as E, computed as R, openBlock as u, createBlock as d, unref as e, withCtx as l, createVNode as t, createCommentVNode as z, createElementVNode as n } from "vue";
2
- import { commandPaletteBus as C } from "../../libs/eventBusses/command-palette.js";
3
- import { PathId as p } from "../../router.js";
4
- import { useWorkspace as I } from "../../store/workspace.js";
5
- import { ScalarDropdown as w, ScalarDropdownItem as o, ScalarIcon as s, ScalarDropdownDivider as S, ScalarButton as b } from "@scalar/components";
6
- import { useRouter as A } from "vue-router";
7
- const B = /* @__PURE__ */ n("span", null, "Add Example", -1), N = /* @__PURE__ */ n("span", null, "Rename", -1), M = /* @__PURE__ */ n("span", null, "Duplicate", -1), P = /* @__PURE__ */ n("span", null, "Delete", -1), j = /* @__PURE__ */ E({
1
+ import { defineComponent as V, computed as q, ref as I, openBlock as E, createElementBlock as $, Fragment as B, createVNode as a, unref as e, withCtx as l, createBlock as A, createCommentVNode as F, createElementVNode as r, createTextVNode as C } from "vue";
2
+ import P from "../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
3
+ import { commandPaletteBus as T } from "../../libs/eventBusses/command-palette.js";
4
+ import { PathId as b } from "../../router.js";
5
+ import { useWorkspace as U } from "../../store/workspace.js";
6
+ import { useModal as g, ScalarDropdown as W, ScalarDropdownItem as p, ScalarIcon as u, ScalarButton as f, ScalarModal as N, ScalarTextField as j } from "@scalar/components";
7
+ import { useRouter as G } from "vue-router";
8
+ const H = /* @__PURE__ */ r("span", null, "Add Example", -1), J = /* @__PURE__ */ r("span", null, "Rename", -1), K = /* @__PURE__ */ r("span", null, "Delete", -1), L = { class: "flex gap-3" }, ae = /* @__PURE__ */ V({
8
9
  __name: "RequestSidebarItemMenu",
9
10
  props: {
10
11
  item: {}
11
12
  },
12
- setup(f) {
13
- const a = f, {
14
- activeWorkspace: c,
15
- activeRouterParams: r,
16
- findRequestFolders: _,
17
- requestMutators: x,
18
- requestExampleMutators: h
19
- } = I(), { replace: m } = A(), k = () => C.emit({
13
+ setup(y) {
14
+ const t = y, {
15
+ activeWorkspace: v,
16
+ activeRouterParams: x,
17
+ findRequestFolders: D,
18
+ requestMutators: _,
19
+ requestExampleMutators: R
20
+ } = U(), { replace: h } = G(), M = () => T.emit({
20
21
  commandName: "Add Example",
21
- metaData: a.item.uid
22
- }), v = () => {
23
- console.log("rename");
24
- }, g = () => {
25
- console.log("duplicate");
26
- }, D = () => {
27
- if ("requestUid" in a.item)
28
- h.delete(a.item), r.value[p.Examples] === a.item.uid && m(`/workspace/${c.value}/request/default`);
22
+ metaData: t.item.uid
23
+ }), S = () => {
24
+ if ("requestUid" in t.item)
25
+ R.delete(t.item), x.value[b.Examples] === t.item.uid && h(`/workspace/${v.value}/request/default`);
29
26
  else {
30
- const i = _(a.item.uid);
31
- if (!i.length) return;
32
- x.delete(a.item, i[0]), r.value[p.Request] === a.item.uid && m(`/workspace/${c.value.uid}/request/default`);
27
+ const c = D(t.item.uid);
28
+ if (!c.length) return;
29
+ _.delete(t.item, c[0]), x.value[b.Request] === t.item.uid && h(`/workspace/${v.value.uid}/request/default`);
33
30
  }
34
- }, q = R(() => "summary" in a.item);
35
- return (i, V) => (u(), d(e(w), { teleport: "#scalar-client" }, {
36
- items: l(() => [
37
- q.value ? (u(), d(e(o), {
38
- key: 0,
39
- class: "flex !gap-2",
40
- onClick: k
41
- }, {
42
- default: l(() => [
43
- t(e(s), {
44
- class: "inline-flex",
45
- icon: "Add",
46
- size: "sm"
31
+ }, n = q(() => "summary" in t.item), k = q(() => "summary" in t.item ? t.item.summary || "" : "name" in t.item && t.item.name || ""), i = I(""), w = () => {
32
+ "summary" in t.item ? _.edit(t.item.uid, "summary", i.value) : "summary" in t.item || R.edit(t.item.uid, "name", i.value), i.value = "", o.hide();
33
+ }, o = g(), d = g(), z = () => {
34
+ i.value = k.value, o.show();
35
+ };
36
+ return (c, s) => (E(), $(B, null, [
37
+ a(e(W), { teleport: "#scalar-client" }, {
38
+ items: l(() => [
39
+ n.value ? (E(), A(e(p), {
40
+ key: 0,
41
+ class: "flex !gap-2",
42
+ onClick: M
43
+ }, {
44
+ default: l(() => [
45
+ a(e(u), {
46
+ class: "inline-flex",
47
+ icon: "Add",
48
+ size: "sm"
49
+ }),
50
+ H
51
+ ]),
52
+ _: 1
53
+ })) : F("", !0),
54
+ a(e(p), {
55
+ class: "flex !gap-2",
56
+ onClick: z
57
+ }, {
58
+ default: l(() => [
59
+ a(e(u), {
60
+ class: "inline-flex",
61
+ icon: "Edit",
62
+ size: "sm"
63
+ }),
64
+ J
65
+ ]),
66
+ _: 1
67
+ }),
68
+ a(e(p), {
69
+ class: "flex !gap-2",
70
+ onClick: s[0] || (s[0] = (m) => e(d).show())
71
+ }, {
72
+ default: l(() => [
73
+ a(e(u), {
74
+ class: "inline-flex",
75
+ icon: "Trash",
76
+ size: "sm"
77
+ }),
78
+ K
79
+ ]),
80
+ _: 1
81
+ })
82
+ ]),
83
+ default: l(() => [
84
+ a(e(f), {
85
+ class: "z-10 hover:bg-b-3 transition-none p-1 group-hover:flex ui-open:flex absolute left-0 hidden -translate-x-full -ml-1",
86
+ size: "sm",
87
+ variant: "ghost"
88
+ }, {
89
+ default: l(() => [
90
+ a(e(u), {
91
+ icon: "Ellipses",
92
+ size: "sm"
93
+ })
94
+ ]),
95
+ _: 1
96
+ })
97
+ ]),
98
+ _: 1
99
+ }),
100
+ a(e(N), {
101
+ size: "sm",
102
+ state: e(d),
103
+ title: n.value ? "Delete Request" : "Delete Example"
104
+ }, {
105
+ default: l(() => [
106
+ a(P, {
107
+ variableName: k.value,
108
+ onClose: s[1] || (s[1] = (m) => e(d).hide()),
109
+ onDelete: S
110
+ }, null, 8, ["variableName"])
111
+ ]),
112
+ _: 1
113
+ }, 8, ["state", "title"]),
114
+ a(e(N), {
115
+ state: e(o),
116
+ title: n.value ? "Rename Request" : "Rename Example"
117
+ }, {
118
+ default: l(() => [
119
+ a(e(j), {
120
+ modelValue: i.value,
121
+ "onUpdate:modelValue": s[2] || (s[2] = (m) => i.value = m),
122
+ label: n.value ? "Request" : "Example"
123
+ }, null, 8, ["modelValue", "label"]),
124
+ r("div", L, [
125
+ a(e(f), {
126
+ class: "flex-1",
127
+ variant: "outlined",
128
+ onClick: s[3] || (s[3] = (m) => e(o).hide())
129
+ }, {
130
+ default: l(() => [
131
+ C(" Cancel ")
132
+ ]),
133
+ _: 1
47
134
  }),
48
- B
49
- ]),
50
- _: 1
51
- })) : z("", !0),
52
- t(e(o), {
53
- class: "flex !gap-2",
54
- onClick: v
55
- }, {
56
- default: l(() => [
57
- t(e(s), {
58
- class: "inline-flex",
59
- icon: "Edit",
60
- size: "sm"
61
- }),
62
- N
63
- ]),
64
- _: 1
65
- }),
66
- t(e(o), {
67
- class: "flex !gap-2",
68
- onClick: g
69
- }, {
70
- default: l(() => [
71
- t(e(s), {
72
- class: "inline-flex",
73
- icon: "Duplicate",
74
- size: "sm"
75
- }),
76
- M
77
- ]),
78
- _: 1
79
- }),
80
- t(e(S)),
81
- t(e(o), {
82
- class: "flex !gap-2",
83
- onClick: D
84
- }, {
85
- default: l(() => [
86
- t(e(s), {
87
- class: "inline-flex",
88
- icon: "Trash",
89
- size: "sm"
90
- }),
91
- P
92
- ]),
93
- _: 1
94
- })
95
- ]),
96
- default: l(() => [
97
- t(e(b), {
98
- class: "z-10 hover:bg-b-3 transition-none p-1 group-hover:flex ui-open:flex absolute left-0 hidden -translate-x-full -ml-1",
99
- size: "sm",
100
- variant: "ghost"
101
- }, {
102
- default: l(() => [
103
- t(e(s), {
104
- icon: "Ellipses",
105
- size: "sm"
135
+ a(e(f), {
136
+ class: "flex-1",
137
+ type: "submit",
138
+ onClick: w
139
+ }, {
140
+ default: l(() => [
141
+ C(" Save ")
142
+ ]),
143
+ _: 1
106
144
  })
107
- ]),
108
- _: 1
109
- })
110
- ]),
111
- _: 1
112
- }));
145
+ ])
146
+ ]),
147
+ _: 1
148
+ }, 8, ["state", "title"])
149
+ ], 64));
113
150
  }
114
151
  });
115
152
  export {
116
- j as default
153
+ ae as default
117
154
  };
@@ -1,14 +1,8 @@
1
- import type { UpdateScheme } from '../../../store/workspace.js';
2
- import { type SecuritySchemeOptionOauth } from '../../../views/Request/libs/index.js';
3
- import type { SelectedSchemeOauth2 } from '@scalar/oas-utils/entities/workspace/security';
1
+ import type { SecuritySchemeOauth2 } from '@scalar/oas-utils/entities/workspace/security';
4
2
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
5
- activeScheme: SelectedSchemeOauth2;
6
- schemeModel: SecuritySchemeOptionOauth;
7
- updateScheme: UpdateScheme;
3
+ scheme: SecuritySchemeOauth2;
8
4
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
9
- activeScheme: SelectedSchemeOauth2;
10
- schemeModel: SecuritySchemeOptionOauth;
11
- updateScheme: UpdateScheme;
5
+ scheme: SecuritySchemeOauth2;
12
6
  }>>>, {}, {}>;
13
7
  export default _default;
14
8
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -1 +1 @@
1
- {"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/components/OAuth2.vue"],"names":[],"mappings":"AAyKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAAO,EACL,KAAK,yBAAyB,EAE/B,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAA;;kBAOzE,oBAAoB;iBACrB,yBAAyB;kBACxB,YAAY;;kBAFZ,oBAAoB;iBACrB,yBAAyB;kBACxB,YAAY;;AAwb5B,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/components/OAuth2.vue"],"names":[],"mappings":"AAwLA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAA;;YAO/E,oBAAoB;;YAApB,oBAAoB;;AA4f9B,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,168 +1,197 @@
1
- import { defineComponent as V, openBlock as i, createBlock as c, unref as d, withCtx as l, createVNode as a, createTextVNode as s, createElementBlock as p, Fragment as h, createCommentVNode as f, createElementVNode as v } from "vue";
2
- import r from "../RequestSection/RequestAuthDataTableInput.vue.js";
3
- import { useLoadingState as k, ScalarButton as w } from "@scalar/components";
4
- import M from "./OAuthScopesInput.vue.js";
5
- import m from "../../../components/DataTable/DataTableRow.vue.js";
6
- import C from "../../../components/DataTable/DataTableCell.vue.js";
7
- import { authorizeOauth2 as g } from "../libs/oauth2.js";
8
- const U = { class: "h-8 flex items-center justify-self-end" }, L = /* @__PURE__ */ V({
1
+ import { defineComponent as S, openBlock as u, createElementBlock as c, Fragment as h, createVNode as t, unref as d, withCtx as o, createTextVNode as s, createElementVNode as V, createBlock as f, createCommentVNode as m } from "vue";
2
+ import { useWorkspace as $ } from "../../../store/workspace.js";
3
+ import n from "../RequestSection/RequestAuthDataTableInput.vue.js";
4
+ import { useLoadingState as v, ScalarButton as k } from "@scalar/components";
5
+ import C from "./OAuthScopesInput.vue.js";
6
+ import i from "../../../components/DataTable/DataTableRow.vue.js";
7
+ import { authorizeOauth2 as T } from "../libs/oauth2.js";
8
+ const F = { class: "h-8 flex items-center justify-self-end" }, I = { class: "h-8 flex items-center justify-self-end" }, E = /* @__PURE__ */ S({
9
9
  __name: "OAuth2",
10
10
  props: {
11
- activeScheme: {},
12
- schemeModel: {},
13
- updateScheme: { type: Function }
11
+ scheme: {}
14
12
  },
15
- setup(S) {
16
- const u = S, n = k(), y = async () => {
17
- if (n.isLoading) return;
18
- n.startLoading();
19
- const e = await g(
20
- u.activeScheme,
21
- u.schemeModel
22
- ).finally(() => n.stopLoading());
23
- e && u.updateScheme(`flows.${u.schemeModel.flowKey}.token`, e);
13
+ setup(y) {
14
+ const w = y, p = v(), { isReadOnly: U, securitySchemeMutators: g } = $(), r = (e, l) => g.edit(w.scheme.uid, e, l), z = async () => {
15
+ if (p.isLoading) return;
16
+ p.startLoading();
17
+ const e = await T(w.scheme).finally(
18
+ () => p.stopLoading()
19
+ );
20
+ e && r("flow.token", e);
24
21
  };
25
- return (e, o) => e.activeScheme.flow.token ? (i(), c(d(m), { key: 0 }, {
26
- default: l(() => [
27
- a(r, {
28
- id: "oauth2-access-token",
29
- class: "border-r-transparent",
30
- modelValue: e.activeScheme.flow.token,
31
- type: "password",
32
- "onUpdate:modelValue": o[0] || (o[0] = (t) => e.updateScheme(`flows.${e.schemeModel.flowKey}.token`, t))
33
- }, {
34
- default: l(() => [
35
- s(" Access Token ")
36
- ]),
37
- _: 1
38
- }, 8, ["modelValue"]),
39
- a(d(C), { class: "flex items-center p-0.5" }, {
40
- default: l(() => [
41
- a(d(w), {
22
+ return (e, l) => e.scheme.flow.token ? (u(), c(h, { key: 0 }, [
23
+ t(d(i), null, {
24
+ default: o(() => [
25
+ t(n, {
26
+ id: "oauth2-access-token",
27
+ class: "border-r-transparent",
28
+ modelValue: e.scheme.flow.token,
29
+ placeholder: "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT",
30
+ type: "password",
31
+ "onUpdate:modelValue": l[0] || (l[0] = (a) => r("flow.token", a))
32
+ }, {
33
+ default: o(() => [
34
+ s(" Access Token ")
35
+ ]),
36
+ _: 1
37
+ }, 8, ["modelValue"])
38
+ ]),
39
+ _: 1
40
+ }),
41
+ t(d(i), { class: "min-w-full" }, {
42
+ default: o(() => [
43
+ V("div", F, [
44
+ t(d(k), {
45
+ class: "p-0 py-0.5 px-2 mr-1",
46
+ loading: d(p),
42
47
  size: "sm",
43
- variant: "ghost",
44
- onClick: o[1] || (o[1] = (t) => e.updateScheme(`flows.${e.schemeModel.flowKey}.token`, ""))
48
+ variant: "outlined",
49
+ onClick: l[1] || (l[1] = (a) => r("flow.token", ""))
45
50
  }, {
46
- default: l(() => [
51
+ default: o(() => [
47
52
  s(" Clear ")
48
53
  ]),
49
54
  _: 1
50
- })
51
- ]),
52
- _: 1
53
- })
54
- ]),
55
- _: 1
56
- })) : (i(), p(h, { key: 1 }, [
57
- ["implicit", "authorizationCode"].includes(e.schemeModel.flowKey) ? (i(), c(d(m), { key: 0 }, {
58
- default: l(() => [
59
- a(r, {
60
- id: "oauth2-redirect-uri",
61
- modelValue: e.activeScheme.scheme.redirectUri,
55
+ }, 8, ["loading"])
56
+ ])
57
+ ]),
58
+ _: 1
59
+ })
60
+ ], 64)) : (u(), c(h, { key: 1 }, [
61
+ d(U) ? m("", !0) : (u(), f(d(i), { key: 0 }, {
62
+ default: o(() => [
63
+ "authorizationUrl" in e.scheme.flow ? (u(), f(n, {
64
+ key: 0,
65
+ id: `oauth2-authorization-url-${e.scheme.uid}`,
66
+ modelValue: e.scheme.flow.authorizationUrl,
67
+ placeholder: "https://galaxy.scalar.com/authorize",
68
+ "onUpdate:modelValue": l[2] || (l[2] = (a) => r("flow.authorizationUrl", a))
69
+ }, {
70
+ default: o(() => [
71
+ s(" Authorization Url ")
72
+ ]),
73
+ _: 1
74
+ }, 8, ["id", "modelValue"])) : m("", !0),
75
+ "tokenUrl" in e.scheme.flow ? (u(), f(n, {
76
+ key: 1,
77
+ id: `oauth2-token-url-${e.scheme.uid}`,
78
+ modelValue: e.scheme.flow.tokenUrl,
79
+ placeholder: "https://galaxy.scalar.com/token",
80
+ "onUpdate:modelValue": l[3] || (l[3] = (a) => r("flow.tokenUrl", a))
81
+ }, {
82
+ default: o(() => [
83
+ s(" Token Url ")
84
+ ]),
85
+ _: 1
86
+ }, 8, ["id", "modelValue"])) : m("", !0)
87
+ ]),
88
+ _: 1
89
+ })),
90
+ "redirectUri" in e.scheme.flow ? (u(), f(d(i), { key: 1 }, {
91
+ default: o(() => [
92
+ t(n, {
93
+ id: `oauth2-redirect-uri-${e.scheme.uid}`,
94
+ modelValue: e.scheme.flow.redirectUri,
62
95
  placeholder: "https://galaxy.scalar.com/callback",
63
- "onUpdate:modelValue": o[2] || (o[2] = (t) => e.updateScheme("redirectUri", t))
96
+ "onUpdate:modelValue": l[4] || (l[4] = (a) => r("flow.redirectUri", a))
64
97
  }, {
65
- default: l(() => [
66
- s(" Redirect URI ")
98
+ default: o(() => [
99
+ s(" Redirect Url ")
67
100
  ]),
68
101
  _: 1
69
- }, 8, ["modelValue"])
102
+ }, 8, ["id", "modelValue"])
70
103
  ]),
71
104
  _: 1
72
- })) : f("", !0),
73
- e.schemeModel.flowKey === "password" && "value" in e.activeScheme.flow ? (i(), p(h, { key: 1 }, [
74
- a(d(m), null, {
75
- default: l(() => [
76
- a(r, {
77
- id: "oauth2-password-username",
105
+ })) : m("", !0),
106
+ e.scheme.flow.type === "password" ? (u(), c(h, { key: 2 }, [
107
+ t(d(i), null, {
108
+ default: o(() => [
109
+ t(n, {
110
+ id: `oauth2-password-username-${e.scheme.uid}`,
78
111
  class: "text-c-2",
79
- modelValue: e.activeScheme.flow.value,
112
+ modelValue: e.scheme.flow.value,
80
113
  placeholder: "ScalarEnjoyer01",
81
- "onUpdate:modelValue": o[3] || (o[3] = (t) => e.updateScheme("flows.password.value", t))
114
+ "onUpdate:modelValue": l[5] || (l[5] = (a) => r("flow.value", a))
82
115
  }, {
83
- default: l(() => [
116
+ default: o(() => [
84
117
  s(" Username ")
85
118
  ]),
86
119
  _: 1
87
- }, 8, ["modelValue"])
120
+ }, 8, ["id", "modelValue"])
88
121
  ]),
89
122
  _: 1
90
123
  }),
91
- a(d(m), null, {
92
- default: l(() => [
93
- a(r, {
94
- id: "oauth2-password-password",
95
- modelValue: e.activeScheme.flow.secondValue,
96
- placeholder: "XYZ123",
124
+ t(d(i), null, {
125
+ default: o(() => [
126
+ t(n, {
127
+ id: `oauth2-password-password-${e.scheme.uid}`,
128
+ modelValue: e.scheme.flow.secondValue,
129
+ placeholder: "xxxxxx",
97
130
  type: "password",
98
- "onUpdate:modelValue": o[4] || (o[4] = (t) => e.updateScheme("flows.password.secondValue", t))
131
+ "onUpdate:modelValue": l[6] || (l[6] = (a) => r("flow.secondValue", a))
99
132
  }, {
100
- default: l(() => [
133
+ default: o(() => [
101
134
  s(" Password ")
102
135
  ]),
103
136
  _: 1
104
- }, 8, ["modelValue"])
137
+ }, 8, ["id", "modelValue"])
105
138
  ]),
106
139
  _: 1
107
140
  })
108
- ], 64)) : f("", !0),
109
- a(d(m), null, {
110
- default: l(() => [
111
- a(r, {
112
- id: "oauth2-client-id",
113
- modelValue: e.activeScheme.scheme.clientId,
141
+ ], 64)) : m("", !0),
142
+ t(d(i), null, {
143
+ default: o(() => [
144
+ t(n, {
145
+ id: `oauth2-client-id-${e.scheme.uid}`,
146
+ modelValue: e.scheme.clientId,
114
147
  placeholder: "12345",
115
- "onUpdate:modelValue": o[5] || (o[5] = (t) => e.updateScheme("clientId", t))
148
+ "onUpdate:modelValue": l[7] || (l[7] = (a) => r("clientId", a))
116
149
  }, {
117
- default: l(() => [
150
+ default: o(() => [
118
151
  s(" Client ID ")
119
152
  ]),
120
153
  _: 1
121
- }, 8, ["modelValue"])
154
+ }, 8, ["id", "modelValue"])
122
155
  ]),
123
156
  _: 1
124
157
  }),
125
- "clientSecret" in e.activeScheme.flow ? (i(), c(d(m), { key: 2 }, {
126
- default: l(() => [
127
- a(r, {
128
- id: "oauth2-client-secret",
129
- modelValue: e.activeScheme.flow.clientSecret,
158
+ "clientSecret" in e.scheme.flow ? (u(), f(d(i), { key: 3 }, {
159
+ default: o(() => [
160
+ t(n, {
161
+ id: `oauth2-client-secret-${e.scheme.uid}`,
162
+ modelValue: e.scheme.flow.clientSecret,
130
163
  placeholder: "XYZ123",
131
164
  type: "password",
132
- "onUpdate:modelValue": o[6] || (o[6] = (t) => (
133
- // Vue cant figure out the type if we check in the template above so we do it here
134
- (e.schemeModel.flowKey === "authorizationCode" || e.schemeModel.flowKey === "clientCredentials" || e.schemeModel.flowKey === "password") && e.updateScheme(`flows.${e.schemeModel.flowKey}.clientSecret`, t)
135
- ))
165
+ "onUpdate:modelValue": l[8] || (l[8] = (a) => r("flow.clientSecret", a))
136
166
  }, {
137
- default: l(() => [
167
+ default: o(() => [
138
168
  s(" Client Secret ")
139
169
  ]),
140
170
  _: 1
141
- }, 8, ["modelValue"])
171
+ }, 8, ["id", "modelValue"])
142
172
  ]),
143
173
  _: 1
144
- })) : f("", !0),
145
- e.activeScheme.flow.scopes ? (i(), c(d(m), { key: 3 }, {
146
- default: l(() => [
147
- a(M, {
148
- activeFlow: e.activeScheme.flow,
149
- schemeModel: e.schemeModel,
150
- updateScheme: e.updateScheme
151
- }, null, 8, ["activeFlow", "schemeModel", "updateScheme"])
174
+ })) : m("", !0),
175
+ e.scheme.flow.scopes ? (u(), f(d(i), { key: 4 }, {
176
+ default: o(() => [
177
+ t(C, {
178
+ activeFlow: e.scheme.flow,
179
+ updateScheme: r
180
+ }, null, 8, ["activeFlow"])
152
181
  ]),
153
182
  _: 1
154
- })) : f("", !0),
155
- a(d(m), { class: "min-w-full" }, {
156
- default: l(() => [
157
- v("div", U, [
158
- a(d(w), {
183
+ })) : m("", !0),
184
+ t(d(i), { class: "min-w-full" }, {
185
+ default: o(() => [
186
+ V("div", I, [
187
+ t(d(k), {
159
188
  class: "p-0 py-0.5 px-2 mr-1",
160
- loading: d(n),
189
+ loading: d(p),
161
190
  size: "sm",
162
191
  variant: "outlined",
163
- onClick: y
192
+ onClick: z
164
193
  }, {
165
- default: l(() => [
194
+ default: o(() => [
166
195
  s(" Authorize ")
167
196
  ]),
168
197
  _: 1
@@ -175,5 +204,5 @@ const U = { class: "h-8 flex items-center justify-self-end" }, L = /* @__PURE__
175
204
  }
176
205
  });
177
206
  export {
178
- L as default
207
+ E as default
179
208
  };
@@ -1,14 +1,10 @@
1
1
  import type { UpdateScheme } from '../../../store/workspace.js';
2
- import type { SecuritySchemeOptionOauth } from '../../../views/Request/libs/index.js';
3
2
  import type { SecuritySchemeOauth2 } from '@scalar/oas-utils/entities/workspace/security';
4
- import type { ValueOf } from 'type-fest';
5
3
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
6
- activeFlow: ValueOf<SecuritySchemeOauth2["flows"]>;
7
- schemeModel: SecuritySchemeOptionOauth;
4
+ activeFlow: SecuritySchemeOauth2["flow"];
8
5
  updateScheme: UpdateScheme;
9
6
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
10
- activeFlow: ValueOf<SecuritySchemeOauth2["flows"]>;
11
- schemeModel: SecuritySchemeOptionOauth;
7
+ activeFlow: SecuritySchemeOauth2["flow"];
12
8
  updateScheme: UpdateScheme;
13
9
  }>>>, {}, {}>;
14
10
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"OAuthScopesInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/components/OAuthScopesInput.vue"],"names":[],"mappings":"AAuGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAGrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAA;AACzF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;;gBAM1B,OAAO,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;iBACrC,yBAAyB;kBACxB,YAAY;;gBAFd,OAAO,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;iBACrC,yBAAyB;kBACxB,YAAY;;AAuR5B,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"OAuthScopesInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/components/OAuthScopesInput.vue"],"names":[],"mappings":"AAgGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAA;;gBAM3E,oBAAoB,CAAC,MAAM,CAAC;kBAC1B,YAAY;;gBADd,oBAAoB,CAAC,MAAM,CAAC;kBAC1B,YAAY;;AAoR5B,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}