@proofchain/sdk 2.4.0 → 2.5.1

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
@@ -196,6 +196,50 @@ const webhooks = await client.webhooks.list();
196
196
  await client.webhooks.delete(webhook.id);
197
197
  ```
198
198
 
199
+ ### Quests
200
+
201
+ Quests are gamified user journeys with steps that can be completed via events.
202
+
203
+ ```typescript
204
+ // List available quests for a user (with their progress)
205
+ const quests = await client.quests.listAvailable(userId);
206
+ // Returns: { quest: Quest, progress?: UserQuestProgress }[]
207
+
208
+ // Each quest has a type that determines behavior:
209
+ // - 'epic': Long-form quests - user must explicitly start
210
+ // - 'quick_hit': Short quests - auto-enrolls on matching event
211
+ // - 'challenge': Time-limited quests - auto-enrolls on matching event
212
+
213
+ for (const { quest, progress } of quests) {
214
+ console.log(`${quest.name} (${quest.quest_type})`);
215
+ if (progress) {
216
+ console.log(` Progress: ${progress.completion_percentage}%`);
217
+ }
218
+ }
219
+
220
+ // Start an Epic quest (required for epic type only)
221
+ const progress = await client.quests.startQuest(questId, userId);
222
+
223
+ // Get user's progress on a specific quest
224
+ const questProgress = await client.quests.getUserProgress(questId, userId);
225
+
226
+ // Get all quest progress for a user
227
+ const allProgress = await client.quests.getAllUserProgress(userId);
228
+
229
+ // Complete a step manually (for manual step types)
230
+ const result = await client.quests.completeStep(questId, userId, stepIndex);
231
+ console.log('Step completed:', result.step_completed);
232
+ console.log('Quest completed:', result.quest_completed);
233
+ ```
234
+
235
+ **Quest Types:**
236
+
237
+ | Type | Behavior |
238
+ |------|----------|
239
+ | `epic` | Long-form, multi-step quests. User must call `startQuest()` to begin. |
240
+ | `quick_hit` | Short, easy quests. Auto-enrolls when user triggers a matching event. |
241
+ | `challenge` | Time-limited or competitive. Auto-enrolls when user triggers a matching event. |
242
+
199
243
  ## Error Handling
200
244
 
201
245
  ```typescript
package/dist/index.d.mts CHANGED
@@ -2455,6 +2455,157 @@ declare class DataViewsClient {
2455
2455
  getTemplates(): Promise<ViewTemplate[]>;
2456
2456
  }
2457
2457
 
