@lobehub/market-sdk 0.14.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
@@ -169,8 +169,12 @@ interface PluginVersionUpdateParams {
169
169
  interface PluginUpdateParams {
170
170
  /** Unique identifier for the plugin */
171
171
  identifier?: string;
172
+ /** Whether this plugin has been claimed by its original author */
173
+ isClaimed?: boolean;
172
174
  /** Whether this plugin is featured */
173
175
  isFeatured?: boolean;
176
+ /** Whether this plugin is officially maintained by LobeHub */
177
+ isOfficial?: boolean;
174
178
  /** Publication status */
175
179
  status?: 'published' | 'draft' | 'review' | 'rejected';
176
180
  /** Visibility level */
@@ -213,6 +217,16 @@ interface PluginI18nImportResponse {
213
217
  /** Total number of processed localizations */
214
218
  totalLocalizations: number;
215
219
  }
220
+ /**
221
+ * Unclaimed plugin item data structure
222
+ * Represents a plugin that has not been claimed by its author
223
+ */
224
+ interface UnclaimedPluginItem {
225
+ /** Plugin ID */
226
+ id: number;
227
+ /** Plugin identifier */
228
+ identifier: string;
229
+ }
216
230
 
217
231
  /**
218
232
  * Market Service Discovery Document
@@ -291,8 +305,12 @@ interface PluginItem extends MarketItemBase {
291
305
  installCount?: number;
292
306
  /** Installation method required by the plugin's recommended deployment option */
293
307
  installationMethods?: string;
308
+ /** Whether this plugin has been claimed by its original author */
309
+ isClaimed?: boolean;
294
310
  /** Whether the plugin is featured */
295
311
  isFeatured?: boolean;
312
+ /** Whether this plugin is officially maintained by LobeHub */
313
+ isOfficial?: boolean;
296
314
  /** Whether this plugin has been validated */
297
315
  isValidated?: boolean;
298
316
  /** Number of prompts provided by this plugin */
@@ -400,6 +418,129 @@ declare class BaseSDK {
400
418
  clearAuthToken(): void;
401
419
  }
402
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
+
403
544
  /**
404
545
  * Plugin Management Service
405
546
  *
@@ -468,6 +609,13 @@ declare class PluginService extends BaseSDK {
468
609
  * @returns Promise resolving to the detailed plugin information with version history
469
610
  */
470
611
  getPlugin(id: number | string): Promise<AdminPluginItemDetail>;
612
+ /**
613
+ * Retrieves a plugin by its GitHub repository URL
614
+ *
615
+ * @param githubUrl - The GitHub repository URL to search for
616
+ * @returns Promise resolving to the detailed plugin information with version history
617
+ */
618
+ getPluginByGithubUrl(githubUrl: string): Promise<AdminPluginItemDetail>;
471
619
  /**
472
620
  * Updates plugin information
473
621
  *
@@ -691,14 +839,21 @@ declare class PluginService extends BaseSDK {
691
839
  versionId: number;
692
840
  }[]>;
693
841
  /**
694
- * 获取i18n不完整的插件列表
842
+ * Retrieves plugins with incomplete internationalization
695
843
  *
696
- * 返回pluginVersionLocalizations只有1个条目的插件。
697
- * 这些插件需要添加更多语言的本地化内容。
844
+ * Returns plugins where pluginVersionLocalizations has only 1 entry.
698
845
  *
699
- * @returns Promise resolving to array of plugins with incomplete i18n
846
+ * @returns Promise resolving to an array of plugins with incomplete i18n
700
847
  */
701
848
  getIncompleteI18nPlugins(): Promise<IncompleteI18nPlugin[]>;
849
+ /**
850
+ * Retrieves unclaimed plugins
851
+ *
852
+ * Returns plugins where isClaimed is false, containing only ID and identifier.
853
+ *
854
+ * @returns Promise resolving to an array of unclaimed plugins with basic info
855
+ */
856
+ getUnclaimedPlugins(): Promise<UnclaimedPluginItem[]>;
702
857
  }
703
858
 
704
859
  /**
@@ -1057,6 +1212,11 @@ declare class PluginEnvService extends BaseSDK {
1057
1212
  * system settings, and dependencies. It requires admin-level authentication.
1058
1213
  */
1059
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;
1060
1220
  /**
1061
1221
  * Plugin management service
1062
1222
  * Provides methods for creating, updating, and managing plugins
@@ -1205,4 +1365,4 @@ declare class MarketSDK extends BaseSDK {
1205
1365
  getDiscoveryDocument(): Promise<DiscoveryDocument>;
1206
1366
  }
1207
1367
 
1208
- 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, VisibilityEnumSchema };
1368
+ 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 };