@lobehub/market-sdk 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/admin/MarketAdmin.ts
2
- import debug7 from "debug";
2
+ import debug8 from "debug";
3
3
 
4
4
  // src/core/BaseSDK.ts
5
5
  import debug from "debug";
@@ -84,9 +84,103 @@ var BaseSDK = class {
84
84
  }
85
85
  };
86
86
 
87
- // src/admin/services/PluginService.ts
87
+ // src/admin/services/AnalysisService.ts
88
88
  import debug2 from "debug";
89
- var log2 = debug2("lobe-market-sdk:admin:plugins");
89
+ var log2 = debug2("lobe-market-sdk:admin:analysis");
90
+ var AnalysisService = class extends BaseSDK {
91
+ /**
92
+ * Retrieves market overview statistics
93
+ *
94
+ * Returns comprehensive market statistics including plugin counts,
95
+ * installation metrics, new plugin trends, and rating averages
96
+ * with comparison to previous periods.
97
+ *
98
+ * @param params - Query parameters for the analysis
99
+ * @returns Promise resolving to market overview statistics
100
+ */
101
+ async getMarketOverview(params = {}) {
102
+ const { period = "30d" } = params;
103
+ log2("Getting market overview statistics for period: %s", period);
104
+ const searchParams = new URLSearchParams();
105
+ if (period) {
106
+ searchParams.append("period", period);
107
+ }
108
+ const url = `/admin/plugins/analysis/market-overview${searchParams.toString() ? `?${searchParams.toString()}` : ""}`;
109
+ const result = await this.request(url);
110
+ log2("Market overview statistics retrieved successfully: %s", result.data);
111
+ return result.data;
112
+ }
113
+ /**
114
+ * Retrieves market overview statistics for 1 day period
115
+ *
116
+ * Convenience method for getting daily market statistics.
117
+ *
118
+ * @returns Promise resolving to market overview statistics for 1 day
119
+ */
120
+ async getDailyOverview() {
121
+ log2("Getting daily market overview");
122
+ return this.getMarketOverview({ period: "1d" });
123
+ }
124
+ /**
125
+ * Retrieves market overview statistics for 7 days period
126
+ *
127
+ * Convenience method for getting weekly market statistics.
128
+ *
129
+ * @returns Promise resolving to market overview statistics for 7 days
130
+ */
131
+ async getWeeklyOverview() {
132
+ log2("Getting weekly market overview");
133
+ return this.getMarketOverview({ period: "7d" });
134
+ }
135
+ /**
136
+ * Retrieves market overview statistics for 30 days period
137
+ *
138
+ * Convenience method for getting monthly market statistics.
139
+ *
140
+ * @returns Promise resolving to market overview statistics for 30 days
141
+ */
142
+ async getMonthlyOverview() {
143
+ log2("Getting monthly market overview");
144
+ return this.getMarketOverview({ period: "30d" });
145
+ }
146
+ /**
147
+ * Calculates growth rate between current and previous values
148
+ *
149
+ * Utility method for calculating percentage growth rates from the statistics.
150
+ *
151
+ * @param current - Current period value
152
+ * @param previous - Previous period value
153
+ * @returns Growth rate as percentage (e.g., 15.5 for 15.5% growth)
154
+ */
155
+ static calculateGrowthRate(current, previous) {
156
+ if (previous === 0) return current > 0 ? 100 : 0;
157
+ return Math.round((current - previous) / previous * 100 * 10) / 10;
158
+ }
159
+ /**
160
+ * Formats market overview statistics with calculated growth rates
161
+ *
162
+ * Utility method that enhances the raw statistics with calculated growth rates
163
+ * for easier consumption in dashboards and reports.
164
+ *
165
+ * @param stats - Raw market overview statistics
166
+ * @returns Enhanced statistics with growth rate calculations
167
+ */
168
+ static formatMarketOverview(stats) {
169
+ return {
170
+ ...stats,
171
+ growth: {
172
+ installs: this.calculateGrowthRate(stats.installs.count, stats.installs.prevCount),
173
+ newPlugins: this.calculateGrowthRate(stats.newPlugins.count, stats.newPlugins.prevCount),
174
+ plugins: this.calculateGrowthRate(stats.plugins.count, stats.plugins.prevCount),
175
+ scores: this.calculateGrowthRate(stats.scores.avg, stats.scores.prevAvg)
176
+ }
177
+ };
178
+ }
179
+ };
180
+
181
+ // src/admin/services/PluginService.ts
182
+ import debug3 from "debug";
183
+ var log3 = debug3("lobe-market-sdk:admin:plugins");
90
184
  var PluginService = class extends BaseSDK {
91
185
  /**
92
186
  * Creates a new PluginService instance
@@ -96,7 +190,7 @@ var PluginService = class extends BaseSDK {
96
190
  */
97
191
  constructor(options = {}, sharedHeaders) {
98
192
  super(options, sharedHeaders);
99
- log2("PluginService instance created");
193
+ log3("PluginService instance created");
100
194
  }
101
195
  /**
102
196
  * Batch imports plugin manifests using the dedicated import endpoint
@@ -108,9 +202,9 @@ var PluginService = class extends BaseSDK {
108
202
  * @returns Promise resolving to the import results with counts of success, skipped, failed, and a list of failed IDs
109
203
  */
110
204
  async importPlugins(manifests, ownerId) {
111
- log2(`Starting batch plugin import of ${manifests.length} manifests`);
205
+ log3(`Starting batch plugin import of ${manifests.length} manifests`);
112
206
  if (ownerId) {
113
- log2(`Using specified owner ID for import: ${ownerId}`);
207
+ log3(`Using specified owner ID for import: ${ownerId}`);
114
208
  }
115
209
  const response = await this.request("/admin/plugins/import", {
116
210
  body: JSON.stringify({
@@ -119,7 +213,7 @@ var PluginService = class extends BaseSDK {
119
213
  }),
120
214
  method: "POST"
121
215
  });
122
- log2(
216
+ log3(
123
217
  `Plugin import completed: ${response.data.success} succeeded, ${response.data.skipped} skipped, ${response.data.failed} failed`
124
218
  );
125
219
  return response.data;
@@ -134,14 +228,14 @@ var PluginService = class extends BaseSDK {
134
228
  * @returns Promise resolving to the import results with counts of success and failure
135
229
  */
136
230
  async importPluginI18n(params) {
137
- log2(
231
+ log3(
138
232
  `Starting i18n import for plugin ${params.identifier} v${params.version} with ${params.localizations.length} localizations`
139
233
  );
140
234
  const response = await this.request("/admin/plugins/import/i18n", {
141
235
  body: JSON.stringify(params),
142
236
  method: "POST"
143
237
  });
144
- log2(
238
+ log3(
145
239
  `Plugin i18n import completed: ${response.data.success} succeeded, ${response.data.failed} failed, ${response.data.totalLocalizations} total`
146
240
  );
147
241
  return response.data;
@@ -155,11 +249,11 @@ var PluginService = class extends BaseSDK {
155
249
  * @returns Promise resolving to the plugin list response with admin details
156
250
  */
157
251
  async getPlugins(params = {}) {
158
- log2("Getting plugins with params: %O", params);
252
+ log3("Getting plugins with params: %O", params);
159
253
  const queryString = this.buildQueryString(params);
160
254
  const url = `/admin/plugins${queryString}`;
161
255
  const result = await this.request(url);
162
- log2("Retrieved %d plugins", result.data.length);
256
+ log3("Retrieved %d plugins", result.data.length);
163
257
  return result;
164
258
  }
165
259
  /**
@@ -172,9 +266,9 @@ var PluginService = class extends BaseSDK {
172
266
  * @returns Promise resolving to an array containing identifiers array and last modified time
173
267
  */
174
268
  async getPublishedIdentifiers() {
175
- log2("Getting published plugin identifiers (admin)");
269
+ log3("Getting published plugin identifiers (admin)");
176
270
  const result = await this.request("/v1/plugins/identifiers");
177
- log2("Retrieved %d published plugin identifiers (admin)", result.length);
271
+ log3("Retrieved %d published plugin identifiers (admin)", result.length);
178
272
  return result;
179
273
  }
180
274
  /**
@@ -184,9 +278,9 @@ var PluginService = class extends BaseSDK {
184
278
  * @returns Promise resolving to the detailed plugin information with version history
185
279
  */
186
280
  async getPlugin(id) {
187
- log2("Getting plugin details (admin): %d", id);
281
+ log3("Getting plugin details (admin): %d", id);
188
282
  const result = await this.request(`/admin/plugins/${id}`);
189
- log2("Retrieved plugin with %d versions", result.versions.length);
283
+ log3("Retrieved plugin with %d versions", result.versions.length);
190
284
  return result;
191
285
  }
192
286
  /**
@@ -196,12 +290,12 @@ var PluginService = class extends BaseSDK {
196
290
  * @returns Promise resolving to the detailed plugin information with version history
197
291
  */
198
292
  async getPluginByGithubUrl(githubUrl) {
199
- log2("Getting plugin by GitHub URL: %s", githubUrl);
293
+ log3("Getting plugin by GitHub URL: %s", githubUrl);
200
294
  const queryString = this.buildQueryString({ url: githubUrl });
201
295
  const result = await this.request(
202
296
  `/admin/plugins/by-github-url${queryString}`
203
297
  );
204
- log2("Retrieved plugin with %d versions", result.versions.length);
298
+ log3("Retrieved plugin with %d versions", result.versions.length);
205
299
  return result;
206
300
  }
207
301
  /**
@@ -212,12 +306,12 @@ var PluginService = class extends BaseSDK {
212
306
  * @returns Promise resolving to the updated plugin
213
307
  */
214
308
  async updatePlugin(id, data) {
215
- log2("Updating plugin: %d, data: %O", id, data);
309
+ log3("Updating plugin: %d, data: %O", id, data);
216
310
  const result = await this.request(`/admin/plugins/${id}`, {
217
311
  body: JSON.stringify(data),
218
312
  method: "PUT"
219
313
  });
220
- log2("Plugin updated successfully");
314
+ log3("Plugin updated successfully");
221
315
  return result;
222
316
  }
223
317
  /**
@@ -228,7 +322,7 @@ var PluginService = class extends BaseSDK {
228
322
  * @returns Promise resolving to success response
229
323
  */
230
324
  async updatePluginStatus(id, status) {
231
- log2("Updating plugin status: %d to %s", id, status);
325
+ log3("Updating plugin status: %d to %s", id, status);
232
326
  const result = await this.request(
233
327
  `/admin/plugins/${id}/status`,
234
328
  {
@@ -236,7 +330,7 @@ var PluginService = class extends BaseSDK {
236
330
  method: "PATCH"
237
331
  }
238
332
  );
239
- log2("Plugin status updated successfully");
333
+ log3("Plugin status updated successfully");
240
334
  return result;
241
335
  }
242
336
  /**
@@ -246,12 +340,12 @@ var PluginService = class extends BaseSDK {
246
340
  * @returns Promise resolving to success response
247
341
  */
248
342
  async deletePlugin(id) {
249
- log2("Deleting plugin: %d", id);
343
+ log3("Deleting plugin: %d", id);
250
344
  const result = await this.request(
251
345
  `/admin/plugins/${id}`,
252
346
  { method: "DELETE" }
253
347
  );
254
- log2("Plugin deleted successfully");
348
+ log3("Plugin deleted successfully");
255
349
  return result;
256
350
  }
257
351
  /**
@@ -261,9 +355,9 @@ var PluginService = class extends BaseSDK {
261
355
  * @returns Promise resolving to an array of plugin versions
262
356
  */
263
357
  async getPluginVersions(pluginId) {
264
- log2("Getting plugin versions: pluginId=%d", pluginId);
358
+ log3("Getting plugin versions: pluginId=%d", pluginId);
265
359
  const result = await this.request(`/admin/plugins/${pluginId}/versions`);
266
- log2("Retrieved %d versions", result.length);
360
+ log3("Retrieved %d versions", result.length);
267
361
  return result;
268
362
  }
269
363
  /**
@@ -274,11 +368,11 @@ var PluginService = class extends BaseSDK {
274
368
  * @returns Promise resolving to the plugin version details
275
369
  */
276
370
  async getPluginVersion(pluginId, versionId) {
277
- log2("Getting version details: pluginId=%d, versionId=%d", pluginId, versionId);
371
+ log3("Getting version details: pluginId=%d, versionId=%d", pluginId, versionId);
278
372
  const result = await this.request(
279
373
  `/admin/plugins/${pluginId}/versions/${versionId}`
280
374
  );
281
- log2("Version details retrieved");
375
+ log3("Version details retrieved");
282
376
  return result;
283
377
  }
284
378
  /**
@@ -289,11 +383,11 @@ var PluginService = class extends BaseSDK {
289
383
  * @returns Promise resolving to an array of plugin version localizations
290
384
  */
291
385
  async getPluginLocalizations(pluginId, versionId) {
292
- log2("Getting localizations: pluginId=%s, versionId=%d", pluginId, versionId);
386
+ log3("Getting localizations: pluginId=%s, versionId=%d", pluginId, versionId);
293
387
  const result = await this.request(
294
388
  `/admin/plugins/${pluginId}/versions/${versionId}/localizations`
295
389
  );
296
- log2("Retrieved %d localizations for plugin %s, version %d", result.length, pluginId, versionId);
390
+ log3("Retrieved %d localizations for plugin %s, version %d", result.length, pluginId, versionId);
297
391
  return result;
298
392
  }
299
393
  /**
@@ -304,12 +398,12 @@ var PluginService = class extends BaseSDK {
304
398
  * @returns Promise resolving to the created plugin version
305
399
  */
306
400
  async createPluginVersion(pluginId, data) {
307
- log2("Creating new plugin version: pluginId=%d, data: %O", pluginId, data);
401
+ log3("Creating new plugin version: pluginId=%d, data: %O", pluginId, data);
308
402
  const result = await this.request(`/admin/plugins/${pluginId}/versions`, {
309
403
  body: JSON.stringify(data),
310
404
  method: "POST"
311
405
  });
312
- log2("Plugin version created successfully: version=%s", data.version);
406
+ log3("Plugin version created successfully: version=%s", data.version);
313
407
  return result;
314
408
  }
315
409
  /**
@@ -323,7 +417,7 @@ var PluginService = class extends BaseSDK {
323
417
  */
324
418
  async createPluginVersionFromManifest(pluginId, manifest, options = {}) {
325
419
  var _a, _b, _c, _d, _e, _f, _g;
326
- log2(
420
+ log3(
327
421
  "Creating plugin version from manifest: pluginId=%d, version=%s",
328
422
  pluginId,
329
423
  manifest.version
@@ -359,7 +453,7 @@ var PluginService = class extends BaseSDK {
359
453
  * @returns Promise resolving to the updated plugin version
360
454
  */
361
455
  async updatePluginVersion(idOrIdentifier, versionId, data) {
362
- log2(
456
+ log3(
363
457
  "Updating plugin version: pluginId=%d, versionId=%d, data: %O",
364
458
  idOrIdentifier,
365
459
  versionId,
@@ -372,7 +466,7 @@ var PluginService = class extends BaseSDK {
372
466
  method: "PUT"
373
467
  }
374
468
  );
375
- log2("Plugin version updated successfully");
469
+ log3("Plugin version updated successfully");
376
470
  return result;
377
471
  }
378
472
  /**
@@ -383,12 +477,12 @@ var PluginService = class extends BaseSDK {
383
477
  * @returns Promise resolving to success response
384
478
  */
385
479
  async deletePluginVersion(pluginId, versionId) {
386
- log2("Deleting version: pluginId=%d, versionId=%d", pluginId, versionId);
480
+ log3("Deleting version: pluginId=%d, versionId=%d", pluginId, versionId);
387
481
  const result = await this.request(
388
482
  `/admin/plugins/${pluginId}/versions/${versionId}`,
389
483
  { method: "DELETE" }
390
484
  );
391
- log2("Plugin version deleted successfully");
485
+ log3("Plugin version deleted successfully");
392
486
  return result;
393
487
  }
394
488
  /**
@@ -399,12 +493,12 @@ var PluginService = class extends BaseSDK {
399
493
  * @returns Promise resolving to success response
400
494
  */
401
495
  async setPluginVersionAsLatest(pluginId, versionId) {
402
- log2("Setting version as latest: pluginId=%d, versionId=%d", pluginId, versionId);
496
+ log3("Setting version as latest: pluginId=%d, versionId=%d", pluginId, versionId);
403
497
  const result = await this.request(
404
498
  `/admin/plugins/${pluginId}/versions/${versionId}/latest`,
405
499
  { method: "POST" }
406
500
  );
407
- log2("Version set as latest successfully");
501
+ log3("Version set as latest successfully");
408
502
  return result;
409
503
  }
410
504
  /**
@@ -415,7 +509,7 @@ var PluginService = class extends BaseSDK {
415
509
  * @returns Promise resolving to success response
416
510
  */
417
511
  async updatePluginVisibility(id, visibility) {
418
- log2("Updating plugin visibility: %d to %s", id, visibility);
512
+ log3("Updating plugin visibility: %d to %s", id, visibility);
419
513
  const result = await this.request(
420
514
  `/admin/plugins/${id}/visibility`,
421
515
  {
@@ -423,7 +517,7 @@ var PluginService = class extends BaseSDK {
423
517
  method: "PATCH"
424
518
  }
425
519
  );
426
- log2("Plugin visibility updated successfully");
520
+ log3("Plugin visibility updated successfully");
427
521
  return result;
428
522
  }
429
523
  /**
@@ -434,7 +528,7 @@ var PluginService = class extends BaseSDK {
434
528
  * @returns Promise resolving to success response
435
529
  */
436
530
  async batchUpdatePluginStatus(ids, status) {
437
- log2("Batch updating plugin status: %O to %s", ids, status);
531
+ log3("Batch updating plugin status: %O to %s", ids, status);
438
532
  const result = await this.request(
439
533
  "/admin/plugins/batch/status",
440
534
  {
@@ -442,7 +536,7 @@ var PluginService = class extends BaseSDK {
442
536
  method: "PATCH"
443
537
  }
444
538
  );
445
- log2("Batch plugin status update completed");
539
+ log3("Batch plugin status update completed");
446
540
  return result;
447
541
  }
448
542
  /**
@@ -452,7 +546,7 @@ var PluginService = class extends BaseSDK {
452
546
  * @returns Promise resolving to success response
453
547
  */
454
548
  async batchDeletePlugins(ids) {
455
- log2("Batch deleting plugins: %O", ids);
549
+ log3("Batch deleting plugins: %O", ids);
456
550
  const result = await this.request(
457
551
  "/admin/plugins/batch/delete",
458
552
  {
@@ -460,7 +554,7 @@ var PluginService = class extends BaseSDK {
460
554
  method: "DELETE"
461
555
  }
462
556
  );
463
- log2("Batch plugin deletion completed");
557
+ log3("Batch plugin deletion completed");
464
558
  return result;
465
559
  }
466
560
  /**
@@ -471,7 +565,7 @@ var PluginService = class extends BaseSDK {
471
565
  * @returns Promise resolving to version details with deployment options
472
566
  */
473
567
  async getPluginVersionDetails(pluginId, versionId) {
474
- log2(
568
+ log3(
475
569
  "Getting version details with deployment options: pluginId=%d, versionId=%d",
476
570
  pluginId,
477
571
  versionId
@@ -479,7 +573,7 @@ var PluginService = class extends BaseSDK {
479
573
  const result = await this.request(
480
574
  `/admin/plugins/${pluginId}/versions/${versionId}`
481
575
  );
482
- log2("Version details with deployment options retrieved");
576
+ log3("Version details with deployment options retrieved");
483
577
  return result;
484
578
  }
485
579
  /**
@@ -490,11 +584,11 @@ var PluginService = class extends BaseSDK {
490
584
  * @returns Promise resolving to an array of deployment options
491
585
  */
492
586
  async getDeploymentOptions(pluginId, versionId) {
493
- log2("Getting deployment options: pluginId=%d, versionId=%d", pluginId, versionId);
587
+ log3("Getting deployment options: pluginId=%d, versionId=%d", pluginId, versionId);
494
588
  const result = await this.request(
495
589
  `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options`
496
590
  );
497
- log2("Retrieved %d deployment options", result.length);
591
+ log3("Retrieved %d deployment options", result.length);
498
592
  return result;
499
593
  }
500
594
  /**
@@ -506,7 +600,7 @@ var PluginService = class extends BaseSDK {
506
600
  * @returns Promise resolving to the created deployment option
507
601
  */
508
602
  async createDeploymentOption(pluginId, versionId, data) {
509
- log2("Creating deployment option: pluginId=%d, versionId=%d", pluginId, versionId);
603
+ log3("Creating deployment option: pluginId=%d, versionId=%d", pluginId, versionId);
510
604
  const result = await this.request(
511
605
  `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options`,
512
606
  {
@@ -514,7 +608,7 @@ var PluginService = class extends BaseSDK {
514
608
  method: "POST"
515
609
  }
516
610
  );
517
- log2("Deployment option created successfully");
611
+ log3("Deployment option created successfully");
518
612
  return result;
519
613
  }
520
614
  /**
@@ -527,7 +621,7 @@ var PluginService = class extends BaseSDK {
527
621
  * @returns Promise resolving to the updated deployment option
528
622
  */
529
623
  async updateDeploymentOption(pluginId, versionId, optionId, data) {
530
- log2(
624
+ log3(
531
625
  "Updating deployment option: pluginId=%d, versionId=%d, optionId=%d",
532
626
  pluginId,
533
627
  versionId,
@@ -540,7 +634,7 @@ var PluginService = class extends BaseSDK {
540
634
  method: "PUT"
541
635
  }
542
636
  );
543
- log2("Deployment option updated successfully");
637
+ log3("Deployment option updated successfully");
544
638
  return result;
545
639
  }
546
640
  /**
@@ -552,7 +646,7 @@ var PluginService = class extends BaseSDK {
552
646
  * @returns Promise resolving to success response
553
647
  */
554
648
  async deleteDeploymentOption(pluginId, versionId, optionId) {
555
- log2(
649
+ log3(
556
650
  "Deleting deployment option: pluginId=%d, versionId=%d, optionId=%d",
557
651
  pluginId,
558
652
  versionId,
@@ -562,7 +656,7 @@ var PluginService = class extends BaseSDK {
562
656
  `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}`,
563
657
  { method: "DELETE" }
564
658
  );
565
- log2("Deployment option deleted successfully");
659
+ log3("Deployment option deleted successfully");
566
660
  return result;
567
661
  }
568
662
  /**
@@ -574,7 +668,7 @@ var PluginService = class extends BaseSDK {
574
668
  * @returns Promise resolving to an array of system dependencies
575
669
  */
576
670
  async getDeploymentOptionSystemDependencies(pluginId, versionId, optionId) {
577
- log2(
671
+ log3(
578
672
  "Getting system dependencies: pluginId=%d, versionId=%d, optionId=%d",
579
673
  pluginId,
580
674
  versionId,
@@ -583,7 +677,7 @@ var PluginService = class extends BaseSDK {
583
677
  const result = await this.request(
584
678
  `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}/system-dependencies`
585
679
  );
586
- log2("Retrieved %d system dependencies", result.length);
680
+ log3("Retrieved %d system dependencies", result.length);
587
681
  return result;
588
682
  }
589
683
  /**
@@ -594,9 +688,9 @@ var PluginService = class extends BaseSDK {
594
688
  * @returns Promise resolving to array of plugins with incomplete summary data
595
689
  */
596
690
  async getVerifiedPluginsWithoutSummary() {
597
- log2("Getting verified plugins without summary");
691
+ log3("Getting verified plugins without summary");
598
692
  const result = await this.request("/admin/plugins/verified-without-summary");
599
- log2("Retrieved %d verified plugins without summary", result.length);
693
+ log3("Retrieved %d verified plugins without summary", result.length);
600
694
  return result;
601
695
  }
602
696
  /**
@@ -607,9 +701,9 @@ var PluginService = class extends BaseSDK {
607
701
  * @returns Promise resolving to an array of plugins with incomplete i18n
608
702
  */
609
703
  async getIncompleteI18nPlugins() {
610
- log2("Getting plugins with incomplete i18n");
704
+ log3("Getting plugins with incomplete i18n");
611
705
  const result = await this.request("/admin/plugins/incomplete-i18n");
612
- log2("Retrieved %d plugins with incomplete i18n", result.length);
706
+ log3("Retrieved %d plugins with incomplete i18n", result.length);
613
707
  return result;
614
708
  }
615
709
  /**
@@ -620,16 +714,16 @@ var PluginService = class extends BaseSDK {
620
714
  * @returns Promise resolving to an array of unclaimed plugins with basic info
621
715
  */
622
716
  async getUnclaimedPlugins() {
623
- log2("Getting unclaimed plugins");
717
+ log3("Getting unclaimed plugins");
624
718
  const result = await this.request("/admin/plugins/unclaimed");
625
- log2("Retrieved %d unclaimed plugins", result.length);
719
+ log3("Retrieved %d unclaimed plugins", result.length);
626
720
  return result;
627
721
  }
628
722
  };
629
723
 
630
724
  // src/admin/services/SystemDependencyService.ts
631
- import debug3 from "debug";
632
- var log3 = debug3("lobe-market-sdk:admin:dependency");
725
+ import debug4 from "debug";
726
+ var log4 = debug4("lobe-market-sdk:admin:dependency");
633
727
  var SystemDependencyService = class extends BaseSDK {
634
728
  /**
635
729
  * Creates a new SystemDependencyService instance
@@ -639,7 +733,7 @@ var SystemDependencyService = class extends BaseSDK {
639
733
  */
640
734
  constructor(options = {}, sharedHeaders) {
641
735
  super(options, sharedHeaders);
642
- log3("SystemDependencyService instance created");
736
+ log4("SystemDependencyService instance created");
643
737
  }
644
738
  /**
645
739
  * Retrieves all system dependencies
@@ -649,9 +743,9 @@ var SystemDependencyService = class extends BaseSDK {
649
743
  * @returns Promise resolving to an array of system dependencies
650
744
  */
651
745
  async getSystemDependencies() {
652
- log3("Getting all system dependencies");
746
+ log4("Getting all system dependencies");
653
747
  const result = await this.request(`/admin/plugins/dependencies`);
654
- log3("Retrieved %d system dependencies", result.length);
748
+ log4("Retrieved %d system dependencies", result.length);
655
749
  return result;
656
750
  }
657
751
  /**
@@ -661,9 +755,9 @@ var SystemDependencyService = class extends BaseSDK {
661
755
  * @returns Promise resolving to the system dependency details
662
756
  */
663
757
  async getSystemDependency(id) {
664
- log3("Getting system dependency details: %d", id);
758
+ log4("Getting system dependency details: %d", id);
665
759
  const result = await this.request(`/admin/plugins/dependencies/${id}`);
666
- log3("System dependency details retrieved");
760
+ log4("System dependency details retrieved");
667
761
  return result;
668
762
  }
669
763
  /**
@@ -673,12 +767,12 @@ var SystemDependencyService = class extends BaseSDK {
673
767
  * @returns Promise resolving to the created system dependency
674
768
  */
675
769
  async createSystemDependency(data) {
676
- log3("Creating system dependency: %O", data);
770
+ log4("Creating system dependency: %O", data);
677
771
  const result = await this.request(`/admin/plugins/dependencies`, {
678
772
  body: JSON.stringify(data),
679
773
  method: "POST"
680
774
  });
681
- log3("System dependency created successfully");
775
+ log4("System dependency created successfully");
682
776
  return result;
683
777
  }
684
778
  /**
@@ -689,12 +783,12 @@ var SystemDependencyService = class extends BaseSDK {
689
783
  * @returns Promise resolving to the updated system dependency
690
784
  */
691
785
  async updateSystemDependency(id, data) {
692
- log3("Updating system dependency: %d, data: %O", id, data);
786
+ log4("Updating system dependency: %d, data: %O", id, data);
693
787
  const result = await this.request(`/admin/plugins/dependencies/${id}`, {
694
788
  body: JSON.stringify(data),
695
789
  method: "PUT"
696
790
  });
697
- log3("System dependency updated successfully");
791
+ log4("System dependency updated successfully");
698
792
  return result;
699
793
  }
700
794
  /**
@@ -704,19 +798,19 @@ var SystemDependencyService = class extends BaseSDK {
704
798
  * @returns Promise resolving to success response
705
799
  */
706
800
  async deleteSystemDependency(id) {
707
- log3("Deleting system dependency: %d", id);
801
+ log4("Deleting system dependency: %d", id);
708
802
  const result = await this.request(
709
803
  `/admin/plugins/dependencies/${id}`,
710
804
  { method: "DELETE" }
711
805
  );
712
- log3("System dependency deleted successfully");
806
+ log4("System dependency deleted successfully");
713
807
  return result;
714
808
  }
715
809
  };
716
810
 
717
811
  // src/admin/services/SettingsService.ts
718
- import debug4 from "debug";
719
- var log4 = debug4("lobe-market-sdk:admin:settings");
812
+ import debug5 from "debug";
813
+ var log5 = debug5("lobe-market-sdk:admin:settings");
720
814
  var SettingsService = class extends BaseSDK {
721
815
  /**
722
816
  * Retrieves all system settings
@@ -736,9 +830,9 @@ var SettingsService = class extends BaseSDK {
736
830
  * @returns Promise resolving to the setting details
737
831
  */
738
832
  async getSettingByKey(key) {
739
- log4("Getting setting: %s", key);
833
+ log5("Getting setting: %s", key);
740
834
  const result = await this.request(`/admin/settings/${key}`);
741
- log4("Setting retrieved");
835
+ log5("Setting retrieved");
742
836
  return result;
743
837
  }
744
838
  /**
@@ -748,12 +842,12 @@ var SettingsService = class extends BaseSDK {
748
842
  * @returns Promise resolving to the created setting
749
843
  */
750
844
  async createSetting(data) {
751
- log4("Creating setting: %O", data);
845
+ log5("Creating setting: %O", data);
752
846
  const result = await this.request("/admin/settings", {
753
847
  body: JSON.stringify(data),
754
848
  method: "POST"
755
849
  });
756
- log4("Setting created successfully");
850
+ log5("Setting created successfully");
757
851
  return result;
758
852
  }
759
853
  /**
@@ -764,12 +858,12 @@ var SettingsService = class extends BaseSDK {
764
858
  * @returns Promise resolving to the updated setting
765
859
  */
766
860
  async updateSetting(key, data) {
767
- log4("Updating setting: %s, data: %O", key, data);
861
+ log5("Updating setting: %s, data: %O", key, data);
768
862
  const result = await this.request(`/admin/settings/${key}`, {
769
863
  body: JSON.stringify(data),
770
864
  method: "PUT"
771
865
  });
772
- log4("Setting updated successfully");
866
+ log5("Setting updated successfully");
773
867
  return result;
774
868
  }
775
869
  /**
@@ -779,18 +873,18 @@ var SettingsService = class extends BaseSDK {
779
873
  * @returns Promise resolving to success message
780
874
  */
781
875
  async deleteSetting(key) {
782
- log4("Deleting setting: %s", key);
876
+ log5("Deleting setting: %s", key);
783
877
  const result = await this.request(`/admin/settings/${key}`, {
784
878
  method: "DELETE"
785
879
  });
786
- log4("Setting deleted successfully");
880
+ log5("Setting deleted successfully");
787
881
  return result;
788
882
  }
789
883
  };
790
884
 
791
885
  // src/admin/services/ReviewService.ts
792
- import debug5 from "debug";
793
- var log5 = debug5("lobe-market-sdk:admin:review");
886
+ import debug6 from "debug";
887
+ var log6 = debug6("lobe-market-sdk:admin:review");
794
888
  var ReviewService = class extends BaseSDK {
795
889
  /**
796
890
  * Creates a new ReviewService instance
@@ -800,7 +894,7 @@ var ReviewService = class extends BaseSDK {
800
894
  */
801
895
  constructor(options = {}, sharedHeaders) {
802
896
  super(options, sharedHeaders);
803
- log5("ReviewService instance created");
897
+ log6("ReviewService instance created");
804
898
  }
805
899
  /**
806
900
  * Retrieves a list of reviews with filtering options
@@ -809,11 +903,11 @@ var ReviewService = class extends BaseSDK {
809
903
  * @returns Promise resolving to the review list response
810
904
  */
811
905
  async getReviews(params = {}) {
812
- log5("Getting reviews with params: %O", params);
906
+ log6("Getting reviews with params: %O", params);
813
907
  const queryString = this.buildQueryString(params);
814
908
  const url = `/admin/reviews${queryString ? `?${queryString}` : ""}`;
815
909
  const result = await this.request(url);
816
- log5("Retrieved %d reviews", result.data.length);
910
+ log6("Retrieved %d reviews", result.data.length);
817
911
  return result;
818
912
  }
819
913
  /**
@@ -823,9 +917,9 @@ var ReviewService = class extends BaseSDK {
823
917
  * @returns Promise resolving to the review details
824
918
  */
825
919
  async getReviewById(id) {
826
- log5("Getting review details: %d", id);
920
+ log6("Getting review details: %d", id);
827
921
  const result = await this.request(`/admin/reviews/${id}`);
828
- log5("Review details retrieved");
922
+ log6("Review details retrieved");
829
923
  return result;
830
924
  }
831
925
  /**
@@ -836,12 +930,12 @@ var ReviewService = class extends BaseSDK {
836
930
  * @returns Promise resolving to the updated review
837
931
  */
838
932
  async updateReview(id, data) {
839
- log5("Updating review: %d, data: %O", id, data);
933
+ log6("Updating review: %d, data: %O", id, data);
840
934
  const result = await this.request(`/admin/reviews/${id}`, {
841
935
  body: JSON.stringify(data),
842
936
  method: "PUT"
843
937
  });
844
- log5("Review updated successfully");
938
+ log6("Review updated successfully");
845
939
  return result;
846
940
  }
847
941
  /**
@@ -851,16 +945,16 @@ var ReviewService = class extends BaseSDK {
851
945
  * @returns Promise resolving to an array of reviews for the plugin
852
946
  */
853
947
  async getPluginReviews(pluginId) {
854
- log5("Getting plugin reviews: pluginId=%d", pluginId);
948
+ log6("Getting plugin reviews: pluginId=%d", pluginId);
855
949
  const result = await this.request(`/admin/reviews/plugin/${pluginId}`);
856
- log5("Retrieved %d reviews for plugin", result.data.length);
950
+ log6("Retrieved %d reviews for plugin", result.data.length);
857
951
  return result;
858
952
  }
859
953
  };
860
954
 
861
955
  // src/admin/services/PluginEnvService.ts
862
- import debug6 from "debug";
863
- var log6 = debug6("lobe-market-sdk:admin:plugin-env");
956
+ import debug7 from "debug";
957
+ var log7 = debug7("lobe-market-sdk:admin:plugin-env");
864
958
  var PluginEnvService = class extends BaseSDK {
865
959
  /**
866
960
  * Retrieves a paginated list of plugin environment variables
@@ -869,11 +963,11 @@ var PluginEnvService = class extends BaseSDK {
869
963
  * @returns Promise resolving to the env list response
870
964
  */
871
965
  async getPluginEnvs(params = {}) {
872
- log6("Getting plugin envs with params: %O", params);
966
+ log7("Getting plugin envs with params: %O", params);
873
967
  const queryString = this.buildQueryString(params);
874
968
  const url = `/admin/plugins/env${queryString}`;
875
969
  const result = await this.request(url);
876
- log6("Retrieved %d plugin envs", result.data.length);
970
+ log7("Retrieved %d plugin envs", result.data.length);
877
971
  return result;
878
972
  }
879
973
  /**
@@ -883,9 +977,9 @@ var PluginEnvService = class extends BaseSDK {
883
977
  * @returns Promise resolving to the env item
884
978
  */
885
979
  async getPluginEnv(id) {
886
- log6("Getting plugin env: %d", id);
980
+ log7("Getting plugin env: %d", id);
887
981
  const result = await this.request(`/admin/plugins/env/${id}`);
888
- log6("Retrieved plugin env: %d", id);
982
+ log7("Retrieved plugin env: %d", id);
889
983
  return result;
890
984
  }
891
985
  /**
@@ -895,12 +989,12 @@ var PluginEnvService = class extends BaseSDK {
895
989
  * @returns Promise resolving to the created env item
896
990
  */
897
991
  async createPluginEnv(data) {
898
- log6("Creating plugin env: %O", data);
992
+ log7("Creating plugin env: %O", data);
899
993
  const result = await this.request(`/admin/plugins/env`, {
900
994
  body: JSON.stringify(data),
901
995
  method: "POST"
902
996
  });
903
- log6("Plugin env created successfully");
997
+ log7("Plugin env created successfully");
904
998
  return result;
905
999
  }
906
1000
  /**
@@ -911,12 +1005,12 @@ var PluginEnvService = class extends BaseSDK {
911
1005
  * @returns Promise resolving to the updated env item
912
1006
  */
913
1007
  async updatePluginEnv(id, data) {
914
- log6("Updating plugin env: %d, data: %O", id, data);
1008
+ log7("Updating plugin env: %d, data: %O", id, data);
915
1009
  const result = await this.request(`/admin/plugins/env/${id}`, {
916
1010
  body: JSON.stringify(data),
917
1011
  method: "PUT"
918
1012
  });
919
- log6("Plugin env updated successfully");
1013
+ log7("Plugin env updated successfully");
920
1014
  return result;
921
1015
  }
922
1016
  /**
@@ -926,11 +1020,11 @@ var PluginEnvService = class extends BaseSDK {
926
1020
  * @returns Promise resolving to success response
927
1021
  */
928
1022
  async deletePluginEnv(id) {
929
- log6("Deleting plugin env: %d", id);
1023
+ log7("Deleting plugin env: %d", id);
930
1024
  const result = await this.request(`/admin/plugins/env/${id}`, {
931
1025
  method: "DELETE"
932
1026
  });
933
- log6("Plugin env deleted successfully");
1027
+ log7("Plugin env deleted successfully");
934
1028
  return result;
935
1029
  }
936
1030
  /**
@@ -940,18 +1034,18 @@ var PluginEnvService = class extends BaseSDK {
940
1034
  * @returns Promise resolving to import result
941
1035
  */
942
1036
  async importPluginEnvs(data) {
943
- log6("Batch importing plugin envs: %O", data);
1037
+ log7("Batch importing plugin envs: %O", data);
944
1038
  const result = await this.request(`/admin/plugins/env/import`, {
945
1039
  body: JSON.stringify(data),
946
1040
  method: "POST"
947
1041
  });
948
- log6("Batch import completed: %d envs imported", result.success);
1042
+ log7("Batch import completed: %d envs imported", result.success);
949
1043
  return result;
950
1044
  }
951
1045
  };
952
1046
 
953
1047
  // src/admin/MarketAdmin.ts
954
- var log7 = debug7("lobe-market-sdk:admin");
1048
+ var log8 = debug8("lobe-market-sdk:admin");
955
1049
  var MarketAdmin = class extends BaseSDK {
956
1050
  /**
957
1051
  * Creates a new MarketAdmin instance
@@ -961,7 +1055,8 @@ var MarketAdmin = class extends BaseSDK {
961
1055
  constructor(options = {}) {
962
1056
  const apiKey = options.apiKey || process.env.MARKET_ADMIN_API_KEY;
963
1057
  super({ ...options, apiKey });
964
- log7("MarketAdmin instance created");
1058
+ log8("MarketAdmin instance created");
1059
+ this.analysis = new AnalysisService(options, this.headers);
965
1060
  this.plugins = new PluginService(options, this.headers);
966
1061
  this.reviews = new ReviewService(options, this.headers);
967
1062
  this.settings = new SettingsService(options, this.headers);
@@ -971,11 +1066,11 @@ var MarketAdmin = class extends BaseSDK {
971
1066
  };
972
1067
 
973
1068
  // src/market/market-sdk.ts
974
- import debug10 from "debug";
1069
+ import debug11 from "debug";
975
1070
 
976
1071
  // src/market/services/DiscoveryService.ts
977
- import debug8 from "debug";
978
- var log8 = debug8("lobe-market-sdk:discovery");
1072
+ import debug9 from "debug";
1073
+ var log9 = debug9("lobe-market-sdk:discovery");
979
1074
  var DiscoveryService = class extends BaseSDK {
980
1075
  /**
981
1076
  * Creates a new DiscoveryService instance
@@ -985,7 +1080,7 @@ var DiscoveryService = class extends BaseSDK {
985
1080
  */
986
1081
  constructor(options = {}, sharedHeaders) {
987
1082
  super(options, sharedHeaders);
988
- log8("DiscoveryService instance created");
1083
+ log9("DiscoveryService instance created");
989
1084
  }
990
1085
  /**
991
1086
  * Retrieves the service discovery document
@@ -997,20 +1092,20 @@ var DiscoveryService = class extends BaseSDK {
997
1092
  * @returns Promise resolving to the service discovery document
998
1093
  */
999
1094
  async getDiscoveryDocument() {
1000
- log8("Fetching discovery document");
1095
+ log9("Fetching discovery document");
1001
1096
  if (this.discoveryDoc) {
1002
- log8("Returning cached discovery document");
1097
+ log9("Returning cached discovery document");
1003
1098
  return this.discoveryDoc;
1004
1099
  }
1005
1100
  this.discoveryDoc = await this.request("/market/.well-known/discovery");
1006
- log8("Discovery document successfully fetched");
1101
+ log9("Discovery document successfully fetched");
1007
1102
  return this.discoveryDoc;
1008
1103
  }
1009
1104
  };
1010
1105
 
1011
1106
  // src/market/services/PluginsService.ts
1012
- import debug9 from "debug";
1013
- var log9 = debug9("lobe-market-sdk:plugins");
1107
+ import debug10 from "debug";
1108
+ var log10 = debug10("lobe-market-sdk:plugins");
1014
1109
  var PluginsService = class extends BaseSDK {
1015
1110
  /**
1016
1111
  * Creates a new PluginsService instance
@@ -1020,7 +1115,7 @@ var PluginsService = class extends BaseSDK {
1020
1115
  */
1021
1116
  constructor(options = {}, sharedHeaders) {
1022
1117
  super(options, sharedHeaders);
1023
- log9("PluginsService instance created");
1118
+ log10("PluginsService instance created");
1024
1119
  }
1025
1120
  /**
1026
1121
  * Retrieves a list of plugins from the marketplace
@@ -1035,9 +1130,9 @@ var PluginsService = class extends BaseSDK {
1035
1130
  const locale = params.locale || this.defaultLocale;
1036
1131
  const queryParams = { ...params, locale };
1037
1132
  const queryString = this.buildQueryString(queryParams);
1038
- log9("Getting plugin list: %O", queryParams);
1133
+ log10("Getting plugin list: %O", queryParams);
1039
1134
  const result = await this.request(`/v1/plugins${queryString}`, options);
1040
- log9("Retrieved %d plugins", result.items.length);
1135
+ log10("Retrieved %d plugins", result.items.length);
1041
1136
  return result;
1042
1137
  }
1043
1138
  /**
@@ -1055,12 +1150,12 @@ var PluginsService = class extends BaseSDK {
1055
1150
  const locale = params.locale || this.defaultLocale;
1056
1151
  const queryParams = { ...params, locale };
1057
1152
  const queryString = this.buildQueryString(queryParams);
1058
- log9("Getting plugin categories: %O", queryParams);
1153
+ log10("Getting plugin categories: %O", queryParams);
1059
1154
  const result = await this.request(
1060
1155
  `/v1/plugins/categories${queryString}`,
1061
1156
  options
1062
1157
  );
1063
- log9("Retrieved %d categories", result.length);
1158
+ log10("Retrieved %d categories", result.length);
1064
1159
  return result;
1065
1160
  }
1066
1161
  /**
@@ -1073,12 +1168,12 @@ var PluginsService = class extends BaseSDK {
1073
1168
  * @returns Promise resolving to an array containing identifiers array and last modified time
1074
1169
  */
1075
1170
  async getPublishedIdentifiers(options) {
1076
- log9("Getting published plugin identifiers");
1171
+ log10("Getting published plugin identifiers");
1077
1172
  const result = await this.request(
1078
1173
  "/v1/plugins/identifiers",
1079
1174
  options
1080
1175
  );
1081
- log9("Retrieved %d published plugin identifiers", result.length);
1176
+ log10("Retrieved %d published plugin identifiers", result.length);
1082
1177
  return result;
1083
1178
  }
1084
1179
  /**
@@ -1098,7 +1193,7 @@ var PluginsService = class extends BaseSDK {
1098
1193
  version,
1099
1194
  identifier
1100
1195
  }, options) {
1101
- log9("Getting plugin manifest: %O", { identifier, locale, version });
1196
+ log10("Getting plugin manifest: %O", { identifier, locale, version });
1102
1197
  const localeParam = locale || this.defaultLocale;
1103
1198
  const params = { locale: localeParam };
1104
1199
  if (version) {
@@ -1109,7 +1204,7 @@ var PluginsService = class extends BaseSDK {
1109
1204
  `/v1/plugins/${identifier}/manifest${queryString}`,
1110
1205
  options
1111
1206
  );
1112
- log9("Plugin manifest successfully retrieved: %s", identifier);
1207
+ log10("Plugin manifest successfully retrieved: %s", identifier);
1113
1208
  return manifest;
1114
1209
  }
1115
1210
  /**
@@ -1126,7 +1221,7 @@ var PluginsService = class extends BaseSDK {
1126
1221
  version,
1127
1222
  identifier
1128
1223
  }, options) {
1129
- log9("Getting plugin detail: %O", { identifier, locale, version });
1224
+ log10("Getting plugin detail: %O", { identifier, locale, version });
1130
1225
  const localeParam = locale || this.defaultLocale;
1131
1226
  const params = { locale: localeParam };
1132
1227
  if (version) {
@@ -1137,13 +1232,13 @@ var PluginsService = class extends BaseSDK {
1137
1232
  `/v1/plugins/${identifier}${queryString}`,
1138
1233
  options
1139
1234
  );
1140
- log9("Plugin manifest successfully retrieved: %s", identifier);
1235
+ log10("Plugin manifest successfully retrieved: %s", identifier);
1141
1236
  return manifest;
1142
1237
  }
1143
1238
  };
1144
1239
 
1145
1240
  // src/market/market-sdk.ts
1146
- var log10 = debug10("lobe-market-sdk");
1241
+ var log11 = debug11("lobe-market-sdk");
1147
1242
  var MarketSDK = class extends BaseSDK {
1148
1243
  /**
1149
1244
  * Creates a new MarketSDK instance
@@ -1152,7 +1247,7 @@ var MarketSDK = class extends BaseSDK {
1152
1247
  */
1153
1248
  constructor(options = {}) {
1154
1249
  super(options);
1155
- log10("MarketSDK instance created");
1250
+ log11("MarketSDK instance created");
1156
1251
  this.plugins = new PluginsService(options, this.headers);
1157
1252
  this.discovery = new DiscoveryService(options, this.headers);
1158
1253
  }