@lobehub/market-sdk 0.27.2 → 0.28.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 +785 -1
- package/dist/index.mjs +462 -87
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1561,7 +1561,7 @@ var MarketAdmin = class extends BaseSDK {
|
|
|
1561
1561
|
};
|
|
1562
1562
|
|
|
1563
1563
|
// src/market/market-sdk.ts
|
|
1564
|
-
import
|
|
1564
|
+
import debug21 from "debug";
|
|
1565
1565
|
|
|
1566
1566
|
// src/market/services/AgentService.ts
|
|
1567
1567
|
import debug10 from "debug";
|
|
@@ -2182,10 +2182,258 @@ _AuthService.HANDOFF_CONSUMED_STATUS = "consumed";
|
|
|
2182
2182
|
_AuthService.HANDOFF_EXPIRED_STATUS = "expired";
|
|
2183
2183
|
var AuthService = _AuthService;
|
|
2184
2184
|
|
|
2185
|
-
// src/market/services/
|
|
2185
|
+
// src/market/services/ConnectService.ts
|
|
2186
2186
|
import debug12 from "debug";
|
|
2187
2187
|
import urlJoin3 from "url-join";
|
|
2188
|
-
var log12 = debug12("lobe-market-sdk:
|
|
2188
|
+
var log12 = debug12("lobe-market-sdk:connect");
|
|
2189
|
+
var ConnectService = class extends BaseSDK {
|
|
2190
|
+
/**
|
|
2191
|
+
* Lists all available OAuth providers
|
|
2192
|
+
*
|
|
2193
|
+
* Returns providers that have credentials configured on the server.
|
|
2194
|
+
* This is a public endpoint that doesn't require authentication.
|
|
2195
|
+
*
|
|
2196
|
+
* @param options - Optional request options
|
|
2197
|
+
* @returns Promise resolving to the list of available providers
|
|
2198
|
+
*/
|
|
2199
|
+
async listProviders(options) {
|
|
2200
|
+
var _a;
|
|
2201
|
+
log12("Listing connect providers");
|
|
2202
|
+
const result = await this.request("/connect/providers", options);
|
|
2203
|
+
log12("Found %d connect providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
|
|
2204
|
+
return result;
|
|
2205
|
+
}
|
|
2206
|
+
/**
|
|
2207
|
+
* Gets detailed information about a specific provider
|
|
2208
|
+
*
|
|
2209
|
+
* This is a public endpoint that doesn't require authentication.
|
|
2210
|
+
*
|
|
2211
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2212
|
+
* @param options - Optional request options
|
|
2213
|
+
* @returns Promise resolving to the provider details
|
|
2214
|
+
*/
|
|
2215
|
+
async getProvider(provider, options) {
|
|
2216
|
+
var _a;
|
|
2217
|
+
log12("Getting provider details: %s", provider);
|
|
2218
|
+
const result = await this.request(
|
|
2219
|
+
`/connect/providers/${encodeURIComponent(provider)}`,
|
|
2220
|
+
options
|
|
2221
|
+
);
|
|
2222
|
+
log12("Retrieved provider: %s", (_a = result.provider) == null ? void 0 : _a.name);
|
|
2223
|
+
return result;
|
|
2224
|
+
}
|
|
2225
|
+
/**
|
|
2226
|
+
* Requests an authorization code for initiating OAuth flow
|
|
2227
|
+
*
|
|
2228
|
+
* This method obtains a signed, short-lived authorization code that can be
|
|
2229
|
+
* used to start the OAuth flow in a browser context where Bearer tokens
|
|
2230
|
+
* cannot be sent (e.g., opening a popup or redirecting the page).
|
|
2231
|
+
*
|
|
2232
|
+
* The returned `authorize_url` can be directly opened in a browser.
|
|
2233
|
+
*
|
|
2234
|
+
* **This is the recommended way to initiate OAuth authorization.**
|
|
2235
|
+
*
|
|
2236
|
+
* @param provider - The provider ID (e.g., 'linear', 'github', 'microsoft')
|
|
2237
|
+
* @param params - Optional parameters for scopes and redirect URI
|
|
2238
|
+
* @param options - Optional request options (must include authentication)
|
|
2239
|
+
* @returns Promise resolving to the authorization code and URL
|
|
2240
|
+
*
|
|
2241
|
+
* @example
|
|
2242
|
+
* ```typescript
|
|
2243
|
+
* // Get authorization code and URL
|
|
2244
|
+
* const { authorize_url, code, expires_in } = await sdk.connect.authorize('linear');
|
|
2245
|
+
*
|
|
2246
|
+
* // Open the URL in a popup
|
|
2247
|
+
* const popup = window.open(authorize_url, 'oauth', 'width=600,height=700,popup=yes');
|
|
2248
|
+
*
|
|
2249
|
+
* // With custom scopes
|
|
2250
|
+
* const { authorize_url } = await sdk.connect.authorize('github', {
|
|
2251
|
+
* scopes: ['user', 'repo', 'read:org']
|
|
2252
|
+
* });
|
|
2253
|
+
*
|
|
2254
|
+
* // With redirect URI
|
|
2255
|
+
* const { authorize_url } = await sdk.connect.authorize('microsoft', {
|
|
2256
|
+
* scopes: ['Calendars.ReadWrite'],
|
|
2257
|
+
* redirect_uri: 'https://myapp.com/oauth/callback'
|
|
2258
|
+
* });
|
|
2259
|
+
* ```
|
|
2260
|
+
*/
|
|
2261
|
+
async authorize(provider, params, options) {
|
|
2262
|
+
log12("Requesting authorization code for provider: %s", provider);
|
|
2263
|
+
const result = await this.request(
|
|
2264
|
+
`/connect/${encodeURIComponent(provider)}/authorize`,
|
|
2265
|
+
{
|
|
2266
|
+
body: params ? JSON.stringify(params) : void 0,
|
|
2267
|
+
headers: {
|
|
2268
|
+
"Content-Type": "application/json"
|
|
2269
|
+
},
|
|
2270
|
+
method: "POST",
|
|
2271
|
+
...options
|
|
2272
|
+
}
|
|
2273
|
+
);
|
|
2274
|
+
log12("Authorization code obtained, expires in %d seconds", result.expires_in);
|
|
2275
|
+
return result;
|
|
2276
|
+
}
|
|
2277
|
+
/**
|
|
2278
|
+
* Generates the OAuth authorization URL for a provider (deprecated)
|
|
2279
|
+
*
|
|
2280
|
+
* @deprecated Use `authorize()` instead. This method constructs a URL that
|
|
2281
|
+
* requires Bearer token authentication, which doesn't work in browser redirects.
|
|
2282
|
+
* The new `authorize()` method returns a URL with a signed code that works
|
|
2283
|
+
* in browser contexts.
|
|
2284
|
+
*
|
|
2285
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2286
|
+
* @param params - Optional parameters for scopes and redirect URI
|
|
2287
|
+
* @returns The authorization URL (requires Bearer token, won't work in browser)
|
|
2288
|
+
*
|
|
2289
|
+
* @example
|
|
2290
|
+
* ```typescript
|
|
2291
|
+
* // OLD way (deprecated) - won't work in browser
|
|
2292
|
+
* const url = sdk.connect.getAuthorizeUrl('linear');
|
|
2293
|
+
*
|
|
2294
|
+
* // NEW way (recommended) - works in browser
|
|
2295
|
+
* const { authorize_url } = await sdk.connect.authorize('linear');
|
|
2296
|
+
* window.open(authorize_url, 'oauth', 'width=600,height=700');
|
|
2297
|
+
* ```
|
|
2298
|
+
*/
|
|
2299
|
+
getAuthorizeUrl(provider, params) {
|
|
2300
|
+
log12("Generating authorize URL for provider: %s (deprecated, use authorize() instead)", provider);
|
|
2301
|
+
const queryParams = new URLSearchParams();
|
|
2302
|
+
if ((params == null ? void 0 : params.scopes) && params.scopes.length > 0) {
|
|
2303
|
+
queryParams.set("scope", params.scopes.join(","));
|
|
2304
|
+
}
|
|
2305
|
+
if (params == null ? void 0 : params.redirectUri) {
|
|
2306
|
+
queryParams.set("redirect_uri", params.redirectUri);
|
|
2307
|
+
}
|
|
2308
|
+
const queryString = queryParams.toString();
|
|
2309
|
+
const path = `/connect/${encodeURIComponent(provider)}/start${queryString ? `?${queryString}` : ""}`;
|
|
2310
|
+
const url = urlJoin3(this.baseUrl, "api", path);
|
|
2311
|
+
log12("Generated authorize URL: %s", url);
|
|
2312
|
+
return url;
|
|
2313
|
+
}
|
|
2314
|
+
/**
|
|
2315
|
+
* Gets the connection status for a specific provider
|
|
2316
|
+
*
|
|
2317
|
+
* Checks if the authenticated user has an active OAuth connection.
|
|
2318
|
+
* Requires authentication.
|
|
2319
|
+
*
|
|
2320
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2321
|
+
* @param options - Optional request options (must include authentication)
|
|
2322
|
+
* @returns Promise resolving to the connection status
|
|
2323
|
+
*/
|
|
2324
|
+
async getStatus(provider, options) {
|
|
2325
|
+
log12("Getting connection status for provider: %s", provider);
|
|
2326
|
+
const result = await this.request(
|
|
2327
|
+
`/connect/${encodeURIComponent(provider)}/status`,
|
|
2328
|
+
options
|
|
2329
|
+
);
|
|
2330
|
+
log12("Provider %s connection status: connected=%s", provider, result.connected);
|
|
2331
|
+
return result;
|
|
2332
|
+
}
|
|
2333
|
+
/**
|
|
2334
|
+
* Lists all OAuth connections for the authenticated user
|
|
2335
|
+
*
|
|
2336
|
+
* Requires authentication.
|
|
2337
|
+
*
|
|
2338
|
+
* @param options - Optional request options (must include authentication)
|
|
2339
|
+
* @returns Promise resolving to the list of connections
|
|
2340
|
+
*/
|
|
2341
|
+
async listConnections(options) {
|
|
2342
|
+
var _a;
|
|
2343
|
+
log12("Listing user connections");
|
|
2344
|
+
const result = await this.request("/connect/connections", options);
|
|
2345
|
+
log12("Found %d connections", ((_a = result.connections) == null ? void 0 : _a.length) || 0);
|
|
2346
|
+
return result;
|
|
2347
|
+
}
|
|
2348
|
+
/**
|
|
2349
|
+
* Checks the health of a specific provider connection
|
|
2350
|
+
*
|
|
2351
|
+
* Verifies if the token is valid, expiring soon, or expired.
|
|
2352
|
+
* Requires authentication.
|
|
2353
|
+
*
|
|
2354
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2355
|
+
* @param options - Optional request options (must include authentication)
|
|
2356
|
+
* @returns Promise resolving to the connection health status
|
|
2357
|
+
*/
|
|
2358
|
+
async getHealth(provider, options) {
|
|
2359
|
+
log12("Checking health for provider: %s", provider);
|
|
2360
|
+
const result = await this.request(
|
|
2361
|
+
`/connect/${encodeURIComponent(provider)}/health`,
|
|
2362
|
+
options
|
|
2363
|
+
);
|
|
2364
|
+
log12("Provider %s health: healthy=%s, status=%s", provider, result.healthy, result.tokenStatus);
|
|
2365
|
+
return result;
|
|
2366
|
+
}
|
|
2367
|
+
/**
|
|
2368
|
+
* Checks the health of all provider connections
|
|
2369
|
+
*
|
|
2370
|
+
* Requires authentication.
|
|
2371
|
+
*
|
|
2372
|
+
* @param options - Optional request options (must include authentication)
|
|
2373
|
+
* @returns Promise resolving to the health status of all connections
|
|
2374
|
+
*/
|
|
2375
|
+
async getAllHealth(options) {
|
|
2376
|
+
var _a, _b, _c;
|
|
2377
|
+
log12("Checking health for all connections");
|
|
2378
|
+
const result = await this.request("/connect/health", options);
|
|
2379
|
+
log12(
|
|
2380
|
+
"Health check complete: total=%d, healthy=%d, unhealthy=%d",
|
|
2381
|
+
((_a = result.summary) == null ? void 0 : _a.total) || 0,
|
|
2382
|
+
((_b = result.summary) == null ? void 0 : _b.healthy) || 0,
|
|
2383
|
+
((_c = result.summary) == null ? void 0 : _c.unhealthy) || 0
|
|
2384
|
+
);
|
|
2385
|
+
return result;
|
|
2386
|
+
}
|
|
2387
|
+
/**
|
|
2388
|
+
* Manually refreshes the access token for a provider connection
|
|
2389
|
+
*
|
|
2390
|
+
* Only works for providers that support token refresh.
|
|
2391
|
+
* Requires authentication.
|
|
2392
|
+
*
|
|
2393
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2394
|
+
* @param options - Optional request options (must include authentication)
|
|
2395
|
+
* @returns Promise resolving to the refresh result
|
|
2396
|
+
*/
|
|
2397
|
+
async refresh(provider, options) {
|
|
2398
|
+
log12("Refreshing token for provider: %s", provider);
|
|
2399
|
+
const result = await this.request(
|
|
2400
|
+
`/connect/${encodeURIComponent(provider)}/refresh`,
|
|
2401
|
+
{
|
|
2402
|
+
method: "POST",
|
|
2403
|
+
...options
|
|
2404
|
+
}
|
|
2405
|
+
);
|
|
2406
|
+
log12("Token refresh for %s: refreshed=%s", provider, result.refreshed);
|
|
2407
|
+
return result;
|
|
2408
|
+
}
|
|
2409
|
+
/**
|
|
2410
|
+
* Revokes/disconnects a provider connection
|
|
2411
|
+
*
|
|
2412
|
+
* Removes the OAuth connection and deletes stored tokens.
|
|
2413
|
+
* Requires authentication.
|
|
2414
|
+
*
|
|
2415
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2416
|
+
* @param options - Optional request options (must include authentication)
|
|
2417
|
+
* @returns Promise resolving to the revoke result
|
|
2418
|
+
*/
|
|
2419
|
+
async revoke(provider, options) {
|
|
2420
|
+
log12("Revoking connection for provider: %s", provider);
|
|
2421
|
+
const result = await this.request(
|
|
2422
|
+
`/connect/${encodeURIComponent(provider)}`,
|
|
2423
|
+
{
|
|
2424
|
+
method: "DELETE",
|
|
2425
|
+
...options
|
|
2426
|
+
}
|
|
2427
|
+
);
|
|
2428
|
+
log12("Connection revoked for %s: success=%s", provider, result.success);
|
|
2429
|
+
return result;
|
|
2430
|
+
}
|
|
2431
|
+
};
|
|
2432
|
+
|
|
2433
|
+
// src/market/services/DiscoveryService.ts
|
|
2434
|
+
import debug13 from "debug";
|
|
2435
|
+
import urlJoin4 from "url-join";
|
|
2436
|
+
var log13 = debug13("lobe-market-sdk:discovery");
|
|
2189
2437
|
var DiscoveryService = class extends BaseSDK {
|
|
2190
2438
|
/**
|
|
2191
2439
|
* Retrieves the service discovery document
|
|
@@ -2197,24 +2445,24 @@ var DiscoveryService = class extends BaseSDK {
|
|
|
2197
2445
|
* @returns Promise resolving to the service discovery document
|
|
2198
2446
|
*/
|
|
2199
2447
|
async getDiscoveryDocument() {
|
|
2200
|
-
|
|
2448
|
+
log13("Fetching discovery document");
|
|
2201
2449
|
if (this.discoveryDoc) {
|
|
2202
|
-
|
|
2450
|
+
log13("Returning cached discovery document");
|
|
2203
2451
|
return this.discoveryDoc;
|
|
2204
2452
|
}
|
|
2205
|
-
const res = await fetch(
|
|
2453
|
+
const res = await fetch(urlJoin4(this.baseUrl, "/.well-known/discovery"));
|
|
2206
2454
|
if (!res.ok) {
|
|
2207
2455
|
throw new Error(await res.text());
|
|
2208
2456
|
}
|
|
2209
2457
|
this.discoveryDoc = await res.json();
|
|
2210
|
-
|
|
2458
|
+
log13("Discovery document successfully fetched");
|
|
2211
2459
|
return this.discoveryDoc;
|
|
2212
2460
|
}
|
|
2213
2461
|
};
|
|
2214
2462
|
|
|
2215
2463
|
// src/market/services/FeedbackService.ts
|
|
2216
|
-
import
|
|
2217
|
-
var
|
|
2464
|
+
import debug14 from "debug";
|
|
2465
|
+
var log14 = debug14("lobe-market-sdk:feedback");
|
|
2218
2466
|
var FeedbackService = class extends BaseSDK {
|
|
2219
2467
|
/**
|
|
2220
2468
|
* Submits user feedback
|
|
@@ -2244,7 +2492,7 @@ var FeedbackService = class extends BaseSDK {
|
|
|
2244
2492
|
* ```
|
|
2245
2493
|
*/
|
|
2246
2494
|
async submitFeedback(data, options) {
|
|
2247
|
-
|
|
2495
|
+
log14("Submitting feedback: %s", data.title);
|
|
2248
2496
|
const result = await this.request("/v1/user/feedback", {
|
|
2249
2497
|
body: JSON.stringify(data),
|
|
2250
2498
|
headers: {
|
|
@@ -2253,14 +2501,14 @@ var FeedbackService = class extends BaseSDK {
|
|
|
2253
2501
|
method: "POST",
|
|
2254
2502
|
...options
|
|
2255
2503
|
});
|
|
2256
|
-
|
|
2504
|
+
log14("Feedback submitted successfully: %s", result.issueId);
|
|
2257
2505
|
return result;
|
|
2258
2506
|
}
|
|
2259
2507
|
};
|
|
2260
2508
|
|
|
2261
2509
|
// src/market/services/PluginsService.ts
|
|
2262
|
-
import
|
|
2263
|
-
var
|
|
2510
|
+
import debug15 from "debug";
|
|
2511
|
+
var log15 = debug15("lobe-market-sdk:plugins");
|
|
2264
2512
|
var PluginsService = class extends BaseSDK {
|
|
2265
2513
|
/**
|
|
2266
2514
|
* Retrieves a list of plugins from the marketplace
|
|
@@ -2275,9 +2523,9 @@ var PluginsService = class extends BaseSDK {
|
|
|
2275
2523
|
const locale = params.locale || this.defaultLocale;
|
|
2276
2524
|
const queryParams = { ...params, locale };
|
|
2277
2525
|
const queryString = this.buildQueryString(queryParams);
|
|
2278
|
-
|
|
2526
|
+
log15("Getting plugin list: %O", queryParams);
|
|
2279
2527
|
const result = await this.request(`/v1/plugins${queryString}`, options);
|
|
2280
|
-
|
|
2528
|
+
log15("Retrieved %d plugins", result.items.length);
|
|
2281
2529
|
return result;
|
|
2282
2530
|
}
|
|
2283
2531
|
/**
|
|
@@ -2295,12 +2543,12 @@ var PluginsService = class extends BaseSDK {
|
|
|
2295
2543
|
const locale = params.locale || this.defaultLocale;
|
|
2296
2544
|
const queryParams = { ...params, locale };
|
|
2297
2545
|
const queryString = this.buildQueryString(queryParams);
|
|
2298
|
-
|
|
2546
|
+
log15("Getting plugin categories: %O", queryParams);
|
|
2299
2547
|
const result = await this.request(
|
|
2300
2548
|
`/v1/plugins/categories${queryString}`,
|
|
2301
2549
|
options
|
|
2302
2550
|
);
|
|
2303
|
-
|
|
2551
|
+
log15("Retrieved %d categories", result.length);
|
|
2304
2552
|
return result;
|
|
2305
2553
|
}
|
|
2306
2554
|
/**
|
|
@@ -2313,12 +2561,12 @@ var PluginsService = class extends BaseSDK {
|
|
|
2313
2561
|
* @returns Promise resolving to an array containing identifiers array and last modified time
|
|
2314
2562
|
*/
|
|
2315
2563
|
async getPublishedIdentifiers(options) {
|
|
2316
|
-
|
|
2564
|
+
log15("Getting published plugin identifiers");
|
|
2317
2565
|
const result = await this.request(
|
|
2318
2566
|
"/v1/plugins/identifiers",
|
|
2319
2567
|
options
|
|
2320
2568
|
);
|
|
2321
|
-
|
|
2569
|
+
log15("Retrieved %d published plugin identifiers", result.length);
|
|
2322
2570
|
return result;
|
|
2323
2571
|
}
|
|
2324
2572
|
/**
|
|
@@ -2338,7 +2586,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2338
2586
|
version,
|
|
2339
2587
|
identifier
|
|
2340
2588
|
}, options) {
|
|
2341
|
-
|
|
2589
|
+
log15("Getting plugin manifest: %O", { identifier, locale, version });
|
|
2342
2590
|
const localeParam = locale || this.defaultLocale;
|
|
2343
2591
|
const params = { locale: localeParam };
|
|
2344
2592
|
if (version) {
|
|
@@ -2349,7 +2597,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2349
2597
|
`/v1/plugins/${identifier}/manifest${queryString}`,
|
|
2350
2598
|
options
|
|
2351
2599
|
);
|
|
2352
|
-
|
|
2600
|
+
log15("Plugin manifest successfully retrieved: %s", identifier);
|
|
2353
2601
|
return manifest;
|
|
2354
2602
|
}
|
|
2355
2603
|
/**
|
|
@@ -2366,7 +2614,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2366
2614
|
version,
|
|
2367
2615
|
identifier
|
|
2368
2616
|
}, options) {
|
|
2369
|
-
|
|
2617
|
+
log15("Getting plugin detail: %O", { identifier, locale, version });
|
|
2370
2618
|
const localeParam = locale || this.defaultLocale;
|
|
2371
2619
|
const params = { locale: localeParam };
|
|
2372
2620
|
if (version) {
|
|
@@ -2377,7 +2625,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2377
2625
|
`/v1/plugins/${identifier}${queryString}`,
|
|
2378
2626
|
options
|
|
2379
2627
|
);
|
|
2380
|
-
|
|
2628
|
+
log15("Plugin manifest successfully retrieved: %s", identifier);
|
|
2381
2629
|
return manifest;
|
|
2382
2630
|
}
|
|
2383
2631
|
/**
|
|
@@ -2392,7 +2640,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2392
2640
|
*
|
|
2393
2641
|
*/
|
|
2394
2642
|
async reportInstallation(reportData) {
|
|
2395
|
-
|
|
2643
|
+
log15("Reporting installation for %s@%s", reportData.identifier, reportData.version);
|
|
2396
2644
|
const result = await this.request("/v1/plugins/report/installation", {
|
|
2397
2645
|
body: JSON.stringify(reportData),
|
|
2398
2646
|
headers: {
|
|
@@ -2400,7 +2648,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2400
2648
|
},
|
|
2401
2649
|
method: "POST"
|
|
2402
2650
|
});
|
|
2403
|
-
|
|
2651
|
+
log15("Installation report submitted successfully: %O", result);
|
|
2404
2652
|
return result;
|
|
2405
2653
|
}
|
|
2406
2654
|
/**
|
|
@@ -2414,7 +2662,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2414
2662
|
* @returns Promise resolving to the report submission response
|
|
2415
2663
|
*/
|
|
2416
2664
|
async reportCall(reportData) {
|
|
2417
|
-
|
|
2665
|
+
log15(
|
|
2418
2666
|
"Reporting call for %s@%s - %s:%s",
|
|
2419
2667
|
reportData.identifier,
|
|
2420
2668
|
reportData.version,
|
|
@@ -2428,7 +2676,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2428
2676
|
},
|
|
2429
2677
|
method: "POST"
|
|
2430
2678
|
});
|
|
2431
|
-
|
|
2679
|
+
log15("Call report submitted successfully: %O", result);
|
|
2432
2680
|
return result;
|
|
2433
2681
|
}
|
|
2434
2682
|
/**
|
|
@@ -2440,7 +2688,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2440
2688
|
* @param options - Optional request init overrides
|
|
2441
2689
|
*/
|
|
2442
2690
|
async createEvent(eventData, options) {
|
|
2443
|
-
|
|
2691
|
+
log15("Recording plugin event: %s for %s", eventData.event, eventData.identifier);
|
|
2444
2692
|
await this.request("/v1/plugins/events", {
|
|
2445
2693
|
body: JSON.stringify(eventData),
|
|
2446
2694
|
headers: {
|
|
@@ -2470,7 +2718,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2470
2718
|
* ```
|
|
2471
2719
|
*/
|
|
2472
2720
|
async callCloudGateway(request, options) {
|
|
2473
|
-
|
|
2721
|
+
log15("Calling cloud gateway for plugin %s, tool %s", request.identifier, request.toolName);
|
|
2474
2722
|
const result = await this.request("/v1/plugins/cloud-gateway", {
|
|
2475
2723
|
body: JSON.stringify(request),
|
|
2476
2724
|
headers: {
|
|
@@ -2479,7 +2727,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2479
2727
|
method: "POST",
|
|
2480
2728
|
...options
|
|
2481
2729
|
});
|
|
2482
|
-
|
|
2730
|
+
log15("Cloud gateway call completed: %O", {
|
|
2483
2731
|
identifier: request.identifier,
|
|
2484
2732
|
isError: result.isError,
|
|
2485
2733
|
toolName: request.toolName
|
|
@@ -2520,7 +2768,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2520
2768
|
* ```
|
|
2521
2769
|
*/
|
|
2522
2770
|
async runBuildInTool(toolName, params, context, options) {
|
|
2523
|
-
|
|
2771
|
+
log15(
|
|
2524
2772
|
"Running built-in tool: %s for user %s, topic %s",
|
|
2525
2773
|
toolName,
|
|
2526
2774
|
context.userId,
|
|
@@ -2539,7 +2787,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2539
2787
|
method: "POST",
|
|
2540
2788
|
...options
|
|
2541
2789
|
});
|
|
2542
|
-
|
|
2790
|
+
log15("Built-in tool execution completed: %O", {
|
|
2543
2791
|
success: result.success,
|
|
2544
2792
|
toolName
|
|
2545
2793
|
});
|
|
@@ -2642,9 +2890,134 @@ var PluginsService = class extends BaseSDK {
|
|
|
2642
2890
|
}
|
|
2643
2891
|
};
|
|
2644
2892
|
|
|
2893
|
+
// src/market/services/SkillService.ts
|
|
2894
|
+
import debug16 from "debug";
|
|
2895
|
+
var log16 = debug16("lobe-market-sdk:skill");
|
|
2896
|
+
var SkillService = class extends BaseSDK {
|
|
2897
|
+
/**
|
|
2898
|
+
* Lists all available skill providers
|
|
2899
|
+
*
|
|
2900
|
+
* Returns a list of providers that can be connected via OAuth.
|
|
2901
|
+
* This is a public endpoint that doesn't require authentication.
|
|
2902
|
+
*
|
|
2903
|
+
* @param options - Optional request options
|
|
2904
|
+
* @returns Promise resolving to the list of available providers
|
|
2905
|
+
*/
|
|
2906
|
+
async listProviders(options) {
|
|
2907
|
+
var _a;
|
|
2908
|
+
log16("Listing skill providers");
|
|
2909
|
+
const result = await this.request("/v1/skill/providers", options);
|
|
2910
|
+
log16("Found %d skill providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
|
|
2911
|
+
return result;
|
|
2912
|
+
}
|
|
2913
|
+
/**
|
|
2914
|
+
* Lists available tools for a specific provider
|
|
2915
|
+
*
|
|
2916
|
+
* Returns the tools/functions that can be called on the provider.
|
|
2917
|
+
* This is a public endpoint that doesn't require authentication.
|
|
2918
|
+
*
|
|
2919
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2920
|
+
* @param options - Optional request options
|
|
2921
|
+
* @returns Promise resolving to the list of available tools
|
|
2922
|
+
*/
|
|
2923
|
+
async listTools(provider, options) {
|
|
2924
|
+
var _a;
|
|
2925
|
+
log16("Listing tools for provider: %s", provider);
|
|
2926
|
+
const result = await this.request(
|
|
2927
|
+
`/v1/skill/${encodeURIComponent(provider)}/tools`,
|
|
2928
|
+
options
|
|
2929
|
+
);
|
|
2930
|
+
log16("Found %d tools for provider %s", ((_a = result.tools) == null ? void 0 : _a.length) || 0, provider);
|
|
2931
|
+
return result;
|
|
2932
|
+
}
|
|
2933
|
+
/**
|
|
2934
|
+
* Gets details of a specific tool
|
|
2935
|
+
*
|
|
2936
|
+
* Returns detailed information about a tool including its input schema.
|
|
2937
|
+
* This is a public endpoint that doesn't require authentication.
|
|
2938
|
+
*
|
|
2939
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2940
|
+
* @param toolName - The name of the tool
|
|
2941
|
+
* @param options - Optional request options
|
|
2942
|
+
* @returns Promise resolving to the tool details
|
|
2943
|
+
*/
|
|
2944
|
+
async getTool(provider, toolName, options) {
|
|
2945
|
+
var _a;
|
|
2946
|
+
log16("Getting tool %s from provider %s", toolName, provider);
|
|
2947
|
+
const result = await this.request(
|
|
2948
|
+
`/v1/skill/${encodeURIComponent(provider)}/tool/${encodeURIComponent(toolName)}`,
|
|
2949
|
+
options
|
|
2950
|
+
);
|
|
2951
|
+
log16("Retrieved tool: %s", (_a = result.tool) == null ? void 0 : _a.name);
|
|
2952
|
+
return result;
|
|
2953
|
+
}
|
|
2954
|
+
/**
|
|
2955
|
+
* Gets the connection status for a provider
|
|
2956
|
+
*
|
|
2957
|
+
* Checks if the authenticated user has an active OAuth connection to the provider.
|
|
2958
|
+
* Requires authentication.
|
|
2959
|
+
*
|
|
2960
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2961
|
+
* @param options - Optional request options (must include authentication)
|
|
2962
|
+
* @returns Promise resolving to the connection status
|
|
2963
|
+
*/
|
|
2964
|
+
async getStatus(provider, options) {
|
|
2965
|
+
log16("Getting status for provider: %s", provider);
|
|
2966
|
+
const result = await this.request(
|
|
2967
|
+
`/v1/skill/${encodeURIComponent(provider)}/status`,
|
|
2968
|
+
options
|
|
2969
|
+
);
|
|
2970
|
+
log16("Provider %s status: connected=%s", provider, result.connected);
|
|
2971
|
+
return result;
|
|
2972
|
+
}
|
|
2973
|
+
/**
|
|
2974
|
+
* Calls a tool on a connected provider
|
|
2975
|
+
*
|
|
2976
|
+
* Executes a tool/function on the provider using the user's OAuth connection.
|
|
2977
|
+
* Requires authentication and an active OAuth connection to the provider.
|
|
2978
|
+
*
|
|
2979
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2980
|
+
* @param params - The tool call parameters (tool name and arguments)
|
|
2981
|
+
* @param options - Optional request options (must include authentication)
|
|
2982
|
+
* @returns Promise resolving to the tool call result
|
|
2983
|
+
*
|
|
2984
|
+
* @example
|
|
2985
|
+
* ```typescript
|
|
2986
|
+
* // Create a Linear issue
|
|
2987
|
+
* const result = await sdk.skills.callTool('linear', {
|
|
2988
|
+
* tool: 'create_issue',
|
|
2989
|
+
* args: {
|
|
2990
|
+
* title: 'New feature request',
|
|
2991
|
+
* team: 'Engineering',
|
|
2992
|
+
* description: 'We need to implement...'
|
|
2993
|
+
* }
|
|
2994
|
+
* });
|
|
2995
|
+
* ```
|
|
2996
|
+
*/
|
|
2997
|
+
async callTool(provider, params, options) {
|
|
2998
|
+
log16("Calling tool %s on provider %s", params.tool, provider);
|
|
2999
|
+
const result = await this.request(
|
|
3000
|
+
`/v1/skill/${encodeURIComponent(provider)}/call`,
|
|
3001
|
+
{
|
|
3002
|
+
body: JSON.stringify({
|
|
3003
|
+
args: params.args || {},
|
|
3004
|
+
tool: params.tool
|
|
3005
|
+
}),
|
|
3006
|
+
headers: {
|
|
3007
|
+
"Content-Type": "application/json"
|
|
3008
|
+
},
|
|
3009
|
+
method: "POST",
|
|
3010
|
+
...options
|
|
3011
|
+
}
|
|
3012
|
+
);
|
|
3013
|
+
log16("Tool %s call completed: success=%s", params.tool, result.success);
|
|
3014
|
+
return result;
|
|
3015
|
+
}
|
|
3016
|
+
};
|
|
3017
|
+
|
|
2645
3018
|
// src/market/services/UserService.ts
|
|
2646
|
-
import
|
|
2647
|
-
var
|
|
3019
|
+
import debug17 from "debug";
|
|
3020
|
+
var log17 = debug17("lobe-market-sdk:user");
|
|
2648
3021
|
var UserService = class extends BaseSDK {
|
|
2649
3022
|
/**
|
|
2650
3023
|
* Retrieves user information by account ID or userName
|
|
@@ -2661,12 +3034,12 @@ var UserService = class extends BaseSDK {
|
|
|
2661
3034
|
const locale = params.locale || this.defaultLocale;
|
|
2662
3035
|
const queryParams = { locale };
|
|
2663
3036
|
const queryString = this.buildQueryString(queryParams);
|
|
2664
|
-
|
|
3037
|
+
log17("Getting user info: %O", { idOrUserName, ...params });
|
|
2665
3038
|
const result = await this.request(
|
|
2666
3039
|
`/v1/user/info/${idOrUserName}${queryString}`,
|
|
2667
3040
|
options
|
|
2668
3041
|
);
|
|
2669
|
-
|
|
3042
|
+
log17("User info successfully retrieved for: %s", idOrUserName);
|
|
2670
3043
|
return result;
|
|
2671
3044
|
}
|
|
2672
3045
|
/**
|
|
@@ -2681,7 +3054,7 @@ var UserService = class extends BaseSDK {
|
|
|
2681
3054
|
* @throws Error if userName is already taken or update fails
|
|
2682
3055
|
*/
|
|
2683
3056
|
async updateUserInfo(data, options) {
|
|
2684
|
-
|
|
3057
|
+
log17("Updating user info: %O", data);
|
|
2685
3058
|
const result = await this.request("/v1/user/update", {
|
|
2686
3059
|
body: JSON.stringify(data),
|
|
2687
3060
|
headers: {
|
|
@@ -2690,14 +3063,14 @@ var UserService = class extends BaseSDK {
|
|
|
2690
3063
|
method: "POST",
|
|
2691
3064
|
...options
|
|
2692
3065
|
});
|
|
2693
|
-
|
|
3066
|
+
log17("User info updated successfully");
|
|
2694
3067
|
return result;
|
|
2695
3068
|
}
|
|
2696
3069
|
};
|
|
2697
3070
|
|
|
2698
3071
|
// src/market/services/UserFollowService.ts
|
|
2699
|
-
import
|
|
2700
|
-
var
|
|
3072
|
+
import debug18 from "debug";
|
|
3073
|
+
var log18 = debug18("lobe-market-sdk:user-follow");
|
|
2701
3074
|
var UserFollowService = class extends BaseSDK {
|
|
2702
3075
|
/**
|
|
2703
3076
|
* Follow a user
|
|
@@ -2711,7 +3084,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2711
3084
|
* @throws Error if already following or cannot follow yourself
|
|
2712
3085
|
*/
|
|
2713
3086
|
async follow(followingId, options) {
|
|
2714
|
-
|
|
3087
|
+
log18("Following user: %d", followingId);
|
|
2715
3088
|
const body = { followingId };
|
|
2716
3089
|
const result = await this.request("/v1/user/follows", {
|
|
2717
3090
|
body: JSON.stringify(body),
|
|
@@ -2721,7 +3094,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2721
3094
|
method: "POST",
|
|
2722
3095
|
...options
|
|
2723
3096
|
});
|
|
2724
|
-
|
|
3097
|
+
log18("Successfully followed user: %d", followingId);
|
|
2725
3098
|
return result;
|
|
2726
3099
|
}
|
|
2727
3100
|
/**
|
|
@@ -2736,7 +3109,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2736
3109
|
* @throws Error if follow relationship not found
|
|
2737
3110
|
*/
|
|
2738
3111
|
async unfollow(followingId, options) {
|
|
2739
|
-
|
|
3112
|
+
log18("Unfollowing user: %d", followingId);
|
|
2740
3113
|
const body = { followingId };
|
|
2741
3114
|
const result = await this.request("/v1/user/follows", {
|
|
2742
3115
|
body: JSON.stringify(body),
|
|
@@ -2746,7 +3119,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2746
3119
|
method: "DELETE",
|
|
2747
3120
|
...options
|
|
2748
3121
|
});
|
|
2749
|
-
|
|
3122
|
+
log18("Successfully unfollowed user: %d", followingId);
|
|
2750
3123
|
return result;
|
|
2751
3124
|
}
|
|
2752
3125
|
/**
|
|
@@ -2760,13 +3133,13 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2760
3133
|
* @returns Promise resolving to follow status (isFollowing, isMutual)
|
|
2761
3134
|
*/
|
|
2762
3135
|
async checkFollowStatus(targetUserId, options) {
|
|
2763
|
-
|
|
3136
|
+
log18("Checking follow status for user: %d", targetUserId);
|
|
2764
3137
|
const queryString = this.buildQueryString({ targetUserId: String(targetUserId) });
|
|
2765
3138
|
const result = await this.request(
|
|
2766
3139
|
`/v1/user/follows/check${queryString}`,
|
|
2767
3140
|
options
|
|
2768
3141
|
);
|
|
2769
|
-
|
|
3142
|
+
log18("Follow status retrieved: %O", result);
|
|
2770
3143
|
return result;
|
|
2771
3144
|
}
|
|
2772
3145
|
/**
|
|
@@ -2781,7 +3154,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2781
3154
|
* @returns Promise resolving to list of following users
|
|
2782
3155
|
*/
|
|
2783
3156
|
async getFollowing(userId, params = {}, options) {
|
|
2784
|
-
|
|
3157
|
+
log18("Getting following list for user: %d", userId);
|
|
2785
3158
|
const queryParams = {};
|
|
2786
3159
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
2787
3160
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -2790,7 +3163,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2790
3163
|
`/v1/user/follows/${userId}/following${queryString}`,
|
|
2791
3164
|
options
|
|
2792
3165
|
);
|
|
2793
|
-
|
|
3166
|
+
log18("Following list retrieved for user: %d", userId);
|
|
2794
3167
|
return result;
|
|
2795
3168
|
}
|
|
2796
3169
|
/**
|
|
@@ -2805,7 +3178,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2805
3178
|
* @returns Promise resolving to list of followers
|
|
2806
3179
|
*/
|
|
2807
3180
|
async getFollowers(userId, params = {}, options) {
|
|
2808
|
-
|
|
3181
|
+
log18("Getting followers list for user: %d", userId);
|
|
2809
3182
|
const queryParams = {};
|
|
2810
3183
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
2811
3184
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -2814,14 +3187,14 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2814
3187
|
`/v1/user/follows/${userId}/followers${queryString}`,
|
|
2815
3188
|
options
|
|
2816
3189
|
);
|
|
2817
|
-
|
|
3190
|
+
log18("Followers list retrieved for user: %d", userId);
|
|
2818
3191
|
return result;
|
|
2819
3192
|
}
|
|
2820
3193
|
};
|
|
2821
3194
|
|
|
2822
3195
|
// src/market/services/UserFavoriteService.ts
|
|
2823
|
-
import
|
|
2824
|
-
var
|
|
3196
|
+
import debug19 from "debug";
|
|
3197
|
+
var log19 = debug19("lobe-market-sdk:user-favorite");
|
|
2825
3198
|
var UserFavoriteService = class extends BaseSDK {
|
|
2826
3199
|
/**
|
|
2827
3200
|
* Add to favorites
|
|
@@ -2836,7 +3209,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2836
3209
|
* @throws Error if already in favorites
|
|
2837
3210
|
*/
|
|
2838
3211
|
async addFavorite(targetType, targetId, options) {
|
|
2839
|
-
|
|
3212
|
+
log19("Adding favorite: %s %d", targetType, targetId);
|
|
2840
3213
|
const body = { targetId, targetType };
|
|
2841
3214
|
const result = await this.request("/v1/user/favorites", {
|
|
2842
3215
|
body: JSON.stringify(body),
|
|
@@ -2846,7 +3219,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2846
3219
|
method: "POST",
|
|
2847
3220
|
...options
|
|
2848
3221
|
});
|
|
2849
|
-
|
|
3222
|
+
log19("Successfully added favorite: %s %d", targetType, targetId);
|
|
2850
3223
|
return result;
|
|
2851
3224
|
}
|
|
2852
3225
|
/**
|
|
@@ -2862,7 +3235,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2862
3235
|
* @throws Error if favorite not found
|
|
2863
3236
|
*/
|
|
2864
3237
|
async removeFavorite(targetType, targetId, options) {
|
|
2865
|
-
|
|
3238
|
+
log19("Removing favorite: %s %d", targetType, targetId);
|
|
2866
3239
|
const body = { targetId, targetType };
|
|
2867
3240
|
const result = await this.request("/v1/user/favorites", {
|
|
2868
3241
|
body: JSON.stringify(body),
|
|
@@ -2872,7 +3245,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2872
3245
|
method: "DELETE",
|
|
2873
3246
|
...options
|
|
2874
3247
|
});
|
|
2875
|
-
|
|
3248
|
+
log19("Successfully removed favorite: %s %d", targetType, targetId);
|
|
2876
3249
|
return result;
|
|
2877
3250
|
}
|
|
2878
3251
|
/**
|
|
@@ -2887,7 +3260,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2887
3260
|
* @returns Promise resolving to favorite status
|
|
2888
3261
|
*/
|
|
2889
3262
|
async checkFavorite(targetType, targetId, options) {
|
|
2890
|
-
|
|
3263
|
+
log19("Checking favorite status: %s %d", targetType, targetId);
|
|
2891
3264
|
const queryString = this.buildQueryString({
|
|
2892
3265
|
targetId: String(targetId),
|
|
2893
3266
|
targetType
|
|
@@ -2896,7 +3269,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2896
3269
|
`/v1/user/favorites/check${queryString}`,
|
|
2897
3270
|
options
|
|
2898
3271
|
);
|
|
2899
|
-
|
|
3272
|
+
log19("Favorite status retrieved: %O", result);
|
|
2900
3273
|
return result;
|
|
2901
3274
|
}
|
|
2902
3275
|
/**
|
|
@@ -2910,7 +3283,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2910
3283
|
* @returns Promise resolving to list of favorites
|
|
2911
3284
|
*/
|
|
2912
3285
|
async getMyFavorites(params = {}, options) {
|
|
2913
|
-
|
|
3286
|
+
log19("Getting my favorites: %O", params);
|
|
2914
3287
|
const queryParams = {};
|
|
2915
3288
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
2916
3289
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -2920,7 +3293,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2920
3293
|
`/v1/user/favorites/me${queryString}`,
|
|
2921
3294
|
options
|
|
2922
3295
|
);
|
|
2923
|
-
|
|
3296
|
+
log19("My favorites retrieved");
|
|
2924
3297
|
return result;
|
|
2925
3298
|
}
|
|
2926
3299
|
/**
|
|
@@ -2935,7 +3308,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2935
3308
|
* @returns Promise resolving to list of favorites
|
|
2936
3309
|
*/
|
|
2937
3310
|
async getUserFavorites(userId, params = {}, options) {
|
|
2938
|
-
|
|
3311
|
+
log19("Getting favorites for user: %d", userId);
|
|
2939
3312
|
const queryParams = {};
|
|
2940
3313
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
2941
3314
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -2945,7 +3318,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2945
3318
|
`/v1/user/favorites/${userId}${queryString}`,
|
|
2946
3319
|
options
|
|
2947
3320
|
);
|
|
2948
|
-
|
|
3321
|
+
log19("Favorites retrieved for user: %d", userId);
|
|
2949
3322
|
return result;
|
|
2950
3323
|
}
|
|
2951
3324
|
/**
|
|
@@ -2960,7 +3333,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2960
3333
|
* @returns Promise resolving to list of favorite agents
|
|
2961
3334
|
*/
|
|
2962
3335
|
async getUserFavoriteAgents(userId, params = {}, options) {
|
|
2963
|
-
|
|
3336
|
+
log19("Getting favorite agents for user: %d", userId);
|
|
2964
3337
|
const queryParams = {};
|
|
2965
3338
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
2966
3339
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -2969,7 +3342,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2969
3342
|
`/v1/user/favorites/${userId}/agents${queryString}`,
|
|
2970
3343
|
options
|
|
2971
3344
|
);
|
|
2972
|
-
|
|
3345
|
+
log19("Favorite agents retrieved for user: %d", userId);
|
|
2973
3346
|
return result;
|
|
2974
3347
|
}
|
|
2975
3348
|
/**
|
|
@@ -2984,7 +3357,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2984
3357
|
* @returns Promise resolving to list of favorite plugins
|
|
2985
3358
|
*/
|
|
2986
3359
|
async getUserFavoritePlugins(userId, params = {}, options) {
|
|
2987
|
-
|
|
3360
|
+
log19("Getting favorite plugins for user: %d", userId);
|
|
2988
3361
|
const queryParams = {};
|
|
2989
3362
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
2990
3363
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -2993,14 +3366,14 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2993
3366
|
`/v1/user/favorites/${userId}/plugins${queryString}`,
|
|
2994
3367
|
options
|
|
2995
3368
|
);
|
|
2996
|
-
|
|
3369
|
+
log19("Favorite plugins retrieved for user: %d", userId);
|
|
2997
3370
|
return result;
|
|
2998
3371
|
}
|
|
2999
3372
|
};
|
|
3000
3373
|
|
|
3001
3374
|
// src/market/services/UserLikeService.ts
|
|
3002
|
-
import
|
|
3003
|
-
var
|
|
3375
|
+
import debug20 from "debug";
|
|
3376
|
+
var log20 = debug20("lobe-market-sdk:user-like");
|
|
3004
3377
|
var UserLikeService = class extends BaseSDK {
|
|
3005
3378
|
/**
|
|
3006
3379
|
* Like content
|
|
@@ -3015,7 +3388,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3015
3388
|
* @throws Error if already liked
|
|
3016
3389
|
*/
|
|
3017
3390
|
async like(targetType, targetId, options) {
|
|
3018
|
-
|
|
3391
|
+
log20("Liking: %s %d", targetType, targetId);
|
|
3019
3392
|
const body = { targetId, targetType };
|
|
3020
3393
|
const result = await this.request("/v1/user/likes", {
|
|
3021
3394
|
body: JSON.stringify(body),
|
|
@@ -3025,7 +3398,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3025
3398
|
method: "POST",
|
|
3026
3399
|
...options
|
|
3027
3400
|
});
|
|
3028
|
-
|
|
3401
|
+
log20("Successfully liked: %s %d", targetType, targetId);
|
|
3029
3402
|
return result;
|
|
3030
3403
|
}
|
|
3031
3404
|
/**
|
|
@@ -3041,7 +3414,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3041
3414
|
* @throws Error if like not found
|
|
3042
3415
|
*/
|
|
3043
3416
|
async unlike(targetType, targetId, options) {
|
|
3044
|
-
|
|
3417
|
+
log20("Unliking: %s %d", targetType, targetId);
|
|
3045
3418
|
const body = { targetId, targetType };
|
|
3046
3419
|
const result = await this.request("/v1/user/likes", {
|
|
3047
3420
|
body: JSON.stringify(body),
|
|
@@ -3051,7 +3424,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3051
3424
|
method: "DELETE",
|
|
3052
3425
|
...options
|
|
3053
3426
|
});
|
|
3054
|
-
|
|
3427
|
+
log20("Successfully unliked: %s %d", targetType, targetId);
|
|
3055
3428
|
return result;
|
|
3056
3429
|
}
|
|
3057
3430
|
/**
|
|
@@ -3066,7 +3439,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3066
3439
|
* @returns Promise resolving to toggle response with new like status
|
|
3067
3440
|
*/
|
|
3068
3441
|
async toggleLike(targetType, targetId, options) {
|
|
3069
|
-
|
|
3442
|
+
log20("Toggling like: %s %d", targetType, targetId);
|
|
3070
3443
|
const body = { targetId, targetType };
|
|
3071
3444
|
const result = await this.request("/v1/user/likes/toggle", {
|
|
3072
3445
|
body: JSON.stringify(body),
|
|
@@ -3076,7 +3449,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3076
3449
|
method: "POST",
|
|
3077
3450
|
...options
|
|
3078
3451
|
});
|
|
3079
|
-
|
|
3452
|
+
log20("Like toggled, new status: %O", result);
|
|
3080
3453
|
return result;
|
|
3081
3454
|
}
|
|
3082
3455
|
/**
|
|
@@ -3091,7 +3464,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3091
3464
|
* @returns Promise resolving to like status
|
|
3092
3465
|
*/
|
|
3093
3466
|
async checkLike(targetType, targetId, options) {
|
|
3094
|
-
|
|
3467
|
+
log20("Checking like status: %s %d", targetType, targetId);
|
|
3095
3468
|
const queryString = this.buildQueryString({
|
|
3096
3469
|
targetId: String(targetId),
|
|
3097
3470
|
targetType
|
|
@@ -3100,7 +3473,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3100
3473
|
`/v1/user/likes/check${queryString}`,
|
|
3101
3474
|
options
|
|
3102
3475
|
);
|
|
3103
|
-
|
|
3476
|
+
log20("Like status retrieved: %O", result);
|
|
3104
3477
|
return result;
|
|
3105
3478
|
}
|
|
3106
3479
|
/**
|
|
@@ -3114,7 +3487,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3114
3487
|
* @returns Promise resolving to list of likes
|
|
3115
3488
|
*/
|
|
3116
3489
|
async getMyLikes(params = {}, options) {
|
|
3117
|
-
|
|
3490
|
+
log20("Getting my likes: %O", params);
|
|
3118
3491
|
const queryParams = {};
|
|
3119
3492
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3120
3493
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3124,7 +3497,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3124
3497
|
`/v1/user/likes/me${queryString}`,
|
|
3125
3498
|
options
|
|
3126
3499
|
);
|
|
3127
|
-
|
|
3500
|
+
log20("My likes retrieved");
|
|
3128
3501
|
return result;
|
|
3129
3502
|
}
|
|
3130
3503
|
/**
|
|
@@ -3139,7 +3512,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3139
3512
|
* @returns Promise resolving to list of likes
|
|
3140
3513
|
*/
|
|
3141
3514
|
async getUserLikes(userId, params = {}, options) {
|
|
3142
|
-
|
|
3515
|
+
log20("Getting likes for user: %d", userId);
|
|
3143
3516
|
const queryParams = {};
|
|
3144
3517
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3145
3518
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3149,7 +3522,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3149
3522
|
`/v1/user/likes/${userId}${queryString}`,
|
|
3150
3523
|
options
|
|
3151
3524
|
);
|
|
3152
|
-
|
|
3525
|
+
log20("Likes retrieved for user: %d", userId);
|
|
3153
3526
|
return result;
|
|
3154
3527
|
}
|
|
3155
3528
|
/**
|
|
@@ -3164,7 +3537,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3164
3537
|
* @returns Promise resolving to list of liked agents
|
|
3165
3538
|
*/
|
|
3166
3539
|
async getUserLikedAgents(userId, params = {}, options) {
|
|
3167
|
-
|
|
3540
|
+
log20("Getting liked agents for user: %d", userId);
|
|
3168
3541
|
const queryParams = {};
|
|
3169
3542
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3170
3543
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3173,7 +3546,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3173
3546
|
`/v1/user/likes/${userId}/agents${queryString}`,
|
|
3174
3547
|
options
|
|
3175
3548
|
);
|
|
3176
|
-
|
|
3549
|
+
log20("Liked agents retrieved for user: %d", userId);
|
|
3177
3550
|
return result;
|
|
3178
3551
|
}
|
|
3179
3552
|
/**
|
|
@@ -3188,7 +3561,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3188
3561
|
* @returns Promise resolving to list of liked plugins
|
|
3189
3562
|
*/
|
|
3190
3563
|
async getUserLikedPlugins(userId, params = {}, options) {
|
|
3191
|
-
|
|
3564
|
+
log20("Getting liked plugins for user: %d", userId);
|
|
3192
3565
|
const queryParams = {};
|
|
3193
3566
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3194
3567
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3197,13 +3570,13 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3197
3570
|
`/v1/user/likes/${userId}/plugins${queryString}`,
|
|
3198
3571
|
options
|
|
3199
3572
|
);
|
|
3200
|
-
|
|
3573
|
+
log20("Liked plugins retrieved for user: %d", userId);
|
|
3201
3574
|
return result;
|
|
3202
3575
|
}
|
|
3203
3576
|
};
|
|
3204
3577
|
|
|
3205
3578
|
// src/market/market-sdk.ts
|
|
3206
|
-
var
|
|
3579
|
+
var log21 = debug21("lobe-market-sdk");
|
|
3207
3580
|
var MarketSDK = class extends BaseSDK {
|
|
3208
3581
|
/**
|
|
3209
3582
|
* Creates a new MarketSDK instance
|
|
@@ -3216,15 +3589,17 @@ var MarketSDK = class extends BaseSDK {
|
|
|
3216
3589
|
tokenExpiry: void 0
|
|
3217
3590
|
};
|
|
3218
3591
|
super(options, void 0, sharedTokenState);
|
|
3219
|
-
|
|
3592
|
+
log21("MarketSDK instance created");
|
|
3220
3593
|
this.agents = new AgentService2(options, this.headers, sharedTokenState);
|
|
3221
3594
|
this.auth = new AuthService(options, this.headers, sharedTokenState);
|
|
3595
|
+
this.connect = new ConnectService(options, this.headers, sharedTokenState);
|
|
3222
3596
|
this.plugins = new PluginsService(options, this.headers, sharedTokenState);
|
|
3223
3597
|
this.user = new UserService(options, this.headers, sharedTokenState);
|
|
3224
3598
|
this.follows = new UserFollowService(options, this.headers, sharedTokenState);
|
|
3225
3599
|
this.favorites = new UserFavoriteService(options, this.headers, sharedTokenState);
|
|
3226
3600
|
this.likes = new UserLikeService(options, this.headers, sharedTokenState);
|
|
3227
3601
|
this.feedback = new FeedbackService(options, this.headers, sharedTokenState);
|
|
3602
|
+
this.skills = new SkillService(options, this.headers, sharedTokenState);
|
|
3228
3603
|
this.discovery = new DiscoveryService(options, this.headers, sharedTokenState);
|
|
3229
3604
|
}
|
|
3230
3605
|
/**
|
|
@@ -3251,7 +3626,7 @@ var MarketSDK = class extends BaseSDK {
|
|
|
3251
3626
|
* @deprecated Use auth.registerClient() instead
|
|
3252
3627
|
*/
|
|
3253
3628
|
async registerClient(request) {
|
|
3254
|
-
|
|
3629
|
+
log21("Registering client (deprecated method, use auth.registerClient): %s", request.clientName);
|
|
3255
3630
|
return this.auth.registerClient(request);
|
|
3256
3631
|
}
|
|
3257
3632
|
};
|