2458
+ /**
2459
+ * Cohort Leaderboard API Client
2460
+ *
2461
+ * Manage cohort definitions, scoring, and filtered leaderboards with percentiles.
2462
+ */
2463
+
2464
+ interface CohortLeaderboardEntry {
2465
+ rank: number;
2466
+ user_id: string;
2467
+ score: number;
2468
+ percentile_global: number;
2469
+ percentile_filtered: number | null;
2470
+ computed_at?: string;
2471
+ }
2472
+ interface CohortGroupStats {
2473
+ filtered_avg_percentile: number | null;
2474
+ filtered_top_n_avg_percentile: number | null;
2475
+ global_count: number;
2476
+ global_avg_percentile: number;
2477
+ }
2478
+ interface CohortLeaderboardResponse {
2479
+ cohort_id: string;
2480
+ cohort_name: string;
2481
+ filter: Record<string, unknown>;
2482
+ total_users: number;
2483
+ group_stats: CohortGroupStats;
2484
+ leaderboard: CohortLeaderboardEntry[];
2485
+ }
2486
+ interface CohortDefinition {
2487
+ id: string;
2488
+ tenant_id: string;
2489
+ name: string;
2490
+ slug: string;
2491
+ description?: string;
2492
+ scoring_type: string;
2493
+ icon?: string;
2494
+ color?: string;
2495
+ status: 'active' | 'inactive' | 'draft';
2496
+ avg_score?: number;
2497
+ total_users?: number;
2498
+ created_at: string;
2499
+ updated_at: string;
2500
+ }
2501
+ interface UserCohortBreakdownEntry {
2502
+ cohort_id: string;
2503
+ cohort_slug: string;
2504
+ cohort_name: string;
2505
+ icon?: string;
2506
+ color?: string;
2507
+ user_percentile: number;
2508
+ filtered_group_avg_percentile: number | null;
2509
+ global_group_avg_percentile: number;
2510
+ }
2511
+ interface UserBreakdownResponse {
2512
+ user_id: string;
2513
+ filter: Record<string, unknown>;
2514
+ cohorts: UserCohortBreakdownEntry[];
2515
+ }
2516
+ interface CohortLeaderboardOptions {
2517
+ filters?: Record<string, string>;
2518
+ country?: string;
2519
+ limit?: number;
2520
+ top_n?: number;
2521
+ fresh?: boolean;
2522
+ }
2523
+ interface ListCohortsOptions {
2524
+ status?: 'active' | 'inactive' | 'draft';
2525
+ limit?: number;
2526
+ offset?: number;
2527
+ }
2528
+ declare class CohortLeaderboardClient {
2529
+ private http;
2530
+ constructor(http: HttpClient);
2531
+ /**
2532
+ * List all cohort definitions
2533
+ */
2534
+ list(options?: ListCohortsOptions): Promise<CohortDefinition[]>;
2535
+ /**
2536
+ * Get a cohort definition by ID
2537
+ */
2538
+ get(cohortId: string): Promise<CohortDefinition>;
2539
+ /**
2540
+ * Get filtered cohort leaderboard with both global and filtered percentiles
2541
+ */
2542
+ getLeaderboard(cohortId: string, options?: CohortLeaderboardOptions): Promise<CohortLeaderboardResponse>;
2543
+ /**
2544
+ * Get user's breakdown across all cohorts for spider charts
2545
+ */
2546
+ getUserBreakdown(userId: string, options?: {
2547
+ filters?: Record<string, string>;
2548
+ country?: string;
2549
+ }): Promise<UserBreakdownResponse>;
2550
+ }
2551
+
2552
+ /**
2553
+ * Fanpass Leaderboard API Client
2554
+ *
2555
+ * Manage fanpass composite scores and filtered leaderboards.
2556
+ */
2557
+
2558
+ interface FanpassLeaderboardEntry {
2559
+ rank: number;
2560
+ user_id: string;
2561
+ fan_score: number;
2562
+ raw_score: number;
2563
+ percentile: number;
2564
+ computed_at?: string;
2565
+ }
2566
+ interface FanpassGroupStats {
2567
+ avg_fan_score: number;
2568
+ top_n_avg_fan_score: number;
2569
+ global_count: number;
2570
+ global_avg_fan_score: number;
2571
+ }
2572
+ interface FanpassLeaderboardResponse {
2573
+ aggregation_rule_id: string | null;
2574
+ aggregation_rule_name: string | null;
2575
+ filter: Record<string, unknown>;
2576
+ total_users: number;
2577
+ group_stats: FanpassGroupStats;
2578
+ leaderboard: FanpassLeaderboardEntry[];
2579
+ }
2580
+ interface FanpassUserComparisonResponse {
2581
+ user_id: string;
2582
+ filter: Record<string, unknown>;
2583
+ cohorts: UserCohortBreakdownEntry[];
2584
+ }
2585
+ interface FanpassLeaderboardOptions {
2586
+ aggregationRuleId?: string;
2587
+ filters?: Record<string, string>;
2588
+ country?: string;
2589
+ limit?: number;
2590
+ top_n?: number;
2591
+ fresh?: boolean;
2592
+ }
2593
+ declare class FanpassLeaderboardClient {
2594
+ private http;
2595
+ constructor(http: HttpClient);
2596
+ /**
2597
+ * Get fanpass leaderboard with composite scores
2598
+ */
2599
+ getLeaderboard(options?: FanpassLeaderboardOptions): Promise<FanpassLeaderboardResponse>;
2600
+ /**
2601
+ * Get user's comparison across all cohorts (spider chart data)
2602
+ */
2603
+ getUserComparison(userId: string, options?: {
2604
+ filters?: Record<string, string>;
2605
+ country?: string;
2606
+ }): Promise<FanpassUserComparisonResponse>;
2607
+ }
2608
+
2458
2609
  /**
2459
2610
  * ProofChain Client
2460
2611
  */
