@lobehub/market-sdk 0.27.3 → 0.28.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 +785 -1
- package/dist/index.mjs +465 -87
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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,261 @@ _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(
|
|
2301
|
+
"Generating authorize URL for provider: %s (deprecated, use authorize() instead)",
|
|
2302
|
+
provider
|
|
2303
|
+
);
|
|
2304
|
+
const queryParams = new URLSearchParams();
|
|
2305
|
+
if ((params == null ? void 0 : params.scopes) && params.scopes.length > 0) {
|
|
2306
|
+
queryParams.set("scope", params.scopes.join(","));
|
|
2307
|
+
}
|
|
2308
|
+
if (params == null ? void 0 : params.redirectUri) {
|
|
2309
|
+
queryParams.set("redirect_uri", params.redirectUri);
|
|
2310
|
+
}
|
|
2311
|
+
const queryString = queryParams.toString();
|
|
2312
|
+
const path = `/connect/${encodeURIComponent(provider)}/start${queryString ? `?${queryString}` : ""}`;
|
|
2313
|
+
const url = urlJoin3(this.baseUrl, "api", path);
|
|
2314
|
+
log12("Generated authorize URL: %s", url);
|
|
2315
|
+
return url;
|
|
2316
|
+
}
|
|
2317
|
+
/**
|
|
2318
|
+
* Gets the connection status for a specific provider
|
|
2319
|
+
*
|
|
2320
|
+
* Checks if the authenticated user has an active OAuth connection.
|
|
2321
|
+
* Requires authentication.
|
|
2322
|
+
*
|
|
2323
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2324
|
+
* @param options - Optional request options (must include authentication)
|
|
2325
|
+
* @returns Promise resolving to the connection status
|
|
2326
|
+
*/
|
|
2327
|
+
async getStatus(provider, options) {
|
|
2328
|
+
log12("Getting connection status for provider: %s", provider);
|
|
2329
|
+
const result = await this.request(
|
|
2330
|
+
`/connect/${encodeURIComponent(provider)}/status`,
|
|
2331
|
+
options
|
|
2332
|
+
);
|
|
2333
|
+
log12("Provider %s connection status: connected=%s", provider, result.connected);
|
|
2334
|
+
return result;
|
|
2335
|
+
}
|
|
2336
|
+
/**
|
|
2337
|
+
* Lists all OAuth connections for the authenticated user
|
|
2338
|
+
*
|
|
2339
|
+
* Requires authentication.
|
|
2340
|
+
*
|
|
2341
|
+
* @param options - Optional request options (must include authentication)
|
|
2342
|
+
* @returns Promise resolving to the list of connections
|
|
2343
|
+
*/
|
|
2344
|
+
async listConnections(options) {
|
|
2345
|
+
var _a;
|
|
2346
|
+
log12("Listing user connections");
|
|
2347
|
+
const result = await this.request("/connect/connections", options);
|
|
2348
|
+
log12("Found %d connections", ((_a = result.connections) == null ? void 0 : _a.length) || 0);
|
|
2349
|
+
return result;
|
|
2350
|
+
}
|
|
2351
|
+
/**
|
|
2352
|
+
* Checks the health of a specific provider connection
|
|
2353
|
+
*
|
|
2354
|
+
* Verifies if the token is valid, expiring soon, or expired.
|
|
2355
|
+
* Requires authentication.
|
|
2356
|
+
*
|
|
2357
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2358
|
+
* @param options - Optional request options (must include authentication)
|
|
2359
|
+
* @returns Promise resolving to the connection health status
|
|
2360
|
+
*/
|
|
2361
|
+
async getHealth(provider, options) {
|
|
2362
|
+
log12("Checking health for provider: %s", provider);
|
|
2363
|
+
const result = await this.request(
|
|
2364
|
+
`/connect/${encodeURIComponent(provider)}/health`,
|
|
2365
|
+
options
|
|
2366
|
+
);
|
|
2367
|
+
log12("Provider %s health: healthy=%s, status=%s", provider, result.healthy, result.tokenStatus);
|
|
2368
|
+
return result;
|
|
2369
|
+
}
|
|
2370
|
+
/**
|
|
2371
|
+
* Checks the health of all provider connections
|
|
2372
|
+
*
|
|
2373
|
+
* Requires authentication.
|
|
2374
|
+
*
|
|
2375
|
+
* @param options - Optional request options (must include authentication)
|
|
2376
|
+
* @returns Promise resolving to the health status of all connections
|
|
2377
|
+
*/
|
|
2378
|
+
async getAllHealth(options) {
|
|
2379
|
+
var _a, _b, _c;
|
|
2380
|
+
log12("Checking health for all connections");
|
|
2381
|
+
const result = await this.request("/connect/health", options);
|
|
2382
|
+
log12(
|
|
2383
|
+
"Health check complete: total=%d, healthy=%d, unhealthy=%d",
|
|
2384
|
+
((_a = result.summary) == null ? void 0 : _a.total) || 0,
|
|
2385
|
+
((_b = result.summary) == null ? void 0 : _b.healthy) || 0,
|
|
2386
|
+
((_c = result.summary) == null ? void 0 : _c.unhealthy) || 0
|
|
2387
|
+
);
|
|
2388
|
+
return result;
|
|
2389
|
+
}
|
|
2390
|
+
/**
|
|
2391
|
+
* Manually refreshes the access token for a provider connection
|
|
2392
|
+
*
|
|
2393
|
+
* Only works for providers that support token refresh.
|
|
2394
|
+
* Requires authentication.
|
|
2395
|
+
*
|
|
2396
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2397
|
+
* @param options - Optional request options (must include authentication)
|
|
2398
|
+
* @returns Promise resolving to the refresh result
|
|
2399
|
+
*/
|
|
2400
|
+
async refresh(provider, options) {
|
|
2401
|
+
log12("Refreshing token for provider: %s", provider);
|
|
2402
|
+
const result = await this.request(
|
|
2403
|
+
`/connect/${encodeURIComponent(provider)}/refresh`,
|
|
2404
|
+
{
|
|
2405
|
+
method: "POST",
|
|
2406
|
+
...options
|
|
2407
|
+
}
|
|
2408
|
+
);
|
|
2409
|
+
log12("Token refresh for %s: refreshed=%s", provider, result.refreshed);
|
|
2410
|
+
return result;
|
|
2411
|
+
}
|
|
2412
|
+
/**
|
|
2413
|
+
* Revokes/disconnects a provider connection
|
|
2414
|
+
*
|
|
2415
|
+
* Removes the OAuth connection and deletes stored tokens.
|
|
2416
|
+
* Requires authentication.
|
|
2417
|
+
*
|
|
2418
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2419
|
+
* @param options - Optional request options (must include authentication)
|
|
2420
|
+
* @returns Promise resolving to the revoke result
|
|
2421
|
+
*/
|
|
2422
|
+
async revoke(provider, options) {
|
|
2423
|
+
log12("Revoking connection for provider: %s", provider);
|
|
2424
|
+
const result = await this.request(
|
|
2425
|
+
`/connect/${encodeURIComponent(provider)}`,
|
|
2426
|
+
{
|
|
2427
|
+
method: "DELETE",
|
|
2428
|
+
...options
|
|
2429
|
+
}
|
|
2430
|
+
);
|
|
2431
|
+
log12("Connection revoked for %s: success=%s", provider, result.success);
|
|
2432
|
+
return result;
|
|
2433
|
+
}
|
|
2434
|
+
};
|
|
2435
|
+
|
|
2436
|
+
// src/market/services/DiscoveryService.ts
|
|
2437
|
+
import debug13 from "debug";
|
|
2438
|
+
import urlJoin4 from "url-join";
|
|
2439
|
+
var log13 = debug13("lobe-market-sdk:discovery");
|
|
2189
2440
|
var DiscoveryService = class extends BaseSDK {
|
|
2190
2441
|
/**
|
|
2191
2442
|
* Retrieves the service discovery document
|
|
@@ -2197,24 +2448,24 @@ var DiscoveryService = class extends BaseSDK {
|
|
|
2197
2448
|
* @returns Promise resolving to the service discovery document
|
|
2198
2449
|
*/
|
|
2199
2450
|
async getDiscoveryDocument() {
|
|
2200
|
-
|
|
2451
|
+
log13("Fetching discovery document");
|
|
2201
2452
|
if (this.discoveryDoc) {
|
|
2202
|
-
|
|
2453
|
+
log13("Returning cached discovery document");
|
|
2203
2454
|
return this.discoveryDoc;
|
|
2204
2455
|
}
|
|
2205
|
-
const res = await fetch(
|
|
2456
|
+
const res = await fetch(urlJoin4(this.baseUrl, "/.well-known/discovery"));
|
|
2206
2457
|
if (!res.ok) {
|
|
2207
2458
|
throw new Error(await res.text());
|
|
2208
2459
|
}
|
|
2209
2460
|
this.discoveryDoc = await res.json();
|
|
2210
|
-
|
|
2461
|
+
log13("Discovery document successfully fetched");
|
|
2211
2462
|
return this.discoveryDoc;
|
|
2212
2463
|
}
|
|
2213
2464
|
};
|
|
2214
2465
|
|
|
2215
2466
|
// src/market/services/FeedbackService.ts
|
|
2216
|
-
import
|
|
2217
|
-
var
|
|
2467
|
+
import debug14 from "debug";
|
|
2468
|
+
var log14 = debug14("lobe-market-sdk:feedback");
|
|
2218
2469
|
var FeedbackService = class extends BaseSDK {
|
|
2219
2470
|
/**
|
|
2220
2471
|
* Submits user feedback
|
|
@@ -2244,7 +2495,7 @@ var FeedbackService = class extends BaseSDK {
|
|
|
2244
2495
|
* ```
|
|
2245
2496
|
*/
|
|
2246
2497
|
async submitFeedback(data, options) {
|
|
2247
|
-
|
|
2498
|
+
log14("Submitting feedback: %s", data.title);
|
|
2248
2499
|
const result = await this.request("/v1/user/feedback", {
|
|
2249
2500
|
body: JSON.stringify(data),
|
|
2250
2501
|
headers: {
|
|
@@ -2253,14 +2504,14 @@ var FeedbackService = class extends BaseSDK {
|
|
|
2253
2504
|
method: "POST",
|
|
2254
2505
|
...options
|
|
2255
2506
|
});
|
|
2256
|
-
|
|
2507
|
+
log14("Feedback submitted successfully: %s", result.issueId);
|
|
2257
2508
|
return result;
|
|
2258
2509
|
}
|
|
2259
2510
|
};
|
|
2260
2511
|
|
|
2261
2512
|
// src/market/services/PluginsService.ts
|
|
2262
|
-
import
|
|
2263
|
-
var
|
|
2513
|
+
import debug15 from "debug";
|
|
2514
|
+
var log15 = debug15("lobe-market-sdk:plugins");
|
|
2264
2515
|
var PluginsService = class extends BaseSDK {
|
|
2265
2516
|
/**
|
|
2266
2517
|
* Retrieves a list of plugins from the marketplace
|
|
@@ -2275,9 +2526,9 @@ var PluginsService = class extends BaseSDK {
|
|
|
2275
2526
|
const locale = params.locale || this.defaultLocale;
|
|
2276
2527
|
const queryParams = { ...params, locale };
|
|
2277
2528
|
const queryString = this.buildQueryString(queryParams);
|
|
2278
|
-
|
|
2529
|
+
log15("Getting plugin list: %O", queryParams);
|
|
2279
2530
|
const result = await this.request(`/v1/plugins${queryString}`, options);
|
|
2280
|
-
|
|
2531
|
+
log15("Retrieved %d plugins", result.items.length);
|
|
2281
2532
|
return result;
|
|
2282
2533
|
}
|
|
2283
2534
|
/**
|
|
@@ -2295,12 +2546,12 @@ var PluginsService = class extends BaseSDK {
|
|
|
2295
2546
|
const locale = params.locale || this.defaultLocale;
|
|
2296
2547
|
const queryParams = { ...params, locale };
|
|
2297
2548
|
const queryString = this.buildQueryString(queryParams);
|
|
2298
|
-
|
|
2549
|
+
log15("Getting plugin categories: %O", queryParams);
|
|
2299
2550
|
const result = await this.request(
|
|
2300
2551
|
`/v1/plugins/categories${queryString}`,
|
|
2301
2552
|
options
|
|
2302
2553
|
);
|
|
2303
|
-
|
|
2554
|
+
log15("Retrieved %d categories", result.length);
|
|
2304
2555
|
return result;
|
|
2305
2556
|
}
|
|
2306
2557
|
/**
|
|
@@ -2313,12 +2564,12 @@ var PluginsService = class extends BaseSDK {
|
|
|
2313
2564
|
* @returns Promise resolving to an array containing identifiers array and last modified time
|
|
2314
2565
|
*/
|
|
2315
2566
|
async getPublishedIdentifiers(options) {
|
|
2316
|
-
|
|
2567
|
+
log15("Getting published plugin identifiers");
|
|
2317
2568
|
const result = await this.request(
|
|
2318
2569
|
"/v1/plugins/identifiers",
|
|
2319
2570
|
options
|
|
2320
2571
|
);
|
|
2321
|
-
|
|
2572
|
+
log15("Retrieved %d published plugin identifiers", result.length);
|
|
2322
2573
|
return result;
|
|
2323
2574
|
}
|
|
2324
2575
|
/**
|
|
@@ -2338,7 +2589,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2338
2589
|
version,
|
|
2339
2590
|
identifier
|
|
2340
2591
|
}, options) {
|
|
2341
|
-
|
|
2592
|
+
log15("Getting plugin manifest: %O", { identifier, locale, version });
|
|
2342
2593
|
const localeParam = locale || this.defaultLocale;
|
|
2343
2594
|
const params = { locale: localeParam };
|
|
2344
2595
|
if (version) {
|
|
@@ -2349,7 +2600,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2349
2600
|
`/v1/plugins/${identifier}/manifest${queryString}`,
|
|
2350
2601
|
options
|
|
2351
2602
|
);
|
|
2352
|
-
|
|
2603
|
+
log15("Plugin manifest successfully retrieved: %s", identifier);
|
|
2353
2604
|
return manifest;
|
|
2354
2605
|
}
|
|
2355
2606
|
/**
|
|
@@ -2366,7 +2617,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2366
2617
|
version,
|
|
2367
2618
|
identifier
|
|
2368
2619
|
}, options) {
|
|
2369
|
-
|
|
2620
|
+
log15("Getting plugin detail: %O", { identifier, locale, version });
|
|
2370
2621
|
const localeParam = locale || this.defaultLocale;
|
|
2371
2622
|
const params = { locale: localeParam };
|
|
2372
2623
|
if (version) {
|
|
@@ -2377,7 +2628,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2377
2628
|
`/v1/plugins/${identifier}${queryString}`,
|
|
2378
2629
|
options
|
|
2379
2630
|
);
|
|
2380
|
-
|
|
2631
|
+
log15("Plugin manifest successfully retrieved: %s", identifier);
|
|
2381
2632
|
return manifest;
|
|
2382
2633
|
}
|
|
2383
2634
|
/**
|
|
@@ -2392,7 +2643,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2392
2643
|
*
|
|
2393
2644
|
*/
|
|
2394
2645
|
async reportInstallation(reportData) {
|
|
2395
|
-
|
|
2646
|
+
log15("Reporting installation for %s@%s", reportData.identifier, reportData.version);
|
|
2396
2647
|
const result = await this.request("/v1/plugins/report/installation", {
|
|
2397
2648
|
body: JSON.stringify(reportData),
|
|
2398
2649
|
headers: {
|
|
@@ -2400,7 +2651,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2400
2651
|
},
|
|
2401
2652
|
method: "POST"
|
|
2402
2653
|
});
|
|
2403
|
-
|
|
2654
|
+
log15("Installation report submitted successfully: %O", result);
|
|
2404
2655
|
return result;
|
|
2405
2656
|
}
|
|
2406
2657
|
/**
|
|
@@ -2414,7 +2665,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2414
2665
|
* @returns Promise resolving to the report submission response
|
|
2415
2666
|
*/
|
|
2416
2667
|
async reportCall(reportData) {
|
|
2417
|
-
|
|
2668
|
+
log15(
|
|
2418
2669
|
"Reporting call for %s@%s - %s:%s",
|
|
2419
2670
|
reportData.identifier,
|
|
2420
2671
|
reportData.version,
|
|
@@ -2428,7 +2679,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2428
2679
|
},
|
|
2429
2680
|
method: "POST"
|
|
2430
2681
|
});
|
|
2431
|
-
|
|
2682
|
+
log15("Call report submitted successfully: %O", result);
|
|
2432
2683
|
return result;
|
|
2433
2684
|
}
|
|
2434
2685
|
/**
|
|
@@ -2440,7 +2691,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2440
2691
|
* @param options - Optional request init overrides
|
|
2441
2692
|
*/
|
|
2442
2693
|
async createEvent(eventData, options) {
|
|
2443
|
-
|
|
2694
|
+
log15("Recording plugin event: %s for %s", eventData.event, eventData.identifier);
|
|
2444
2695
|
await this.request("/v1/plugins/events", {
|
|
2445
2696
|
body: JSON.stringify(eventData),
|
|
2446
2697
|
headers: {
|
|
@@ -2470,7 +2721,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2470
2721
|
* ```
|
|
2471
2722
|
*/
|
|
2472
2723
|
async callCloudGateway(request, options) {
|
|
2473
|
-
|
|
2724
|
+
log15("Calling cloud gateway for plugin %s, tool %s", request.identifier, request.toolName);
|
|
2474
2725
|
const result = await this.request("/v1/plugins/cloud-gateway", {
|
|
2475
2726
|
body: JSON.stringify(request),
|
|
2476
2727
|
headers: {
|
|
@@ -2479,7 +2730,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2479
2730
|
method: "POST",
|
|
2480
2731
|
...options
|
|
2481
2732
|
});
|
|
2482
|
-
|
|
2733
|
+
log15("Cloud gateway call completed: %O", {
|
|
2483
2734
|
identifier: request.identifier,
|
|
2484
2735
|
isError: result.isError,
|
|
2485
2736
|
toolName: request.toolName
|
|
@@ -2520,7 +2771,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2520
2771
|
* ```
|
|
2521
2772
|
*/
|
|
2522
2773
|
async runBuildInTool(toolName, params, context, options) {
|
|
2523
|
-
|
|
2774
|
+
log15(
|
|
2524
2775
|
"Running built-in tool: %s for user %s, topic %s",
|
|
2525
2776
|
toolName,
|
|
2526
2777
|
context.userId,
|
|
@@ -2539,7 +2790,7 @@ var PluginsService = class extends BaseSDK {
|
|
|
2539
2790
|
method: "POST",
|
|
2540
2791
|
...options
|
|
2541
2792
|
});
|
|
2542
|
-
|
|
2793
|
+
log15("Built-in tool execution completed: %O", {
|
|
2543
2794
|
success: result.success,
|
|
2544
2795
|
toolName
|
|
2545
2796
|
});
|
|
@@ -2642,9 +2893,134 @@ var PluginsService = class extends BaseSDK {
|
|
|
2642
2893
|
}
|
|
2643
2894
|
};
|
|
2644
2895
|
|
|
2896
|
+
// src/market/services/SkillService.ts
|
|
2897
|
+
import debug16 from "debug";
|
|
2898
|
+
var log16 = debug16("lobe-market-sdk:skill");
|
|
2899
|
+
var SkillService = class extends BaseSDK {
|
|
2900
|
+
/**
|
|
2901
|
+
* Lists all available skill providers
|
|
2902
|
+
*
|
|
2903
|
+
* Returns a list of providers that can be connected via OAuth.
|
|
2904
|
+
* This is a public endpoint that doesn't require authentication.
|
|
2905
|
+
*
|
|
2906
|
+
* @param options - Optional request options
|
|
2907
|
+
* @returns Promise resolving to the list of available providers
|
|
2908
|
+
*/
|
|
2909
|
+
async listProviders(options) {
|
|
2910
|
+
var _a;
|
|
2911
|
+
log16("Listing skill providers");
|
|
2912
|
+
const result = await this.request("/v1/skill/providers", options);
|
|
2913
|
+
log16("Found %d skill providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
|
|
2914
|
+
return result;
|
|
2915
|
+
}
|
|
2916
|
+
/**
|
|
2917
|
+
* Lists available tools for a specific provider
|
|
2918
|
+
*
|
|
2919
|
+
* Returns the tools/functions that can be called on the provider.
|
|
2920
|
+
* This is a public endpoint that doesn't require authentication.
|
|
2921
|
+
*
|
|
2922
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2923
|
+
* @param options - Optional request options
|
|
2924
|
+
* @returns Promise resolving to the list of available tools
|
|
2925
|
+
*/
|
|
2926
|
+
async listTools(provider, options) {
|
|
2927
|
+
var _a;
|
|
2928
|
+
log16("Listing tools for provider: %s", provider);
|
|
2929
|
+
const result = await this.request(
|
|
2930
|
+
`/v1/skill/${encodeURIComponent(provider)}/tools`,
|
|
2931
|
+
options
|
|
2932
|
+
);
|
|
2933
|
+
log16("Found %d tools for provider %s", ((_a = result.tools) == null ? void 0 : _a.length) || 0, provider);
|
|
2934
|
+
return result;
|
|
2935
|
+
}
|
|
2936
|
+
/**
|
|
2937
|
+
* Gets details of a specific tool
|
|
2938
|
+
*
|
|
2939
|
+
* Returns detailed information about a tool including its input schema.
|
|
2940
|
+
* This is a public endpoint that doesn't require authentication.
|
|
2941
|
+
*
|
|
2942
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2943
|
+
* @param toolName - The name of the tool
|
|
2944
|
+
* @param options - Optional request options
|
|
2945
|
+
* @returns Promise resolving to the tool details
|
|
2946
|
+
*/
|
|
2947
|
+
async getTool(provider, toolName, options) {
|
|
2948
|
+
var _a;
|
|
2949
|
+
log16("Getting tool %s from provider %s", toolName, provider);
|
|
2950
|
+
const result = await this.request(
|
|
2951
|
+
`/v1/skill/${encodeURIComponent(provider)}/tool/${encodeURIComponent(toolName)}`,
|
|
2952
|
+
options
|
|
2953
|
+
);
|
|
2954
|
+
log16("Retrieved tool: %s", (_a = result.tool) == null ? void 0 : _a.name);
|
|
2955
|
+
return result;
|
|
2956
|
+
}
|
|
2957
|
+
/**
|
|
2958
|
+
* Gets the connection status for a provider
|
|
2959
|
+
*
|
|
2960
|
+
* Checks if the authenticated user has an active OAuth connection to the provider.
|
|
2961
|
+
* Requires authentication.
|
|
2962
|
+
*
|
|
2963
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2964
|
+
* @param options - Optional request options (must include authentication)
|
|
2965
|
+
* @returns Promise resolving to the connection status
|
|
2966
|
+
*/
|
|
2967
|
+
async getStatus(provider, options) {
|
|
2968
|
+
log16("Getting status for provider: %s", provider);
|
|
2969
|
+
const result = await this.request(
|
|
2970
|
+
`/v1/skill/${encodeURIComponent(provider)}/status`,
|
|
2971
|
+
options
|
|
2972
|
+
);
|
|
2973
|
+
log16("Provider %s status: connected=%s", provider, result.connected);
|
|
2974
|
+
return result;
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Calls a tool on a connected provider
|
|
2978
|
+
*
|
|
2979
|
+
* Executes a tool/function on the provider using the user's OAuth connection.
|
|
2980
|
+
* Requires authentication and an active OAuth connection to the provider.
|
|
2981
|
+
*
|
|
2982
|
+
* @param provider - The provider ID (e.g., 'linear', 'github')
|
|
2983
|
+
* @param params - The tool call parameters (tool name and arguments)
|
|
2984
|
+
* @param options - Optional request options (must include authentication)
|
|
2985
|
+
* @returns Promise resolving to the tool call result
|
|
2986
|
+
*
|
|
2987
|
+
* @example
|
|
2988
|
+
* ```typescript
|
|
2989
|
+
* // Create a Linear issue
|
|
2990
|
+
* const result = await sdk.skills.callTool('linear', {
|
|
2991
|
+
* tool: 'create_issue',
|
|
2992
|
+
* args: {
|
|
2993
|
+
* title: 'New feature request',
|
|
2994
|
+
* team: 'Engineering',
|
|
2995
|
+
* description: 'We need to implement...'
|
|
2996
|
+
* }
|
|
2997
|
+
* });
|
|
2998
|
+
* ```
|
|
2999
|
+
*/
|
|
3000
|
+
async callTool(provider, params, options) {
|
|
3001
|
+
log16("Calling tool %s on provider %s", params.tool, provider);
|
|
3002
|
+
const result = await this.request(
|
|
3003
|
+
`/v1/skill/${encodeURIComponent(provider)}/call`,
|
|
3004
|
+
{
|
|
3005
|
+
body: JSON.stringify({
|
|
3006
|
+
args: params.args || {},
|
|
3007
|
+
tool: params.tool
|
|
3008
|
+
}),
|
|
3009
|
+
headers: {
|
|
3010
|
+
"Content-Type": "application/json"
|
|
3011
|
+
},
|
|
3012
|
+
method: "POST",
|
|
3013
|
+
...options
|
|
3014
|
+
}
|
|
3015
|
+
);
|
|
3016
|
+
log16("Tool %s call completed: success=%s", params.tool, result.success);
|
|
3017
|
+
return result;
|
|
3018
|
+
}
|
|
3019
|
+
};
|
|
3020
|
+
|
|
2645
3021
|
// src/market/services/UserService.ts
|
|
2646
|
-
import
|
|
2647
|
-
var
|
|
3022
|
+
import debug17 from "debug";
|
|
3023
|
+
var log17 = debug17("lobe-market-sdk:user");
|
|
2648
3024
|
var UserService = class extends BaseSDK {
|
|
2649
3025
|
/**
|
|
2650
3026
|
* Retrieves user information by account ID or userName
|
|
@@ -2661,12 +3037,12 @@ var UserService = class extends BaseSDK {
|
|
|
2661
3037
|
const locale = params.locale || this.defaultLocale;
|
|
2662
3038
|
const queryParams = { locale };
|
|
2663
3039
|
const queryString = this.buildQueryString(queryParams);
|
|
2664
|
-
|
|
3040
|
+
log17("Getting user info: %O", { idOrUserName, ...params });
|
|
2665
3041
|
const result = await this.request(
|
|
2666
3042
|
`/v1/user/info/${idOrUserName}${queryString}`,
|
|
2667
3043
|
options
|
|
2668
3044
|
);
|
|
2669
|
-
|
|
3045
|
+
log17("User info successfully retrieved for: %s", idOrUserName);
|
|
2670
3046
|
return result;
|
|
2671
3047
|
}
|
|
2672
3048
|
/**
|
|
@@ -2681,7 +3057,7 @@ var UserService = class extends BaseSDK {
|
|
|
2681
3057
|
* @throws Error if userName is already taken or update fails
|
|
2682
3058
|
*/
|
|
2683
3059
|
async updateUserInfo(data, options) {
|
|
2684
|
-
|
|
3060
|
+
log17("Updating user info: %O", data);
|
|
2685
3061
|
const result = await this.request("/v1/user/update", {
|
|
2686
3062
|
body: JSON.stringify(data),
|
|
2687
3063
|
headers: {
|
|
@@ -2690,14 +3066,14 @@ var UserService = class extends BaseSDK {
|
|
|
2690
3066
|
method: "POST",
|
|
2691
3067
|
...options
|
|
2692
3068
|
});
|
|
2693
|
-
|
|
3069
|
+
log17("User info updated successfully");
|
|
2694
3070
|
return result;
|
|
2695
3071
|
}
|
|
2696
3072
|
};
|
|
2697
3073
|
|
|
2698
3074
|
// src/market/services/UserFollowService.ts
|
|
2699
|
-
import
|
|
2700
|
-
var
|
|
3075
|
+
import debug18 from "debug";
|
|
3076
|
+
var log18 = debug18("lobe-market-sdk:user-follow");
|
|
2701
3077
|
var UserFollowService = class extends BaseSDK {
|
|
2702
3078
|
/**
|
|
2703
3079
|
* Follow a user
|
|
@@ -2711,7 +3087,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2711
3087
|
* @throws Error if already following or cannot follow yourself
|
|
2712
3088
|
*/
|
|
2713
3089
|
async follow(followingId, options) {
|
|
2714
|
-
|
|
3090
|
+
log18("Following user: %d", followingId);
|
|
2715
3091
|
const body = { followingId };
|
|
2716
3092
|
const result = await this.request("/v1/user/follows", {
|
|
2717
3093
|
body: JSON.stringify(body),
|
|
@@ -2721,7 +3097,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2721
3097
|
method: "POST",
|
|
2722
3098
|
...options
|
|
2723
3099
|
});
|
|
2724
|
-
|
|
3100
|
+
log18("Successfully followed user: %d", followingId);
|
|
2725
3101
|
return result;
|
|
2726
3102
|
}
|
|
2727
3103
|
/**
|
|
@@ -2736,7 +3112,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2736
3112
|
* @throws Error if follow relationship not found
|
|
2737
3113
|
*/
|
|
2738
3114
|
async unfollow(followingId, options) {
|
|
2739
|
-
|
|
3115
|
+
log18("Unfollowing user: %d", followingId);
|
|
2740
3116
|
const body = { followingId };
|
|
2741
3117
|
const result = await this.request("/v1/user/follows", {
|
|
2742
3118
|
body: JSON.stringify(body),
|
|
@@ -2746,7 +3122,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2746
3122
|
method: "DELETE",
|
|
2747
3123
|
...options
|
|
2748
3124
|
});
|
|
2749
|
-
|
|
3125
|
+
log18("Successfully unfollowed user: %d", followingId);
|
|
2750
3126
|
return result;
|
|
2751
3127
|
}
|
|
2752
3128
|
/**
|
|
@@ -2760,13 +3136,13 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2760
3136
|
* @returns Promise resolving to follow status (isFollowing, isMutual)
|
|
2761
3137
|
*/
|
|
2762
3138
|
async checkFollowStatus(targetUserId, options) {
|
|
2763
|
-
|
|
3139
|
+
log18("Checking follow status for user: %d", targetUserId);
|
|
2764
3140
|
const queryString = this.buildQueryString({ targetUserId: String(targetUserId) });
|
|
2765
3141
|
const result = await this.request(
|
|
2766
3142
|
`/v1/user/follows/check${queryString}`,
|
|
2767
3143
|
options
|
|
2768
3144
|
);
|
|
2769
|
-
|
|
3145
|
+
log18("Follow status retrieved: %O", result);
|
|
2770
3146
|
return result;
|
|
2771
3147
|
}
|
|
2772
3148
|
/**
|
|
@@ -2781,7 +3157,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2781
3157
|
* @returns Promise resolving to list of following users
|
|
2782
3158
|
*/
|
|
2783
3159
|
async getFollowing(userId, params = {}, options) {
|
|
2784
|
-
|
|
3160
|
+
log18("Getting following list for user: %d", userId);
|
|
2785
3161
|
const queryParams = {};
|
|
2786
3162
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
2787
3163
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -2790,7 +3166,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2790
3166
|
`/v1/user/follows/${userId}/following${queryString}`,
|
|
2791
3167
|
options
|
|
2792
3168
|
);
|
|
2793
|
-
|
|
3169
|
+
log18("Following list retrieved for user: %d", userId);
|
|
2794
3170
|
return result;
|
|
2795
3171
|
}
|
|
2796
3172
|
/**
|
|
@@ -2805,7 +3181,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2805
3181
|
* @returns Promise resolving to list of followers
|
|
2806
3182
|
*/
|
|
2807
3183
|
async getFollowers(userId, params = {}, options) {
|
|
2808
|
-
|
|
3184
|
+
log18("Getting followers list for user: %d", userId);
|
|
2809
3185
|
const queryParams = {};
|
|
2810
3186
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
2811
3187
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -2814,14 +3190,14 @@ var UserFollowService = class extends BaseSDK {
|
|
|
2814
3190
|
`/v1/user/follows/${userId}/followers${queryString}`,
|
|
2815
3191
|
options
|
|
2816
3192
|
);
|
|
2817
|
-
|
|
3193
|
+
log18("Followers list retrieved for user: %d", userId);
|
|
2818
3194
|
return result;
|
|
2819
3195
|
}
|
|
2820
3196
|
};
|
|
2821
3197
|
|
|
2822
3198
|
// src/market/services/UserFavoriteService.ts
|
|
2823
|
-
import
|
|
2824
|
-
var
|
|
3199
|
+
import debug19 from "debug";
|
|
3200
|
+
var log19 = debug19("lobe-market-sdk:user-favorite");
|
|
2825
3201
|
var UserFavoriteService = class extends BaseSDK {
|
|
2826
3202
|
/**
|
|
2827
3203
|
* Add to favorites
|
|
@@ -2836,7 +3212,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2836
3212
|
* @throws Error if already in favorites
|
|
2837
3213
|
*/
|
|
2838
3214
|
async addFavorite(targetType, targetId, options) {
|
|
2839
|
-
|
|
3215
|
+
log19("Adding favorite: %s %d", targetType, targetId);
|
|
2840
3216
|
const body = { targetId, targetType };
|
|
2841
3217
|
const result = await this.request("/v1/user/favorites", {
|
|
2842
3218
|
body: JSON.stringify(body),
|
|
@@ -2846,7 +3222,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2846
3222
|
method: "POST",
|
|
2847
3223
|
...options
|
|
2848
3224
|
});
|
|
2849
|
-
|
|
3225
|
+
log19("Successfully added favorite: %s %d", targetType, targetId);
|
|
2850
3226
|
return result;
|
|
2851
3227
|
}
|
|
2852
3228
|
/**
|
|
@@ -2862,7 +3238,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2862
3238
|
* @throws Error if favorite not found
|
|
2863
3239
|
*/
|
|
2864
3240
|
async removeFavorite(targetType, targetId, options) {
|
|
2865
|
-
|
|
3241
|
+
log19("Removing favorite: %s %d", targetType, targetId);
|
|
2866
3242
|
const body = { targetId, targetType };
|
|
2867
3243
|
const result = await this.request("/v1/user/favorites", {
|
|
2868
3244
|
body: JSON.stringify(body),
|
|
@@ -2872,7 +3248,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2872
3248
|
method: "DELETE",
|
|
2873
3249
|
...options
|
|
2874
3250
|
});
|
|
2875
|
-
|
|
3251
|
+
log19("Successfully removed favorite: %s %d", targetType, targetId);
|
|
2876
3252
|
return result;
|
|
2877
3253
|
}
|
|
2878
3254
|
/**
|
|
@@ -2887,7 +3263,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2887
3263
|
* @returns Promise resolving to favorite status
|
|
2888
3264
|
*/
|
|
2889
3265
|
async checkFavorite(targetType, targetId, options) {
|
|
2890
|
-
|
|
3266
|
+
log19("Checking favorite status: %s %d", targetType, targetId);
|
|
2891
3267
|
const queryString = this.buildQueryString({
|
|
2892
3268
|
targetId: String(targetId),
|
|
2893
3269
|
targetType
|
|
@@ -2896,7 +3272,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2896
3272
|
`/v1/user/favorites/check${queryString}`,
|
|
2897
3273
|
options
|
|
2898
3274
|
);
|
|
2899
|
-
|
|
3275
|
+
log19("Favorite status retrieved: %O", result);
|
|
2900
3276
|
return result;
|
|
2901
3277
|
}
|
|
2902
3278
|
/**
|
|
@@ -2910,7 +3286,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2910
3286
|
* @returns Promise resolving to list of favorites
|
|
2911
3287
|
*/
|
|
2912
3288
|
async getMyFavorites(params = {}, options) {
|
|
2913
|
-
|
|
3289
|
+
log19("Getting my favorites: %O", params);
|
|
2914
3290
|
const queryParams = {};
|
|
2915
3291
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
2916
3292
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -2920,7 +3296,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2920
3296
|
`/v1/user/favorites/me${queryString}`,
|
|
2921
3297
|
options
|
|
2922
3298
|
);
|
|
2923
|
-
|
|
3299
|
+
log19("My favorites retrieved");
|
|
2924
3300
|
return result;
|
|
2925
3301
|
}
|
|
2926
3302
|
/**
|
|
@@ -2935,7 +3311,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2935
3311
|
* @returns Promise resolving to list of favorites
|
|
2936
3312
|
*/
|
|
2937
3313
|
async getUserFavorites(userId, params = {}, options) {
|
|
2938
|
-
|
|
3314
|
+
log19("Getting favorites for user: %d", userId);
|
|
2939
3315
|
const queryParams = {};
|
|
2940
3316
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
2941
3317
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -2945,7 +3321,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2945
3321
|
`/v1/user/favorites/${userId}${queryString}`,
|
|
2946
3322
|
options
|
|
2947
3323
|
);
|
|
2948
|
-
|
|
3324
|
+
log19("Favorites retrieved for user: %d", userId);
|
|
2949
3325
|
return result;
|
|
2950
3326
|
}
|
|
2951
3327
|
/**
|
|
@@ -2960,7 +3336,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2960
3336
|
* @returns Promise resolving to list of favorite agents
|
|
2961
3337
|
*/
|
|
2962
3338
|
async getUserFavoriteAgents(userId, params = {}, options) {
|
|
2963
|
-
|
|
3339
|
+
log19("Getting favorite agents for user: %d", userId);
|
|
2964
3340
|
const queryParams = {};
|
|
2965
3341
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
2966
3342
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -2969,7 +3345,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2969
3345
|
`/v1/user/favorites/${userId}/agents${queryString}`,
|
|
2970
3346
|
options
|
|
2971
3347
|
);
|
|
2972
|
-
|
|
3348
|
+
log19("Favorite agents retrieved for user: %d", userId);
|
|
2973
3349
|
return result;
|
|
2974
3350
|
}
|
|
2975
3351
|
/**
|
|
@@ -2984,7 +3360,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2984
3360
|
* @returns Promise resolving to list of favorite plugins
|
|
2985
3361
|
*/
|
|
2986
3362
|
async getUserFavoritePlugins(userId, params = {}, options) {
|
|
2987
|
-
|
|
3363
|
+
log19("Getting favorite plugins for user: %d", userId);
|
|
2988
3364
|
const queryParams = {};
|
|
2989
3365
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
2990
3366
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -2993,14 +3369,14 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
2993
3369
|
`/v1/user/favorites/${userId}/plugins${queryString}`,
|
|
2994
3370
|
options
|
|
2995
3371
|
);
|
|
2996
|
-
|
|
3372
|
+
log19("Favorite plugins retrieved for user: %d", userId);
|
|
2997
3373
|
return result;
|
|
2998
3374
|
}
|
|
2999
3375
|
};
|
|
3000
3376
|
|
|
3001
3377
|
// src/market/services/UserLikeService.ts
|
|
3002
|
-
import
|
|
3003
|
-
var
|
|
3378
|
+
import debug20 from "debug";
|
|
3379
|
+
var log20 = debug20("lobe-market-sdk:user-like");
|
|
3004
3380
|
var UserLikeService = class extends BaseSDK {
|
|
3005
3381
|
/**
|
|
3006
3382
|
* Like content
|
|
@@ -3015,7 +3391,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3015
3391
|
* @throws Error if already liked
|
|
3016
3392
|
*/
|
|
3017
3393
|
async like(targetType, targetId, options) {
|
|
3018
|
-
|
|
3394
|
+
log20("Liking: %s %d", targetType, targetId);
|
|
3019
3395
|
const body = { targetId, targetType };
|
|
3020
3396
|
const result = await this.request("/v1/user/likes", {
|
|
3021
3397
|
body: JSON.stringify(body),
|
|
@@ -3025,7 +3401,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3025
3401
|
method: "POST",
|
|
3026
3402
|
...options
|
|
3027
3403
|
});
|
|
3028
|
-
|
|
3404
|
+
log20("Successfully liked: %s %d", targetType, targetId);
|
|
3029
3405
|
return result;
|
|
3030
3406
|
}
|
|
3031
3407
|
/**
|
|
@@ -3041,7 +3417,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3041
3417
|
* @throws Error if like not found
|
|
3042
3418
|
*/
|
|
3043
3419
|
async unlike(targetType, targetId, options) {
|
|
3044
|
-
|
|
3420
|
+
log20("Unliking: %s %d", targetType, targetId);
|
|
3045
3421
|
const body = { targetId, targetType };
|
|
3046
3422
|
const result = await this.request("/v1/user/likes", {
|
|
3047
3423
|
body: JSON.stringify(body),
|
|
@@ -3051,7 +3427,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3051
3427
|
method: "DELETE",
|
|
3052
3428
|
...options
|
|
3053
3429
|
});
|
|
3054
|
-
|
|
3430
|
+
log20("Successfully unliked: %s %d", targetType, targetId);
|
|
3055
3431
|
return result;
|
|
3056
3432
|
}
|
|
3057
3433
|
/**
|
|
@@ -3066,7 +3442,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3066
3442
|
* @returns Promise resolving to toggle response with new like status
|
|
3067
3443
|
*/
|
|
3068
3444
|
async toggleLike(targetType, targetId, options) {
|
|
3069
|
-
|
|
3445
|
+
log20("Toggling like: %s %d", targetType, targetId);
|
|
3070
3446
|
const body = { targetId, targetType };
|
|
3071
3447
|
const result = await this.request("/v1/user/likes/toggle", {
|
|
3072
3448
|
body: JSON.stringify(body),
|
|
@@ -3076,7 +3452,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3076
3452
|
method: "POST",
|
|
3077
3453
|
...options
|
|
3078
3454
|
});
|
|
3079
|
-
|
|
3455
|
+
log20("Like toggled, new status: %O", result);
|
|
3080
3456
|
return result;
|
|
3081
3457
|
}
|
|
3082
3458
|
/**
|
|
@@ -3091,7 +3467,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3091
3467
|
* @returns Promise resolving to like status
|
|
3092
3468
|
*/
|
|
3093
3469
|
async checkLike(targetType, targetId, options) {
|
|
3094
|
-
|
|
3470
|
+
log20("Checking like status: %s %d", targetType, targetId);
|
|
3095
3471
|
const queryString = this.buildQueryString({
|
|
3096
3472
|
targetId: String(targetId),
|
|
3097
3473
|
targetType
|
|
@@ -3100,7 +3476,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3100
3476
|
`/v1/user/likes/check${queryString}`,
|
|
3101
3477
|
options
|
|
3102
3478
|
);
|
|
3103
|
-
|
|
3479
|
+
log20("Like status retrieved: %O", result);
|
|
3104
3480
|
return result;
|
|
3105
3481
|
}
|
|
3106
3482
|
/**
|
|
@@ -3114,7 +3490,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3114
3490
|
* @returns Promise resolving to list of likes
|
|
3115
3491
|
*/
|
|
3116
3492
|
async getMyLikes(params = {}, options) {
|
|
3117
|
-
|
|
3493
|
+
log20("Getting my likes: %O", params);
|
|
3118
3494
|
const queryParams = {};
|
|
3119
3495
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3120
3496
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3124,7 +3500,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3124
3500
|
`/v1/user/likes/me${queryString}`,
|
|
3125
3501
|
options
|
|
3126
3502
|
);
|
|
3127
|
-
|
|
3503
|
+
log20("My likes retrieved");
|
|
3128
3504
|
return result;
|
|
3129
3505
|
}
|
|
3130
3506
|
/**
|
|
@@ -3139,7 +3515,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3139
3515
|
* @returns Promise resolving to list of likes
|
|
3140
3516
|
*/
|
|
3141
3517
|
async getUserLikes(userId, params = {}, options) {
|
|
3142
|
-
|
|
3518
|
+
log20("Getting likes for user: %d", userId);
|
|
3143
3519
|
const queryParams = {};
|
|
3144
3520
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3145
3521
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3149,7 +3525,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3149
3525
|
`/v1/user/likes/${userId}${queryString}`,
|
|
3150
3526
|
options
|
|
3151
3527
|
);
|
|
3152
|
-
|
|
3528
|
+
log20("Likes retrieved for user: %d", userId);
|
|
3153
3529
|
return result;
|
|
3154
3530
|
}
|
|
3155
3531
|
/**
|
|
@@ -3164,7 +3540,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3164
3540
|
* @returns Promise resolving to list of liked agents
|
|
3165
3541
|
*/
|
|
3166
3542
|
async getUserLikedAgents(userId, params = {}, options) {
|
|
3167
|
-
|
|
3543
|
+
log20("Getting liked agents for user: %d", userId);
|
|
3168
3544
|
const queryParams = {};
|
|
3169
3545
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3170
3546
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3173,7 +3549,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3173
3549
|
`/v1/user/likes/${userId}/agents${queryString}`,
|
|
3174
3550
|
options
|
|
3175
3551
|
);
|
|
3176
|
-
|
|
3552
|
+
log20("Liked agents retrieved for user: %d", userId);
|
|
3177
3553
|
return result;
|
|
3178
3554
|
}
|
|
3179
3555
|
/**
|
|
@@ -3188,7 +3564,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3188
3564
|
* @returns Promise resolving to list of liked plugins
|
|
3189
3565
|
*/
|
|
3190
3566
|
async getUserLikedPlugins(userId, params = {}, options) {
|
|
3191
|
-
|
|
3567
|
+
log20("Getting liked plugins for user: %d", userId);
|
|
3192
3568
|
const queryParams = {};
|
|
3193
3569
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
3194
3570
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -3197,13 +3573,13 @@ var UserLikeService = class extends BaseSDK {
|
|
|
3197
3573
|
`/v1/user/likes/${userId}/plugins${queryString}`,
|
|
3198
3574
|
options
|
|
3199
3575
|
);
|
|
3200
|
-
|
|
3576
|
+
log20("Liked plugins retrieved for user: %d", userId);
|
|
3201
3577
|
return result;
|
|
3202
3578
|
}
|
|
3203
3579
|
};
|
|
3204
3580
|
|
|
3205
3581
|
// src/market/market-sdk.ts
|
|
3206
|
-
var
|
|
3582
|
+
var log21 = debug21("lobe-market-sdk");
|
|
3207
3583
|
var MarketSDK = class extends BaseSDK {
|
|
3208
3584
|
/**
|
|
3209
3585
|
* Creates a new MarketSDK instance
|
|
@@ -3216,15 +3592,17 @@ var MarketSDK = class extends BaseSDK {
|
|
|
3216
3592
|
tokenExpiry: void 0
|
|
3217
3593
|
};
|
|
3218
3594
|
super(options, void 0, sharedTokenState);
|
|
3219
|
-
|
|
3595
|
+
log21("MarketSDK instance created");
|
|
3220
3596
|
this.agents = new AgentService2(options, this.headers, sharedTokenState);
|
|
3221
3597
|
this.auth = new AuthService(options, this.headers, sharedTokenState);
|
|
3598
|
+
this.connect = new ConnectService(options, this.headers, sharedTokenState);
|
|
3222
3599
|
this.plugins = new PluginsService(options, this.headers, sharedTokenState);
|
|
3223
3600
|
this.user = new UserService(options, this.headers, sharedTokenState);
|
|
3224
3601
|
this.follows = new UserFollowService(options, this.headers, sharedTokenState);
|
|
3225
3602
|
this.favorites = new UserFavoriteService(options, this.headers, sharedTokenState);
|
|
3226
3603
|
this.likes = new UserLikeService(options, this.headers, sharedTokenState);
|
|
3227
3604
|
this.feedback = new FeedbackService(options, this.headers, sharedTokenState);
|
|
3605
|
+
this.skills = new SkillService(options, this.headers, sharedTokenState);
|
|
3228
3606
|
this.discovery = new DiscoveryService(options, this.headers, sharedTokenState);
|
|
3229
3607
|
}
|
|
3230
3608
|
/**
|
|
@@ -3251,7 +3629,7 @@ var MarketSDK = class extends BaseSDK {
|
|
|
3251
3629
|
* @deprecated Use auth.registerClient() instead
|
|
3252
3630
|
*/
|
|
3253
3631
|
async registerClient(request) {
|
|
3254
|
-
|
|
3632
|
+
log21("Registering client (deprecated method, use auth.registerClient): %s", request.clientName);
|
|
3255
3633
|
return this.auth.registerClient(request);
|
|
3256
3634
|
}
|
|
3257
3635
|
};
|