@lobehub/market-sdk 0.15.0 → 0.17.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 +225 -2
- package/dist/index.mjs +292 -137
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MarketItemBase, PluginConnectionType, PluginManifest, AdminPluginItem, AdminPluginItemDetail, PluginVersion, PluginVersionLocalization, AdminDeploymentOption, InstallationDetails, SystemDependency, IncompleteI18nPlugin, CategoryListQuery, CategoryItem, PluginItemDetail } from '@lobehub/market-types';
|
|
2
|
-
export * from '@lobehub/market-types';
|
|
3
2
|
export { CategoryItem, CategoryListQuery, CategoryListResponse } from '@lobehub/market-types';
|
|
4
3
|
import { z } from 'zod';
|
|
5
4
|
|
|
@@ -227,6 +226,43 @@ interface UnclaimedPluginItem {
|
|
|
227
226
|
/** Plugin identifier */
|
|
228
227
|
identifier: string;
|
|
229
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Range Data Point Interface
|
|
231
|
+
* Defines the structure for daily trend data points
|
|
232
|
+
*/
|
|
233
|
+
interface RangeDataPoint$1 {
|
|
234
|
+
/** Date in YYYY-MM-DD format */
|
|
235
|
+
date: string;
|
|
236
|
+
/** Current period count */
|
|
237
|
+
count: number;
|
|
238
|
+
/** Previous period count for comparison */
|
|
239
|
+
prevCount: number;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Range Statistics Interface
|
|
243
|
+
* Defines the structure for range-based statistics
|
|
244
|
+
*/
|
|
245
|
+
interface RangeStats$1 {
|
|
246
|
+
/** Array of daily data points */
|
|
247
|
+
data: RangeDataPoint$1[];
|
|
248
|
+
/** Total sum for current period */
|
|
249
|
+
sum: number;
|
|
250
|
+
/** Total sum for previous period */
|
|
251
|
+
prevSum: number;
|
|
252
|
+
/** Display configuration */
|
|
253
|
+
display: string;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Range query parameters for trend analysis
|
|
257
|
+
*/
|
|
258
|
+
interface RangeQuery$1 {
|
|
259
|
+
/** Display configuration */
|
|
260
|
+
display: string;
|
|
261
|
+
/** Date range as [startDate, endDate] */
|
|
262
|
+
range: [string, string];
|
|
263
|
+
/** Optional previous period range for comparison */
|
|
264
|
+
prevRange?: [string, string];
|
|
265
|
+
}
|
|
230
266
|
|
|
231
267
|
/**
|
|
232
268
|
* Market Service Discovery Document
|
|
@@ -418,6 +454,188 @@ declare class BaseSDK {
|
|
|
418
454
|
clearAuthToken(): void;
|
|
419
455
|
}
|
|
420
456
|
|
|
457
|
+
/**
|
|
458
|
+
* Market Overview Statistics Interface
|
|
459
|
+
* Defines the structure for market overview data
|
|
460
|
+
*/
|
|
461
|
+
interface MarketOverviewStats {
|
|
462
|
+
installs: {
|
|
463
|
+
count: number;
|
|
464
|
+
prevCount: number;
|
|
465
|
+
};
|
|
466
|
+
newPlugins: {
|
|
467
|
+
count: number;
|
|
468
|
+
prevCount: number;
|
|
469
|
+
};
|
|
470
|
+
period: string;
|
|
471
|
+
plugins: {
|
|
472
|
+
count: number;
|
|
473
|
+
prevCount: number;
|
|
474
|
+
};
|
|
475
|
+
scores: {
|
|
476
|
+
avg: number;
|
|
477
|
+
prevAvg: number;
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Period type for analysis queries
|
|
482
|
+
*/
|
|
483
|
+
type AnalysisPeriod = '1d' | '7d' | '30d';
|
|
484
|
+
/**
|
|
485
|
+
* Market overview query parameters
|
|
486
|
+
*/
|
|
487
|
+
interface MarketOverviewQuery {
|
|
488
|
+
/** Analysis period: 1d, 7d, or 30d */
|
|
489
|
+
period?: AnalysisPeriod;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Range Data Point Interface
|
|
493
|
+
* Defines the structure for daily trend data points
|
|
494
|
+
*/
|
|
495
|
+
interface RangeDataPoint {
|
|
496
|
+
count: number;
|
|
497
|
+
date: string;
|
|
498
|
+
prevCount: number;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Range Statistics Interface
|
|
502
|
+
* Defines the structure for range-based statistics
|
|
503
|
+
*/
|
|
504
|
+
interface RangeStats {
|
|
505
|
+
data: RangeDataPoint[];
|
|
506
|
+
display: string;
|
|
507
|
+
prevSum: number;
|
|
508
|
+
sum: number;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Range query parameters for trend analysis
|
|
512
|
+
*/
|
|
513
|
+
interface RangeQuery {
|
|
514
|
+
/** Display configuration */
|
|
515
|
+
display: string;
|
|
516
|
+
/** Optional previous period range for comparison */
|
|
517
|
+
prevRange?: [string, string];
|
|
518
|
+
/** Date range as [startDate, endDate] */
|
|
519
|
+
range: [string, string];
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Analysis Management Service
|
|
523
|
+
*
|
|
524
|
+
* Provides administrative functionality for accessing market analysis and statistics.
|
|
525
|
+
* This service handles retrieving various analytics reports including market overview,
|
|
526
|
+
* plugin trends, and installation analytics for administrative dashboards.
|
|
527
|
+
*/
|
|
528
|
+
declare class AnalysisService extends BaseSDK {
|
|
529
|
+
/**
|
|
530
|
+
* Retrieves market overview statistics
|
|
531
|
+
*
|
|
532
|
+
* Returns comprehensive market statistics including plugin counts,
|
|
533
|
+
* installation metrics, new plugin trends, and rating averages
|
|
534
|
+
* with comparison to previous periods.
|
|
535
|
+
*
|
|
536
|
+
* @param params - Query parameters for the analysis
|
|
537
|
+
* @returns Promise resolving to market overview statistics
|
|
538
|
+
*/
|
|
539
|
+
getMarketOverview(params?: MarketOverviewQuery): Promise<MarketOverviewStats>;
|
|
540
|
+
/**
|
|
541
|
+
* Retrieves market overview statistics for 1 day period
|
|
542
|
+
*
|
|
543
|
+
* Convenience method for getting daily market statistics.
|
|
544
|
+
*
|
|
545
|
+
* @returns Promise resolving to market overview statistics for 1 day
|
|
546
|
+
*/
|
|
547
|
+
getDailyOverview(): Promise<MarketOverviewStats>;
|
|
548
|
+
/**
|
|
549
|
+
* Retrieves market overview statistics for 7 days period
|
|
550
|
+
*
|
|
551
|
+
* Convenience method for getting weekly market statistics.
|
|
552
|
+
*
|
|
553
|
+
* @returns Promise resolving to market overview statistics for 7 days
|
|
554
|
+
*/
|
|
555
|
+
getWeeklyOverview(): Promise<MarketOverviewStats>;
|
|
556
|
+
/**
|
|
557
|
+
* Retrieves market overview statistics for 30 days period
|
|
558
|
+
*
|
|
559
|
+
* Convenience method for getting monthly market statistics.
|
|
560
|
+
*
|
|
561
|
+
* @returns Promise resolving to market overview statistics for 30 days
|
|
562
|
+
*/
|
|
563
|
+
getMonthlyOverview(): Promise<MarketOverviewStats>;
|
|
564
|
+
/**
|
|
565
|
+
* Calculates growth rate between current and previous values
|
|
566
|
+
*
|
|
567
|
+
* Utility method for calculating percentage growth rates from the statistics.
|
|
568
|
+
*
|
|
569
|
+
* @param current - Current period value
|
|
570
|
+
* @param previous - Previous period value
|
|
571
|
+
* @returns Growth rate as percentage (e.g., 15.5 for 15.5% growth)
|
|
572
|
+
*/
|
|
573
|
+
static calculateGrowthRate(current: number, previous: number): number;
|
|
574
|
+
/**
|
|
575
|
+
* Formats market overview statistics with calculated growth rates
|
|
576
|
+
*
|
|
577
|
+
* Utility method that enhances the raw statistics with calculated growth rates
|
|
578
|
+
* for easier consumption in dashboards and reports.
|
|
579
|
+
*
|
|
580
|
+
* @param stats - Raw market overview statistics
|
|
581
|
+
* @returns Enhanced statistics with growth rate calculations
|
|
582
|
+
*/
|
|
583
|
+
static formatMarketOverview(stats: MarketOverviewStats): {
|
|
584
|
+
growth: {
|
|
585
|
+
installs: number;
|
|
586
|
+
newPlugins: number;
|
|
587
|
+
plugins: number;
|
|
588
|
+
scores: number;
|
|
589
|
+
};
|
|
590
|
+
installs: {
|
|
591
|
+
count: number;
|
|
592
|
+
prevCount: number;
|
|
593
|
+
};
|
|
594
|
+
newPlugins: {
|
|
595
|
+
count: number;
|
|
596
|
+
prevCount: number;
|
|
597
|
+
};
|
|
598
|
+
period: string;
|
|
599
|
+
plugins: {
|
|
600
|
+
count: number;
|
|
601
|
+
prevCount: number;
|
|
602
|
+
};
|
|
603
|
+
scores: {
|
|
604
|
+
avg: number;
|
|
605
|
+
prevAvg: number;
|
|
606
|
+
};
|
|
607
|
+
};
|
|
608
|
+
/**
|
|
609
|
+
* Retrieves installation trend statistics for a specified date range
|
|
610
|
+
*
|
|
611
|
+
* Returns daily installation counts and trends for the specified period
|
|
612
|
+
* with optional comparison to a previous period.
|
|
613
|
+
*
|
|
614
|
+
* @param params - Query parameters including date range and display config
|
|
615
|
+
* @returns Promise resolving to installation trend statistics
|
|
616
|
+
*/
|
|
617
|
+
getRangeInstalls(params: RangeQuery): Promise<RangeStats>;
|
|
618
|
+
/**
|
|
619
|
+
* Retrieves plugin growth trend statistics for a specified date range
|
|
620
|
+
*
|
|
621
|
+
* Returns daily plugin creation counts and trends for the specified period
|
|
622
|
+
* with optional comparison to a previous period.
|
|
623
|
+
*
|
|
624
|
+
* @param params - Query parameters including date range and display config
|
|
625
|
+
* @returns Promise resolving to plugin growth trend statistics
|
|
626
|
+
*/
|
|
627
|
+
getRangePlugins(params: RangeQuery): Promise<RangeStats>;
|
|
628
|
+
/**
|
|
629
|
+
* Calculates trend growth rate between current and previous period totals
|
|
630
|
+
*
|
|
631
|
+
* Utility method for calculating percentage growth rates from range statistics.
|
|
632
|
+
*
|
|
633
|
+
* @param stats - Range statistics with sum and prevSum
|
|
634
|
+
* @returns Growth rate as percentage (e.g., 15.5 for 15.5% growth)
|
|
635
|
+
*/
|
|
636
|
+
static calculateTrendGrowthRate(stats: RangeStats): number;
|
|
637
|
+
}
|
|
638
|
+
|
|
421
639
|
/**
|
|
422
640
|
* Plugin Management Service
|
|
423
641
|
*
|
|
@@ -1089,6 +1307,11 @@ declare class PluginEnvService extends BaseSDK {
|
|
|
1089
1307
|
* system settings, and dependencies. It requires admin-level authentication.
|
|
1090
1308
|
*/
|
|
1091
1309
|
declare class MarketAdmin extends BaseSDK {
|
|
1310
|
+
/**
|
|
1311
|
+
* Market analysis service
|
|
1312
|
+
* Provides methods for accessing market analytics and statistics
|
|
1313
|
+
*/
|
|
1314
|
+
readonly analysis: AnalysisService;
|
|
1092
1315
|
/**
|
|
1093
1316
|
* Plugin management service
|
|
1094
1317
|
* Provides methods for creating, updating, and managing plugins
|
|
@@ -1237,4 +1460,4 @@ declare class MarketSDK extends BaseSDK {
|
|
|
1237
1460
|
getDiscoveryDocument(): Promise<DiscoveryDocument>;
|
|
1238
1461
|
}
|
|
1239
1462
|
|
|
1240
|
-
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 };
|
|
1463
|
+
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 RangeDataPoint$1 as RangeDataPoint, type RangeQuery$1 as RangeQuery, type RangeStats$1 as RangeStats, type ReviewStatus, ReviewStatusEnumSchema, StatusEnumSchema, type UnclaimedPluginItem, VisibilityEnumSchema };
|