@scalar/api-client 2.5.29 → 2.5.31

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 (63) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/analytics.d.ts +1 -36
  3. package/dist/analytics.d.ts.map +1 -1
  4. package/dist/analytics.js +7 -23
  5. package/dist/components/DataTable/DataTableInput.vue.d.ts +1 -1
  6. package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
  7. package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
  8. package/dist/hooks/useAnalytics.d.ts +35 -0
  9. package/dist/hooks/useAnalytics.d.ts.map +1 -0
  10. package/dist/hooks/useAnalytics.js +11 -0
  11. package/dist/index.js +8 -9
  12. package/dist/layouts/App/create-api-client-app.d.ts +45 -78
  13. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  14. package/dist/layouts/App/create-api-client-app.js +20 -20
  15. package/dist/layouts/App/index.js +3 -4
  16. package/dist/layouts/Modal/create-api-client-modal.d.ts +90 -90
  17. package/dist/layouts/Web/create-api-client-web.d.ts +45 -78
  18. package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
  19. package/dist/layouts/Web/create-api-client-web.js +20 -20
  20. package/dist/layouts/Web/index.js +3 -4
  21. package/dist/libs/create-client.d.ts +45 -45
  22. package/dist/libs/hot-keys.d.ts +1 -1
  23. package/dist/store/collections.d.ts +4 -4
  24. package/dist/store/cookies.d.ts +4 -4
  25. package/dist/store/environment.d.ts +4 -4
  26. package/dist/store/request-example.d.ts +4 -4
  27. package/dist/store/requests.d.ts +4 -4
  28. package/dist/store/security-schemes.d.ts +16 -16
  29. package/dist/store/store.d.ts +45 -45
  30. package/dist/store/tags.d.ts +4 -4
  31. package/dist/store/workspace.d.ts +4 -4
  32. package/dist/style.css +1 -1
  33. package/dist/views/Request/RequestRoot.vue.js +2 -2
  34. package/dist/views/Request/RequestRoot.vue2.js +4 -4
  35. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts +14 -1
  36. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
  37. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +49 -47
  38. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts +202 -1
  39. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
  40. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +2 -2
  41. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +111 -103
  42. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts +200 -1
  43. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts.map +1 -1
  44. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.js +2 -2
  45. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue2.js +64 -44
  46. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTableInput.vue.d.ts +1 -1
  47. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTableInput.vue.d.ts.map +1 -1
  48. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.d.ts +14 -1
  49. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.d.ts.map +1 -1
  50. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.js +104 -121
  51. package/dist/views/Request/RequestSection/RequestAuth/helpers/restore-auth-from-local-storage.d.ts +9 -0
  52. package/dist/views/Request/RequestSection/RequestAuth/helpers/restore-auth-from-local-storage.d.ts.map +1 -0
  53. package/dist/views/Request/RequestSection/RequestAuth/helpers/restore-auth-from-local-storage.js +28 -0
  54. package/dist/views/Request/RequestSection/RequestAuth/helpers/restore-auth-from-local-storage.test.d.ts +2 -0
  55. package/dist/views/Request/RequestSection/RequestAuth/helpers/restore-auth-from-local-storage.test.d.ts.map +1 -0
  56. package/dist/views/Request/RequestSection/RequestAuth/index.d.ts +3 -1
  57. package/dist/views/Request/RequestSection/RequestAuth/index.d.ts.map +1 -1
  58. package/dist/views/Request/RequestSection/RequestAuth/index.js +6 -4
  59. package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
  60. package/dist/views/Request/RequestSection/RequestSection.vue.js +2 -2
  61. package/dist/views/Request/RequestSection/RequestSection.vue2.js +25 -24
  62. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  63. package/package.json +12 -12
