@lobehub/market-sdk 0.28.0 → 0.28.2-beta.1
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 +580 -3
- package/dist/index.mjs +443 -147
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -5,6 +5,51 @@ import debug9 from "debug";
|
|
|
5
5
|
import debug from "debug";
|
|
6
6
|
import { SignJWT } from "jose";
|
|
7
7
|
import urlJoin from "url-join";
|
|
8
|
+
|
|
9
|
+
// src/core/MarketAPIError.ts
|
|
10
|
+
var MarketAPIError = class _MarketAPIError extends Error {
|
|
11
|
+
constructor(status, statusText, errorBody) {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const errorCode = (_a = errorBody == null ? void 0 : errorBody.error) == null ? void 0 : _a.code;
|
|
14
|
+
const errorMessage = (_b = errorBody == null ? void 0 : errorBody.error) == null ? void 0 : _b.message;
|
|
15
|
+
const message = errorMessage || statusText;
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = "MarketAPIError";
|
|
18
|
+
this.status = status;
|
|
19
|
+
this.code = errorCode;
|
|
20
|
+
this.errorBody = errorBody;
|
|
21
|
+
if (Error.captureStackTrace) {
|
|
22
|
+
Error.captureStackTrace(this, _MarketAPIError);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check if this is a specific error code
|
|
27
|
+
*/
|
|
28
|
+
isErrorCode(code) {
|
|
29
|
+
return this.code === code;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get the full error details from the API response
|
|
33
|
+
*/
|
|
34
|
+
getErrorDetails() {
|
|
35
|
+
var _a;
|
|
36
|
+
return (_a = this.errorBody) == null ? void 0 : _a.error;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Convert to a plain object for logging or serialization
|
|
40
|
+
*/
|
|
41
|
+
toJSON() {
|
|
42
|
+
return {
|
|
43
|
+
code: this.code,
|
|
44
|
+
errorBody: this.errorBody,
|
|
45
|
+
message: this.message,
|
|
46
|
+
name: this.name,
|
|
47
|
+
status: this.status
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/core/BaseSDK.ts
|
|
8
53
|
var log = debug("lobe-market-sdk:core");
|
|
9
54
|
var BaseSDK = class {
|
|
10
55
|
/**
|
|
@@ -78,14 +123,14 @@ var BaseSDK = class {
|
|
|
78
123
|
headers: mergedHeaders
|
|
79
124
|
});
|
|
80
125
|
if (!response.ok) {
|
|
81
|
-
|
|
126
|
+
let errorBody;
|
|
82
127
|
try {
|
|
83
|
-
|
|
128
|
+
errorBody = await response.json();
|
|
84
129
|
console.error("Request error: %s", JSON.stringify(errorBody));
|
|
85
|
-
throw new Error(`${errorMsg} - ${JSON.stringify(errorBody)}`);
|
|
86
130
|
} catch (e) {
|
|
87
|
-
|
|
131
|
+
errorBody = void 0;
|
|
88
132
|
}
|
|
133
|
+
throw new MarketAPIError(response.status, response.statusText, errorBody);
|
|
89
134
|
}
|
|
90
135
|
log("Request successful: %s", url);
|
|
91
136
|
if (response.status === 204) {
|
|
@@ -1561,7 +1606,7 @@ var MarketAdmin = class extends BaseSDK {
|
|
|
1561
1606
|
};
|
|
1562
1607
|
|
|
1563
1608
|
// src/market/market-sdk.ts
|
|
1564
|
-
import
|
|
1609
|
+
import debug22 from "debug";
|
|
1565
1610
|
|
|
1566
1611
|
// src/market/services/AgentService.ts
|
|
1567
1612
|
import debug10 from "debug";
|
|
@@ -1917,10 +1962,256 @@ var AgentService2 = class extends BaseSDK {
|
|
|
1917
1962
|
}
|
|
1918
1963
|
};
|
|
1919
1964
|
|
|
1920
|
-
// src/market/services/
|
|
1965
|
+
// src/market/services/AgentGroupService.ts
|
|
1921
1966
|
import debug11 from "debug";
|
|
1967
|
+
var log11 = debug11("lobe-market-sdk:agent-groups");
|
|
1968
|
+
var AgentGroupService = class extends BaseSDK {
|
|
1969
|
+
/**
|
|
1970
|
+
* Retrieves a list of agent groups from the marketplace
|
|
1971
|
+
*
|
|
1972
|
+
* Supports filtering, pagination, and localization of results.
|
|
1973
|
+
*
|
|
1974
|
+
* @param params - Query parameters for filtering and pagination
|
|
1975
|
+
* @param options - Optional request options
|
|
1976
|
+
* @returns Promise resolving to the agent group list response containing items and pagination info
|
|
1977
|
+
*/
|
|
1978
|
+
async getAgentGroupList(params = {}, options) {
|
|
1979
|
+
const locale = params.locale || this.defaultLocale;
|
|
1980
|
+
const queryParams = { ...params, locale };
|
|
1981
|
+
const queryString = this.buildQueryString(queryParams);
|
|
1982
|
+
log11("Getting agent group list: %O", queryParams);
|
|
1983
|
+
const result = await this.request(
|
|
1984
|
+
`/v1/agent-groups${queryString}`,
|
|
1985
|
+
options
|
|
1986
|
+
);
|
|
1987
|
+
log11("Retrieved %d agent groups", result.items.length);
|
|
1988
|
+
return result;
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* Retrieves a list of agent groups owned by the authenticated user
|
|
1992
|
+
*
|
|
1993
|
+
* Returns all agent groups regardless of their publish status (published, unpublished,
|
|
1994
|
+
* archived, deprecated). Requires authentication.
|
|
1995
|
+
*
|
|
1996
|
+
* @param params - Query parameters for filtering and pagination
|
|
1997
|
+
* @param options - Optional request options (must include authentication)
|
|
1998
|
+
* @returns Promise resolving to the agent group list response containing items with status field
|
|
1999
|
+
*/
|
|
2000
|
+
async getOwnAgentGroups(params = {}, options) {
|
|
2001
|
+
const locale = params.locale || this.defaultLocale;
|
|
2002
|
+
const queryParams = { ...params, locale };
|
|
2003
|
+
const queryString = this.buildQueryString(queryParams);
|
|
2004
|
+
log11("Getting own agent group list: %O", queryParams);
|
|
2005
|
+
const result = await this.request(
|
|
2006
|
+
`/v1/agent-groups/own${queryString}`,
|
|
2007
|
+
options
|
|
2008
|
+
);
|
|
2009
|
+
log11("Retrieved %d own agent groups", result.items.length);
|
|
2010
|
+
return result;
|
|
2011
|
+
}
|
|
2012
|
+
/**
|
|
2013
|
+
* Retrieves detailed information about a specific agent group
|
|
2014
|
+
*
|
|
2015
|
+
* Returns complete agent group information including group metadata,
|
|
2016
|
+
* all member agents, and localized content.
|
|
2017
|
+
*
|
|
2018
|
+
* @param identifier - Unique identifier of the agent group
|
|
2019
|
+
* @param params - Query parameters for locale and version
|
|
2020
|
+
* @param options - Optional request options
|
|
2021
|
+
* @returns Promise resolving to the agent group detail information
|
|
2022
|
+
*/
|
|
2023
|
+
async getAgentGroupDetail(identifier, params = {}, options) {
|
|
2024
|
+
const locale = params.locale || this.defaultLocale;
|
|
2025
|
+
const queryParams = { identifier, locale };
|
|
2026
|
+
if (params.version !== void 0) {
|
|
2027
|
+
queryParams.version = params.version.toString();
|
|
2028
|
+
}
|
|
2029
|
+
const queryString = this.buildQueryString(queryParams);
|
|
2030
|
+
log11("Getting agent group detail: %O", { identifier, ...params });
|
|
2031
|
+
const result = await this.request(
|
|
2032
|
+
`/v1/agent-groups/detail${queryString}`,
|
|
2033
|
+
options
|
|
2034
|
+
);
|
|
2035
|
+
log11("Agent group detail successfully retrieved: %s", identifier);
|
|
2036
|
+
return result;
|
|
2037
|
+
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Creates a new agent group in the marketplace
|
|
2040
|
+
*
|
|
2041
|
+
* Creates a new agent group with initial version (v1) and all member agents.
|
|
2042
|
+
* Requires authentication and ownership.
|
|
2043
|
+
*
|
|
2044
|
+
* @param groupData - The agent group data to create
|
|
2045
|
+
* @param options - Optional request options
|
|
2046
|
+
* @returns Promise resolving to the created agent group response
|
|
2047
|
+
*/
|
|
2048
|
+
async createAgentGroup(groupData, options) {
|
|
2049
|
+
log11("Creating agent group: %s", groupData.identifier);
|
|
2050
|
+
const result = await this.request("/v1/agent-groups/create", {
|
|
2051
|
+
body: JSON.stringify(groupData),
|
|
2052
|
+
headers: {
|
|
2053
|
+
"Content-Type": "application/json"
|
|
2054
|
+
},
|
|
2055
|
+
method: "POST",
|
|
2056
|
+
...options
|
|
2057
|
+
});
|
|
2058
|
+
log11("Agent group created successfully: %O", result);
|
|
2059
|
+
return result;
|
|
2060
|
+
}
|
|
2061
|
+
/**
|
|
2062
|
+
* Creates a new version for an existing agent group
|
|
2063
|
+
*
|
|
2064
|
+
* Creates a new version with unified version number for the group and all member agents.
|
|
2065
|
+
* Fields not provided will be inherited from the latest version.
|
|
2066
|
+
*
|
|
2067
|
+
* @param versionData - The version data to create
|
|
2068
|
+
* @param options - Optional request options
|
|
2069
|
+
* @returns Promise resolving to the created version response
|
|
2070
|
+
*/
|
|
2071
|
+
async createAgentGroupVersion(versionData, options) {
|
|
2072
|
+
log11("Creating agent group version: %s", versionData.identifier);
|
|
2073
|
+
const result = await this.request(
|
|
2074
|
+
"/v1/agent-groups/version-create",
|
|
2075
|
+
{
|
|
2076
|
+
body: JSON.stringify(versionData),
|
|
2077
|
+
headers: {
|
|
2078
|
+
"Content-Type": "application/json"
|
|
2079
|
+
},
|
|
2080
|
+
method: "POST",
|
|
2081
|
+
...options
|
|
2082
|
+
}
|
|
2083
|
+
);
|
|
2084
|
+
log11("Agent group version created successfully: %O", result);
|
|
2085
|
+
return result;
|
|
2086
|
+
}
|
|
2087
|
+
/**
|
|
2088
|
+
* Modifies an existing agent group
|
|
2089
|
+
*
|
|
2090
|
+
* Updates the agent group's base information. Can be used to change status,
|
|
2091
|
+
* metadata, or other group properties. Only the owner can modify the group.
|
|
2092
|
+
*
|
|
2093
|
+
* @param groupData - The agent group data to modify
|
|
2094
|
+
* @param options - Optional request options
|
|
2095
|
+
* @returns Promise resolving to the modified agent group response
|
|
2096
|
+
*/
|
|
2097
|
+
async modifyAgentGroup(groupData, options) {
|
|
2098
|
+
log11("Modifying agent group: %s", groupData.identifier);
|
|
2099
|
+
const result = await this.request("/v1/agent-groups/modify", {
|
|
2100
|
+
body: JSON.stringify(groupData),
|
|
2101
|
+
headers: {
|
|
2102
|
+
"Content-Type": "application/json"
|
|
2103
|
+
},
|
|
2104
|
+
method: "POST",
|
|
2105
|
+
...options
|
|
2106
|
+
});
|
|
2107
|
+
log11("Agent group modified successfully: %O", result);
|
|
2108
|
+
return result;
|
|
2109
|
+
}
|
|
2110
|
+
/**
|
|
2111
|
+
* Checks if an agent group exists in the marketplace
|
|
2112
|
+
*
|
|
2113
|
+
* @param identifier - Unique identifier of the agent group
|
|
2114
|
+
* @param options - Optional request options
|
|
2115
|
+
* @returns Promise resolving to true if agent group exists, false otherwise
|
|
2116
|
+
*/
|
|
2117
|
+
async checkAgentGroupExists(identifier, options) {
|
|
2118
|
+
log11("Checking if agent group exists: %s", identifier);
|
|
2119
|
+
try {
|
|
2120
|
+
await this.getAgentGroupDetail(identifier, {}, options);
|
|
2121
|
+
log11("Agent group exists: %s", identifier);
|
|
2122
|
+
return true;
|
|
2123
|
+
} catch (e) {
|
|
2124
|
+
log11("Agent group does not exist: %s", identifier);
|
|
2125
|
+
return false;
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
/**
|
|
2129
|
+
* Changes the status of an agent group
|
|
2130
|
+
*
|
|
2131
|
+
* Internal helper method used by publish/unpublish/archive/deprecate methods.
|
|
2132
|
+
* Requires authentication.
|
|
2133
|
+
*
|
|
2134
|
+
* @param identifier - Unique identifier of the agent group
|
|
2135
|
+
* @param status - New status to set
|
|
2136
|
+
* @param options - Optional request options
|
|
2137
|
+
* @returns Promise resolving to the status change response
|
|
2138
|
+
*/
|
|
2139
|
+
async changeStatus(identifier, status, options) {
|
|
2140
|
+
log11("Changing agent group status: %s -> %s", identifier, status);
|
|
2141
|
+
const result = await this.modifyAgentGroup({ identifier, status }, options);
|
|
2142
|
+
log11("Agent group status changed: %s -> %s", identifier, result.status);
|
|
2143
|
+
return {
|
|
2144
|
+
identifier: result.identifier,
|
|
2145
|
+
status: result.status,
|
|
2146
|
+
success: true
|
|
2147
|
+
};
|
|
2148
|
+
}
|
|
2149
|
+
/**
|
|
2150
|
+
* Publishes an agent group to the marketplace
|
|
2151
|
+
*
|
|
2152
|
+
* Makes the agent group publicly visible and available for use.
|
|
2153
|
+
* Requires authentication and ownership of the agent group.
|
|
2154
|
+
* Only groups with "Safe" safety check status can be published.
|
|
2155
|
+
*
|
|
2156
|
+
* @param identifier - Unique identifier of the agent group
|
|
2157
|
+
* @param options - Optional request options
|
|
2158
|
+
* @returns Promise resolving to the status change response
|
|
2159
|
+
*/
|
|
2160
|
+
async publish(identifier, options) {
|
|
2161
|
+
log11("Publishing agent group: %s", identifier);
|
|
2162
|
+
return this.changeStatus(identifier, "published", options);
|
|
2163
|
+
}
|
|
2164
|
+
/**
|
|
2165
|
+
* Unpublishes an agent group from the marketplace
|
|
2166
|
+
*
|
|
2167
|
+
* Hides the agent group from public view. The agent group data is preserved
|
|
2168
|
+
* and can be republished later.
|
|
2169
|
+
* Requires authentication and ownership of the agent group.
|
|
2170
|
+
*
|
|
2171
|
+
* @param identifier - Unique identifier of the agent group
|
|
2172
|
+
* @param options - Optional request options
|
|
2173
|
+
* @returns Promise resolving to the status change response
|
|
2174
|
+
*/
|
|
2175
|
+
async unpublish(identifier, options) {
|
|
2176
|
+
log11("Unpublishing agent group: %s", identifier);
|
|
2177
|
+
return this.changeStatus(identifier, "unpublished", options);
|
|
2178
|
+
}
|
|
2179
|
+
/**
|
|
2180
|
+
* Archives an agent group
|
|
2181
|
+
*
|
|
2182
|
+
* Marks the agent group as archived. Archived agent groups are typically
|
|
2183
|
+
* no longer actively maintained but may still be accessible.
|
|
2184
|
+
* Requires authentication and ownership of the agent group.
|
|
2185
|
+
*
|
|
2186
|
+
* @param identifier - Unique identifier of the agent group
|
|
2187
|
+
* @param options - Optional request options
|
|
2188
|
+
* @returns Promise resolving to the status change response
|
|
2189
|
+
*/
|
|
2190
|
+
async archive(identifier, options) {
|
|
2191
|
+
log11("Archiving agent group: %s", identifier);
|
|
2192
|
+
return this.changeStatus(identifier, "archived", options);
|
|
2193
|
+
}
|
|
2194
|
+
/**
|
|
2195
|
+
* Deprecates an agent group
|
|
2196
|
+
*
|
|
2197
|
+
* Marks the agent group as deprecated. Deprecated agent groups are still
|
|
2198
|
+
* accessible but users are encouraged to migrate to alternatives.
|
|
2199
|
+
* Requires authentication and ownership of the agent group.
|
|
2200
|
+
*
|
|
2201
|
+
* @param identifier - Unique identifier of the agent group
|
|
2202
|
+
* @param options - Optional request options
|
|
2203
|
+
* @returns Promise resolving to the status change response
|
|
2204
|
+
*/
|
|
2205
|
+
async deprecate(identifier, options) {
|
|
2206
|
+
log11("Deprecating agent group: %s", identifier);
|
|
2207
|
+
return this.changeStatus(identifier, "deprecated", options);
|
|
2208
|
+
}
|
|
2209
|
+
};
|
|
2210
|
+
|
|
2211
|
+
// src/market/services/AuthService.ts
|
|
2212
|
+
import debug12 from "debug";
|
|
1922
2213
|
import urlJoin2 from "url-join";
|
|
1923
|
-
var
|
|
2214
|
+
var log12 = debug12("lobe-market-sdk:auth");
|
|
1924
2215
|
var _AuthService = class _AuthService extends BaseSDK {
|
|
1925
2216
|
/** Normalize token response from snake_case to camelCase fields */
|
|
1926
2217
|
static normalizeTokenResponse(data) {
|
|
@@ -1952,7 +2243,7 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
1952
2243
|
if (grantType !== "authorization_code" && grantType !== "refresh_token") {
|
|
1953
2244
|
throw new Error(`Unsupported grant type: ${grantType}`);
|
|
1954
2245
|
}
|
|
1955
|
-
|
|
2246
|
+
log12("Exchanging OAuth token using grant_type=%s", grantType);
|
|
1956
2247
|
const tokenUrl = urlJoin2(this.baseUrl, "lobehub-oidc/token");
|
|
1957
2248
|
const params = new URLSearchParams();
|
|
1958
2249
|
params.set("grant_type", grantType);
|
|
@@ -1994,16 +2285,16 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
1994
2285
|
try {
|
|
1995
2286
|
payload = await response.json();
|
|
1996
2287
|
} catch (error) {
|
|
1997
|
-
|
|
2288
|
+
log12("Failed to parse token response: %O", error);
|
|
1998
2289
|
throw new Error(`Failed to parse token response: ${response.status} ${response.statusText}`);
|
|
1999
2290
|
}
|
|
2000
2291
|
if (!response.ok) {
|
|
2001
2292
|
const errorDescription = (payload == null ? void 0 : payload.error_description) || (payload == null ? void 0 : payload.error) || response.statusText;
|
|
2002
2293
|
const errorMsg = `Token exchange failed: ${response.status} ${errorDescription}`;
|
|
2003
|
-
|
|
2294
|
+
log12("Error: %s", errorMsg);
|
|
2004
2295
|
throw new Error(errorMsg);
|
|
2005
2296
|
}
|
|
2006
|
-
|
|
2297
|
+
log12("Token exchange successful");
|
|
2007
2298
|
return _AuthService.normalizeTokenResponse(payload);
|
|
2008
2299
|
}
|
|
2009
2300
|
/**
|
|
@@ -2016,7 +2307,7 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2016
2307
|
* @returns Promise resolving to the user information
|
|
2017
2308
|
*/
|
|
2018
2309
|
async getUserInfo(accessToken, options) {
|
|
2019
|
-
|
|
2310
|
+
log12("Getting user info");
|
|
2020
2311
|
const userInfoUrl = urlJoin2(this.baseUrl, "lobehub-oidc/userinfo");
|
|
2021
2312
|
const response = await fetch(userInfoUrl, {
|
|
2022
2313
|
headers: {
|
|
@@ -2028,11 +2319,11 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2028
2319
|
});
|
|
2029
2320
|
if (!response.ok) {
|
|
2030
2321
|
const errorMsg = `Failed to fetch user info: ${response.status} ${response.statusText}`;
|
|
2031
|
-
|
|
2322
|
+
log12("Error: %s", errorMsg);
|
|
2032
2323
|
throw new Error(errorMsg);
|
|
2033
2324
|
}
|
|
2034
2325
|
const userInfo = await response.json();
|
|
2035
|
-
|
|
2326
|
+
log12("User info retrieved successfully");
|
|
2036
2327
|
return userInfo;
|
|
2037
2328
|
}
|
|
2038
2329
|
/**
|
|
@@ -2046,7 +2337,7 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2046
2337
|
* @returns Promise resolving to the client credentials
|
|
2047
2338
|
*/
|
|
2048
2339
|
async registerClient(clientData, options) {
|
|
2049
|
-
|
|
2340
|
+
log12("Registering client: %s (%s)", clientData.clientName, clientData.clientType);
|
|
2050
2341
|
const result = await this.request("/v1/clients/register", {
|
|
2051
2342
|
body: JSON.stringify(clientData),
|
|
2052
2343
|
headers: {
|
|
@@ -2055,7 +2346,7 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2055
2346
|
method: "POST",
|
|
2056
2347
|
...options
|
|
2057
2348
|
});
|
|
2058
|
-
|
|
2349
|
+
log12("Client registered successfully: %s", result.client_id);
|
|
2059
2350
|
return result;
|
|
2060
2351
|
}
|
|
2061
2352
|
/**
|
|
@@ -2067,9 +2358,9 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2067
2358
|
* @returns Promise resolving to the access token and expiration time
|
|
2068
2359
|
*/
|
|
2069
2360
|
async getM2MToken() {
|
|
2070
|
-
|
|
2361
|
+
log12("Fetching M2M token");
|
|
2071
2362
|
const tokenInfo = await this.fetchM2MToken();
|
|
2072
|
-
|
|
2363
|
+
log12("M2M token fetched successfully");
|
|
2073
2364
|
return tokenInfo;
|
|
2074
2365
|
}
|
|
2075
2366
|
/** OAuth handoff response shapes */
|
|
@@ -2095,7 +2386,7 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2095
2386
|
async getOAuthHandoff(id, options) {
|
|
2096
2387
|
var _a, _b;
|
|
2097
2388
|
if (!id) throw new Error("id is required");
|
|
2098
|
-
|
|
2389
|
+
log12("Getting OAuth handoff: %s", id);
|
|
2099
2390
|
const handoffUrl = `${urlJoin2(this.baseUrl, "lobehub-oidc/handoff")}?id=${encodeURIComponent(id)}`;
|
|
2100
2391
|
const response = await fetch(handoffUrl, {
|
|
2101
2392
|
headers: {
|
|
@@ -2111,19 +2402,19 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2111
2402
|
code: json.code,
|
|
2112
2403
|
redirectUri: json.redirectUri
|
|
2113
2404
|
});
|
|
2114
|
-
|
|
2405
|
+
log12("OAuth handoff success for id: %s", id);
|
|
2115
2406
|
return result;
|
|
2116
2407
|
}
|
|
2117
2408
|
if (response.status === 202) {
|
|
2118
|
-
|
|
2409
|
+
log12("OAuth handoff pending for id: %s", id);
|
|
2119
2410
|
return { status: _AuthService.HANDOFF_PENDING_STATUS };
|
|
2120
2411
|
}
|
|
2121
2412
|
if (response.status === 404) {
|
|
2122
|
-
|
|
2413
|
+
log12("OAuth handoff consumed for id: %s", id);
|
|
2123
2414
|
return { status: _AuthService.HANDOFF_CONSUMED_STATUS };
|
|
2124
2415
|
}
|
|
2125
2416
|
if (response.status === 410) {
|
|
2126
|
-
|
|
2417
|
+
log12("OAuth handoff expired for id: %s", id);
|
|
2127
2418
|
return { status: _AuthService.HANDOFF_EXPIRED_STATUS };
|
|
2128
2419
|
}
|
|
2129
2420
|
let errorMessage = `Failed to fetch OAuth handoff (status ${response.status} ${response.statusText})`;
|
|
@@ -2134,7 +2425,7 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2134
2425
|
}
|
|
2135
2426
|
} catch (e) {
|
|
2136
2427
|
}
|
|
2137
|
-
|
|
2428
|
+
log12("Error: %s", errorMessage);
|
|
2138
2429
|
throw new Error(errorMessage);
|
|
2139
2430
|
}
|
|
2140
2431
|
/**
|
|
@@ -2148,21 +2439,21 @@ var _AuthService = class _AuthService extends BaseSDK {
|
|
|
2148
2439
|
const timeoutMs = (_b = params.timeoutMs) != null ? _b : 6e4;
|
|
2149
2440
|
const startedAt = Date.now();
|
|
2150
2441
|
const { signal, requestInit } = params;
|
|
2151
|
-
|
|
2442
|
+
log12("Start polling OAuth handoff: %s", id);
|
|
2152
2443
|
while (true) {
|
|
2153
2444
|
if (signal == null ? void 0 : signal.aborted) {
|
|
2154
2445
|
const err = new Error("Polling aborted");
|
|
2155
|
-
|
|
2446
|
+
log12("Error: %s", err.message);
|
|
2156
2447
|
throw err;
|
|
2157
2448
|
}
|
|
2158
2449
|
if (Date.now() - startedAt > timeoutMs) {
|
|
2159
2450
|
const err = new Error("Polling timeout");
|
|
2160
|
-
|
|
2451
|
+
log12("Error: %s", err.message);
|
|
2161
2452
|
throw err;
|
|
2162
2453
|
}
|
|
2163
2454
|
const result = await this.getOAuthHandoff(id, requestInit);
|
|
2164
2455
|
if (result.status === "success" || result.status === "expired" || result.status === "consumed") {
|
|
2165
|
-
|
|
2456
|
+
log12("Stop polling OAuth handoff (terminal): %s -> %s", id, result.status);
|
|
2166
2457
|
return result;
|
|
2167
2458
|
}
|
|
2168
2459
|
await new Promise((resolve) => {
|
|
@@ -2183,9 +2474,9 @@ _AuthService.HANDOFF_EXPIRED_STATUS = "expired";
|
|
|
2183
2474
|
var AuthService = _AuthService;
|
|
2184
2475
|
|
|
2185
2476
|
// src/market/services/ConnectService.ts
|
|
2186
|
-
import
|
|
2477
|
+
import debug13 from "debug";
|
|
2187
2478
|
import urlJoin3 from "url-join";
|
|
2188
|
-
var
|
|
2479
|
+
var log13 = debug13("lobe-market-sdk:connect");
|
|
2189
2480
|
var ConnectService = class extends BaseSDK {
|
|
2190
2481
|
/**
|
|
2191
2482
|
* Lists all available OAuth providers
|
|
@@ -2198,9 +2489,9 @@ var ConnectService = class extends BaseSDK {
|
|
|
2198
2489
|
*/
|
|
2199
2490
|
async listProviders(options) {
|
|
2200
2491
|
var _a;
|
|
2201
|
-
|
|
2492
|
+
log13("Listing connect providers");
|
|
2202
2493
|
const result = await this.request("/connect/providers", options);
|
|
2203
|
-
|
|
2494
|
+
log13("Found %d connect providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
|
|
2204
2495
|
return result;
|
|
2205
2496
|
}
|
|
2206
2497
|
/**
|
|
@@ -2214,12 +2505,12 @@ var ConnectService = class extends BaseSDK {
|
|
|
2214
2505
|
*/
|
|
2215
2506
|
async getProvider(provider, options) {
|
|
2216
2507
|
var _a;
|
|
2217
|
-
|
|
2508
|
+
log13("Getting provider details: %s", provider);
|
|
2218
2509
|
const result = await this.request(
|
|
2219
2510
|
`/connect/providers/${encodeURIComponent(provider)}`,
|
|
2220
2511
|
options
|
|
2221
2512
|
);
|
|
2222
|
-
|
|
2513
|
+
log13("Retrieved provider: %s", (_a = result.provider) == null ? void 0 : _a.name);
|
|
2223
2514
|
return result;
|
|
2224
2515
|
}
|
|
2225
2516
|
/**
|
|
@@ -2259,7 +2550,7 @@ var ConnectService = class extends BaseSDK {
|
|
|
2259
2550
|
* ```
|
|
2260
2551
|
*/
|
|
2261
2552
|
async authorize(provider, params, options) {
|
|
2262
|
-
|
|
2553
|
+
log13("Requesting authorization code for provider: %s", provider);
|
|
2263
2554
|
const result = await this.request(
|
|
2264
2555
|
`/connect/${encodeURIComponent(provider)}/authorize`,
|
|
2265
2556
|
{
|
|
@@ -2271,7 +2562,7 @@ var ConnectService = class extends BaseSDK {
|
|
|
2271
2562
|
...options
|
|
2272
2563
|
}
|
|
2273
2564
|
);
|
|
2274
|
-
|
|
2565
|
+
log13("Authorization code obtained, expires in %d seconds", result.expires_in);
|
|
2275
2566
|
return result;
|
|
2276
2567
|
}
|
|
2277
2568
|
/**
|
|
@@ -2297,7 +2588,10 @@ var ConnectService = class extends BaseSDK {
|
|
|
2297
2588
|
* ```
|
|
2298
2589
|
*/
|
|
2299
2590
|
getAuthorizeUrl(provider, params) {
|
|
2300
|
-
|
|
2591
|
+
log13(
|
|
2592
|
+
"Generating authorize URL for provider: %s (deprecated, use authorize() instead)",
|
|
2593
|
+
provider
|
|
2594
|
+
);
|
|
2301
2595
|
const queryParams = new URLSearchParams();
|
|
2302
2596
|
if ((params == null ? void 0 : params.scopes) && params.scopes.length > 0) {
|
|
2303
2597
|
queryParams.set("scope", params.scopes.join(","));
|
|
@@ -2308,7 +2602,7 @@ var ConnectService = class extends BaseSDK {
|
|
|
2308
2602
|
const queryString = queryParams.toString();
|
|
2309
2603
|
const path = `/connect/${encodeURIComponent(provider)}/start${queryString ? `?${queryString}` : ""}`;
|
|
2310
2604
|
const url = urlJoin3(this.baseUrl, "api", path);
|
|
2311
|
-
|
|
2605
|
+
log13("Generated authorize URL: %s", url);
|
|
2312
2606
|
return url;
|
|
2313
2607
|
}
|
|
2314
2608
|
/**
|
|
@@ -2322,12 +2616,12 @@ var ConnectService = class extends BaseSDK {
|
|
|
2322
2616
|
* @returns Promise resolving to the connection status
|
|
2323
2617
|
*/
|
|
2324
2618
|
async getStatus(provider, options) {
|
|
2325
|
-
|
|
2619
|
+
log13("Getting connection status for provider: %s", provider);
|
|
2326
2620
|
const result = await this.request(
|
|
2327
2621
|
`/connect/${encodeURIComponent(provider)}/status`,
|
|
2328
2622
|
options
|
|
2329
2623
|
);
|
|
2330
|
-
|
|
2624
|
+
log13("Provider %s connection status: connected=%s", provider, result.connected);
|
|
2331
2625
|
return result;
|
|
2332
2626
|
}
|
|
2333
2627
|
/**
|
|
@@ -2340,9 +2634,9 @@ var ConnectService = class extends BaseSDK {
|
|
|
2340
2634
|
*/
|
|
2341
2635
|
async listConnections(options) {
|
|
2342
2636
|
var _a;
|
|
2343
|
-
|
|
2637
|
+
log13("Listing user connections");
|
|
2344
2638
|
const result = await this.request("/connect/connections", options);
|
|
2345
|
-
|
|
2639
|
+
log13("Found %d connections", ((_a = result.connections) == null ? void 0 : _a.length) || 0);
|
|
2346
2640
|
return result;
|
|
2347
2641
|
}
|
|
2348
2642
|
/**
|
|
@@ -2356,12 +2650,12 @@ var ConnectService = class extends BaseSDK {
|
|
|
2356
2650
|
* @returns Promise resolving to the connection health status
|
|
2357
2651
|
*/
|
|
2358
2652
|
async getHealth(provider, options) {
|
|
2359
|
-
|
|
2653
|
+
log13("Checking health for provider: %s", provider);
|
|
2360
2654
|
const result = await this.request(
|
|
2361
2655
|
`/connect/${encodeURIComponent(provider)}/health`,
|
|
2362
2656
|
options
|
|
2363
2657
|
);
|
|
2364
|
-
|
|
2658
|
+
log13("Provider %s health: healthy=%s, status=%s", provider, result.healthy, result.tokenStatus);
|
|
2365
2659
|
return result;
|
|
2366
2660
|
}
|
|
2367
2661
|
/**
|
|
@@ -2374,9 +2668,9 @@ var ConnectService = class extends BaseSDK {
|
|
|
2374
2668
|
*/
|
|
2375
2669
|
async getAllHealth(options) {
|
|
2376
2670
|
var _a, _b, _c;
|
|
2377
|
-
|
|
2671
|
+
log13("Checking health for all connections");
|
|
2378
2672
|
const result = await this.request("/connect/health", options);
|
|
2379
|
-
|
|
2673
|
+
log13(
|
|
2380
2674
|
"Health check complete: total=%d, healthy=%d, unhealthy=%d",
|
|
2381
2675
|
((_a = result.summary) == null ? void 0 : _a.total) || 0,
|
|
2382
2676
|
((_b = result.summary) == null ? void 0 : _b.healthy) || 0,
|
|
@@ -2395,7 +2689,7 @@ var ConnectService = class extends BaseSDK {
|
|
|
2395
2689
|
* @returns Promise resolving to the refresh result
|
|
2396
2690
|
*/
|
|
2397
2691
|
async refresh(provider, options) {
|
|
2398
|
-
|
|
2692
|
+
log13("Refreshing token for provider: %s", provider);
|
|
2399
2693
|
const result = await this.request(
|
|
2400
2694
|
`/connect/${encodeURIComponent(provider)}/refresh`,
|
|
2401
2695
|
{
|
|
@@ -2403,7 +2697,7 @@ var ConnectService = class extends BaseSDK {
|
|
|
2403
2697
|
...options
|
|
2404
2698
|
}
|
|
2405
2699
|
);
|
|
2406
|
-
|
|
2700
|
+
log13("Token refresh for %s: refreshed=%s", provider, result.refreshed);
|
|
2407
2701
|
return result;
|
|
2408
2702
|
}
|
|
2409
2703
|
/**
|
|
@@ -2417,7 +2711,7 @@ var ConnectService = class extends BaseSDK {
|
|
|
2417
2711
|
* @returns Promise resolving to the revoke result
|
|
2418
2712
|
*/
|
|
2419
2713
|
async revoke(provider, options) {
|
|
2420
|
-
|
|
2714
|
+
log13("Revoking connection for provider: %s", provider);
|
|
2421
2715
|
const result = await this.request(
|
|
2422
2716
|
`/connect/${encodeURIComponent(provider)}`,
|
|
2423
2717
|
{
|
|
@@ -2425,15 +2719,15 @@ var ConnectService = class extends BaseSDK {
|
|
|
2425
2719
|
...options
|
|
2426
2720
|
}
|
|
2427
2721
|
);
|
|
2428
|
-
|
|
2722
|
+
log13("Connection revoked for %s: success=%s", provider, result.success);
|
|
2429
2723
|
return result;
|
|
2430
2724
|
}
|
|
2431
2725
|
};
|
|
2432
2726
|
|
|
2433
2727
|
// src/market/services/DiscoveryService.ts
|
|
2434
|
-
import
|
|
2728
|
+
import debug14 from "debug";
|
|
2435
2729
|
import urlJoin4 from "url-join";
|
|
2436
|
-
var
|
|
2730
|
+
var log14 = debug14("lobe-market-sdk:discovery");
|
|
2437
2731
|
var DiscoveryService = class extends BaseSDK {
|
|
2438
2732
|
/**
|
|
2439
2733
|
* Retrieves the service discovery document
|
|
@@ -2445,9 +2739,9 @@ var DiscoveryService = class extends BaseSDK {
|
|
|
2445
2739
|
* @returns Promise resolving to the service discovery document
|
|
2446
2740
|
*/
|
|
2447
2741
|
async getDiscoveryDocument() {
|
|
2448
|
-
|
|
2742
|
+
log14("Fetching discovery document");
|
|
2449
2743
|
if (this.discoveryDoc) {
|
|
2450
|
-
|
|
2744
|
+
log14("Returning cached discovery document");
|
|
2451
2745
|
return this.discoveryDoc;
|
|
2452
2746
|
}
|
|
2453
2747
|
const res = await fetch(urlJoin4(this.baseUrl, "/.well-known/discovery"));
|
|
@@ -2455,14 +2749,14 @@ var DiscoveryService = class extends BaseSDK {
|
|
|
2455
2749
|
throw new Error(await res.text());
|
|
2456
2750
|
}
|
|
2457
2751
|
this.discoveryDoc = await res.json();
|
|
2458
|
-
|
|
2752
|
+
log14("Discovery document successfully fetched");
|
|
2459
2753
|
return this.discoveryDoc;
|
|
2460
2754
|
}
|
|
2461
2755
|
};
|
|
2462
2756
|
|
|
2463
2757
|
// src/market/services/FeedbackService.ts
|
|
2464
|
-
import
|
|
2465
|
-
var
|
|
2758
|
+
import debug15 from "debug";
|
|
2759
|
+
var log15 = debug15("lobe-market-sdk:feedback");
|
|
2466
2760
|
var FeedbackService = class extends BaseSDK {
|
|
2467
2761
|
/**
|
|
2468
2762
|
* Submits user feedback
|
|
@@ -2492,7 +2786,7 @@ var FeedbackService = class extends BaseSDK {
|
|
|
2492
2786
|
* ```
|
|
2493
2787
|
*/
|
|
2494
2788
|
async submitFeedback(data, options) {
|
|
2495
|
-
|
|
2789
|
+
log15("Submitting feedback: %s", data.title);
|
|
2496
2790
|
const result = await this.request("/v1/user/feedback", {
|
|
2497
2791
|
body: JSON.stringify(data),
|
|
2498
2792
|
headers: {
|
|
@@ -2501,14 +2795,14 @@ var FeedbackService = class extends BaseSDK {
|
|
|
2501
2795
|
method: "POST",
|
|
2502
2796
|
...options
|
|
2503
2797
|
});
|
|
2504
|
-
|
|
2798
|
+
log15("Feedback submitted successfully: %s", result.issueId);
|
|
2505
2799
|
return result;
|
|
2506
2800
|
}
|
|
2507
2801
|
};
|
|
2508
2802
|
|
|
2509
2803
|
// src/market/services/PluginsService.ts
|
|
2510
|
-
import
|
|
2511
|
-
var
|
|
2804
|
+
import debug16 from "debug";
|
|
2805
|
+
var log16 = debug16("lobe-market-sdk:plugins");
|
|
2512
2806
|
var PluginsService = class extends BaseSDK {
|
|
2513
2807
|
/**
|
|
2514
2808
|
* Retrieves a list of plugins from the marketplace
|
|
@@ -2523,9 +2817,9 @@ var PluginsService = class extends BaseSDK {
|
|
|
2523
2817
|
const locale = params.locale || this.defaultLocale;
|
|
2524
2818
|
const queryParams = { ...params, locale };
|
|
2525
2819
|
const queryString = this.buildQueryString(queryParams);
|
|
2526
|
-
|
|
2820
|
+
log16("Getting plugin list: %O", queryParams);
|
|
2527
2821
|
const result = await this.request(`/v1/plugins${queryString}`, options);
|
|
2528
|
-
|
|
2822
|
+
log16("Retrieved %d plugins", result.items.length);
|
|
2529
2823
|
return result;
|
|
2530
2824
|
}
|
|
2531
2825
|
/**
|
|
@@ -2543,12 +2837,12 @@ var PluginsService = class extends BaseSDK {
|
|
|
2543
2837
|
const locale = params.locale || this.defaultLocale;
|
|
2544
2838
|
const queryParams = { ...params, locale };
|
|
2545
2839
|
const queryString = this.buildQueryString(queryParams);
|
|
2546
|
-
|
|
2840
|
+
log16("Getting plugin categories: %O", queryParams);
|
|
2547
2841
|
const result = await this.request(
|
|
2548
2842
|
`/v1/plugins/categories${queryString}`,
|
|
2549
2843
|
options
|
|
2550
2844
|
);
|
|
2551
|
-
|
|
2845
|
+
log16("Retrieved %d categories", result.length);
|
|
2552
2846
|
return result;
|
|
2553
2847
|
}
|
|
2554
2848
|
/**
|
|
@@ -2561,12 +2855,12 @@ var PluginsService = class extends BaseSDK {
|
|
|
2561
2855
|
* @returns Promise resolving to an array containing identifiers array and last modified time
|
|
2562
2856
|
*/
|
|
2563
2857
|
async getPublishedIdentifiers(options) {
|
|
2564
|
-
|
|
2858
|
+
log16("Getting published plugin identifiers");
|
|
2565
2859
|
const result = await this.request(
|
|
2566
2860
|
"/v1/plugins/identifiers",
|
|
2567
2861
|
options
|
|
2568
2862
|
);
|
|
2569
|
-
|
|
2863
|
+
log16("Retrieved %d published plugin identifiers", result.length);
|
|
2570
2864
|
return result;
|
|
2571
2865
|
}
|
|
2572
2866
|
/**
|
|
@@ -2586,7 +2880,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2586
2880
|
version,
|
|
2587
2881
|
identifier
|
|
2588
2882
|
}, options) {
|
|
2589
|
-
|
|
2883
|
+
log16("Getting plugin manifest: %O", { identifier, locale, version });
|
|
2590
2884
|
const localeParam = locale || this.defaultLocale;
|
|
2591
2885
|
const params = { locale: localeParam };
|
|
2592
2886
|
if (version) {
|
|
@@ -2597,7 +2891,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2597
2891
|
`/v1/plugins/${identifier}/manifest${queryString}`,
|
|
2598
2892
|
options
|
|
2599
2893
|
);
|
|
2600
|
-
|
|
2894
|
+
log16("Plugin manifest successfully retrieved: %s", identifier);
|
|
2601
2895
|
return manifest;
|
|
2602
2896
|
}
|
|
2603
2897
|
/**
|
|
@@ -2614,7 +2908,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2614
2908
|
version,
|
|
2615
2909
|
identifier
|
|
2616
2910
|
}, options) {
|
|
2617
|
-
|
|
2911
|
+
log16("Getting plugin detail: %O", { identifier, locale, version });
|
|
2618
2912
|
const localeParam = locale || this.defaultLocale;
|
|
2619
2913
|
const params = { locale: localeParam };
|
|
2620
2914
|
if (version) {
|
|
@@ -2625,7 +2919,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2625
2919
|
`/v1/plugins/${identifier}${queryString}`,
|
|
2626
2920
|
options
|
|
2627
2921
|
);
|
|
2628
|
-
|
|
2922
|
+
log16("Plugin manifest successfully retrieved: %s", identifier);
|
|
2629
2923
|
return manifest;
|
|
2630
2924
|
}
|
|
2631
2925
|
/**
|
|
@@ -2640,7 +2934,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2640
2934
|
*
|
|
2641
2935
|
*/
|
|
2642
2936
|
async reportInstallation(reportData) {
|
|
2643
|
-
|
|
2937
|
+
log16("Reporting installation for %s@%s", reportData.identifier, reportData.version);
|
|
2644
2938
|
const result = await this.request("/v1/plugins/report/installation", {
|
|
2645
2939
|
body: JSON.stringify(reportData),
|
|
2646
2940
|
headers: {
|
|
@@ -2648,7 +2942,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2648
2942
|
},
|
|
2649
2943
|
method: "POST"
|
|
2650
2944
|
});
|
|
2651
|
-
|
|
2945
|
+
log16("Installation report submitted successfully: %O", result);
|
|
2652
2946
|
return result;
|
|
2653
2947
|
}
|
|
2654
2948
|
/**
|
|
@@ -2662,7 +2956,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2662
2956
|
* @returns Promise resolving to the report submission response
|
|
2663
2957
|
*/
|
|
2664
2958
|
async reportCall(reportData) {
|
|
2665
|
-
|
|
2959
|
+
log16(
|
|
2666
2960
|
"Reporting call for %s@%s - %s:%s",
|
|
2667
2961
|
reportData.identifier,
|
|
2668
2962
|
reportData.version,
|
|
@@ -2676,7 +2970,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2676
2970
|
},
|
|
2677
2971
|
method: "POST"
|
|
2678
2972
|
});
|
|
2679
|
-
|
|
2973
|
+
log16("Call report submitted successfully: %O", result);
|
|
2680
2974
|
return result;
|
|
2681
2975
|
}
|
|
2682
2976
|
/**
|
|
@@ -2688,7 +2982,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2688
2982
|
* @param options - Optional request init overrides
|
|
2689
2983
|
*/
|
|
2690
2984
|
async createEvent(eventData, options) {
|
|
2691
|
-
|
|
2985
|
+
log16("Recording plugin event: %s for %s", eventData.event, eventData.identifier);
|
|
2692
2986
|
await this.request("/v1/plugins/events", {
|
|
2693
2987
|
body: JSON.stringify(eventData),
|
|
2694
2988
|
headers: {
|
|
@@ -2718,7 +3012,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2718
3012
|
* ```
|
|
2719
3013
|
*/
|
|
2720
3014
|
async callCloudGateway(request, options) {
|
|
2721
|
-
|
|
3015
|
+
log16("Calling cloud gateway for plugin %s, tool %s", request.identifier, request.toolName);
|
|
2722
3016
|
const result = await this.request("/v1/plugins/cloud-gateway", {
|
|
2723
3017
|
body: JSON.stringify(request),
|
|
2724
3018
|
headers: {
|
|
@@ -2727,7 +3021,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2727
3021
|
method: "POST",
|
|
2728
3022
|
...options
|
|
2729
3023
|
});
|
|
2730
|
-
|
|
3024
|
+
log16("Cloud gateway call completed: %O", {
|
|
2731
3025
|
identifier: request.identifier,
|
|
2732
3026
|
isError: result.isError,
|
|
2733
3027
|
toolName: request.toolName
|
|
@@ -2768,7 +3062,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2768
3062
|
* ```
|
|
2769
3063
|
*/
|
|
2770
3064
|
async runBuildInTool(toolName, params, context, options) {
|
|
2771
|
-
|
|
3065
|
+
log16(
|
|
2772
3066
|
"Running built-in tool: %s for user %s, topic %s",
|
|
2773
3067
|
toolName,
|
|
2774
3068
|
context.userId,
|
|
@@ -2787,7 +3081,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2787
3081
|
method: "POST",
|
|
2788
3082
|
...options
|
|
2789
3083
|
});
|
|
2790
|
-
|
|
3084
|
+
log16("Built-in tool execution completed: %O", {
|
|
2791
3085
|
success: result.success,
|
|
2792
3086
|
toolName
|
|
2793
3087
|
});
|
|
@@ -2891,8 +3185,8 @@ var PluginsService = class extends BaseSDK {
|
|
|
2891
3185
|
};
|
|
2892
3186
|
|
|
2893
3187
|
// src/market/services/SkillService.ts
|
|
2894
|
-
import
|
|
2895
|
-
var
|
|
3188
|
+
import debug17 from "debug";
|
|
3189
|
+
var log17 = debug17("lobe-market-sdk:skill");
|
|
2896
3190
|
var SkillService = class extends BaseSDK {
|
|
2897
3191
|
/**
|
|
2898
3192
|
* Lists all available skill providers
|
|
@@ -2905,9 +3199,9 @@ var SkillService = class extends BaseSDK {
|
|
|
2905
3199
|
*/
|
|
2906
3200
|
async listProviders(options) {
|
|
2907
3201
|
var _a;
|
|
2908
|
-
|
|
3202
|
+
log17("Listing skill providers");
|
|
2909
3203
|
const result = await this.request("/v1/skill/providers", options);
|
|
2910
|
-
|
|
3204
|
+
log17("Found %d skill providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
|
|
2911
3205
|
return result;
|
|
2912
3206
|
}
|
|
2913
3207
|
/**
|
|
@@ -2922,12 +3216,12 @@ var SkillService = class extends BaseSDK {
|
|
|
2922
3216
|
*/
|
|
2923
3217
|
async listTools(provider, options) {
|
|
2924
3218
|
var _a;
|
|
2925
|
-
|
|
3219
|
+
log17("Listing tools for provider: %s", provider);
|
|
2926
3220
|
const result = await this.request(
|
|
2927
3221
|
`/v1/skill/${encodeURIComponent(provider)}/tools`,
|
|
2928
3222
|
options
|
|
2929
3223
|
);
|
|
2930
|
-
|
|
3224
|
+
log17("Found %d tools for provider %s", ((_a = result.tools) == null ? void 0 : _a.length) || 0, provider);
|
|
2931
3225
|
return result;
|
|
2932
3226
|
}
|
|
2933
3227
|
/**
|
|
@@ -2943,12 +3237,12 @@ var SkillService = class extends BaseSDK {
|
|
|
2943
3237
|
*/
|
|
2944
3238
|
async getTool(provider, toolName, options) {
|
|
2945
3239
|
var _a;
|
|
2946
|
-
|
|
3240
|
+
log17("Getting tool %s from provider %s", toolName, provider);
|
|
2947
3241
|
const result = await this.request(
|
|
2948
3242
|
`/v1/skill/${encodeURIComponent(provider)}/tool/${encodeURIComponent(toolName)}`,
|
|
2949
3243
|
options
|
|
2950
3244
|
);
|
|
2951
|
-
|
|
3245
|
+
log17("Retrieved tool: %s", (_a = result.tool) == null ? void 0 : _a.name);
|
|
2952
3246
|
return result;
|
|
2953
3247
|
}
|
|
2954
3248
|
/**
|
|
@@ -2962,12 +3256,12 @@ var SkillService = class extends BaseSDK {
|
|
|
2962
3256
|
* @returns Promise resolving to the connection status
|
|
2963
3257
|
*/
|
|
2964
3258
|
async getStatus(provider, options) {
|
|
2965
|
-
|
|
3259
|
+
log17("Getting status for provider: %s", provider);
|
|
2966
3260
|
const result = await this.request(
|
|
2967
3261
|
`/v1/skill/${encodeURIComponent(provider)}/status`,
|
|
2968
3262
|
options
|
|
2969
3263
|
);
|
|
2970
|
-
|
|
3264
|
+
log17("Provider %s status: connected=%s", provider, result.connected);
|
|
2971
3265
|
return result;
|
|
2972
3266
|
}
|
|
2973
3267
|
/**
|
|
@@ -2995,7 +3289,7 @@ var SkillService = class extends BaseSDK {
|
|
|
2995
3289
|
* ```
|
|
2996
3290
|
*/
|
|
2997
3291
|
async callTool(provider, params, options) {
|
|
2998
|
-
|
|
3292
|
+
log17("Calling tool %s on provider %s", params.tool, provider);
|
|
2999
3293
|
const result = await this.request(
|
|
3000
3294
|
`/v1/skill/${encodeURIComponent(provider)}/call`,
|
|
3001
3295
|
{
|
|
@@ -3010,14 +3304,14 @@ var SkillService = class extends BaseSDK {
|
|
|
3010
3304
|
...options
|
|
3011
3305
|
}
|
|
3012
3306
|
);
|
|
3013
|
-
|
|
3307
|
+
log17("Tool %s call completed: success=%s", params.tool, result.success);
|
|
3014
3308
|
return result;
|
|
3015
3309
|
}
|
|
3016
3310
|
};
|
|
3017
3311
|
|
|
3018
3312
|
// src/market/services/UserService.ts
|
|
3019
|
-
import
|
|
3020
|
-
var
|
|
3313
|
+
import debug18 from "debug";
|
|
3314
|
+
var log18 = debug18("lobe-market-sdk:user");
|
|
3021
3315
|
var UserService = class extends BaseSDK {
|
|
3022
3316
|
/**
|
|
3023
3317
|
* Retrieves user information by account ID or userName
|
|
@@ -3034,12 +3328,12 @@ var UserService = class extends BaseSDK {
|
|
|
3034
3328
|
const locale = params.locale || this.defaultLocale;
|
|
3035
3329
|
const queryParams = { locale };
|
|
3036
3330
|
const queryString = this.buildQueryString(queryParams);
|
|
3037
|
-
|
|
3331
|
+
log18("Getting user info: %O", { idOrUserName, ...params });
|
|
3038
3332
|
const result = await this.request(
|
|
3039
3333
|
`/v1/user/info/${idOrUserName}${queryString}`,
|
|
3040
3334
|
options
|
|
3041
3335
|
);
|
|
3042
|
-
|
|
3336
|
+
log18("User info successfully retrieved for: %s", idOrUserName);
|
|
3043
3337
|
return result;
|
|
3044
3338
|
}
|
|
3045
3339
|
/**
|
|
@@ -3054,7 +3348,7 @@ var UserService = class extends BaseSDK {
|
|
|
3054
3348
|
* @throws Error if userName is already taken or update fails
|
|
3055
3349
|
*/
|
|
3056
3350
|
async updateUserInfo(data, options) {
|
|
3057
|
-
|
|
3351
|
+
log18("Updating user info: %O", data);
|
|
3058
3352
|
const result = await this.request("/v1/user/update", {
|
|
3059
3353
|
body: JSON.stringify(data),
|
|
3060
3354
|
headers: {
|
|
@@ -3063,14 +3357,14 @@ var UserService = class extends BaseSDK {
|
|
|
3063
3357
|
method: "POST",
|
|
3064
3358
|
...options
|
|
3065
3359
|
});
|
|
3066
|
-
|
|
3360
|
+
log18("User info updated successfully");
|
|
3067
3361
|
return result;
|
|
3068
3362
|
}
|
|
3069
3363
|
};
|
|
3070
3364
|
|
|
3071
3365
|
// src/market/services/UserFollowService.ts
|
|
3072
|
-
import
|
|
3073
|
-
var
|
|
3366
|
+
import debug19 from "debug";
|
|
3367
|
+
var log19 = debug19("lobe-market-sdk:user-follow");
|
|
3074
3368
|
var UserFollowService = class extends BaseSDK {
|
|
3075
3369
|
/**
|
|
3076
3370
|
* Follow a user
|
|
@@ -3084,7 +3378,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
3084
3378
|
* @throws Error if already following or cannot follow yourself
|
|
3085
3379
|
*/
|
|
3086
3380
|
async follow(followingId, options) {
|
|
3087
|
-
|
|
3381
|
+
log19("Following user: %d", followingId);
|
|
3088
3382
|
const body = { followingId };
|
|
3089
3383
|
const result = await this.request("/v1/user/follows", {
|
|
3090
3384
|
body: JSON.stringify(body),
|
|
@@ -3094,7 +3388,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
3094
3388
|
method: "POST",
|
|
3095
3389
|
...options
|
|
3096
3390
|
});
|
|
3097
|
-
|
|
3391
|
+
log19("Successfully followed user: %d", followingId);
|
|
3098
3392
|
return result;
|
|
3099
3393
|
}
|
|
3100
3394
|
/**
|
|
@@ -3109,7 +3403,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
3109
3403
|
* @throws Error if follow relationship not found
|
|
3110
3404
|
*/
|
|
3111
3405
|
async unfollow(followingId, options) {
|
|
3112
|
-
|
|
3406
|
+
log19("Unfollowing user: %d", followingId);
|
|
3113
3407
|
const body = { followingId };
|
|
3114
3408
|
const result = await this.request("/v1/user/follows", {
|
|
3115
3409
|
body: JSON.stringify(body),
|
|
@@ -3119,7 +3413,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
3119
3413
|
method: "DELETE",
|
|
3120
3414
|
...options
|
|
3121
3415
|
});
|
|
3122
|
-
|
|
3416
|
+
log19("Successfully unfollowed user: %d", followingId);
|
|
3123
3417
|
return result;
|
|
3124
3418
|
}
|
|
3125
3419
|
/**
|
|
@@ -3133,13 +3427,13 @@ var UserFollowService = class extends BaseSDK {
|
|
|
3133
3427
|
* @returns Promise resolving to follow status (isFollowing, isMutual)
|
|
3134
3428
|
*/
|
|
3135
3429
|
async checkFollowStatus(targetUserId, options) {
|
|
3136
|
-
|
|
3430
|
+
log19("Checking follow status for user: %d", targetUserId);
|
|
3137
3431
|
const queryString = this.buildQueryString({ targetUserId: String(targetUserId) });
|
|
3138
3432
|
const result = await this.request(
|
|
3139
3433
|
`/v1/user/follows/check${queryString}`,
|
|
3140
3434
|
options
|
|
3141
3435
|
);
|
|
3142
|
-
|
|
3436
|
+
log19("Follow status retrieved: %O", result);
|
|
3143
3437
|
return result;
|
|
3144
3438
|
}
|
|
3145
3439
|
/**
|
|
@@ -3154,7 +3448,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
3154
3448
|
* @returns Promise resolving to list of following users
|
|
3155
3449
|
*/
|
|
3156
3450
|
async getFollowing(userId, params = {}, options) {
|
|
3157
|
-
|
|
3451
|
+
log19("Getting following list for user: %d", userId);
|
|
3158
3452
|
const queryParams = {};
|
|
3159
3453
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3160
3454
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3163,7 +3457,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
3163
3457
|
`/v1/user/follows/${userId}/following${queryString}`,
|
|
3164
3458
|
options
|
|
3165
3459
|
);
|
|
3166
|
-
|
|
3460
|
+
log19("Following list retrieved for user: %d", userId);
|
|
3167
3461
|
return result;
|
|
3168
3462
|
}
|
|
3169
3463
|
/**
|
|
@@ -3178,7 +3472,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
3178
3472
|
* @returns Promise resolving to list of followers
|
|
3179
3473
|
*/
|
|
3180
3474
|
async getFollowers(userId, params = {}, options) {
|
|
3181
|
-
|
|
3475
|
+
log19("Getting followers list for user: %d", userId);
|
|
3182
3476
|
const queryParams = {};
|
|
3183
3477
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3184
3478
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3187,14 +3481,14 @@ var UserFollowService = class extends BaseSDK {
|
|
|
3187
3481
|
`/v1/user/follows/${userId}/followers${queryString}`,
|
|
3188
3482
|
options
|
|
3189
3483
|
);
|
|
3190
|
-
|
|
3484
|
+
log19("Followers list retrieved for user: %d", userId);
|
|
3191
3485
|
return result;
|
|
3192
3486
|
}
|
|
3193
3487
|
};
|
|
3194
3488
|
|
|
3195
3489
|
// src/market/services/UserFavoriteService.ts
|
|
3196
|
-
import
|
|
3197
|
-
var
|
|
3490
|
+
import debug20 from "debug";
|
|
3491
|
+
var log20 = debug20("lobe-market-sdk:user-favorite");
|
|
3198
3492
|
var UserFavoriteService = class extends BaseSDK {
|
|
3199
3493
|
/**
|
|
3200
3494
|
* Add to favorites
|
|
@@ -3209,7 +3503,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3209
3503
|
* @throws Error if already in favorites
|
|
3210
3504
|
*/
|
|
3211
3505
|
async addFavorite(targetType, targetId, options) {
|
|
3212
|
-
|
|
3506
|
+
log20("Adding favorite: %s %d", targetType, targetId);
|
|
3213
3507
|
const body = { targetId, targetType };
|
|
3214
3508
|
const result = await this.request("/v1/user/favorites", {
|
|
3215
3509
|
body: JSON.stringify(body),
|
|
@@ -3219,7 +3513,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3219
3513
|
method: "POST",
|
|
3220
3514
|
...options
|
|
3221
3515
|
});
|
|
3222
|
-
|
|
3516
|
+
log20("Successfully added favorite: %s %d", targetType, targetId);
|
|
3223
3517
|
return result;
|
|
3224
3518
|
}
|
|
3225
3519
|
/**
|
|
@@ -3235,7 +3529,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3235
3529
|
* @throws Error if favorite not found
|
|
3236
3530
|
*/
|
|
3237
3531
|
async removeFavorite(targetType, targetId, options) {
|
|
3238
|
-
|
|
3532
|
+
log20("Removing favorite: %s %d", targetType, targetId);
|
|
3239
3533
|
const body = { targetId, targetType };
|
|
3240
3534
|
const result = await this.request("/v1/user/favorites", {
|
|
3241
3535
|
body: JSON.stringify(body),
|
|
@@ -3245,7 +3539,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3245
3539
|
method: "DELETE",
|
|
3246
3540
|
...options
|
|
3247
3541
|
});
|
|
3248
|
-
|
|
3542
|
+
log20("Successfully removed favorite: %s %d", targetType, targetId);
|
|
3249
3543
|
return result;
|
|
3250
3544
|
}
|
|
3251
3545
|
/**
|
|
@@ -3260,7 +3554,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3260
3554
|
* @returns Promise resolving to favorite status
|
|
3261
3555
|
*/
|
|
3262
3556
|
async checkFavorite(targetType, targetId, options) {
|
|
3263
|
-
|
|
3557
|
+
log20("Checking favorite status: %s %d", targetType, targetId);
|
|
3264
3558
|
const queryString = this.buildQueryString({
|
|
3265
3559
|
targetId: String(targetId),
|
|
3266
3560
|
targetType
|
|
@@ -3269,7 +3563,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3269
3563
|
`/v1/user/favorites/check${queryString}`,
|
|
3270
3564
|
options
|
|
3271
3565
|
);
|
|
3272
|
-
|
|
3566
|
+
log20("Favorite status retrieved: %O", result);
|
|
3273
3567
|
return result;
|
|
3274
3568
|
}
|
|
3275
3569
|
/**
|
|
@@ -3283,7 +3577,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3283
3577
|
* @returns Promise resolving to list of favorites
|
|
3284
3578
|
*/
|
|
3285
3579
|
async getMyFavorites(params = {}, options) {
|
|
3286
|
-
|
|
3580
|
+
log20("Getting my favorites: %O", params);
|
|
3287
3581
|
const queryParams = {};
|
|
3288
3582
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3289
3583
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3293,7 +3587,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3293
3587
|
`/v1/user/favorites/me${queryString}`,
|
|
3294
3588
|
options
|
|
3295
3589
|
);
|
|
3296
|
-
|
|
3590
|
+
log20("My favorites retrieved");
|
|
3297
3591
|
return result;
|
|
3298
3592
|
}
|
|
3299
3593
|
/**
|
|
@@ -3308,7 +3602,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3308
3602
|
* @returns Promise resolving to list of favorites
|
|
3309
3603
|
*/
|
|
3310
3604
|
async getUserFavorites(userId, params = {}, options) {
|
|
3311
|
-
|
|
3605
|
+
log20("Getting favorites for user: %d", userId);
|
|
3312
3606
|
const queryParams = {};
|
|
3313
3607
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3314
3608
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3318,7 +3612,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3318
3612
|
`/v1/user/favorites/${userId}${queryString}`,
|
|
3319
3613
|
options
|
|
3320
3614
|
);
|
|
3321
|
-
|
|
3615
|
+
log20("Favorites retrieved for user: %d", userId);
|
|
3322
3616
|
return result;
|
|
3323
3617
|
}
|
|
3324
3618
|
/**
|
|
@@ -3333,7 +3627,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3333
3627
|
* @returns Promise resolving to list of favorite agents
|
|
3334
3628
|
*/
|
|
3335
3629
|
async getUserFavoriteAgents(userId, params = {}, options) {
|
|
3336
|
-
|
|
3630
|
+
log20("Getting favorite agents for user: %d", userId);
|
|
3337
3631
|
const queryParams = {};
|
|
3338
3632
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3339
3633
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3342,7 +3636,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3342
3636
|
`/v1/user/favorites/${userId}/agents${queryString}`,
|
|
3343
3637
|
options
|
|
3344
3638
|
);
|
|
3345
|
-
|
|
3639
|
+
log20("Favorite agents retrieved for user: %d", userId);
|
|
3346
3640
|
return result;
|
|
3347
3641
|
}
|
|
3348
3642
|
/**
|
|
@@ -3357,7 +3651,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3357
3651
|
* @returns Promise resolving to list of favorite plugins
|
|
3358
3652
|
*/
|
|
3359
3653
|
async getUserFavoritePlugins(userId, params = {}, options) {
|
|
3360
|
-
|
|
3654
|
+
log20("Getting favorite plugins for user: %d", userId);
|
|
3361
3655
|
const queryParams = {};
|
|
3362
3656
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3363
3657
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3366,14 +3660,14 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
3366
3660
|
`/v1/user/favorites/${userId}/plugins${queryString}`,
|
|
3367
3661
|
options
|
|
3368
3662
|
);
|
|
3369
|
-
|
|
3663
|
+
log20("Favorite plugins retrieved for user: %d", userId);
|
|
3370
3664
|
return result;
|
|
3371
3665
|
}
|
|
3372
3666
|
};
|
|
3373
3667
|
|
|
3374
3668
|
// src/market/services/UserLikeService.ts
|
|
3375
|
-
import
|
|
3376
|
-
var
|
|
3669
|
+
import debug21 from "debug";
|
|
3670
|
+
var log21 = debug21("lobe-market-sdk:user-like");
|
|
3377
3671
|
var UserLikeService = class extends BaseSDK {
|
|
3378
3672
|
/**
|
|
3379
3673
|
* Like content
|
|
@@ -3388,7 +3682,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3388
3682
|
* @throws Error if already liked
|
|
3389
3683
|
*/
|
|
3390
3684
|
async like(targetType, targetId, options) {
|
|
3391
|
-
|
|
3685
|
+
log21("Liking: %s %d", targetType, targetId);
|
|
3392
3686
|
const body = { targetId, targetType };
|
|
3393
3687
|
const result = await this.request("/v1/user/likes", {
|
|
3394
3688
|
body: JSON.stringify(body),
|
|
@@ -3398,7 +3692,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3398
3692
|
method: "POST",
|
|
3399
3693
|
...options
|
|
3400
3694
|
});
|
|
3401
|
-
|
|
3695
|
+
log21("Successfully liked: %s %d", targetType, targetId);
|
|
3402
3696
|
return result;
|
|
3403
3697
|
}
|
|
3404
3698
|
/**
|
|
@@ -3414,7 +3708,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3414
3708
|
* @throws Error if like not found
|
|
3415
3709
|
*/
|
|
3416
3710
|
async unlike(targetType, targetId, options) {
|
|
3417
|
-
|
|
3711
|
+
log21("Unliking: %s %d", targetType, targetId);
|
|
3418
3712
|
const body = { targetId, targetType };
|
|
3419
3713
|
const result = await this.request("/v1/user/likes", {
|
|
3420
3714
|
body: JSON.stringify(body),
|
|
@@ -3424,7 +3718,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3424
3718
|
method: "DELETE",
|
|
3425
3719
|
...options
|
|
3426
3720
|
});
|
|
3427
|
-
|
|
3721
|
+
log21("Successfully unliked: %s %d", targetType, targetId);
|
|
3428
3722
|
return result;
|
|
3429
3723
|
}
|
|
3430
3724
|
/**
|
|
@@ -3439,7 +3733,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3439
3733
|
* @returns Promise resolving to toggle response with new like status
|
|
3440
3734
|
*/
|
|
3441
3735
|
async toggleLike(targetType, targetId, options) {
|
|
3442
|
-
|
|
3736
|
+
log21("Toggling like: %s %d", targetType, targetId);
|
|
3443
3737
|
const body = { targetId, targetType };
|
|
3444
3738
|
const result = await this.request("/v1/user/likes/toggle", {
|
|
3445
3739
|
body: JSON.stringify(body),
|
|
@@ -3449,7 +3743,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3449
3743
|
method: "POST",
|
|
3450
3744
|
...options
|
|
3451
3745
|
});
|
|
3452
|
-
|
|
3746
|
+
log21("Like toggled, new status: %O", result);
|
|
3453
3747
|
return result;
|
|
3454
3748
|
}
|
|
3455
3749
|
/**
|
|
@@ -3464,7 +3758,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3464
3758
|
* @returns Promise resolving to like status
|
|
3465
3759
|
*/
|
|
3466
3760
|
async checkLike(targetType, targetId, options) {
|
|
3467
|
-
|
|
3761
|
+
log21("Checking like status: %s %d", targetType, targetId);
|
|
3468
3762
|
const queryString = this.buildQueryString({
|
|
3469
3763
|
targetId: String(targetId),
|
|
3470
3764
|
targetType
|
|
@@ -3473,7 +3767,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3473
3767
|
`/v1/user/likes/check${queryString}`,
|
|
3474
3768
|
options
|
|
3475
3769
|
);
|
|
3476
|
-
|
|
3770
|
+
log21("Like status retrieved: %O", result);
|
|
3477
3771
|
return result;
|
|
3478
3772
|
}
|
|
3479
3773
|
/**
|
|
@@ -3487,7 +3781,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3487
3781
|
* @returns Promise resolving to list of likes
|
|
3488
3782
|
*/
|
|
3489
3783
|
async getMyLikes(params = {}, options) {
|
|
3490
|
-
|
|
3784
|
+
log21("Getting my likes: %O", params);
|
|
3491
3785
|
const queryParams = {};
|
|
3492
3786
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3493
3787
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3497,7 +3791,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3497
3791
|
`/v1/user/likes/me${queryString}`,
|
|
3498
3792
|
options
|
|
3499
3793
|
);
|
|
3500
|
-
|
|
3794
|
+
log21("My likes retrieved");
|
|
3501
3795
|
return result;
|
|
3502
3796
|
}
|
|
3503
3797
|
/**
|
|
@@ -3512,7 +3806,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3512
3806
|
* @returns Promise resolving to list of likes
|
|
3513
3807
|
*/
|
|
3514
3808
|
async getUserLikes(userId, params = {}, options) {
|
|
3515
|
-
|
|
3809
|
+
log21("Getting likes for user: %d", userId);
|
|
3516
3810
|
const queryParams = {};
|
|
3517
3811
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3518
3812
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3522,7 +3816,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3522
3816
|
`/v1/user/likes/${userId}${queryString}`,
|
|
3523
3817
|
options
|
|
3524
3818
|
);
|
|
3525
|
-
|
|
3819
|
+
log21("Likes retrieved for user: %d", userId);
|
|
3526
3820
|
return result;
|
|
3527
3821
|
}
|
|
3528
3822
|
/**
|
|
@@ -3537,7 +3831,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3537
3831
|
* @returns Promise resolving to list of liked agents
|
|
3538
3832
|
*/
|
|
3539
3833
|
async getUserLikedAgents(userId, params = {}, options) {
|
|
3540
|
-
|
|
3834
|
+
log21("Getting liked agents for user: %d", userId);
|
|
3541
3835
|
const queryParams = {};
|
|
3542
3836
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3543
3837
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3546,7 +3840,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3546
3840
|
`/v1/user/likes/${userId}/agents${queryString}`,
|
|
3547
3841
|
options
|
|
3548
3842
|
);
|
|
3549
|
-
|
|
3843
|
+
log21("Liked agents retrieved for user: %d", userId);
|
|
3550
3844
|
return result;
|
|
3551
3845
|
}
|
|
3552
3846
|
/**
|
|
@@ -3561,7 +3855,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3561
3855
|
* @returns Promise resolving to list of liked plugins
|
|
3562
3856
|
*/
|
|
3563
3857
|
async getUserLikedPlugins(userId, params = {}, options) {
|
|
3564
|
-
|
|
3858
|
+
log21("Getting liked plugins for user: %d", userId);
|
|
3565
3859
|
const queryParams = {};
|
|
3566
3860
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3567
3861
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3570,13 +3864,13 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3570
3864
|
`/v1/user/likes/${userId}/plugins${queryString}`,
|
|
3571
3865
|
options
|
|
3572
3866
|
);
|
|
3573
|
-
|
|
3867
|
+
log21("Liked plugins retrieved for user: %d", userId);
|
|
3574
3868
|
return result;
|
|
3575
3869
|
}
|
|
3576
3870
|
};
|
|
3577
3871
|
|
|
3578
3872
|
// src/market/market-sdk.ts
|
|
3579
|
-
var
|
|
3873
|
+
var log22 = debug22("lobe-market-sdk");
|
|
3580
3874
|
var MarketSDK = class extends BaseSDK {
|
|
3581
3875
|
/**
|
|
3582
3876
|
* Creates a new MarketSDK instance
|
|
@@ -3589,8 +3883,9 @@ var MarketSDK = class extends BaseSDK {
|
|
|
3589
3883
|
tokenExpiry: void 0
|
|
3590
3884
|
};
|
|
3591
3885
|
super(options, void 0, sharedTokenState);
|
|
3592
|
-
|
|
3886
|
+
log22("MarketSDK instance created");
|
|
3593
3887
|
this.agents = new AgentService2(options, this.headers, sharedTokenState);
|
|
3888
|
+
this.agentGroups = new AgentGroupService(options, this.headers, sharedTokenState);
|
|
3594
3889
|
this.auth = new AuthService(options, this.headers, sharedTokenState);
|
|
3595
3890
|
this.connect = new ConnectService(options, this.headers, sharedTokenState);
|
|
3596
3891
|
this.plugins = new PluginsService(options, this.headers, sharedTokenState);
|
|
@@ -3626,7 +3921,7 @@ var MarketSDK = class extends BaseSDK {
|
|
|
3626
3921
|
* @deprecated Use auth.registerClient() instead
|
|
3627
3922
|
*/
|
|
3628
3923
|
async registerClient(request) {
|
|
3629
|
-
|
|
3924
|
+
log22("Registering client (deprecated method, use auth.registerClient): %s", request.clientName);
|
|
3630
3925
|
return this.auth.registerClient(request);
|
|
3631
3926
|
}
|
|
3632
3927
|
};
|
|
@@ -3682,6 +3977,7 @@ function buildTrustedClientPayload(params) {
|
|
|
3682
3977
|
// src/index.ts
|
|
3683
3978
|
export * from "@lobehub/market-types";
|
|
3684
3979
|
export {
|
|
3980
|
+
MarketAPIError,
|
|
3685
3981
|
MarketAdmin,
|
|
3686
3982
|
MarketSDK,
|
|
3687
3983
|
ReviewStatusEnumSchema,
|