@scalar/api-client 2.22.1 → 2.22.2
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.
- package/CHANGELOG.md +50 -0
- package/dist/hooks/useClientConfig.d.ts +6 -3
- package/dist/hooks/useClientConfig.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +2 -2
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +23 -29
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +45 -43
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +0 -6
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
- package/dist/v2/components/code-input/CodeInput.vue2.js +50 -63
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts +0 -3
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +55 -53
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +33 -28
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue2.js +137 -127
- package/dist/v2/features/command-palette/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/TheCommandPalette.vue.js +1 -1
- package/dist/v2/features/command-palette/TheCommandPalette.vue2.js +6 -6
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +2 -2
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +60 -56
- package/dist/v2/features/operation/Operation.vue.js +1 -1
- package/dist/v2/features/search/hooks/use-search-index.d.ts +3 -7
- package/dist/v2/features/search/hooks/use-search-index.d.ts.map +1 -1
- package/dist/v2/features/search/hooks/use-search-index.js +12 -18
- package/dist/v2/features/search/index.d.ts +1 -2
- package/dist/v2/features/search/index.d.ts.map +1 -1
- package/dist/v2/features/search/index.js +2 -4
- package/dist/v2/features/search/types.d.ts +1 -1
- package/dist/v2/features/search/types.d.ts.map +1 -1
- package/dist/v2/helpers/handle-hotkeys.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
- package/dist/views/Request/libs/oauth2.js +54 -52
- package/package.json +17 -17
- package/dist/v2/features/search/components/SearchButton.vue.d.ts +0 -12
- package/dist/v2/features/search/components/SearchButton.vue.d.ts.map +0 -1
- package/dist/v2/features/search/components/SearchButton.vue.js +0 -71
- package/dist/v2/features/search/components/SearchButton.vue2.js +0 -4
- package/dist/v2/features/search/components/SearchModal.vue.d.ts +0 -11
- package/dist/v2/features/search/components/SearchModal.vue.d.ts.map +0 -1
- package/dist/v2/features/search/components/SearchModal.vue.js +0 -7
- package/dist/v2/features/search/components/SearchModal.vue2.js +0 -102
- package/dist/v2/features/search/components/SearchResult.vue.d.ts +0 -10
- package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +0 -1
- package/dist/v2/features/search/components/SearchResult.vue.js +0 -80
- package/dist/v2/features/search/components/SearchResult.vue2.js +0 -4
|
@@ -1,61 +1,65 @@
|
|
|
1
|
-
import { useModal as
|
|
2
|
-
import { ScalarIconArrowSquareIn as
|
|
3
|
-
import
|
|
4
|
-
import { ref as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { useModal as k } from "@scalar/components";
|
|
2
|
+
import { ScalarIconArrowSquareIn as y, ScalarIconPackage as _, ScalarIconFolder as P, ScalarIconArrowUpRight as A, ScalarIconPuzzlePiece as R, ScalarIconBracketsCurly as b, ScalarIconCookie as q, ScalarIconSlidersHorizontal as L } from "@scalar/icons";
|
|
3
|
+
import d from "fuse.js";
|
|
4
|
+
import { ref as p, shallowRef as $, computed as o, toValue as a } from "vue";
|
|
5
|
+
import x from "../components/CommandPaletteDocument.vue.js";
|
|
6
|
+
import z from "../components/CommandPaletteExample.vue.js";
|
|
7
|
+
import F from "../components/CommandPaletteImport.vue.js";
|
|
8
|
+
import U from "../components/CommandPaletteImportCurl.vue.js";
|
|
9
|
+
import E from "../components/CommandPaletteRequest.vue.js";
|
|
10
|
+
import O from "../components/CommandPaletteTag.vue.js";
|
|
11
|
+
const W = (m = B, l = Q) => {
|
|
12
|
+
const c = k(), n = p(""), s = $(null), i = p(null), f = o(() => c.open), v = o(
|
|
13
|
+
() => new d(a(m), {
|
|
14
|
+
keys: ["name"],
|
|
15
|
+
threshold: 0.1
|
|
16
|
+
})
|
|
17
|
+
), C = o(
|
|
18
|
+
() => new d(a(l), {
|
|
19
|
+
keys: ["name"],
|
|
20
|
+
threshold: 0.1
|
|
21
|
+
})
|
|
22
|
+
), S = o(() => {
|
|
19
23
|
const e = n.value.toLowerCase().trim();
|
|
20
|
-
return (e ?
|
|
21
|
-
}),
|
|
24
|
+
return (e ? v.value.search(e).map((t) => t.item) : a(m)).filter((t) => !t.hidden);
|
|
25
|
+
}), w = o(() => {
|
|
22
26
|
const e = n.value.toLowerCase().trim();
|
|
23
|
-
return e ?
|
|
24
|
-
}),
|
|
25
|
-
e && (
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
},
|
|
27
|
+
return e ? C.value.search(e).map((r) => r.item) : a(l);
|
|
28
|
+
}), g = (e, ...r) => {
|
|
29
|
+
e && (s.value = a(m).find((t) => t.id === e) ?? null, i.value = r[0] ?? null), c.show();
|
|
30
|
+
}, h = () => {
|
|
31
|
+
c.hide(), u();
|
|
32
|
+
}, I = (e) => {
|
|
29
33
|
n.value = e;
|
|
30
|
-
},
|
|
31
|
-
n.value = "",
|
|
34
|
+
}, u = () => {
|
|
35
|
+
n.value = "", s.value = null, i.value = null;
|
|
32
36
|
};
|
|
33
37
|
return {
|
|
34
|
-
isOpen:
|
|
35
|
-
activeCommand:
|
|
36
|
-
activeCommandProps:
|
|
38
|
+
isOpen: f,
|
|
39
|
+
activeCommand: s,
|
|
40
|
+
activeCommandProps: i,
|
|
37
41
|
filterQuery: n,
|
|
38
|
-
filteredCommands:
|
|
42
|
+
filteredCommands: o(() => [
|
|
39
43
|
{
|
|
40
44
|
label: "",
|
|
41
|
-
commands:
|
|
45
|
+
commands: S.value
|
|
42
46
|
},
|
|
43
47
|
{
|
|
44
48
|
label: "Pages",
|
|
45
|
-
commands:
|
|
49
|
+
commands: w.value
|
|
46
50
|
}
|
|
47
51
|
]),
|
|
48
|
-
open:
|
|
49
|
-
close:
|
|
50
|
-
setFilterQuery:
|
|
51
|
-
reset:
|
|
52
|
+
open: g,
|
|
53
|
+
close: h,
|
|
54
|
+
setFilterQuery: I,
|
|
55
|
+
reset: u
|
|
52
56
|
};
|
|
53
|
-
},
|
|
57
|
+
}, Q = [
|
|
54
58
|
{
|
|
55
59
|
type: "route",
|
|
56
60
|
id: "environment",
|
|
57
61
|
name: "Environment",
|
|
58
|
-
icon:
|
|
62
|
+
icon: b,
|
|
59
63
|
to: {
|
|
60
64
|
name: "workspace.environment"
|
|
61
65
|
}
|
|
@@ -73,51 +77,51 @@ const V = (a = Q, i = O) => {
|
|
|
73
77
|
type: "route",
|
|
74
78
|
id: "settings",
|
|
75
79
|
name: "Settings",
|
|
76
|
-
icon:
|
|
80
|
+
icon: L,
|
|
77
81
|
to: {
|
|
78
82
|
name: "workspace.settings"
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
|
-
],
|
|
85
|
+
], B = [
|
|
82
86
|
{
|
|
83
87
|
id: "import-from-openapi-swagger-postman-curl",
|
|
84
88
|
name: "Import from OpenAPI/Swagger/Postman/cURL",
|
|
85
|
-
component:
|
|
86
|
-
icon:
|
|
89
|
+
component: F,
|
|
90
|
+
icon: y
|
|
87
91
|
},
|
|
88
92
|
{
|
|
89
93
|
id: "create-document",
|
|
90
94
|
name: "Create Document",
|
|
91
|
-
component:
|
|
92
|
-
icon:
|
|
95
|
+
component: x,
|
|
96
|
+
icon: _
|
|
93
97
|
},
|
|
94
98
|
{
|
|
95
99
|
id: "add-tag",
|
|
96
100
|
name: "Add Tag",
|
|
97
|
-
component:
|
|
98
|
-
icon:
|
|
101
|
+
component: O,
|
|
102
|
+
icon: P
|
|
99
103
|
},
|
|
100
104
|
{
|
|
101
105
|
id: "create-request",
|
|
102
106
|
name: "Create Request",
|
|
103
|
-
component:
|
|
104
|
-
icon:
|
|
107
|
+
component: E,
|
|
108
|
+
icon: A
|
|
105
109
|
},
|
|
106
110
|
{
|
|
107
111
|
id: "add-example",
|
|
108
112
|
name: "Add Example",
|
|
109
|
-
component:
|
|
110
|
-
icon:
|
|
113
|
+
component: z,
|
|
114
|
+
icon: R
|
|
111
115
|
},
|
|
112
116
|
{
|
|
113
117
|
id: "import-curl-command",
|
|
114
118
|
name: "Import cURL Command",
|
|
115
119
|
hidden: !0,
|
|
116
|
-
component:
|
|
120
|
+
component: U
|
|
117
121
|
}
|
|
118
122
|
];
|
|
119
123
|
export {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
124
|
+
B as baseClientActions,
|
|
125
|
+
Q as baseRoutes,
|
|
126
|
+
W as useCommandPaletteState
|
|
123
127
|
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
2
|
import { type MaybeRefOrGetter } from 'vue';
|
|
3
|
-
import type { FuseData } from '../types';
|
|
4
3
|
/**
|
|
5
|
-
* Creates the search index from
|
|
4
|
+
* Creates the search index from multiple OpenAPI documents
|
|
6
5
|
*/
|
|
7
|
-
export declare
|
|
8
|
-
results: import("vue").ComputedRef<
|
|
9
|
-
item: FuseData;
|
|
10
|
-
refIndex: number;
|
|
11
|
-
}[]>;
|
|
6
|
+
export declare const useSearchIndex: (documents: MaybeRefOrGetter<OpenApiDocument[]>) => {
|
|
7
|
+
results: import("vue").ComputedRef<import("@scalar/workspace-store/schemas/navigation").TraversedEntry[] | null>;
|
|
12
8
|
query: import("vue").Ref<string, string>;
|
|
13
9
|
};
|
|
14
10
|
//# sourceMappingURL=use-search-index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-search-index.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/search/hooks/use-search-index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-search-index.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/search/hooks/use-search-index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AACnG,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,KAAK,CAAA;AAOnE;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,gBAAgB,CAAC,eAAe,EAAE,CAAC;;;CAiC5E,CAAA"}
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
import { computed as n, toValue as
|
|
2
|
-
import { createFuseInstance as
|
|
3
|
-
import { createSearchIndex as
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}), e = a("");
|
|
1
|
+
import { computed as n, toValue as o, ref as c } from "vue";
|
|
2
|
+
import { createFuseInstance as a } from "../helpers/create-fuse-instance.js";
|
|
3
|
+
import { createSearchIndex as l } from "../helpers/create-search-index.js";
|
|
4
|
+
const i = 25, h = (s) => {
|
|
5
|
+
const u = n(() => {
|
|
6
|
+
const t = a();
|
|
7
|
+
return t.setCollection(l(o(s))), t;
|
|
8
|
+
}), e = c("");
|
|
10
9
|
return {
|
|
11
|
-
results: n(() => e.value.length !== 0 ?
|
|
12
|
-
limit:
|
|
13
|
-
})
|
|
14
|
-
(c, u) => ({
|
|
15
|
-
item: c,
|
|
16
|
-
refIndex: u
|
|
17
|
-
})
|
|
18
|
-
)),
|
|
10
|
+
results: n(() => e.value.length !== 0 ? u.value.search(e.value, {
|
|
11
|
+
limit: i
|
|
12
|
+
}).flatMap((r) => r.item.entry.type !== "operation" ? [] : r.item.entry) : null),
|
|
19
13
|
query: e
|
|
20
14
|
};
|
|
21
|
-
}
|
|
15
|
+
};
|
|
22
16
|
export {
|
|
23
17
|
h as useSearchIndex
|
|
24
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { default as t } from "./components/SearchModal.vue.js";
|
|
1
|
+
import { useSearchIndex as o } from "./hooks/use-search-index.js";
|
|
3
2
|
export {
|
|
4
|
-
o as
|
|
5
|
-
t as SearchModal
|
|
3
|
+
o as useSearchIndex
|
|
6
4
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/search/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/search/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAEhF,KAAK,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,KAAK,CAAA;AAEhD,KAAK,QAAQ,GAAG;IACd,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,SAAS,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,cAAc,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,KAAK,aAAa,GAAG,QAAQ,GAAG;IAC9B,IAAI,EAAE,WAAW,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,KAAK,WAAW,GAAG,QAAQ,GAAG;IAC5B,IAAI,EAAE,SAAS,CAAA;CAChB,CAAA;AAED,KAAK,OAAO,GAAG,QAAQ,GAAG;IACxB,IAAI,EAAE,KAAK,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,WAAW,GAAG,OAAO,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { isMacOS as f } from "@scalar/helpers/general/is-mac-os";
|
|
|
2
2
|
const r = {
|
|
3
3
|
Enter: { event: "operation:send:request:hotkey", modifiers: ["default"] },
|
|
4
4
|
b: { event: "ui:toggle:sidebar", modifiers: ["default"] },
|
|
5
|
-
|
|
5
|
+
k: { event: "ui:open:command-palette", modifiers: ["default"] },
|
|
6
6
|
l: { event: "ui:focus:address-bar", modifiers: ["default"] }
|
|
7
7
|
}, n = {
|
|
8
8
|
web: r,
|
|
@@ -33,7 +33,7 @@ const W = { class: "flex-center relative flex flex-1 flex-col gap-6 p-2 capitali
|
|
|
33
33
|
}));
|
|
34
34
|
}, f = (u) => {
|
|
35
35
|
u?.createNew && g.name === "request" && p();
|
|
36
|
-
}, v = "2.22.
|
|
36
|
+
}, v = "2.22.2";
|
|
37
37
|
return q(() => a.hotKeys.on(f)), R(() => a.hotKeys.off(f)), (u, e) => (l(), n("div", W, [
|
|
38
38
|
s("div", {
|
|
39
39
|
class: y(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth2.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/libs/oauth2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth2.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/libs/oauth2.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAGzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,qDAAqD;AACrD,KAAK,eAAe,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,CAAA;AAEhE,KAAK,SAAS,GAAG;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAA;AA8BD;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAU,UAAU,MAAM,EAAE,UAAU,SAAS,GAAG,OAAO,KAAG,OAAO,CAAC,MAAM,CAkB3G,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,UAAU;AAChB,wEAAwE;AACxE,cAAc,MAAM;AACpB,kCAAkC;AAClC,WAAW,MAAM,KAChB,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CA0K/B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,MAAM,eAAe,EACrB,QAAQ,MAAM,EACd,2BAIG;IACD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC9B,YAAK,EACN,cAAc,MAAM,GAAG,SAAS,KAC/B,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CA2F/B,CAAA"}
|
|
@@ -1,113 +1,115 @@
|
|
|
1
|
+
import { isRelativePath as U } from "@scalar/helpers/url/is-relative-path";
|
|
1
2
|
import { makeUrlAbsolute as x } from "@scalar/helpers/url/make-url-absolute";
|
|
2
|
-
import { shouldUseProxy as
|
|
3
|
-
import { encode as
|
|
4
|
-
const
|
|
3
|
+
import { shouldUseProxy as f } from "@scalar/helpers/url/redirect-to-proxy";
|
|
4
|
+
import { encode as A, fromUint8Array as k } from "js-base64";
|
|
5
|
+
const w = (e) => {
|
|
6
|
+
const a = e?.url;
|
|
7
|
+
return a ? U(a) ? typeof window > "u" ? {} : { basePath: a } : { baseUrl: a } : {};
|
|
8
|
+
}, b = () => {
|
|
5
9
|
const e = new Uint8Array(32);
|
|
6
|
-
return crypto.getRandomValues(e),
|
|
7
|
-
},
|
|
8
|
-
if (
|
|
10
|
+
return crypto.getRandomValues(e), k(e, !0);
|
|
11
|
+
}, E = async (e, a) => {
|
|
12
|
+
if (a === "plain")
|
|
9
13
|
return e;
|
|
10
14
|
if (typeof crypto?.subtle?.digest != "function")
|
|
11
15
|
return console.warn("SHA-256 is only supported when using https, using a plain text code challenge instead."), e;
|
|
12
|
-
const
|
|
13
|
-
return
|
|
14
|
-
},
|
|
16
|
+
const c = new TextEncoder().encode(e), o = await crypto.subtle.digest("SHA-256", c);
|
|
17
|
+
return k(new Uint8Array(o), !0);
|
|
18
|
+
}, $ = async (e, a, u) => {
|
|
15
19
|
try {
|
|
16
20
|
if (!e)
|
|
17
21
|
return [new Error("Flow not found"), null];
|
|
18
|
-
const
|
|
22
|
+
const c = e.selectedScopes.join(" ");
|
|
19
23
|
if (e.type === "clientCredentials" || e.type === "password")
|
|
20
|
-
return
|
|
24
|
+
return S(
|
|
21
25
|
e,
|
|
22
|
-
|
|
26
|
+
c,
|
|
23
27
|
{
|
|
24
28
|
proxyUrl: u
|
|
25
29
|
},
|
|
26
|
-
|
|
30
|
+
a
|
|
27
31
|
);
|
|
28
|
-
const o = (Math.random() + 1).toString(36).substring(2, 10), _ = x(e.authorizationUrl,
|
|
29
|
-
baseUrl: c?.url
|
|
30
|
-
}), t = new URL(_);
|
|
32
|
+
const o = (Math.random() + 1).toString(36).substring(2, 10), _ = x(e.authorizationUrl, w(a)), t = new URL(_);
|
|
31
33
|
let y = null;
|
|
32
34
|
if (e.type === "implicit")
|
|
33
35
|
t.searchParams.set("response_type", "token");
|
|
34
36
|
else if (e.type === "authorizationCode" && (t.searchParams.set("response_type", "code"), e["x-usePkce"] !== "no")) {
|
|
35
|
-
const r =
|
|
37
|
+
const r = b(), s = await E(r, e["x-usePkce"]);
|
|
36
38
|
y = {
|
|
37
39
|
codeVerifier: r,
|
|
38
|
-
codeChallenge:
|
|
40
|
+
codeChallenge: s,
|
|
39
41
|
codeChallengeMethod: e["x-usePkce"] === "SHA-256" ? "S256" : "plain"
|
|
40
|
-
}, t.searchParams.set("code_challenge",
|
|
42
|
+
}, t.searchParams.set("code_challenge", s), t.searchParams.set("code_challenge_method", y.codeChallengeMethod);
|
|
41
43
|
}
|
|
42
44
|
if (e["x-scalar-redirect-uri"].startsWith("/")) {
|
|
43
|
-
const r =
|
|
44
|
-
t.searchParams.set("redirect_uri",
|
|
45
|
+
const r = a?.url || window.location.origin + window.location.pathname, s = x(e["x-scalar-redirect-uri"], { baseUrl: r });
|
|
46
|
+
t.searchParams.set("redirect_uri", s);
|
|
45
47
|
} else
|
|
46
48
|
t.searchParams.set("redirect_uri", e["x-scalar-redirect-uri"]);
|
|
47
49
|
e["x-scalar-security-query"] && Object.keys(e["x-scalar-security-query"]).forEach((r) => {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
}), t.searchParams.set("client_id", e["x-scalar-client-id"]), t.searchParams.set("state", o),
|
|
51
|
-
const
|
|
52
|
-
return
|
|
53
|
-
const
|
|
54
|
-
let h = null,
|
|
50
|
+
const s = e["x-scalar-security-query"]?.[r];
|
|
51
|
+
s && t.searchParams.set(r, s);
|
|
52
|
+
}), t.searchParams.set("client_id", e["x-scalar-client-id"]), t.searchParams.set("state", o), c && t.searchParams.set("scope", c);
|
|
53
|
+
const n = window.open(t, "openAuth2Window", "left=100,top=100,width=800,height=600");
|
|
54
|
+
return n ? new Promise((r) => {
|
|
55
|
+
const s = setInterval(() => {
|
|
56
|
+
let h = null, d = null, l = null, m = null;
|
|
55
57
|
try {
|
|
56
|
-
const i = new URL(
|
|
57
|
-
h = i.get(P),
|
|
58
|
-
const g = new URLSearchParams(
|
|
59
|
-
h ||= g.get(P),
|
|
58
|
+
const i = new URL(n.location.href).searchParams, P = e["x-tokenName"] || "access_token";
|
|
59
|
+
h = i.get(P), d = i.get("code"), l = i.get("error"), m = i.get("error_description");
|
|
60
|
+
const g = new URLSearchParams(n.location.href.split("#")[1]);
|
|
61
|
+
h ||= g.get(P), d ||= g.get("code"), l ||= g.get("error"), m ||= g.get("error_description");
|
|
60
62
|
} catch {
|
|
61
63
|
}
|
|
62
|
-
if (
|
|
63
|
-
if (clearInterval(
|
|
64
|
-
r([new Error(`OAuth error: ${
|
|
64
|
+
if (n.closed || h || d || l)
|
|
65
|
+
if (clearInterval(s), n.close(), l)
|
|
66
|
+
r([new Error(`OAuth error: ${l}${m ? ` (${m})` : ""}`), null]);
|
|
65
67
|
else if (h) {
|
|
66
|
-
const i =
|
|
68
|
+
const i = n.location.href.match(/state=([^&]*)/)?.[1];
|
|
67
69
|
r(i === o ? [null, h] : [new Error("State mismatch"), null]);
|
|
68
|
-
} else
|
|
70
|
+
} else d ? new URL(n.location.href).searchParams.get("state") === o ? S(
|
|
69
71
|
e,
|
|
70
|
-
|
|
72
|
+
c,
|
|
71
73
|
{
|
|
72
|
-
code:
|
|
74
|
+
code: d,
|
|
73
75
|
pkce: y,
|
|
74
76
|
proxyUrl: u
|
|
75
77
|
},
|
|
76
|
-
|
|
77
|
-
).then(r) : r([new Error("State mismatch"), null]) : (clearInterval(
|
|
78
|
+
a
|
|
79
|
+
).then(r) : r([new Error("State mismatch"), null]) : (clearInterval(s), r([new Error("Window was closed without granting authorization"), null]));
|
|
78
80
|
}, 200);
|
|
79
81
|
}) : [new Error("Failed to open auth window"), null];
|
|
80
82
|
} catch {
|
|
81
83
|
return [new Error("Failed to authorize oauth2 flow"), null];
|
|
82
84
|
}
|
|
83
|
-
},
|
|
85
|
+
}, S = async (e, a, {
|
|
84
86
|
code: u,
|
|
85
|
-
pkce:
|
|
87
|
+
pkce: c,
|
|
86
88
|
proxyUrl: o
|
|
87
89
|
} = {}, _) => {
|
|
88
90
|
if (!e)
|
|
89
91
|
return [new Error("OAuth2 flow was not defined"), null];
|
|
90
92
|
const t = new URLSearchParams();
|
|
91
|
-
t.set("client_id", e["x-scalar-client-id"]),
|
|
92
|
-
|
|
93
|
+
t.set("client_id", e["x-scalar-client-id"]), a && (e.type === "clientCredentials" || e.type === "password") && t.set("scope", a), e.clientSecret && (!e["x-scalar-credentials-location"] || e["x-scalar-credentials-location"] === "body") && t.set("client_secret", e.clientSecret), "x-scalar-redirect-uri" in e && e["x-scalar-redirect-uri"] && t.set("redirect_uri", e["x-scalar-redirect-uri"]), u ? (t.set("code", u), t.set("grant_type", "authorization_code"), c && t.set("code_verifier", c.codeVerifier)) : e.type === "password" ? (t.set("grant_type", "password"), t.set("username", e.username), t.set("password", e.password)) : t.set("grant_type", "client_credentials"), e["x-scalar-security-body"] && Object.entries(e["x-scalar-security-body"]).forEach(([p, n]) => {
|
|
94
|
+
n && t.set(p, n);
|
|
93
95
|
});
|
|
94
96
|
try {
|
|
95
97
|
const p = {
|
|
96
98
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
97
99
|
};
|
|
98
|
-
e.clientSecret && (!e["x-scalar-credentials-location"] || e["x-scalar-credentials-location"] === "header") && (p.Authorization = `Basic ${
|
|
99
|
-
const r = x(e.tokenUrl,
|
|
100
|
+
e.clientSecret && (!e["x-scalar-credentials-location"] || e["x-scalar-credentials-location"] === "header") && (p.Authorization = `Basic ${A(`${e["x-scalar-client-id"]}:${e.clientSecret}`)}`);
|
|
101
|
+
const r = x(e.tokenUrl, w(_)), s = f(o, r) ? `${o}?${new URLSearchParams([["scalar_url", r]]).toString()}` : r, d = await (await fetch(s, {
|
|
100
102
|
method: "POST",
|
|
101
103
|
headers: p,
|
|
102
104
|
body: t
|
|
103
|
-
})).json(),
|
|
104
|
-
return [null, l
|
|
105
|
+
})).json(), l = e["x-tokenName"] || "access_token";
|
|
106
|
+
return [null, d[l]];
|
|
105
107
|
} catch {
|
|
106
108
|
return [new Error("Failed to get an access token. Please check your credentials."), null];
|
|
107
109
|
}
|
|
108
110
|
};
|
|
109
111
|
export {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
$ as authorizeOauth2,
|
|
113
|
+
S as authorizeServers,
|
|
114
|
+
E as generateCodeChallenge
|
|
113
115
|
};
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"rest",
|
|
19
19
|
"testing"
|
|
20
20
|
],
|
|
21
|
-
"version": "2.22.
|
|
21
|
+
"version": "2.22.2",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=20"
|
|
24
24
|
},
|
|
@@ -322,25 +322,25 @@
|
|
|
322
322
|
"yaml": "^2.8.0",
|
|
323
323
|
"zod": "^4.3.5",
|
|
324
324
|
"@scalar/analytics-client": "1.0.1",
|
|
325
|
-
"@scalar/components": "0.17.
|
|
325
|
+
"@scalar/components": "0.17.1",
|
|
326
|
+
"@scalar/helpers": "0.2.10",
|
|
326
327
|
"@scalar/draggable": "0.3.0",
|
|
327
|
-
"@scalar/helpers": "0.2.9",
|
|
328
328
|
"@scalar/icons": "0.5.2",
|
|
329
|
-
"@scalar/import": "0.4.
|
|
330
|
-
"@scalar/
|
|
331
|
-
"@scalar/
|
|
332
|
-
"@scalar/
|
|
329
|
+
"@scalar/import": "0.4.47",
|
|
330
|
+
"@scalar/object-utils": "1.2.24",
|
|
331
|
+
"@scalar/json-magic": "0.9.5",
|
|
332
|
+
"@scalar/oas-utils": "0.6.31",
|
|
333
|
+
"@scalar/openapi-parser": "0.24.6",
|
|
333
334
|
"@scalar/openapi-types": "0.5.3",
|
|
334
|
-
"@scalar/postman-to-openapi": "0.4.
|
|
335
|
-
"@scalar/sidebar": "0.7.
|
|
335
|
+
"@scalar/postman-to-openapi": "0.4.2",
|
|
336
|
+
"@scalar/sidebar": "0.7.24",
|
|
337
|
+
"@scalar/snippetz": "0.6.10",
|
|
336
338
|
"@scalar/themes": "0.14.0",
|
|
337
|
-
"@scalar/
|
|
338
|
-
"@scalar/
|
|
339
|
-
"@scalar/types": "0.6.0",
|
|
340
|
-
"@scalar/use-codemirror": "0.13.27",
|
|
341
|
-
"@scalar/use-hooks": "0.3.6",
|
|
339
|
+
"@scalar/types": "0.6.1",
|
|
340
|
+
"@scalar/use-codemirror": "0.13.28",
|
|
342
341
|
"@scalar/use-toasts": "0.9.1",
|
|
343
|
-
"@scalar/
|
|
342
|
+
"@scalar/use-hooks": "0.3.7",
|
|
343
|
+
"@scalar/workspace-store": "0.28.0"
|
|
344
344
|
},
|
|
345
345
|
"devDependencies": {
|
|
346
346
|
"@tailwindcss/vite": "^4.1.18",
|
|
@@ -355,8 +355,8 @@
|
|
|
355
355
|
"vite": "^7.3.1",
|
|
356
356
|
"vite-svg-loader": "5.1.0",
|
|
357
357
|
"vitest": "4.0.16",
|
|
358
|
-
"@scalar/
|
|
359
|
-
"@scalar/
|
|
358
|
+
"@scalar/build-tooling": "0.4.1",
|
|
359
|
+
"@scalar/galaxy": "0.5.12"
|
|
360
360
|
},
|
|
361
361
|
"scripts": {
|
|
362
362
|
"build": "scalar-build-vite",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
2
|
-
import type { WorkspaceDocument } from '@scalar/workspace-store/schemas';
|
|
3
|
-
type __VLS_Props = {
|
|
4
|
-
forceIcon?: boolean;
|
|
5
|
-
searchHotKey?: string;
|
|
6
|
-
hideModels?: boolean;
|
|
7
|
-
documents: WorkspaceDocument[];
|
|
8
|
-
eventBus: WorkspaceEventBus;
|
|
9
|
-
};
|
|
10
|
-
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>;
|
|
11
|
-
export default _default;
|
|
12
|
-
//# sourceMappingURL=SearchButton.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SearchButton.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/search/components/SearchButton.vue"],"names":[],"mappings":"AAwGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAKxE,KAAK,WAAW,GAAG;IACjB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,EAAE,iBAAiB,EAAE,CAAA;IAC9B,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;;AAyKF,wBAMG"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { defineComponent as p, ref as k, watch as h, nextTick as S, onMounted as B, onBeforeUnmount as w, createElementBlock as r, openBlock as s, Fragment as d, createBlock as m, createVNode as v, unref as l, normalizeClass as M, withCtx as f, createElementVNode as a, createTextVNode as C, toDisplayString as K } from "vue";
|
|
2
|
-
import { useModal as b, ScalarIconButton as g, ScalarSidebarSearchButton as x } from "@scalar/components";
|
|
3
|
-
import { isMacOS as y } from "@scalar/helpers/general/is-mac-os";
|
|
4
|
-
import { ScalarIconMagnifyingGlass as E } from "@scalar/icons";
|
|
5
|
-
import H from "./SearchModal.vue.js";
|
|
6
|
-
const D = /* @__PURE__ */ p({
|
|
7
|
-
__name: "SearchButton",
|
|
8
|
-
props: {
|
|
9
|
-
forceIcon: { type: Boolean },
|
|
10
|
-
searchHotKey: { default: "k" },
|
|
11
|
-
hideModels: { type: Boolean, default: !1 },
|
|
12
|
-
documents: {},
|
|
13
|
-
eventBus: {}
|
|
14
|
-
},
|
|
15
|
-
setup(n) {
|
|
16
|
-
const i = k(), o = b(), u = (t) => {
|
|
17
|
-
(y() ? t.metaKey : t.ctrlKey) && t.key === n.searchHotKey && (t.preventDefault(), t.stopPropagation(), o.open ? o.hide() : o.show());
|
|
18
|
-
};
|
|
19
|
-
h(
|
|
20
|
-
() => o.open,
|
|
21
|
-
async (t, e) => {
|
|
22
|
-
!t && e && (await S(), i.value?.$el.focus());
|
|
23
|
-
}
|
|
24
|
-
), B(() => window.addEventListener("keydown", u)), w(() => window.removeEventListener("keydown", u));
|
|
25
|
-
function c() {
|
|
26
|
-
o.show();
|
|
27
|
-
}
|
|
28
|
-
return (t, e) => (s(), r(d, null, [
|
|
29
|
-
n.forceIcon ? (s(), m(l(g), {
|
|
30
|
-
key: 0,
|
|
31
|
-
icon: l(E),
|
|
32
|
-
label: "Search",
|
|
33
|
-
onClick: c
|
|
34
|
-
}, null, 8, ["icon"])) : (s(), m(l(x), {
|
|
35
|
-
key: 1,
|
|
36
|
-
ref_key: "button",
|
|
37
|
-
ref: i,
|
|
38
|
-
class: M(["w-full", t.$attrs.class]),
|
|
39
|
-
onClick: c
|
|
40
|
-
}, {
|
|
41
|
-
shortcut: f(() => [
|
|
42
|
-
l(y)() ? (s(), r(d, { key: 0 }, [
|
|
43
|
-
e[0] || (e[0] = a("span", { class: "sr-only" }, "Command", -1)),
|
|
44
|
-
e[1] || (e[1] = a("span", { "aria-hidden": "true" }, "⌘", -1))
|
|
45
|
-
], 64)) : (s(), r(d, { key: 1 }, [
|
|
46
|
-
e[2] || (e[2] = a("span", { class: "sr-only" }, "CTRL", -1)),
|
|
47
|
-
e[3] || (e[3] = a("span", { "aria-hidden": "true" }, "⌃", -1))
|
|
48
|
-
], 64)),
|
|
49
|
-
C(" " + K(n.searchHotKey), 1)
|
|
50
|
-
]),
|
|
51
|
-
default: f(() => [
|
|
52
|
-
e[4] || (e[4] = a("span", { class: "sr-only" }, "Open Search", -1)),
|
|
53
|
-
e[5] || (e[5] = a("span", {
|
|
54
|
-
"aria-hidden": "true",
|
|
55
|
-
class: "sidebar-search-placeholder"
|
|
56
|
-
}, " Search ", -1))
|
|
57
|
-
]),
|
|
58
|
-
_: 1
|
|
59
|
-
}, 8, ["class"])),
|
|
60
|
-
v(H, {
|
|
61
|
-
documents: n.documents,
|
|
62
|
-
eventBus: n.eventBus,
|
|
63
|
-
hideModels: n.hideModels,
|
|
64
|
-
modalState: l(o)
|
|
65
|
-
}, null, 8, ["documents", "eventBus", "hideModels", "modalState"])
|
|
66
|
-
], 64));
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
export {
|
|
70
|
-
D as default
|
|
71
|
-
};
|