@lobehub/market-sdk 0.18.5 → 0.20.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/README.md CHANGED
@@ -155,6 +155,65 @@ async function updateSettings() {
155
155
  }
156
156
  ```
157
157
 
158
+ ### M2M (Machine-to-Machine) Authentication
159
+
160
+ For server-to-server authentication, you can use M2M authentication with client credentials:
161
+
162
+ ```typescript
163
+ import { MarketAdmin, MarketSDK } from '@lobehub/market-sdk';
164
+
165
+ // Using M2M authentication for Market SDK
166
+ const market = new MarketSDK({
167
+ baseURL: 'https://market.lobehub.com/api',
168
+ clientId: 'your-client-id',
169
+ clientSecret: 'your-client-secret',
170
+ defaultLocale: 'en-US',
171
+ });
172
+
173
+ // Using M2M authentication for Admin SDK
174
+ const admin = new MarketAdmin({
175
+ baseURL: 'https://market.lobehub.com/api',
176
+ clientId: 'your-client-id',
177
+ clientSecret: 'your-client-secret',
178
+ });
179
+
180
+ // The SDK will automatically handle token exchange
181
+ async function useM2MAuthentication() {
182
+ try {
183
+ // For protected APIs that require authentication
184
+ const result = await market.plugins.reportInstallation({
185
+ identifier: 'plugin-id',
186
+ version: '1.0.0',
187
+ success: true,
188
+ installDurationMs: 1500,
189
+ });
190
+
191
+ console.log('Installation reported:', result);
192
+ } catch (error) {
193
+ console.error('Error with M2M authentication:', error);
194
+ }
195
+ }
196
+ ```
197
+
198
+ #### How M2M Authentication Works
199
+
200
+ 1. **Client Credentials**: You need to obtain `clientId` and `clientSecret` from the LobeHub Market administrator.
201
+
202
+ 2. **Automatic Token Exchange**: The SDK automatically:
203
+
204
+ - Creates a signed JWT using your client credentials
205
+ - Exchanges this JWT for an access token
206
+ - Uses the access token for authenticated API requests
207
+
208
+ 3. **Token Management**: The SDK handles token refresh automatically when needed.
209
+
210
+ #### M2M vs API Key Authentication
211
+
212
+ - **M2M Authentication**: More secure, uses JWT-based authentication with automatic token refresh
213
+ - **API Key Authentication**: Simple but less secure, uses static API keys
214
+
215
+ Choose M2M authentication for production environments and API keys for development/testing.
216
+
158
217
  ## API Reference
159
218
 
160
219
  ### MarketSDK Services
package/dist/index.d.mts CHANGED
@@ -268,12 +268,51 @@ interface DiscoveryDocument {
268
268
  * Options for configuring the behavior of the Market SDK.
269
269
  */
270
270
  interface MarketSDKOptions {
271
- /** API key for authentication */
271
+ /**
272
+ * API Key for authentication
273
+ */
272
274
  apiKey?: string;
273
- /** Base URL for the Market API */
275
+ /**
276
+ * The base URL for the LobeHub Market API
277
+ */
274
278
  baseURL?: string;
275
- /** Default locale to use for localized content */
279
+ /**
280
+ * The client ID for M2M authentication
281
+ */
282
+ clientId?: string;
283
+ /**
284
+ * The client secret for M2M authentication
285
+ */
286
+ clientSecret?: string;
287
+ /**
288
+ * The default locale for the market
289
+ * @default 'en-US'
290
+ */
276
291
  defaultLocale?: string;
292
+ /**
293
+ * Base URL for root path
294
+ */
295
+ rootBaseURL?: string;
296
+ }
297
+ /**
298
+ * Shared token state for SDK instances
299
+ *
300
+ * Used to share authentication tokens between multiple service instances
301
+ * to avoid duplicate token requests and improve performance.
302
+ */
303
+ interface SharedTokenState {
304
+ /**
305
+ * The current access token
306
+ */
307
+ accessToken?: string;
308
+ /**
309
+ * Token expiry timestamp (milliseconds since epoch)
310
+ */
311
+ tokenExpiry?: number;
312
+ /**
313
+ * Promise for ongoing token request to prevent concurrent requests
314
+ */
315
+ tokenPromise?: Promise<string>;
277
316
  }
278
317
 
279
318
  /**
@@ -378,18 +417,28 @@ interface PluginQueryParams {
378
417
  */
379
418
  declare class BaseSDK {
380
419
  /** Base API URL */
420
+ protected apiBaseUrl: string;
421
+ /** Base URL */
381
422
  protected baseUrl: string;
423
+ /** OAuth URL */
424
+ protected oauthBaseUrl: string;
382
425
  /** Default locale for requests that require localization */
383
426
  protected defaultLocale: string;
384
427
  /** HTTP headers to include with all requests */
385
428
  protected headers: Record<string, string>;
429
+ private clientId?;
430
+ private clientSecret?;
431
+ private accessToken?;
432
+ private tokenExpiry?;
433
+ private sharedTokenState?;
386
434
  /**
387
435
  * Creates a new BaseSDK instance
388
436
  *
389
437
  * @param options - Configuration options for the SDK
390
438
  * @param sharedHeaders - Optional shared headers object for reuse across services
439
+ * @param sharedTokenState - Optional shared token state object for reuse across services
391
440
  */
392
- constructor(options?: MarketSDKOptions, sharedHeaders?: Record<string, string>);
441
+ constructor(options?: MarketSDKOptions, sharedHeaders?: Record<string, string>, sharedTokenState?: SharedTokenState);
393
442
  /**
394
443
  * Sends an HTTP request to the API and handles the response
395
444
  *
@@ -416,6 +465,10 @@ declare class BaseSDK {
416
465
  * Clears the authentication token
417
466
  */
418
467
  clearAuthToken(): void;
468
+ private createClientAssertion;
469
+ private exchangeToken;
470
+ private setM2MAuthToken;
471
+ private fetchNewToken;
419
472
  }
420
473
 
421
474
  /**
@@ -601,13 +654,6 @@ declare class AnalysisService extends BaseSDK {
601
654
  * This service handles CRUD operations for plugins, plugin versions, and deployment options.
602
655
  */
603
656
  declare class PluginService extends BaseSDK {
604
- /**
605
- * Creates a new PluginService instance
606
- *
607
- * @param options - Configuration options for the SDK
608
- * @param sharedHeaders - Optional shared headers object for reuse across services
609
- */
610
- constructor(options?: MarketSDKOptions, sharedHeaders?: Record<string, string>);
611
657
  /**
612
658
  * Batch imports plugin manifests using the dedicated import endpoint
613
659
  *
@@ -917,13 +963,6 @@ declare class PluginService extends BaseSDK {
917
963
  * and listing system dependencies that plugins may require.
918
964
  */
919
965
  declare class SystemDependencyService extends BaseSDK {
920
- /**
921
- * Creates a new SystemDependencyService instance
922
- *
923
- * @param options - Configuration options for the SDK
924
- * @param sharedHeaders - Optional shared headers object for reuse across services
925
- */
926
- constructor(options?: MarketSDKOptions, sharedHeaders?: Record<string, string>);
927
966
  /**
928
967
  * Retrieves all system dependencies
929
968
  *
@@ -1150,13 +1189,6 @@ interface UpdateReviewParams {
1150
1189
  * for plugins in the marketplace.
1151
1190
  */
1152
1191
  declare class ReviewService extends BaseSDK {
1153
- /**
1154
- * Creates a new ReviewService instance
1155
- *
1156
- * @param options - Configuration options for the SDK
1157
- * @param sharedHeaders - Optional shared headers object for reuse across services
1158
- */
1159
- constructor(options?: MarketSDKOptions, sharedHeaders?: Record<string, string>);
1160
1192
  /**
1161
1193
  * Retrieves a list of reviews with filtering options
1162
1194
  *
@@ -1307,13 +1339,6 @@ declare class MarketAdmin extends BaseSDK {
1307
1339
  * about plugins available in the marketplace.
1308
1340
  */
1309
1341
  declare class PluginsService extends BaseSDK {
1310
- /**
1311
- * Creates a new PluginsService instance
1312
- *
1313
- * @param options - Configuration options for the SDK
1314
- * @param sharedHeaders - Optional shared headers object for reuse across services
1315
- */
1316
- constructor(options?: MarketSDKOptions, sharedHeaders?: Record<string, string>);
1317
1342
  /**
1318
1343
  * Retrieves a list of plugins from the marketplace
1319
1344
  *
@@ -1430,4 +1455,4 @@ declare class MarketSDK extends BaseSDK {
1430
1455
  getDiscoveryDocument(): Promise<DiscoveryDocument>;
1431
1456
  }
1432
1457
 
1433
- export { type AdminListQueryParams, type AdminListResponse, type AdminPluginParams, type DiscoveryDocument, MarketAdmin, MarketSDK, type MarketSDKOptions, type PluginI18nImportParams, type PluginI18nImportResponse, type PluginItem, type PluginListResponse, type PluginLocalization, type PluginQueryParams, type PluginUpdateParams, type PluginVersionCreateParams, type PluginVersionUpdateParams, type ReviewStatus, ReviewStatusEnumSchema, StatusEnumSchema, type UnclaimedPluginItem, VisibilityEnumSchema };
1458
+ export { type AdminListQueryParams, type AdminListResponse, type AdminPluginParams, type DiscoveryDocument, MarketAdmin, MarketSDK, type MarketSDKOptions, type PluginI18nImportParams, type PluginI18nImportResponse, type PluginItem, type PluginListResponse, type PluginLocalization, type PluginQueryParams, type PluginUpdateParams, type PluginVersionCreateParams, type PluginVersionUpdateParams, type ReviewStatus, ReviewStatusEnumSchema, type SharedTokenState, StatusEnumSchema, type UnclaimedPluginItem, VisibilityEnumSchema };
package/dist/index.mjs CHANGED
@@ -3,31 +3,45 @@ import debug8 from "debug";
3
3
 
4
4
  // src/core/BaseSDK.ts
5
5
  import debug from "debug";
6
+ import { SignJWT } from "jose";
7
+ import urlJoin from "url-join";
6
8
  var log = debug("lobe-market-sdk:core");
9
+ var LOBEHUB_MARKET_API_AUDIENCE = "urn:lobehub:market-api";
7
10
  var BaseSDK = class {
8
11
  /**
9
12
  * Creates a new BaseSDK instance
10
13
  *
11
14
  * @param options - Configuration options for the SDK
12
15
  * @param sharedHeaders - Optional shared headers object for reuse across services
16
+ * @param sharedTokenState - Optional shared token state object for reuse across services
13
17
  */
14
- constructor(options = {}, sharedHeaders) {
15
- this.baseUrl = options.baseURL || process.env.MARKET_BASE_URL || "https://market.lobehub.com/api";
18
+ constructor(options = {}, sharedHeaders, sharedTokenState) {
19
+ this.baseUrl = options.baseURL || process.env.MARKET_BASE_URL || "https://market.lobehub.com";
20
+ this.apiBaseUrl = urlJoin(this.baseUrl, "api");
21
+ this.oauthBaseUrl = urlJoin(this.baseUrl, "oauth");
16
22
  this.defaultLocale = options.defaultLocale || "en-US";
23
+ this.clientId = options.clientId;
24
+ this.clientSecret = options.clientSecret;
25
+ this.sharedTokenState = sharedTokenState;
17
26
  const apiKey = options.apiKey || process.env.MARKET_API_KEY;
18
27
  if (sharedHeaders) {
19
28
  this.headers = sharedHeaders;
20
29
  log("Using shared headers object");
21
30
  } else {
22
31
  this.headers = {
23
- "Content-Type": "application/json",
24
- ...apiKey ? { Authorization: `Bearer ${apiKey}` } : {}
32
+ "Content-Type": "application/json"
25
33
  };
26
34
  log("Created new headers object");
27
35
  }
36
+ if (apiKey) {
37
+ this.headers.Authorization = `Bearer ${apiKey}`;
38
+ }
28
39
  log("BaseSDK instance created: %O", {
29
40
  baseUrl: this.baseUrl,
30
- defaultLocale: this.defaultLocale
41
+ defaultLocale: this.defaultLocale,
42
+ hasApiKey: !!apiKey,
43
+ hasM2MCredentials: !!this.clientId,
44
+ hasSharedTokenState: !!this.sharedTokenState
31
45
  });
32
46
  }
33
47
  /**
@@ -40,8 +54,12 @@ var BaseSDK = class {
40
54
  */
41
55
  // eslint-disable-next-line no-undef
42
56
  async request(url, options = {}) {
43
- log("Sending request: %s", `${this.baseUrl}${url}`);
44
- const response = await fetch(`${this.baseUrl}${url}`, {
57
+ const requestUrl = urlJoin(this.apiBaseUrl, url);
58
+ log("Sending request: %s", requestUrl);
59
+ if (this.clientId && this.clientSecret) {
60
+ await this.setM2MAuthToken();
61
+ }
62
+ const response = await fetch(requestUrl, {
45
63
  ...options,
46
64
  headers: {
47
65
  ...this.headers,
@@ -51,7 +69,12 @@ var BaseSDK = class {
51
69
  if (!response.ok) {
52
70
  const errorMsg = `Request failed: ${response.status} ${response.statusText}`;
53
71
  log("Request error: %s", errorMsg);
54
- throw new Error(errorMsg);
72
+ try {
73
+ const errorBody = await response.json();
74
+ throw new Error(`${errorMsg} - ${JSON.stringify(errorBody)}`);
75
+ } catch (e) {
76
+ throw new Error(errorMsg);
77
+ }
55
78
  }
56
79
  log("Request successful: %s", url);
57
80
  return response.json();
@@ -73,6 +96,14 @@ var BaseSDK = class {
73
96
  */
74
97
  setAuthToken(token) {
75
98
  log("Setting authentication token");
99
+ this.accessToken = void 0;
100
+ this.tokenExpiry = void 0;
101
+ this.clientId = void 0;
102
+ this.clientSecret = void 0;
103
+ if (this.sharedTokenState) {
104
+ this.sharedTokenState.accessToken = void 0;
105
+ this.sharedTokenState.tokenExpiry = void 0;
106
+ }
76
107
  this.headers.Authorization = `Bearer ${token}`;
77
108
  }
78
109
  /**
@@ -80,8 +111,102 @@ var BaseSDK = class {
80
111
  */
81
112
  clearAuthToken() {
82
113
  log("Clearing authentication token");
114
+ this.accessToken = void 0;
115
+ this.tokenExpiry = void 0;
116
+ this.clientId = void 0;
117
+ this.clientSecret = void 0;
118
+ if (this.sharedTokenState) {
119
+ this.sharedTokenState.accessToken = void 0;
120
+ this.sharedTokenState.tokenExpiry = void 0;
121
+ }
83
122
  delete this.headers.Authorization;
84
123
  }
124
+ async createClientAssertion() {
125
+ if (!this.clientId || !this.clientSecret) {
126
+ throw new Error("Missing clientId or clientSecret for M2M authentication.");
127
+ }
128
+ const secret = new TextEncoder().encode(this.clientSecret);
129
+ return await new SignJWT({}).setProtectedHeader({ alg: "HS256" }).setIssuer(this.clientId).setSubject(this.clientId).setAudience(LOBEHUB_MARKET_API_AUDIENCE).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("5m").sign(secret);
130
+ }
131
+ async exchangeToken(clientAssertion) {
132
+ const tokenEndpoint = urlJoin(this.oauthBaseUrl, "token");
133
+ log("Exchanging token at endpoint: %s", tokenEndpoint);
134
+ const params = new URLSearchParams();
135
+ params.append("grant_type", "client_credentials");
136
+ params.append(
137
+ "client_assertion_type",
138
+ "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"
139
+ );
140
+ params.append("client_assertion", clientAssertion);
141
+ const response = await fetch(tokenEndpoint, {
142
+ body: params,
143
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
144
+ method: "POST"
145
+ });
146
+ const tokenData = await response.json();
147
+ if (!response.ok) {
148
+ throw new Error(`Token exchange failed: ${JSON.stringify(tokenData)}`);
149
+ }
150
+ const expiresInSeconds = tokenData.expires_in || 3600;
151
+ this.tokenExpiry = Date.now() + (expiresInSeconds - 60) * 1e3;
152
+ return tokenData.access_token;
153
+ }
154
+ async setM2MAuthToken() {
155
+ var _a, _b, _c;
156
+ const currentAccessToken = ((_a = this.sharedTokenState) == null ? void 0 : _a.accessToken) || this.accessToken;
157
+ const currentTokenExpiry = ((_b = this.sharedTokenState) == null ? void 0 : _b.tokenExpiry) || this.tokenExpiry;
158
+ log(
159
+ "Token check: hasSharedState=%s, hasCurrentToken=%s, tokenExpiry=%d, currentTime=%d",
160
+ !!this.sharedTokenState,
161
+ !!currentAccessToken,
162
+ currentTokenExpiry || 0,
163
+ Date.now()
164
+ );
165
+ if (currentAccessToken && currentTokenExpiry && Date.now() < currentTokenExpiry) {
166
+ log(
167
+ "Using existing M2M access token (expires in %d seconds)",
168
+ Math.floor((currentTokenExpiry - Date.now()) / 1e3)
169
+ );
170
+ this.headers.Authorization = `Bearer ${currentAccessToken}`;
171
+ return;
172
+ }
173
+ if ((_c = this.sharedTokenState) == null ? void 0 : _c.tokenPromise) {
174
+ log("Token request already in progress, waiting for completion...");
175
+ const token = await this.sharedTokenState.tokenPromise;
176
+ this.headers.Authorization = `Bearer ${token}`;
177
+ log("Using token from concurrent request");
178
+ return;
179
+ }
180
+ log("Fetching new M2M access token...");
181
+ const tokenPromise = this.fetchNewToken();
182
+ if (this.sharedTokenState) {
183
+ this.sharedTokenState.tokenPromise = tokenPromise;
184
+ }
185
+ try {
186
+ const newAccessToken = await tokenPromise;
187
+ this.accessToken = newAccessToken;
188
+ this.headers.Authorization = `Bearer ${newAccessToken}`;
189
+ if (this.sharedTokenState) {
190
+ this.sharedTokenState.accessToken = newAccessToken;
191
+ this.sharedTokenState.tokenExpiry = this.tokenExpiry;
192
+ this.sharedTokenState.tokenPromise = void 0;
193
+ log(
194
+ "Updated shared token state (expires in %d seconds)",
195
+ Math.floor(((this.tokenExpiry || 0) - Date.now()) / 1e3)
196
+ );
197
+ }
198
+ log("Successfully set new M2M access token");
199
+ } catch (error) {
200
+ if (this.sharedTokenState) {
201
+ this.sharedTokenState.tokenPromise = void 0;
202
+ }
203
+ throw error;
204
+ }
205
+ }
206
+ async fetchNewToken() {
207
+ const assertion = await this.createClientAssertion();
208
+ return await this.exchangeToken(assertion);
209
+ }
85
210
  };
86
211
 
87
212
  // src/admin/services/AnalysisService.ts
@@ -278,16 +403,6 @@ var AnalysisService = class extends BaseSDK {
278
403
  import debug3 from "debug";
279
404
  var log3 = debug3("lobe-market-sdk:admin:plugins");
280
405
  var PluginService = class extends BaseSDK {
281
- /**
282
- * Creates a new PluginService instance
283
- *
284
- * @param options - Configuration options for the SDK
285
- * @param sharedHeaders - Optional shared headers object for reuse across services
286
- */
287
- constructor(options = {}, sharedHeaders) {
288
- super(options, sharedHeaders);
289
- log3("PluginService instance created");
290
- }
291
406
  /**
292
407
  * Batch imports plugin manifests using the dedicated import endpoint
293
408
  *
@@ -821,16 +936,6 @@ var PluginService = class extends BaseSDK {
821
936
  import debug4 from "debug";
822
937
  var log4 = debug4("lobe-market-sdk:admin:dependency");
823
938
  var SystemDependencyService = class extends BaseSDK {
824
- /**
825
- * Creates a new SystemDependencyService instance
826
- *
827
- * @param options - Configuration options for the SDK
828
- * @param sharedHeaders - Optional shared headers object for reuse across services
829
- */
830
- constructor(options = {}, sharedHeaders) {
831
- super(options, sharedHeaders);
832
- log4("SystemDependencyService instance created");
833
- }
834
939
  /**
835
940
  * Retrieves all system dependencies
836
941
  *
@@ -982,16 +1087,6 @@ var SettingsService = class extends BaseSDK {
982
1087
  import debug6 from "debug";
983
1088
  var log6 = debug6("lobe-market-sdk:admin:review");
984
1089
  var ReviewService = class extends BaseSDK {
985
- /**
986
- * Creates a new ReviewService instance
987
- *
988
- * @param options - Configuration options for the SDK
989
- * @param sharedHeaders - Optional shared headers object for reuse across services
990
- */
991
- constructor(options = {}, sharedHeaders) {
992
- super(options, sharedHeaders);
993
- log6("ReviewService instance created");
994
- }
995
1090
  /**
996
1091
  * Retrieves a list of reviews with filtering options
997
1092
  *
@@ -1150,14 +1245,18 @@ var MarketAdmin = class extends BaseSDK {
1150
1245
  */
1151
1246
  constructor(options = {}) {
1152
1247
  const apiKey = options.apiKey || process.env.MARKET_ADMIN_API_KEY;
1153
- super({ ...options, apiKey });
1248
+ const sharedTokenState = {
1249
+ accessToken: void 0,
1250
+ tokenExpiry: void 0
1251
+ };
1252
+ super({ ...options, apiKey }, void 0, sharedTokenState);
1154
1253
  log8("MarketAdmin instance created");
1155
- this.analysis = new AnalysisService(options, this.headers);
1156
- this.plugins = new PluginService(options, this.headers);
1157
- this.reviews = new ReviewService(options, this.headers);
1158
- this.settings = new SettingsService(options, this.headers);
1159
- this.dependencies = new SystemDependencyService(options, this.headers);
1160
- this.env = new PluginEnvService(options, this.headers);
1254
+ this.analysis = new AnalysisService(options, this.headers, sharedTokenState);
1255
+ this.plugins = new PluginService(options, this.headers, sharedTokenState);
1256
+ this.reviews = new ReviewService(options, this.headers, sharedTokenState);
1257
+ this.settings = new SettingsService(options, this.headers, sharedTokenState);
1258
+ this.dependencies = new SystemDependencyService(options, this.headers, sharedTokenState);
1259
+ this.env = new PluginEnvService(options, this.headers, sharedTokenState);
1161
1260
  }
1162
1261
  };
1163
1262
 
@@ -1168,16 +1267,6 @@ import debug11 from "debug";
1168
1267
  import debug9 from "debug";
1169
1268
  var log9 = debug9("lobe-market-sdk:discovery");
1170
1269
  var DiscoveryService = class extends BaseSDK {
1171
- /**
1172
- * Creates a new DiscoveryService instance
1173
- *
1174
- * @param options - Configuration options for the SDK
1175
- * @param sharedHeaders - Optional shared headers object for reuse across services
1176
- */
1177
- constructor(options = {}, sharedHeaders) {
1178
- super(options, sharedHeaders);
1179
- log9("DiscoveryService instance created");
1180
- }
1181
1270
  /**
1182
1271
  * Retrieves the service discovery document
1183
1272
  *
@@ -1203,16 +1292,6 @@ var DiscoveryService = class extends BaseSDK {
1203
1292
  import debug10 from "debug";
1204
1293
  var log10 = debug10("lobe-market-sdk:plugins");
1205
1294
  var PluginsService = class extends BaseSDK {
1206
- /**
1207
- * Creates a new PluginsService instance
1208
- *
1209
- * @param options - Configuration options for the SDK
1210
- * @param sharedHeaders - Optional shared headers object for reuse across services
1211
- */
1212
- constructor(options = {}, sharedHeaders) {
1213
- super(options, sharedHeaders);
1214
- log10("PluginsService instance created");
1215
- }
1216
1295
  /**
1217
1296
  * Retrieves a list of plugins from the marketplace
1218
1297
  *
@@ -1370,10 +1449,14 @@ var MarketSDK = class extends BaseSDK {
1370
1449
  * @param options - Configuration options for the SDK
1371
1450
  */
1372
1451
  constructor(options = {}) {
1373
- super(options);
1452
+ const sharedTokenState = {
1453
+ accessToken: void 0,
1454
+ tokenExpiry: void 0
1455
+ };
1456
+ super(options, void 0, sharedTokenState);
1374
1457
  log11("MarketSDK instance created");
1375
- this.plugins = new PluginsService(options, this.headers);
1376
- this.discovery = new DiscoveryService(options, this.headers);
1458
+ this.plugins = new PluginsService(options, this.headers, sharedTokenState);
1459
+ this.discovery = new DiscoveryService(options, this.headers, sharedTokenState);
1377
1460
  }
1378
1461
  /**
1379
1462
  * Retrieves the service discovery document
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/admin/MarketAdmin.ts","../src/core/BaseSDK.ts","../src/admin/services/AnalysisService.ts","../src/admin/services/PluginService.ts","../src/admin/services/SystemDependencyService.ts","../src/admin/services/SettingsService.ts","../src/admin/services/ReviewService.ts","../src/admin/services/PluginEnvService.ts","../src/market/market-sdk.ts","../src/market/services/DiscoveryService.ts","../src/market/services/PluginsService.ts","../src/types/admin.ts","../src/index.ts"],"sourcesContent":["import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport { MarketSDKOptions } from '@/types';\n\nimport {\n AnalysisService,\n PluginEnvService,\n PluginService,\n ReviewService,\n SettingsService,\n SystemDependencyService,\n} from './services';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin');\n\n/**\n * LobeHub Market Admin SDK Client\n *\n * Client for accessing administrative functionality of the LobeHub Marketplace.\n * This SDK provides privileged operations for managing plugins, reviews,\n * system settings, and dependencies. It requires admin-level authentication.\n */\nexport class MarketAdmin extends BaseSDK {\n /**\n * Market analysis service\n * Provides methods for accessing market analytics and statistics\n */\n readonly analysis: AnalysisService;\n\n /**\n * Plugin management service\n * Provides methods for creating, updating, and managing plugins\n */\n readonly plugins: PluginService;\n\n readonly env: PluginEnvService;\n\n /**\n * Review management service\n * Provides methods for moderating and managing user reviews\n */\n readonly reviews: ReviewService;\n\n /**\n * System settings management service\n * Provides methods for configuring marketplace settings\n */\n readonly settings: SettingsService;\n\n /**\n * System dependency management service\n * Provides methods for managing system dependencies required by plugins\n */\n readonly dependencies: SystemDependencyService;\n\n /**\n * Creates a new MarketAdmin instance\n *\n * @param options - Configuration options for the SDK\n */\n constructor(options: MarketSDKOptions = {}) {\n // Use admin-specific API key if available\n const apiKey = options.apiKey || process.env.MARKET_ADMIN_API_KEY;\n\n super({ ...options, apiKey });\n log('MarketAdmin instance created');\n\n // Initialize admin services with shared headers for efficient header reuse\n this.analysis = new AnalysisService(options, this.headers);\n this.plugins = new PluginService(options, this.headers);\n this.reviews = new ReviewService(options, this.headers);\n this.settings = new SettingsService(options, this.headers);\n this.dependencies = new SystemDependencyService(options, this.headers);\n this.env = new PluginEnvService(options, this.headers);\n }\n}\n","import debug from 'debug';\n\nimport type { MarketSDKOptions } from '../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:core');\n\n/**\n * Base SDK class\n *\n * Provides shared request handling and authentication functionality that is used\n * by both the Market SDK and Admin SDK. This class handles the common concerns:\n * - API endpoint configuration\n * - Authentication header management\n * - HTTP request handling\n * - Error handling\n * - Query string building\n */\nexport class BaseSDK {\n /** Base API URL */\n protected baseUrl: string;\n\n /** Default locale for requests that require localization */\n protected defaultLocale: string;\n\n /** HTTP headers to include with all requests */\n protected headers: Record<string, string>;\n\n /**\n * Creates a new BaseSDK instance\n *\n * @param options - Configuration options for the SDK\n * @param sharedHeaders - Optional shared headers object for reuse across services\n */\n constructor(options: MarketSDKOptions = {}, sharedHeaders?: Record<string, string>) {\n // Set base URL from options, environment variable, or default to production URL\n this.baseUrl =\n options.baseURL || process.env.MARKET_BASE_URL || 'https://market.lobehub.com/api';\n\n // Set default locale from options or use English as default\n this.defaultLocale = options.defaultLocale || 'en-US';\n\n // Get API key from options or environment variable\n const apiKey = options.apiKey || process.env.MARKET_API_KEY;\n\n // Either use shared headers or create new headers object\n if (sharedHeaders) {\n this.headers = sharedHeaders;\n log('Using shared headers object');\n } else {\n this.headers = {\n 'Content-Type': 'application/json',\n ...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}),\n };\n log('Created new headers object');\n }\n\n log('BaseSDK instance created: %O', {\n baseUrl: this.baseUrl,\n defaultLocale: this.defaultLocale,\n });\n }\n\n /**\n * Sends an HTTP request to the API and handles the response\n *\n * @param url - Request URL path (will be appended to baseUrl)\n * @param options - Fetch API request options\n * @returns Promise resolving to the parsed JSON response\n * @throws Error if the request fails\n */\n // eslint-disable-next-line no-undef\n protected async request<T>(url: string, options: RequestInit = {}): Promise<T> {\n log('Sending request: %s', `${this.baseUrl}${url}`);\n\n const response = await fetch(`${this.baseUrl}${url}`, {\n ...options,\n headers: {\n ...this.headers,\n ...options.headers,\n },\n });\n\n if (!response.ok) {\n const errorMsg = `Request failed: ${response.status} ${response.statusText}`;\n log('Request error: %s', errorMsg);\n throw new Error(errorMsg);\n }\n\n log('Request successful: %s', url);\n return response.json() as Promise<T>;\n }\n\n /**\n * Builds a URL query string from a parameters object\n *\n * @param params - Object containing query parameters\n * @returns Formatted query string (including leading ? if params exist)\n */\n protected buildQueryString(params: Record<string, any>): string {\n const query = Object.entries(params)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n .filter(([_, value]) => value !== undefined && value !== null)\n .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`)\n .join('&');\n\n return query ? `?${query}` : '';\n }\n\n /**\n * Sets an authentication token for API requests\n *\n * @param token - API authentication token\n */\n setAuthToken(token: string): void {\n log('Setting authentication token');\n this.headers.Authorization = `Bearer ${token}`;\n }\n\n /**\n * Clears the authentication token\n */\n clearAuthToken(): void {\n log('Clearing authentication token');\n delete this.headers.Authorization;\n }\n}\n","import { RangeQuery, RangeStats } from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:analysis');\n\n/**\n * Market Overview Statistics Interface\n * Defines the structure for market overview data\n */\nexport interface MarketOverviewStats {\n installs: {\n count: number;\n prevCount: number;\n };\n newPlugins: {\n count: number;\n prevCount: number;\n };\n period: string;\n plugins: {\n count: number;\n prevCount: number;\n };\n scores: {\n avg: number;\n prevAvg: number;\n };\n}\n\n/**\n * Period type for analysis queries\n */\nexport type AnalysisPeriod = '1d' | '7d' | '30d' | '1mo' | '3mo' | '1y';\n\n/**\n * Market overview query parameters\n */\nexport interface MarketOverviewQuery {\n /** Analysis period: 1d, 7d, 30d (rolling periods) or 1mo, 3mo, 1y (natural periods) */\n period?: AnalysisPeriod;\n}\n\n/**\n * Standard API response wrapper\n */\ninterface ApiResponse<T> {\n data: T;\n success: boolean;\n}\n\n/**\n * Analysis Management Service\n *\n * Provides administrative functionality for accessing market analysis and statistics.\n * This service handles retrieving various analytics reports including market overview,\n * plugin trends, and installation analytics for administrative dashboards.\n */\nexport class AnalysisService extends BaseSDK {\n /**\n * Retrieves market overview statistics\n *\n * Returns comprehensive market statistics including plugin counts,\n * installation metrics, new plugin trends, and rating averages\n * with comparison to previous periods.\n *\n * @param params - Query parameters for the analysis\n * @returns Promise resolving to market overview statistics\n */\n async getMarketOverview(params: MarketOverviewQuery = {}): Promise<MarketOverviewStats> {\n const { period = '30d' } = params;\n\n log('Getting market overview statistics for period: %s', period);\n\n const searchParams = new URLSearchParams();\n if (period) {\n searchParams.append('period', period);\n }\n\n const url = `/admin/analysis/plugin/overview${searchParams.toString() ? `?${searchParams.toString()}` : ''}`;\n\n const result = await this.request<ApiResponse<MarketOverviewStats>>(url);\n\n log('Market overview statistics retrieved successfully: %s', result.data);\n\n return result.data;\n }\n\n /**\n * Retrieves market overview statistics for 1 day period\n *\n * Convenience method for getting daily market statistics.\n *\n * @returns Promise resolving to market overview statistics for 1 day\n */\n async getDailyOverview(): Promise<MarketOverviewStats> {\n log('Getting daily market overview');\n return this.getMarketOverview({ period: '1d' });\n }\n\n /**\n * Retrieves market overview statistics for 7 days period\n *\n * Convenience method for getting weekly market statistics.\n *\n * @returns Promise resolving to market overview statistics for 7 days\n */\n async getWeeklyOverview(): Promise<MarketOverviewStats> {\n log('Getting weekly market overview');\n return this.getMarketOverview({ period: '7d' });\n }\n\n /**\n * Retrieves market overview statistics for 30 days period\n *\n * Convenience method for getting monthly market statistics.\n *\n * @returns Promise resolving to market overview statistics for 30 days\n */\n async getMonthlyOverview(): Promise<MarketOverviewStats> {\n log('Getting monthly market overview');\n return this.getMarketOverview({ period: '30d' });\n }\n\n /**\n * Retrieves market overview statistics for current natural month\n *\n * Convenience method for getting current month vs previous month statistics.\n *\n * @returns Promise resolving to market overview statistics for current month\n */\n async getThisMonthOverview(): Promise<MarketOverviewStats> {\n log('Getting this month market overview');\n return this.getMarketOverview({ period: '1mo' });\n }\n\n /**\n * Retrieves market overview statistics for current quarter\n *\n * Convenience method for getting current quarter vs previous quarter statistics.\n *\n * @returns Promise resolving to market overview statistics for current quarter\n */\n async getQuarterlyOverview(): Promise<MarketOverviewStats> {\n log('Getting quarterly market overview');\n return this.getMarketOverview({ period: '3mo' });\n }\n\n /**\n * Retrieves market overview statistics for current year\n *\n * Convenience method for getting current year vs previous year statistics.\n *\n * @returns Promise resolving to market overview statistics for current year\n */\n async getYearlyOverview(): Promise<MarketOverviewStats> {\n log('Getting yearly market overview');\n return this.getMarketOverview({ period: '1y' });\n }\n\n /**\n * Calculates growth rate between current and previous values\n *\n * Utility method for calculating percentage growth rates from the statistics.\n *\n * @param current - Current period value\n * @param previous - Previous period value\n * @returns Growth rate as percentage (e.g., 15.5 for 15.5% growth)\n */\n static calculateGrowthRate(current: number, previous: number): number {\n if (previous === 0) return current > 0 ? 100 : 0;\n return Math.round(((current - previous) / previous) * 100 * 10) / 10;\n }\n\n /**\n * Formats market overview statistics with calculated growth rates\n *\n * Utility method that enhances the raw statistics with calculated growth rates\n * for easier consumption in dashboards and reports.\n *\n * @param stats - Raw market overview statistics\n * @returns Enhanced statistics with growth rate calculations\n */\n static formatMarketOverview(stats: MarketOverviewStats) {\n return {\n ...stats,\n growth: {\n installs: this.calculateGrowthRate(stats.installs.count, stats.installs.prevCount),\n newPlugins: this.calculateGrowthRate(stats.newPlugins.count, stats.newPlugins.prevCount),\n plugins: this.calculateGrowthRate(stats.plugins.count, stats.plugins.prevCount),\n scores: this.calculateGrowthRate(stats.scores.avg, stats.scores.prevAvg),\n },\n };\n }\n\n /**\n * Retrieves installation trend statistics for a specified date range\n *\n * Returns daily installation counts and trends for the specified period\n * with optional comparison to a previous period.\n *\n * @param params - Query parameters including date range and display config\n * @returns Promise resolving to installation trend statistics\n */\n async getRangeInstalls(params: RangeQuery): Promise<RangeStats> {\n const { display, range, prevRange } = params;\n\n log('Getting installation trend statistics for range: %s to %s', range[0], range[1]);\n\n const searchParams = new URLSearchParams();\n searchParams.append('display', display);\n searchParams.append('range', range.join(','));\n if (prevRange) {\n searchParams.append('prevRange', prevRange.join(','));\n }\n\n const url = `/admin/analysis/plugin/range-installs?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<RangeStats>>(url);\n\n log(\n 'Installation trend statistics retrieved successfully: %d data points',\n result.data.data.length,\n );\n\n return result.data;\n }\n\n /**\n * Retrieves plugin growth trend statistics for a specified date range\n *\n * Returns daily plugin creation counts and trends for the specified period\n * with optional comparison to a previous period.\n *\n * @param params - Query parameters including date range and display config\n * @returns Promise resolving to plugin growth trend statistics\n */\n async getRangePlugins(params: RangeQuery): Promise<RangeStats> {\n const { display, range, prevRange } = params;\n\n log('Getting plugin growth trend statistics for range: %s to %s', range[0], range[1]);\n\n const searchParams = new URLSearchParams();\n searchParams.append('display', display);\n searchParams.append('range', range.join(','));\n if (prevRange) {\n searchParams.append('prevRange', prevRange.join(','));\n }\n\n const url = `/admin/analysis/plugin/range-plugins?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<RangeStats>>(url);\n\n log(\n 'Plugin growth trend statistics retrieved successfully: %d data points',\n result.data.data.length,\n );\n\n return result.data;\n }\n\n /**\n * Calculates trend growth rate between current and previous period totals\n *\n * Utility method for calculating percentage growth rates from range statistics.\n *\n * @param stats - Range statistics with sum and prevSum\n * @returns Growth rate as percentage (e.g., 15.5 for 15.5% growth)\n */\n static calculateTrendGrowthRate(stats: RangeStats): number {\n return this.calculateGrowthRate(stats.sum, stats.prevSum);\n }\n}\n","import type {\n AdminDeploymentOption,\n AdminPluginItem,\n AdminPluginItemDetail,\n IncompleteI18nPlugin,\n InstallationDetails,\n PluginManifest,\n PluginVersion,\n PluginVersionLocalization,\n SystemDependency,\n} from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport {\n AdminListQueryParams,\n AdminListResponse,\n MarketSDKOptions,\n PluginI18nImportParams,\n PluginI18nImportResponse,\n PluginUpdateParams,\n PluginVersionCreateParams,\n PluginVersionUpdateParams,\n UnclaimedPluginItem,\n} from '@/types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:plugins');\n\n/**\n * Plugin Management Service\n *\n * Provides administrative functionality for managing plugins in the marketplace.\n * This service handles CRUD operations for plugins, plugin versions, and deployment options.\n */\nexport class PluginService extends BaseSDK {\n /**\n * Creates a new PluginService instance\n *\n * @param options - Configuration options for the SDK\n * @param sharedHeaders - Optional shared headers object for reuse across services\n */\n constructor(options: MarketSDKOptions = {}, sharedHeaders?: Record<string, string>) {\n super(options, sharedHeaders);\n log('PluginService instance created');\n }\n\n /**\n * Batch imports plugin manifests using the dedicated import endpoint\n *\n * This method is intended for use with scripts and bulk import operations.\n *\n * @param manifests - Array of plugin manifests to import\n * @param ownerId - Optional owner ID to associate with the imported plugins\n * @returns Promise resolving to the import results with counts of success, skipped, failed, and a list of failed IDs\n */\n async importPlugins(\n manifests: PluginManifest[],\n ownerId?: number,\n ): Promise<{ failed: number; failedIds: string[]; skipped: number; success: number }> {\n log(`Starting batch plugin import of ${manifests.length} manifests`);\n if (ownerId) {\n log(`Using specified owner ID for import: ${ownerId}`);\n }\n\n const response = await this.request<{\n data: { failed: number; failedIds: string[]; skipped: number; success: number };\n }>('/admin/plugins/import', {\n body: JSON.stringify({\n manifests,\n ownerId,\n }),\n method: 'POST',\n });\n\n log(\n `Plugin import completed: ${response.data.success} succeeded, ${response.data.skipped} skipped, ${response.data.failed} failed`,\n );\n return response.data;\n }\n\n /**\n * Imports plugin internationalization (i18n) data\n *\n * Allows importing localized content for a specific plugin version.\n * This method creates or updates localizations for the specified plugin.\n *\n * @param params - Plugin i18n import parameters containing identifier, version, and localizations\n * @returns Promise resolving to the import results with counts of success and failure\n */\n async importPluginI18n(params: PluginI18nImportParams): Promise<PluginI18nImportResponse> {\n log(\n `Starting i18n import for plugin ${params.identifier} v${params.version} with ${params.localizations.length} localizations`,\n );\n\n const response = await this.request<{\n data: PluginI18nImportResponse;\n message: string;\n }>('/admin/plugins/import/i18n', {\n body: JSON.stringify(params),\n method: 'POST',\n });\n\n log(\n `Plugin i18n import completed: ${response.data.success} succeeded, ${response.data.failed} failed, ${response.data.totalLocalizations} total`,\n );\n return response.data;\n }\n\n /**\n * Retrieves a list of plugins with admin details\n *\n * Supports filtering, pagination, and sorting of results.\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the plugin list response with admin details\n */\n async getPlugins(params: AdminListQueryParams = {}): Promise<AdminListResponse<AdminPluginItem>> {\n log('Getting plugins with params: %O', params);\n\n const queryString = this.buildQueryString(params);\n const url = `/admin/plugins${queryString}`;\n\n const result = await this.request<AdminListResponse<AdminPluginItem>>(url);\n\n log('Retrieved %d plugins', result.data.length);\n return result;\n }\n\n /**\n * Retrieves all published plugin identifiers\n *\n * Returns a lightweight list of all published plugin identifiers without\n * full plugin metadata. This is useful for admin operations that need to know\n * which plugins are currently published and available to users.\n *\n * @returns Promise resolving to an array containing identifiers array and last modified time\n */\n async getPublishedIdentifiers(): Promise<{ identifier: string; lastModified: string }[]> {\n log('Getting published plugin identifiers (admin)');\n\n const result =\n await this.request<{ identifier: string; lastModified: string }[]>('/v1/plugins/identifiers');\n log('Retrieved %d published plugin identifiers (admin)', result.length);\n return result;\n }\n\n /**\n * Retrieves a single plugin with full admin details\n *\n * @param id - Plugin ID or identifier\n * @returns Promise resolving to the detailed plugin information with version history\n */\n async getPlugin(id: number | string): Promise<AdminPluginItemDetail> {\n log('Getting plugin details (admin): %d', id);\n\n const result = await this.request<AdminPluginItemDetail>(`/admin/plugins/${id}`);\n log('Retrieved plugin with %d versions', result.versions.length);\n return result;\n }\n\n /**\n * Retrieves a plugin by its GitHub repository URL\n *\n * @param githubUrl - The GitHub repository URL to search for\n * @returns Promise resolving to the detailed plugin information with version history\n */\n async getPluginByGithubUrl(githubUrl: string): Promise<AdminPluginItemDetail> {\n log('Getting plugin by GitHub URL: %s', githubUrl);\n\n const queryString = this.buildQueryString({ url: githubUrl });\n const result = await this.request<AdminPluginItemDetail>(\n `/admin/plugins/by-github-url${queryString}`,\n );\n log('Retrieved plugin with %d versions', result.versions.length);\n return result;\n }\n\n /**\n * Updates plugin information\n *\n * @param id - Plugin ID\n * @param data - Plugin update data containing fields to update\n * @returns Promise resolving to the updated plugin\n */\n async updatePlugin(id: number, data: PluginUpdateParams): Promise<AdminPluginItem> {\n log('Updating plugin: %d, data: %O', id, data);\n\n const result = await this.request<AdminPluginItem>(`/admin/plugins/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Plugin updated successfully');\n return result;\n }\n\n /**\n * Updates plugin publication status\n *\n * @param id - Plugin ID\n * @param status - New status to set\n * @returns Promise resolving to success response\n */\n async updatePluginStatus(\n id: number,\n status: 'published' | 'draft' | 'review' | 'rejected',\n ): Promise<{ message: string; success: boolean }> {\n log('Updating plugin status: %d to %s', id, status);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${id}/status`,\n {\n body: JSON.stringify({ status }),\n method: 'PATCH',\n },\n );\n log('Plugin status updated successfully');\n return result;\n }\n\n /**\n * Deletes a plugin\n *\n * @param id - Plugin ID\n * @returns Promise resolving to success response\n */\n async deletePlugin(id: number): Promise<{ message: string; success: boolean }> {\n log('Deleting plugin: %d', id);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${id}`,\n { method: 'DELETE' },\n );\n log('Plugin deleted successfully');\n return result;\n }\n\n /**\n * Retrieves the version history for a plugin\n *\n * @param pluginId - Plugin ID\n * @returns Promise resolving to an array of plugin versions\n */\n async getPluginVersions(pluginId: number): Promise<PluginVersion[]> {\n log('Getting plugin versions: pluginId=%d', pluginId);\n\n const result = await this.request<PluginVersion[]>(`/admin/plugins/${pluginId}/versions`);\n\n log('Retrieved %d versions', result.length);\n return result;\n }\n\n /**\n * Retrieves a specific plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to the plugin version details\n */\n async getPluginVersion(pluginId: number, versionId: number): Promise<PluginVersion> {\n log('Getting version details: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<PluginVersion>(\n `/admin/plugins/${pluginId}/versions/${versionId}`,\n );\n log('Version details retrieved');\n return result;\n }\n\n /**\n * Retrieves all localizations for a specific plugin version\n *\n * @param pluginId - Plugin ID or identifier\n * @param versionId - Version ID\n * @returns Promise resolving to an array of plugin version localizations\n */\n async getPluginLocalizations(\n pluginId: number | string,\n versionId: number,\n ): Promise<PluginVersionLocalization[]> {\n log('Getting localizations: pluginId=%s, versionId=%d', pluginId, versionId);\n\n const result = await this.request<PluginVersionLocalization[]>(\n `/admin/plugins/${pluginId}/versions/${versionId}/localizations`,\n );\n log('Retrieved %d localizations for plugin %s, version %d', result.length, pluginId, versionId);\n return result;\n }\n\n /**\n * Creates a new plugin version with all version-specific data\n *\n * @param pluginId - Plugin ID\n * @param data - Version creation data including all version-specific fields\n * @returns Promise resolving to the created plugin version\n */\n async createPluginVersion(\n pluginId: number,\n data: PluginVersionCreateParams,\n ): Promise<PluginVersion> {\n log('Creating new plugin version: pluginId=%d, data: %O', pluginId, data);\n\n const result = await this.request<PluginVersion>(`/admin/plugins/${pluginId}/versions`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Plugin version created successfully: version=%s', data.version);\n return result;\n }\n\n /**\n * Creates a new plugin version from a manifest\n * Extracts version data from the manifest for easier creation\n *\n * @param pluginId - Plugin ID\n * @param manifest - Plugin manifest containing all version data\n * @param options - Additional options for version creation\n * @returns Promise resolving to the created plugin version\n */\n async createPluginVersionFromManifest(\n pluginId: number,\n manifest: PluginManifest,\n options: {\n isLatest?: boolean;\n isValidated?: boolean;\n } = {},\n ): Promise<PluginVersion> {\n log(\n 'Creating plugin version from manifest: pluginId=%d, version=%s',\n pluginId,\n manifest.version,\n );\n\n const versionData: PluginVersionCreateParams = {\n author: manifest.author?.name,\n authorUrl: manifest.author?.url,\n capabilitiesPrompts: manifest.capabilities?.prompts,\n capabilitiesResources: manifest.capabilities?.resources,\n capabilitiesTools: manifest.capabilities?.tools,\n category: manifest.category,\n description: manifest.description,\n icon: manifest.icon,\n isLatest: options.isLatest,\n isValidated: options.isValidated,\n name: manifest.name,\n prompts: manifest.prompts,\n readme: manifest.overview?.readme,\n resources: manifest.resources,\n summary: manifest.overview?.summary,\n tags: manifest.tags,\n tools: manifest.tools,\n version: manifest.version,\n };\n\n return this.createPluginVersion(pluginId, versionData);\n }\n\n /**\n * Updates a plugin version with comprehensive version-specific data\n *\n * @param idOrIdentifier - Plugin ID\n * @param versionId - Version ID\n * @param data - Version update data including all version-specific fields\n * @returns Promise resolving to the updated plugin version\n */\n async updatePluginVersion(\n idOrIdentifier: number | string,\n versionId: number,\n data: PluginVersionUpdateParams,\n ): Promise<PluginVersion> {\n log(\n 'Updating plugin version: pluginId=%d, versionId=%d, data: %O',\n idOrIdentifier,\n versionId,\n data,\n );\n\n const result = await this.request<PluginVersion>(\n `/admin/plugins/${idOrIdentifier}/versions/${versionId}`,\n {\n body: JSON.stringify(data),\n method: 'PUT',\n },\n );\n\n log('Plugin version updated successfully');\n return result;\n }\n\n /**\n * Deletes a plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to success response\n */\n async deletePluginVersion(\n pluginId: number,\n versionId: number,\n ): Promise<{ message: string; success: boolean }> {\n log('Deleting version: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${pluginId}/versions/${versionId}`,\n { method: 'DELETE' },\n );\n log('Plugin version deleted successfully');\n return result;\n }\n\n /**\n * Sets a specific version as the latest version of a plugin\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID to set as latest\n * @returns Promise resolving to success response\n */\n async setPluginVersionAsLatest(\n pluginId: number,\n versionId: number,\n ): Promise<{ message: string; success: boolean }> {\n log('Setting version as latest: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${pluginId}/versions/${versionId}/latest`,\n { method: 'POST' },\n );\n log('Version set as latest successfully');\n return result;\n }\n\n /**\n * Updates plugin visibility\n *\n * @param id - Plugin ID\n * @param visibility - New visibility setting\n * @returns Promise resolving to success response\n */\n async updatePluginVisibility(\n id: number,\n visibility: 'public' | 'private' | 'unlisted',\n ): Promise<{ message: string; success: boolean }> {\n log('Updating plugin visibility: %d to %s', id, visibility);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${id}/visibility`,\n {\n body: JSON.stringify({ visibility }),\n method: 'PATCH',\n },\n );\n log('Plugin visibility updated successfully');\n return result;\n }\n\n /**\n * Updates status for multiple plugins in a single operation\n *\n * @param ids - Array of plugin IDs to update\n * @param status - New status to set for all specified plugins\n * @returns Promise resolving to success response\n */\n async batchUpdatePluginStatus(\n ids: number[],\n status: 'published' | 'draft' | 'review' | 'rejected',\n ): Promise<{ message: string; success: boolean }> {\n log('Batch updating plugin status: %O to %s', ids, status);\n\n const result = await this.request<{ message: string; success: boolean }>(\n '/admin/plugins/batch/status',\n {\n body: JSON.stringify({ ids, status }),\n method: 'PATCH',\n },\n );\n log('Batch plugin status update completed');\n return result;\n }\n\n /**\n * Deletes multiple plugins in a single operation\n *\n * @param ids - Array of plugin IDs to delete\n * @returns Promise resolving to success response\n */\n async batchDeletePlugins(ids: number[]): Promise<{ message: string; success: boolean }> {\n log('Batch deleting plugins: %O', ids);\n\n const result = await this.request<{ message: string; success: boolean }>(\n '/admin/plugins/batch/delete',\n {\n body: JSON.stringify({ ids }),\n method: 'DELETE',\n },\n );\n log('Batch plugin deletion completed');\n return result;\n }\n\n /**\n * Retrieves detailed information about a plugin version including deployment options\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to version details with deployment options\n */\n async getPluginVersionDetails(\n pluginId: number,\n versionId: number,\n ): Promise<PluginVersion & { deploymentOptions: any }> {\n log(\n 'Getting version details with deployment options: pluginId=%d, versionId=%d',\n pluginId,\n versionId,\n );\n\n const result = await this.request<PluginVersion & { deploymentOptions: any }>(\n `/admin/plugins/${pluginId}/versions/${versionId}`,\n );\n log('Version details with deployment options retrieved');\n return result;\n }\n\n /**\n * Retrieves deployment options for a specific plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to an array of deployment options\n */\n async getDeploymentOptions(\n pluginId: number,\n versionId: number,\n ): Promise<AdminDeploymentOption[]> {\n log('Getting deployment options: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<AdminDeploymentOption[]>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options`,\n );\n log('Retrieved %d deployment options', result.length);\n return result;\n }\n\n /**\n * Creates a new deployment option for a plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param data - Deployment option configuration data\n * @returns Promise resolving to the created deployment option\n */\n async createDeploymentOption(\n pluginId: number,\n versionId: number,\n data: {\n connectionArgs?: string[];\n connectionCommand?: string;\n connectionType: string;\n description?: string;\n installationDetails?: InstallationDetails;\n installationMethod: string;\n isRecommended?: boolean;\n },\n ): Promise<AdminDeploymentOption> {\n log('Creating deployment option: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<AdminDeploymentOption>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options`,\n {\n body: JSON.stringify(data),\n method: 'POST',\n },\n );\n log('Deployment option created successfully');\n return result;\n }\n\n /**\n * Updates an existing deployment option\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param optionId - Deployment option ID\n * @param data - Updated deployment option configuration\n * @returns Promise resolving to the updated deployment option\n */\n async updateDeploymentOption(\n pluginId: number,\n versionId: number,\n optionId: number,\n data: {\n connectionArgs?: string[];\n connectionCommand?: string;\n connectionType?: string;\n description?: string;\n installationDetails?: Record<string, any>;\n installationMethod?: string;\n isRecommended?: boolean;\n },\n ): Promise<AdminDeploymentOption> {\n log(\n 'Updating deployment option: pluginId=%d, versionId=%d, optionId=%d',\n pluginId,\n versionId,\n optionId,\n );\n\n const result = await this.request<AdminDeploymentOption>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}`,\n {\n body: JSON.stringify(data),\n method: 'PUT',\n },\n );\n log('Deployment option updated successfully');\n return result;\n }\n\n /**\n * Deletes a deployment option\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param optionId - Deployment option ID\n * @returns Promise resolving to success response\n */\n async deleteDeploymentOption(\n pluginId: number,\n versionId: number,\n optionId: number,\n ): Promise<{ message: string; success: boolean }> {\n log(\n 'Deleting deployment option: pluginId=%d, versionId=%d, optionId=%d',\n pluginId,\n versionId,\n optionId,\n );\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}`,\n { method: 'DELETE' },\n );\n log('Deployment option deleted successfully');\n return result;\n }\n\n /**\n * Retrieves system dependencies for a deployment option\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param optionId - Deployment option ID\n * @returns Promise resolving to an array of system dependencies\n */\n async getDeploymentOptionSystemDependencies(\n pluginId: number,\n versionId: number,\n optionId: number,\n ): Promise<SystemDependency[]> {\n log(\n 'Getting system dependencies: pluginId=%d, versionId=%d, optionId=%d',\n pluginId,\n versionId,\n optionId,\n );\n\n const result = await this.request<SystemDependency[]>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}/system-dependencies`,\n );\n log('Retrieved %d system dependencies', result.length);\n return result;\n }\n\n /**\n * Retrieves verified plugins without summary information\n *\n * Returns plugins that are validated but missing summary data.\n *\n * @returns Promise resolving to array of plugins with incomplete summary data\n */\n async getVerifiedPluginsWithoutSummary(): Promise<\n { identifier: string; manifest: PluginManifest; versionId: number }[]\n > {\n log('Getting verified plugins without summary');\n\n const result = await this.request<\n { identifier: string; manifest: PluginManifest; versionId: number }[]\n >('/admin/plugins/verified-without-summary');\n\n log('Retrieved %d verified plugins without summary', result.length);\n return result;\n }\n\n /**\n * Retrieves plugins with incomplete internationalization\n *\n * Returns plugins where pluginVersionLocalizations has only 1 entry.\n *\n * @returns Promise resolving to an array of plugins with incomplete i18n\n */\n async getIncompleteI18nPlugins(): Promise<IncompleteI18nPlugin[]> {\n log('Getting plugins with incomplete i18n');\n\n const result = await this.request<IncompleteI18nPlugin[]>('/admin/plugins/incomplete-i18n');\n log('Retrieved %d plugins with incomplete i18n', result.length);\n return result;\n }\n\n /**\n * Retrieves unclaimed plugins\n *\n * Returns plugins where isClaimed is false, containing only ID and identifier.\n *\n * @returns Promise resolving to an array of unclaimed plugins with basic info\n */\n async getUnclaimedPlugins(): Promise<UnclaimedPluginItem[]> {\n log('Getting unclaimed plugins');\n\n const result = await this.request<UnclaimedPluginItem[]>('/admin/plugins/unclaimed');\n log('Retrieved %d unclaimed plugins', result.length);\n return result;\n }\n}\n","import type { SystemDependency } from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport type { MarketSDKOptions } from '@/types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:dependency');\n\n/**\n * System Dependency Management Service\n *\n * Provides administrative functionality for managing system dependencies\n * required by plugins. This service handles creating, updating, deleting,\n * and listing system dependencies that plugins may require.\n */\nexport class SystemDependencyService extends BaseSDK {\n /**\n * Creates a new SystemDependencyService instance\n *\n * @param options - Configuration options for the SDK\n * @param sharedHeaders - Optional shared headers object for reuse across services\n */\n constructor(options: MarketSDKOptions = {}, sharedHeaders?: Record<string, string>) {\n super(options, sharedHeaders);\n log('SystemDependencyService instance created');\n }\n\n /**\n * Retrieves all system dependencies\n *\n * Gets a list of all defined system dependencies that plugins may require.\n *\n * @returns Promise resolving to an array of system dependencies\n */\n async getSystemDependencies(): Promise<SystemDependency[]> {\n log('Getting all system dependencies');\n\n const result = await this.request<SystemDependency[]>(`/admin/plugins/dependencies`);\n log('Retrieved %d system dependencies', result.length);\n return result;\n }\n\n /**\n * Retrieves a specific system dependency by ID\n *\n * @param id - System dependency ID\n * @returns Promise resolving to the system dependency details\n */\n async getSystemDependency(id: number): Promise<SystemDependency> {\n log('Getting system dependency details: %d', id);\n\n const result = await this.request<SystemDependency>(`/admin/plugins/dependencies/${id}`);\n log('System dependency details retrieved');\n return result;\n }\n\n /**\n * Creates a new system dependency\n *\n * @param data - System dependency creation data\n * @returns Promise resolving to the created system dependency\n */\n async createSystemDependency(data: Omit<SystemDependency, 'id'>): Promise<SystemDependency> {\n log('Creating system dependency: %O', data);\n\n const result = await this.request<SystemDependency>(`/admin/plugins/dependencies`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('System dependency created successfully');\n return result;\n }\n\n /**\n * Updates an existing system dependency\n *\n * @param id - System dependency ID\n * @param data - System dependency update data\n * @returns Promise resolving to the updated system dependency\n */\n async updateSystemDependency(\n id: number,\n data: Partial<SystemDependency>,\n ): Promise<SystemDependency> {\n log('Updating system dependency: %d, data: %O', id, data);\n\n const result = await this.request<SystemDependency>(`/admin/plugins/dependencies/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('System dependency updated successfully');\n return result;\n }\n\n /**\n * Deletes a system dependency\n *\n * @param id - System dependency ID\n * @returns Promise resolving to success response\n */\n async deleteSystemDependency(id: number): Promise<{ message: string; success: boolean }> {\n log('Deleting system dependency: %d', id);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/dependencies/${id}`,\n { method: 'DELETE' },\n );\n log('System dependency deleted successfully');\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:settings');\n\n/**\n * Settings entity representing a system setting\n */\nexport interface Settings {\n /** Creation timestamp (ISO 8601 format) */\n createdAt: string;\n /** Optional description of the setting's purpose */\n description?: string;\n /** Unique identifier for the setting */\n id: number;\n /** Setting key name used for retrieving the setting */\n key: string;\n /** Last update timestamp (ISO 8601 format) */\n updatedAt: string;\n /** Setting value (stored as string) */\n value: string;\n}\n\n/**\n * Configuration for enabled resource types\n */\nexport interface EnabledResources {\n /** Whether agent resources are enabled */\n agents: boolean;\n /** Whether plugin resources are enabled */\n plugins: boolean;\n}\n\n/**\n * Authentication configuration\n */\nexport interface AuthenticationConfig {\n /** Whether authentication is required */\n enabled: boolean;\n /** Supported authentication schemes */\n schemes: string[];\n}\n\n/**\n * Documentation URL configuration\n */\nexport interface DocumentationConfig {\n /** URL to API documentation */\n apiUrl?: string;\n /** URL to privacy policy */\n policyUrl?: string;\n /** URL to terms of service */\n termsOfServiceUrl?: string;\n}\n\n/**\n * Map of all system settings with typed properties\n */\nexport interface SettingsMap {\n /** Additional settings (dynamically added) */\n [key: string]: any;\n /** Authentication configuration */\n authentication: AuthenticationConfig;\n /** Base URL for the marketplace */\n baseURL: string;\n /** Documentation URL configuration */\n documentation: DocumentationConfig;\n /** Configuration for enabled resource types */\n enabledResources: EnabledResources;\n /** Supported locales */\n locales: string[];\n}\n\n/**\n * Parameters for creating a new setting\n */\nexport interface CreateSettingsParams {\n /** Optional description of the setting's purpose */\n description?: string;\n /** Setting key name */\n key: string;\n /** Setting value (will be stored as string) */\n value: string;\n}\n\n/**\n * Parameters for updating an existing setting\n */\nexport interface UpdateSettingsParams {\n /** Optional new description */\n description?: string;\n /** New setting value */\n value: string;\n}\n\n/**\n * Settings Management Service\n *\n * Provides administrative functionality for managing system settings.\n * This service handles getting, creating, updating, and deleting\n * configuration settings for the marketplace.\n */\nexport class SettingsService extends BaseSDK {\n /**\n * Retrieves all system settings\n *\n * Returns a consolidated map of all settings with typed values\n * for known setting keys.\n *\n * @returns Promise resolving to the settings map\n */\n async getSettings(): Promise<SettingsMap> {\n return await this.request<SettingsMap>('/admin/settings');\n }\n\n /**\n * Retrieves a specific setting by key\n *\n * @param key - Setting key name\n * @returns Promise resolving to the setting details\n */\n async getSettingByKey(key: string): Promise<{ data: Settings }> {\n log('Getting setting: %s', key);\n\n const result = await this.request<{ data: Settings }>(`/admin/settings/${key}`);\n log('Setting retrieved');\n return result;\n }\n\n /**\n * Creates a new system setting\n *\n * @param data - Setting creation parameters\n * @returns Promise resolving to the created setting\n */\n async createSetting(data: CreateSettingsParams): Promise<{ data: Settings }> {\n log('Creating setting: %O', data);\n\n const result = await this.request<{ data: Settings }>('/admin/settings', {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Setting created successfully');\n return result;\n }\n\n /**\n * Updates an existing setting\n *\n * @param key - Setting key name\n * @param data - Setting update parameters\n * @returns Promise resolving to the updated setting\n */\n async updateSetting(key: string, data: UpdateSettingsParams): Promise<{ data: Settings }> {\n log('Updating setting: %s, data: %O', key, data);\n\n const result = await this.request<{ data: Settings }>(`/admin/settings/${key}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Setting updated successfully');\n return result;\n }\n\n /**\n * Deletes a setting\n *\n * @param key - Setting key name\n * @returns Promise resolving to success message\n */\n async deleteSetting(key: string): Promise<{ message: string }> {\n log('Deleting setting: %s', key);\n\n const result = await this.request<{ message: string }>(`/admin/settings/${key}`, {\n method: 'DELETE',\n });\n log('Setting deleted successfully');\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport type {\n AdminListQueryParams,\n AdminListResponse,\n MarketSDKOptions,\n ReviewStatus,\n} from '@/types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:review');\n\n/**\n * Review entity representing a plugin review\n */\nexport interface Review {\n /** Optional comment providing feedback */\n comment?: string;\n /** Creation timestamp (ISO 8601 format) */\n createdAt: string;\n /** Unique identifier for the review */\n id: number;\n /** ID of the plugin being reviewed */\n pluginId: number;\n /** ID of the reviewer (if available) */\n reviewerId?: number;\n /** Current status of the review */\n status: ReviewStatus;\n /** Last update timestamp (ISO 8601 format) */\n updatedAt: string;\n}\n\n/**\n * Extended review information with related entities\n */\nexport interface PluginReviewWithRelations extends Review {\n /** Related plugin information */\n plugin?: any;\n /** Related version information */\n version?: any;\n}\n\n/**\n * Parameters for updating a review\n */\nexport interface UpdateReviewParams {\n /** Optional comment or feedback */\n comment?: string;\n /** New status to set for the review */\n status: ReviewStatus;\n}\n\n/**\n * Review Management Service\n *\n * Provides administrative functionality for managing plugin reviews.\n * This service handles listing, fetching, and updating review statuses\n * for plugins in the marketplace.\n */\nexport class ReviewService extends BaseSDK {\n /**\n * Creates a new ReviewService instance\n *\n * @param options - Configuration options for the SDK\n * @param sharedHeaders - Optional shared headers object for reuse across services\n */\n constructor(options: MarketSDKOptions = {}, sharedHeaders?: Record<string, string>) {\n super(options, sharedHeaders);\n log('ReviewService instance created');\n }\n\n /**\n * Retrieves a list of reviews with filtering options\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the review list response\n */\n async getReviews(\n params: AdminListQueryParams = {},\n ): Promise<AdminListResponse<PluginReviewWithRelations>> {\n log('Getting reviews with params: %O', params);\n\n const queryString = this.buildQueryString(params);\n const url = `/admin/reviews${queryString ? `?${queryString}` : ''}`;\n\n const result = await this.request<AdminListResponse<PluginReviewWithRelations>>(url);\n\n log('Retrieved %d reviews', result.data.length);\n return result;\n }\n\n /**\n * Retrieves a specific review by ID\n *\n * @param id - Review ID\n * @returns Promise resolving to the review details\n */\n async getReviewById(id: number): Promise<Review> {\n log('Getting review details: %d', id);\n\n const result = await this.request<Review>(`/admin/reviews/${id}`);\n log('Review details retrieved');\n return result;\n }\n\n /**\n * Updates a review's status and comment\n *\n * @param id - Review ID\n * @param data - Update parameters containing new status and optional comment\n * @returns Promise resolving to the updated review\n */\n async updateReview(id: number, data: UpdateReviewParams): Promise<Review> {\n log('Updating review: %d, data: %O', id, data);\n\n const result = await this.request<Review>(`/admin/reviews/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Review updated successfully');\n return result;\n }\n\n /**\n * Retrieves the review history for a specific plugin\n *\n * @param pluginId - Plugin ID\n * @returns Promise resolving to an array of reviews for the plugin\n */\n async getPluginReviews(pluginId: number): Promise<{ data: Review[] }> {\n log('Getting plugin reviews: pluginId=%d', pluginId);\n\n const result = await this.request<{ data: Review[] }>(`/admin/reviews/plugin/${pluginId}`);\n log('Retrieved %d reviews for plugin', result.data.length);\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport type { AdminListResponse } from '@/types/admin';\n\ntype AdminPluginEnvListQuery = any;\ntype PluginEnv = any;\n\nconst log = debug('lobe-market-sdk:admin:plugin-env');\n\nexport interface AdminPluginEnvCreateParams {\n description?: string;\n identifier: string;\n key: string;\n value: string;\n}\n\nexport interface AdminPluginEnvUpdateParams {\n description?: string;\n value?: string;\n}\n\n/**\n * Plugin Environment Variable Management Service\n *\n * Provides administrative functionality for managing plugin environment variables.\n */\nexport class PluginEnvService extends BaseSDK {\n /**\n * Retrieves a paginated list of plugin environment variables\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the env list response\n */\n async getPluginEnvs(params: AdminPluginEnvListQuery = {}): Promise<AdminListResponse<PluginEnv>> {\n log('Getting plugin envs with params: %O', params);\n const queryString = this.buildQueryString(params);\n const url = `/admin/plugins/env${queryString}`;\n const result = await this.request<AdminListResponse<PluginEnv>>(url);\n log('Retrieved %d plugin envs', result.data.length);\n return result;\n }\n\n /**\n * Retrieves a single plugin environment variable by ID\n *\n * @param id - Env ID\n * @returns Promise resolving to the env item\n */\n async getPluginEnv(id: number): Promise<PluginEnv> {\n log('Getting plugin env: %d', id);\n const result = await this.request<PluginEnv>(`/admin/plugins/env/${id}`);\n log('Retrieved plugin env: %d', id);\n return result;\n }\n\n /**\n * Creates a new plugin environment variable\n *\n * @param data - Env creation data\n * @returns Promise resolving to the created env item\n */\n async createPluginEnv(data: AdminPluginEnvCreateParams): Promise<PluginEnv> {\n log('Creating plugin env: %O', data);\n const result = await this.request<PluginEnv>(`/admin/plugins/env`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Plugin env created successfully');\n return result;\n }\n\n /**\n * Updates a plugin environment variable\n *\n * @param id - Env ID\n * @param data - Env update data\n * @returns Promise resolving to the updated env item\n */\n async updatePluginEnv(id: number, data: AdminPluginEnvUpdateParams): Promise<PluginEnv> {\n log('Updating plugin env: %d, data: %O', id, data);\n const result = await this.request<PluginEnv>(`/admin/plugins/env/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Plugin env updated successfully');\n return result;\n }\n\n /**\n * Deletes a plugin environment variable\n *\n * @param id - Env ID\n * @returns Promise resolving to success response\n */\n async deletePluginEnv(id: number): Promise<{ success: boolean }> {\n log('Deleting plugin env: %d', id);\n const result = await this.request<{ success: boolean }>(`/admin/plugins/env/${id}`, {\n method: 'DELETE',\n });\n log('Plugin env deleted successfully');\n return result;\n }\n\n /**\n * Batch import plugin environment variables\n *\n * @param data - Batch import data, format: { [plugin: string]: { [envKey: string]: string } }\n * @returns Promise resolving to import result\n */\n async importPluginEnvs(\n data: Record<string, Record<string, string>>,\n ): Promise<{ success: number }> {\n log('Batch importing plugin envs: %O', data);\n const result = await this.request<{ success: number }>(`/admin/plugins/env/import`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Batch import completed: %d envs imported', result.success);\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../core/BaseSDK';\nimport type { DiscoveryDocument, MarketSDKOptions } from '../types';\nimport { DiscoveryService, PluginsService } from './services';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk');\n\n/**\n * LobeHub Market SDK Client\n *\n * Main client for accessing the LobeHub Marketplace API.\n * This class provides access to marketplace resources like plugins, agents,\n * and service discovery information. It follows a composition pattern\n * by combining specialized domain services.\n */\nexport class MarketSDK extends BaseSDK {\n /**\n * Plugins service for accessing plugin-related functionality\n * Provides methods to list, search, retrieve plugin information, and report installation attempts\n */\n readonly plugins: PluginsService;\n\n /**\n * Discovery service for retrieving API service information\n * Used to get information about available endpoints and services\n */\n private readonly discovery: DiscoveryService;\n\n /**\n * Creates a new MarketSDK instance\n *\n * @param options - Configuration options for the SDK\n */\n constructor(options: MarketSDKOptions = {}) {\n super(options);\n log('MarketSDK instance created');\n\n // Initialize domain services with shared headers for efficient header reuse\n this.plugins = new PluginsService(options, this.headers);\n this.discovery = new DiscoveryService(options, this.headers);\n }\n\n /**\n * Retrieves the service discovery document\n *\n * The discovery document provides information about available API endpoints,\n * versions, and capabilities of the Market API.\n *\n * @returns Promise resolving to the service discovery document\n */\n async getDiscoveryDocument(): Promise<DiscoveryDocument> {\n return this.discovery.getDiscoveryDocument();\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type { DiscoveryDocument, MarketSDKOptions } from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:discovery');\n\n/**\n * Discovery Service\n *\n * Provides functionality for retrieving service discovery information\n * from the LobeHub Marketplace API. The discovery document contains\n * metadata about available endpoints, authentication methods, and\n * other capabilities of the API.\n */\nexport class DiscoveryService extends BaseSDK {\n /** Cached discovery document to avoid repeated requests */\n private discoveryDoc?: DiscoveryDocument;\n\n /**\n * Creates a new DiscoveryService instance\n *\n * @param options - Configuration options for the SDK\n * @param sharedHeaders - Optional shared headers object for reuse across services\n */\n constructor(options: MarketSDKOptions = {}, sharedHeaders?: Record<string, string>) {\n super(options, sharedHeaders);\n log('DiscoveryService instance created');\n }\n\n /**\n * Retrieves the service discovery document\n *\n * This document contains information about available API endpoints,\n * authentication methods, and other capabilities of the Market API.\n * The result is cached after the first request to improve performance.\n *\n * @returns Promise resolving to the service discovery document\n */\n async getDiscoveryDocument(): Promise<DiscoveryDocument> {\n log('Fetching discovery document');\n if (this.discoveryDoc) {\n log('Returning cached discovery document');\n return this.discoveryDoc;\n }\n\n this.discoveryDoc = await this.request<DiscoveryDocument>('/market/.well-known/discovery');\n log('Discovery document successfully fetched');\n return this.discoveryDoc;\n }\n}\n","import type {\n InstallReportRequest,\n InstallReportResponse,\n PluginItemDetail,\n PluginManifest,\n} from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n CategoryItem,\n CategoryListQuery,\n MarketSDKOptions,\n PluginListResponse,\n PluginQueryParams,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:plugins');\n\n/**\n * Plugins Service\n *\n * Provides access to plugin-related functionality in the LobeHub Marketplace.\n * This service handles listing, searching, and retrieving detailed information\n * about plugins available in the marketplace.\n */\nexport class PluginsService extends BaseSDK {\n /**\n * Creates a new PluginsService instance\n *\n * @param options - Configuration options for the SDK\n * @param sharedHeaders - Optional shared headers object for reuse across services\n */\n constructor(options: MarketSDKOptions = {}, sharedHeaders?: Record<string, string>) {\n super(options, sharedHeaders);\n log('PluginsService instance created');\n }\n\n /**\n * Retrieves a list of plugins from the marketplace\n *\n * Supports filtering, pagination, and localization of results.\n *\n * @param params - Query parameters for filtering and pagination\n * @param options\n * @returns Promise resolving to the plugin list response containing items and pagination info\n */\n async getPluginList(\n params: PluginQueryParams = {},\n options?: globalThis.RequestInit,\n ): Promise<PluginListResponse> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting plugin list: %O', queryParams);\n\n const result = await this.request<PluginListResponse>(`/v1/plugins${queryString}`, options);\n log('Retrieved %d plugins', result.items.length);\n return result;\n }\n\n /**\n * Retrieves all plugin categories and their counts\n *\n * Returns a list of categories along with the number of plugins in each category.\n * Useful for building category filters in a UI. Supports optional search filtering\n * via 'q' parameter and locale specification.\n *\n * @param params - Query parameters for filtering categories\n * @param options - Optional request options\n * @returns Promise resolving to an array of category items with counts\n */\n async getCategories(\n params: CategoryListQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<CategoryItem[]> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting plugin categories: %O', queryParams);\n\n const result = await this.request<CategoryItem[]>(\n `/v1/plugins/categories${queryString}`,\n options,\n );\n log('Retrieved %d categories', result.length);\n return result;\n }\n\n /**\n * Retrieves all published plugin identifiers\n *\n * Returns a lightweight list of all published plugin identifiers without\n * full plugin metadata. This is useful for clients that need to know which\n * plugins are available without fetching complete plugin information.\n *\n * @returns Promise resolving to an array containing identifiers array and last modified time\n */\n async getPublishedIdentifiers(\n options?: globalThis.RequestInit,\n ): Promise<{ identifier: string; lastModified: string }[]> {\n log('Getting published plugin identifiers');\n\n const result = await this.request<{ identifier: string; lastModified: string }[]>(\n '/v1/plugins/identifiers',\n options,\n );\n log('Retrieved %d published plugin identifiers', result.length);\n return result;\n }\n\n /**\n * Retrieves the manifest for a specific plugin\n *\n * The manifest contains detailed information about a plugin, including\n * its capabilities, tools, prompts, and resources.\n *\n * @param identifier - Unique identifier of the plugin\n * @param locale - Optional locale for localized content (defaults to SDK default locale)\n * @param version - Optional specific version to retrieve (defaults to latest)\n * @param options\n * @returns Promise resolving to the plugin manifest\n */\n async getPluginManifest(\n {\n locale,\n version,\n identifier,\n }: {\n identifier: string;\n locale?: string;\n version?: string;\n },\n options?: globalThis.RequestInit,\n ): Promise<PluginManifest> {\n log('Getting plugin manifest: %O', { identifier, locale, version });\n const localeParam = locale || this.defaultLocale;\n const params: Record<string, string> = { locale: localeParam };\n if (version) {\n params.version = version;\n }\n const queryString = this.buildQueryString(params);\n\n const manifest = await this.request<PluginManifest>(\n `/v1/plugins/${identifier}/manifest${queryString}`,\n options,\n );\n\n log('Plugin manifest successfully retrieved: %s', identifier);\n return manifest;\n }\n\n /**\n * Retrieves the plugin detailed information about a plugin, including\n * its capabilities, tools, prompts, and resources.\n *\n * @param identifier - Unique identifier of the plugin\n * @param locale - Optional locale for localized content (defaults to SDK default locale)\n * @param version - Optional specific version to retrieve (defaults to latest)\n * @returns Promise resolving to the plugin manifest\n */\n async getPluginDetail(\n {\n locale,\n version,\n identifier,\n }: {\n identifier: string;\n locale?: string;\n version?: string;\n },\n options?: globalThis.RequestInit,\n ): Promise<PluginItemDetail> {\n log('Getting plugin detail: %O', { identifier, locale, version });\n const localeParam = locale || this.defaultLocale;\n const params: Record<string, string> = { locale: localeParam };\n if (version) {\n params.version = version;\n }\n const queryString = this.buildQueryString(params);\n\n const manifest = await this.request<PluginItemDetail>(\n `/v1/plugins/${identifier}${queryString}`,\n options,\n );\n\n log('Plugin manifest successfully retrieved: %s', identifier);\n return manifest;\n }\n\n /**\n * Report a plugin installation attempt\n *\n * Reports the outcome of a plugin installation attempt, including timing,\n * success status, manifest information, and error details if applicable.\n * This helps improve plugin validation and provides analytics about installation success rates.\n *\n * @param reportData - The installation report data\n * @returns Promise resolving to the report submission response\n *\n */\n async reportInstallation(reportData: InstallReportRequest): Promise<InstallReportResponse> {\n log('Reporting installation for %s@%s', reportData.identifier, reportData.version);\n\n try {\n const result = await this.request<InstallReportResponse>('/v1/plugins/report/installation', {\n body: JSON.stringify(reportData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n });\n\n log('Installation report submitted successfully: %O', result);\n\n return result;\n } catch (error) {\n log('Failed to report installation: %O', error);\n throw error;\n }\n }\n}\n","import { z } from 'zod';\n\n/**\n * Visibility levels for plugins in the marketplace\n * - public: Visible to all users\n * - private: Visible only to the owner and authorized users\n * - internal: Visible only within the organization\n */\nexport const VisibilityEnumSchema = z.enum(['public', 'private', 'internal']);\n\n/**\n * Publication status options for plugins\n * - published: Publicly available in the marketplace\n * - unpublished: Not publicly visible\n * - archived: Marked as no longer maintained\n * - deprecated: Marked as deprecated, but still available\n */\nexport const StatusEnumSchema = z.enum(['published', 'unpublished', 'archived', 'deprecated']);\n\n/**\n * Common query parameters for admin list endpoints\n * These parameters are used for pagination, filtering, and sorting.\n */\nexport interface AdminListQueryParams {\n /** Current page number (1-based) */\n current?: number;\n /** Search keyword for filtering results */\n keyword?: string;\n /** Number of items per page */\n pageSize?: number;\n /** Field to sort results by */\n sortField?: string;\n /** Sort direction */\n sortOrder?: 'ascend' | 'descend';\n}\n\n/**\n * Common response format for paginated admin list endpoints\n * This structure provides both the data and pagination information.\n */\nexport interface AdminListResponse<T> {\n /** Current page number (1-based) */\n current: number;\n /** Array of items for the current page */\n data: T[];\n /** Number of items per page */\n pageSize: number;\n /** Total number of items across all pages */\n total: number;\n /** Total number of pages */\n totalPages: number;\n}\n\n/**\n * Review status options\n * - pending: Awaiting review\n * - approved: Review approved\n * - rejected: Review rejected\n */\nexport type ReviewStatus = 'pending' | 'approved' | 'rejected';\n\n/**\n * Review status schema for validation\n */\nexport const ReviewStatusEnumSchema = z.enum(['published', 'draft', 'review', 'rejected']);\n\n/**\n * Parameters for admin plugin listing\n * Extends the common query parameters with plugin-specific filters.\n */\nexport interface AdminPluginParams {\n /** Filter for featured plugins */\n featured?: boolean;\n /** Maximum number of items to return */\n limit?: number;\n /** Number of items to skip */\n offset?: number;\n /** Sort direction */\n order?: 'asc' | 'desc';\n /** Field to sort by */\n orderBy?: 'createdAt' | 'updatedAt' | 'installCount' | 'ratingAverage';\n /** Filter by owner ID */\n ownerId?: number;\n /** Search query string */\n query?: string;\n /** Filter by plugin status */\n status?: 'published' | 'draft' | 'review' | 'rejected';\n /** Filter by visibility level */\n visibility?: 'public' | 'private' | 'unlisted';\n}\n\n/**\n * Parameters for creating a new plugin version\n */\nexport interface PluginVersionCreateParams {\n /** Author or organization name for this version */\n author?: string;\n /** URL to the author's website or profile */\n authorUrl?: string;\n /** Capability flag: whether this plugin provides prompts */\n capabilitiesPrompts?: boolean;\n /** Capability flag: whether this plugin manages resources (MCP) */\n capabilitiesResources?: boolean;\n /** Capability flag: whether this plugin provides tools */\n capabilitiesTools?: boolean;\n /** Category key for the plugin */\n category?: string;\n /** Description of the plugin version */\n description?: string;\n /** Icon URL or emoji for the plugin */\n icon?: string;\n /** Whether this is the latest version */\n isLatest?: boolean;\n /** Whether this version has been validated */\n isValidated?: boolean;\n /** Name of the plugin version */\n name?: string;\n /** Array of prompt definitions */\n prompts?: any[];\n /** README content */\n readme?: string;\n /** Array of resource definitions */\n resources?: any[];\n /** Summary of the plugin version */\n summary?: string;\n /** Array of tags for categorization */\n tags?: string[];\n /** Array of tool definitions */\n tools?: any[];\n /** Semantic version string (e.g., \"1.0.0\") */\n version: string;\n}\n\n/**\n * Parameters for updating an existing plugin version\n */\nexport interface PluginVersionUpdateParams {\n /** Author or organization name for this version */\n author?: string;\n /** URL to the author's website or profile */\n authorUrl?: string;\n /** Capability flag: whether this plugin provides prompts */\n capabilitiesPrompts?: boolean;\n /** Capability flag: whether this plugin manages resources (MCP) */\n capabilitiesResources?: boolean;\n /** Capability flag: whether this plugin provides tools */\n capabilitiesTools?: boolean;\n /** Category key for the plugin */\n category?: string;\n /** Description of the plugin version */\n description?: string;\n /** Icon URL or emoji for the plugin */\n icon?: string;\n /** Whether this version has been validated */\n isValidated?: boolean;\n /** Name of the plugin version */\n name?: string;\n /** Array of prompt definitions */\n prompts?: any[];\n /** README content */\n readme?: string;\n /** Array of resource definitions */\n resources?: any[];\n /** Summary of the plugin version */\n summary?: string;\n /** Array of tags for categorization */\n tags?: string[];\n /** Array of tool definitions */\n tools?: any[];\n}\n\n/**\n * Parameters for updating plugin basic metadata (non-version specific)\n */\nexport interface PluginUpdateParams {\n /** Unique identifier for the plugin */\n identifier?: string;\n /** Whether this plugin has been claimed by its original author */\n isClaimed?: boolean;\n /** Whether this plugin is featured */\n isFeatured?: boolean;\n /** Whether this plugin is officially maintained by LobeHub */\n isOfficial?: boolean;\n /** Publication status */\n status?: 'published' | 'draft' | 'review' | 'rejected';\n /** Visibility level */\n visibility?: 'public' | 'private' | 'unlisted';\n}\n\n/**\n * Plugin localization data\n */\nexport interface PluginLocalization {\n /** Plugin description in specific locale */\n description: string;\n /** Locale identifier (e.g., 'en-US', 'zh-CN') */\n locale: string;\n /** Plugin name in specific locale */\n name: string;\n /** Summary in specific locale */\n summary?: string;\n /** Plugin tags in specific locale */\n tags?: string[];\n}\n\n/**\n * Parameters for importing plugin i18n data\n */\nexport interface PluginI18nImportParams {\n /** Plugin identifier */\n identifier: string;\n /** Array of localizations for this plugin version */\n localizations: PluginLocalization[];\n /** Plugin version */\n version: string;\n}\n\n/**\n * Response from plugin i18n import operation\n */\nexport interface PluginI18nImportResponse {\n /** Number of failed localizations */\n failed: number;\n /** Number of successful localizations */\n success: number;\n /** Total number of processed localizations */\n totalLocalizations: number;\n}\n\n/**\n * Unclaimed plugin item data structure\n * Represents a plugin that has not been claimed by its author\n */\nexport interface UnclaimedPluginItem {\n /** Plugin ID */\n id: number;\n /** Plugin identifier */\n identifier: string;\n}\n","/**\n * LobeHub Market JavaScript SDK\n *\n * This is the main entry point for the LobeHub Market SDK.\n * It exports the primary client classes and all type definitions.\n */\n\n// Export admin-related functionality\nexport { MarketAdmin } from './admin';\n\n// Export market-related functionality\nexport { MarketSDK } from './market';\n\n// Export SDK-specific types\nexport * from './types';\n\n// Re-export all type definitions from the types package\nexport * from '@lobehub/market-types';\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAKlB,IAAM,MAAM,MAAM,sBAAsB;AAajC,IAAM,UAAN,MAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBnB,YAAY,UAA4B,CAAC,GAAG,eAAwC;AAElF,SAAK,UACH,QAAQ,WAAW,QAAQ,IAAI,mBAAmB;AAGpD,SAAK,gBAAgB,QAAQ,iBAAiB;AAG9C,UAAM,SAAS,QAAQ,UAAU,QAAQ,IAAI;AAG7C,QAAI,eAAe;AACjB,WAAK,UAAU;AACf,UAAI,6BAA6B;AAAA,IACnC,OAAO;AACL,WA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ug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","log","debug","debug","debug","log","debug","debug","log","debug","log","debug"]}
1
+ {"version":3,"sources":["../src/admin/MarketAdmin.ts","../src/core/BaseSDK.ts","../src/admin/services/AnalysisService.ts","../src/admin/services/PluginService.ts","../src/admin/services/SystemDependencyService.ts","../src/admin/services/SettingsService.ts","../src/admin/services/ReviewService.ts","../src/admin/services/PluginEnvService.ts","../src/market/market-sdk.ts","../src/market/services/DiscoveryService.ts","../src/market/services/PluginsService.ts","../src/types/admin.ts","../src/index.ts"],"sourcesContent":["import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport { MarketSDKOptions } from '@/types';\n\nimport {\n AnalysisService,\n PluginEnvService,\n PluginService,\n ReviewService,\n SettingsService,\n SystemDependencyService,\n} from './services';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin');\n\n/**\n * LobeHub Market Admin SDK Client\n *\n * Client for accessing administrative functionality of the LobeHub Marketplace.\n * This SDK provides privileged operations for managing plugins, reviews,\n * system settings, and dependencies. It requires admin-level authentication.\n */\nexport class MarketAdmin extends BaseSDK {\n /**\n * Market analysis service\n * Provides methods for accessing market analytics and statistics\n */\n readonly analysis: AnalysisService;\n\n /**\n * Plugin management service\n * Provides methods for creating, updating, and managing plugins\n */\n readonly plugins: PluginService;\n\n readonly env: PluginEnvService;\n\n /**\n * Review management service\n * Provides methods for moderating and managing user reviews\n */\n readonly reviews: ReviewService;\n\n /**\n * System settings management service\n * Provides methods for configuring marketplace settings\n */\n readonly settings: SettingsService;\n\n /**\n * System dependency management service\n * Provides methods for managing system dependencies required by plugins\n */\n readonly dependencies: SystemDependencyService;\n\n /**\n * Creates a new MarketAdmin instance\n *\n * @param options - Configuration options for the SDK\n */\n constructor(options: MarketSDKOptions = {}) {\n // Use admin-specific API key if available\n const apiKey = options.apiKey || process.env.MARKET_ADMIN_API_KEY;\n\n // Create shared token state object for all services\n const sharedTokenState = {\n accessToken: undefined,\n tokenExpiry: undefined,\n };\n\n super({ ...options, apiKey }, undefined, sharedTokenState);\n log('MarketAdmin instance created');\n\n // Initialize admin services with shared headers and token state for efficient reuse\n this.analysis = new AnalysisService(options, this.headers, sharedTokenState);\n this.plugins = new PluginService(options, this.headers, sharedTokenState);\n this.reviews = new ReviewService(options, this.headers, sharedTokenState);\n this.settings = new SettingsService(options, this.headers, sharedTokenState);\n this.dependencies = new SystemDependencyService(options, this.headers, sharedTokenState);\n this.env = new PluginEnvService(options, this.headers, sharedTokenState);\n }\n}\n","import debug from 'debug';\nimport { SignJWT } from 'jose';\nimport urlJoin from 'url-join';\n\nimport type { MarketSDKOptions, SharedTokenState } from '../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:core');\n\nconst LOBEHUB_MARKET_API_AUDIENCE = 'urn:lobehub:market-api';\n\n/**\n * Base SDK class\n *\n * Provides shared request handling and authentication functionality that is used\n * by both the Market SDK and Admin SDK. This class handles the common concerns:\n * - API endpoint configuration\n * - Authentication header management\n * - HTTP request handling\n * - Error handling\n * - Query string building\n */\nexport class BaseSDK {\n /** Base API URL */\n protected apiBaseUrl: string;\n /** Base URL */\n protected baseUrl: string;\n /** OAuth URL */\n protected oauthBaseUrl: string;\n\n /** Default locale for requests that require localization */\n protected defaultLocale: string;\n\n /** HTTP headers to include with all requests */\n protected headers: Record<string, string>;\n\n private clientId?: string;\n private clientSecret?: string;\n private accessToken?: string;\n private tokenExpiry?: number;\n\n // Shared token state for all instances\n private sharedTokenState?: SharedTokenState;\n\n /**\n * Creates a new BaseSDK instance\n *\n * @param options - Configuration options for the SDK\n * @param sharedHeaders - Optional shared headers object for reuse across services\n * @param sharedTokenState - Optional shared token state object for reuse across services\n */\n constructor(\n options: MarketSDKOptions = {},\n sharedHeaders?: Record<string, string>,\n sharedTokenState?: SharedTokenState,\n ) {\n // Set base URL from options, environment variable, or default to production URL\n this.baseUrl = options.baseURL || process.env.MARKET_BASE_URL || 'https://market.lobehub.com';\n this.apiBaseUrl = urlJoin(this.baseUrl, 'api');\n this.oauthBaseUrl = urlJoin(this.baseUrl, 'oauth');\n\n // Set default locale from options or use English as default\n this.defaultLocale = options.defaultLocale || 'en-US';\n\n this.clientId = options.clientId;\n this.clientSecret = options.clientSecret;\n\n // Share token state across instances if provided\n this.sharedTokenState = sharedTokenState;\n\n // Get API key from options or environment variable\n const apiKey = options.apiKey || process.env.MARKET_API_KEY;\n\n // Either use shared headers or create new headers object\n if (sharedHeaders) {\n this.headers = sharedHeaders;\n log('Using shared headers object');\n } else {\n this.headers = {\n 'Content-Type': 'application/json',\n };\n log('Created new headers object');\n }\n\n // If an apiKey is provided, use it for authorization.\n // This will be overridden by M2M auth if credentials are also provided.\n if (apiKey) {\n this.headers.Authorization = `Bearer ${apiKey}`;\n }\n\n log('BaseSDK instance created: %O', {\n baseUrl: this.baseUrl,\n defaultLocale: this.defaultLocale,\n hasApiKey: !!apiKey,\n hasM2MCredentials: !!this.clientId,\n hasSharedTokenState: !!this.sharedTokenState,\n });\n }\n\n /**\n * Sends an HTTP request to the API and handles the response\n *\n * @param url - Request URL path (will be appended to baseUrl)\n * @param options - Fetch API request options\n * @returns Promise resolving to the parsed JSON response\n * @throws Error if the request fails\n */\n // eslint-disable-next-line no-undef\n protected async request<T>(url: string, options: RequestInit = {}): Promise<T> {\n const requestUrl = urlJoin(this.apiBaseUrl, url);\n log('Sending request: %s', requestUrl);\n\n if (this.clientId && this.clientSecret) {\n await this.setM2MAuthToken();\n }\n\n const response = await fetch(requestUrl, {\n ...options,\n headers: {\n ...this.headers,\n ...options.headers,\n },\n });\n\n if (!response.ok) {\n const errorMsg = `Request failed: ${response.status} ${response.statusText}`;\n log('Request error: %s', errorMsg);\n try {\n const errorBody = await response.json();\n throw new Error(`${errorMsg} - ${JSON.stringify(errorBody)}`);\n } catch {\n throw new Error(errorMsg);\n }\n }\n\n log('Request successful: %s', url);\n return response.json() as Promise<T>;\n }\n\n /**\n * Builds a URL query string from a parameters object\n *\n * @param params - Object containing query parameters\n * @returns Formatted query string (including leading ? if params exist)\n */\n protected buildQueryString(params: Record<string, any>): string {\n const query = Object.entries(params)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n .filter(([_, value]) => value !== undefined && value !== null)\n .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`)\n .join('&');\n\n return query ? `?${query}` : '';\n }\n\n /**\n * Sets an authentication token for API requests\n *\n * @param token - API authentication token\n */\n setAuthToken(token: string): void {\n log('Setting authentication token');\n this.accessToken = undefined;\n this.tokenExpiry = undefined;\n this.clientId = undefined;\n this.clientSecret = undefined;\n\n // Clear shared token state if it exists\n if (this.sharedTokenState) {\n this.sharedTokenState.accessToken = undefined;\n this.sharedTokenState.tokenExpiry = undefined;\n }\n\n this.headers.Authorization = `Bearer ${token}`;\n }\n\n /**\n * Clears the authentication token\n */\n clearAuthToken(): void {\n log('Clearing authentication token');\n this.accessToken = undefined;\n this.tokenExpiry = undefined;\n this.clientId = undefined;\n this.clientSecret = undefined;\n\n // Clear shared token state if it exists\n if (this.sharedTokenState) {\n this.sharedTokenState.accessToken = undefined;\n this.sharedTokenState.tokenExpiry = undefined;\n }\n\n delete this.headers.Authorization;\n }\n\n private async createClientAssertion(): Promise<string> {\n if (!this.clientId || !this.clientSecret) {\n throw new Error('Missing clientId or clientSecret for M2M authentication.');\n }\n\n const secret = new TextEncoder().encode(this.clientSecret);\n\n return await new SignJWT({})\n .setProtectedHeader({ alg: 'HS256' })\n .setIssuer(this.clientId)\n .setSubject(this.clientId)\n .setAudience(LOBEHUB_MARKET_API_AUDIENCE)\n .setJti(crypto.randomUUID())\n .setIssuedAt()\n .setExpirationTime('5m')\n .sign(secret);\n }\n\n private async exchangeToken(clientAssertion: string): Promise<string> {\n const tokenEndpoint = urlJoin(this.oauthBaseUrl, 'token');\n log('Exchanging token at endpoint: %s', tokenEndpoint);\n\n const params = new URLSearchParams();\n params.append('grant_type', 'client_credentials');\n params.append(\n 'client_assertion_type',\n 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',\n );\n params.append('client_assertion', clientAssertion);\n\n const response = await fetch(tokenEndpoint, {\n body: params,\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n method: 'POST',\n });\n\n const tokenData = await response.json();\n\n if (!response.ok) {\n throw new Error(`Token exchange failed: ${JSON.stringify(tokenData)}`);\n }\n\n // Calculate token expiry time (current time + expires_in seconds - 60 seconds buffer)\n const expiresInSeconds = tokenData.expires_in || 3600; // Default to 1 hour if not provided\n this.tokenExpiry = Date.now() + (expiresInSeconds - 60) * 1000; // 60 seconds buffer\n\n return tokenData.access_token;\n }\n\n private async setM2MAuthToken(): Promise<void> {\n // Use shared token state if available\n const currentAccessToken = this.sharedTokenState?.accessToken || this.accessToken;\n const currentTokenExpiry = this.sharedTokenState?.tokenExpiry || this.tokenExpiry;\n\n log(\n 'Token check: hasSharedState=%s, hasCurrentToken=%s, tokenExpiry=%d, currentTime=%d',\n !!this.sharedTokenState,\n !!currentAccessToken,\n currentTokenExpiry || 0,\n Date.now(),\n );\n\n // Check if we have a valid token that hasn't expired\n if (currentAccessToken && currentTokenExpiry && Date.now() < currentTokenExpiry) {\n log(\n 'Using existing M2M access token (expires in %d seconds)',\n Math.floor((currentTokenExpiry - Date.now()) / 1000),\n );\n this.headers.Authorization = `Bearer ${currentAccessToken}`;\n return;\n }\n\n // Check if there's already a token request in progress (for shared state)\n if (this.sharedTokenState?.tokenPromise) {\n log('Token request already in progress, waiting for completion...');\n const token = await this.sharedTokenState.tokenPromise;\n this.headers.Authorization = `Bearer ${token}`;\n log('Using token from concurrent request');\n return;\n }\n\n log('Fetching new M2M access token...');\n\n // Create token request promise and store it in shared state\n const tokenPromise = this.fetchNewToken();\n if (this.sharedTokenState) {\n this.sharedTokenState.tokenPromise = tokenPromise;\n }\n\n try {\n const newAccessToken = await tokenPromise;\n\n // Update both local and shared token state\n this.accessToken = newAccessToken;\n this.headers.Authorization = `Bearer ${newAccessToken}`;\n\n if (this.sharedTokenState) {\n this.sharedTokenState.accessToken = newAccessToken;\n this.sharedTokenState.tokenExpiry = this.tokenExpiry;\n // Clear the promise since we're done\n this.sharedTokenState.tokenPromise = undefined;\n log(\n 'Updated shared token state (expires in %d seconds)',\n Math.floor(((this.tokenExpiry || 0) - Date.now()) / 1000),\n );\n }\n\n log('Successfully set new M2M access token');\n } catch (error) {\n // Clear the promise on error\n if (this.sharedTokenState) {\n this.sharedTokenState.tokenPromise = undefined;\n }\n throw error;\n }\n }\n\n private async fetchNewToken(): Promise<string> {\n const assertion = await this.createClientAssertion();\n return await this.exchangeToken(assertion);\n }\n}\n","import { RangeQuery, RangeStats } from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:analysis');\n\n/**\n * Market Overview Statistics Interface\n * Defines the structure for market overview data\n */\nexport interface MarketOverviewStats {\n installs: {\n count: number;\n prevCount: number;\n };\n newPlugins: {\n count: number;\n prevCount: number;\n };\n period: string;\n plugins: {\n count: number;\n prevCount: number;\n };\n scores: {\n avg: number;\n prevAvg: number;\n };\n}\n\n/**\n * Period type for analysis queries\n */\nexport type AnalysisPeriod = '1d' | '7d' | '30d' | '1mo' | '3mo' | '1y';\n\n/**\n * Market overview query parameters\n */\nexport interface MarketOverviewQuery {\n /** Analysis period: 1d, 7d, 30d (rolling periods) or 1mo, 3mo, 1y (natural periods) */\n period?: AnalysisPeriod;\n}\n\n/**\n * Standard API response wrapper\n */\ninterface ApiResponse<T> {\n data: T;\n success: boolean;\n}\n\n/**\n * Analysis Management Service\n *\n * Provides administrative functionality for accessing market analysis and statistics.\n * This service handles retrieving various analytics reports including market overview,\n * plugin trends, and installation analytics for administrative dashboards.\n */\nexport class AnalysisService extends BaseSDK {\n /**\n * Retrieves market overview statistics\n *\n * Returns comprehensive market statistics including plugin counts,\n * installation metrics, new plugin trends, and rating averages\n * with comparison to previous periods.\n *\n * @param params - Query parameters for the analysis\n * @returns Promise resolving to market overview statistics\n */\n async getMarketOverview(params: MarketOverviewQuery = {}): Promise<MarketOverviewStats> {\n const { period = '30d' } = params;\n\n log('Getting market overview statistics for period: %s', period);\n\n const searchParams = new URLSearchParams();\n if (period) {\n searchParams.append('period', period);\n }\n\n const url = `/admin/analysis/plugin/overview${searchParams.toString() ? `?${searchParams.toString()}` : ''}`;\n\n const result = await this.request<ApiResponse<MarketOverviewStats>>(url);\n\n log('Market overview statistics retrieved successfully: %s', result.data);\n\n return result.data;\n }\n\n /**\n * Retrieves market overview statistics for 1 day period\n *\n * Convenience method for getting daily market statistics.\n *\n * @returns Promise resolving to market overview statistics for 1 day\n */\n async getDailyOverview(): Promise<MarketOverviewStats> {\n log('Getting daily market overview');\n return this.getMarketOverview({ period: '1d' });\n }\n\n /**\n * Retrieves market overview statistics for 7 days period\n *\n * Convenience method for getting weekly market statistics.\n *\n * @returns Promise resolving to market overview statistics for 7 days\n */\n async getWeeklyOverview(): Promise<MarketOverviewStats> {\n log('Getting weekly market overview');\n return this.getMarketOverview({ period: '7d' });\n }\n\n /**\n * Retrieves market overview statistics for 30 days period\n *\n * Convenience method for getting monthly market statistics.\n *\n * @returns Promise resolving to market overview statistics for 30 days\n */\n async getMonthlyOverview(): Promise<MarketOverviewStats> {\n log('Getting monthly market overview');\n return this.getMarketOverview({ period: '30d' });\n }\n\n /**\n * Retrieves market overview statistics for current natural month\n *\n * Convenience method for getting current month vs previous month statistics.\n *\n * @returns Promise resolving to market overview statistics for current month\n */\n async getThisMonthOverview(): Promise<MarketOverviewStats> {\n log('Getting this month market overview');\n return this.getMarketOverview({ period: '1mo' });\n }\n\n /**\n * Retrieves market overview statistics for current quarter\n *\n * Convenience method for getting current quarter vs previous quarter statistics.\n *\n * @returns Promise resolving to market overview statistics for current quarter\n */\n async getQuarterlyOverview(): Promise<MarketOverviewStats> {\n log('Getting quarterly market overview');\n return this.getMarketOverview({ period: '3mo' });\n }\n\n /**\n * Retrieves market overview statistics for current year\n *\n * Convenience method for getting current year vs previous year statistics.\n *\n * @returns Promise resolving to market overview statistics for current year\n */\n async getYearlyOverview(): Promise<MarketOverviewStats> {\n log('Getting yearly market overview');\n return this.getMarketOverview({ period: '1y' });\n }\n\n /**\n * Calculates growth rate between current and previous values\n *\n * Utility method for calculating percentage growth rates from the statistics.\n *\n * @param current - Current period value\n * @param previous - Previous period value\n * @returns Growth rate as percentage (e.g., 15.5 for 15.5% growth)\n */\n static calculateGrowthRate(current: number, previous: number): number {\n if (previous === 0) return current > 0 ? 100 : 0;\n return Math.round(((current - previous) / previous) * 100 * 10) / 10;\n }\n\n /**\n * Formats market overview statistics with calculated growth rates\n *\n * Utility method that enhances the raw statistics with calculated growth rates\n * for easier consumption in dashboards and reports.\n *\n * @param stats - Raw market overview statistics\n * @returns Enhanced statistics with growth rate calculations\n */\n static formatMarketOverview(stats: MarketOverviewStats) {\n return {\n ...stats,\n growth: {\n installs: this.calculateGrowthRate(stats.installs.count, stats.installs.prevCount),\n newPlugins: this.calculateGrowthRate(stats.newPlugins.count, stats.newPlugins.prevCount),\n plugins: this.calculateGrowthRate(stats.plugins.count, stats.plugins.prevCount),\n scores: this.calculateGrowthRate(stats.scores.avg, stats.scores.prevAvg),\n },\n };\n }\n\n /**\n * Retrieves installation trend statistics for a specified date range\n *\n * Returns daily installation counts and trends for the specified period\n * with optional comparison to a previous period.\n *\n * @param params - Query parameters including date range and display config\n * @returns Promise resolving to installation trend statistics\n */\n async getRangeInstalls(params: RangeQuery): Promise<RangeStats> {\n const { display, range, prevRange } = params;\n\n log('Getting installation trend statistics for range: %s to %s', range[0], range[1]);\n\n const searchParams = new URLSearchParams();\n searchParams.append('display', display);\n searchParams.append('range', range.join(','));\n if (prevRange) {\n searchParams.append('prevRange', prevRange.join(','));\n }\n\n const url = `/admin/analysis/plugin/range-installs?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<RangeStats>>(url);\n\n log(\n 'Installation trend statistics retrieved successfully: %d data points',\n result.data.data.length,\n );\n\n return result.data;\n }\n\n /**\n * Retrieves plugin growth trend statistics for a specified date range\n *\n * Returns daily plugin creation counts and trends for the specified period\n * with optional comparison to a previous period.\n *\n * @param params - Query parameters including date range and display config\n * @returns Promise resolving to plugin growth trend statistics\n */\n async getRangePlugins(params: RangeQuery): Promise<RangeStats> {\n const { display, range, prevRange } = params;\n\n log('Getting plugin growth trend statistics for range: %s to %s', range[0], range[1]);\n\n const searchParams = new URLSearchParams();\n searchParams.append('display', display);\n searchParams.append('range', range.join(','));\n if (prevRange) {\n searchParams.append('prevRange', prevRange.join(','));\n }\n\n const url = `/admin/analysis/plugin/range-plugins?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<RangeStats>>(url);\n\n log(\n 'Plugin growth trend statistics retrieved successfully: %d data points',\n result.data.data.length,\n );\n\n return result.data;\n }\n\n /**\n * Calculates trend growth rate between current and previous period totals\n *\n * Utility method for calculating percentage growth rates from range statistics.\n *\n * @param stats - Range statistics with sum and prevSum\n * @returns Growth rate as percentage (e.g., 15.5 for 15.5% growth)\n */\n static calculateTrendGrowthRate(stats: RangeStats): number {\n return this.calculateGrowthRate(stats.sum, stats.prevSum);\n }\n}\n","import type {\n AdminDeploymentOption,\n AdminPluginItem,\n AdminPluginItemDetail,\n IncompleteI18nPlugin,\n InstallationDetails,\n PluginManifest,\n PluginVersion,\n PluginVersionLocalization,\n SystemDependency,\n} from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport {\n AdminListQueryParams,\n AdminListResponse,\n PluginI18nImportParams,\n PluginI18nImportResponse,\n PluginUpdateParams,\n PluginVersionCreateParams,\n PluginVersionUpdateParams,\n UnclaimedPluginItem,\n} from '@/types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:plugins');\n\n/**\n * Plugin Management Service\n *\n * Provides administrative functionality for managing plugins in the marketplace.\n * This service handles CRUD operations for plugins, plugin versions, and deployment options.\n */\nexport class PluginService extends BaseSDK {\n /**\n * Batch imports plugin manifests using the dedicated import endpoint\n *\n * This method is intended for use with scripts and bulk import operations.\n *\n * @param manifests - Array of plugin manifests to import\n * @param ownerId - Optional owner ID to associate with the imported plugins\n * @returns Promise resolving to the import results with counts of success, skipped, failed, and a list of failed IDs\n */\n async importPlugins(\n manifests: PluginManifest[],\n ownerId?: number,\n ): Promise<{ failed: number; failedIds: string[]; skipped: number; success: number }> {\n log(`Starting batch plugin import of ${manifests.length} manifests`);\n if (ownerId) {\n log(`Using specified owner ID for import: ${ownerId}`);\n }\n\n const response = await this.request<{\n data: { failed: number; failedIds: string[]; skipped: number; success: number };\n }>('/admin/plugins/import', {\n body: JSON.stringify({\n manifests,\n ownerId,\n }),\n method: 'POST',\n });\n\n log(\n `Plugin import completed: ${response.data.success} succeeded, ${response.data.skipped} skipped, ${response.data.failed} failed`,\n );\n return response.data;\n }\n\n /**\n * Imports plugin internationalization (i18n) data\n *\n * Allows importing localized content for a specific plugin version.\n * This method creates or updates localizations for the specified plugin.\n *\n * @param params - Plugin i18n import parameters containing identifier, version, and localizations\n * @returns Promise resolving to the import results with counts of success and failure\n */\n async importPluginI18n(params: PluginI18nImportParams): Promise<PluginI18nImportResponse> {\n log(\n `Starting i18n import for plugin ${params.identifier} v${params.version} with ${params.localizations.length} localizations`,\n );\n\n const response = await this.request<{\n data: PluginI18nImportResponse;\n message: string;\n }>('/admin/plugins/import/i18n', {\n body: JSON.stringify(params),\n method: 'POST',\n });\n\n log(\n `Plugin i18n import completed: ${response.data.success} succeeded, ${response.data.failed} failed, ${response.data.totalLocalizations} total`,\n );\n return response.data;\n }\n\n /**\n * Retrieves a list of plugins with admin details\n *\n * Supports filtering, pagination, and sorting of results.\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the plugin list response with admin details\n */\n async getPlugins(params: AdminListQueryParams = {}): Promise<AdminListResponse<AdminPluginItem>> {\n log('Getting plugins with params: %O', params);\n\n const queryString = this.buildQueryString(params);\n const url = `/admin/plugins${queryString}`;\n\n const result = await this.request<AdminListResponse<AdminPluginItem>>(url);\n\n log('Retrieved %d plugins', result.data.length);\n return result;\n }\n\n /**\n * Retrieves all published plugin identifiers\n *\n * Returns a lightweight list of all published plugin identifiers without\n * full plugin metadata. This is useful for admin operations that need to know\n * which plugins are currently published and available to users.\n *\n * @returns Promise resolving to an array containing identifiers array and last modified time\n */\n async getPublishedIdentifiers(): Promise<{ identifier: string; lastModified: string }[]> {\n log('Getting published plugin identifiers (admin)');\n\n const result =\n await this.request<{ identifier: string; lastModified: string }[]>('/v1/plugins/identifiers');\n log('Retrieved %d published plugin identifiers (admin)', result.length);\n return result;\n }\n\n /**\n * Retrieves a single plugin with full admin details\n *\n * @param id - Plugin ID or identifier\n * @returns Promise resolving to the detailed plugin information with version history\n */\n async getPlugin(id: number | string): Promise<AdminPluginItemDetail> {\n log('Getting plugin details (admin): %d', id);\n\n const result = await this.request<AdminPluginItemDetail>(`/admin/plugins/${id}`);\n log('Retrieved plugin with %d versions', result.versions.length);\n return result;\n }\n\n /**\n * Retrieves a plugin by its GitHub repository URL\n *\n * @param githubUrl - The GitHub repository URL to search for\n * @returns Promise resolving to the detailed plugin information with version history\n */\n async getPluginByGithubUrl(githubUrl: string): Promise<AdminPluginItemDetail> {\n log('Getting plugin by GitHub URL: %s', githubUrl);\n\n const queryString = this.buildQueryString({ url: githubUrl });\n const result = await this.request<AdminPluginItemDetail>(\n `/admin/plugins/by-github-url${queryString}`,\n );\n log('Retrieved plugin with %d versions', result.versions.length);\n return result;\n }\n\n /**\n * Updates plugin information\n *\n * @param id - Plugin ID\n * @param data - Plugin update data containing fields to update\n * @returns Promise resolving to the updated plugin\n */\n async updatePlugin(id: number, data: PluginUpdateParams): Promise<AdminPluginItem> {\n log('Updating plugin: %d, data: %O', id, data);\n\n const result = await this.request<AdminPluginItem>(`/admin/plugins/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Plugin updated successfully');\n return result;\n }\n\n /**\n * Updates plugin publication status\n *\n * @param id - Plugin ID\n * @param status - New status to set\n * @returns Promise resolving to success response\n */\n async updatePluginStatus(\n id: number,\n status: 'published' | 'draft' | 'review' | 'rejected',\n ): Promise<{ message: string; success: boolean }> {\n log('Updating plugin status: %d to %s', id, status);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${id}/status`,\n {\n body: JSON.stringify({ status }),\n method: 'PATCH',\n },\n );\n log('Plugin status updated successfully');\n return result;\n }\n\n /**\n * Deletes a plugin\n *\n * @param id - Plugin ID\n * @returns Promise resolving to success response\n */\n async deletePlugin(id: number): Promise<{ message: string; success: boolean }> {\n log('Deleting plugin: %d', id);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${id}`,\n { method: 'DELETE' },\n );\n log('Plugin deleted successfully');\n return result;\n }\n\n /**\n * Retrieves the version history for a plugin\n *\n * @param pluginId - Plugin ID\n * @returns Promise resolving to an array of plugin versions\n */\n async getPluginVersions(pluginId: number): Promise<PluginVersion[]> {\n log('Getting plugin versions: pluginId=%d', pluginId);\n\n const result = await this.request<PluginVersion[]>(`/admin/plugins/${pluginId}/versions`);\n\n log('Retrieved %d versions', result.length);\n return result;\n }\n\n /**\n * Retrieves a specific plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to the plugin version details\n */\n async getPluginVersion(pluginId: number, versionId: number): Promise<PluginVersion> {\n log('Getting version details: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<PluginVersion>(\n `/admin/plugins/${pluginId}/versions/${versionId}`,\n );\n log('Version details retrieved');\n return result;\n }\n\n /**\n * Retrieves all localizations for a specific plugin version\n *\n * @param pluginId - Plugin ID or identifier\n * @param versionId - Version ID\n * @returns Promise resolving to an array of plugin version localizations\n */\n async getPluginLocalizations(\n pluginId: number | string,\n versionId: number,\n ): Promise<PluginVersionLocalization[]> {\n log('Getting localizations: pluginId=%s, versionId=%d', pluginId, versionId);\n\n const result = await this.request<PluginVersionLocalization[]>(\n `/admin/plugins/${pluginId}/versions/${versionId}/localizations`,\n );\n log('Retrieved %d localizations for plugin %s, version %d', result.length, pluginId, versionId);\n return result;\n }\n\n /**\n * Creates a new plugin version with all version-specific data\n *\n * @param pluginId - Plugin ID\n * @param data - Version creation data including all version-specific fields\n * @returns Promise resolving to the created plugin version\n */\n async createPluginVersion(\n pluginId: number,\n data: PluginVersionCreateParams,\n ): Promise<PluginVersion> {\n log('Creating new plugin version: pluginId=%d, data: %O', pluginId, data);\n\n const result = await this.request<PluginVersion>(`/admin/plugins/${pluginId}/versions`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Plugin version created successfully: version=%s', data.version);\n return result;\n }\n\n /**\n * Creates a new plugin version from a manifest\n * Extracts version data from the manifest for easier creation\n *\n * @param pluginId - Plugin ID\n * @param manifest - Plugin manifest containing all version data\n * @param options - Additional options for version creation\n * @returns Promise resolving to the created plugin version\n */\n async createPluginVersionFromManifest(\n pluginId: number,\n manifest: PluginManifest,\n options: {\n isLatest?: boolean;\n isValidated?: boolean;\n } = {},\n ): Promise<PluginVersion> {\n log(\n 'Creating plugin version from manifest: pluginId=%d, version=%s',\n pluginId,\n manifest.version,\n );\n\n const versionData: PluginVersionCreateParams = {\n author: manifest.author?.name,\n authorUrl: manifest.author?.url,\n capabilitiesPrompts: manifest.capabilities?.prompts,\n capabilitiesResources: manifest.capabilities?.resources,\n capabilitiesTools: manifest.capabilities?.tools,\n category: manifest.category,\n description: manifest.description,\n icon: manifest.icon,\n isLatest: options.isLatest,\n isValidated: options.isValidated,\n name: manifest.name,\n prompts: manifest.prompts,\n readme: manifest.overview?.readme,\n resources: manifest.resources,\n summary: manifest.overview?.summary,\n tags: manifest.tags,\n tools: manifest.tools,\n version: manifest.version,\n };\n\n return this.createPluginVersion(pluginId, versionData);\n }\n\n /**\n * Updates a plugin version with comprehensive version-specific data\n *\n * @param idOrIdentifier - Plugin ID\n * @param versionId - Version ID\n * @param data - Version update data including all version-specific fields\n * @returns Promise resolving to the updated plugin version\n */\n async updatePluginVersion(\n idOrIdentifier: number | string,\n versionId: number,\n data: PluginVersionUpdateParams,\n ): Promise<PluginVersion> {\n log(\n 'Updating plugin version: pluginId=%d, versionId=%d, data: %O',\n idOrIdentifier,\n versionId,\n data,\n );\n\n const result = await this.request<PluginVersion>(\n `/admin/plugins/${idOrIdentifier}/versions/${versionId}`,\n {\n body: JSON.stringify(data),\n method: 'PUT',\n },\n );\n\n log('Plugin version updated successfully');\n return result;\n }\n\n /**\n * Deletes a plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to success response\n */\n async deletePluginVersion(\n pluginId: number,\n versionId: number,\n ): Promise<{ message: string; success: boolean }> {\n log('Deleting version: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${pluginId}/versions/${versionId}`,\n { method: 'DELETE' },\n );\n log('Plugin version deleted successfully');\n return result;\n }\n\n /**\n * Sets a specific version as the latest version of a plugin\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID to set as latest\n * @returns Promise resolving to success response\n */\n async setPluginVersionAsLatest(\n pluginId: number,\n versionId: number,\n ): Promise<{ message: string; success: boolean }> {\n log('Setting version as latest: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${pluginId}/versions/${versionId}/latest`,\n { method: 'POST' },\n );\n log('Version set as latest successfully');\n return result;\n }\n\n /**\n * Updates plugin visibility\n *\n * @param id - Plugin ID\n * @param visibility - New visibility setting\n * @returns Promise resolving to success response\n */\n async updatePluginVisibility(\n id: number,\n visibility: 'public' | 'private' | 'unlisted',\n ): Promise<{ message: string; success: boolean }> {\n log('Updating plugin visibility: %d to %s', id, visibility);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${id}/visibility`,\n {\n body: JSON.stringify({ visibility }),\n method: 'PATCH',\n },\n );\n log('Plugin visibility updated successfully');\n return result;\n }\n\n /**\n * Updates status for multiple plugins in a single operation\n *\n * @param ids - Array of plugin IDs to update\n * @param status - New status to set for all specified plugins\n * @returns Promise resolving to success response\n */\n async batchUpdatePluginStatus(\n ids: number[],\n status: 'published' | 'draft' | 'review' | 'rejected',\n ): Promise<{ message: string; success: boolean }> {\n log('Batch updating plugin status: %O to %s', ids, status);\n\n const result = await this.request<{ message: string; success: boolean }>(\n '/admin/plugins/batch/status',\n {\n body: JSON.stringify({ ids, status }),\n method: 'PATCH',\n },\n );\n log('Batch plugin status update completed');\n return result;\n }\n\n /**\n * Deletes multiple plugins in a single operation\n *\n * @param ids - Array of plugin IDs to delete\n * @returns Promise resolving to success response\n */\n async batchDeletePlugins(ids: number[]): Promise<{ message: string; success: boolean }> {\n log('Batch deleting plugins: %O', ids);\n\n const result = await this.request<{ message: string; success: boolean }>(\n '/admin/plugins/batch/delete',\n {\n body: JSON.stringify({ ids }),\n method: 'DELETE',\n },\n );\n log('Batch plugin deletion completed');\n return result;\n }\n\n /**\n * Retrieves detailed information about a plugin version including deployment options\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to version details with deployment options\n */\n async getPluginVersionDetails(\n pluginId: number,\n versionId: number,\n ): Promise<PluginVersion & { deploymentOptions: any }> {\n log(\n 'Getting version details with deployment options: pluginId=%d, versionId=%d',\n pluginId,\n versionId,\n );\n\n const result = await this.request<PluginVersion & { deploymentOptions: any }>(\n `/admin/plugins/${pluginId}/versions/${versionId}`,\n );\n log('Version details with deployment options retrieved');\n return result;\n }\n\n /**\n * Retrieves deployment options for a specific plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to an array of deployment options\n */\n async getDeploymentOptions(\n pluginId: number,\n versionId: number,\n ): Promise<AdminDeploymentOption[]> {\n log('Getting deployment options: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<AdminDeploymentOption[]>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options`,\n );\n log('Retrieved %d deployment options', result.length);\n return result;\n }\n\n /**\n * Creates a new deployment option for a plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param data - Deployment option configuration data\n * @returns Promise resolving to the created deployment option\n */\n async createDeploymentOption(\n pluginId: number,\n versionId: number,\n data: {\n connectionArgs?: string[];\n connectionCommand?: string;\n connectionType: string;\n description?: string;\n installationDetails?: InstallationDetails;\n installationMethod: string;\n isRecommended?: boolean;\n },\n ): Promise<AdminDeploymentOption> {\n log('Creating deployment option: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<AdminDeploymentOption>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options`,\n {\n body: JSON.stringify(data),\n method: 'POST',\n },\n );\n log('Deployment option created successfully');\n return result;\n }\n\n /**\n * Updates an existing deployment option\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param optionId - Deployment option ID\n * @param data - Updated deployment option configuration\n * @returns Promise resolving to the updated deployment option\n */\n async updateDeploymentOption(\n pluginId: number,\n versionId: number,\n optionId: number,\n data: {\n connectionArgs?: string[];\n connectionCommand?: string;\n connectionType?: string;\n description?: string;\n installationDetails?: Record<string, any>;\n installationMethod?: string;\n isRecommended?: boolean;\n },\n ): Promise<AdminDeploymentOption> {\n log(\n 'Updating deployment option: pluginId=%d, versionId=%d, optionId=%d',\n pluginId,\n versionId,\n optionId,\n );\n\n const result = await this.request<AdminDeploymentOption>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}`,\n {\n body: JSON.stringify(data),\n method: 'PUT',\n },\n );\n log('Deployment option updated successfully');\n return result;\n }\n\n /**\n * Deletes a deployment option\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param optionId - Deployment option ID\n * @returns Promise resolving to success response\n */\n async deleteDeploymentOption(\n pluginId: number,\n versionId: number,\n optionId: number,\n ): Promise<{ message: string; success: boolean }> {\n log(\n 'Deleting deployment option: pluginId=%d, versionId=%d, optionId=%d',\n pluginId,\n versionId,\n optionId,\n );\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}`,\n { method: 'DELETE' },\n );\n log('Deployment option deleted successfully');\n return result;\n }\n\n /**\n * Retrieves system dependencies for a deployment option\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param optionId - Deployment option ID\n * @returns Promise resolving to an array of system dependencies\n */\n async getDeploymentOptionSystemDependencies(\n pluginId: number,\n versionId: number,\n optionId: number,\n ): Promise<SystemDependency[]> {\n log(\n 'Getting system dependencies: pluginId=%d, versionId=%d, optionId=%d',\n pluginId,\n versionId,\n optionId,\n );\n\n const result = await this.request<SystemDependency[]>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}/system-dependencies`,\n );\n log('Retrieved %d system dependencies', result.length);\n return result;\n }\n\n /**\n * Retrieves verified plugins without summary information\n *\n * Returns plugins that are validated but missing summary data.\n *\n * @returns Promise resolving to array of plugins with incomplete summary data\n */\n async getVerifiedPluginsWithoutSummary(): Promise<\n { identifier: string; manifest: PluginManifest; versionId: number }[]\n > {\n log('Getting verified plugins without summary');\n\n const result = await this.request<\n { identifier: string; manifest: PluginManifest; versionId: number }[]\n >('/admin/plugins/verified-without-summary');\n\n log('Retrieved %d verified plugins without summary', result.length);\n return result;\n }\n\n /**\n * Retrieves plugins with incomplete internationalization\n *\n * Returns plugins where pluginVersionLocalizations has only 1 entry.\n *\n * @returns Promise resolving to an array of plugins with incomplete i18n\n */\n async getIncompleteI18nPlugins(): Promise<IncompleteI18nPlugin[]> {\n log('Getting plugins with incomplete i18n');\n\n const result = await this.request<IncompleteI18nPlugin[]>('/admin/plugins/incomplete-i18n');\n log('Retrieved %d plugins with incomplete i18n', result.length);\n return result;\n }\n\n /**\n * Retrieves unclaimed plugins\n *\n * Returns plugins where isClaimed is false, containing only ID and identifier.\n *\n * @returns Promise resolving to an array of unclaimed plugins with basic info\n */\n async getUnclaimedPlugins(): Promise<UnclaimedPluginItem[]> {\n log('Getting unclaimed plugins');\n\n const result = await this.request<UnclaimedPluginItem[]>('/admin/plugins/unclaimed');\n log('Retrieved %d unclaimed plugins', result.length);\n return result;\n }\n}\n","import type { SystemDependency } from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:dependency');\n\n/**\n * System Dependency Management Service\n *\n * Provides administrative functionality for managing system dependencies\n * required by plugins. This service handles creating, updating, deleting,\n * and listing system dependencies that plugins may require.\n */\nexport class SystemDependencyService extends BaseSDK {\n /**\n * Retrieves all system dependencies\n *\n * Gets a list of all defined system dependencies that plugins may require.\n *\n * @returns Promise resolving to an array of system dependencies\n */\n async getSystemDependencies(): Promise<SystemDependency[]> {\n log('Getting all system dependencies');\n\n const result = await this.request<SystemDependency[]>(`/admin/plugins/dependencies`);\n log('Retrieved %d system dependencies', result.length);\n return result;\n }\n\n /**\n * Retrieves a specific system dependency by ID\n *\n * @param id - System dependency ID\n * @returns Promise resolving to the system dependency details\n */\n async getSystemDependency(id: number): Promise<SystemDependency> {\n log('Getting system dependency details: %d', id);\n\n const result = await this.request<SystemDependency>(`/admin/plugins/dependencies/${id}`);\n log('System dependency details retrieved');\n return result;\n }\n\n /**\n * Creates a new system dependency\n *\n * @param data - System dependency creation data\n * @returns Promise resolving to the created system dependency\n */\n async createSystemDependency(data: Omit<SystemDependency, 'id'>): Promise<SystemDependency> {\n log('Creating system dependency: %O', data);\n\n const result = await this.request<SystemDependency>(`/admin/plugins/dependencies`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('System dependency created successfully');\n return result;\n }\n\n /**\n * Updates an existing system dependency\n *\n * @param id - System dependency ID\n * @param data - System dependency update data\n * @returns Promise resolving to the updated system dependency\n */\n async updateSystemDependency(\n id: number,\n data: Partial<SystemDependency>,\n ): Promise<SystemDependency> {\n log('Updating system dependency: %d, data: %O', id, data);\n\n const result = await this.request<SystemDependency>(`/admin/plugins/dependencies/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('System dependency updated successfully');\n return result;\n }\n\n /**\n * Deletes a system dependency\n *\n * @param id - System dependency ID\n * @returns Promise resolving to success response\n */\n async deleteSystemDependency(id: number): Promise<{ message: string; success: boolean }> {\n log('Deleting system dependency: %d', id);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/dependencies/${id}`,\n { method: 'DELETE' },\n );\n log('System dependency deleted successfully');\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:settings');\n\n/**\n * Settings entity representing a system setting\n */\nexport interface Settings {\n /** Creation timestamp (ISO 8601 format) */\n createdAt: string;\n /** Optional description of the setting's purpose */\n description?: string;\n /** Unique identifier for the setting */\n id: number;\n /** Setting key name used for retrieving the setting */\n key: string;\n /** Last update timestamp (ISO 8601 format) */\n updatedAt: string;\n /** Setting value (stored as string) */\n value: string;\n}\n\n/**\n * Configuration for enabled resource types\n */\nexport interface EnabledResources {\n /** Whether agent resources are enabled */\n agents: boolean;\n /** Whether plugin resources are enabled */\n plugins: boolean;\n}\n\n/**\n * Authentication configuration\n */\nexport interface AuthenticationConfig {\n /** Whether authentication is required */\n enabled: boolean;\n /** Supported authentication schemes */\n schemes: string[];\n}\n\n/**\n * Documentation URL configuration\n */\nexport interface DocumentationConfig {\n /** URL to API documentation */\n apiUrl?: string;\n /** URL to privacy policy */\n policyUrl?: string;\n /** URL to terms of service */\n termsOfServiceUrl?: string;\n}\n\n/**\n * Map of all system settings with typed properties\n */\nexport interface SettingsMap {\n /** Additional settings (dynamically added) */\n [key: string]: any;\n /** Authentication configuration */\n authentication: AuthenticationConfig;\n /** Base URL for the marketplace */\n baseURL: string;\n /** Documentation URL configuration */\n documentation: DocumentationConfig;\n /** Configuration for enabled resource types */\n enabledResources: EnabledResources;\n /** Supported locales */\n locales: string[];\n}\n\n/**\n * Parameters for creating a new setting\n */\nexport interface CreateSettingsParams {\n /** Optional description of the setting's purpose */\n description?: string;\n /** Setting key name */\n key: string;\n /** Setting value (will be stored as string) */\n value: string;\n}\n\n/**\n * Parameters for updating an existing setting\n */\nexport interface UpdateSettingsParams {\n /** Optional new description */\n description?: string;\n /** New setting value */\n value: string;\n}\n\n/**\n * Settings Management Service\n *\n * Provides administrative functionality for managing system settings.\n * This service handles getting, creating, updating, and deleting\n * configuration settings for the marketplace.\n */\nexport class SettingsService extends BaseSDK {\n /**\n * Retrieves all system settings\n *\n * Returns a consolidated map of all settings with typed values\n * for known setting keys.\n *\n * @returns Promise resolving to the settings map\n */\n async getSettings(): Promise<SettingsMap> {\n return await this.request<SettingsMap>('/admin/settings');\n }\n\n /**\n * Retrieves a specific setting by key\n *\n * @param key - Setting key name\n * @returns Promise resolving to the setting details\n */\n async getSettingByKey(key: string): Promise<{ data: Settings }> {\n log('Getting setting: %s', key);\n\n const result = await this.request<{ data: Settings }>(`/admin/settings/${key}`);\n log('Setting retrieved');\n return result;\n }\n\n /**\n * Creates a new system setting\n *\n * @param data - Setting creation parameters\n * @returns Promise resolving to the created setting\n */\n async createSetting(data: CreateSettingsParams): Promise<{ data: Settings }> {\n log('Creating setting: %O', data);\n\n const result = await this.request<{ data: Settings }>('/admin/settings', {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Setting created successfully');\n return result;\n }\n\n /**\n * Updates an existing setting\n *\n * @param key - Setting key name\n * @param data - Setting update parameters\n * @returns Promise resolving to the updated setting\n */\n async updateSetting(key: string, data: UpdateSettingsParams): Promise<{ data: Settings }> {\n log('Updating setting: %s, data: %O', key, data);\n\n const result = await this.request<{ data: Settings }>(`/admin/settings/${key}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Setting updated successfully');\n return result;\n }\n\n /**\n * Deletes a setting\n *\n * @param key - Setting key name\n * @returns Promise resolving to success message\n */\n async deleteSetting(key: string): Promise<{ message: string }> {\n log('Deleting setting: %s', key);\n\n const result = await this.request<{ message: string }>(`/admin/settings/${key}`, {\n method: 'DELETE',\n });\n log('Setting deleted successfully');\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport type { AdminListQueryParams, AdminListResponse, ReviewStatus } from '@/types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:review');\n\n/**\n * Review entity representing a plugin review\n */\nexport interface Review {\n /** Optional comment providing feedback */\n comment?: string;\n /** Creation timestamp (ISO 8601 format) */\n createdAt: string;\n /** Unique identifier for the review */\n id: number;\n /** ID of the plugin being reviewed */\n pluginId: number;\n /** ID of the reviewer (if available) */\n reviewerId?: number;\n /** Current status of the review */\n status: ReviewStatus;\n /** Last update timestamp (ISO 8601 format) */\n updatedAt: string;\n}\n\n/**\n * Extended review information with related entities\n */\nexport interface PluginReviewWithRelations extends Review {\n /** Related plugin information */\n plugin?: any;\n /** Related version information */\n version?: any;\n}\n\n/**\n * Parameters for updating a review\n */\nexport interface UpdateReviewParams {\n /** Optional comment or feedback */\n comment?: string;\n /** New status to set for the review */\n status: ReviewStatus;\n}\n\n/**\n * Review Management Service\n *\n * Provides administrative functionality for managing plugin reviews.\n * This service handles listing, fetching, and updating review statuses\n * for plugins in the marketplace.\n */\nexport class ReviewService extends BaseSDK {\n /**\n * Retrieves a list of reviews with filtering options\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the review list response\n */\n async getReviews(\n params: AdminListQueryParams = {},\n ): Promise<AdminListResponse<PluginReviewWithRelations>> {\n log('Getting reviews with params: %O', params);\n\n const queryString = this.buildQueryString(params);\n const url = `/admin/reviews${queryString ? `?${queryString}` : ''}`;\n\n const result = await this.request<AdminListResponse<PluginReviewWithRelations>>(url);\n\n log('Retrieved %d reviews', result.data.length);\n return result;\n }\n\n /**\n * Retrieves a specific review by ID\n *\n * @param id - Review ID\n * @returns Promise resolving to the review details\n */\n async getReviewById(id: number): Promise<Review> {\n log('Getting review details: %d', id);\n\n const result = await this.request<Review>(`/admin/reviews/${id}`);\n log('Review details retrieved');\n return result;\n }\n\n /**\n * Updates a review's status and comment\n *\n * @param id - Review ID\n * @param data - Update parameters containing new status and optional comment\n * @returns Promise resolving to the updated review\n */\n async updateReview(id: number, data: UpdateReviewParams): Promise<Review> {\n log('Updating review: %d, data: %O', id, data);\n\n const result = await this.request<Review>(`/admin/reviews/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Review updated successfully');\n return result;\n }\n\n /**\n * Retrieves the review history for a specific plugin\n *\n * @param pluginId - Plugin ID\n * @returns Promise resolving to an array of reviews for the plugin\n */\n async getPluginReviews(pluginId: number): Promise<{ data: Review[] }> {\n log('Getting plugin reviews: pluginId=%d', pluginId);\n\n const result = await this.request<{ data: Review[] }>(`/admin/reviews/plugin/${pluginId}`);\n log('Retrieved %d reviews for plugin', result.data.length);\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport type { AdminListResponse } from '@/types/admin';\n\ntype AdminPluginEnvListQuery = any;\ntype PluginEnv = any;\n\nconst log = debug('lobe-market-sdk:admin:plugin-env');\n\nexport interface AdminPluginEnvCreateParams {\n description?: string;\n identifier: string;\n key: string;\n value: string;\n}\n\nexport interface AdminPluginEnvUpdateParams {\n description?: string;\n value?: string;\n}\n\n/**\n * Plugin Environment Variable Management Service\n *\n * Provides administrative functionality for managing plugin environment variables.\n */\nexport class PluginEnvService extends BaseSDK {\n /**\n * Retrieves a paginated list of plugin environment variables\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the env list response\n */\n async getPluginEnvs(params: AdminPluginEnvListQuery = {}): Promise<AdminListResponse<PluginEnv>> {\n log('Getting plugin envs with params: %O', params);\n const queryString = this.buildQueryString(params);\n const url = `/admin/plugins/env${queryString}`;\n const result = await this.request<AdminListResponse<PluginEnv>>(url);\n log('Retrieved %d plugin envs', result.data.length);\n return result;\n }\n\n /**\n * Retrieves a single plugin environment variable by ID\n *\n * @param id - Env ID\n * @returns Promise resolving to the env item\n */\n async getPluginEnv(id: number): Promise<PluginEnv> {\n log('Getting plugin env: %d', id);\n const result = await this.request<PluginEnv>(`/admin/plugins/env/${id}`);\n log('Retrieved plugin env: %d', id);\n return result;\n }\n\n /**\n * Creates a new plugin environment variable\n *\n * @param data - Env creation data\n * @returns Promise resolving to the created env item\n */\n async createPluginEnv(data: AdminPluginEnvCreateParams): Promise<PluginEnv> {\n log('Creating plugin env: %O', data);\n const result = await this.request<PluginEnv>(`/admin/plugins/env`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Plugin env created successfully');\n return result;\n }\n\n /**\n * Updates a plugin environment variable\n *\n * @param id - Env ID\n * @param data - Env update data\n * @returns Promise resolving to the updated env item\n */\n async updatePluginEnv(id: number, data: AdminPluginEnvUpdateParams): Promise<PluginEnv> {\n log('Updating plugin env: %d, data: %O', id, data);\n const result = await this.request<PluginEnv>(`/admin/plugins/env/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Plugin env updated successfully');\n return result;\n }\n\n /**\n * Deletes a plugin environment variable\n *\n * @param id - Env ID\n * @returns Promise resolving to success response\n */\n async deletePluginEnv(id: number): Promise<{ success: boolean }> {\n log('Deleting plugin env: %d', id);\n const result = await this.request<{ success: boolean }>(`/admin/plugins/env/${id}`, {\n method: 'DELETE',\n });\n log('Plugin env deleted successfully');\n return result;\n }\n\n /**\n * Batch import plugin environment variables\n *\n * @param data - Batch import data, format: { [plugin: string]: { [envKey: string]: string } }\n * @returns Promise resolving to import result\n */\n async importPluginEnvs(\n data: Record<string, Record<string, string>>,\n ): Promise<{ success: number }> {\n log('Batch importing plugin envs: %O', data);\n const result = await this.request<{ success: number }>(`/admin/plugins/env/import`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Batch import completed: %d envs imported', result.success);\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../core/BaseSDK';\nimport type { DiscoveryDocument, MarketSDKOptions } from '../types';\nimport { DiscoveryService, PluginsService } from './services';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk');\n\n/**\n * LobeHub Market SDK Client\n *\n * Main client for accessing the LobeHub Marketplace API.\n * This class provides access to marketplace resources like plugins, agents,\n * and service discovery information. It follows a composition pattern\n * by combining specialized domain services.\n */\nexport class MarketSDK extends BaseSDK {\n /**\n * Plugins service for accessing plugin-related functionality\n * Provides methods to list, search, retrieve plugin information, and report installation attempts\n */\n readonly plugins: PluginsService;\n\n /**\n * Discovery service for retrieving API service information\n * Used to get information about available endpoints and services\n */\n private readonly discovery: DiscoveryService;\n\n /**\n * Creates a new MarketSDK instance\n *\n * @param options - Configuration options for the SDK\n */\n constructor(options: MarketSDKOptions = {}) {\n // Create shared token state object for all services\n const sharedTokenState = {\n accessToken: undefined,\n tokenExpiry: undefined,\n };\n\n super(options, undefined, sharedTokenState);\n log('MarketSDK instance created');\n\n // Initialize domain services with shared headers and token state for efficient reuse\n this.plugins = new PluginsService(options, this.headers, sharedTokenState);\n this.discovery = new DiscoveryService(options, this.headers, sharedTokenState);\n }\n\n /**\n * Retrieves the service discovery document\n *\n * The discovery document provides information about available API endpoints,\n * versions, and capabilities of the Market API.\n *\n * @returns Promise resolving to the service discovery document\n */\n async getDiscoveryDocument(): Promise<DiscoveryDocument> {\n return this.discovery.getDiscoveryDocument();\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type { DiscoveryDocument } from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:discovery');\n\n/**\n * Discovery Service\n *\n * Provides functionality for retrieving service discovery information\n * from the LobeHub Marketplace API. The discovery document contains\n * metadata about available endpoints, authentication methods, and\n * other capabilities of the API.\n */\nexport class DiscoveryService extends BaseSDK {\n /** Cached discovery document to avoid repeated requests */\n private discoveryDoc?: DiscoveryDocument;\n\n /**\n * Retrieves the service discovery document\n *\n * This document contains information about available API endpoints,\n * authentication methods, and other capabilities of the Market API.\n * The result is cached after the first request to improve performance.\n *\n * @returns Promise resolving to the service discovery document\n */\n async getDiscoveryDocument(): Promise<DiscoveryDocument> {\n log('Fetching discovery document');\n if (this.discoveryDoc) {\n log('Returning cached discovery document');\n return this.discoveryDoc;\n }\n\n this.discoveryDoc = await this.request<DiscoveryDocument>('/market/.well-known/discovery');\n log('Discovery document successfully fetched');\n return this.discoveryDoc;\n }\n}\n","import type {\n InstallReportRequest,\n InstallReportResponse,\n PluginItemDetail,\n PluginManifest,\n} from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n CategoryItem,\n CategoryListQuery,\n PluginListResponse,\n PluginQueryParams,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:plugins');\n\n/**\n * Plugins Service\n *\n * Provides access to plugin-related functionality in the LobeHub Marketplace.\n * This service handles listing, searching, and retrieving detailed information\n * about plugins available in the marketplace.\n */\nexport class PluginsService extends BaseSDK {\n /**\n * Retrieves a list of plugins from the marketplace\n *\n * Supports filtering, pagination, and localization of results.\n *\n * @param params - Query parameters for filtering and pagination\n * @param options\n * @returns Promise resolving to the plugin list response containing items and pagination info\n */\n async getPluginList(\n params: PluginQueryParams = {},\n options?: globalThis.RequestInit,\n ): Promise<PluginListResponse> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting plugin list: %O', queryParams);\n\n const result = await this.request<PluginListResponse>(`/v1/plugins${queryString}`, options);\n log('Retrieved %d plugins', result.items.length);\n return result;\n }\n\n /**\n * Retrieves all plugin categories and their counts\n *\n * Returns a list of categories along with the number of plugins in each category.\n * Useful for building category filters in a UI. Supports optional search filtering\n * via 'q' parameter and locale specification.\n *\n * @param params - Query parameters for filtering categories\n * @param options - Optional request options\n * @returns Promise resolving to an array of category items with counts\n */\n async getCategories(\n params: CategoryListQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<CategoryItem[]> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting plugin categories: %O', queryParams);\n\n const result = await this.request<CategoryItem[]>(\n `/v1/plugins/categories${queryString}`,\n options,\n );\n log('Retrieved %d categories', result.length);\n return result;\n }\n\n /**\n * Retrieves all published plugin identifiers\n *\n * Returns a lightweight list of all published plugin identifiers without\n * full plugin metadata. This is useful for clients that need to know which\n * plugins are available without fetching complete plugin information.\n *\n * @returns Promise resolving to an array containing identifiers array and last modified time\n */\n async getPublishedIdentifiers(\n options?: globalThis.RequestInit,\n ): Promise<{ identifier: string; lastModified: string }[]> {\n log('Getting published plugin identifiers');\n\n const result = await this.request<{ identifier: string; lastModified: string }[]>(\n '/v1/plugins/identifiers',\n options,\n );\n log('Retrieved %d published plugin identifiers', result.length);\n return result;\n }\n\n /**\n * Retrieves the manifest for a specific plugin\n *\n * The manifest contains detailed information about a plugin, including\n * its capabilities, tools, prompts, and resources.\n *\n * @param identifier - Unique identifier of the plugin\n * @param locale - Optional locale for localized content (defaults to SDK default locale)\n * @param version - Optional specific version to retrieve (defaults to latest)\n * @param options\n * @returns Promise resolving to the plugin manifest\n */\n async getPluginManifest(\n {\n locale,\n version,\n identifier,\n }: {\n identifier: string;\n locale?: string;\n version?: string;\n },\n options?: globalThis.RequestInit,\n ): Promise<PluginManifest> {\n log('Getting plugin manifest: %O', { identifier, locale, version });\n const localeParam = locale || this.defaultLocale;\n const params: Record<string, string> = { locale: localeParam };\n if (version) {\n params.version = version;\n }\n const queryString = this.buildQueryString(params);\n\n const manifest = await this.request<PluginManifest>(\n `/v1/plugins/${identifier}/manifest${queryString}`,\n options,\n );\n\n log('Plugin manifest successfully retrieved: %s', identifier);\n return manifest;\n }\n\n /**\n * Retrieves the plugin detailed information about a plugin, including\n * its capabilities, tools, prompts, and resources.\n *\n * @param identifier - Unique identifier of the plugin\n * @param locale - Optional locale for localized content (defaults to SDK default locale)\n * @param version - Optional specific version to retrieve (defaults to latest)\n * @returns Promise resolving to the plugin manifest\n */\n async getPluginDetail(\n {\n locale,\n version,\n identifier,\n }: {\n identifier: string;\n locale?: string;\n version?: string;\n },\n options?: globalThis.RequestInit,\n ): Promise<PluginItemDetail> {\n log('Getting plugin detail: %O', { identifier, locale, version });\n const localeParam = locale || this.defaultLocale;\n const params: Record<string, string> = { locale: localeParam };\n if (version) {\n params.version = version;\n }\n const queryString = this.buildQueryString(params);\n\n const manifest = await this.request<PluginItemDetail>(\n `/v1/plugins/${identifier}${queryString}`,\n options,\n );\n\n log('Plugin manifest successfully retrieved: %s', identifier);\n return manifest;\n }\n\n /**\n * Report a plugin installation attempt\n *\n * Reports the outcome of a plugin installation attempt, including timing,\n * success status, manifest information, and error details if applicable.\n * This helps improve plugin validation and provides analytics about installation success rates.\n *\n * @param reportData - The installation report data\n * @returns Promise resolving to the report submission response\n *\n */\n async reportInstallation(reportData: InstallReportRequest): Promise<InstallReportResponse> {\n log('Reporting installation for %s@%s', reportData.identifier, reportData.version);\n\n try {\n const result = await this.request<InstallReportResponse>('/v1/plugins/report/installation', {\n body: JSON.stringify(reportData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n });\n\n log('Installation report submitted successfully: %O', result);\n\n return result;\n } catch (error) {\n log('Failed to report installation: %O', error);\n throw error;\n }\n }\n}\n","import { z } from 'zod';\n\n/**\n * Visibility levels for plugins in the marketplace\n * - public: Visible to all users\n * - private: Visible only to the owner and authorized users\n * - internal: Visible only within the organization\n */\nexport const VisibilityEnumSchema = z.enum(['public', 'private', 'internal']);\n\n/**\n * Publication status options for plugins\n * - published: Publicly available in the marketplace\n * - unpublished: Not publicly visible\n * - archived: Marked as no longer maintained\n * - deprecated: Marked as deprecated, but still available\n */\nexport const StatusEnumSchema = z.enum(['published', 'unpublished', 'archived', 'deprecated']);\n\n/**\n * Common query parameters for admin list endpoints\n * These parameters are used for pagination, filtering, and sorting.\n */\nexport interface AdminListQueryParams {\n /** Current page number (1-based) */\n current?: number;\n /** Search keyword for filtering results */\n keyword?: string;\n /** Number of items per page */\n pageSize?: number;\n /** Field to sort results by */\n sortField?: string;\n /** Sort direction */\n sortOrder?: 'ascend' | 'descend';\n}\n\n/**\n * Common response format for paginated admin list endpoints\n * This structure provides both the data and pagination information.\n */\nexport interface AdminListResponse<T> {\n /** Current page number (1-based) */\n current: number;\n /** Array of items for the current page */\n data: T[];\n /** Number of items per page */\n pageSize: number;\n /** Total number of items across all pages */\n total: number;\n /** Total number of pages */\n totalPages: number;\n}\n\n/**\n * Review status options\n * - pending: Awaiting review\n * - approved: Review approved\n * - rejected: Review rejected\n */\nexport type ReviewStatus = 'pending' | 'approved' | 'rejected';\n\n/**\n * Review status schema for validation\n */\nexport const ReviewStatusEnumSchema = z.enum(['published', 'draft', 'review', 'rejected']);\n\n/**\n * Parameters for admin plugin listing\n * Extends the common query parameters with plugin-specific filters.\n */\nexport interface AdminPluginParams {\n /** Filter for featured plugins */\n featured?: boolean;\n /** Maximum number of items to return */\n limit?: number;\n /** Number of items to skip */\n offset?: number;\n /** Sort direction */\n order?: 'asc' | 'desc';\n /** Field to sort by */\n orderBy?: 'createdAt' | 'updatedAt' | 'installCount' | 'ratingAverage';\n /** Filter by owner ID */\n ownerId?: number;\n /** Search query string */\n query?: string;\n /** Filter by plugin status */\n status?: 'published' | 'draft' | 'review' | 'rejected';\n /** Filter by visibility level */\n visibility?: 'public' | 'private' | 'unlisted';\n}\n\n/**\n * Parameters for creating a new plugin version\n */\nexport interface PluginVersionCreateParams {\n /** Author or organization name for this version */\n author?: string;\n /** URL to the author's website or profile */\n authorUrl?: string;\n /** Capability flag: whether this plugin provides prompts */\n capabilitiesPrompts?: boolean;\n /** Capability flag: whether this plugin manages resources (MCP) */\n capabilitiesResources?: boolean;\n /** Capability flag: whether this plugin provides tools */\n capabilitiesTools?: boolean;\n /** Category key for the plugin */\n category?: string;\n /** Description of the plugin version */\n description?: string;\n /** Icon URL or emoji for the plugin */\n icon?: string;\n /** Whether this is the latest version */\n isLatest?: boolean;\n /** Whether this version has been validated */\n isValidated?: boolean;\n /** Name of the plugin version */\n name?: string;\n /** Array of prompt definitions */\n prompts?: any[];\n /** README content */\n readme?: string;\n /** Array of resource definitions */\n resources?: any[];\n /** Summary of the plugin version */\n summary?: string;\n /** Array of tags for categorization */\n tags?: string[];\n /** Array of tool definitions */\n tools?: any[];\n /** Semantic version string (e.g., \"1.0.0\") */\n version: string;\n}\n\n/**\n * Parameters for updating an existing plugin version\n */\nexport interface PluginVersionUpdateParams {\n /** Author or organization name for this version */\n author?: string;\n /** URL to the author's website or profile */\n authorUrl?: string;\n /** Capability flag: whether this plugin provides prompts */\n capabilitiesPrompts?: boolean;\n /** Capability flag: whether this plugin manages resources (MCP) */\n capabilitiesResources?: boolean;\n /** Capability flag: whether this plugin provides tools */\n capabilitiesTools?: boolean;\n /** Category key for the plugin */\n category?: string;\n /** Description of the plugin version */\n description?: string;\n /** Icon URL or emoji for the plugin */\n icon?: string;\n /** Whether this version has been validated */\n isValidated?: boolean;\n /** Name of the plugin version */\n name?: string;\n /** Array of prompt definitions */\n prompts?: any[];\n /** README content */\n readme?: string;\n /** Array of resource definitions */\n resources?: any[];\n /** Summary of the plugin version */\n summary?: string;\n /** Array of tags for categorization */\n tags?: string[];\n /** Array of tool definitions */\n tools?: any[];\n}\n\n/**\n * Parameters for updating plugin basic metadata (non-version specific)\n */\nexport interface PluginUpdateParams {\n /** Unique identifier for the plugin */\n identifier?: string;\n /** Whether this plugin has been claimed by its original author */\n isClaimed?: boolean;\n /** Whether this plugin is featured */\n isFeatured?: boolean;\n /** Whether this plugin is officially maintained by LobeHub */\n isOfficial?: boolean;\n /** Publication status */\n status?: 'published' | 'draft' | 'review' | 'rejected';\n /** Visibility level */\n visibility?: 'public' | 'private' | 'unlisted';\n}\n\n/**\n * Plugin localization data\n */\nexport interface PluginLocalization {\n /** Plugin description in specific locale */\n description: string;\n /** Locale identifier (e.g., 'en-US', 'zh-CN') */\n locale: string;\n /** Plugin name in specific locale */\n name: string;\n /** Summary in specific locale */\n summary?: string;\n /** Plugin tags in specific locale */\n tags?: string[];\n}\n\n/**\n * Parameters for importing plugin i18n data\n */\nexport interface PluginI18nImportParams {\n /** Plugin identifier */\n identifier: string;\n /** Array of localizations for this plugin version */\n localizations: PluginLocalization[];\n /** Plugin version */\n version: string;\n}\n\n/**\n * Response from plugin i18n import operation\n */\nexport interface PluginI18nImportResponse {\n /** Number of failed localizations */\n failed: number;\n /** Number of successful localizations */\n success: number;\n /** Total number of processed localizations */\n totalLocalizations: number;\n}\n\n/**\n * Unclaimed plugin item data structure\n * Represents a plugin that has not been claimed by its author\n */\nexport interface UnclaimedPluginItem {\n /** Plugin ID */\n id: number;\n /** Plugin identifier */\n identifier: string;\n}\n","/**\n * LobeHub Market JavaScript SDK\n *\n * This is the main entry point for the LobeHub Market SDK.\n * It exports the primary client classes and all type definitions.\n */\n\n// Export admin-related functionality\nexport { MarketAdmin } from './admin';\n\n// Export market-related functionality\nexport { MarketSDK } from './market';\n\n// Export SDK-specific types\nexport * from './types';\n\n// Re-export all type definitions from the types package\nexport * from '@lobehub/market-types';\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAClB,SAAS,eAAe;AACxB,OAAO,aAAa;AAKpB,IAAM,MAAM,MAAM,sBAAsB;AAExC,IAAM,8BAA8B;AAa7B,IAAM,UAAN,MAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6BnB,YACE,UAA4B,CAAC,GAC7B,eACA,kBACA;AAEA,SAAK,UAAU,QAAQ,WAAW,QAAQ,IAAI,mBAAmB;AACjE,SAAK,aAAa,QAAQ,KAAK,SAAS,KAAK;AAC7C,SAAK,eAAe,QAAQ,KAAK,SAAS,OAAO;AAGjD,SAAK,gBAAgB,QAAQ,iBAAiB;AAE9C,SAAK,WAAW,QAAQ;AACxB,SAAK,eAAe,QAAQ;AAG5B,SAAK,mBA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AuB,EAAE,KAAK,CAAC,UAAU,WAAW,UAAU,CAAC;AASrE,IAAM,mBAAmB,EAAE,KAAK,CAAC,aAAa,eAAe,YAAY,YAAY,CAAC;AA+CtF,IAAM,yBAAyB,EAAE,KAAK,CAAC,aAAa,SAAS,UAAU,UAAU,CAAC;;;AC/CzF,cAAc;","names":["debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","log","debug","debug","debug","log","debug","debug","log","debug","log","debug"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/market-sdk",
3
- "version": "0.18.5",
3
+ "version": "0.20.0",
4
4
  "description": "LobeHub Market JavaScript SDK",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -26,7 +26,9 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@lobehub/market-types": "1.10.3",
29
- "debug": "^4.4.1"
29
+ "debug": "^4.4.1",
30
+ "jose": "^6.0.11",
31
+ "url-join": "^5.0.0"
30
32
  },
31
33
  "peerDependencies": {
32
34
  "@lobehub/market-types": "1.10.3",