relayax-cli 0.3.63 → 0.3.64
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/dist/lib/api.js +20 -4
- package/package.json +1 -1
package/dist/lib/api.js
CHANGED
|
@@ -24,7 +24,11 @@ async function fetchMyOrgs() {
|
|
|
24
24
|
async function fetchAgentInfo(slug) {
|
|
25
25
|
const registrySlug = slug.startsWith('@') ? slug.slice(1) : slug;
|
|
26
26
|
const url = `${config_js_1.API_URL}/api/registry/${registrySlug}`;
|
|
27
|
-
const
|
|
27
|
+
const token = await (0, config_js_1.getValidToken)();
|
|
28
|
+
const headers = {};
|
|
29
|
+
if (token)
|
|
30
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
31
|
+
const res = await fetch(url, { headers });
|
|
28
32
|
if (!res.ok) {
|
|
29
33
|
const body = await res.text();
|
|
30
34
|
throw new Error(`에이전트 정보 조회 실패 (${res.status}): ${body}`);
|
|
@@ -36,7 +40,11 @@ async function searchAgents(query, tag) {
|
|
|
36
40
|
if (tag)
|
|
37
41
|
params.set('tag', tag);
|
|
38
42
|
const url = `${config_js_1.API_URL}/api/registry/search?${params.toString()}`;
|
|
39
|
-
const
|
|
43
|
+
const token = await (0, config_js_1.getValidToken)();
|
|
44
|
+
const headers = {};
|
|
45
|
+
if (token)
|
|
46
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
47
|
+
const res = await fetch(url, { headers });
|
|
40
48
|
if (!res.ok) {
|
|
41
49
|
const body = await res.text();
|
|
42
50
|
throw new Error(`검색 실패 (${res.status}): ${body}`);
|
|
@@ -47,7 +55,11 @@ async function searchAgents(query, tag) {
|
|
|
47
55
|
async function fetchAgentVersions(slug) {
|
|
48
56
|
const registrySlug = slug.startsWith('@') ? slug.slice(1) : slug;
|
|
49
57
|
const url = `${config_js_1.API_URL}/api/registry/${registrySlug}/versions`;
|
|
50
|
-
const
|
|
58
|
+
const token = await (0, config_js_1.getValidToken)();
|
|
59
|
+
const headers = {};
|
|
60
|
+
if (token)
|
|
61
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
62
|
+
const res = await fetch(url, { headers });
|
|
51
63
|
if (!res.ok) {
|
|
52
64
|
const body = await res.text();
|
|
53
65
|
throw new Error(`버전 목록 조회 실패 (${res.status}): ${body}`);
|
|
@@ -81,7 +93,11 @@ async function reportInstall(agentId, slug, version) {
|
|
|
81
93
|
}
|
|
82
94
|
async function resolveSlugFromServer(name) {
|
|
83
95
|
const url = `${config_js_1.API_URL}/api/registry/resolve?name=${encodeURIComponent(name)}`;
|
|
84
|
-
const
|
|
96
|
+
const token = await (0, config_js_1.getValidToken)();
|
|
97
|
+
const headers = {};
|
|
98
|
+
if (token)
|
|
99
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
100
|
+
const res = await fetch(url, { headers, signal: AbortSignal.timeout(5000) });
|
|
85
101
|
if (!res.ok) {
|
|
86
102
|
throw new Error(`slug resolve 실패 (${res.status})`);
|
|
87
103
|
}
|