@lobehub/market-sdk 0.41.0 → 0.43.0
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/index.d.mts +462 -354
- package/dist/index.mjs +852 -448
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// src/admin/MarketAdmin.ts
|
|
2
|
-
import
|
|
2
|
+
import debug14 from "debug";
|
|
3
3
|
|
|
4
4
|
// src/core/BaseSDK.ts
|
|
5
|
+
import { context, isSpanContextValid, trace } from "@opentelemetry/api";
|
|
5
6
|
import debug from "debug";
|
|
6
7
|
import { SignJWT } from "jose";
|
|
7
8
|
import urlJoin from "url-join";
|
|
@@ -27,7 +28,7 @@ var normalizeErrorDetails = (errorBody) => {
|
|
|
27
28
|
return void 0;
|
|
28
29
|
};
|
|
29
30
|
var MarketAPIError = class _MarketAPIError extends Error {
|
|
30
|
-
constructor(status, statusText, errorBody) {
|
|
31
|
+
constructor(status, statusText, errorBody, traceId) {
|
|
31
32
|
const errorDetails = normalizeErrorDetails(errorBody);
|
|
32
33
|
const errorCode = errorDetails == null ? void 0 : errorDetails.code;
|
|
33
34
|
const errorMessage = errorDetails == null ? void 0 : errorDetails.message;
|
|
@@ -37,6 +38,7 @@ var MarketAPIError = class _MarketAPIError extends Error {
|
|
|
37
38
|
this.status = status;
|
|
38
39
|
this.code = errorCode;
|
|
39
40
|
this.errorBody = errorBody;
|
|
41
|
+
this.traceId = traceId && /^[\da-f]{32}$/.test(traceId) && !/^0{32}$/.test(traceId) ? traceId : void 0;
|
|
40
42
|
if (Error.captureStackTrace) {
|
|
41
43
|
Error.captureStackTrace(this, _MarketAPIError);
|
|
42
44
|
}
|
|
@@ -62,7 +64,8 @@ var MarketAPIError = class _MarketAPIError extends Error {
|
|
|
62
64
|
errorBody: this.errorBody,
|
|
63
65
|
message: this.message,
|
|
64
66
|
name: this.name,
|
|
65
|
-
status: this.status
|
|
67
|
+
status: this.status,
|
|
68
|
+
traceId: this.traceId
|
|
66
69
|
};
|
|
67
70
|
}
|
|
68
71
|
};
|
|
@@ -100,7 +103,7 @@ var BaseSDK = class {
|
|
|
100
103
|
"Content-Type": "application/json",
|
|
101
104
|
"User-Agent": userAgent
|
|
102
105
|
};
|
|
103
|
-
log("Created new headers object
|
|
106
|
+
log("Created new headers object");
|
|
104
107
|
}
|
|
105
108
|
if (apiKey) {
|
|
106
109
|
this.headers.Authorization = `Bearer ${apiKey}`;
|
|
@@ -116,16 +119,7 @@ var BaseSDK = class {
|
|
|
116
119
|
this.headers["x-lobe-owner-account-id"] = String(options.ownerAccountId);
|
|
117
120
|
log("Owner account id configured: %d", options.ownerAccountId);
|
|
118
121
|
}
|
|
119
|
-
log("BaseSDK instance created
|
|
120
|
-
baseUrl: this.baseUrl,
|
|
121
|
-
defaultLocale: this.defaultLocale,
|
|
122
|
-
hasApiKey: !!apiKey,
|
|
123
|
-
hasInitialAccessToken: !!this.initialAccessToken,
|
|
124
|
-
hasM2MCredentials: !!this.clientId,
|
|
125
|
-
hasOwnerAccountId: options.ownerAccountId !== void 0,
|
|
126
|
-
hasSharedTokenState: !!this.sharedTokenState,
|
|
127
|
-
hasTrustedClientToken: !!options.trustedClientToken
|
|
128
|
-
});
|
|
122
|
+
log("BaseSDK instance created");
|
|
129
123
|
}
|
|
130
124
|
/**
|
|
131
125
|
* Sets the owner account id header for subsequent requests.
|
|
@@ -157,19 +151,32 @@ var BaseSDK = class {
|
|
|
157
151
|
*/
|
|
158
152
|
// eslint-disable-next-line no-undef
|
|
159
153
|
async request(url, options = {}) {
|
|
154
|
+
var _a, _b, _c, _d;
|
|
160
155
|
const requestUrl = urlJoin(this.apiBaseUrl, url);
|
|
161
|
-
|
|
156
|
+
const spanContext = trace.getSpanContext(context.active());
|
|
157
|
+
log("Sending request");
|
|
162
158
|
if (!this.initialAccessToken && this.clientId && this.clientSecret) {
|
|
163
159
|
await this.setM2MAuthToken();
|
|
164
160
|
}
|
|
165
161
|
const mergedHeaders = {
|
|
166
162
|
...this.headers,
|
|
167
|
-
...options.headers
|
|
163
|
+
...options.headers instanceof Headers || Array.isArray(options.headers) ? Object.fromEntries(new Headers(options.headers)) : options.headers
|
|
168
164
|
};
|
|
165
|
+
if (spanContext && isSpanContextValid(spanContext)) {
|
|
166
|
+
for (const key of Object.keys(mergedHeaders)) {
|
|
167
|
+
if (key.toLowerCase() === "traceparent" || key.toLowerCase() === "tracestate") {
|
|
168
|
+
delete mergedHeaders[key];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
mergedHeaders.traceparent = `00-${spanContext.traceId}-${spanContext.spanId}-${(spanContext.traceFlags & 1).toString(16).padStart(2, "0")}`;
|
|
172
|
+
const traceState = (_a = spanContext.traceState) == null ? void 0 : _a.serialize();
|
|
173
|
+
if (traceState) mergedHeaders.tracestate = traceState;
|
|
174
|
+
}
|
|
169
175
|
if (typeof FormData !== "undefined" && options.body instanceof FormData) {
|
|
170
|
-
|
|
176
|
+
for (const key of Object.keys(mergedHeaders)) {
|
|
177
|
+
if (key.toLowerCase() === "content-type") delete mergedHeaders[key];
|
|
178
|
+
}
|
|
171
179
|
}
|
|
172
|
-
log("Request headers: %O", mergedHeaders);
|
|
173
180
|
const response = await fetch(requestUrl, {
|
|
174
181
|
...options,
|
|
175
182
|
headers: mergedHeaders
|
|
@@ -178,13 +185,19 @@ var BaseSDK = class {
|
|
|
178
185
|
let errorBody;
|
|
179
186
|
try {
|
|
180
187
|
errorBody = await response.json();
|
|
181
|
-
console.error("Request error: %s", JSON.stringify(errorBody));
|
|
182
188
|
} catch (e) {
|
|
183
189
|
errorBody = void 0;
|
|
184
190
|
}
|
|
185
|
-
|
|
191
|
+
const error = new MarketAPIError(
|
|
192
|
+
response.status,
|
|
193
|
+
response.statusText,
|
|
194
|
+
errorBody,
|
|
195
|
+
(_c = (_b = response.headers) == null ? void 0 : _b.get("x-market-trace-id")) != null ? _c : void 0
|
|
196
|
+
);
|
|
197
|
+
log("Request failed: status=%d traceId=%s", error.status, (_d = error.traceId) != null ? _d : "none");
|
|
198
|
+
throw error;
|
|
186
199
|
}
|
|
187
|
-
log("Request successful:
|
|
200
|
+
log("Request successful: status=%d", response.status);
|
|
188
201
|
if (response.status === 204) {
|
|
189
202
|
return void 0;
|
|
190
203
|
}
|
|
@@ -264,7 +277,7 @@ var BaseSDK = class {
|
|
|
264
277
|
}
|
|
265
278
|
async exchangeTokenForServer(clientAssertion) {
|
|
266
279
|
const tokenEndpoint = urlJoin(this.oauthBaseUrl, "token");
|
|
267
|
-
log("Exchanging token
|
|
280
|
+
log("Exchanging token");
|
|
268
281
|
const params = new URLSearchParams();
|
|
269
282
|
params.append("grant_type", "client_credentials");
|
|
270
283
|
params.append(
|
|
@@ -346,7 +359,7 @@ import debug2 from "debug";
|
|
|
346
359
|
var log2 = debug2("lobe-market-sdk:admin:agents");
|
|
347
360
|
var AgentService = class extends BaseSDK {
|
|
348
361
|
/**
|
|
349
|
-
* Creates
|
|
362
|
+
* Creates a cloud Agent and its current initial version, including required A2A metadata.
|
|
350
363
|
*/
|
|
351
364
|
async createAgent(data) {
|
|
352
365
|
log2("Creating Agent with initial version: %s", data.identifier);
|
|
@@ -358,6 +371,8 @@ var AgentService = class extends BaseSDK {
|
|
|
358
371
|
/**
|
|
359
372
|
* Retrieves a list of agents with admin details
|
|
360
373
|
*
|
|
374
|
+
* Set category to UNCATEGORIZED_CATEGORY to select assets with no assigned category.
|
|
375
|
+
*
|
|
361
376
|
* Supports filtering, pagination, and sorting of results.
|
|
362
377
|
*
|
|
363
378
|
* @param params - Query parameters for filtering and pagination
|
|
@@ -449,6 +464,26 @@ var AgentService = class extends BaseSDK {
|
|
|
449
464
|
log2("Agent version updated successfully: %s@%s", id, version);
|
|
450
465
|
return result;
|
|
451
466
|
}
|
|
467
|
+
/**
|
|
468
|
+
* Creates a new version for an existing agent, inheriting A2A-level fields
|
|
469
|
+
* from the version the agent currently points to.
|
|
470
|
+
*
|
|
471
|
+
* @param id - Agent ID or identifier
|
|
472
|
+
* @param data - Version creation parameters (version string required)
|
|
473
|
+
* @returns Promise resolving to the created Agent version
|
|
474
|
+
*/
|
|
475
|
+
async createAgentVersion(id, data) {
|
|
476
|
+
log2("Creating agent version: %s@%s, data: %O", id, data.version);
|
|
477
|
+
const result = await this.request(
|
|
478
|
+
`/admin/agents/${encodeURIComponent(String(id))}/versions`,
|
|
479
|
+
{
|
|
480
|
+
body: JSON.stringify(data),
|
|
481
|
+
method: "POST"
|
|
482
|
+
}
|
|
483
|
+
);
|
|
484
|
+
log2("Agent version created successfully: %s@%s", id, result.version);
|
|
485
|
+
return result;
|
|
486
|
+
}
|
|
452
487
|
/**
|
|
453
488
|
* Updates agent publication status
|
|
454
489
|
*
|
|
@@ -921,6 +956,8 @@ var PluginService = class extends BaseSDK {
|
|
|
921
956
|
/**
|
|
922
957
|
* Retrieves a list of plugins with admin details
|
|
923
958
|
*
|
|
959
|
+
* Set category to UNCATEGORIZED_CATEGORY to select assets with no assigned category.
|
|
960
|
+
*
|
|
924
961
|
* Supports filtering, pagination, and sorting of results.
|
|
925
962
|
*
|
|
926
963
|
* @param params - Query parameters for filtering and pagination
|
|
@@ -1716,9 +1753,47 @@ var SkillCollectionService = class extends BaseSDK {
|
|
|
1716
1753
|
import debug10 from "debug";
|
|
1717
1754
|
var log10 = debug10("lobe-market-sdk:admin:skills");
|
|
1718
1755
|
var SkillService = class extends BaseSDK {
|
|
1756
|
+
/** Create a manual Skill. Self-hosted category names resolve to directory identifiers. */
|
|
1757
|
+
async createSkill(data) {
|
|
1758
|
+
return this.request("/admin/skills", {
|
|
1759
|
+
body: JSON.stringify(data),
|
|
1760
|
+
method: "POST"
|
|
1761
|
+
});
|
|
1762
|
+
}
|
|
1763
|
+
/** Import a GitHub Skill; omit icon to preserve it, or pass null to clear it. */
|
|
1764
|
+
async importFromGitHub(data) {
|
|
1765
|
+
return this.request("/admin/skills/import", {
|
|
1766
|
+
body: JSON.stringify(data),
|
|
1767
|
+
method: "POST"
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1770
|
+
/** Retrieve raw Admin detail and image metadata for editing. */
|
|
1771
|
+
async getSkill(id) {
|
|
1772
|
+
return this.request(`/admin/skills/${id}`);
|
|
1773
|
+
}
|
|
1774
|
+
/**
|
|
1775
|
+
* Update publication settings and the current version's category atomically.
|
|
1776
|
+
*
|
|
1777
|
+
* @param id - Skill database ID
|
|
1778
|
+
* @param data - Omit category to preserve it, or pass null to clear it
|
|
1779
|
+
* Self-hosted categories accept directory identifiers or unique names; unknown names return 400.
|
|
1780
|
+
* @returns Updated Skill metadata; read the category through the Skill detail endpoint
|
|
1781
|
+
* @throws If the Skill does not exist, or category is supplied without a current version
|
|
1782
|
+
*/
|
|
1783
|
+
async updateSkill(id, data) {
|
|
1784
|
+
log10("Updating skill: %d", id);
|
|
1785
|
+
const result = await this.request(`/admin/skills/${id}`, {
|
|
1786
|
+
body: JSON.stringify(data),
|
|
1787
|
+
method: "PUT"
|
|
1788
|
+
});
|
|
1789
|
+
log10("Updated skill: %d", id);
|
|
1790
|
+
return result;
|
|
1791
|
+
}
|
|
1719
1792
|
/**
|
|
1720
1793
|
* Retrieve Skills with Admin API status and visibility fields.
|
|
1721
1794
|
*
|
|
1795
|
+
* Set category to UNCATEGORIZED_CATEGORY to select assets with no assigned category.
|
|
1796
|
+
*
|
|
1722
1797
|
* @param params - Query parameters for filtering and pagination
|
|
1723
1798
|
* @returns Paginated Skill list
|
|
1724
1799
|
*/
|
|
@@ -1740,6 +1815,8 @@ var SkillService = class extends BaseSDK {
|
|
|
1740
1815
|
const filename = options.filename || (typeof File !== "undefined" && file instanceof File ? file.name : "skill.zip");
|
|
1741
1816
|
const formData = new FormData();
|
|
1742
1817
|
formData.set("file", file, filename);
|
|
1818
|
+
if (options.icon !== void 0)
|
|
1819
|
+
formData.set("icon", options.icon === null ? "null" : options.icon);
|
|
1743
1820
|
if (options.identifier) formData.set("identifier", options.identifier);
|
|
1744
1821
|
log10("Importing skill package: %s", filename);
|
|
1745
1822
|
const result = await this.request("/admin/skills/import/upload", {
|
|
@@ -1924,8 +2001,74 @@ var OrganizationService = class extends BaseSDK {
|
|
|
1924
2001
|
}
|
|
1925
2002
|
};
|
|
1926
2003
|
|
|
2004
|
+
// src/admin/services/CategoryService.ts
|
|
2005
|
+
import debug13 from "debug";
|
|
2006
|
+
var log13 = debug13("lobe-market-sdk:admin:categories");
|
|
2007
|
+
var CategoryService = class extends BaseSDK {
|
|
2008
|
+
/** Lists categories and counts assets referencing them in any version. */
|
|
2009
|
+
async list(params) {
|
|
2010
|
+
log13("Listing categories for %s", params.assetType);
|
|
2011
|
+
return this.request(`/admin/categories${this.buildQueryString(params)}`);
|
|
2012
|
+
}
|
|
2013
|
+
/** Creates a category with a server-generated stable identifier. */
|
|
2014
|
+
async create(assetType, data) {
|
|
2015
|
+
log13("Creating category for %s", assetType);
|
|
2016
|
+
return this.request(`/admin/categories/${assetType}`, {
|
|
2017
|
+
body: JSON.stringify(data),
|
|
2018
|
+
method: "POST"
|
|
2019
|
+
});
|
|
2020
|
+
}
|
|
2021
|
+
/** Updates presentation fields; icon: null clears the image, omission preserves it. */
|
|
2022
|
+
async update(assetType, identifier, data) {
|
|
2023
|
+
log13("Updating category %s for %s", identifier, assetType);
|
|
2024
|
+
return this.request(`/admin/categories/${assetType}/${encodeURIComponent(identifier)}`, {
|
|
2025
|
+
body: JSON.stringify(data),
|
|
2026
|
+
method: "PATCH"
|
|
2027
|
+
});
|
|
2028
|
+
}
|
|
2029
|
+
/** Deletes up to 200 categories and reassigns or clears all affected asset versions atomically. */
|
|
2030
|
+
async delete(assetType, data) {
|
|
2031
|
+
log13("Deleting %d categories for %s", data.identifiers.length, assetType);
|
|
2032
|
+
return this.request(`/admin/categories/${assetType}/delete`, {
|
|
2033
|
+
body: JSON.stringify(data),
|
|
2034
|
+
method: "POST"
|
|
2035
|
+
});
|
|
2036
|
+
}
|
|
2037
|
+
};
|
|
2038
|
+
|
|
2039
|
+
// src/admin/services/SandboxSessionService.ts
|
|
2040
|
+
var SandboxSessionService = class extends BaseSDK {
|
|
2041
|
+
list(params = {}) {
|
|
2042
|
+
return this.request(`/admin/sandbox-sessions${this.buildQueryString(params)}`);
|
|
2043
|
+
}
|
|
2044
|
+
get(id) {
|
|
2045
|
+
return this.request(`/admin/sandbox-sessions/${id}`);
|
|
2046
|
+
}
|
|
2047
|
+
related(id, params = {}) {
|
|
2048
|
+
return this.request(`/admin/sandbox-sessions/${id}/related${this.buildQueryString(params)}`);
|
|
2049
|
+
}
|
|
2050
|
+
};
|
|
2051
|
+
|
|
2052
|
+
// src/admin/services/SandboxStorageService.ts
|
|
2053
|
+
var SandboxStorageService = class extends BaseSDK {
|
|
2054
|
+
measure(key) {
|
|
2055
|
+
return this.request(`/admin/sandbox-storage/${encodeURIComponent(key)}/measure`, {
|
|
2056
|
+
method: "POST"
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
2059
|
+
efs() {
|
|
2060
|
+
return this.request("/admin/sandbox-storage/efs");
|
|
2061
|
+
}
|
|
2062
|
+
list(params = {}) {
|
|
2063
|
+
return this.request(`/admin/sandbox-storage${this.buildQueryString(params)}`);
|
|
2064
|
+
}
|
|
2065
|
+
get(key) {
|
|
2066
|
+
return this.request(`/admin/sandbox-storage/${encodeURIComponent(key)}`);
|
|
2067
|
+
}
|
|
2068
|
+
};
|
|
2069
|
+
|
|
1927
2070
|
// src/admin/MarketAdmin.ts
|
|
1928
|
-
var
|
|
2071
|
+
var log14 = debug14("lobe-market-sdk:admin");
|
|
1929
2072
|
var MarketAdmin = class extends BaseSDK {
|
|
1930
2073
|
/**
|
|
1931
2074
|
* Creates a new MarketAdmin instance
|
|
@@ -1939,7 +2082,10 @@ var MarketAdmin = class extends BaseSDK {
|
|
|
1939
2082
|
tokenExpiry: void 0
|
|
1940
2083
|
};
|
|
1941
2084
|
super({ ...options, apiKey }, void 0, sharedTokenState);
|
|
1942
|
-
|
|
2085
|
+
log14("MarketAdmin instance created");
|
|
2086
|
+
this.sandboxStorage = new SandboxStorageService(options, this.headers, sharedTokenState);
|
|
2087
|
+
this.sandboxSessions = new SandboxSessionService(options, this.headers, sharedTokenState);
|
|
2088
|
+
this.categories = new CategoryService(options, this.headers, sharedTokenState);
|
|
1943
2089
|
this.agents = new AgentService(options, this.headers, sharedTokenState);
|
|
1944
2090
|
this.analysis = new AnalysisService(options, this.headers, sharedTokenState);
|
|
1945
2091
|
this.dependencies = new SystemDependencyService(options, this.headers, sharedTokenState);
|
|
@@ -1955,11 +2101,12 @@ var MarketAdmin = class extends BaseSDK {
|
|
|
1955
2101
|
};
|
|
1956
2102
|
|
|
1957
2103
|
// src/market/market-sdk.ts
|
|
1958
|
-
import
|
|
2104
|
+
import { getAssetImagePath, getAssetInitialPath } from "@lobehub/market-types";
|
|
2105
|
+
import debug39 from "debug";
|
|
1959
2106
|
|
|
1960
2107
|
// src/market/services/AgentProfileService.ts
|
|
1961
|
-
import
|
|
1962
|
-
var
|
|
2108
|
+
import debug15 from "debug";
|
|
2109
|
+
var log15 = debug15("lobe-market-sdk:agent-profile");
|
|
1963
2110
|
var AgentProfileService = class extends BaseSDK {
|
|
1964
2111
|
/**
|
|
1965
2112
|
* Retrieves the current agent's profile
|
|
@@ -1971,9 +2118,9 @@ var AgentProfileService = class extends BaseSDK {
|
|
|
1971
2118
|
* @returns Promise resolving to the agent profile response
|
|
1972
2119
|
*/
|
|
1973
2120
|
async getProfile(options) {
|
|
1974
|
-
|
|
2121
|
+
log15("Getting agent profile");
|
|
1975
2122
|
const result = await this.request("/v1/agent/profile", options);
|
|
1976
|
-
|
|
2123
|
+
log15("Agent profile retrieved: id=%d, identifier=%s", result.agent.id, result.agent.identifier);
|
|
1977
2124
|
return result;
|
|
1978
2125
|
}
|
|
1979
2126
|
/**
|
|
@@ -1987,7 +2134,7 @@ var AgentProfileService = class extends BaseSDK {
|
|
|
1987
2134
|
* @returns Promise resolving to the updated agent profile response
|
|
1988
2135
|
*/
|
|
1989
2136
|
async updateProfile(data, options) {
|
|
1990
|
-
|
|
2137
|
+
log15("Updating agent profile: %O", data);
|
|
1991
2138
|
const result = await this.request("/v1/agent/profile", {
|
|
1992
2139
|
body: JSON.stringify(data),
|
|
1993
2140
|
headers: {
|
|
@@ -1996,18 +2143,20 @@ var AgentProfileService = class extends BaseSDK {
|
|
|
1996
2143
|
method: "PATCH",
|
|
1997
2144
|
...options
|
|
1998
2145
|
});
|
|
1999
|
-
|
|
2146
|
+
log15("Agent profile updated: id=%d, name=%s", result.agent.id, result.agent.name);
|
|
2000
2147
|
return result;
|
|
2001
2148
|
}
|
|
2002
2149
|
};
|
|
2003
2150
|
|
|
2004
2151
|
// src/market/services/AgentService.ts
|
|
2005
|
-
import
|
|
2006
|
-
var
|
|
2152
|
+
import debug16 from "debug";
|
|
2153
|
+
var log16 = debug16("lobe-market-sdk:agents");
|
|
2007
2154
|
var AgentService2 = class extends BaseSDK {
|
|
2008
2155
|
/**
|
|
2009
2156
|
* Retrieves a list of agents from the marketplace
|
|
2010
2157
|
*
|
|
2158
|
+
* Set category to UNCATEGORIZED_CATEGORY to select assets with no assigned category.
|
|
2159
|
+
*
|
|
2011
2160
|
* Supports filtering, pagination, and localization of results.
|
|
2012
2161
|
*
|
|
2013
2162
|
* @param params - Query parameters for filtering and pagination
|
|
@@ -2018,9 +2167,9 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2018
2167
|
const locale = params.locale || this.defaultLocale;
|
|
2019
2168
|
const queryParams = { ...params, locale };
|
|
2020
2169
|
const queryString = this.buildQueryString(queryParams);
|
|
2021
|
-
|
|
2170
|
+
log16("Getting agent list: %O", queryParams);
|
|
2022
2171
|
const result = await this.request(`/v1/agents${queryString}`, options);
|
|
2023
|
-
|
|
2172
|
+
log16("Retrieved %d agents", result.items.length);
|
|
2024
2173
|
return result;
|
|
2025
2174
|
}
|
|
2026
2175
|
/**
|
|
@@ -2037,9 +2186,9 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2037
2186
|
const locale = params.locale || this.defaultLocale;
|
|
2038
2187
|
const queryParams = { ...params, locale };
|
|
2039
2188
|
const queryString = this.buildQueryString(queryParams);
|
|
2040
|
-
|
|
2189
|
+
log16("Getting own agent list: %O", queryParams);
|
|
2041
2190
|
const result = await this.request(`/v1/agents/own${queryString}`, options);
|
|
2042
|
-
|
|
2191
|
+
log16("Retrieved %d own agents", result.items.length);
|
|
2043
2192
|
return result;
|
|
2044
2193
|
}
|
|
2045
2194
|
/**
|
|
@@ -2060,12 +2209,12 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2060
2209
|
queryParams.version = params.version.toString();
|
|
2061
2210
|
}
|
|
2062
2211
|
const queryString = this.buildQueryString(queryParams);
|
|
2063
|
-
|
|
2212
|
+
log16("Getting agent detail: %O", { id, ...params });
|
|
2064
2213
|
const result = await this.request(
|
|
2065
2214
|
`/v1/agents/detail/${id}${queryString}`,
|
|
2066
2215
|
options
|
|
2067
2216
|
);
|
|
2068
|
-
|
|
2217
|
+
log16("Agent detail successfully retrieved: %s", id);
|
|
2069
2218
|
return result;
|
|
2070
2219
|
}
|
|
2071
2220
|
/**
|
|
@@ -2081,12 +2230,12 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2081
2230
|
* @returns Promise resolving to an array containing identifiers array and last modified time
|
|
2082
2231
|
*/
|
|
2083
2232
|
async getPublishedIdentifiers(options) {
|
|
2084
|
-
|
|
2233
|
+
log16("Getting published agent identifiers");
|
|
2085
2234
|
const result = await this.request(
|
|
2086
2235
|
"/v1/agents/identifiers",
|
|
2087
2236
|
options
|
|
2088
2237
|
);
|
|
2089
|
-
|
|
2238
|
+
log16("Retrieved %d published agent identifiers", result.length);
|
|
2090
2239
|
return result;
|
|
2091
2240
|
}
|
|
2092
2241
|
/**
|
|
@@ -2097,9 +2246,9 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2097
2246
|
*/
|
|
2098
2247
|
async getSitemap(params = {}, options) {
|
|
2099
2248
|
const queryString = this.buildQueryString(params);
|
|
2100
|
-
|
|
2249
|
+
log16("Getting agent sitemap%s", queryString);
|
|
2101
2250
|
const result = await this.request(`/v1/agents/sitemap${queryString}`, options);
|
|
2102
|
-
|
|
2251
|
+
log16(
|
|
2103
2252
|
"Retrieved agent sitemap page %d/%d (%d items)",
|
|
2104
2253
|
result.currentPage,
|
|
2105
2254
|
result.totalPages,
|
|
@@ -2122,12 +2271,12 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2122
2271
|
const locale = params.locale || this.defaultLocale;
|
|
2123
2272
|
const queryParams = { ...params, locale };
|
|
2124
2273
|
const queryString = this.buildQueryString(queryParams);
|
|
2125
|
-
|
|
2274
|
+
log16("Getting agent categories: %O", queryParams);
|
|
2126
2275
|
const result = await this.request(
|
|
2127
2276
|
`/v1/agents/categories${queryString}`,
|
|
2128
2277
|
options
|
|
2129
2278
|
);
|
|
2130
|
-
|
|
2279
|
+
log16("Retrieved %d categories", result.length);
|
|
2131
2280
|
return result;
|
|
2132
2281
|
}
|
|
2133
2282
|
/**
|
|
@@ -2141,7 +2290,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2141
2290
|
* @returns Promise resolving to the upload response
|
|
2142
2291
|
*/
|
|
2143
2292
|
async uploadAgent(agentData, options) {
|
|
2144
|
-
|
|
2293
|
+
log16("Uploading agent: %s@%s", agentData.agentIdentifier, agentData.version.version);
|
|
2145
2294
|
const result = await this.request("/v1/agents/upload", {
|
|
2146
2295
|
body: JSON.stringify(agentData),
|
|
2147
2296
|
headers: {
|
|
@@ -2150,7 +2299,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2150
2299
|
method: "POST",
|
|
2151
2300
|
...options
|
|
2152
2301
|
});
|
|
2153
|
-
|
|
2302
|
+
log16("Agent uploaded successfully: %O", result);
|
|
2154
2303
|
return result;
|
|
2155
2304
|
}
|
|
2156
2305
|
/**
|
|
@@ -2161,7 +2310,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2161
2310
|
* @returns Promise resolving to the created agent response
|
|
2162
2311
|
*/
|
|
2163
2312
|
async createAgent(agentData, options) {
|
|
2164
|
-
|
|
2313
|
+
log16("Creating agent: %s", agentData.identifier);
|
|
2165
2314
|
const result = await this.request("/v1/agents/create", {
|
|
2166
2315
|
body: JSON.stringify(agentData),
|
|
2167
2316
|
headers: {
|
|
@@ -2170,7 +2319,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2170
2319
|
method: "POST",
|
|
2171
2320
|
...options
|
|
2172
2321
|
});
|
|
2173
|
-
|
|
2322
|
+
log16("Agent created successfully: %O", result);
|
|
2174
2323
|
return result;
|
|
2175
2324
|
}
|
|
2176
2325
|
/**
|
|
@@ -2181,7 +2330,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2181
2330
|
* @returns Promise resolving to the created version response
|
|
2182
2331
|
*/
|
|
2183
2332
|
async createAgentVersion(versionData, options) {
|
|
2184
|
-
|
|
2333
|
+
log16("Creating agent version: %s", versionData.identifier);
|
|
2185
2334
|
const result = await this.request("/v1/agents/version/create", {
|
|
2186
2335
|
body: JSON.stringify(versionData),
|
|
2187
2336
|
headers: {
|
|
@@ -2190,7 +2339,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2190
2339
|
method: "POST",
|
|
2191
2340
|
...options
|
|
2192
2341
|
});
|
|
2193
|
-
|
|
2342
|
+
log16("Agent version created successfully: %O", result);
|
|
2194
2343
|
return result;
|
|
2195
2344
|
}
|
|
2196
2345
|
/**
|
|
@@ -2201,7 +2350,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2201
2350
|
* @returns Promise resolving to the modified agent response
|
|
2202
2351
|
*/
|
|
2203
2352
|
async modifyAgent(agentData, options) {
|
|
2204
|
-
|
|
2353
|
+
log16("Modifying agent: %s", agentData.identifier);
|
|
2205
2354
|
const result = await this.request("/v1/agents/modify", {
|
|
2206
2355
|
body: JSON.stringify(agentData),
|
|
2207
2356
|
headers: {
|
|
@@ -2210,7 +2359,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2210
2359
|
method: "POST",
|
|
2211
2360
|
...options
|
|
2212
2361
|
});
|
|
2213
|
-
|
|
2362
|
+
log16("Agent modified successfully: %O", result);
|
|
2214
2363
|
return result;
|
|
2215
2364
|
}
|
|
2216
2365
|
/**
|
|
@@ -2221,7 +2370,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2221
2370
|
* @returns Promise resolving to the modified version response
|
|
2222
2371
|
*/
|
|
2223
2372
|
async modifyAgentVersion(versionData, options) {
|
|
2224
|
-
|
|
2373
|
+
log16("Modifying agent version: %s@%s", versionData.identifier, versionData.version);
|
|
2225
2374
|
const result = await this.request("/v1/agents/version/modify", {
|
|
2226
2375
|
body: JSON.stringify(versionData),
|
|
2227
2376
|
headers: {
|
|
@@ -2230,7 +2379,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2230
2379
|
method: "POST",
|
|
2231
2380
|
...options
|
|
2232
2381
|
});
|
|
2233
|
-
|
|
2382
|
+
log16("Agent version modified successfully: %O", result);
|
|
2234
2383
|
return result;
|
|
2235
2384
|
}
|
|
2236
2385
|
/**
|
|
@@ -2241,13 +2390,13 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2241
2390
|
* @returns Promise resolving to true if agent exists, false otherwise
|
|
2242
2391
|
*/
|
|
2243
2392
|
async checkAgentExists(identifier, options) {
|
|
2244
|
-
|
|
2393
|
+
log16("Checking if agent exists: %s", identifier);
|
|
2245
2394
|
try {
|
|
2246
2395
|
await this.getAgentDetail(identifier, {}, options);
|
|
2247
|
-
|
|
2396
|
+
log16("Agent exists: %s", identifier);
|
|
2248
2397
|
return true;
|
|
2249
2398
|
} catch (e) {
|
|
2250
|
-
|
|
2399
|
+
log16("Agent does not exist: %s", identifier);
|
|
2251
2400
|
return false;
|
|
2252
2401
|
}
|
|
2253
2402
|
}
|
|
@@ -2260,7 +2409,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2260
2409
|
* @param options - Optional request init overrides
|
|
2261
2410
|
*/
|
|
2262
2411
|
async createEvent(eventData, options) {
|
|
2263
|
-
|
|
2412
|
+
log16("Recording agent event: %s for %s", eventData.event, eventData.identifier);
|
|
2264
2413
|
await this.request("/v1/agents/events", {
|
|
2265
2414
|
body: JSON.stringify(eventData),
|
|
2266
2415
|
headers: {
|
|
@@ -2281,7 +2430,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2281
2430
|
* @returns Promise resolving to the updated install count response
|
|
2282
2431
|
*/
|
|
2283
2432
|
async increaseInstallCount(identifier, options) {
|
|
2284
|
-
|
|
2433
|
+
log16("Increasing install count for agent: %s", identifier);
|
|
2285
2434
|
const result = await this.request("/v1/agents/install-count", {
|
|
2286
2435
|
body: JSON.stringify({ identifier }),
|
|
2287
2436
|
headers: {
|
|
@@ -2290,7 +2439,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2290
2439
|
method: "POST",
|
|
2291
2440
|
...options
|
|
2292
2441
|
});
|
|
2293
|
-
|
|
2442
|
+
log16("Install count increased for agent %s: %d", identifier, result.installCount);
|
|
2294
2443
|
return result;
|
|
2295
2444
|
}
|
|
2296
2445
|
/**
|
|
@@ -2305,9 +2454,9 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2305
2454
|
* @returns Promise resolving to the status change response
|
|
2306
2455
|
*/
|
|
2307
2456
|
async changeStatus(identifier, status, options) {
|
|
2308
|
-
|
|
2457
|
+
log16("Changing agent status: %s -> %s", identifier, status);
|
|
2309
2458
|
const result = await this.modifyAgent({ identifier, status }, options);
|
|
2310
|
-
|
|
2459
|
+
log16("Agent status changed: %s -> %s", identifier, result.status);
|
|
2311
2460
|
return {
|
|
2312
2461
|
identifier: result.identifier,
|
|
2313
2462
|
status: result.status,
|
|
@@ -2325,7 +2474,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2325
2474
|
* @returns Promise resolving to the status change response
|
|
2326
2475
|
*/
|
|
2327
2476
|
async publish(identifier, options) {
|
|
2328
|
-
|
|
2477
|
+
log16("Publishing agent: %s", identifier);
|
|
2329
2478
|
return this.changeStatus(identifier, "published", options);
|
|
2330
2479
|
}
|
|
2331
2480
|
/**
|
|
@@ -2340,7 +2489,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2340
2489
|
* @returns Promise resolving to the status change response
|
|
2341
2490
|
*/
|
|
2342
2491
|
async unpublish(identifier, options) {
|
|
2343
|
-
|
|
2492
|
+
log16("Unpublishing agent: %s", identifier);
|
|
2344
2493
|
return this.changeStatus(identifier, "unpublished", options);
|
|
2345
2494
|
}
|
|
2346
2495
|
/**
|
|
@@ -2355,7 +2504,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2355
2504
|
* @returns Promise resolving to the status change response
|
|
2356
2505
|
*/
|
|
2357
2506
|
async archive(identifier, options) {
|
|
2358
|
-
|
|
2507
|
+
log16("Archiving agent: %s", identifier);
|
|
2359
2508
|
return this.changeStatus(identifier, "archived", options);
|
|
2360
2509
|
}
|
|
2361
2510
|
/**
|
|
@@ -2370,7 +2519,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2370
2519
|
* @returns Promise resolving to the status change response
|
|
2371
2520
|
*/
|
|
2372
2521
|
async deprecate(identifier, options) {
|
|
2373
|
-
|
|
2522
|
+
log16("Deprecating agent: %s", identifier);
|
|
2374
2523
|
return this.changeStatus(identifier, "deprecated", options);
|
|
2375
2524
|
}
|
|
2376
2525
|
/**
|
|
@@ -2388,12 +2537,12 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2388
2537
|
const locale = params.locale || this.defaultLocale;
|
|
2389
2538
|
const queryParams = { ...params, locale };
|
|
2390
2539
|
const queryString = this.buildQueryString(queryParams);
|
|
2391
|
-
|
|
2540
|
+
log16("Getting agents by plugin: %s", params.pluginId);
|
|
2392
2541
|
const result = await this.request(
|
|
2393
2542
|
`/v1/agents/by-plugin${queryString}`,
|
|
2394
2543
|
options
|
|
2395
2544
|
);
|
|
2396
|
-
|
|
2545
|
+
log16("Retrieved %d agents for plugin %s", result.items.length, params.pluginId);
|
|
2397
2546
|
return result;
|
|
2398
2547
|
}
|
|
2399
2548
|
/**
|
|
@@ -2409,7 +2558,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2409
2558
|
* @returns Promise resolving to the fork response with new agent details
|
|
2410
2559
|
*/
|
|
2411
2560
|
async forkAgent(sourceIdentifier, forkData, options) {
|
|
2412
|
-
|
|
2561
|
+
log16("Forking agent: %s -> %s", sourceIdentifier, forkData.identifier);
|
|
2413
2562
|
const result = await this.request(`/v1/agents/${sourceIdentifier}/fork`, {
|
|
2414
2563
|
body: JSON.stringify(forkData),
|
|
2415
2564
|
headers: {
|
|
@@ -2418,7 +2567,7 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2418
2567
|
method: "POST",
|
|
2419
2568
|
...options
|
|
2420
2569
|
});
|
|
2421
|
-
|
|
2570
|
+
log16("Agent forked successfully: %s (id: %d)", result.agent.identifier, result.agent.id);
|
|
2422
2571
|
return result;
|
|
2423
2572
|
}
|
|
2424
2573
|
/**
|
|
@@ -2432,12 +2581,12 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2432
2581
|
* @returns Promise resolving to the forks list response
|
|
2433
2582
|
*/
|
|
2434
2583
|
async getAgentForks(identifier, options) {
|
|
2435
|
-
|
|
2584
|
+
log16("Getting forks for agent: %s", identifier);
|
|
2436
2585
|
const result = await this.request(
|
|
2437
2586
|
`/v1/agents/${identifier}/forks`,
|
|
2438
2587
|
options
|
|
2439
2588
|
);
|
|
2440
|
-
|
|
2589
|
+
log16("Retrieved %d forks for agent: %s", result.totalCount, identifier);
|
|
2441
2590
|
return result;
|
|
2442
2591
|
}
|
|
2443
2592
|
/**
|
|
@@ -2450,23 +2599,23 @@ var AgentService2 = class extends BaseSDK {
|
|
|
2450
2599
|
* @returns Promise resolving to the fork source response
|
|
2451
2600
|
*/
|
|
2452
2601
|
async getAgentForkSource(identifier, options) {
|
|
2453
|
-
|
|
2602
|
+
log16("Getting fork source for agent: %s", identifier);
|
|
2454
2603
|
const result = await this.request(
|
|
2455
2604
|
`/v1/agents/${identifier}/fork-source`,
|
|
2456
2605
|
options
|
|
2457
2606
|
);
|
|
2458
2607
|
if (result.source) {
|
|
2459
|
-
|
|
2608
|
+
log16("Agent %s was forked from: %s", identifier, result.source.identifier);
|
|
2460
2609
|
} else {
|
|
2461
|
-
|
|
2610
|
+
log16("Agent %s is not a fork (original agent)", identifier);
|
|
2462
2611
|
}
|
|
2463
2612
|
return result;
|
|
2464
2613
|
}
|
|
2465
2614
|
};
|
|
2466
2615
|
|
|
2467
2616
|
// src/market/services/AgentGroupService.ts
|
|
2468
|
-
import
|
|
2469
|
-
var
|
|
2617
|
+
import debug17 from "debug";
|
|
2618
|
+
var log17 = debug17("lobe-market-sdk:agent-groups");
|
|
2470
2619
|
var AgentGroupService = class extends BaseSDK {
|
|
2471
2620
|
/**
|
|
2472
2621
|
* Retrieves a list of agent groups from the marketplace
|
|
@@ -2481,12 +2630,12 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2481
2630
|
const locale = params.locale || this.defaultLocale;
|
|
2482
2631
|
const queryParams = { ...params, locale };
|
|
2483
2632
|
const queryString = this.buildQueryString(queryParams);
|
|
2484
|
-
|
|
2633
|
+
log17("Getting agent group list: %O", queryParams);
|
|
2485
2634
|
const result = await this.request(
|
|
2486
2635
|
`/v1/agent-groups${queryString}`,
|
|
2487
2636
|
options
|
|
2488
2637
|
);
|
|
2489
|
-
|
|
2638
|
+
log17("Retrieved %d agent groups", result.items.length);
|
|
2490
2639
|
return result;
|
|
2491
2640
|
}
|
|
2492
2641
|
/**
|
|
@@ -2503,12 +2652,12 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2503
2652
|
const locale = params.locale || this.defaultLocale;
|
|
2504
2653
|
const queryParams = { ...params, locale };
|
|
2505
2654
|
const queryString = this.buildQueryString(queryParams);
|
|
2506
|
-
|
|
2655
|
+
log17("Getting own agent group list: %O", queryParams);
|
|
2507
2656
|
const result = await this.request(
|
|
2508
2657
|
`/v1/agent-groups/own${queryString}`,
|
|
2509
2658
|
options
|
|
2510
2659
|
);
|
|
2511
|
-
|
|
2660
|
+
log17("Retrieved %d own agent groups", result.items.length);
|
|
2512
2661
|
return result;
|
|
2513
2662
|
}
|
|
2514
2663
|
/**
|
|
@@ -2529,12 +2678,12 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2529
2678
|
queryParams.version = params.version.toString();
|
|
2530
2679
|
}
|
|
2531
2680
|
const queryString = this.buildQueryString(queryParams);
|
|
2532
|
-
|
|
2681
|
+
log17("Getting agent group detail: %O", { identifier, ...params });
|
|
2533
2682
|
const result = await this.request(
|
|
2534
2683
|
`/v1/agent-groups/detail${queryString}`,
|
|
2535
2684
|
options
|
|
2536
2685
|
);
|
|
2537
|
-
|
|
2686
|
+
log17("Agent group detail successfully retrieved: %s", identifier);
|
|
2538
2687
|
return result;
|
|
2539
2688
|
}
|
|
2540
2689
|
/**
|
|
@@ -2548,7 +2697,7 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2548
2697
|
* @returns Promise resolving to the created agent group response
|
|
2549
2698
|
*/
|
|
2550
2699
|
async createAgentGroup(groupData, options) {
|
|
2551
|
-
|
|
2700
|
+
log17("Creating agent group: %s", groupData.identifier);
|
|
2552
2701
|
const result = await this.request("/v1/agent-groups/create", {
|
|
2553
2702
|
body: JSON.stringify(groupData),
|
|
2554
2703
|
headers: {
|
|
@@ -2557,7 +2706,7 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2557
2706
|
method: "POST",
|
|
2558
2707
|
...options
|
|
2559
2708
|
});
|
|
2560
|
-
|
|
2709
|
+
log17("Agent group created successfully: %O", result);
|
|
2561
2710
|
return result;
|
|
2562
2711
|
}
|
|
2563
2712
|
/**
|
|
@@ -2571,7 +2720,7 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2571
2720
|
* @returns Promise resolving to the created version response
|
|
2572
2721
|
*/
|
|
2573
2722
|
async createAgentGroupVersion(versionData, options) {
|
|
2574
|
-
|
|
2723
|
+
log17("Creating agent group version: %s", versionData.identifier);
|
|
2575
2724
|
const result = await this.request(
|
|
2576
2725
|
"/v1/agent-groups/version-create",
|
|
2577
2726
|
{
|
|
@@ -2583,7 +2732,7 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2583
2732
|
...options
|
|
2584
2733
|
}
|
|
2585
2734
|
);
|
|
2586
|
-
|
|
2735
|
+
log17("Agent group version created successfully: %O", result);
|
|
2587
2736
|
return result;
|
|
2588
2737
|
}
|
|
2589
2738
|
/**
|
|
@@ -2597,7 +2746,7 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2597
2746
|
* @returns Promise resolving to the modified agent group response
|
|
2598
2747
|
*/
|
|
2599
2748
|
async modifyAgentGroup(groupData, options) {
|
|
2600
|
-
|
|
2749
|
+
log17("Modifying agent group: %s", groupData.identifier);
|
|
2601
2750
|
const result = await this.request("/v1/agent-groups/modify", {
|
|
2602
2751
|
body: JSON.stringify(groupData),
|
|
2603
2752
|
headers: {
|
|
@@ -2606,7 +2755,7 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2606
2755
|
method: "POST",
|
|
2607
2756
|
...options
|
|
2608
2757
|
});
|
|
2609
|
-
|
|
2758
|
+
log17("Agent group modified successfully: %O", result);
|
|
2610
2759
|
return result;
|
|
2611
2760
|
}
|
|
2612
2761
|
/**
|
|
@@ -2617,13 +2766,13 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2617
2766
|
* @returns Promise resolving to true if agent group exists, false otherwise
|
|
2618
2767
|
*/
|
|
2619
2768
|
async checkAgentGroupExists(identifier, options) {
|
|
2620
|
-
|
|
2769
|
+
log17("Checking if agent group exists: %s", identifier);
|
|
2621
2770
|
try {
|
|
2622
2771
|
await this.getAgentGroupDetail(identifier, {}, options);
|
|
2623
|
-
|
|
2772
|
+
log17("Agent group exists: %s", identifier);
|
|
2624
2773
|
return true;
|
|
2625
2774
|
} catch (e) {
|
|
2626
|
-
|
|
2775
|
+
log17("Agent group does not exist: %s", identifier);
|
|
2627
2776
|
return false;
|
|
2628
2777
|
}
|
|
2629
2778
|
}
|
|
@@ -2639,9 +2788,9 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2639
2788
|
* @returns Promise resolving to the status change response
|
|
2640
2789
|
*/
|
|
2641
2790
|
async changeStatus(identifier, status, options) {
|
|
2642
|
-
|
|
2791
|
+
log17("Changing agent group status: %s -> %s", identifier, status);
|
|
2643
2792
|
const result = await this.modifyAgentGroup({ identifier, status }, options);
|
|
2644
|
-
|
|
2793
|
+
log17("Agent group status changed: %s -> %s", identifier, result.status);
|
|
2645
2794
|
return {
|
|
2646
2795
|
identifier: result.identifier,
|
|
2647
2796
|
status: result.status,
|
|
@@ -2660,7 +2809,7 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2660
2809
|
* @returns Promise resolving to the status change response
|
|
2661
2810
|
*/
|
|
2662
2811
|
async publish(identifier, options) {
|
|
2663
|
-
|
|
2812
|
+
log17("Publishing agent group: %s", identifier);
|
|
2664
2813
|
return this.changeStatus(identifier, "published", options);
|
|
2665
2814
|
}
|
|
2666
2815
|
/**
|
|
@@ -2675,7 +2824,7 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2675
2824
|
* @returns Promise resolving to the status change response
|
|
2676
2825
|
*/
|
|
2677
2826
|
async unpublish(identifier, options) {
|
|
2678
|
-
|
|
2827
|
+
log17("Unpublishing agent group: %s", identifier);
|
|
2679
2828
|
return this.changeStatus(identifier, "unpublished", options);
|
|
2680
2829
|
}
|
|
2681
2830
|
/**
|
|
@@ -2690,7 +2839,7 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2690
2839
|
* @returns Promise resolving to the status change response
|
|
2691
2840
|
*/
|
|
2692
2841
|
async archive(identifier, options) {
|
|
2693
|
-
|
|
2842
|
+
log17("Archiving agent group: %s", identifier);
|
|
2694
2843
|
return this.changeStatus(identifier, "archived", options);
|
|
2695
2844
|
}
|
|
2696
2845
|
/**
|
|
@@ -2705,7 +2854,7 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2705
2854
|
* @returns Promise resolving to the status change response
|
|
2706
2855
|
*/
|
|
2707
2856
|
async deprecate(identifier, options) {
|
|
2708
|
-
|
|
2857
|
+
log17("Deprecating agent group: %s", identifier);
|
|
2709
2858
|
return this.changeStatus(identifier, "deprecated", options);
|
|
2710
2859
|
}
|
|
2711
2860
|
/**
|
|
@@ -2721,7 +2870,7 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2721
2870
|
* @returns Promise resolving to the fork response with new group details
|
|
2722
2871
|
*/
|
|
2723
2872
|
async forkAgentGroup(sourceIdentifier, forkData, options) {
|
|
2724
|
-
|
|
2873
|
+
log17("Forking agent group: %s -> %s", sourceIdentifier, forkData.identifier);
|
|
2725
2874
|
const result = await this.request(
|
|
2726
2875
|
`/v1/agent-groups/${sourceIdentifier}/fork`,
|
|
2727
2876
|
{
|
|
@@ -2733,7 +2882,7 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2733
2882
|
...options
|
|
2734
2883
|
}
|
|
2735
2884
|
);
|
|
2736
|
-
|
|
2885
|
+
log17(
|
|
2737
2886
|
"Agent group forked successfully: %s (id: %d, members: %d)",
|
|
2738
2887
|
result.group.identifier,
|
|
2739
2888
|
result.group.id,
|
|
@@ -2752,12 +2901,12 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2752
2901
|
* @returns Promise resolving to the forks list response
|
|
2753
2902
|
*/
|
|
2754
2903
|
async getAgentGroupForks(identifier, options) {
|
|
2755
|
-
|
|
2904
|
+
log17("Getting forks for agent group: %s", identifier);
|
|
2756
2905
|
const result = await this.request(
|
|
2757
2906
|
`/v1/agent-groups/${identifier}/forks`,
|
|
2758
2907
|
options
|
|
2759
2908
|
);
|
|
2760
|
-
|
|
2909
|
+
log17("Retrieved %d forks for agent group: %s", result.totalCount, identifier);
|
|
2761
2910
|
return result;
|
|
2762
2911
|
}
|
|
2763
2912
|
/**
|
|
@@ -2770,24 +2919,24 @@ var AgentGroupService = class extends BaseSDK {
|
|
|
2770
2919
|
* @returns Promise resolving to the fork source response
|
|
2771
2920
|
*/
|
|
2772
2921
|
async getAgentGroupForkSource(identifier, options) {
|
|
2773
|
-
|
|
2922
|
+
log17("Getting fork source for agent group: %s", identifier);
|
|
2774
2923
|
const result = await this.request(
|
|
2775
2924
|
`/v1/agent-groups/${identifier}/fork-source`,
|
|
2776
2925
|
options
|
|
2777
2926
|
);
|
|
2778
2927
|
if (result.source) {
|
|
2779
|
-
|
|
2928
|
+
log17("Agent group %s was forked from: %s", identifier, result.source.identifier);
|
|
2780
2929
|
} else {
|
|
2781
|
-
|
|
2930
|
+
log17("Agent group %s is not a fork (original group)", identifier);
|
|
2782
2931
|
}
|
|
2783
2932
|
return result;
|
|
2784
2933
|
}
|
|
2785
2934
|
};
|
|
2786
2935
|
|
|
2787
2936
|
// src/market/services/AuthService.ts
|
|
2788
|
-
import
|
|
2937
|
+
import debug18 from "debug";
|
|
2789
2938
|
import urlJoin2 from "url-join";
|
|
2790
|
-
var
|
|
2939
|
+
var log18 = debug18("lobe-market-sdk:auth");
|
|
2791
2940
|
var _AuthService = class _AuthService extends BaseSDK {
|
|
2792
2941
|
/** Normalize token response from snake_case to camelCase fields */
|
|
2793
2942
|
static normalizeTokenResponse(data) {
|
|
@@ -2819,7 +2968,7 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2819
2968
|
if (grantType !== "authorization_code" && grantType !== "refresh_token") {
|
|
2820
2969
|
throw new Error(`Unsupported grant type: ${grantType}`);
|
|
2821
2970
|
}
|
|
2822
|
-
|
|
2971
|
+
log18("Exchanging OAuth token using grant_type=%s", grantType);
|
|
2823
2972
|
const tokenUrl = urlJoin2(this.baseUrl, "lobehub-oidc/token");
|
|
2824
2973
|
const params = new URLSearchParams();
|
|
2825
2974
|
params.set("grant_type", grantType);
|
|
@@ -2861,16 +3010,16 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2861
3010
|
try {
|
|
2862
3011
|
payload = await response.json();
|
|
2863
3012
|
} catch (error) {
|
|
2864
|
-
|
|
3013
|
+
log18("Failed to parse token response: %O", error);
|
|
2865
3014
|
throw new Error(`Failed to parse token response: ${response.status} ${response.statusText}`);
|
|
2866
3015
|
}
|
|
2867
3016
|
if (!response.ok) {
|
|
2868
3017
|
const errorDescription = (payload == null ? void 0 : payload.error_description) || (payload == null ? void 0 : payload.error) || response.statusText;
|
|
2869
3018
|
const errorMsg = `Token exchange failed: ${response.status} ${errorDescription}`;
|
|
2870
|
-
|
|
3019
|
+
log18("Error: %s", errorMsg);
|
|
2871
3020
|
throw new Error(errorMsg);
|
|
2872
3021
|
}
|
|
2873
|
-
|
|
3022
|
+
log18("Token exchange successful");
|
|
2874
3023
|
return _AuthService.normalizeTokenResponse(payload);
|
|
2875
3024
|
}
|
|
2876
3025
|
/**
|
|
@@ -2888,7 +3037,7 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2888
3037
|
if (!clientId || !token) {
|
|
2889
3038
|
throw new Error("clientId and token are required for token revocation");
|
|
2890
3039
|
}
|
|
2891
|
-
|
|
3040
|
+
log18("Revoking OAuth token (hint=%s)", tokenTypeHint != null ? tokenTypeHint : "none");
|
|
2892
3041
|
const revocationUrl = urlJoin2(this.baseUrl, "lobehub-oidc/token/revocation");
|
|
2893
3042
|
const params = new URLSearchParams();
|
|
2894
3043
|
params.set("client_id", clientId);
|
|
@@ -2916,10 +3065,10 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2916
3065
|
} catch (e) {
|
|
2917
3066
|
}
|
|
2918
3067
|
const errorMsg = `Token revocation failed: ${response.status} ${errorDescription}`;
|
|
2919
|
-
|
|
3068
|
+
log18("Error: %s", errorMsg);
|
|
2920
3069
|
throw new Error(errorMsg);
|
|
2921
3070
|
}
|
|
2922
|
-
|
|
3071
|
+
log18("Token revocation successful");
|
|
2923
3072
|
}
|
|
2924
3073
|
/**
|
|
2925
3074
|
* Retrieves user information from the OIDC userinfo endpoint
|
|
@@ -2931,7 +3080,7 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2931
3080
|
* @returns Promise resolving to the user information
|
|
2932
3081
|
*/
|
|
2933
3082
|
async getUserInfo(accessToken, options) {
|
|
2934
|
-
|
|
3083
|
+
log18("Getting user info");
|
|
2935
3084
|
const userInfoUrl = urlJoin2(this.baseUrl, "lobehub-oidc/userinfo");
|
|
2936
3085
|
const response = await fetch(userInfoUrl, {
|
|
2937
3086
|
headers: {
|
|
@@ -2943,11 +3092,11 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2943
3092
|
});
|
|
2944
3093
|
if (!response.ok) {
|
|
2945
3094
|
const errorMsg = `Failed to fetch user info: ${response.status} ${response.statusText}`;
|
|
2946
|
-
|
|
3095
|
+
log18("Error: %s", errorMsg);
|
|
2947
3096
|
throw new Error(errorMsg);
|
|
2948
3097
|
}
|
|
2949
3098
|
const userInfo = await response.json();
|
|
2950
|
-
|
|
3099
|
+
log18("User info retrieved successfully");
|
|
2951
3100
|
return userInfo;
|
|
2952
3101
|
}
|
|
2953
3102
|
/**
|
|
@@ -2961,7 +3110,7 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2961
3110
|
* @returns Promise resolving to the client credentials
|
|
2962
3111
|
*/
|
|
2963
3112
|
async registerClient(clientData, options) {
|
|
2964
|
-
|
|
3113
|
+
log18("Registering client: %s (%s)", clientData.clientName, clientData.clientType);
|
|
2965
3114
|
const result = await this.request("/v1/clients/register", {
|
|
2966
3115
|
body: JSON.stringify(clientData),
|
|
2967
3116
|
headers: {
|
|
@@ -2970,7 +3119,7 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2970
3119
|
method: "POST",
|
|
2971
3120
|
...options
|
|
2972
3121
|
});
|
|
2973
|
-
|
|
3122
|
+
log18("Client registered successfully: %s", result.client_id);
|
|
2974
3123
|
return result;
|
|
2975
3124
|
}
|
|
2976
3125
|
/**
|
|
@@ -2982,9 +3131,9 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2982
3131
|
* @returns Promise resolving to the access token and expiration time
|
|
2983
3132
|
*/
|
|
2984
3133
|
async getM2MToken() {
|
|
2985
|
-
|
|
3134
|
+
log18("Fetching M2M token");
|
|
2986
3135
|
const tokenInfo = await this.fetchM2MToken();
|
|
2987
|
-
|
|
3136
|
+
log18("M2M token fetched successfully");
|
|
2988
3137
|
return tokenInfo;
|
|
2989
3138
|
}
|
|
2990
3139
|
/** OAuth handoff response shapes */
|
|
@@ -3010,7 +3159,7 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
3010
3159
|
async getOAuthHandoff(id, options) {
|
|
3011
3160
|
var _a, _b;
|
|
3012
3161
|
if (!id) throw new Error("id is required");
|
|
3013
|
-
|
|
3162
|
+
log18("Getting OAuth handoff: %s", id);
|
|
3014
3163
|
const handoffUrl = `${urlJoin2(this.baseUrl, "lobehub-oidc/handoff")}?id=${encodeURIComponent(id)}`;
|
|
3015
3164
|
const response = await fetch(handoffUrl, {
|
|
3016
3165
|
headers: {
|
|
@@ -3026,19 +3175,19 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
3026
3175
|
code: json.code,
|
|
3027
3176
|
redirectUri: json.redirectUri
|
|
3028
3177
|
});
|
|
3029
|
-
|
|
3178
|
+
log18("OAuth handoff success for id: %s", id);
|
|
3030
3179
|
return result;
|
|
3031
3180
|
}
|
|
3032
3181
|
if (response.status === 202) {
|
|
3033
|
-
|
|
3182
|
+
log18("OAuth handoff pending for id: %s", id);
|
|
3034
3183
|
return { status: _AuthService.HANDOFF_PENDING_STATUS };
|
|
3035
3184
|
}
|
|
3036
3185
|
if (response.status === 404) {
|
|
3037
|
-
|
|
3186
|
+
log18("OAuth handoff consumed for id: %s", id);
|
|
3038
3187
|
return { status: _AuthService.HANDOFF_CONSUMED_STATUS };
|
|
3039
3188
|
}
|
|
3040
3189
|
if (response.status === 410) {
|
|
3041
|
-
|
|
3190
|
+
log18("OAuth handoff expired for id: %s", id);
|
|
3042
3191
|
return { status: _AuthService.HANDOFF_EXPIRED_STATUS };
|
|
3043
3192
|
}
|
|
3044
3193
|
let errorMessage = `Failed to fetch OAuth handoff (status ${response.status} ${response.statusText})`;
|
|
@@ -3049,7 +3198,7 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
3049
3198
|
}
|
|
3050
3199
|
} catch (e) {
|
|
3051
3200
|
}
|
|
3052
|
-
|
|
3201
|
+
log18("Error: %s", errorMessage);
|
|
3053
3202
|
throw new Error(errorMessage);
|
|
3054
3203
|
}
|
|
3055
3204
|
/**
|
|
@@ -3063,21 +3212,21 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
3063
3212
|
const timeoutMs = (_b = params.timeoutMs) != null ? _b : 6e4;
|
|
3064
3213
|
const startedAt = Date.now();
|
|
3065
3214
|
const { signal, requestInit } = params;
|
|
3066
|
-
|
|
3215
|
+
log18("Start polling OAuth handoff: %s", id);
|
|
3067
3216
|
while (true) {
|
|
3068
3217
|
if (signal == null ? void 0 : signal.aborted) {
|
|
3069
3218
|
const err = new Error("Polling aborted");
|
|
3070
|
-
|
|
3219
|
+
log18("Error: %s", err.message);
|
|
3071
3220
|
throw err;
|
|
3072
3221
|
}
|
|
3073
3222
|
if (Date.now() - startedAt > timeoutMs) {
|
|
3074
3223
|
const err = new Error("Polling timeout");
|
|
3075
|
-
|
|
3224
|
+
log18("Error: %s", err.message);
|
|
3076
3225
|
throw err;
|
|
3077
3226
|
}
|
|
3078
3227
|
const result = await this.getOAuthHandoff(id, requestInit);
|
|
3079
3228
|
if (result.status === "success" || result.status === "expired" || result.status === "consumed") {
|
|
3080
|
-
|
|
3229
|
+
log18("Stop polling OAuth handoff (terminal): %s -> %s", id, result.status);
|
|
3081
3230
|
return result;
|
|
3082
3231
|
}
|
|
3083
3232
|
await new Promise((resolve) => {
|
|
@@ -3098,9 +3247,9 @@ _AuthService.HANDOFF_EXPIRED_STATUS = "expired";
|
|
|
3098
3247
|
var AuthService = _AuthService;
|
|
3099
3248
|
|
|
3100
3249
|
// src/market/services/ConnectService.ts
|
|
3101
|
-
import
|
|
3250
|
+
import debug19 from "debug";
|
|
3102
3251
|
import urlJoin3 from "url-join";
|
|
3103
|
-
var
|
|
3252
|
+
var log19 = debug19("lobe-market-sdk:connect");
|
|
3104
3253
|
var CIMD_CLIENT_METADATA_VERSION = "v1";
|
|
3105
3254
|
var CIMD_CLIENT_METADATA_VERSION_BY_PROVIDER = {
|
|
3106
3255
|
posthog: "v2"
|
|
@@ -3124,9 +3273,9 @@ var ConnectService = class extends BaseSDK {
|
|
|
3124
3273
|
*/
|
|
3125
3274
|
async listProviders(options) {
|
|
3126
3275
|
var _a;
|
|
3127
|
-
|
|
3276
|
+
log19("Listing connect providers");
|
|
3128
3277
|
const result = await this.request("/connect/providers", options);
|
|
3129
|
-
|
|
3278
|
+
log19("Found %d connect providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
|
|
3130
3279
|
return result;
|
|
3131
3280
|
}
|
|
3132
3281
|
/**
|
|
@@ -3140,12 +3289,12 @@ var ConnectService = class extends BaseSDK {
|
|
|
3140
3289
|
*/
|
|
3141
3290
|
async getProvider(provider, options) {
|
|
3142
3291
|
var _a;
|
|
3143
|
-
|
|
3292
|
+
log19("Getting provider details: %s", provider);
|
|
3144
3293
|
const result = await this.request(
|
|
3145
3294
|
`/connect/providers/${encodeURIComponent(provider)}`,
|
|
3146
3295
|
options
|
|
3147
3296
|
);
|
|
3148
|
-
|
|
3297
|
+
log19("Retrieved provider: %s", (_a = result.provider) == null ? void 0 : _a.name);
|
|
3149
3298
|
return result;
|
|
3150
3299
|
}
|
|
3151
3300
|
/**
|
|
@@ -3164,12 +3313,12 @@ var ConnectService = class extends BaseSDK {
|
|
|
3164
3313
|
const metadataParams = hasParams ? params : void 0;
|
|
3165
3314
|
const requestOptions = hasParams ? options : params;
|
|
3166
3315
|
const version = getCimdClientMetadataVersion(provider, metadataParams == null ? void 0 : metadataParams.version);
|
|
3167
|
-
|
|
3316
|
+
log19("Getting CIMD client metadata for provider: %s version: %s", provider, version);
|
|
3168
3317
|
const result = await this.request(
|
|
3169
3318
|
`/connect/${encodeURIComponent(provider)}/oauth/client-metadata/${encodeURIComponent(version)}.json`,
|
|
3170
3319
|
requestOptions
|
|
3171
3320
|
);
|
|
3172
|
-
|
|
3321
|
+
log19("Retrieved CIMD client metadata: %s", result.client_id);
|
|
3173
3322
|
return result;
|
|
3174
3323
|
}
|
|
3175
3324
|
/**
|
|
@@ -3209,7 +3358,7 @@ var ConnectService = class extends BaseSDK {
|
|
|
3209
3358
|
* ```
|
|
3210
3359
|
*/
|
|
3211
3360
|
async authorize(provider, params, options) {
|
|
3212
|
-
|
|
3361
|
+
log19("Requesting authorization code for provider: %s", provider);
|
|
3213
3362
|
const result = await this.request(
|
|
3214
3363
|
`/connect/${encodeURIComponent(provider)}/authorize`,
|
|
3215
3364
|
{
|
|
@@ -3221,7 +3370,7 @@ var ConnectService = class extends BaseSDK {
|
|
|
3221
3370
|
...options
|
|
3222
3371
|
}
|
|
3223
3372
|
);
|
|
3224
|
-
|
|
3373
|
+
log19("Authorization code obtained, expires in %d seconds", result.expires_in);
|
|
3225
3374
|
return result;
|
|
3226
3375
|
}
|
|
3227
3376
|
/**
|
|
@@ -3247,7 +3396,7 @@ var ConnectService = class extends BaseSDK {
|
|
|
3247
3396
|
* ```
|
|
3248
3397
|
*/
|
|
3249
3398
|
getAuthorizeUrl(provider, params) {
|
|
3250
|
-
|
|
3399
|
+
log19(
|
|
3251
3400
|
"Generating authorize URL for provider: %s (deprecated, use authorize() instead)",
|
|
3252
3401
|
provider
|
|
3253
3402
|
);
|
|
@@ -3261,7 +3410,7 @@ var ConnectService = class extends BaseSDK {
|
|
|
3261
3410
|
const queryString = queryParams.toString();
|
|
3262
3411
|
const path = `/connect/${encodeURIComponent(provider)}/start${queryString ? `?${queryString}` : ""}`;
|
|
3263
3412
|
const url = urlJoin3(this.baseUrl, "api", path);
|
|
3264
|
-
|
|
3413
|
+
log19("Generated authorize URL: %s", url);
|
|
3265
3414
|
return url;
|
|
3266
3415
|
}
|
|
3267
3416
|
/**
|
|
@@ -3275,12 +3424,12 @@ var ConnectService = class extends BaseSDK {
|
|
|
3275
3424
|
* @returns Promise resolving to the connection status
|
|
3276
3425
|
*/
|
|
3277
3426
|
async getStatus(provider, options) {
|
|
3278
|
-
|
|
3427
|
+
log19("Getting connection status for provider: %s", provider);
|
|
3279
3428
|
const result = await this.request(
|
|
3280
3429
|
`/connect/${encodeURIComponent(provider)}/status`,
|
|
3281
3430
|
options
|
|
3282
3431
|
);
|
|
3283
|
-
|
|
3432
|
+
log19("Provider %s connection status: connected=%s", provider, result.connected);
|
|
3284
3433
|
return result;
|
|
3285
3434
|
}
|
|
3286
3435
|
/**
|
|
@@ -3293,9 +3442,9 @@ var ConnectService = class extends BaseSDK {
|
|
|
3293
3442
|
*/
|
|
3294
3443
|
async listConnections(options) {
|
|
3295
3444
|
var _a;
|
|
3296
|
-
|
|
3445
|
+
log19("Listing user connections");
|
|
3297
3446
|
const result = await this.request("/connect/connections", options);
|
|
3298
|
-
|
|
3447
|
+
log19("Found %d connections", ((_a = result.connections) == null ? void 0 : _a.length) || 0);
|
|
3299
3448
|
return result;
|
|
3300
3449
|
}
|
|
3301
3450
|
/**
|
|
@@ -3309,12 +3458,12 @@ var ConnectService = class extends BaseSDK {
|
|
|
3309
3458
|
* @returns Promise resolving to the connection health status
|
|
3310
3459
|
*/
|
|
3311
3460
|
async getHealth(provider, options) {
|
|
3312
|
-
|
|
3461
|
+
log19("Checking health for provider: %s", provider);
|
|
3313
3462
|
const result = await this.request(
|
|
3314
3463
|
`/connect/${encodeURIComponent(provider)}/health`,
|
|
3315
3464
|
options
|
|
3316
3465
|
);
|
|
3317
|
-
|
|
3466
|
+
log19("Provider %s health: healthy=%s, status=%s", provider, result.healthy, result.tokenStatus);
|
|
3318
3467
|
return result;
|
|
3319
3468
|
}
|
|
3320
3469
|
/**
|
|
@@ -3327,9 +3476,9 @@ var ConnectService = class extends BaseSDK {
|
|
|
3327
3476
|
*/
|
|
3328
3477
|
async getAllHealth(options) {
|
|
3329
3478
|
var _a, _b, _c;
|
|
3330
|
-
|
|
3479
|
+
log19("Checking health for all connections");
|
|
3331
3480
|
const result = await this.request("/connect/health", options);
|
|
3332
|
-
|
|
3481
|
+
log19(
|
|
3333
3482
|
"Health check complete: total=%d, healthy=%d, unhealthy=%d",
|
|
3334
3483
|
((_a = result.summary) == null ? void 0 : _a.total) || 0,
|
|
3335
3484
|
((_b = result.summary) == null ? void 0 : _b.healthy) || 0,
|
|
@@ -3348,7 +3497,7 @@ var ConnectService = class extends BaseSDK {
|
|
|
3348
3497
|
* @returns Promise resolving to the refresh result
|
|
3349
3498
|
*/
|
|
3350
3499
|
async refresh(provider, options) {
|
|
3351
|
-
|
|
3500
|
+
log19("Refreshing token for provider: %s", provider);
|
|
3352
3501
|
const result = await this.request(
|
|
3353
3502
|
`/connect/${encodeURIComponent(provider)}/refresh`,
|
|
3354
3503
|
{
|
|
@@ -3356,7 +3505,7 @@ var ConnectService = class extends BaseSDK {
|
|
|
3356
3505
|
...options
|
|
3357
3506
|
}
|
|
3358
3507
|
);
|
|
3359
|
-
|
|
3508
|
+
log19("Token refresh for %s: refreshed=%s", provider, result.refreshed);
|
|
3360
3509
|
return result;
|
|
3361
3510
|
}
|
|
3362
3511
|
/**
|
|
@@ -3370,7 +3519,7 @@ var ConnectService = class extends BaseSDK {
|
|
|
3370
3519
|
* @returns Promise resolving to the revoke result
|
|
3371
3520
|
*/
|
|
3372
3521
|
async revoke(provider, options) {
|
|
3373
|
-
|
|
3522
|
+
log19("Revoking connection for provider: %s", provider);
|
|
3374
3523
|
const result = await this.request(
|
|
3375
3524
|
`/connect/${encodeURIComponent(provider)}`,
|
|
3376
3525
|
{
|
|
@@ -3378,14 +3527,14 @@ var ConnectService = class extends BaseSDK {
|
|
|
3378
3527
|
...options
|
|
3379
3528
|
}
|
|
3380
3529
|
);
|
|
3381
|
-
|
|
3530
|
+
log19("Connection revoked for %s: success=%s", provider, result.success);
|
|
3382
3531
|
return result;
|
|
3383
3532
|
}
|
|
3384
3533
|
};
|
|
3385
3534
|
|
|
3386
3535
|
// src/market/services/CredService.ts
|
|
3387
|
-
import
|
|
3388
|
-
var
|
|
3536
|
+
import debug20 from "debug";
|
|
3537
|
+
var log20 = debug20("lobe-market-sdk:creds");
|
|
3389
3538
|
var CredService = class extends BaseSDK {
|
|
3390
3539
|
// ===========================================================================
|
|
3391
3540
|
// List & Get Operations
|
|
@@ -3401,9 +3550,9 @@ var CredService = class extends BaseSDK {
|
|
|
3401
3550
|
*/
|
|
3402
3551
|
async list(options) {
|
|
3403
3552
|
var _a;
|
|
3404
|
-
|
|
3553
|
+
log20("Listing user credentials");
|
|
3405
3554
|
const result = await this.request("/v1/user/creds", options);
|
|
3406
|
-
|
|
3555
|
+
log20("Found %d credentials", ((_a = result.data) == null ? void 0 : _a.length) || 0);
|
|
3407
3556
|
return result;
|
|
3408
3557
|
}
|
|
3409
3558
|
/**
|
|
@@ -3418,7 +3567,7 @@ var CredService = class extends BaseSDK {
|
|
|
3418
3567
|
* @returns Promise resolving to the credential details
|
|
3419
3568
|
*/
|
|
3420
3569
|
async get(id, getOptions, options) {
|
|
3421
|
-
|
|
3570
|
+
log20("Getting credential: %d (decrypt=%s)", id, getOptions == null ? void 0 : getOptions.decrypt);
|
|
3422
3571
|
const queryParams = {};
|
|
3423
3572
|
if (getOptions == null ? void 0 : getOptions.decrypt) {
|
|
3424
3573
|
queryParams.decrypt = "true";
|
|
@@ -3428,7 +3577,7 @@ var CredService = class extends BaseSDK {
|
|
|
3428
3577
|
`/v1/user/creds/${id}${queryString}`,
|
|
3429
3578
|
options
|
|
3430
3579
|
);
|
|
3431
|
-
|
|
3580
|
+
log20("Retrieved credential: %s", result.key);
|
|
3432
3581
|
return result;
|
|
3433
3582
|
}
|
|
3434
3583
|
// ===========================================================================
|
|
@@ -3447,7 +3596,7 @@ var CredService = class extends BaseSDK {
|
|
|
3447
3596
|
* @returns Promise resolving to the created credential
|
|
3448
3597
|
*/
|
|
3449
3598
|
async createKV(data, options) {
|
|
3450
|
-
|
|
3599
|
+
log20("Creating KV credential: %s (type=%s)", data.key, data.type);
|
|
3451
3600
|
const result = await this.request("/v1/user/creds/kv", {
|
|
3452
3601
|
body: JSON.stringify(data),
|
|
3453
3602
|
headers: {
|
|
@@ -3456,7 +3605,7 @@ var CredService = class extends BaseSDK {
|
|
|
3456
3605
|
method: "POST",
|
|
3457
3606
|
...options
|
|
3458
3607
|
});
|
|
3459
|
-
|
|
3608
|
+
log20("Created KV credential: %d", result.id);
|
|
3460
3609
|
return result;
|
|
3461
3610
|
}
|
|
3462
3611
|
/**
|
|
@@ -3470,7 +3619,7 @@ var CredService = class extends BaseSDK {
|
|
|
3470
3619
|
* @returns Promise resolving to the created credential
|
|
3471
3620
|
*/
|
|
3472
3621
|
async createOAuth(data, options) {
|
|
3473
|
-
|
|
3622
|
+
log20("Creating OAuth credential: %s (connectionId=%d)", data.key, data.oauthConnectionId);
|
|
3474
3623
|
const result = await this.request("/v1/user/creds/oauth", {
|
|
3475
3624
|
body: JSON.stringify(data),
|
|
3476
3625
|
headers: {
|
|
@@ -3479,7 +3628,7 @@ var CredService = class extends BaseSDK {
|
|
|
3479
3628
|
method: "POST",
|
|
3480
3629
|
...options
|
|
3481
3630
|
});
|
|
3482
|
-
|
|
3631
|
+
log20("Created OAuth credential: %d", result.id);
|
|
3483
3632
|
return result;
|
|
3484
3633
|
}
|
|
3485
3634
|
/**
|
|
@@ -3493,7 +3642,7 @@ var CredService = class extends BaseSDK {
|
|
|
3493
3642
|
* @returns Promise resolving to the created credential
|
|
3494
3643
|
*/
|
|
3495
3644
|
async createFile(data, options) {
|
|
3496
|
-
|
|
3645
|
+
log20("Creating file credential: %s (fileName=%s)", data.key, data.fileName);
|
|
3497
3646
|
const result = await this.request("/v1/user/creds/file", {
|
|
3498
3647
|
body: JSON.stringify(data),
|
|
3499
3648
|
headers: {
|
|
@@ -3502,7 +3651,7 @@ var CredService = class extends BaseSDK {
|
|
|
3502
3651
|
method: "POST",
|
|
3503
3652
|
...options
|
|
3504
3653
|
});
|
|
3505
|
-
|
|
3654
|
+
log20("Created file credential: %d", result.id);
|
|
3506
3655
|
return result;
|
|
3507
3656
|
}
|
|
3508
3657
|
// ===========================================================================
|
|
@@ -3520,7 +3669,7 @@ var CredService = class extends BaseSDK {
|
|
|
3520
3669
|
* @returns Promise resolving to the updated credential
|
|
3521
3670
|
*/
|
|
3522
3671
|
async update(id, data, options) {
|
|
3523
|
-
|
|
3672
|
+
log20("Updating credential: %d", id);
|
|
3524
3673
|
const result = await this.request(`/v1/user/creds/${id}`, {
|
|
3525
3674
|
body: JSON.stringify(data),
|
|
3526
3675
|
headers: {
|
|
@@ -3529,7 +3678,7 @@ var CredService = class extends BaseSDK {
|
|
|
3529
3678
|
method: "PATCH",
|
|
3530
3679
|
...options
|
|
3531
3680
|
});
|
|
3532
|
-
|
|
3681
|
+
log20("Updated credential: %d", result.id);
|
|
3533
3682
|
return result;
|
|
3534
3683
|
}
|
|
3535
3684
|
// ===========================================================================
|
|
@@ -3550,7 +3699,7 @@ var CredService = class extends BaseSDK {
|
|
|
3550
3699
|
* @returns Promise resolving to the updated credential
|
|
3551
3700
|
*/
|
|
3552
3701
|
async share(id, data, options) {
|
|
3553
|
-
|
|
3702
|
+
log20("Sharing credential %d with org %s", id, data.orgId);
|
|
3554
3703
|
const result = await this.request(`/v1/user/creds/${id}/share`, {
|
|
3555
3704
|
body: JSON.stringify(data),
|
|
3556
3705
|
headers: {
|
|
@@ -3559,7 +3708,7 @@ var CredService = class extends BaseSDK {
|
|
|
3559
3708
|
method: "POST",
|
|
3560
3709
|
...options
|
|
3561
3710
|
});
|
|
3562
|
-
|
|
3711
|
+
log20("Shared credential: %d", result.id);
|
|
3563
3712
|
return result;
|
|
3564
3713
|
}
|
|
3565
3714
|
/**
|
|
@@ -3574,12 +3723,12 @@ var CredService = class extends BaseSDK {
|
|
|
3574
3723
|
* @returns Promise resolving to the updated credential
|
|
3575
3724
|
*/
|
|
3576
3725
|
async publish(id, options) {
|
|
3577
|
-
|
|
3726
|
+
log20("Publishing credential: %d", id);
|
|
3578
3727
|
const result = await this.request(`/v1/user/creds/${id}/publish`, {
|
|
3579
3728
|
method: "POST",
|
|
3580
3729
|
...options
|
|
3581
3730
|
});
|
|
3582
|
-
|
|
3731
|
+
log20("Published credential: %d", result.id);
|
|
3583
3732
|
return result;
|
|
3584
3733
|
}
|
|
3585
3734
|
/**
|
|
@@ -3594,12 +3743,12 @@ var CredService = class extends BaseSDK {
|
|
|
3594
3743
|
* @returns Promise resolving to the updated credential
|
|
3595
3744
|
*/
|
|
3596
3745
|
async unshare(id, options) {
|
|
3597
|
-
|
|
3746
|
+
log20("Unsharing credential: %d", id);
|
|
3598
3747
|
const result = await this.request(`/v1/user/creds/${id}/unshare`, {
|
|
3599
3748
|
method: "POST",
|
|
3600
3749
|
...options
|
|
3601
3750
|
});
|
|
3602
|
-
|
|
3751
|
+
log20("Unshared credential: %d", result.id);
|
|
3603
3752
|
return result;
|
|
3604
3753
|
}
|
|
3605
3754
|
// ===========================================================================
|
|
@@ -3615,12 +3764,12 @@ var CredService = class extends BaseSDK {
|
|
|
3615
3764
|
* @returns Promise resolving to the delete result
|
|
3616
3765
|
*/
|
|
3617
3766
|
async delete(id, options) {
|
|
3618
|
-
|
|
3767
|
+
log20("Deleting credential by ID: %d", id);
|
|
3619
3768
|
const result = await this.request(`/v1/user/creds/${id}`, {
|
|
3620
3769
|
method: "DELETE",
|
|
3621
3770
|
...options
|
|
3622
3771
|
});
|
|
3623
|
-
|
|
3772
|
+
log20("Deleted credential: %d, success=%s", id, result.success);
|
|
3624
3773
|
return result;
|
|
3625
3774
|
}
|
|
3626
3775
|
/**
|
|
@@ -3634,7 +3783,7 @@ var CredService = class extends BaseSDK {
|
|
|
3634
3783
|
* @returns Promise resolving to the delete result
|
|
3635
3784
|
*/
|
|
3636
3785
|
async deleteByKey(key, options) {
|
|
3637
|
-
|
|
3786
|
+
log20("Deleting credential by key: %s", key);
|
|
3638
3787
|
const result = await this.request(
|
|
3639
3788
|
`/v1/user/creds/key/${encodeURIComponent(key)}`,
|
|
3640
3789
|
{
|
|
@@ -3642,7 +3791,7 @@ var CredService = class extends BaseSDK {
|
|
|
3642
3791
|
...options
|
|
3643
3792
|
}
|
|
3644
3793
|
);
|
|
3645
|
-
|
|
3794
|
+
log20("Deleted credential by key: %s, success=%s", key, result.success);
|
|
3646
3795
|
return result;
|
|
3647
3796
|
}
|
|
3648
3797
|
// ===========================================================================
|
|
@@ -3661,12 +3810,12 @@ var CredService = class extends BaseSDK {
|
|
|
3661
3810
|
* @returns Promise resolving to the credential status list
|
|
3662
3811
|
*/
|
|
3663
3812
|
async getSkillCredStatus(skillIdentifier, options) {
|
|
3664
|
-
|
|
3813
|
+
log20("Getting skill cred status: %s", skillIdentifier);
|
|
3665
3814
|
const result = await this.request(
|
|
3666
3815
|
`/v1/skills/${encodeURIComponent(skillIdentifier)}/creds/status`,
|
|
3667
3816
|
options
|
|
3668
3817
|
);
|
|
3669
|
-
|
|
3818
|
+
log20("Skill %s has %d credential requirements", skillIdentifier, result.length);
|
|
3670
3819
|
return result;
|
|
3671
3820
|
}
|
|
3672
3821
|
// ===========================================================================
|
|
@@ -3705,7 +3854,7 @@ var CredService = class extends BaseSDK {
|
|
|
3705
3854
|
*/
|
|
3706
3855
|
async inject(request, options) {
|
|
3707
3856
|
var _a, _b, _c, _d;
|
|
3708
|
-
|
|
3857
|
+
log20("Injecting credentials by keys: %O (sandbox=%s)", request.keys, request.sandbox);
|
|
3709
3858
|
const result = await this.request(
|
|
3710
3859
|
"/v1/plugins/run-buildin-tools/inject-creds",
|
|
3711
3860
|
{
|
|
@@ -3717,7 +3866,7 @@ var CredService = class extends BaseSDK {
|
|
|
3717
3866
|
...options
|
|
3718
3867
|
}
|
|
3719
3868
|
);
|
|
3720
|
-
|
|
3869
|
+
log20(
|
|
3721
3870
|
"Inject result: success=%s, env=%d, files=%d, notFound=%d",
|
|
3722
3871
|
result.success,
|
|
3723
3872
|
Object.keys(((_a = result.credentials) == null ? void 0 : _a.env) || {}).length,
|
|
@@ -3759,7 +3908,7 @@ var CredService = class extends BaseSDK {
|
|
|
3759
3908
|
*/
|
|
3760
3909
|
async injectForSkill(request, options) {
|
|
3761
3910
|
var _a, _b, _c, _d;
|
|
3762
|
-
|
|
3911
|
+
log20(
|
|
3763
3912
|
"Injecting credentials for skill: %s (sandbox=%s)",
|
|
3764
3913
|
request.skillIdentifier,
|
|
3765
3914
|
request.sandbox
|
|
@@ -3775,7 +3924,7 @@ var CredService = class extends BaseSDK {
|
|
|
3775
3924
|
...options
|
|
3776
3925
|
}
|
|
3777
3926
|
);
|
|
3778
|
-
|
|
3927
|
+
log20(
|
|
3779
3928
|
"Inject result: success=%s, env=%d, files=%d, missing=%d",
|
|
3780
3929
|
result.success,
|
|
3781
3930
|
Object.keys(((_a = result.credentials) == null ? void 0 : _a.env) || {}).length,
|
|
@@ -3787,11 +3936,11 @@ var CredService = class extends BaseSDK {
|
|
|
3787
3936
|
};
|
|
3788
3937
|
|
|
3789
3938
|
// src/market/services/DeploymentService.ts
|
|
3790
|
-
import
|
|
3791
|
-
var
|
|
3939
|
+
import debug21 from "debug";
|
|
3940
|
+
var log21 = debug21("lobe-market-sdk:deployments");
|
|
3792
3941
|
var DeploymentService = class extends BaseSDK {
|
|
3793
3942
|
async prepareUpload(data, options) {
|
|
3794
|
-
|
|
3943
|
+
log21("Preparing deployment upload with %d files", data.files.length);
|
|
3795
3944
|
const result = await this.request(
|
|
3796
3945
|
"/v1/deployments/uploads/prepare",
|
|
3797
3946
|
{
|
|
@@ -3803,7 +3952,7 @@ var DeploymentService = class extends BaseSDK {
|
|
|
3803
3952
|
return result.data;
|
|
3804
3953
|
}
|
|
3805
3954
|
async ingestUpload(uploadId, options) {
|
|
3806
|
-
|
|
3955
|
+
log21("Ingesting deployment upload: %s", uploadId);
|
|
3807
3956
|
const result = await this.request(
|
|
3808
3957
|
`/v1/deployments/uploads/${encodeURIComponent(uploadId)}/ingest`,
|
|
3809
3958
|
{ ...options, method: "POST" }
|
|
@@ -3811,7 +3960,7 @@ var DeploymentService = class extends BaseSDK {
|
|
|
3811
3960
|
return result.data;
|
|
3812
3961
|
}
|
|
3813
3962
|
async finalizeUpload(uploadId, options) {
|
|
3814
|
-
|
|
3963
|
+
log21("Finalizing deployment upload: %s", uploadId);
|
|
3815
3964
|
const result = await this.request(
|
|
3816
3965
|
`/v1/deployments/uploads/${encodeURIComponent(uploadId)}/finalize`,
|
|
3817
3966
|
{ ...options, method: "POST" }
|
|
@@ -3821,9 +3970,9 @@ var DeploymentService = class extends BaseSDK {
|
|
|
3821
3970
|
};
|
|
3822
3971
|
|
|
3823
3972
|
// src/market/services/DiscoveryService.ts
|
|
3824
|
-
import
|
|
3973
|
+
import debug22 from "debug";
|
|
3825
3974
|
import urlJoin4 from "url-join";
|
|
3826
|
-
var
|
|
3975
|
+
var log22 = debug22("lobe-market-sdk:discovery");
|
|
3827
3976
|
var DiscoveryService = class extends BaseSDK {
|
|
3828
3977
|
/**
|
|
3829
3978
|
* Retrieves the service discovery document
|
|
@@ -3835,9 +3984,9 @@ var DiscoveryService = class extends BaseSDK {
|
|
|
3835
3984
|
* @returns Promise resolving to the service discovery document
|
|
3836
3985
|
*/
|
|
3837
3986
|
async getDiscoveryDocument() {
|
|
3838
|
-
|
|
3987
|
+
log22("Fetching discovery document");
|
|
3839
3988
|
if (this.discoveryDoc) {
|
|
3840
|
-
|
|
3989
|
+
log22("Returning cached discovery document");
|
|
3841
3990
|
return this.discoveryDoc;
|
|
3842
3991
|
}
|
|
3843
3992
|
const res = await fetch(urlJoin4(this.baseUrl, "/.well-known/discovery"));
|
|
@@ -3845,14 +3994,14 @@ var DiscoveryService = class extends BaseSDK {
|
|
|
3845
3994
|
throw new Error(await res.text());
|
|
3846
3995
|
}
|
|
3847
3996
|
this.discoveryDoc = await res.json();
|
|
3848
|
-
|
|
3997
|
+
log22("Discovery document successfully fetched");
|
|
3849
3998
|
return this.discoveryDoc;
|
|
3850
3999
|
}
|
|
3851
4000
|
};
|
|
3852
4001
|
|
|
3853
4002
|
// src/market/services/FeedbackService.ts
|
|
3854
|
-
import
|
|
3855
|
-
var
|
|
4003
|
+
import debug23 from "debug";
|
|
4004
|
+
var log23 = debug23("lobe-market-sdk:feedback");
|
|
3856
4005
|
var FeedbackService = class extends BaseSDK {
|
|
3857
4006
|
/**
|
|
3858
4007
|
* Submits user feedback
|
|
@@ -3882,7 +4031,7 @@ var FeedbackService = class extends BaseSDK {
|
|
|
3882
4031
|
* ```
|
|
3883
4032
|
*/
|
|
3884
4033
|
async submitFeedback(data, options) {
|
|
3885
|
-
|
|
4034
|
+
log23("Submitting feedback: %s", data.title);
|
|
3886
4035
|
const result = await this.request("/v1/user/feedback", {
|
|
3887
4036
|
body: JSON.stringify(data),
|
|
3888
4037
|
headers: {
|
|
@@ -3891,14 +4040,14 @@ var FeedbackService = class extends BaseSDK {
|
|
|
3891
4040
|
method: "POST",
|
|
3892
4041
|
...options
|
|
3893
4042
|
});
|
|
3894
|
-
|
|
4043
|
+
log23("Feedback submitted successfully: %s", result.issueId);
|
|
3895
4044
|
return result;
|
|
3896
4045
|
}
|
|
3897
4046
|
};
|
|
3898
4047
|
|
|
3899
4048
|
// src/market/services/PluginsService.ts
|
|
3900
|
-
import
|
|
3901
|
-
var
|
|
4049
|
+
import debug24 from "debug";
|
|
4050
|
+
var log24 = debug24("lobe-market-sdk:plugins");
|
|
3902
4051
|
function encodeBase64(input) {
|
|
3903
4052
|
if (typeof Buffer !== "undefined") {
|
|
3904
4053
|
return Buffer.from(input, "utf8").toString("base64");
|
|
@@ -3912,6 +4061,8 @@ var PluginsService = class extends BaseSDK {
|
|
|
3912
4061
|
/**
|
|
3913
4062
|
* Retrieves a list of plugins from the marketplace
|
|
3914
4063
|
*
|
|
4064
|
+
* Set category to UNCATEGORIZED_CATEGORY to select assets with no assigned category.
|
|
4065
|
+
*
|
|
3915
4066
|
* Supports filtering, pagination, and localization of results.
|
|
3916
4067
|
*
|
|
3917
4068
|
* @param params - Query parameters for filtering and pagination
|
|
@@ -3922,9 +4073,9 @@ var PluginsService = class extends BaseSDK {
|
|
|
3922
4073
|
const locale = params.locale || this.defaultLocale;
|
|
3923
4074
|
const queryParams = { ...params, locale };
|
|
3924
4075
|
const queryString = this.buildQueryString(queryParams);
|
|
3925
|
-
|
|
4076
|
+
log24("Getting plugin list: %O", queryParams);
|
|
3926
4077
|
const result = await this.request(`/v1/plugins${queryString}`, options);
|
|
3927
|
-
|
|
4078
|
+
log24("Retrieved %d plugins", result.items.length);
|
|
3928
4079
|
return result;
|
|
3929
4080
|
}
|
|
3930
4081
|
/**
|
|
@@ -3942,12 +4093,12 @@ var PluginsService = class extends BaseSDK {
|
|
|
3942
4093
|
const locale = params.locale || this.defaultLocale;
|
|
3943
4094
|
const queryParams = { ...params, locale };
|
|
3944
4095
|
const queryString = this.buildQueryString(queryParams);
|
|
3945
|
-
|
|
4096
|
+
log24("Getting plugin categories: %O", queryParams);
|
|
3946
4097
|
const result = await this.request(
|
|
3947
4098
|
`/v1/plugins/categories${queryString}`,
|
|
3948
4099
|
options
|
|
3949
4100
|
);
|
|
3950
|
-
|
|
4101
|
+
log24("Retrieved %d categories", result.length);
|
|
3951
4102
|
return result;
|
|
3952
4103
|
}
|
|
3953
4104
|
/**
|
|
@@ -3961,12 +4112,12 @@ var PluginsService = class extends BaseSDK {
|
|
|
3961
4112
|
* @returns Promise resolving to an array containing identifiers array and last modified time
|
|
3962
4113
|
*/
|
|
3963
4114
|
async getPublishedIdentifiers(options) {
|
|
3964
|
-
|
|
4115
|
+
log24("Getting published plugin identifiers");
|
|
3965
4116
|
const result = await this.request(
|
|
3966
4117
|
"/v1/plugins/identifiers",
|
|
3967
4118
|
options
|
|
3968
4119
|
);
|
|
3969
|
-
|
|
4120
|
+
log24("Retrieved %d published plugin identifiers", result.length);
|
|
3970
4121
|
return result;
|
|
3971
4122
|
}
|
|
3972
4123
|
/**
|
|
@@ -3977,12 +4128,12 @@ var PluginsService = class extends BaseSDK {
|
|
|
3977
4128
|
*/
|
|
3978
4129
|
async getSitemap(params = {}, options) {
|
|
3979
4130
|
const queryString = this.buildQueryString(params);
|
|
3980
|
-
|
|
4131
|
+
log24("Getting plugin sitemap%s", queryString);
|
|
3981
4132
|
const result = await this.request(
|
|
3982
4133
|
`/v1/plugins/sitemap${queryString}`,
|
|
3983
4134
|
options
|
|
3984
4135
|
);
|
|
3985
|
-
|
|
4136
|
+
log24(
|
|
3986
4137
|
"Retrieved plugin sitemap page %d/%d (%d items)",
|
|
3987
4138
|
result.currentPage,
|
|
3988
4139
|
result.totalPages,
|
|
@@ -4007,7 +4158,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4007
4158
|
version,
|
|
4008
4159
|
identifier
|
|
4009
4160
|
}, options) {
|
|
4010
|
-
|
|
4161
|
+
log24("Getting plugin manifest: %O", { identifier, locale, version });
|
|
4011
4162
|
const localeParam = locale || this.defaultLocale;
|
|
4012
4163
|
const params = { locale: localeParam };
|
|
4013
4164
|
if (version) {
|
|
@@ -4018,7 +4169,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4018
4169
|
`/v1/plugins/${identifier}/manifest${queryString}`,
|
|
4019
4170
|
options
|
|
4020
4171
|
);
|
|
4021
|
-
|
|
4172
|
+
log24("Plugin manifest successfully retrieved: %s", identifier);
|
|
4022
4173
|
return manifest;
|
|
4023
4174
|
}
|
|
4024
4175
|
/**
|
|
@@ -4035,7 +4186,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4035
4186
|
version,
|
|
4036
4187
|
identifier
|
|
4037
4188
|
}, options) {
|
|
4038
|
-
|
|
4189
|
+
log24("Getting plugin detail: %O", { identifier, locale, version });
|
|
4039
4190
|
const localeParam = locale || this.defaultLocale;
|
|
4040
4191
|
const params = { locale: localeParam };
|
|
4041
4192
|
if (version) {
|
|
@@ -4046,7 +4197,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4046
4197
|
`/v1/plugins/${identifier}${queryString}`,
|
|
4047
4198
|
options
|
|
4048
4199
|
);
|
|
4049
|
-
|
|
4200
|
+
log24("Plugin manifest successfully retrieved: %s", identifier);
|
|
4050
4201
|
return manifest;
|
|
4051
4202
|
}
|
|
4052
4203
|
/**
|
|
@@ -4061,7 +4212,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4061
4212
|
*
|
|
4062
4213
|
*/
|
|
4063
4214
|
async reportInstallation(reportData) {
|
|
4064
|
-
|
|
4215
|
+
log24("Reporting installation for %s@%s", reportData.identifier, reportData.version);
|
|
4065
4216
|
const result = await this.request("/v1/plugins/report/installation", {
|
|
4066
4217
|
body: JSON.stringify(reportData),
|
|
4067
4218
|
headers: {
|
|
@@ -4069,7 +4220,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4069
4220
|
},
|
|
4070
4221
|
method: "POST"
|
|
4071
4222
|
});
|
|
4072
|
-
|
|
4223
|
+
log24("Installation report submitted successfully: %O", result);
|
|
4073
4224
|
return result;
|
|
4074
4225
|
}
|
|
4075
4226
|
/**
|
|
@@ -4083,7 +4234,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4083
4234
|
* @returns Promise resolving to the report submission response
|
|
4084
4235
|
*/
|
|
4085
4236
|
async reportCall(reportData) {
|
|
4086
|
-
|
|
4237
|
+
log24(
|
|
4087
4238
|
"Reporting call for %s@%s - %s:%s",
|
|
4088
4239
|
reportData.identifier,
|
|
4089
4240
|
reportData.version,
|
|
@@ -4097,7 +4248,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4097
4248
|
},
|
|
4098
4249
|
method: "POST"
|
|
4099
4250
|
});
|
|
4100
|
-
|
|
4251
|
+
log24("Call report submitted successfully: %O", result);
|
|
4101
4252
|
return result;
|
|
4102
4253
|
}
|
|
4103
4254
|
/**
|
|
@@ -4109,7 +4260,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4109
4260
|
* @param options - Optional request init overrides
|
|
4110
4261
|
*/
|
|
4111
4262
|
async createEvent(eventData, options) {
|
|
4112
|
-
|
|
4263
|
+
log24("Recording plugin event: %s for %s", eventData.event, eventData.identifier);
|
|
4113
4264
|
await this.request("/v1/plugins/events", {
|
|
4114
4265
|
body: JSON.stringify(eventData),
|
|
4115
4266
|
headers: {
|
|
@@ -4139,7 +4290,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4139
4290
|
* ```
|
|
4140
4291
|
*/
|
|
4141
4292
|
async callCloudGateway(request, options) {
|
|
4142
|
-
|
|
4293
|
+
log24("Calling cloud gateway for plugin %s, tool %s", request.identifier, request.toolName);
|
|
4143
4294
|
const result = await this.request("/v1/plugins/cloud-gateway", {
|
|
4144
4295
|
body: JSON.stringify(request),
|
|
4145
4296
|
headers: {
|
|
@@ -4148,7 +4299,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4148
4299
|
method: "POST",
|
|
4149
4300
|
...options
|
|
4150
4301
|
});
|
|
4151
|
-
|
|
4302
|
+
log24("Cloud gateway call completed: %O", {
|
|
4152
4303
|
identifier: request.identifier,
|
|
4153
4304
|
isError: result.isError,
|
|
4154
4305
|
toolName: request.toolName
|
|
@@ -4188,20 +4339,27 @@ var PluginsService = class extends BaseSDK {
|
|
|
4188
4339
|
* );
|
|
4189
4340
|
* ```
|
|
4190
4341
|
*/
|
|
4191
|
-
async runBuildInTool(toolName, params,
|
|
4192
|
-
|
|
4342
|
+
async runBuildInTool(toolName, params, context2, options) {
|
|
4343
|
+
log24(
|
|
4193
4344
|
"Running built-in tool: %s for user %s, topic %s",
|
|
4194
4345
|
toolName,
|
|
4195
|
-
|
|
4196
|
-
|
|
4346
|
+
context2.userId,
|
|
4347
|
+
context2.topicId
|
|
4197
4348
|
);
|
|
4198
4349
|
const result = await this.request("/v1/plugins/run-buildin-tools", {
|
|
4199
4350
|
body: JSON.stringify({
|
|
4200
4351
|
paramsB64: encodeBase64(JSON.stringify(params)),
|
|
4201
4352
|
paramsEncoding: "base64",
|
|
4202
4353
|
toolName,
|
|
4203
|
-
|
|
4204
|
-
|
|
4354
|
+
...context2.sandboxCwd && { sandboxCwd: context2.sandboxCwd },
|
|
4355
|
+
...context2.sandboxSpecification && {
|
|
4356
|
+
sandboxSpecification: context2.sandboxSpecification
|
|
4357
|
+
},
|
|
4358
|
+
...context2.sandboxWorkingDir && { sandboxWorkingDir: context2.sandboxWorkingDir },
|
|
4359
|
+
...context2.sandboxInstanceId && { sandboxInstanceId: context2.sandboxInstanceId },
|
|
4360
|
+
...context2.sandboxMode && { sandboxMode: context2.sandboxMode },
|
|
4361
|
+
topicId: context2.topicId,
|
|
4362
|
+
userId: context2.userId
|
|
4205
4363
|
}),
|
|
4206
4364
|
headers: {
|
|
4207
4365
|
"Content-Type": "application/json"
|
|
@@ -4209,7 +4367,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4209
4367
|
method: "POST",
|
|
4210
4368
|
...options
|
|
4211
4369
|
});
|
|
4212
|
-
|
|
4370
|
+
log24("Built-in tool execution completed: %O", {
|
|
4213
4371
|
success: result.success,
|
|
4214
4372
|
toolName
|
|
4215
4373
|
});
|
|
@@ -4223,8 +4381,8 @@ var PluginsService = class extends BaseSDK {
|
|
|
4223
4381
|
* @param options - Additional options (background, timeout)
|
|
4224
4382
|
* @returns Promise resolving to command execution result
|
|
4225
4383
|
*/
|
|
4226
|
-
async runCommand(command,
|
|
4227
|
-
return this.runBuildInTool("runCommand", { command, ...options },
|
|
4384
|
+
async runCommand(command, context2, options) {
|
|
4385
|
+
return this.runBuildInTool("runCommand", { command, ...options }, context2);
|
|
4228
4386
|
}
|
|
4229
4387
|
/**
|
|
4230
4388
|
* Read a file from the Code Interpreter sandbox
|
|
@@ -4234,8 +4392,8 @@ var PluginsService = class extends BaseSDK {
|
|
|
4234
4392
|
* @param options - Line range options (startLine, endLine)
|
|
4235
4393
|
* @returns Promise resolving to file content
|
|
4236
4394
|
*/
|
|
4237
|
-
async readFile(path,
|
|
4238
|
-
return this.runBuildInTool("readLocalFile", { path, ...options },
|
|
4395
|
+
async readFile(path, context2, options) {
|
|
4396
|
+
return this.runBuildInTool("readLocalFile", { path, ...options }, context2);
|
|
4239
4397
|
}
|
|
4240
4398
|
/**
|
|
4241
4399
|
* Write content to a file in the Code Interpreter sandbox
|
|
@@ -4246,8 +4404,8 @@ var PluginsService = class extends BaseSDK {
|
|
|
4246
4404
|
* @param options - Additional options (createDirectories)
|
|
4247
4405
|
* @returns Promise resolving to write result
|
|
4248
4406
|
*/
|
|
4249
|
-
async writeFile(path, content,
|
|
4250
|
-
return this.runBuildInTool("writeLocalFile", { content, path, ...options },
|
|
4407
|
+
async writeFile(path, content, context2, options) {
|
|
4408
|
+
return this.runBuildInTool("writeLocalFile", { content, path, ...options }, context2);
|
|
4251
4409
|
}
|
|
4252
4410
|
/**
|
|
4253
4411
|
* List files in a directory in the Code Interpreter sandbox
|
|
@@ -4256,8 +4414,8 @@ var PluginsService = class extends BaseSDK {
|
|
|
4256
4414
|
* @param context - User and topic context
|
|
4257
4415
|
* @returns Promise resolving to directory listing
|
|
4258
4416
|
*/
|
|
4259
|
-
async listFiles(directoryPath,
|
|
4260
|
-
return this.runBuildInTool("listLocalFiles", { directoryPath },
|
|
4417
|
+
async listFiles(directoryPath, context2) {
|
|
4418
|
+
return this.runBuildInTool("listLocalFiles", { directoryPath }, context2);
|
|
4261
4419
|
}
|
|
4262
4420
|
/**
|
|
4263
4421
|
* Search for files matching a glob pattern
|
|
@@ -4267,8 +4425,8 @@ var PluginsService = class extends BaseSDK {
|
|
|
4267
4425
|
* @param directory - Base directory (optional)
|
|
4268
4426
|
* @returns Promise resolving to matching files
|
|
4269
4427
|
*/
|
|
4270
|
-
async globFiles(pattern,
|
|
4271
|
-
return this.runBuildInTool("globLocalFiles", { directory, pattern },
|
|
4428
|
+
async globFiles(pattern, context2, directory) {
|
|
4429
|
+
return this.runBuildInTool("globLocalFiles", { directory, pattern }, context2);
|
|
4272
4430
|
}
|
|
4273
4431
|
/**
|
|
4274
4432
|
* Search file contents using regex pattern
|
|
@@ -4279,8 +4437,8 @@ var PluginsService = class extends BaseSDK {
|
|
|
4279
4437
|
* @param options - Additional options (filePattern, recursive)
|
|
4280
4438
|
* @returns Promise resolving to grep results
|
|
4281
4439
|
*/
|
|
4282
|
-
async grepContent(pattern, directory,
|
|
4283
|
-
return this.runBuildInTool("grepContent", { directory, pattern, ...options },
|
|
4440
|
+
async grepContent(pattern, directory, context2, options) {
|
|
4441
|
+
return this.runBuildInTool("grepContent", { directory, pattern, ...options }, context2);
|
|
4284
4442
|
}
|
|
4285
4443
|
/**
|
|
4286
4444
|
* Export a file from the Code Interpreter sandbox to a pre-signed URL
|
|
@@ -4307,8 +4465,8 @@ var PluginsService = class extends BaseSDK {
|
|
|
4307
4465
|
* }
|
|
4308
4466
|
* ```
|
|
4309
4467
|
*/
|
|
4310
|
-
async exportFile(path, uploadUrl,
|
|
4311
|
-
return this.runBuildInTool("exportFile", { path, uploadUrl },
|
|
4468
|
+
async exportFile(path, uploadUrl, context2) {
|
|
4469
|
+
return this.runBuildInTool("exportFile", { path, uploadUrl }, context2);
|
|
4312
4470
|
}
|
|
4313
4471
|
// ============================================================================
|
|
4314
4472
|
// Rating Methods
|
|
@@ -4322,7 +4480,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4322
4480
|
* @returns Promise resolving to the submitted score
|
|
4323
4481
|
*/
|
|
4324
4482
|
async submitRating(identifier, score, options) {
|
|
4325
|
-
|
|
4483
|
+
log24("Submitting rating for plugin %s: %d", identifier, score);
|
|
4326
4484
|
const result = await this.request(
|
|
4327
4485
|
`/v1/plugins/${encodeURIComponent(identifier)}/ratings`,
|
|
4328
4486
|
{
|
|
@@ -4331,7 +4489,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4331
4489
|
method: "POST"
|
|
4332
4490
|
}
|
|
4333
4491
|
);
|
|
4334
|
-
|
|
4492
|
+
log24("Rating submitted for plugin %s: %d", identifier, result.score);
|
|
4335
4493
|
return result;
|
|
4336
4494
|
}
|
|
4337
4495
|
/**
|
|
@@ -4342,7 +4500,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4342
4500
|
* @returns Promise resolving to success status
|
|
4343
4501
|
*/
|
|
4344
4502
|
async deleteRating(identifier, options) {
|
|
4345
|
-
|
|
4503
|
+
log24("Deleting rating for plugin %s", identifier);
|
|
4346
4504
|
const result = await this.request(
|
|
4347
4505
|
`/v1/plugins/${encodeURIComponent(identifier)}/ratings`,
|
|
4348
4506
|
{
|
|
@@ -4350,7 +4508,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4350
4508
|
method: "DELETE"
|
|
4351
4509
|
}
|
|
4352
4510
|
);
|
|
4353
|
-
|
|
4511
|
+
log24("Rating deleted for plugin %s", identifier);
|
|
4354
4512
|
return result;
|
|
4355
4513
|
}
|
|
4356
4514
|
/**
|
|
@@ -4361,12 +4519,12 @@ var PluginsService = class extends BaseSDK {
|
|
|
4361
4519
|
* @returns Promise resolving to the rating distribution
|
|
4362
4520
|
*/
|
|
4363
4521
|
async getRatingDistribution(identifier, options) {
|
|
4364
|
-
|
|
4522
|
+
log24("Getting rating distribution for plugin: %s", identifier);
|
|
4365
4523
|
const result = await this.request(
|
|
4366
4524
|
`/v1/plugins/${encodeURIComponent(identifier)}/ratings/distribution`,
|
|
4367
4525
|
options
|
|
4368
4526
|
);
|
|
4369
|
-
|
|
4527
|
+
log24("Rating distribution retrieved for plugin %s: %d total", identifier, result.totalCount);
|
|
4370
4528
|
return result;
|
|
4371
4529
|
}
|
|
4372
4530
|
// ============================================================================
|
|
@@ -4382,12 +4540,12 @@ var PluginsService = class extends BaseSDK {
|
|
|
4382
4540
|
*/
|
|
4383
4541
|
async getComments(identifier, params = {}, options) {
|
|
4384
4542
|
const queryString = this.buildQueryString(params);
|
|
4385
|
-
|
|
4543
|
+
log24("Getting comments for plugin %s: %O", identifier, params);
|
|
4386
4544
|
const result = await this.request(
|
|
4387
4545
|
`/v1/plugins/${encodeURIComponent(identifier)}/comments${queryString}`,
|
|
4388
4546
|
options
|
|
4389
4547
|
);
|
|
4390
|
-
|
|
4548
|
+
log24(
|
|
4391
4549
|
"Retrieved %d comments for plugin %s (page %d/%d)",
|
|
4392
4550
|
result.items.length,
|
|
4393
4551
|
identifier,
|
|
@@ -4404,15 +4562,15 @@ var PluginsService = class extends BaseSDK {
|
|
|
4404
4562
|
* @returns Promise resolving to the latest own comment or null when none exists
|
|
4405
4563
|
*/
|
|
4406
4564
|
async getLatestOwnComment(identifier, options) {
|
|
4407
|
-
|
|
4565
|
+
log24("Getting latest own comment for plugin %s", identifier);
|
|
4408
4566
|
const result = await this.request(
|
|
4409
4567
|
`/v1/plugins/${encodeURIComponent(identifier)}/comments/latest`,
|
|
4410
4568
|
options
|
|
4411
4569
|
);
|
|
4412
4570
|
if (result) {
|
|
4413
|
-
|
|
4571
|
+
log24("Retrieved latest own comment for plugin %s: id=%d", identifier, result.id);
|
|
4414
4572
|
} else {
|
|
4415
|
-
|
|
4573
|
+
log24("No own comments found for plugin %s", identifier);
|
|
4416
4574
|
}
|
|
4417
4575
|
return result;
|
|
4418
4576
|
}
|
|
@@ -4425,7 +4583,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4425
4583
|
* @returns Promise resolving to the created comment (with optional rating field)
|
|
4426
4584
|
*/
|
|
4427
4585
|
async createComment(identifier, data, options) {
|
|
4428
|
-
|
|
4586
|
+
log24("Creating comment on plugin %s", identifier);
|
|
4429
4587
|
const result = await this.request(
|
|
4430
4588
|
`/v1/plugins/${encodeURIComponent(identifier)}/comments`,
|
|
4431
4589
|
{
|
|
@@ -4434,7 +4592,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4434
4592
|
method: "POST"
|
|
4435
4593
|
}
|
|
4436
4594
|
);
|
|
4437
|
-
|
|
4595
|
+
log24("Comment created on plugin %s: id=%d", identifier, result.id);
|
|
4438
4596
|
return result;
|
|
4439
4597
|
}
|
|
4440
4598
|
/**
|
|
@@ -4446,7 +4604,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4446
4604
|
* @returns Promise resolving to success status
|
|
4447
4605
|
*/
|
|
4448
4606
|
async deleteComment(identifier, commentId, options) {
|
|
4449
|
-
|
|
4607
|
+
log24("Deleting comment %d from plugin %s", commentId, identifier);
|
|
4450
4608
|
const result = await this.request(
|
|
4451
4609
|
`/v1/plugins/${encodeURIComponent(identifier)}/comments/${commentId}`,
|
|
4452
4610
|
{
|
|
@@ -4454,7 +4612,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4454
4612
|
method: "DELETE"
|
|
4455
4613
|
}
|
|
4456
4614
|
);
|
|
4457
|
-
|
|
4615
|
+
log24("Comment %d deleted from plugin %s", commentId, identifier);
|
|
4458
4616
|
return result;
|
|
4459
4617
|
}
|
|
4460
4618
|
// ============================================================================
|
|
@@ -4469,7 +4627,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4469
4627
|
* @returns Promise resolving to the created reaction
|
|
4470
4628
|
*/
|
|
4471
4629
|
async addReaction(commentId, type, options) {
|
|
4472
|
-
|
|
4630
|
+
log24("Adding %s reaction to comment %d", type, commentId);
|
|
4473
4631
|
const result = await this.request(
|
|
4474
4632
|
`/v1/plugins/comments/${commentId}/reactions`,
|
|
4475
4633
|
{
|
|
@@ -4478,7 +4636,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4478
4636
|
method: "POST"
|
|
4479
4637
|
}
|
|
4480
4638
|
);
|
|
4481
|
-
|
|
4639
|
+
log24("Reaction added to comment %d: %s (id=%d)", commentId, result.type, result.id);
|
|
4482
4640
|
return result;
|
|
4483
4641
|
}
|
|
4484
4642
|
/**
|
|
@@ -4489,7 +4647,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
4489
4647
|
* @returns Promise resolving to success status
|
|
4490
4648
|
*/
|
|
4491
4649
|
async removeReaction(commentId, options) {
|
|
4492
|
-
|
|
4650
|
+
log24("Removing reaction from comment %d", commentId);
|
|
4493
4651
|
const result = await this.request(
|
|
4494
4652
|
`/v1/plugins/comments/${commentId}/reactions`,
|
|
4495
4653
|
{
|
|
@@ -4497,14 +4655,235 @@ var PluginsService = class extends BaseSDK {
|
|
|
4497
4655
|
method: "DELETE"
|
|
4498
4656
|
}
|
|
4499
4657
|
);
|
|
4500
|
-
|
|
4658
|
+
log24("Reaction removed from comment %d", commentId);
|
|
4501
4659
|
return result;
|
|
4502
4660
|
}
|
|
4503
4661
|
};
|
|
4504
4662
|
|
|
4663
|
+
// src/market/services/SandboxService.ts
|
|
4664
|
+
import debug25 from "debug";
|
|
4665
|
+
var log25 = debug25("lobe-market-sdk:sandbox");
|
|
4666
|
+
function encodeBase642(input) {
|
|
4667
|
+
if (typeof Buffer !== "undefined") {
|
|
4668
|
+
return Buffer.from(input, "utf8").toString("base64");
|
|
4669
|
+
}
|
|
4670
|
+
const bytes = new TextEncoder().encode(input);
|
|
4671
|
+
let binary = "";
|
|
4672
|
+
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
4673
|
+
return btoa(binary);
|
|
4674
|
+
}
|
|
4675
|
+
var SandboxService = class extends BaseSDK {
|
|
4676
|
+
/**
|
|
4677
|
+
* Run a script once in a fresh sandbox and return its output.
|
|
4678
|
+
*
|
|
4679
|
+
* A non-zero `exitCode` or `timedOut: true` is a normal result, not an error.
|
|
4680
|
+
* Non-2xx responses (validation, `rate_limited`, `sandbox_unavailable`, …)
|
|
4681
|
+
* throw like every other SDK call.
|
|
4682
|
+
*
|
|
4683
|
+
* @example
|
|
4684
|
+
* ```typescript
|
|
4685
|
+
* const result = await sdk.sandbox.run({
|
|
4686
|
+
* egress: {
|
|
4687
|
+
* allow: ['api.github.com'],
|
|
4688
|
+
* inject: [{ header: 'Authorization', host: 'api.github.com', prefix: 'Bearer ', secretRef: { key: 'github' } }],
|
|
4689
|
+
* },
|
|
4690
|
+
* runtime: 'node',
|
|
4691
|
+
* script: 'const r = await fetch("https://api.github.com/user"); console.log(JSON.stringify(await r.json()))',
|
|
4692
|
+
* subject: { id: widgetId, kind: 'widget' },
|
|
4693
|
+
* timeoutMs: 20_000,
|
|
4694
|
+
* });
|
|
4695
|
+
* ```
|
|
4696
|
+
*/
|
|
4697
|
+
async run(params, options) {
|
|
4698
|
+
const { script, ...rest } = params;
|
|
4699
|
+
log25(
|
|
4700
|
+
"Running %s sandbox script for %s %s",
|
|
4701
|
+
params.runtime,
|
|
4702
|
+
params.subject.kind,
|
|
4703
|
+
params.subject.id
|
|
4704
|
+
);
|
|
4705
|
+
return this.request("/v1/sandbox/runs", {
|
|
4706
|
+
body: JSON.stringify({ ...rest, scriptB64: encodeBase642(script), scriptEncoding: "base64" }),
|
|
4707
|
+
headers: { "Content-Type": "application/json" },
|
|
4708
|
+
method: "POST",
|
|
4709
|
+
...options
|
|
4710
|
+
});
|
|
4711
|
+
}
|
|
4712
|
+
};
|
|
4713
|
+
|
|
4714
|
+
// src/market/services/SandboxStorageService.ts
|
|
4715
|
+
import debug26 from "debug";
|
|
4716
|
+
var log26 = debug26("lobe-market-sdk:sandbox-storage");
|
|
4717
|
+
var SandboxStorageService2 = class extends BaseSDK {
|
|
4718
|
+
/** Storage directory, quota and the last measured usage. */
|
|
4719
|
+
async getStorage(key = "current", options) {
|
|
4720
|
+
log26("Getting sandbox storage: %s", key);
|
|
4721
|
+
const result = await this.request(
|
|
4722
|
+
`/v1/sandbox/storages/${encodeURIComponent(key)}`,
|
|
4723
|
+
{ ...options, method: "GET" }
|
|
4724
|
+
);
|
|
4725
|
+
return result.data;
|
|
4726
|
+
}
|
|
4727
|
+
/**
|
|
4728
|
+
* Re-measure the storage size. Costs a sandbox round trip and walks the
|
|
4729
|
+
* whole directory, so call it on demand rather than on every render.
|
|
4730
|
+
*/
|
|
4731
|
+
async refreshUsage(key = "current", context2 = {}, options) {
|
|
4732
|
+
log26("Refreshing sandbox storage usage: %s", key);
|
|
4733
|
+
const result = await this.request(
|
|
4734
|
+
`/v1/sandbox/storages/${encodeURIComponent(key)}/usage`,
|
|
4735
|
+
{ ...options, body: JSON.stringify(context2), method: "POST" }
|
|
4736
|
+
);
|
|
4737
|
+
return result.data;
|
|
4738
|
+
}
|
|
4739
|
+
async listFiles(params = {}, options) {
|
|
4740
|
+
const { key = "current", path, recursive, topicId } = params;
|
|
4741
|
+
log26("Listing sandbox storage files: %s/%s", key, path != null ? path : "");
|
|
4742
|
+
const query = new URLSearchParams();
|
|
4743
|
+
if (path) query.set("path", path);
|
|
4744
|
+
if (recursive) query.set("recursive", "true");
|
|
4745
|
+
if (topicId) query.set("topicId", topicId);
|
|
4746
|
+
const result = await this.request(
|
|
4747
|
+
`/v1/sandbox/storages/${encodeURIComponent(key)}/files?${query.toString()}`,
|
|
4748
|
+
{ ...options, method: "GET" }
|
|
4749
|
+
);
|
|
4750
|
+
return result.data;
|
|
4751
|
+
}
|
|
4752
|
+
async readFile(params, options) {
|
|
4753
|
+
const { key = "current", path, topicId } = params;
|
|
4754
|
+
log26("Reading sandbox storage file: %s/%s", key, path);
|
|
4755
|
+
const query = new URLSearchParams({ path });
|
|
4756
|
+
if (topicId) query.set("topicId", topicId);
|
|
4757
|
+
const result = await this.request(
|
|
4758
|
+
`/v1/sandbox/storages/${encodeURIComponent(key)}/file?${query.toString()}`,
|
|
4759
|
+
{ ...options, method: "GET" }
|
|
4760
|
+
);
|
|
4761
|
+
return result.data;
|
|
4762
|
+
}
|
|
4763
|
+
async writeFile(params, options) {
|
|
4764
|
+
const { content, key = "current", path, topicId } = params;
|
|
4765
|
+
log26("Writing sandbox storage file: %s/%s (%d bytes)", key, path, content.length);
|
|
4766
|
+
const result = await this.request(
|
|
4767
|
+
`/v1/sandbox/storages/${encodeURIComponent(key)}/file`,
|
|
4768
|
+
{
|
|
4769
|
+
...options,
|
|
4770
|
+
body: JSON.stringify({ content, path, topicId }),
|
|
4771
|
+
method: "PUT"
|
|
4772
|
+
}
|
|
4773
|
+
);
|
|
4774
|
+
return result.data;
|
|
4775
|
+
}
|
|
4776
|
+
/**
|
|
4777
|
+
* The storage's instances, newest first.
|
|
4778
|
+
*
|
|
4779
|
+
* Sizes come from the archives themselves rather than a cache, so they are
|
|
4780
|
+
* exact — but the call needs a live sandbox, so a cold start can take a few
|
|
4781
|
+
* seconds. Worth a loading state.
|
|
4782
|
+
*/
|
|
4783
|
+
/**
|
|
4784
|
+
* One instance's run history, newest first: every session that ran it
|
|
4785
|
+
* and every build of it. Answered from the control plane alone, so it is
|
|
4786
|
+
* cheap — no sandbox is started. Page with the `nextBefore` it returns.
|
|
4787
|
+
*/
|
|
4788
|
+
async listInstanceSessions(instance, params = {}, options) {
|
|
4789
|
+
const { before, key = "current", limit } = params;
|
|
4790
|
+
const query = new URLSearchParams();
|
|
4791
|
+
if (limit !== void 0) query.set("limit", String(limit));
|
|
4792
|
+
if (before) query.set("before", before);
|
|
4793
|
+
const suffix = query.size > 0 ? `?${query.toString()}` : "";
|
|
4794
|
+
const result = await this.request(
|
|
4795
|
+
`/v1/sandbox/storages/${encodeURIComponent(key)}/instances/${encodeURIComponent(instance)}/sessions${suffix}`,
|
|
4796
|
+
{ ...options, method: "GET" }
|
|
4797
|
+
);
|
|
4798
|
+
return result.data;
|
|
4799
|
+
}
|
|
4800
|
+
async listInstances(params = {}, options) {
|
|
4801
|
+
const { key = "current", topicId } = params;
|
|
4802
|
+
const query = topicId ? `?topicId=${encodeURIComponent(topicId)}` : "";
|
|
4803
|
+
const result = await this.request(
|
|
4804
|
+
`/v1/sandbox/storages/${encodeURIComponent(key)}/instances${query}`,
|
|
4805
|
+
{ ...options, method: "GET" }
|
|
4806
|
+
);
|
|
4807
|
+
return result.data;
|
|
4808
|
+
}
|
|
4809
|
+
/** Copy an instance to a new identifier, for "start from this one". */
|
|
4810
|
+
async copyInstance(params, options) {
|
|
4811
|
+
const { instanceDir, key = "current", name, to, topicId } = params;
|
|
4812
|
+
const result = await this.request(
|
|
4813
|
+
`/v1/sandbox/storages/${encodeURIComponent(key)}/instances/${encodeURIComponent(name)}/copy`,
|
|
4814
|
+
{ ...options, body: JSON.stringify({ instanceDir, to, topicId }), method: "POST" }
|
|
4815
|
+
);
|
|
4816
|
+
return result.data;
|
|
4817
|
+
}
|
|
4818
|
+
/**
|
|
4819
|
+
* Stop the sandbox holding an instance and release it, instead of waiting for
|
|
4820
|
+
* the idle sweep. The sandbox is snapshotted first.
|
|
4821
|
+
*
|
|
4822
|
+
* Refused retryably with 503 `SNAPSHOT_IN_PROGRESS` while that snapshot is
|
|
4823
|
+
* still packing, and with 409 `INSTANCE_STARTING`, `INSTANCE_BUILDING` or
|
|
4824
|
+
* `INSTANCE_BUSY` while what holds it cannot be stopped yet. `stopped: false`
|
|
4825
|
+
* means nothing held the instance.
|
|
4826
|
+
*/
|
|
4827
|
+
async stopInstance(params, options) {
|
|
4828
|
+
const { key = "current", name } = params;
|
|
4829
|
+
const result = await this.request(
|
|
4830
|
+
`/v1/sandbox/storages/${encodeURIComponent(key)}/instances/${encodeURIComponent(name)}/stop`,
|
|
4831
|
+
{ ...options, method: "POST" }
|
|
4832
|
+
);
|
|
4833
|
+
return result.data;
|
|
4834
|
+
}
|
|
4835
|
+
/**
|
|
4836
|
+
* Delete an instance.
|
|
4837
|
+
*
|
|
4838
|
+
* Refused with 409 `INSTANCE_IN_USE` while a live session is running it —
|
|
4839
|
+
* that session would write the archive back when it ends, so the delete would
|
|
4840
|
+
* appear to work and then silently undo itself.
|
|
4841
|
+
*/
|
|
4842
|
+
async deleteInstance(params, options) {
|
|
4843
|
+
const { key = "current", name, topicId } = params;
|
|
4844
|
+
const query = topicId ? `?topicId=${encodeURIComponent(topicId)}` : "";
|
|
4845
|
+
const result = await this.request(
|
|
4846
|
+
`/v1/sandbox/storages/${encodeURIComponent(key)}/instances/${encodeURIComponent(name)}${query}`,
|
|
4847
|
+
{ ...options, method: "DELETE" }
|
|
4848
|
+
);
|
|
4849
|
+
return result.data;
|
|
4850
|
+
}
|
|
4851
|
+
/**
|
|
4852
|
+
* Create a directory, parents included.
|
|
4853
|
+
*
|
|
4854
|
+
* Idempotent: a directory that already exists is reported as created, so a
|
|
4855
|
+
* picker can call it without checking first.
|
|
4856
|
+
*/
|
|
4857
|
+
async createDirectory(params, options) {
|
|
4858
|
+
const { key = "current", path, topicId } = params;
|
|
4859
|
+
log26("Creating sandbox storage directory: %s/%s", key, path);
|
|
4860
|
+
const result = await this.request(
|
|
4861
|
+
`/v1/sandbox/storages/${encodeURIComponent(key)}/directory`,
|
|
4862
|
+
{
|
|
4863
|
+
...options,
|
|
4864
|
+
body: JSON.stringify({ path, topicId }),
|
|
4865
|
+
method: "POST"
|
|
4866
|
+
}
|
|
4867
|
+
);
|
|
4868
|
+
return result.data;
|
|
4869
|
+
}
|
|
4870
|
+
async deleteFile(params, options) {
|
|
4871
|
+
const { key = "current", path, recursive, topicId } = params;
|
|
4872
|
+
log26("Deleting sandbox storage path: %s/%s", key, path);
|
|
4873
|
+
const query = new URLSearchParams({ path });
|
|
4874
|
+
if (recursive) query.set("recursive", "true");
|
|
4875
|
+
if (topicId) query.set("topicId", topicId);
|
|
4876
|
+
const result = await this.request(
|
|
4877
|
+
`/v1/sandbox/storages/${encodeURIComponent(key)}/file?${query.toString()}`,
|
|
4878
|
+
{ ...options, method: "DELETE" }
|
|
4879
|
+
);
|
|
4880
|
+
return result.data;
|
|
4881
|
+
}
|
|
4882
|
+
};
|
|
4883
|
+
|
|
4505
4884
|
// src/market/services/SkillService.ts
|
|
4506
|
-
import
|
|
4507
|
-
var
|
|
4885
|
+
import debug27 from "debug";
|
|
4886
|
+
var log27 = debug27("lobe-market-sdk:skill");
|
|
4508
4887
|
var SkillService2 = class extends BaseSDK {
|
|
4509
4888
|
/**
|
|
4510
4889
|
* Lists all available skill providers
|
|
@@ -4517,9 +4896,9 @@ var SkillService2 = class extends BaseSDK {
|
|
|
4517
4896
|
*/
|
|
4518
4897
|
async listProviders(options) {
|
|
4519
4898
|
var _a;
|
|
4520
|
-
|
|
4899
|
+
log27("Listing skill providers");
|
|
4521
4900
|
const result = await this.request("/v1/skill/providers", options);
|
|
4522
|
-
|
|
4901
|
+
log27("Found %d skill providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
|
|
4523
4902
|
return result;
|
|
4524
4903
|
}
|
|
4525
4904
|
/**
|
|
@@ -4534,12 +4913,12 @@ var SkillService2 = class extends BaseSDK {
|
|
|
4534
4913
|
*/
|
|
4535
4914
|
async listTools(provider, options) {
|
|
4536
4915
|
var _a;
|
|
4537
|
-
|
|
4916
|
+
log27("Listing tools for provider: %s", provider);
|
|
4538
4917
|
const result = await this.request(
|
|
4539
4918
|
`/v1/skill/${encodeURIComponent(provider)}/tools`,
|
|
4540
4919
|
options
|
|
4541
4920
|
);
|
|
4542
|
-
|
|
4921
|
+
log27("Found %d tools for provider %s", ((_a = result.tools) == null ? void 0 : _a.length) || 0, provider);
|
|
4543
4922
|
return result;
|
|
4544
4923
|
}
|
|
4545
4924
|
/**
|
|
@@ -4556,12 +4935,12 @@ var SkillService2 = class extends BaseSDK {
|
|
|
4556
4935
|
*/
|
|
4557
4936
|
async listLiveTools(provider, options) {
|
|
4558
4937
|
var _a;
|
|
4559
|
-
|
|
4938
|
+
log27("Listing live tools for provider: %s", provider);
|
|
4560
4939
|
const result = await this.request(
|
|
4561
4940
|
`/v1/skill/${encodeURIComponent(provider)}/tools/live`,
|
|
4562
4941
|
options
|
|
4563
4942
|
);
|
|
4564
|
-
|
|
4943
|
+
log27("Found %d live tools for provider %s", ((_a = result.tools) == null ? void 0 : _a.length) || 0, provider);
|
|
4565
4944
|
return result;
|
|
4566
4945
|
}
|
|
4567
4946
|
/**
|
|
@@ -4577,12 +4956,12 @@ var SkillService2 = class extends BaseSDK {
|
|
|
4577
4956
|
*/
|
|
4578
4957
|
async getTool(provider, toolName, options) {
|
|
4579
4958
|
var _a;
|
|
4580
|
-
|
|
4959
|
+
log27("Getting tool %s from provider %s", toolName, provider);
|
|
4581
4960
|
const result = await this.request(
|
|
4582
4961
|
`/v1/skill/${encodeURIComponent(provider)}/tool/${encodeURIComponent(toolName)}`,
|
|
4583
4962
|
options
|
|
4584
4963
|
);
|
|
4585
|
-
|
|
4964
|
+
log27("Retrieved tool: %s", (_a = result.tool) == null ? void 0 : _a.name);
|
|
4586
4965
|
return result;
|
|
4587
4966
|
}
|
|
4588
4967
|
/**
|
|
@@ -4596,12 +4975,12 @@ var SkillService2 = class extends BaseSDK {
|
|
|
4596
4975
|
* @returns Promise resolving to the connection status
|
|
4597
4976
|
*/
|
|
4598
4977
|
async getStatus(provider, options) {
|
|
4599
|
-
|
|
4978
|
+
log27("Getting status for provider: %s", provider);
|
|
4600
4979
|
const result = await this.request(
|
|
4601
4980
|
`/v1/skill/${encodeURIComponent(provider)}/status`,
|
|
4602
4981
|
options
|
|
4603
4982
|
);
|
|
4604
|
-
|
|
4983
|
+
log27("Provider %s status: connected=%s", provider, result.connected);
|
|
4605
4984
|
return result;
|
|
4606
4985
|
}
|
|
4607
4986
|
/**
|
|
@@ -4629,7 +5008,7 @@ var SkillService2 = class extends BaseSDK {
|
|
|
4629
5008
|
* ```
|
|
4630
5009
|
*/
|
|
4631
5010
|
async callTool(provider, params, options) {
|
|
4632
|
-
|
|
5011
|
+
log27("Calling tool %s on provider %s", params.tool, provider);
|
|
4633
5012
|
const { args, tool, ...rest } = params;
|
|
4634
5013
|
const result = await this.request(
|
|
4635
5014
|
`/v1/skill/${encodeURIComponent(provider)}/call`,
|
|
@@ -4646,14 +5025,14 @@ var SkillService2 = class extends BaseSDK {
|
|
|
4646
5025
|
...options
|
|
4647
5026
|
}
|
|
4648
5027
|
);
|
|
4649
|
-
|
|
5028
|
+
log27("Tool %s call completed: success=%s", params.tool, result.success);
|
|
4650
5029
|
return result;
|
|
4651
5030
|
}
|
|
4652
5031
|
};
|
|
4653
5032
|
|
|
4654
5033
|
// src/market/services/MarketTaskTemplateService.ts
|
|
4655
|
-
import
|
|
4656
|
-
var
|
|
5034
|
+
import debug28 from "debug";
|
|
5035
|
+
var log28 = debug28("lobe-market-sdk:task-templates");
|
|
4657
5036
|
var MarketTaskTemplateService = class extends BaseSDK {
|
|
4658
5037
|
/**
|
|
4659
5038
|
* Retrieves personalized task template recommendations.
|
|
@@ -4676,7 +5055,7 @@ var MarketTaskTemplateService = class extends BaseSDK {
|
|
|
4676
5055
|
refreshSeed: params.refreshSeed,
|
|
4677
5056
|
seedKey: params.seedKey
|
|
4678
5057
|
};
|
|
4679
|
-
|
|
5058
|
+
log28("Getting task template recommendations: %O", body);
|
|
4680
5059
|
const result = await this.request(
|
|
4681
5060
|
"/v1/task-templates/recommendations",
|
|
4682
5061
|
{
|
|
@@ -4685,14 +5064,14 @@ var MarketTaskTemplateService = class extends BaseSDK {
|
|
|
4685
5064
|
method: "POST"
|
|
4686
5065
|
}
|
|
4687
5066
|
);
|
|
4688
|
-
|
|
5067
|
+
log28("Retrieved %d task template recommendations", result.items.length);
|
|
4689
5068
|
return result;
|
|
4690
5069
|
}
|
|
4691
5070
|
};
|
|
4692
5071
|
|
|
4693
5072
|
// src/market/services/MarketSkillCollectionService.ts
|
|
4694
|
-
import
|
|
4695
|
-
var
|
|
5073
|
+
import debug29 from "debug";
|
|
5074
|
+
var log29 = debug29("lobe-market-sdk:skill-collections");
|
|
4696
5075
|
var MarketSkillCollectionService = class extends BaseSDK {
|
|
4697
5076
|
async getSkillCollectionDetail(slug, params = {}, options) {
|
|
4698
5077
|
const locale = params.locale || this.defaultLocale;
|
|
@@ -4701,12 +5080,12 @@ var MarketSkillCollectionService = class extends BaseSDK {
|
|
|
4701
5080
|
locale
|
|
4702
5081
|
};
|
|
4703
5082
|
const queryString = this.buildQueryString(queryParams);
|
|
4704
|
-
|
|
5083
|
+
log29("Getting skill collection detail: %s %O", slug, queryParams);
|
|
4705
5084
|
const result = await this.request(
|
|
4706
5085
|
`/v1/skills/collections/${encodeURIComponent(slug)}${queryString}`,
|
|
4707
5086
|
options
|
|
4708
5087
|
);
|
|
4709
|
-
|
|
5088
|
+
log29("Skill collection detail retrieved: %s (%d items)", slug, result.items.length);
|
|
4710
5089
|
return result;
|
|
4711
5090
|
}
|
|
4712
5091
|
async getSkillCollections(params = {}, options) {
|
|
@@ -4716,23 +5095,25 @@ var MarketSkillCollectionService = class extends BaseSDK {
|
|
|
4716
5095
|
locale
|
|
4717
5096
|
};
|
|
4718
5097
|
const queryString = this.buildQueryString(queryParams);
|
|
4719
|
-
|
|
5098
|
+
log29("Getting skill collections: %O", queryParams);
|
|
4720
5099
|
const result = await this.request(
|
|
4721
5100
|
`/v1/skills/collections${queryString}`,
|
|
4722
5101
|
options
|
|
4723
5102
|
);
|
|
4724
|
-
|
|
5103
|
+
log29("Retrieved %d skill collections", result.length);
|
|
4725
5104
|
return result;
|
|
4726
5105
|
}
|
|
4727
5106
|
};
|
|
4728
5107
|
|
|
4729
5108
|
// src/market/services/MarketSkillService.ts
|
|
4730
|
-
import
|
|
4731
|
-
var
|
|
5109
|
+
import debug30 from "debug";
|
|
5110
|
+
var log30 = debug30("lobe-market-sdk:market-skills");
|
|
4732
5111
|
var MarketSkillService = class extends BaseSDK {
|
|
4733
5112
|
/**
|
|
4734
5113
|
* Retrieves a list of skills from the marketplace
|
|
4735
5114
|
*
|
|
5115
|
+
* Set category to UNCATEGORIZED_CATEGORY to select assets with no assigned category.
|
|
5116
|
+
*
|
|
4736
5117
|
* Supports filtering, pagination, search, and various sorting options
|
|
4737
5118
|
* including GitHub stats (stars, forks, watchers). Locale localizes
|
|
4738
5119
|
* descriptions and summaries, but the returned skill name stays canonical.
|
|
@@ -4761,9 +5142,9 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4761
5142
|
const locale = params.locale || this.defaultLocale;
|
|
4762
5143
|
const queryParams = { ...params, locale };
|
|
4763
5144
|
const queryString = this.buildQueryString(queryParams);
|
|
4764
|
-
|
|
5145
|
+
log30("Getting skill list: %O", queryParams);
|
|
4765
5146
|
const result = await this.request(`/v1/skills${queryString}`, options);
|
|
4766
|
-
|
|
5147
|
+
log30(
|
|
4767
5148
|
"Retrieved %d skills (page %d/%d)",
|
|
4768
5149
|
result.items.length,
|
|
4769
5150
|
result.currentPage,
|
|
@@ -4802,12 +5183,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4802
5183
|
queryParams.version = params.version;
|
|
4803
5184
|
}
|
|
4804
5185
|
const queryString = this.buildQueryString(queryParams);
|
|
4805
|
-
|
|
5186
|
+
log30("Getting skill detail: %s %O", identifier, params);
|
|
4806
5187
|
const result = await this.request(
|
|
4807
5188
|
`/v1/skills/${encodeURIComponent(identifier)}${queryString}`,
|
|
4808
5189
|
options
|
|
4809
5190
|
);
|
|
4810
|
-
|
|
5191
|
+
log30("Skill detail retrieved: %s (v%s)", identifier, result.version);
|
|
4811
5192
|
return result;
|
|
4812
5193
|
}
|
|
4813
5194
|
/**
|
|
@@ -4838,7 +5219,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4838
5219
|
if (version) {
|
|
4839
5220
|
url += `?version=${encodeURIComponent(version)}`;
|
|
4840
5221
|
}
|
|
4841
|
-
|
|
5222
|
+
log30("Generated download URL: %s", url);
|
|
4842
5223
|
return url;
|
|
4843
5224
|
}
|
|
4844
5225
|
/**
|
|
@@ -4862,7 +5243,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4862
5243
|
* ```
|
|
4863
5244
|
*/
|
|
4864
5245
|
async downloadSkill(identifier, version, options) {
|
|
4865
|
-
|
|
5246
|
+
log30("Downloading skill: %s (version: %s)", identifier, version || "latest");
|
|
4866
5247
|
const queryParams = {};
|
|
4867
5248
|
if (version) {
|
|
4868
5249
|
queryParams.version = version;
|
|
@@ -4878,7 +5259,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4878
5259
|
});
|
|
4879
5260
|
if (!response.ok) {
|
|
4880
5261
|
const errorText = await response.text();
|
|
4881
|
-
|
|
5262
|
+
log30("Download failed: %s %s", response.status, errorText);
|
|
4882
5263
|
throw new Error(`Failed to download skill: ${response.statusText}`);
|
|
4883
5264
|
}
|
|
4884
5265
|
const contentDisposition = response.headers.get("content-disposition");
|
|
@@ -4890,7 +5271,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4890
5271
|
}
|
|
4891
5272
|
}
|
|
4892
5273
|
const buffer = await response.arrayBuffer();
|
|
4893
|
-
|
|
5274
|
+
log30("Downloaded skill: %s (%d bytes)", filename, buffer.byteLength);
|
|
4894
5275
|
return { buffer, filename };
|
|
4895
5276
|
}
|
|
4896
5277
|
/**
|
|
@@ -4918,12 +5299,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4918
5299
|
const locale = params.locale || this.defaultLocale;
|
|
4919
5300
|
const queryParams = { ...params, locale };
|
|
4920
5301
|
const queryString = this.buildQueryString(queryParams);
|
|
4921
|
-
|
|
5302
|
+
log30("Getting skill categories: %O", queryParams);
|
|
4922
5303
|
const result = await this.request(
|
|
4923
5304
|
`/v1/skills/categories${queryString}`,
|
|
4924
5305
|
options
|
|
4925
5306
|
);
|
|
4926
|
-
|
|
5307
|
+
log30("Retrieved %d categories", result.length);
|
|
4927
5308
|
return result;
|
|
4928
5309
|
}
|
|
4929
5310
|
/**
|
|
@@ -4938,12 +5319,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4938
5319
|
* @returns Promise resolving to an array of identifiers with last modified times
|
|
4939
5320
|
*/
|
|
4940
5321
|
async getPublishedIdentifiers(options) {
|
|
4941
|
-
|
|
5322
|
+
log30("Getting published skill identifiers");
|
|
4942
5323
|
const result = await this.request(
|
|
4943
5324
|
"/v1/skills/identifiers",
|
|
4944
5325
|
options
|
|
4945
5326
|
);
|
|
4946
|
-
|
|
5327
|
+
log30("Retrieved %d published skill identifiers", result.length);
|
|
4947
5328
|
return result;
|
|
4948
5329
|
}
|
|
4949
5330
|
/**
|
|
@@ -4954,9 +5335,9 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4954
5335
|
*/
|
|
4955
5336
|
async getSitemap(params = {}, options) {
|
|
4956
5337
|
const queryString = this.buildQueryString(params);
|
|
4957
|
-
|
|
5338
|
+
log30("Getting skill sitemap%s", queryString);
|
|
4958
5339
|
const result = await this.request(`/v1/skills/sitemap${queryString}`, options);
|
|
4959
|
-
|
|
5340
|
+
log30(
|
|
4960
5341
|
"Retrieved skill sitemap page %d/%d (%d items)",
|
|
4961
5342
|
result.currentPage,
|
|
4962
5343
|
result.totalPages,
|
|
@@ -4972,13 +5353,13 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4972
5353
|
* @returns Promise resolving to true if skill exists, false otherwise
|
|
4973
5354
|
*/
|
|
4974
5355
|
async checkSkillExists(identifier, options) {
|
|
4975
|
-
|
|
5356
|
+
log30("Checking if skill exists: %s", identifier);
|
|
4976
5357
|
try {
|
|
4977
5358
|
await this.getSkillDetail(identifier, {}, options);
|
|
4978
|
-
|
|
5359
|
+
log30("Skill exists: %s", identifier);
|
|
4979
5360
|
return true;
|
|
4980
5361
|
} catch (e) {
|
|
4981
|
-
|
|
5362
|
+
log30("Skill does not exist: %s", identifier);
|
|
4982
5363
|
return false;
|
|
4983
5364
|
}
|
|
4984
5365
|
}
|
|
@@ -4999,12 +5380,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4999
5380
|
* ```
|
|
5000
5381
|
*/
|
|
5001
5382
|
async getSkillVersions(identifier, options) {
|
|
5002
|
-
|
|
5383
|
+
log30("Getting skill versions: %s", identifier);
|
|
5003
5384
|
const result = await this.request(
|
|
5004
5385
|
`/v1/skills/${encodeURIComponent(identifier)}/versions`,
|
|
5005
5386
|
options
|
|
5006
5387
|
);
|
|
5007
|
-
|
|
5388
|
+
log30("Retrieved %d versions for skill %s", result.data.length, identifier);
|
|
5008
5389
|
return result.data;
|
|
5009
5390
|
}
|
|
5010
5391
|
/**
|
|
@@ -5028,12 +5409,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5028
5409
|
const locale = params.locale || this.defaultLocale;
|
|
5029
5410
|
const queryParams = { locale };
|
|
5030
5411
|
const queryString = this.buildQueryString(queryParams);
|
|
5031
|
-
|
|
5412
|
+
log30("Getting skill version: %s@%s", identifier, version);
|
|
5032
5413
|
const result = await this.request(
|
|
5033
5414
|
`/v1/skills/${encodeURIComponent(identifier)}/versions/${encodeURIComponent(version)}${queryString}`,
|
|
5034
5415
|
options
|
|
5035
5416
|
);
|
|
5036
|
-
|
|
5417
|
+
log30("Skill version detail retrieved: %s@%s", identifier, version);
|
|
5037
5418
|
return result;
|
|
5038
5419
|
}
|
|
5039
5420
|
/**
|
|
@@ -5062,13 +5443,13 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5062
5443
|
* ```
|
|
5063
5444
|
*/
|
|
5064
5445
|
async reportGitHubSkill(params, options) {
|
|
5065
|
-
|
|
5446
|
+
log30("Reporting GitHub skill: %s", params.gitUrl);
|
|
5066
5447
|
const result = await this.request("/v1/skills/report/github", {
|
|
5067
5448
|
...options,
|
|
5068
5449
|
body: JSON.stringify(params),
|
|
5069
5450
|
method: "POST"
|
|
5070
5451
|
});
|
|
5071
|
-
|
|
5452
|
+
log30("GitHub skill reported: %s (status: %s)", result.identifier, result.status);
|
|
5072
5453
|
return result;
|
|
5073
5454
|
}
|
|
5074
5455
|
/**
|
|
@@ -5093,7 +5474,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5093
5474
|
* ```
|
|
5094
5475
|
*/
|
|
5095
5476
|
async reportSkillInstall(params, options) {
|
|
5096
|
-
|
|
5477
|
+
log30("Reporting skill install: %s (success: %s)", params.identifier, params.success);
|
|
5097
5478
|
const result = await this.request(
|
|
5098
5479
|
"/v1/skills/report/installation",
|
|
5099
5480
|
{
|
|
@@ -5102,7 +5483,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5102
5483
|
method: "POST"
|
|
5103
5484
|
}
|
|
5104
5485
|
);
|
|
5105
|
-
|
|
5486
|
+
log30("Skill install reported: %s", result.message);
|
|
5106
5487
|
return result;
|
|
5107
5488
|
}
|
|
5108
5489
|
/**
|
|
@@ -5114,7 +5495,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5114
5495
|
* @returns Promise resolving to the submitted score
|
|
5115
5496
|
*/
|
|
5116
5497
|
async submitRating(identifier, score, options) {
|
|
5117
|
-
|
|
5498
|
+
log30("Submitting rating for skill %s: %d", identifier, score);
|
|
5118
5499
|
const result = await this.request(
|
|
5119
5500
|
`/v1/skills/${encodeURIComponent(identifier)}/ratings`,
|
|
5120
5501
|
{
|
|
@@ -5123,7 +5504,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5123
5504
|
method: "POST"
|
|
5124
5505
|
}
|
|
5125
5506
|
);
|
|
5126
|
-
|
|
5507
|
+
log30("Rating submitted for skill %s: %d", identifier, result.score);
|
|
5127
5508
|
return result;
|
|
5128
5509
|
}
|
|
5129
5510
|
/**
|
|
@@ -5134,12 +5515,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5134
5515
|
* @returns Promise resolving to the rating distribution
|
|
5135
5516
|
*/
|
|
5136
5517
|
async getRatingDistribution(identifier, options) {
|
|
5137
|
-
|
|
5518
|
+
log30("Getting rating distribution for skill: %s", identifier);
|
|
5138
5519
|
const result = await this.request(
|
|
5139
5520
|
`/v1/skills/${encodeURIComponent(identifier)}/ratings/distribution`,
|
|
5140
5521
|
options
|
|
5141
5522
|
);
|
|
5142
|
-
|
|
5523
|
+
log30("Rating distribution retrieved for skill %s: %d total", identifier, result.totalCount);
|
|
5143
5524
|
return result;
|
|
5144
5525
|
}
|
|
5145
5526
|
/**
|
|
@@ -5152,12 +5533,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5152
5533
|
*/
|
|
5153
5534
|
async getComments(identifier, params = {}, options) {
|
|
5154
5535
|
const queryString = this.buildQueryString(params);
|
|
5155
|
-
|
|
5536
|
+
log30("Getting comments for skill %s: %O", identifier, params);
|
|
5156
5537
|
const result = await this.request(
|
|
5157
5538
|
`/v1/skills/${encodeURIComponent(identifier)}/comments${queryString}`,
|
|
5158
5539
|
options
|
|
5159
5540
|
);
|
|
5160
|
-
|
|
5541
|
+
log30(
|
|
5161
5542
|
"Retrieved %d comments for skill %s (page %d/%d)",
|
|
5162
5543
|
result.items.length,
|
|
5163
5544
|
identifier,
|
|
@@ -5174,15 +5555,15 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5174
5555
|
* @returns Promise resolving to the latest own comment or null when none exists
|
|
5175
5556
|
*/
|
|
5176
5557
|
async getLatestOwnComment(identifier, options) {
|
|
5177
|
-
|
|
5558
|
+
log30("Getting latest own comment for skill %s", identifier);
|
|
5178
5559
|
const result = await this.request(
|
|
5179
5560
|
`/v1/skills/${encodeURIComponent(identifier)}/comments/latest`,
|
|
5180
5561
|
options
|
|
5181
5562
|
);
|
|
5182
5563
|
if (result) {
|
|
5183
|
-
|
|
5564
|
+
log30("Retrieved latest own comment for skill %s: id=%d", identifier, result.id);
|
|
5184
5565
|
} else {
|
|
5185
|
-
|
|
5566
|
+
log30("No own comments found for skill %s", identifier);
|
|
5186
5567
|
}
|
|
5187
5568
|
return result;
|
|
5188
5569
|
}
|
|
@@ -5195,7 +5576,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5195
5576
|
* @returns Promise resolving to the created comment (with optional rating field)
|
|
5196
5577
|
*/
|
|
5197
5578
|
async createComment(identifier, data, options) {
|
|
5198
|
-
|
|
5579
|
+
log30("Creating comment on skill %s", identifier);
|
|
5199
5580
|
const result = await this.request(
|
|
5200
5581
|
`/v1/skills/${encodeURIComponent(identifier)}/comments`,
|
|
5201
5582
|
{
|
|
@@ -5204,7 +5585,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5204
5585
|
method: "POST"
|
|
5205
5586
|
}
|
|
5206
5587
|
);
|
|
5207
|
-
|
|
5588
|
+
log30("Comment created on skill %s: id=%d", identifier, result.id);
|
|
5208
5589
|
return result;
|
|
5209
5590
|
}
|
|
5210
5591
|
/**
|
|
@@ -5216,7 +5597,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5216
5597
|
* @returns Promise resolving to success status
|
|
5217
5598
|
*/
|
|
5218
5599
|
async deleteComment(identifier, commentId, options) {
|
|
5219
|
-
|
|
5600
|
+
log30("Deleting comment %d from skill %s", commentId, identifier);
|
|
5220
5601
|
const result = await this.request(
|
|
5221
5602
|
`/v1/skills/${encodeURIComponent(identifier)}/comments/${commentId}`,
|
|
5222
5603
|
{
|
|
@@ -5224,7 +5605,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5224
5605
|
method: "DELETE"
|
|
5225
5606
|
}
|
|
5226
5607
|
);
|
|
5227
|
-
|
|
5608
|
+
log30("Comment %d deleted from skill %s", commentId, identifier);
|
|
5228
5609
|
return result;
|
|
5229
5610
|
}
|
|
5230
5611
|
/**
|
|
@@ -5236,7 +5617,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5236
5617
|
* @returns Promise resolving to the created reaction
|
|
5237
5618
|
*/
|
|
5238
5619
|
async addReaction(commentId, type, options) {
|
|
5239
|
-
|
|
5620
|
+
log30("Adding %s reaction to comment %d", type, commentId);
|
|
5240
5621
|
const result = await this.request(
|
|
5241
5622
|
`/v1/skills/comments/${commentId}/reactions`,
|
|
5242
5623
|
{
|
|
@@ -5245,7 +5626,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5245
5626
|
method: "POST"
|
|
5246
5627
|
}
|
|
5247
5628
|
);
|
|
5248
|
-
|
|
5629
|
+
log30("Reaction added to comment %d: %s (id=%d)", commentId, result.type, result.id);
|
|
5249
5630
|
return result;
|
|
5250
5631
|
}
|
|
5251
5632
|
/**
|
|
@@ -5256,7 +5637,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5256
5637
|
* @returns Promise resolving to success status
|
|
5257
5638
|
*/
|
|
5258
5639
|
async removeReaction(commentId, options) {
|
|
5259
|
-
|
|
5640
|
+
log30("Removing reaction from comment %d", commentId);
|
|
5260
5641
|
const result = await this.request(
|
|
5261
5642
|
`/v1/skills/comments/${commentId}/reactions`,
|
|
5262
5643
|
{
|
|
@@ -5264,19 +5645,19 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
5264
5645
|
method: "DELETE"
|
|
5265
5646
|
}
|
|
5266
5647
|
);
|
|
5267
|
-
|
|
5648
|
+
log30("Reaction removed from comment %d", commentId);
|
|
5268
5649
|
return result;
|
|
5269
5650
|
}
|
|
5270
5651
|
};
|
|
5271
5652
|
|
|
5272
5653
|
// src/market/services/OrganizationCredsService.ts
|
|
5273
|
-
import
|
|
5654
|
+
import debug31 from "debug";
|
|
5274
5655
|
|
|
5275
5656
|
// src/utils/orgRef.ts
|
|
5276
5657
|
var orgRefToPathSegment = (ref) => typeof ref === "number" ? String(ref) : `workspace:${encodeURIComponent(ref.workspaceId)}`;
|
|
5277
5658
|
|
|
5278
5659
|
// src/market/services/OrganizationCredsService.ts
|
|
5279
|
-
var
|
|
5660
|
+
var log31 = debug31("lobe-market-sdk:org-creds");
|
|
5280
5661
|
var OrganizationCredsService = class extends BaseSDK {
|
|
5281
5662
|
constructor(orgId, options = {}, sharedHeaders, sharedTokenState) {
|
|
5282
5663
|
super(options, sharedHeaders, sharedTokenState);
|
|
@@ -5308,9 +5689,9 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5308
5689
|
*/
|
|
5309
5690
|
async list(options) {
|
|
5310
5691
|
var _a;
|
|
5311
|
-
|
|
5692
|
+
log31("Listing org %s credentials", this.orgSegment);
|
|
5312
5693
|
const result = await this.request(this.base(), options);
|
|
5313
|
-
|
|
5694
|
+
log31("Found %d credentials for org %s", ((_a = result.data) == null ? void 0 : _a.length) || 0, this.orgSegment);
|
|
5314
5695
|
return result;
|
|
5315
5696
|
}
|
|
5316
5697
|
/**
|
|
@@ -5319,20 +5700,20 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5319
5700
|
* owner via `CredService.get(id, { decrypt: true })`.
|
|
5320
5701
|
*/
|
|
5321
5702
|
async get(id, getOptions, options) {
|
|
5322
|
-
|
|
5703
|
+
log31("Getting org %s credential %d (decrypt=%s)", this.orgSegment, id, getOptions == null ? void 0 : getOptions.decrypt);
|
|
5323
5704
|
const queryString = this.buildQueryString((getOptions == null ? void 0 : getOptions.decrypt) ? { decrypt: "true" } : {});
|
|
5324
5705
|
const result = await this.request(
|
|
5325
5706
|
`${this.base()}/${id}${queryString}`,
|
|
5326
5707
|
options
|
|
5327
5708
|
);
|
|
5328
|
-
|
|
5709
|
+
log31("Retrieved org credential: %s", result.key);
|
|
5329
5710
|
return result;
|
|
5330
5711
|
}
|
|
5331
5712
|
// ===========================================================================
|
|
5332
5713
|
// Create
|
|
5333
5714
|
// ===========================================================================
|
|
5334
5715
|
async createKV(data, options) {
|
|
5335
|
-
|
|
5716
|
+
log31("Creating org %s KV credential: %s (type=%s)", this.orgSegment, data.key, data.type);
|
|
5336
5717
|
return this.request(`${this.base()}/kv`, {
|
|
5337
5718
|
body: JSON.stringify(data),
|
|
5338
5719
|
headers: { "Content-Type": "application/json" },
|
|
@@ -5341,7 +5722,7 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5341
5722
|
});
|
|
5342
5723
|
}
|
|
5343
5724
|
async createOAuth(data, options) {
|
|
5344
|
-
|
|
5725
|
+
log31("Creating org %s OAuth credential: %s", this.orgSegment, data.key);
|
|
5345
5726
|
return this.request(`${this.base()}/oauth`, {
|
|
5346
5727
|
body: JSON.stringify(data),
|
|
5347
5728
|
headers: { "Content-Type": "application/json" },
|
|
@@ -5350,7 +5731,7 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5350
5731
|
});
|
|
5351
5732
|
}
|
|
5352
5733
|
async createFile(data, options) {
|
|
5353
|
-
|
|
5734
|
+
log31("Creating org %s file credential: %s", this.orgSegment, data.key);
|
|
5354
5735
|
return this.request(`${this.base()}/file`, {
|
|
5355
5736
|
body: JSON.stringify(data),
|
|
5356
5737
|
headers: { "Content-Type": "application/json" },
|
|
@@ -5362,7 +5743,7 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5362
5743
|
// Update
|
|
5363
5744
|
// ===========================================================================
|
|
5364
5745
|
async update(id, data, options) {
|
|
5365
|
-
|
|
5746
|
+
log31("Updating org %s credential %d", this.orgSegment, id);
|
|
5366
5747
|
return this.request(`${this.base()}/${id}`, {
|
|
5367
5748
|
body: JSON.stringify(data),
|
|
5368
5749
|
headers: { "Content-Type": "application/json" },
|
|
@@ -5374,14 +5755,14 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5374
5755
|
// Delete
|
|
5375
5756
|
// ===========================================================================
|
|
5376
5757
|
async delete(id, options) {
|
|
5377
|
-
|
|
5758
|
+
log31("Deleting org %s credential %d", this.orgSegment, id);
|
|
5378
5759
|
return this.request(`${this.base()}/${id}`, {
|
|
5379
5760
|
method: "DELETE",
|
|
5380
5761
|
...options
|
|
5381
5762
|
});
|
|
5382
5763
|
}
|
|
5383
5764
|
async deleteByKey(key, options) {
|
|
5384
|
-
|
|
5765
|
+
log31("Deleting org %s credential by key: %s", this.orgSegment, key);
|
|
5385
5766
|
return this.request(`${this.base()}/key/${encodeURIComponent(key)}`, {
|
|
5386
5767
|
method: "DELETE",
|
|
5387
5768
|
...options
|
|
@@ -5395,7 +5776,7 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5395
5776
|
* the org has bound vs. is missing. Reads only; any org member may call.
|
|
5396
5777
|
*/
|
|
5397
5778
|
async getSkillCredStatus(skillIdentifier, options) {
|
|
5398
|
-
|
|
5779
|
+
log31("Getting org %s skill cred status: %s", this.orgSegment, skillIdentifier);
|
|
5399
5780
|
const path = `/v1/organizations/${this.orgSegment}/skills/${encodeURIComponent(skillIdentifier)}/creds/status`;
|
|
5400
5781
|
const result = await this.request(
|
|
5401
5782
|
path,
|
|
@@ -5406,8 +5787,8 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5406
5787
|
};
|
|
5407
5788
|
|
|
5408
5789
|
// src/market/services/OrganizationService.ts
|
|
5409
|
-
import
|
|
5410
|
-
var
|
|
5790
|
+
import debug32 from "debug";
|
|
5791
|
+
var log32 = debug32("lobe-market-sdk:organization");
|
|
5411
5792
|
var OrganizationService2 = class extends BaseSDK {
|
|
5412
5793
|
constructor(options = {}, sharedHeaders, sharedTokenState) {
|
|
5413
5794
|
super(options, sharedHeaders, sharedTokenState);
|
|
@@ -5455,12 +5836,12 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5455
5836
|
async getOrganizationInfo(idOrNamespace, params = {}, options) {
|
|
5456
5837
|
const locale = params.locale || this.defaultLocale;
|
|
5457
5838
|
const queryString = this.buildQueryString({ locale });
|
|
5458
|
-
|
|
5839
|
+
log32("Getting organization info: %O", { idOrNamespace, ...params });
|
|
5459
5840
|
const result = await this.request(
|
|
5460
5841
|
`/v1/organizations/info/${idOrNamespace}${queryString}`,
|
|
5461
5842
|
options
|
|
5462
5843
|
);
|
|
5463
|
-
|
|
5844
|
+
log32("Organization info retrieved for: %s", idOrNamespace);
|
|
5464
5845
|
return result;
|
|
5465
5846
|
}
|
|
5466
5847
|
/**
|
|
@@ -5470,7 +5851,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5470
5851
|
* @returns Promise resolving to the user's organizations
|
|
5471
5852
|
*/
|
|
5472
5853
|
async listMyOrganizations(options) {
|
|
5473
|
-
|
|
5854
|
+
log32("Listing organizations for current user");
|
|
5474
5855
|
const result = await this.request(
|
|
5475
5856
|
"/v1/organizations/me",
|
|
5476
5857
|
options
|
|
@@ -5488,7 +5869,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5488
5869
|
* @returns The created/existing organization and whether it was newly created
|
|
5489
5870
|
*/
|
|
5490
5871
|
async createOrganization(data, options) {
|
|
5491
|
-
|
|
5872
|
+
log32("Creating organization: %s", data.clerkId);
|
|
5492
5873
|
return this.request("/v1/organizations", {
|
|
5493
5874
|
...options,
|
|
5494
5875
|
body: JSON.stringify(data),
|
|
@@ -5503,7 +5884,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5503
5884
|
* @returns The updated organization
|
|
5504
5885
|
*/
|
|
5505
5886
|
async updateOrganization(orgId, data, options) {
|
|
5506
|
-
|
|
5887
|
+
log32("Updating organization %d: %O", orgId, data);
|
|
5507
5888
|
const result = await this.request(
|
|
5508
5889
|
`/v1/organizations/${orgRefToPathSegment(orgId)}`,
|
|
5509
5890
|
{
|
|
@@ -5522,7 +5903,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5522
5903
|
* @returns The archived organization
|
|
5523
5904
|
*/
|
|
5524
5905
|
async archiveOrganization(orgId, options) {
|
|
5525
|
-
|
|
5906
|
+
log32("Archiving organization %d", orgId);
|
|
5526
5907
|
const result = await this.request(
|
|
5527
5908
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/archive`,
|
|
5528
5909
|
{ ...options, method: "POST" }
|
|
@@ -5536,7 +5917,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5536
5917
|
* @returns The reactivated organization
|
|
5537
5918
|
*/
|
|
5538
5919
|
async unarchiveOrganization(orgId, options) {
|
|
5539
|
-
|
|
5920
|
+
log32("Unarchiving organization %d", orgId);
|
|
5540
5921
|
const result = await this.request(
|
|
5541
5922
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/unarchive`,
|
|
5542
5923
|
{ ...options, method: "POST" }
|
|
@@ -5550,7 +5931,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5550
5931
|
* @returns Hydrated member rows
|
|
5551
5932
|
*/
|
|
5552
5933
|
async listMembers(orgId, options) {
|
|
5553
|
-
|
|
5934
|
+
log32("Listing members of organization %d", orgId);
|
|
5554
5935
|
const result = await this.request(
|
|
5555
5936
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/members`,
|
|
5556
5937
|
options
|
|
@@ -5567,7 +5948,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5567
5948
|
* @returns Whether the member was newly added and their effective role
|
|
5568
5949
|
*/
|
|
5569
5950
|
async addMember(orgId, userAccountId, role, options) {
|
|
5570
|
-
|
|
5951
|
+
log32("Adding member %d to organization %d (role=%s)", userAccountId, orgId, role);
|
|
5571
5952
|
return this.request(
|
|
5572
5953
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/members`,
|
|
5573
5954
|
{
|
|
@@ -5586,7 +5967,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5586
5967
|
* @returns Whether a membership row was removed
|
|
5587
5968
|
*/
|
|
5588
5969
|
async removeMember(orgId, userAccountId, options) {
|
|
5589
|
-
|
|
5970
|
+
log32("Removing member %d from organization %d", userAccountId, orgId);
|
|
5590
5971
|
return this.request(
|
|
5591
5972
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/members/${userAccountId}`,
|
|
5592
5973
|
{ ...options, method: "DELETE" }
|
|
@@ -5602,7 +5983,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5602
5983
|
* @returns The effective role and whether it changed
|
|
5603
5984
|
*/
|
|
5604
5985
|
async updateMemberRole(orgId, userAccountId, role, options) {
|
|
5605
|
-
|
|
5986
|
+
log32("Updating member %d role to %s in organization %d", userAccountId, role, orgId);
|
|
5606
5987
|
return this.request(
|
|
5607
5988
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/members/${userAccountId}`,
|
|
5608
5989
|
{ ...options, body: JSON.stringify({ role }), method: "PATCH" }
|
|
@@ -5620,7 +6001,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5620
6001
|
* @returns Counts of added / removed / updated members and skipped ids
|
|
5621
6002
|
*/
|
|
5622
6003
|
async reconcileMembers(orgId, members, options) {
|
|
5623
|
-
|
|
6004
|
+
log32("Reconciling %d members for organization %d", members.length, orgId);
|
|
5624
6005
|
return this.request(
|
|
5625
6006
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/members`,
|
|
5626
6007
|
{
|
|
@@ -5633,8 +6014,8 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5633
6014
|
};
|
|
5634
6015
|
|
|
5635
6016
|
// src/market/services/UserService.ts
|
|
5636
|
-
import
|
|
5637
|
-
var
|
|
6017
|
+
import debug33 from "debug";
|
|
6018
|
+
var log33 = debug33("lobe-market-sdk:user");
|
|
5638
6019
|
var UserService = class extends BaseSDK {
|
|
5639
6020
|
/**
|
|
5640
6021
|
* Retrieves user information by account ID or userName
|
|
@@ -5651,12 +6032,12 @@ var UserService = class extends BaseSDK {
|
|
|
5651
6032
|
const locale = params.locale || this.defaultLocale;
|
|
5652
6033
|
const queryParams = { locale };
|
|
5653
6034
|
const queryString = this.buildQueryString(queryParams);
|
|
5654
|
-
|
|
6035
|
+
log33("Getting user info: %O", { idOrUserName, ...params });
|
|
5655
6036
|
const result = await this.request(
|
|
5656
6037
|
`/v1/user/info/${idOrUserName}${queryString}`,
|
|
5657
6038
|
options
|
|
5658
6039
|
);
|
|
5659
|
-
|
|
6040
|
+
log33("User info successfully retrieved for: %s", idOrUserName);
|
|
5660
6041
|
return result;
|
|
5661
6042
|
}
|
|
5662
6043
|
/**
|
|
@@ -5671,7 +6052,7 @@ var UserService = class extends BaseSDK {
|
|
|
5671
6052
|
* @throws Error if userName is already taken or update fails
|
|
5672
6053
|
*/
|
|
5673
6054
|
async updateUserInfo(data, options) {
|
|
5674
|
-
|
|
6055
|
+
log33("Updating user info: %O", data);
|
|
5675
6056
|
const result = await this.request("/v1/user/update", {
|
|
5676
6057
|
body: JSON.stringify(data),
|
|
5677
6058
|
headers: {
|
|
@@ -5680,7 +6061,7 @@ var UserService = class extends BaseSDK {
|
|
|
5680
6061
|
method: "POST",
|
|
5681
6062
|
...options
|
|
5682
6063
|
});
|
|
5683
|
-
|
|
6064
|
+
log33("User info updated successfully");
|
|
5684
6065
|
return result;
|
|
5685
6066
|
}
|
|
5686
6067
|
/**
|
|
@@ -5710,7 +6091,7 @@ var UserService = class extends BaseSDK {
|
|
|
5710
6091
|
* ```
|
|
5711
6092
|
*/
|
|
5712
6093
|
async register(data, options) {
|
|
5713
|
-
|
|
6094
|
+
log33("Registering user: %O", {
|
|
5714
6095
|
followUserId: data.followUserId,
|
|
5715
6096
|
registerUserId: data.registerUserId
|
|
5716
6097
|
});
|
|
@@ -5722,14 +6103,14 @@ var UserService = class extends BaseSDK {
|
|
|
5722
6103
|
method: "POST",
|
|
5723
6104
|
...options
|
|
5724
6105
|
});
|
|
5725
|
-
|
|
6106
|
+
log33("User registered successfully: created=%s, userId=%s", result.created, result.user.clerkId);
|
|
5726
6107
|
return result;
|
|
5727
6108
|
}
|
|
5728
6109
|
};
|
|
5729
6110
|
|
|
5730
6111
|
// src/market/services/UserFollowService.ts
|
|
5731
|
-
import
|
|
5732
|
-
var
|
|
6112
|
+
import debug34 from "debug";
|
|
6113
|
+
var log34 = debug34("lobe-market-sdk:user-follow");
|
|
5733
6114
|
var UserFollowService = class extends BaseSDK {
|
|
5734
6115
|
/**
|
|
5735
6116
|
* Follow a user
|
|
@@ -5743,7 +6124,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5743
6124
|
* @throws Error if already following or cannot follow yourself
|
|
5744
6125
|
*/
|
|
5745
6126
|
async follow(followingId, options) {
|
|
5746
|
-
|
|
6127
|
+
log34("Following user: %d", followingId);
|
|
5747
6128
|
const body = { followingId };
|
|
5748
6129
|
const result = await this.request("/v1/user/follows", {
|
|
5749
6130
|
body: JSON.stringify(body),
|
|
@@ -5753,7 +6134,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5753
6134
|
method: "POST",
|
|
5754
6135
|
...options
|
|
5755
6136
|
});
|
|
5756
|
-
|
|
6137
|
+
log34("Successfully followed user: %d", followingId);
|
|
5757
6138
|
return result;
|
|
5758
6139
|
}
|
|
5759
6140
|
/**
|
|
@@ -5768,7 +6149,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5768
6149
|
* @throws Error if follow relationship not found
|
|
5769
6150
|
*/
|
|
5770
6151
|
async unfollow(followingId, options) {
|
|
5771
|
-
|
|
6152
|
+
log34("Unfollowing user: %d", followingId);
|
|
5772
6153
|
const body = { followingId };
|
|
5773
6154
|
const result = await this.request("/v1/user/follows", {
|
|
5774
6155
|
body: JSON.stringify(body),
|
|
@@ -5778,7 +6159,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5778
6159
|
method: "DELETE",
|
|
5779
6160
|
...options
|
|
5780
6161
|
});
|
|
5781
|
-
|
|
6162
|
+
log34("Successfully unfollowed user: %d", followingId);
|
|
5782
6163
|
return result;
|
|
5783
6164
|
}
|
|
5784
6165
|
/**
|
|
@@ -5792,13 +6173,13 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5792
6173
|
* @returns Promise resolving to follow status (isFollowing, isMutual)
|
|
5793
6174
|
*/
|
|
5794
6175
|
async checkFollowStatus(targetUserId, options) {
|
|
5795
|
-
|
|
6176
|
+
log34("Checking follow status for user: %d", targetUserId);
|
|
5796
6177
|
const queryString = this.buildQueryString({ targetUserId: String(targetUserId) });
|
|
5797
6178
|
const result = await this.request(
|
|
5798
6179
|
`/v1/user/follows/check${queryString}`,
|
|
5799
6180
|
options
|
|
5800
6181
|
);
|
|
5801
|
-
|
|
6182
|
+
log34("Follow status retrieved: %O", result);
|
|
5802
6183
|
return result;
|
|
5803
6184
|
}
|
|
5804
6185
|
/**
|
|
@@ -5813,7 +6194,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5813
6194
|
* @returns Promise resolving to list of following users
|
|
5814
6195
|
*/
|
|
5815
6196
|
async getFollowing(userId, params = {}, options) {
|
|
5816
|
-
|
|
6197
|
+
log34("Getting following list for user: %d", userId);
|
|
5817
6198
|
const queryParams = {};
|
|
5818
6199
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5819
6200
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5822,7 +6203,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5822
6203
|
`/v1/user/follows/${userId}/following${queryString}`,
|
|
5823
6204
|
options
|
|
5824
6205
|
);
|
|
5825
|
-
|
|
6206
|
+
log34("Following list retrieved for user: %d", userId);
|
|
5826
6207
|
return result;
|
|
5827
6208
|
}
|
|
5828
6209
|
/**
|
|
@@ -5837,7 +6218,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5837
6218
|
* @returns Promise resolving to list of followers
|
|
5838
6219
|
*/
|
|
5839
6220
|
async getFollowers(userId, params = {}, options) {
|
|
5840
|
-
|
|
6221
|
+
log34("Getting followers list for user: %d", userId);
|
|
5841
6222
|
const queryParams = {};
|
|
5842
6223
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5843
6224
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5846,14 +6227,14 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5846
6227
|
`/v1/user/follows/${userId}/followers${queryString}`,
|
|
5847
6228
|
options
|
|
5848
6229
|
);
|
|
5849
|
-
|
|
6230
|
+
log34("Followers list retrieved for user: %d", userId);
|
|
5850
6231
|
return result;
|
|
5851
6232
|
}
|
|
5852
6233
|
};
|
|
5853
6234
|
|
|
5854
6235
|
// src/market/services/UserFavoriteService.ts
|
|
5855
|
-
import
|
|
5856
|
-
var
|
|
6236
|
+
import debug35 from "debug";
|
|
6237
|
+
var log35 = debug35("lobe-market-sdk:user-favorite");
|
|
5857
6238
|
var UserFavoriteService = class extends BaseSDK {
|
|
5858
6239
|
/**
|
|
5859
6240
|
* Add to favorites
|
|
@@ -5868,7 +6249,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5868
6249
|
* @throws Error if already in favorites
|
|
5869
6250
|
*/
|
|
5870
6251
|
async addFavorite(targetType, targetId, options) {
|
|
5871
|
-
|
|
6252
|
+
log35("Adding favorite: %s %d", targetType, targetId);
|
|
5872
6253
|
const body = { targetId, targetType };
|
|
5873
6254
|
const result = await this.request("/v1/user/favorites", {
|
|
5874
6255
|
body: JSON.stringify(body),
|
|
@@ -5878,7 +6259,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5878
6259
|
method: "POST",
|
|
5879
6260
|
...options
|
|
5880
6261
|
});
|
|
5881
|
-
|
|
6262
|
+
log35("Successfully added favorite: %s %d", targetType, targetId);
|
|
5882
6263
|
return result;
|
|
5883
6264
|
}
|
|
5884
6265
|
/**
|
|
@@ -5894,7 +6275,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5894
6275
|
* @throws Error if favorite not found
|
|
5895
6276
|
*/
|
|
5896
6277
|
async removeFavorite(targetType, targetId, options) {
|
|
5897
|
-
|
|
6278
|
+
log35("Removing favorite: %s %d", targetType, targetId);
|
|
5898
6279
|
const body = { targetId, targetType };
|
|
5899
6280
|
const result = await this.request("/v1/user/favorites", {
|
|
5900
6281
|
body: JSON.stringify(body),
|
|
@@ -5904,7 +6285,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5904
6285
|
method: "DELETE",
|
|
5905
6286
|
...options
|
|
5906
6287
|
});
|
|
5907
|
-
|
|
6288
|
+
log35("Successfully removed favorite: %s %d", targetType, targetId);
|
|
5908
6289
|
return result;
|
|
5909
6290
|
}
|
|
5910
6291
|
/**
|
|
@@ -5919,7 +6300,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5919
6300
|
* @returns Promise resolving to favorite status
|
|
5920
6301
|
*/
|
|
5921
6302
|
async checkFavorite(targetType, targetId, options) {
|
|
5922
|
-
|
|
6303
|
+
log35("Checking favorite status: %s %d", targetType, targetId);
|
|
5923
6304
|
const queryString = this.buildQueryString({
|
|
5924
6305
|
targetId: String(targetId),
|
|
5925
6306
|
targetType
|
|
@@ -5928,7 +6309,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5928
6309
|
`/v1/user/favorites/check${queryString}`,
|
|
5929
6310
|
options
|
|
5930
6311
|
);
|
|
5931
|
-
|
|
6312
|
+
log35("Favorite status retrieved: %O", result);
|
|
5932
6313
|
return result;
|
|
5933
6314
|
}
|
|
5934
6315
|
/**
|
|
@@ -5942,7 +6323,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5942
6323
|
* @returns Promise resolving to list of favorites
|
|
5943
6324
|
*/
|
|
5944
6325
|
async getMyFavorites(params = {}, options) {
|
|
5945
|
-
|
|
6326
|
+
log35("Getting my favorites: %O", params);
|
|
5946
6327
|
const queryParams = {};
|
|
5947
6328
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5948
6329
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5952,7 +6333,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5952
6333
|
`/v1/user/favorites/me${queryString}`,
|
|
5953
6334
|
options
|
|
5954
6335
|
);
|
|
5955
|
-
|
|
6336
|
+
log35("My favorites retrieved");
|
|
5956
6337
|
return result;
|
|
5957
6338
|
}
|
|
5958
6339
|
/**
|
|
@@ -5967,7 +6348,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5967
6348
|
* @returns Promise resolving to list of favorites
|
|
5968
6349
|
*/
|
|
5969
6350
|
async getUserFavorites(userId, params = {}, options) {
|
|
5970
|
-
|
|
6351
|
+
log35("Getting favorites for user: %d", userId);
|
|
5971
6352
|
const queryParams = {};
|
|
5972
6353
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5973
6354
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5977,7 +6358,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5977
6358
|
`/v1/user/favorites/${userId}${queryString}`,
|
|
5978
6359
|
options
|
|
5979
6360
|
);
|
|
5980
|
-
|
|
6361
|
+
log35("Favorites retrieved for user: %d", userId);
|
|
5981
6362
|
return result;
|
|
5982
6363
|
}
|
|
5983
6364
|
/**
|
|
@@ -5992,7 +6373,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5992
6373
|
* @returns Promise resolving to list of favorite agents
|
|
5993
6374
|
*/
|
|
5994
6375
|
async getUserFavoriteAgents(userId, params = {}, options) {
|
|
5995
|
-
|
|
6376
|
+
log35("Getting favorite agents for user: %d", userId);
|
|
5996
6377
|
const queryParams = {};
|
|
5997
6378
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5998
6379
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -6001,7 +6382,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
6001
6382
|
`/v1/user/favorites/${userId}/agents${queryString}`,
|
|
6002
6383
|
options
|
|
6003
6384
|
);
|
|
6004
|
-
|
|
6385
|
+
log35("Favorite agents retrieved for user: %d", userId);
|
|
6005
6386
|
return result;
|
|
6006
6387
|
}
|
|
6007
6388
|
/**
|
|
@@ -6016,7 +6397,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
6016
6397
|
* @returns Promise resolving to list of favorite plugins
|
|
6017
6398
|
*/
|
|
6018
6399
|
async getUserFavoritePlugins(userId, params = {}, options) {
|
|
6019
|
-
|
|
6400
|
+
log35("Getting favorite plugins for user: %d", userId);
|
|
6020
6401
|
const queryParams = {};
|
|
6021
6402
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
6022
6403
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -6025,14 +6406,14 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
6025
6406
|
`/v1/user/favorites/${userId}/plugins${queryString}`,
|
|
6026
6407
|
options
|
|
6027
6408
|
);
|
|
6028
|
-
|
|
6409
|
+
log35("Favorite plugins retrieved for user: %d", userId);
|
|
6029
6410
|
return result;
|
|
6030
6411
|
}
|
|
6031
6412
|
};
|
|
6032
6413
|
|
|
6033
6414
|
// src/market/services/UserLikeService.ts
|
|
6034
|
-
import
|
|
6035
|
-
var
|
|
6415
|
+
import debug36 from "debug";
|
|
6416
|
+
var log36 = debug36("lobe-market-sdk:user-like");
|
|
6036
6417
|
var UserLikeService = class extends BaseSDK {
|
|
6037
6418
|
/**
|
|
6038
6419
|
* Like content
|
|
@@ -6047,7 +6428,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6047
6428
|
* @throws Error if already liked
|
|
6048
6429
|
*/
|
|
6049
6430
|
async like(targetType, targetId, options) {
|
|
6050
|
-
|
|
6431
|
+
log36("Liking: %s %d", targetType, targetId);
|
|
6051
6432
|
const body = { targetId, targetType };
|
|
6052
6433
|
const result = await this.request("/v1/user/likes", {
|
|
6053
6434
|
body: JSON.stringify(body),
|
|
@@ -6057,7 +6438,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6057
6438
|
method: "POST",
|
|
6058
6439
|
...options
|
|
6059
6440
|
});
|
|
6060
|
-
|
|
6441
|
+
log36("Successfully liked: %s %d", targetType, targetId);
|
|
6061
6442
|
return result;
|
|
6062
6443
|
}
|
|
6063
6444
|
/**
|
|
@@ -6073,7 +6454,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6073
6454
|
* @throws Error if like not found
|
|
6074
6455
|
*/
|
|
6075
6456
|
async unlike(targetType, targetId, options) {
|
|
6076
|
-
|
|
6457
|
+
log36("Unliking: %s %d", targetType, targetId);
|
|
6077
6458
|
const body = { targetId, targetType };
|
|
6078
6459
|
const result = await this.request("/v1/user/likes", {
|
|
6079
6460
|
body: JSON.stringify(body),
|
|
@@ -6083,7 +6464,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6083
6464
|
method: "DELETE",
|
|
6084
6465
|
...options
|
|
6085
6466
|
});
|
|
6086
|
-
|
|
6467
|
+
log36("Successfully unliked: %s %d", targetType, targetId);
|
|
6087
6468
|
return result;
|
|
6088
6469
|
}
|
|
6089
6470
|
/**
|
|
@@ -6098,7 +6479,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6098
6479
|
* @returns Promise resolving to toggle response with new like status
|
|
6099
6480
|
*/
|
|
6100
6481
|
async toggleLike(targetType, targetId, options) {
|
|
6101
|
-
|
|
6482
|
+
log36("Toggling like: %s %d", targetType, targetId);
|
|
6102
6483
|
const body = { targetId, targetType };
|
|
6103
6484
|
const result = await this.request("/v1/user/likes/toggle", {
|
|
6104
6485
|
body: JSON.stringify(body),
|
|
@@ -6108,7 +6489,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6108
6489
|
method: "POST",
|
|
6109
6490
|
...options
|
|
6110
6491
|
});
|
|
6111
|
-
|
|
6492
|
+
log36("Like toggled, new status: %O", result);
|
|
6112
6493
|
return result;
|
|
6113
6494
|
}
|
|
6114
6495
|
/**
|
|
@@ -6123,7 +6504,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6123
6504
|
* @returns Promise resolving to like status
|
|
6124
6505
|
*/
|
|
6125
6506
|
async checkLike(targetType, targetId, options) {
|
|
6126
|
-
|
|
6507
|
+
log36("Checking like status: %s %d", targetType, targetId);
|
|
6127
6508
|
const queryString = this.buildQueryString({
|
|
6128
6509
|
targetId: String(targetId),
|
|
6129
6510
|
targetType
|
|
@@ -6132,7 +6513,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6132
6513
|
`/v1/user/likes/check${queryString}`,
|
|
6133
6514
|
options
|
|
6134
6515
|
);
|
|
6135
|
-
|
|
6516
|
+
log36("Like status retrieved: %O", result);
|
|
6136
6517
|
return result;
|
|
6137
6518
|
}
|
|
6138
6519
|
/**
|
|
@@ -6146,7 +6527,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6146
6527
|
* @returns Promise resolving to list of likes
|
|
6147
6528
|
*/
|
|
6148
6529
|
async getMyLikes(params = {}, options) {
|
|
6149
|
-
|
|
6530
|
+
log36("Getting my likes: %O", params);
|
|
6150
6531
|
const queryParams = {};
|
|
6151
6532
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
6152
6533
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -6156,7 +6537,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6156
6537
|
`/v1/user/likes/me${queryString}`,
|
|
6157
6538
|
options
|
|
6158
6539
|
);
|
|
6159
|
-
|
|
6540
|
+
log36("My likes retrieved");
|
|
6160
6541
|
return result;
|
|
6161
6542
|
}
|
|
6162
6543
|
/**
|
|
@@ -6171,7 +6552,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6171
6552
|
* @returns Promise resolving to list of likes
|
|
6172
6553
|
*/
|
|
6173
6554
|
async getUserLikes(userId, params = {}, options) {
|
|
6174
|
-
|
|
6555
|
+
log36("Getting likes for user: %d", userId);
|
|
6175
6556
|
const queryParams = {};
|
|
6176
6557
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
6177
6558
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -6181,7 +6562,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6181
6562
|
`/v1/user/likes/${userId}${queryString}`,
|
|
6182
6563
|
options
|
|
6183
6564
|
);
|
|
6184
|
-
|
|
6565
|
+
log36("Likes retrieved for user: %d", userId);
|
|
6185
6566
|
return result;
|
|
6186
6567
|
}
|
|
6187
6568
|
/**
|
|
@@ -6196,7 +6577,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6196
6577
|
* @returns Promise resolving to list of liked agents
|
|
6197
6578
|
*/
|
|
6198
6579
|
async getUserLikedAgents(userId, params = {}, options) {
|
|
6199
|
-
|
|
6580
|
+
log36("Getting liked agents for user: %d", userId);
|
|
6200
6581
|
const queryParams = {};
|
|
6201
6582
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
6202
6583
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -6205,7 +6586,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6205
6586
|
`/v1/user/likes/${userId}/agents${queryString}`,
|
|
6206
6587
|
options
|
|
6207
6588
|
);
|
|
6208
|
-
|
|
6589
|
+
log36("Liked agents retrieved for user: %d", userId);
|
|
6209
6590
|
return result;
|
|
6210
6591
|
}
|
|
6211
6592
|
/**
|
|
@@ -6220,7 +6601,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6220
6601
|
* @returns Promise resolving to list of liked plugins
|
|
6221
6602
|
*/
|
|
6222
6603
|
async getUserLikedPlugins(userId, params = {}, options) {
|
|
6223
|
-
|
|
6604
|
+
log36("Getting liked plugins for user: %d", userId);
|
|
6224
6605
|
const queryParams = {};
|
|
6225
6606
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
6226
6607
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -6229,14 +6610,14 @@ var UserLikeService = class extends BaseSDK {
|
|
|
6229
6610
|
`/v1/user/likes/${userId}/plugins${queryString}`,
|
|
6230
6611
|
options
|
|
6231
6612
|
);
|
|
6232
|
-
|
|
6613
|
+
log36("Liked plugins retrieved for user: %d", userId);
|
|
6233
6614
|
return result;
|
|
6234
6615
|
}
|
|
6235
6616
|
};
|
|
6236
6617
|
|
|
6237
6618
|
// src/market/services/UserPublishService.ts
|
|
6238
|
-
import
|
|
6239
|
-
var
|
|
6619
|
+
import debug37 from "debug";
|
|
6620
|
+
var log37 = debug37("lobe-market-sdk:user-publish");
|
|
6240
6621
|
var UserPublishService = class extends BaseSDK {
|
|
6241
6622
|
/**
|
|
6242
6623
|
* Lists all plugins owned by the authenticated user
|
|
@@ -6246,9 +6627,9 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6246
6627
|
*/
|
|
6247
6628
|
async listPlugins(options) {
|
|
6248
6629
|
var _a;
|
|
6249
|
-
|
|
6630
|
+
log37("Listing user plugins");
|
|
6250
6631
|
const result = await this.request("/v1/user/plugins", options);
|
|
6251
|
-
|
|
6632
|
+
log37("Found %d user plugins", ((_a = result.data) == null ? void 0 : _a.length) || 0);
|
|
6252
6633
|
return result;
|
|
6253
6634
|
}
|
|
6254
6635
|
/**
|
|
@@ -6259,9 +6640,9 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6259
6640
|
*/
|
|
6260
6641
|
async listSkills(options) {
|
|
6261
6642
|
var _a;
|
|
6262
|
-
|
|
6643
|
+
log37("Listing user skills");
|
|
6263
6644
|
const result = await this.request("/v1/user/skills", options);
|
|
6264
|
-
|
|
6645
|
+
log37("Found %d user skills", ((_a = result.data) == null ? void 0 : _a.length) || 0);
|
|
6265
6646
|
return result;
|
|
6266
6647
|
}
|
|
6267
6648
|
/**
|
|
@@ -6273,7 +6654,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6273
6654
|
* @returns Promise resolving to the publish result
|
|
6274
6655
|
*/
|
|
6275
6656
|
async publishSkillVersion(identifier, zipBuffer, options) {
|
|
6276
|
-
|
|
6657
|
+
log37("Publishing skill version for: %s", identifier);
|
|
6277
6658
|
const formData = new FormData();
|
|
6278
6659
|
const arrayBuffer = zipBuffer instanceof ArrayBuffer ? zipBuffer : zipBuffer.buffer.slice(
|
|
6279
6660
|
zipBuffer.byteOffset,
|
|
@@ -6289,7 +6670,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6289
6670
|
...options
|
|
6290
6671
|
}
|
|
6291
6672
|
);
|
|
6292
|
-
|
|
6673
|
+
log37("Published skill version: %s@%s", identifier, result.version);
|
|
6293
6674
|
return result;
|
|
6294
6675
|
}
|
|
6295
6676
|
/**
|
|
@@ -6300,11 +6681,11 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6300
6681
|
*/
|
|
6301
6682
|
async scanClaimableAssets(assetType) {
|
|
6302
6683
|
var _a;
|
|
6303
|
-
|
|
6684
|
+
log37("Scanning claimable %s", assetType);
|
|
6304
6685
|
const result = await this.request(
|
|
6305
6686
|
`/v1/user/claims/scan/${assetType}`
|
|
6306
6687
|
);
|
|
6307
|
-
|
|
6688
|
+
log37("Found %d claimable %s", ((_a = result.data) == null ? void 0 : _a.length) || 0, assetType);
|
|
6308
6689
|
return result;
|
|
6309
6690
|
}
|
|
6310
6691
|
/**
|
|
@@ -6315,13 +6696,13 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6315
6696
|
* @returns Promise resolving to the claim result
|
|
6316
6697
|
*/
|
|
6317
6698
|
async claimAsset(assetId, assetType) {
|
|
6318
|
-
|
|
6699
|
+
log37("Claiming %s with id: %d", assetType, assetId);
|
|
6319
6700
|
const result = await this.request("/v1/user/claims", {
|
|
6320
6701
|
body: JSON.stringify({ assetId, assetType }),
|
|
6321
6702
|
headers: { "Content-Type": "application/json" },
|
|
6322
6703
|
method: "POST"
|
|
6323
6704
|
});
|
|
6324
|
-
|
|
6705
|
+
log37("Claim result for %s %d: %s", assetType, assetId, result.success);
|
|
6325
6706
|
return result;
|
|
6326
6707
|
}
|
|
6327
6708
|
/**
|
|
@@ -6335,13 +6716,13 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6335
6716
|
* @returns Promise resolving to the claim result
|
|
6336
6717
|
*/
|
|
6337
6718
|
async claimAssetByIdentifier(identifier, assetType) {
|
|
6338
|
-
|
|
6719
|
+
log37("Claiming %s with identifier: %s", assetType, identifier);
|
|
6339
6720
|
const result = await this.request("/v1/user/claims", {
|
|
6340
6721
|
body: JSON.stringify({ assetType, identifier }),
|
|
6341
6722
|
headers: { "Content-Type": "application/json" },
|
|
6342
6723
|
method: "POST"
|
|
6343
6724
|
});
|
|
6344
|
-
|
|
6725
|
+
log37("Claim result for %s %s: %s", assetType, identifier, result.success);
|
|
6345
6726
|
return result;
|
|
6346
6727
|
}
|
|
6347
6728
|
/**
|
|
@@ -6356,14 +6737,14 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6356
6737
|
* @returns Promise resolving to the submission result
|
|
6357
6738
|
*/
|
|
6358
6739
|
async submitRepo(params, options) {
|
|
6359
|
-
|
|
6740
|
+
log37("Submitting repository for import: %s (%s)", params.gitUrl, params.type);
|
|
6360
6741
|
const result = await this.request("/v1/user/claims/submit-repo", {
|
|
6361
6742
|
body: JSON.stringify(params),
|
|
6362
6743
|
headers: { "Content-Type": "application/json" },
|
|
6363
6744
|
method: "POST",
|
|
6364
6745
|
...options
|
|
6365
6746
|
});
|
|
6366
|
-
|
|
6747
|
+
log37("Submit result for %s: %s", params.gitUrl, result.success);
|
|
6367
6748
|
return result;
|
|
6368
6749
|
}
|
|
6369
6750
|
/**
|
|
@@ -6374,14 +6755,14 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6374
6755
|
* @returns Promise resolving immediately with the plugin identifier and version
|
|
6375
6756
|
*/
|
|
6376
6757
|
async publishPlugin(params, options) {
|
|
6377
|
-
|
|
6758
|
+
log37("Publishing plugin: %s@%s", params.identifier, params.version);
|
|
6378
6759
|
const result = await this.request("/v1/user/plugins", {
|
|
6379
6760
|
body: JSON.stringify(params),
|
|
6380
6761
|
headers: { "Content-Type": "application/json" },
|
|
6381
6762
|
method: "POST",
|
|
6382
6763
|
...options
|
|
6383
6764
|
});
|
|
6384
|
-
|
|
6765
|
+
log37("Published plugin: %s@%s (%s)", result.identifier, result.version, result.status);
|
|
6385
6766
|
return result;
|
|
6386
6767
|
}
|
|
6387
6768
|
/**
|
|
@@ -6392,12 +6773,12 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6392
6773
|
* @returns Promise resolving to the delete result
|
|
6393
6774
|
*/
|
|
6394
6775
|
async deleteSkill(identifier, options) {
|
|
6395
|
-
|
|
6776
|
+
log37("Deleting skill: %s", identifier);
|
|
6396
6777
|
const result = await this.request(
|
|
6397
6778
|
`/v1/user/skills/${encodeURIComponent(identifier)}`,
|
|
6398
6779
|
{ method: "DELETE", ...options }
|
|
6399
6780
|
);
|
|
6400
|
-
|
|
6781
|
+
log37("Deleted skill: %s", identifier);
|
|
6401
6782
|
return result;
|
|
6402
6783
|
}
|
|
6403
6784
|
/**
|
|
@@ -6409,7 +6790,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6409
6790
|
* @returns Promise resolving to the updated status
|
|
6410
6791
|
*/
|
|
6411
6792
|
async updateSkillStatus(identifier, status, options) {
|
|
6412
|
-
|
|
6793
|
+
log37("Updating skill status: %s \u2192 %s", identifier, status);
|
|
6413
6794
|
const result = await this.request(
|
|
6414
6795
|
`/v1/user/skills/${encodeURIComponent(identifier)}/status`,
|
|
6415
6796
|
{
|
|
@@ -6419,7 +6800,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6419
6800
|
...options
|
|
6420
6801
|
}
|
|
6421
6802
|
);
|
|
6422
|
-
|
|
6803
|
+
log37("Updated skill status: %s \u2192 %s", identifier, result.status);
|
|
6423
6804
|
return result;
|
|
6424
6805
|
}
|
|
6425
6806
|
/**
|
|
@@ -6430,12 +6811,12 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6430
6811
|
* @returns Promise resolving to the delete result
|
|
6431
6812
|
*/
|
|
6432
6813
|
async deletePlugin(identifier, options) {
|
|
6433
|
-
|
|
6814
|
+
log37("Deleting plugin: %s", identifier);
|
|
6434
6815
|
const result = await this.request(
|
|
6435
6816
|
`/v1/user/plugins/${encodeURIComponent(identifier)}`,
|
|
6436
6817
|
{ method: "DELETE", ...options }
|
|
6437
6818
|
);
|
|
6438
|
-
|
|
6819
|
+
log37("Deleted plugin: %s", identifier);
|
|
6439
6820
|
return result;
|
|
6440
6821
|
}
|
|
6441
6822
|
/**
|
|
@@ -6447,7 +6828,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6447
6828
|
* @returns Promise resolving to the updated status
|
|
6448
6829
|
*/
|
|
6449
6830
|
async updatePluginStatus(identifier, status, options) {
|
|
6450
|
-
|
|
6831
|
+
log37("Updating plugin status: %s \u2192 %s", identifier, status);
|
|
6451
6832
|
const result = await this.request(
|
|
6452
6833
|
`/v1/user/plugins/${encodeURIComponent(identifier)}/status`,
|
|
6453
6834
|
{
|
|
@@ -6457,7 +6838,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6457
6838
|
...options
|
|
6458
6839
|
}
|
|
6459
6840
|
);
|
|
6460
|
-
|
|
6841
|
+
log37("Updated plugin status: %s \u2192 %s", identifier, result.status);
|
|
6461
6842
|
return result;
|
|
6462
6843
|
}
|
|
6463
6844
|
/**
|
|
@@ -6469,7 +6850,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6469
6850
|
* @returns Promise resolving to the publish result
|
|
6470
6851
|
*/
|
|
6471
6852
|
async publishPluginVersion(identifier, data, options) {
|
|
6472
|
-
|
|
6853
|
+
log37("Publishing plugin version for: %s", identifier);
|
|
6473
6854
|
const result = await this.request(
|
|
6474
6855
|
`/v1/user/plugins/${encodeURIComponent(identifier)}/versions`,
|
|
6475
6856
|
{
|
|
@@ -6479,7 +6860,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6479
6860
|
...options
|
|
6480
6861
|
}
|
|
6481
6862
|
);
|
|
6482
|
-
|
|
6863
|
+
log37("Published plugin version: %s@%s", identifier, result.version);
|
|
6483
6864
|
return result;
|
|
6484
6865
|
}
|
|
6485
6866
|
/**
|
|
@@ -6492,13 +6873,13 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6492
6873
|
*/
|
|
6493
6874
|
async getPluginLocalizations(identifier, version, options) {
|
|
6494
6875
|
var _a;
|
|
6495
|
-
|
|
6876
|
+
log37("Listing localizations for plugin: %s", identifier);
|
|
6496
6877
|
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
6497
6878
|
const result = await this.request(
|
|
6498
6879
|
`/v1/user/plugins/${encodeURIComponent(identifier)}/localizations${query}`,
|
|
6499
6880
|
options
|
|
6500
6881
|
);
|
|
6501
|
-
|
|
6882
|
+
log37("Found %d localizations for %s", ((_a = result.localizations) == null ? void 0 : _a.length) || 0, identifier);
|
|
6502
6883
|
return result;
|
|
6503
6884
|
}
|
|
6504
6885
|
/**
|
|
@@ -6515,7 +6896,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6515
6896
|
* @returns Promise resolving to the upsert result
|
|
6516
6897
|
*/
|
|
6517
6898
|
async updatePluginLocalizations(identifier, localizations, version, options) {
|
|
6518
|
-
|
|
6899
|
+
log37("Upserting %d localization(s) for plugin: %s", localizations.length, identifier);
|
|
6519
6900
|
const result = await this.request(
|
|
6520
6901
|
`/v1/user/plugins/${encodeURIComponent(identifier)}/localizations`,
|
|
6521
6902
|
{
|
|
@@ -6525,7 +6906,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6525
6906
|
...options
|
|
6526
6907
|
}
|
|
6527
6908
|
);
|
|
6528
|
-
|
|
6909
|
+
log37("Upserted localizations for %s@%s", identifier, result.version);
|
|
6529
6910
|
return result;
|
|
6530
6911
|
}
|
|
6531
6912
|
/**
|
|
@@ -6539,20 +6920,40 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6539
6920
|
* @returns Promise resolving to the delete result
|
|
6540
6921
|
*/
|
|
6541
6922
|
async deletePluginLocalization(identifier, locale, version, options) {
|
|
6542
|
-
|
|
6923
|
+
log37("Deleting localization %s for plugin: %s", locale, identifier);
|
|
6543
6924
|
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
6544
6925
|
const result = await this.request(
|
|
6545
6926
|
`/v1/user/plugins/${encodeURIComponent(identifier)}/localizations/${encodeURIComponent(locale)}${query}`,
|
|
6546
6927
|
{ method: "DELETE", ...options }
|
|
6547
6928
|
);
|
|
6548
|
-
|
|
6929
|
+
log37("Deleted localization %s for %s", locale, identifier);
|
|
6549
6930
|
return result;
|
|
6550
6931
|
}
|
|
6551
6932
|
};
|
|
6552
6933
|
|
|
6934
|
+
// src/market/services/CategoryService.ts
|
|
6935
|
+
import debug38 from "debug";
|
|
6936
|
+
var log38 = debug38("lobe-market-sdk:market:categories");
|
|
6937
|
+
var CategoryService2 = class extends BaseSDK {
|
|
6938
|
+
/** Lists configured categories with nullable HTTP(S) image URLs or lucide:<name> icons and public asset counts, including empty categories. */
|
|
6939
|
+
async list(assetType, locale) {
|
|
6940
|
+
log38("Listing categories for %s", assetType);
|
|
6941
|
+
const query = this.buildQueryString({ assetType, locale });
|
|
6942
|
+
return this.request(`/v1/categories${query}`);
|
|
6943
|
+
}
|
|
6944
|
+
};
|
|
6945
|
+
|
|
6553
6946
|
// src/market/market-sdk.ts
|
|
6554
|
-
var
|
|
6947
|
+
var log39 = debug39("lobe-market-sdk");
|
|
6555
6948
|
var MarketSDK = class extends BaseSDK {
|
|
6949
|
+
/** Anonymous WebP byte URL. No signed token or public bucket is required. */
|
|
6950
|
+
getAssetImageUrl(id) {
|
|
6951
|
+
return new URL(getAssetImagePath(id), this.baseUrl).toString();
|
|
6952
|
+
}
|
|
6953
|
+
/** Anonymous SVG with a safely generated single initial; name must contain 1–255 characters. */
|
|
6954
|
+
getAssetInitialUrl(name) {
|
|
6955
|
+
return new URL(getAssetInitialPath(name), this.baseUrl).toString();
|
|
6956
|
+
}
|
|
6556
6957
|
/**
|
|
6557
6958
|
* Creates a new MarketSDK instance
|
|
6558
6959
|
*
|
|
@@ -6564,8 +6965,9 @@ var MarketSDK = class extends BaseSDK {
|
|
|
6564
6965
|
tokenExpiry: void 0
|
|
6565
6966
|
};
|
|
6566
6967
|
super(options, void 0, sharedTokenState);
|
|
6567
|
-
|
|
6968
|
+
log39("MarketSDK instance created");
|
|
6568
6969
|
this.agentProfile = new AgentProfileService(options, this.headers, sharedTokenState);
|
|
6970
|
+
this.categories = new CategoryService2(options, this.headers, sharedTokenState);
|
|
6569
6971
|
this.agents = new AgentService2(options, this.headers, sharedTokenState);
|
|
6570
6972
|
this.agentGroups = new AgentGroupService(options, this.headers, sharedTokenState);
|
|
6571
6973
|
this.auth = new AuthService(options, this.headers, sharedTokenState);
|
|
@@ -6573,6 +6975,8 @@ var MarketSDK = class extends BaseSDK {
|
|
|
6573
6975
|
this.creds = new CredService(options, this.headers, sharedTokenState);
|
|
6574
6976
|
this.deployments = new DeploymentService(options, this.headers, sharedTokenState);
|
|
6575
6977
|
this.plugins = new PluginsService(options, this.headers, sharedTokenState);
|
|
6978
|
+
this.sandbox = new SandboxService(options, this.headers, sharedTokenState);
|
|
6979
|
+
this.sandboxStorage = new SandboxStorageService2(options, this.headers, sharedTokenState);
|
|
6576
6980
|
this.organizations = new OrganizationService2(options, this.headers, sharedTokenState);
|
|
6577
6981
|
this.user = new UserService(options, this.headers, sharedTokenState);
|
|
6578
6982
|
this.userPublish = new UserPublishService(options, this.headers, sharedTokenState);
|
|
@@ -6614,7 +7018,7 @@ var MarketSDK = class extends BaseSDK {
|
|
|
6614
7018
|
* @deprecated Use auth.registerClient() instead
|
|
6615
7019
|
*/
|
|
6616
7020
|
async registerClient(request) {
|
|
6617
|
-
|
|
7021
|
+
log39("Registering client (deprecated method, use auth.registerClient): %s", request.clientName);
|
|
6618
7022
|
return this.auth.registerClient(request);
|
|
6619
7023
|
}
|
|
6620
7024
|
};
|