@@ -1,12 +1,14 @@
1
- import { defineComponent as k, ref as d, computed as h, watch as S, createElementBlock as l, openBlock as o, withModifiers as g, createCommentVNode as p, createBlock as w, createVNode as v, normalizeClass as s, Fragment as x, renderList as A, createElementVNode as f, toDisplayString as C, unref as c, withCtx as V } from "vue";
2
- import { useModal as O } from "@scalar/components";
3
- import B from "./DeleteRequestAuthModal.vue.js";
4
- import $ from "./RequestAuthTab.vue.js";
5
- import z from "../../../../components/DataTable/DataTable.vue.js";
6
- const M = ["onClick"], N = { class: "relative z-10 font-medium whitespace-nowrap" }, D = {
1
+ import { defineComponent as A, ref as h, computed as p, watch as v, createElementBlock as s, openBlock as o, withModifiers as z, createCommentVNode as f, createBlock as C, createVNode as b, normalizeClass as a, Fragment as V, renderList as $, createElementVNode as y, toDisplayString as O, unref as u, withCtx as S, renderSlot as B } from "vue";
2
+ import { useModal as M } from "@scalar/components";
3
+ import { isDefined as N } from "@scalar/helpers/array/is-defined";
4
+ import D from "./DeleteRequestAuthModal.vue.js";
5
+ import E from "./RequestAuthTab.vue.js";
6
+ import U from "../../../../components/DataTable/DataTable.vue.js";
7
+ import { useWorkspace as j } from "../../../../store/store.js";
8
+ const q = ["onClick"], F = { class: "relative z-10 font-medium whitespace-nowrap" }, I = {
7
9
  key: 0,
8
10
  class: "absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current"
9
- }, L = /* @__PURE__ */ k({
11
+ }, P = /* @__PURE__ */ A({
10
12
  __name: "RequestAuthDataTable",
11
13
  props: {
12
14
  collection: {},
@@ -18,79 +20,97 @@ const M = ["onClick"], N = { class: "relative z-10 font-medium whitespace-nowrap
18
20
  server: {},
19
21
  workspace: {}
20
22
  },
21
- setup(n) {
22
- const u = O(), b = d(
23
+ emits: ["authorized", "activeSchemes"],
24
+ setup(n, { emit: k }) {
25
+ const m = k, { securitySchemes: g } = j(), d = M(), w = h(
23
26
  null
24
- ), t = d(0), m = h(() => {
27
+ ), r = h(0), i = p(() => {
25
28
  if (!n.selectedSchemeOptions || n.selectedSchemeOptions.length === 0)
26
29
  return [];
27
- const e = n.selectedSchemeOptions[t.value];
30
+ const e = n.selectedSchemeOptions[r.value];
28
31
  if (!e)
29
32
  return [];
30
- const r = e.id.split(",").filter(Boolean);
31
- return r.length > 1 ? r : [e.id];
32
- }), y = h(() => m.value.length > 0);
33
- return S(
33
+ const t = e.id.split(",").filter(Boolean);
34
+ return t.length > 1 ? t : [e.id];
35
+ });
36
+ v(
37
+ i,
38
+ (e) => {
39
+ m(
40
+ "activeSchemes",
41
+ e.map((t) => g[t]).filter(N)
42
+ );
43
+ },
44
+ { immediate: !0 }
45
+ );
46
+ const x = p(() => i.value.length > 0);
47
+ return v(
34
48
  () => n.selectedSchemeOptions,
35
49
  (e) => {
36
- (!e || !e[t.value]) && (t.value = Math.max(0, t.value - 1));
50
+ (!e || !e[r.value]) && (r.value = Math.max(0, r.value - 1));
37
51
  }
38
- ), (e, r) => (o(), l("form", {
39
- onSubmit: r[1] || (r[1] = g(() => {
52
+ ), (e, t) => (o(), s("form", {
53
+ onSubmit: t[2] || (t[2] = z(() => {
40
54
  }, ["prevent"]))
41
55
  }, [
42
- e.selectedSchemeOptions.length > 1 ? (o(), l("div", {
56
+ e.selectedSchemeOptions.length > 1 ? (o(), s("div", {
43
57
  key: 0,
44
- class: s(["box-content flex flex-wrap gap-x-2.5 overflow-hidden border border-b-0 px-3", e.layout === "client" && "border-x-0"])
58
+ class: a(["box-content flex flex-wrap gap-x-2.5 overflow-hidden border border-b-0 px-3", e.layout === "client" && "border-x-0"])
45
59
  }, [
46
- (o(!0), l(x, null, A(e.selectedSchemeOptions, (a, i) => (o(), l("div", {
47
- key: a.id,
48
- class: s(["relative z-1 -mb-[var(--scalar-border-width)] flex h-8 cursor-pointer", [t.value === i ? "text-c-1" : "text-c-3"]])
60
+ (o(!0), s(V, null, $(e.selectedSchemeOptions, (l, c) => (o(), s("div", {
61
+ key: l.id,
62
+ class: a(["relative z-1 -mb-[var(--scalar-border-width)] flex h-8 cursor-pointer", [r.value === c ? "text-c-1" : "text-c-3"]])
49
63
  }, [
50
- f("button", {
64
+ y("button", {
51
65
  class: "floating-bg relative cursor-pointer border-b-[1px] border-transparent py-1 text-sm font-medium",
52
66
  type: "button",
53
- onClick: (E) => t.value = i
67
+ onClick: (L) => r.value = c
54
68
  }, [
55
- f("span", N, C(a.label), 1)
56
- ], 8, M),
57
- t.value === i ? (o(), l("div", D)) : p("", !0)
69
+ y("span", F, O(l.label), 1)
70
+ ], 8, q),
71
+ r.value === c ? (o(), s("div", I)) : f("", !0)
58
72
  ], 2))), 128))
59
- ], 2)) : p("", !0),
60
- y.value ? (o(), w(c(z), {
73
+ ], 2)) : f("", !0),
74
+ x.value ? (o(), C(u(U), {
61
75
  key: 1,
62
- class: s(["flex-1", e.layout === "reference" && "bg-b-1 rounded-b-lg border border-t-0"]),
76
+ class: a(["flex-1", e.layout === "reference" && "bg-b-1 rounded-b-lg border border-t-0"]),
63
77
  columns: [""],
64
78
  presentational: ""
65
79
  }, {
66
- default: V(() => [
67
- v($, {
80
+ default: S(() => [
81
+ b(E, {
68
82
  collection: e.collection,
69
83
  envVariables: e.envVariables,
70
84
  environment: e.environment,
71
85
  layout: e.layout,
72
86
  persistAuth: e.persistAuth,
73
- securitySchemeUids: m.value,
87
+ securitySchemeUids: i.value,
74
88
  server: e.server,
75
- workspace: e.workspace
76
- }, null, 8, ["collection", "envVariables", "environment", "layout", "persistAuth", "securitySchemeUids", "server", "workspace"])
89
+ workspace: e.workspace,
90
+ onAuthorized: t[0] || (t[0] = (l) => m("authorized"))
91
+ }, {
92
+ "oauth-actions": S(() => [
93
+ B(e.$slots, "oauth-actions", {}, void 0, !0)
94
+ ]),
95
+ _: 3
96
+ }, 8, ["collection", "envVariables", "environment", "layout", "persistAuth", "securitySchemeUids", "server", "workspace"])
77
97
  ]),
78
- _: 1
79
- }, 8, ["class"])) : (o(), l("div", {
98
+ _: 3
99
+ }, 8, ["class"])) : (o(), s("div", {
80
100
  key: 2,
81
- class: s([
101
+ class: a([
82
102
  "text-c-3 bg-b-1 flex min-h-16 items-center justify-center border-t px-4 text-sm",
83
103
  e.layout === "reference" && "min-h-[calc(4rem+0.5px)] rounded-b-lg border"
84
104
  ])
85
105
  }, " No authentication selected ", 2)),
86
- v(B, {
87
- scheme: b.value,
88
- state: c(u),
89
- onClose: r[0] || (r[0] = (a) => c(u).hide())
106
+ b(D, {
107
+ scheme: w.value,
108
+ state: u(d),
109
+ onClose: t[1] || (t[1] = (l) => u(d).hide())
90
110
  }, null, 8, ["scheme", "state"])
91
111
  ], 32));
92
112
  }
93
113
  });
94
114
  export {
95
- L as default
115
+ P as default
96
116
  };
@@ -29,8 +29,8 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
29
29
  onInputFocus?: (() => any) | undefined;
30
30
  onInputBlur?: (() => any) | undefined;
31
31
  }>, {
32
- readOnly: boolean;
33
32
  required: boolean;
33
+ readOnly: boolean;
34
34
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
35
35
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
36
36
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"RequestAuthDataTableInput.vue.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/RequestAuthDataTableInput.vue"],"names":[],"mappings":"AA8DA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAIrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,KAAK,WAAW,GAAG;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,WAAW,CAAA;IACxB,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,SAAS,EAAE,SAAS,CAAA;CACrB,CAAC;AAiGJ,QAAA,IAAI,QAAQ,IAAW,EAAE,QAAQ,IAAY,CAAE;AAC/C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GAC7C;IAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAyB7C,QAAA,MAAM,eAAe;;;;;;;;;;;cAjIN,OAAO;cAFP,OAAO;6EA2IpB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAa1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"RequestAuthDataTableInput.vue.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/RequestAuthDataTableInput.vue"],"names":[],"mappings":"AA8DA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAIrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,KAAK,WAAW,GAAG;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,WAAW,CAAA;IACxB,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,SAAS,EAAE,SAAS,CAAA;CACrB,CAAC;AAiGJ,QAAA,IAAI,QAAQ,IAAW,EAAE,QAAQ,IAAY,CAAE;AAC/C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GAC7C;IAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAyB7C,QAAA,MAAM,eAAe;;;;;;;;;;;cAnIN,OAAO;cAEP,OAAO;6EAyIpB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAa1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -12,6 +12,19 @@ type __VLS_Props = {
12
12
  server: Server | undefined;
13
13
  workspace: Workspace;
14
14
  };
15
- 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>;
15
+ type __VLS_Slots = {
16
+ 'oauth-actions'?: () => unknown;
17
+ };
18
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ authorized: () => any;
20
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
21
+ onAuthorized?: (() => any) | undefined;
22
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
16
24
  export default _default;
25
+ type __VLS_WithSlots<T, S> = T & {
26
+ new (): {
27
+ $slots: S;
28
+ };
29
+ };
17
30
  //# sourceMappingURL=RequestAuthTab.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RequestAuthTab.vue.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue"],"names":[],"mappings":"AAyTA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,KAAK,EACV,UAAU,EAEV,MAAM,EACP,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAOrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAU1D,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;IACxB,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,MAAM,EAAE,QAAQ,GAAG,WAAW,CAAA;IAC9B,WAAW,EAAE,OAAO,CAAA;IACpB,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,SAAS,EAAE,SAAS,CAAA;CACrB,CAAC;;AAsiBF,wBAMG"}
1
+ {"version":3,"file":"RequestAuthTab.vue.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue"],"names":[],"mappings":"AA0QA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,KAAK,EACV,UAAU,EAEV,MAAM,EACP,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAKrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAQ1D,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;IACxB,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,MAAM,EAAE,QAAQ,GAAG,WAAW,CAAA;IAC9B,WAAW,EAAE,OAAO,CAAA;IACpB,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,SAAS,EAAE,SAAS,CAAA;CACrB,CAAC;AAiBF,KAAK,WAAW,GAAG;IACjB,eAAe,CAAC,EAAE,MAAM,OAAO,CAAA;CAChC,CAAC;AAkgBF,QAAA,MAAM,eAAe;;;;kFAOnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,17 +1,16 @@
1
- import { defineComponent as F, computed as P, ref as R, onMounted as z, createElementBlock as i, openBlock as l, Fragment as s, renderList as U, createBlock as x, createCommentVNode as v, unref as d, withCtx as n, createVNode as u, createElementVNode as $, toDisplayString as A, mergeProps as V, createTextVNode as m, normalizeClass as I, capitalize as _ } from "vue";
2
- import { ScalarMarkdownSummary as D } from "@scalar/components";
3
- import { safeLocalStorage as N, CLIENT_LS_KEYS as j } from "@scalar/helpers/object/local-storage";
4
- import { isDefined as B } from "@scalar/oas-utils/helpers";
5
- import { useWorkspace as H } from "../../../../store/store.js";
6
- import { updateScheme as Q } from "../helpers/update-scheme.js";
7
- import q from "./OAuth2.vue.js";
8
- import w from "./RequestAuthDataTableInput.vue.js";
1
+ import { defineComponent as N, computed as P, ref as j, onMounted as L, createElementBlock as u, openBlock as a, Fragment as p, renderList as U, createBlock as m, createCommentVNode as v, unref as i, withCtx as l, createVNode as n, createElementVNode as C, toDisplayString as A, mergeProps as V, createTextVNode as w, normalizeClass as T, renderSlot as M, capitalize as $ } from "vue";
2
+ import { ScalarMarkdownSummary as R } from "@scalar/components";
3
+ import { useWorkspace as Q } from "../../../../store/store.js";
4
+ import { updateScheme as q } from "../helpers/update-scheme.js";
5
+ import { restoreAuthFromLocalStorage as D } from "./helpers/restore-auth-from-local-storage.js";
6
+ import E from "./OAuth2.vue.js";
7
+ import x from "./RequestAuthDataTableInput.vue.js";
9
8
  import f from "../../../../components/DataTable/DataTableRow.vue.js";
10
- import L from "../../../../components/DataTable/DataTableCell.vue.js";
11
- const J = { class: "bg-b-1 text-c-2 outline-b-3 top-0 z-1 h-full w-full overflow-hidden px-3 py-1.25 text-ellipsis group-hover/auth:absolute group-hover/auth:h-auto group-hover/auth:border-b *:first:line-clamp-1 *:first:text-ellipsis group-hover/auth:*:first:line-clamp-none" }, Y = {
9
+ import z from "../../../../components/DataTable/DataTableCell.vue.js";
10
+ const O = { class: "bg-b-1 text-c-2 outline-b-3 top-0 z-1 h-full w-full overflow-hidden px-3 py-1.25 text-ellipsis group-hover/auth:absolute group-hover/auth:h-auto group-hover/auth:border-b *:first:line-clamp-1 *:first:text-ellipsis group-hover/auth:*:first:line-clamp-none" }, H = {
12
11
  key: 0,
13
12
  class: "flex min-h-8 border-t text-base"
14
- }, W = { class: "flex h-8 max-w-full gap-2.5 overflow-x-auto px-3" }, G = ["onClick"], X = { class: "relative z-10" }, ie = /* @__PURE__ */ F({
13
+ }, W = { class: "flex h-8 max-w-full gap-2.5 overflow-x-auto px-3" }, G = ["onClick"], J = { class: "relative z-10" }, le = /* @__PURE__ */ N({
15
14
  __name: "RequestAuthTab",
16
15
  props: {
17
16
  collection: {},
@@ -23,79 +22,57 @@ const J = { class: "bg-b-1 text-c-2 outline-b-3 top-0 z-1 h-full w-full overflow
23
22
  server: {},
24
23
  workspace: {}
25
24
  },
26
- setup(b) {
27
- const C = H(), { collectionMutators: M, securitySchemes: g, securitySchemeMutators: O } = C, S = P(
25
+ emits: ["authorized"],
26
+ setup(b, { emit: B }) {
27
+ const F = B, c = Q(), { securitySchemes: I } = c, _ = P(
28
28
  () => b.securitySchemeUids.map((t) => ({
29
- scheme: g[t]
29
+ scheme: I[t]
30
30
  }))
31
- ), p = R(""), T = (t) => {
32
- const r = t.description ? `: ${t.description}` : "", e = `${_(t.nameKey)}${r || `: ${t.type}`}`;
31
+ ), d = j(""), S = (t) => {
32
+ const o = t.description ? `: ${t.description}` : "", e = `${$(t.nameKey)}${o || `: ${t.type}`}`;
33
33
  if (t.type === "apiKey")
34
- return `${_(t.nameKey)}${r || `: ${t.in}`}`;
34
+ return `${$(t.nameKey)}${o || `: ${t.in}`}`;
35
35
  if (t.type === "oauth2") {
36
- const o = Object.values(t.flows ?? {})[0];
37
- return `${_(t.nameKey)}: ${p.value ? p.value : (o == null ? void 0 : o.type) ?? ""}${r}`;
36
+ const r = Object.values(t.flows ?? {})[0];
37
+ return `${$(t.nameKey)}: ${d.value ? d.value : (r == null ? void 0 : r.type) ?? ""}${o}`;
38
38
  }
39
- return t.type === "http" ? `${_(t.nameKey)}: ${t.scheme}${r}` : `${e}${r}`;
40
- }, k = (t, r, e) => {
41
- Q(t, r, e, C, b.persistAuth);
39
+ return t.type === "http" ? `${$(t.nameKey)}: ${t.scheme}${o}` : `${e}${o}`;
40
+ }, k = (t, o, e) => {
41
+ q(t, o, e, c, b.persistAuth);
42
42
  };
43
- z(() => {
44
- if (!b.persistAuth)
45
- return;
46
- const t = JSON.parse(
47
- N().getItem(j.AUTH) ?? "{}"
48
- ), r = Object.keys(g).reduce(
49
- (e, o) => {
50
- const a = g[o];
51
- return a && (e[a.nameKey] = a.uid), e;
52
- },
53
- {}
54
- );
55
- Object.entries(t).forEach(([e, o]) => {
56
- const a = r[e];
57
- a && Object.entries(o).forEach(([E, K]) => {
58
- O.edit(a, E, K);
59
- });
60
- });
61
- try {
62
- const o = JSON.parse(
63
- N().getItem(j.SELECTED_SECURITY_SCHEMES) ?? ""
64
- ).map((a) => Array.isArray(a) ? a.map((y) => r[y]).filter(B) : r[a]).filter(B);
65
- M.edit(b.collection.uid, "selectedSecuritySchemeUids", o);
66
- } catch {
67
- }
43
+ L(() => {
44
+ b.persistAuth && D(c, b.collection.uid);
68
45
  });
69
- const c = {
46
+ const y = {
70
47
  environment: b.environment,
71
48
  envVariables: b.envVariables,
72
49
  workspace: b.workspace
73
50
  };
74
- return (t, r) => (l(!0), i(s, null, U(S.value, ({ scheme: e }) => (l(), i(s, {
51
+ return (t, o) => (a(!0), u(p, null, U(_.value, ({ scheme: e }) => (a(), u(p, {
75
52
  key: e == null ? void 0 : e.uid
76
53
  }, [
77
- S.value.length > 1 && e ? (l(), x(d(f), { key: 0 }, {
78
- default: n(() => [
79
- u(d(L), {
80
- "aria-label": T(e),
54
+ _.value.length > 1 && e ? (a(), m(i(f), { key: 0 }, {
55
+ default: l(() => [
56
+ n(i(z), {
57
+ "aria-label": S(e),
81
58
  class: "text-c-2 group/auth flex items-center leading-[22px] whitespace-nowrap outline-none hover:whitespace-normal"
82
59
  }, {
83
- default: n(() => [
84
- $("p", J, A(T(e)), 1)
60
+ default: l(() => [
61
+ C("p", O, A(S(e)), 1)
85
62
  ]),
86
63
  _: 2
87
64
  }, 1032, ["aria-label"])
88
65
  ]),
89
66
  _: 2
90
67
  }, 1024)) : v("", !0),
91
- e != null && e.description && S.value.length <= 1 ? (l(), x(d(f), { key: 1 }, {
92
- default: n(() => [
93
- u(d(L), {
94
- class: "max-h-[auto]",
95
- "aria-label": e.description
68
+ e != null && e.description && _.value.length <= 1 ? (a(), m(i(f), { key: 1 }, {
69
+ default: l(() => [
70
+ n(i(z), {
71
+ "aria-label": e.description,
72
+ class: "max-h-[auto]"
96
73
  }, {
97
- default: n(() => [
98
- u(d(D), {
74
+ default: l(() => [
75
+ n(i(R), {
99
76
  class: "auth-description bg-b-1 text-c-2 min-w-0 flex-1 px-3 py-1.25",
100
77
  value: e.description
101
78
  }, null, 8, ["value"])
@@ -105,137 +82,143 @@ const J = { class: "bg-b-1 text-c-2 outline-b-3 top-0 z-1 h-full w-full overflow
105
82
  ]),
106
83
  _: 2
107
84
  }, 1024)) : v("", !0),
108
- (e == null ? void 0 : e.type) === "http" ? (l(), i(s, { key: 2 }, [
109
- e.scheme === "bearer" ? (l(), x(d(f), { key: 0 }, {
110
- default: n(() => [
111
- u(w, V({ ref_for: !0 }, c, {
85
+ (e == null ? void 0 : e.type) === "http" ? (a(), u(p, { key: 2 }, [
86
+ e.scheme === "bearer" ? (a(), m(i(f), { key: 0 }, {
87
+ default: l(() => [
88
+ n(x, V({ ref_for: !0 }, y, {
112
89
  containerClass: t.layout === "reference" && "border-t",
113
90
  modelValue: e.token,
114
91
  placeholder: "Token",
115
92
  type: "password",
116
- "onUpdate:modelValue": (o) => k(e.uid, "token", o)
93
+ "onUpdate:modelValue": (r) => k(e.uid, "token", r)
117
94
  }), {
118
- default: n(() => r[0] || (r[0] = [
119
- m(" Bearer Token ")
95
+ default: l(() => o[1] || (o[1] = [
96
+ w(" Bearer Token ")
120
97
  ])),
121
98
  _: 2,
122
- __: [0]
99
+ __: [1]
123
100
  }, 1040, ["containerClass", "modelValue", "onUpdate:modelValue"])
124
101
  ]),
125
102
  _: 2
126
- }, 1024)) : (e == null ? void 0 : e.scheme) === "basic" ? (l(), i(s, { key: 1 }, [
127
- u(d(f), null, {
128
- default: n(() => [
129
- u(w, V({ ref_for: !0 }, c, {
103
+ }, 1024)) : (e == null ? void 0 : e.scheme) === "basic" ? (a(), u(p, { key: 1 }, [
104
+ n(i(f), null, {
105
+ default: l(() => [
106
+ n(x, V({ ref_for: !0 }, y, {
130
107
  class: "text-c-2",
131
108
  modelValue: e.username,
132
109
  placeholder: "janedoe",
133
110
  required: "",
134
- "onUpdate:modelValue": (o) => k(e.uid, "username", o)
111
+ "onUpdate:modelValue": (r) => k(e.uid, "username", r)
135
112
  }), {
136
- default: n(() => r[1] || (r[1] = [
137
- m(" Username ")
113
+ default: l(() => o[2] || (o[2] = [
114
+ w(" Username ")
138
115
  ])),
139
116
  _: 2,
140
- __: [1]
117
+ __: [2]
141
118
  }, 1040, ["modelValue", "onUpdate:modelValue"])
142
119
  ]),
143
120
  _: 2
144
121
  }, 1024),
145
- u(d(f), null, {
146
- default: n(() => [
147
- u(w, V({ ref_for: !0 }, c, {
122
+ n(i(f), null, {
123
+ default: l(() => [
124
+ n(x, V({ ref_for: !0 }, y, {
148
125
  modelValue: e.password,
149
126
  placeholder: "********",
150
127
  type: "password",
151
- "onUpdate:modelValue": (o) => k(e.uid, "password", o)
128
+ "onUpdate:modelValue": (r) => k(e.uid, "password", r)
152
129
  }), {
153
- default: n(() => r[2] || (r[2] = [
154
- m(" Password ")
130
+ default: l(() => o[3] || (o[3] = [
131
+ w(" Password ")
155
132
  ])),
156
133
  _: 2,
157
- __: [2]
134
+ __: [3]
158
135
  }, 1040, ["modelValue", "onUpdate:modelValue"])
159
136
  ]),
160
137
  _: 2
161
138
  }, 1024)
162
139
  ], 64)) : v("", !0)
163
- ], 64)) : (e == null ? void 0 : e.type) === "apiKey" ? (l(), i(s, { key: 3 }, [
164
- u(d(f), null, {
165
- default: n(() => [
166
- u(w, V({ ref_for: !0 }, c, {
140
+ ], 64)) : (e == null ? void 0 : e.type) === "apiKey" ? (a(), u(p, { key: 3 }, [
141
+ n(i(f), null, {
142
+ default: l(() => [
143
+ n(x, V({ ref_for: !0 }, y, {
167
144
  containerClass: t.layout === "reference" && "border-t",
168
145
  modelValue: e.name,
169
146
  placeholder: "api-key",
170
- "onUpdate:modelValue": (o) => k(e.uid, "name", o)
147
+ "onUpdate:modelValue": (r) => k(e.uid, "name", r)
171
148
  }), {
172
- default: n(() => r[3] || (r[3] = [
173
- m(" Name ")
149
+ default: l(() => o[4] || (o[4] = [
150
+ w(" Name ")
174
151
  ])),
175
152
  _: 2,
176
- __: [3]
153
+ __: [4]
177
154
  }, 1040, ["containerClass", "modelValue", "onUpdate:modelValue"])
178
155
  ]),
179
156
  _: 2
180
157
  }, 1024),
181
- u(d(f), null, {
182
- default: n(() => [
183
- u(w, V({ ref_for: !0 }, c, {
158
+ n(i(f), null, {
159
+ default: l(() => [
160
+ n(x, V({ ref_for: !0 }, y, {
184
161
  modelValue: e.value,
185
162
  placeholder: "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT",
186
163
  type: "password",
187
- "onUpdate:modelValue": (o) => k(e.uid, "value", o)
164
+ "onUpdate:modelValue": (r) => k(e.uid, "value", r)
188
165
  }), {
189
- default: n(() => r[4] || (r[4] = [
190
- m(" Value ")
166
+ default: l(() => o[5] || (o[5] = [
167
+ w(" Value ")
191
168
  ])),
192
169
  _: 2,
193
- __: [4]
170
+ __: [5]
194
171
  }, 1040, ["modelValue", "onUpdate:modelValue"])
195
172
  ]),
196
173
  _: 2
197
174
  }, 1024)
198
- ], 64)) : (e == null ? void 0 : e.type) === "oauth2" ? (l(), i(s, { key: 4 }, [
199
- u(d(f), null, {
200
- default: n(() => [
201
- Object.keys(e.flows).length > 1 ? (l(), i("div", Y, [
202
- $("div", W, [
203
- (l(!0), i(s, null, U(e == null ? void 0 : e.flows, (o, a, y) => (l(), i("button", {
204
- key: a,
205
- class: I(["floating-bg text-c-3 relative cursor-pointer border-b-[1px] border-transparent py-1 text-base font-medium", {
206
- "!text-c-1 !rounded-none border-b-[1px] !border-current": t.layout !== "reference" && (p.value === a || y === 0 && !p.value),
207
- "!text-c-1 !rounded-none border-b-[1px] !border-current opacity-100": t.layout === "reference" && (p.value === a || y === 0 && !p.value)
175
+ ], 64)) : (e == null ? void 0 : e.type) === "oauth2" ? (a(), u(p, { key: 4 }, [
176
+ n(i(f), null, {
177
+ default: l(() => [
178
+ Object.keys(e.flows).length > 1 ? (a(), u("div", H, [
179
+ C("div", W, [
180
+ (a(!0), u(p, null, U(e == null ? void 0 : e.flows, (r, s, g) => (a(), u("button", {
181
+ key: s,
182
+ class: T(["floating-bg text-c-3 relative cursor-pointer border-b-[1px] border-transparent py-1 text-base font-medium", {
183
+ "!text-c-1 !rounded-none border-b-[1px] !border-current": t.layout !== "reference" && (d.value === s || g === 0 && !d.value),
184
+ "!text-c-1 !rounded-none border-b-[1px] !border-current opacity-100": t.layout === "reference" && (d.value === s || g === 0 && !d.value)
208
185
  }]),
209
186
  type: "button",
210
- onClick: (E) => p.value = a
187
+ onClick: (K) => d.value = s
211
188
  }, [
212
- $("span", X, A(a), 1)
189
+ C("span", J, A(s), 1)
213
190
  ], 10, G))), 128))
214
191
  ])
215
192
  ])) : v("", !0)
216
193
  ]),
217
194
  _: 2
218
195
  }, 1024),
219
- (l(!0), i(s, null, U(e == null ? void 0 : e.flows, (o, a, y) => (l(), i(s, { key: a }, [
220
- p.value === a || y === 0 && !p.value ? (l(), x(q, V({
196
+ (a(!0), u(p, null, U(e == null ? void 0 : e.flows, (r, s, g) => (a(), u(p, { key: s }, [
197
+ d.value === s || g === 0 && !d.value ? (a(), m(E, V({
221
198
  key: 0,
222
199
  ref_for: !0
223
- }, c, {
200
+ }, y, {
224
201
  collection: t.collection,
225
- flow: o,
202
+ flow: r,
226
203
  persistAuth: t.persistAuth,
227
204
  scheme: e,
228
205
  server: t.server,
229
- workspace: t.workspace
230
- }), null, 16, ["collection", "flow", "persistAuth", "scheme", "server", "workspace"])) : v("", !0)
206
+ workspace: t.workspace,
207
+ onAuthorized: o[0] || (o[0] = (K) => F("authorized"))
208
+ }), {
209
+ "oauth-actions": l(() => [
210
+ M(t.$slots, "oauth-actions")
211
+ ]),
212
+ _: 2
213
+ }, 1040, ["collection", "flow", "persistAuth", "scheme", "server", "workspace"])) : v("", !0)
231
214
  ], 64))), 128))
232
- ], 64)) : (e == null ? void 0 : e.type) === "openIdConnect" ? (l(), i("div", {
215
+ ], 64)) : (e == null ? void 0 : e.type) === "openIdConnect" ? (a(), u("div", {
233
216
  key: 5,
234
- class: I(["text-c-3 bg-b-1 flex min-h-[calc(4rem+1px)] items-center justify-center border-t border-b-0 px-4 text-base", { "rounded-b-lg": t.layout === "reference" }])
217
+ class: T(["text-c-3 bg-b-1 flex min-h-[calc(4rem+1px)] items-center justify-center border-t border-b-0 px-4 text-base", { "rounded-b-lg": t.layout === "reference" }])
235
218
  }, " Coming soon ", 2)) : v("", !0)
236
219
  ], 64))), 128));
237
220
  }
238
221
  });
239
222
  export {
240
- ie as default
223
+ le as default
241
224
  };
@@ -0,0 +1,9 @@
1
+ import type { WorkspaceStore } from '../../../../../store/store.js';
2
+ /**
3
+ * Manually restore the auth from local storage
4
+ *
5
+ * Only use this if you need to restore auth manually, in the client web + app we load the whole store from
6
+ * local storage so it isn't needed there.
7
+ */
8
+ export declare const restoreAuthFromLocalStorage: (store: WorkspaceStore, collectionUid: string) => void;
9
+ //# sourceMappingURL=restore-auth-from-local-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restore-auth-from-local-storage.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Request/RequestSection/RequestAuth/helpers/restore-auth-from-local-storage.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAGnD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,cAAc,EAAE,eAAe,MAAM,SAgDvF,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { isDefined as i } from "@scalar/helpers/array/is-defined";
2
+ import { safeLocalStorage as n, CLIENT_LS_KEYS as S } from "@scalar/helpers/object/local-storage";
3
+ const O = (a, d) => {
4
+ try {
5
+ const { collectionMutators: c, securitySchemes: o, securitySchemeMutators: m } = a, u = JSON.parse(n().getItem(S.AUTH) ?? "{}"), s = Object.keys(o).reduce(
6
+ (e, r) => {
7
+ const t = o[r];
8
+ return t && (e[t.nameKey] = t.uid), e;
9
+ },
10
+ {}
11
+ );
12
+ Object.entries(u).forEach(([e, r]) => {
13
+ const t = s[e];
14
+ t && Object.entries(r).forEach(([h, l]) => {
15
+ m.edit(t, h, l);
16
+ });
17
+ });
18
+ const f = JSON.parse(
19
+ n().getItem(S.SELECTED_SECURITY_SCHEMES) ?? "[]"
20
+ ).map((e) => Array.isArray(e) ? e.map((r) => s[r]).filter(i) : s[e]).filter(i);
21
+ c.edit(d, "selectedSecuritySchemeUids", f);
22
+ } catch (c) {
23
+ console.error(c);
24
+ }
25
+ };
26
+ export {
27
+ O as restoreAuthFromLocalStorage
28
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=restore-auth-from-local-storage.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restore-auth-from-local-storage.test.d.ts","sourceRoot":"","sources":["../../../../../../src/views/Request/RequestSection/RequestAuth/helpers/restore-auth-from-local-storage.test.ts"],"names":[],"mappings":""}
@@ -1,3 +1,5 @@
1
- export { default as RequestAuthDataTable } from './RequestAuthDataTable.vue.js';
1
+ /** biome-ignore-all lint/performance/noBarrelFile: these are exported publicly */
2
+ export { restoreAuthFromLocalStorage } from './helpers/restore-auth-from-local-storage.js';
2
3
  export { default as RequestAuth } from './RequestAuth.vue.js';
4
+ export { default as RequestAuthDataTable } from './RequestAuthDataTable.vue.js';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAC5E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAA;AACvF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAA"}