@@ -2645,6 +2796,10 @@ declare class ProofChain {
2645
2796
  schemas: SchemasClient;
2646
2797
  /** Data Views client for custom data view operations */
2647
2798
  dataViews: DataViewsClient;
2799
+ /** Cohort leaderboard client for filtered leaderboards and percentiles */
2800
+ cohorts: CohortLeaderboardClient;
2801
+ /** Fanpass leaderboard client for composite score leaderboards */
2802
+ fanpassLeaderboard: FanpassLeaderboardClient;
2648
2803
  constructor(options: ProofChainOptions);
2649
2804
  /**
2650
2805
  * Create a client from environment variables.
@@ -2788,4 +2943,4 @@ declare class TimeoutError extends ProofChainError {
2788
2943
  constructor(message?: string);
2789
2944
  }
2790
2945
 
2791
- export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest, type CreateWebhookRequest, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FieldValue, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type LinkWalletRequest, type ListCertificatesRequest, type ListEndUsersOptions, type ListEventsRequest, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RewardAsset, type RewardDefinition, type RewardEarned, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type Settlement, type StepCompletionResult, type StepProgress, type StreamAck, type StreamEventRequest, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserQuestProgress, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletStats, type Webhook, WebhooksResource };
2946
+ export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type CohortDefinition, type CohortGroupStats, CohortLeaderboardClient, type CohortLeaderboardEntry, type CohortLeaderboardOptions, type CohortLeaderboardResponse, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest, type CreateWebhookRequest, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FanpassGroupStats, FanpassLeaderboardClient, type FanpassLeaderboardEntry, type FanpassLeaderboardOptions, type FanpassLeaderboardResponse, type FanpassUserComparisonResponse, type FieldValue, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type LinkWalletRequest, type ListCertificatesRequest, type ListCohortsOptions, type ListEndUsersOptions, type ListEventsRequest, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RewardAsset, type RewardDefinition, type RewardEarned, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type Settlement, type StepCompletionResult, type StepProgress, type StreamAck, type StreamEventRequest, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserBreakdownResponse, type UserCohortBreakdownEntry, type UserQuestProgress, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletStats, type Webhook, WebhooksResource };
package/dist/index.d.ts CHANGED
@@ -2455,6 +2455,157 @@ declare class DataViewsClient {
2455
2455
  getTemplates(): Promise<ViewTemplate[]>;
2456
2456
  }
2457
2457
 
2458
+ /**
2459
+ * Cohort Leaderboard API Client
2460
+ *
2461
+ * Manage cohort definitions, scoring, and filtered leaderboards with percentiles.
2462
+ */
2463
+
2464
+ interface CohortLeaderboardEntry {
2465
+ rank: number;
2466
+ user_id: string;
2467
+ score: number;
2468
+ percentile_global: number;
2469
+ percentile_filtered: number | null;
2470
+ computed_at?: string;
2471
+ }
2472
+ interface CohortGroupStats {
2473
+ filtered_avg_percentile: number | null;
2474
+ filtered_top_n_avg_percentile: number | null;
2475
+ global_count: number;
2476
+ global_avg_percentile: number;
2477
+ }
2478
+ interface CohortLeaderboardResponse {
2479
+ cohort_id: string;
2480
+ cohort_name: string;
2481
+ filter: Record<string, unknown>;
2482
+ total_users: number;
2483
+ group_stats: CohortGroupStats;
2484
+ leaderboard: CohortLeaderboardEntry[];
2485
+ }
2486
+ interface CohortDefinition {
2487
+ id: string;
2488
+ tenant_id: string;
2489
+ name: string;
2490
+ slug: string;
2491
+ description?: string;
2492
+ scoring_type: string;
2493
+ icon?: string;
2494
+ color?: string;
2495
+ status: 'active' | 'inactive' | 'draft';
2496
+ avg_score?: number;
2497
+ total_users?: number;
2498
+ created_at: string;
2499
+ updated_at: string;
2500
+ }
2501
+ interface UserCohortBreakdownEntry {
2502
+ cohort_id: string;
2503
+ cohort_slug: string;
2504
+ cohort_name: string;
2505
+ icon?: string;
2506
+ color?: string;
2507
+ user_percentile: number;
2508
+ filtered_group_avg_percentile: number | null;
2509
+ global_group_avg_percentile: number;
2510
+ }
2511
+ interface UserBreakdownResponse {
2512
+ user_id: string;
2513
+ filter: Record<string, unknown>;
2514
+ cohorts: UserCohortBreakdownEntry[];
2515
+ }
2516
+ interface CohortLeaderboardOptions {
2517
+ filters?: Record<string, string>;
2518
+ country?: string;
2519
+ limit?: number;
2520
+ top_n?: number;
2521
+ fresh?: boolean;
2522
+ }
2523
+ interface ListCohortsOptions {
2524
+ status?: 'active' | 'inactive' | 'draft';
2525
+ limit?: number;
2526
+ offset?: number;
2527
+ }
2528
+ declare class CohortLeaderboardClient {
2529
+ private http;
2530
+ constructor(http: HttpClient);
2531
+ /**
2532
+ * List all cohort definitions
2533
+ */
2534
+ list(options?: ListCohortsOptions): Promise<CohortDefinition[]>;
2535
+ /**
2536
+ * Get a cohort definition by ID
2537
+ */
2538
+ get(cohortId: string): Promise<CohortDefinition>;
2539
+ /**
2540
+ * Get filtered cohort leaderboard with both global and filtered percentiles
2541
+ */
2542
+ getLeaderboard(cohortId: string, options?: CohortLeaderboardOptions): Promise<CohortLeaderboardResponse>;
2543
+ /**
2544
+ * Get user's breakdown across all cohorts for spider charts
2545
+ */
2546
+ getUserBreakdown(userId: string, options?: {
2547
+ filters?: Record<string, string>;
2548
+ country?: string;
2549
+ }): Promise<UserBreakdownResponse>;
2550
+ }
2551
+
2552
+ /**
2553
+ * Fanpass Leaderboard API Client
2554
+ *
2555
+ * Manage fanpass composite scores and filtered leaderboards.
2556
+ */
2557
+
2558
+ interface FanpassLeaderboardEntry {
2559
+ rank: number;
2560
+ user_id: string;
2561
+ fan_score: number;
2562
+ raw_score: number;
2563
+ percentile: number;
2564
+ computed_at?: string;
2565
+ }
2566
+ interface FanpassGroupStats {
2567
+ avg_fan_score: number;
2568
+ top_n_avg_fan_score: number;
2569
+ global_count: number;
2570
+ global_avg_fan_score: number;
2571
+ }
2572
+ interface FanpassLeaderboardResponse {
2573
+ aggregation_rule_id: string | null;
2574
+ aggregation_rule_name: string | null;
2575
+ filter: Record<string, unknown>;
2576
+ total_users: number;
2577
+ group_stats: FanpassGroupStats;
2578
+ leaderboard: FanpassLeaderboardEntry[];
2579
+ }
2580
+ interface FanpassUserComparisonResponse {
2581
+ user_id: string;
2582
+ filter: Record<string, unknown>;
2583
+ cohorts: UserCohortBreakdownEntry[];
2584
+ }
2585
+ interface FanpassLeaderboardOptions {
2586
+ aggregationRuleId?: string;
2587
+ filters?: Record<string, string>;
2588
+ country?: string;
2589
+ limit?: number;
2590
+ top_n?: number;
2591
+ fresh?: boolean;
2592
+ }
2593
+ declare class FanpassLeaderboardClient {
2594
+ private http;
2595
+ constructor(http: HttpClient);
2596
+ /**
2597
+ * Get fanpass leaderboard with composite scores
2598
+ */
2599
+ getLeaderboard(options?: FanpassLeaderboardOptions): Promise<FanpassLeaderboardResponse>;
2600
+ /**
2601
+ * Get user's comparison across all cohorts (spider chart data)
2602
+ */
2603
+ getUserComparison(userId: string, options?: {
2604
+ filters?: Record<string, string>;
2605
+ country?: string;
2606
+ }): Promise<FanpassUserComparisonResponse>;
2607
+ }
2608
+
2458
2609
  /**
2459
2610
  * ProofChain Client
2460
2611
  */
@@ -2645,6 +2796,10 @@ declare class ProofChain {
2645
2796
  schemas: SchemasClient;
2646
2797
  /** Data Views client for custom data view operations */
2647
2798
  dataViews: DataViewsClient;
2799
+ /** Cohort leaderboard client for filtered leaderboards and percentiles */
2800
+ cohorts: CohortLeaderboardClient;
2801
+ /** Fanpass leaderboard client for composite score leaderboards */
2802
+ fanpassLeaderboard: FanpassLeaderboardClient;
2648
2803
  constructor(options: ProofChainOptions);
2649
2804
  /**
2650
2805
  * Create a client from environment variables.
@@ -2788,4 +2943,4 @@ declare class TimeoutError extends ProofChainError {
2788
2943
  constructor(message?: string);
2789
2944
  }
2790
2945
 
2791
- export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest, type CreateWebhookRequest, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FieldValue, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type LinkWalletRequest, type ListCertificatesRequest, type ListEndUsersOptions, type ListEventsRequest, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RewardAsset, type RewardDefinition, type RewardEarned, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type Settlement, type StepCompletionResult, type StepProgress, type StreamAck, type StreamEventRequest, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserQuestProgress, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletStats, type Webhook, WebhooksResource };
2946
+ export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type CohortDefinition, type CohortGroupStats, CohortLeaderboardClient, type CohortLeaderboardEntry, type CohortLeaderboardOptions, type CohortLeaderboardResponse, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest, type CreateWebhookRequest, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FanpassGroupStats, FanpassLeaderboardClient, type FanpassLeaderboardEntry, type FanpassLeaderboardOptions, type FanpassLeaderboardResponse, type FanpassUserComparisonResponse, type FieldValue, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type LinkWalletRequest, type ListCertificatesRequest, type ListCohortsOptions, type ListEndUsersOptions, type ListEventsRequest, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RewardAsset, type RewardDefinition, type RewardEarned, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type Settlement, type StepCompletionResult, type StepProgress, type StreamAck, type StreamEventRequest, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserBreakdownResponse, type UserCohortBreakdownEntry, type UserQuestProgress, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletStats, type Webhook, WebhooksResource };
package/dist/index.js CHANGED
@@ -24,10 +24,12 @@ __export(index_exports, {
24
24
  AuthorizationError: () => AuthorizationError,
25
25
  CertificatesResource: () => CertificatesResource,
26
26
  ChannelsResource: () => ChannelsResource,
27
+ CohortLeaderboardClient: () => CohortLeaderboardClient,
27
28
  DataViewsClient: () => DataViewsClient,
28
29
  DocumentsResource: () => DocumentsResource,
29
30
  EndUsersClient: () => EndUsersClient,
30
31
  EventsResource: () => EventsResource,
32
+ FanpassLeaderboardClient: () => FanpassLeaderboardClient,
31
33
  IngestionClient: () => IngestionClient,
32
34
  NetworkError: () => NetworkError,
33
35
  NotFoundError: () => NotFoundError,
@@ -1770,6 +1772,99 @@ var DataViewsClient = class {
1770
1772
  }
1771
1773
  };
1772
1774
 
1775
+ // src/cohorts.ts
1776
+ var CohortLeaderboardClient = class {
1777
+ constructor(http) {
1778
+ this.http = http;
1779
+ }
1780
+ /**
1781
+ * List all cohort definitions
1782
+ */
1783
+ async list(options = {}) {
1784
+ const params = {};
1785
+ if (options.status) params.status = options.status;
1786
+ if (options.limit) params.limit = options.limit;
1787
+ if (options.offset) params.offset = options.offset;
1788
+ const response = await this.http.get(
1789
+ "/cohorts/definitions",
1790
+ params
1791
+ );
1792
+ return Array.isArray(response) ? response : response.cohorts || [];
1793
+ }
1794
+ /**
1795
+ * Get a cohort definition by ID
1796
+ */
1797
+ async get(cohortId) {
1798
+ return this.http.get(
1799
+ `/cohorts/definitions/${encodeURIComponent(cohortId)}`
1800
+ );
1801
+ }
1802
+ /**
1803
+ * Get filtered cohort leaderboard with both global and filtered percentiles
1804
+ */
1805
+ async getLeaderboard(cohortId, options = {}) {
1806
+ const params = {};
1807
+ if (options.filters) params.filters = JSON.stringify(options.filters);
1808
+ if (options.country) params.country = options.country;
1809
+ if (options.limit) params.limit = options.limit;
1810
+ if (options.top_n) params.top_n = options.top_n;
1811
+ if (options.fresh) params.fresh = "true";
1812
+ return this.http.get(
1813
+ `/cohorts/definitions/${encodeURIComponent(cohortId)}/leaderboard`,
1814
+ params
1815
+ );
1816
+ }
1817
+ /**
1818
+ * Get user's breakdown across all cohorts for spider charts
1819
+ */
1820
+ async getUserBreakdown(userId, options = {}) {
1821
+ const params = {};
1822
+ if (options.filters) params.filters = JSON.stringify(options.filters);
1823
+ if (options.country) params.country = options.country;
1824
+ return this.http.get(
1825
+ `/cohorts/users/${encodeURIComponent(userId)}/breakdown`,
1826
+ params
1827
+ );
1828
+ }
1829
+ };
1830
+
1831
+ // src/fanpass_leaderboard.ts
1832
+ var FanpassLeaderboardClient = class {
1833
+ constructor(http) {
1834
+ this.http = http;
1835
+ }
1836
+ /**
1837
+ * Get fanpass leaderboard with composite scores
1838
+ */
1839
+ async getLeaderboard(options = {}) {
1840
+ const params = {};
1841
+ if (options.aggregationRuleId) {
1842
+ params.aggregation_rule_id = options.aggregationRuleId;
1843
+ }
1844
+ if (options.filters) params.filters = JSON.stringify(options.filters);
1845
+ if (options.country) params.country = options.country;
1846
+ if (options.limit) params.limit = options.limit;
1847
+ if (options.top_n) params.top_n = options.top_n;
1848
+ if (options.fresh) params.fresh = "true";
1849
+ return this.http.get(
1850
+ "/passport-v2/fanpass/leaderboard",
1851
+ params
1852
+ );
1853
+ }
1854
+ /**
1855
+ * Get user's comparison across all cohorts (spider chart data)
1856
+ */
1857
+ async getUserComparison(userId, options = {}) {
1858
+ const params = {};
1859
+ if (options.filters) params.filters = JSON.stringify(options.filters);
1860
+ if (options.country) params.country = options.country;
1861
+ return this.http.get(
1862
+ `/passport-v2/fanpass/${encodeURIComponent(userId)}/comparison`,
1863
+ params
1864
+ );
1865
+ }
1866
+ };
1867
+
1773
1868
  // src/client.ts
1774
1869
  var DocumentsResource = class {
1775
1870
  constructor(http) {
@@ -2065,6 +2160,8 @@ var ProofChain = class _ProofChain {
2065
2160
  this.quests = new QuestsClient(this.http);
2066
2161
  this.schemas = new SchemasClient(this.http);
2067
2162
  this.dataViews = new DataViewsClient(this.http);
2163
+ this.cohorts = new CohortLeaderboardClient(this.http);
2164
+ this.fanpassLeaderboard = new FanpassLeaderboardClient(this.http);
2068
2165
  }
2069
2166
  /**
2070
2167
  * Create a client from environment variables.
@@ -2252,10 +2349,12 @@ var IngestionClient = class {
2252
2349
  AuthorizationError,
2253
2350
  CertificatesResource,
2254
2351
  ChannelsResource,
2352
+ CohortLeaderboardClient,
2255
2353
  DataViewsClient,
2256
2354
  DocumentsResource,
2257
2355
  EndUsersClient,
2258
2356
  EventsResource,
2357
+ FanpassLeaderboardClient,
2259
2358
  IngestionClient,
2260
2359
  NetworkError,
2261
2360
  NotFoundError,
package/dist/index.mjs CHANGED
@@ -1718,6 +1718,99 @@ var DataViewsClient = class {
1718
1718
  }
1719
1719
  };
1720
1720
 
1721
+ // src/cohorts.ts
1722
+ var CohortLeaderboardClient = class {
1723
+ constructor(http) {
1724
+ this.http = http;
1725
+ }
1726
+ /**
1727
+ * List all cohort definitions
1728
+ */
1729
+ async list(options = {}) {
1730
+ const params = {};
1731
+ if (options.status) params.status = options.status;
1732
+ if (options.limit) params.limit = options.limit;
1733
+ if (options.offset) params.offset = options.offset;
1734
+ const response = await this.http.get(
1735
+ "/cohorts/definitions",
1736
+ params
1737
+ );
1738
+ return Array.isArray(response) ? response : response.cohorts || [];
1739
+ }
1740
+ /**
1741
+ * Get a cohort definition by ID
1742
+ */
1743
+ async get(cohortId) {
1744
+ return this.http.get(
1745
+ `/cohorts/definitions/${encodeURIComponent(cohortId)}`
1746
+ );
1747
+ }
1748
+ /**
1749
+ * Get filtered cohort leaderboard with both global and filtered percentiles
1750
+ */
1751
+ async getLeaderboard(cohortId, options = {}) {
1752
+ const params = {};
1753
+ if (options.filters) params.filters = JSON.stringify(options.filters);
1754
+ if (options.country) params.country = options.country;
1755
+ if (options.limit) params.limit = options.limit;
1756
+ if (options.top_n) params.top_n = options.top_n;
1757
+ if (options.fresh) params.fresh = "true";
1758
+ return this.http.get(
1759
+ `/cohorts/definitions/${encodeURIComponent(cohortId)}/leaderboard`,
1760
+ params
1761
+ );
1762
+ }
1763
+ /**
1764
+ * Get user's breakdown across all cohorts for spider charts
1765
+ */
1766
+ async getUserBreakdown(userId, options = {}) {
1767
+ const params = {};
1768
+ if (options.filters) params.filters = JSON.stringify(options.filters);
1769
+ if (options.country) params.country = options.country;
1770
+ return this.http.get(
1771
+ `/cohorts/users/${encodeURIComponent(userId)}/breakdown`,
1772
+ params
1773
+ );
1774
+ }
1775
+ };
1776
+
1777
+ // src/fanpass_leaderboard.ts
1778
+ var FanpassLeaderboardClient = class {
1779
+ constructor(http) {
1780
+ this.http = http;
1781
+ }
1782
+ /**
1783
+ * Get fanpass leaderboard with composite scores
1784
+ */
1785
+ async getLeaderboard(options = {}) {
1786
+ const params = {};
1787
+ if (options.aggregationRuleId) {
1788
+ params.aggregation_rule_id = options.aggregationRuleId;
1789
+ }
1790
+ if (options.filters) params.filters = JSON.stringify(options.filters);
1791
+ if (options.country) params.country = options.country;
1792
+ if (options.limit) params.limit = options.limit;
1793
+ if (options.top_n) params.top_n = options.top_n;
1794
+ if (options.fresh) params.fresh = "true";
1795
+ return this.http.get(
1796
+ "/passport-v2/fanpass/leaderboard",
1797
+ params
1798
+ );
1799
+ }
1800
+ /**
1801
+ * Get user's comparison across all cohorts (spider chart data)
1802
+ */
1803
+ async getUserComparison(userId, options = {}) {
1804
+ const params = {};
1805
+ if (options.filters) params.filters = JSON.stringify(options.filters);
1806
+ if (options.country) params.country = options.country;
1807
+ return this.http.get(
1808
+ `/passport-v2/fanpass/${encodeURIComponent(userId)}/comparison`,
1809
+ params
1810
+ );
1811
+ }
1812
+ };
1813
+
1721
1814
  // src/client.ts
1722
1815
  var DocumentsResource = class {
1723
1816
  constructor(http) {
@@ -2013,6 +2106,8 @@ var ProofChain = class _ProofChain {
2013
2106
  this.quests = new QuestsClient(this.http);
2014
2107
  this.schemas = new SchemasClient(this.http);
2015
2108
  this.dataViews = new DataViewsClient(this.http);
2109
+ this.cohorts = new CohortLeaderboardClient(this.http);
2110
+ this.fanpassLeaderboard = new FanpassLeaderboardClient(this.http);
2016
2111
  }
2017
2112
  /**
2018
2113
  * Create a client from environment variables.
@@ -2199,10 +2294,12 @@ export {
2199
2294
  AuthorizationError,
2200
2295
  CertificatesResource,
2201
2296
  ChannelsResource,
2297
+ CohortLeaderboardClient,
2202
2298
  DataViewsClient,
2203
2299
  DocumentsResource,
2204
2300
  EndUsersClient,
2205
2301
  EventsResource,
2302
+ FanpassLeaderboardClient,
2206
2303
  IngestionClient,
2207
2304
  NetworkError,
2208
2305
  NotFoundError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proofchain/sdk",
3
- "version": "2.4.0",
3
+ "version": "2.5.1",
4
4
  "description": "Official JavaScript/TypeScript SDK for ProofChain - blockchain-anchored document attestation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",