@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.d.mts CHANGED
@@ -418,6 +418,129 @@ declare class BaseSDK {
418
418
  clearAuthToken(): void;
419
419
  }
420
420
 
421
+ /**
422
+ * Market Overview Statistics Interface
423
+ * Defines the structure for market overview data
424
+ */
425
+ interface MarketOverviewStats {
426
+ installs: {
427
+ count: number;
428
+ prevCount: number;
429
+ };
430
+ newPlugins: {
431
+ count: number;
432
+ prevCount: number;
433
+ };
434
+ period: string;
435
+ plugins: {
436
+ count: number;
437
+ prevCount: number;
438
+ };
439
+ scores: {
440
+ avg: number;
441
+ prevAvg: number;
442
+ };
443
+ }
444
+ /**
445
+ * Period type for analysis queries
446
+ */
447
+ type AnalysisPeriod = '1d' | '7d' | '30d';
448
+ /**
449
+ * Market overview query parameters
450
+ */
451
+ interface MarketOverviewQuery {
452
+ /** Analysis period: 1d, 7d, or 30d */
453
+ period?: AnalysisPeriod;
454
+ }
455
+ /**
456
+ * Analysis Management Service
457
+ *
458
+ * Provides administrative functionality for accessing market analysis and statistics.
459
+ * This service handles retrieving various analytics reports including market overview,
460
+ * plugin trends, and installation analytics for administrative dashboards.
461
+ */
462
+ declare class AnalysisService extends BaseSDK {
463
+ /**
464
+ * Retrieves market overview statistics
465
+ *
466
+ * Returns comprehensive market statistics including plugin counts,
467
+ * installation metrics, new plugin trends, and rating averages
468
+ * with comparison to previous periods.
469
+ *
470
+ * @param params - Query parameters for the analysis
471
+ * @returns Promise resolving to market overview statistics
472
+ */
473
+ getMarketOverview(params?: MarketOverviewQuery): Promise<MarketOverviewStats>;
474
+ /**
475
+ * Retrieves market overview statistics for 1 day period
476
+ *
477
+ * Convenience method for getting daily market statistics.
478
+ *
479
+ * @returns Promise resolving to market overview statistics for 1 day
480
+ */
481
+ getDailyOverview(): Promise<MarketOverviewStats>;
482
+ /**
483
+ * Retrieves market overview statistics for 7 days period
484
+ *
485
+ * Convenience method for getting weekly market statistics.
486
+ *
487
+ * @returns Promise resolving to market overview statistics for 7 days
488
+ */
489
+ getWeeklyOverview(): Promise<MarketOverviewStats>;
490
+ /**
491
+ * Retrieves market overview statistics for 30 days period
492
+ *
493
+ * Convenience method for getting monthly market statistics.
494
+ *
495
+ * @returns Promise resolving to market overview statistics for 30 days
496
+ */
497
+ getMonthlyOverview(): Promise<MarketOverviewStats>;
498
+ /**
499
+ * Calculates growth rate between current and previous values
500
+ *
501
+ * Utility method for calculating percentage growth rates from the statistics.
502
+ *
503
+ * @param current - Current period value
504
+ * @param previous - Previous period value
505
+ * @returns Growth rate as percentage (e.g., 15.5 for 15.5% growth)
506
+ */
507
+ static calculateGrowthRate(current: number, previous: number): number;
508
+ /**
509
+ * Formats market overview statistics with calculated growth rates
510
+ *
511
+ * Utility method that enhances the raw statistics with calculated growth rates
512
+ * for easier consumption in dashboards and reports.
513
+ *
514
+ * @param stats - Raw market overview statistics
515
+ * @returns Enhanced statistics with growth rate calculations
516
+ */
517
+ static formatMarketOverview(stats: MarketOverviewStats): {
518
+ growth: {
519
+ installs: number;
520
+ newPlugins: number;
521
+ plugins: number;
522
+ scores: number;
523
+ };
524
+ installs: {
525
+ count: number;
526
+ prevCount: number;
527
+ };
528
+ newPlugins: {
529
+ count: number;
530
+ prevCount: number;
531
+ };
532
+ period: string;
533
+ plugins: {
534
+ count: number;
535
+ prevCount: number;
536
+ };
537
+ scores: {
538
+ avg: number;
539
+ prevAvg: number;
540
+ };
541
+ };
542
+ }
543
+
421
544
  /**
422
545
  * Plugin Management Service
423
546
  *
@@ -1089,6 +1212,11 @@ declare class PluginEnvService extends BaseSDK {
1089
1212
  * system settings, and dependencies. It requires admin-level authentication.
1090
1213
  */
1091
1214
  declare class MarketAdmin extends BaseSDK {
1215
+ /**
1216
+ * Market analysis service
1217
+ * Provides methods for accessing market analytics and statistics
1218
+ */
1219
+ readonly analysis: AnalysisService;
1092
1220
  /**
1093
1221
  * Plugin management service
1094
1222
  * Provides methods for creating, updating, and managing plugins