@mpgd/adapter-verse8 0.1.0 → 0.2.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.
@@ -0,0 +1 @@
1
+ export declare const verse8AdsRewardEvidenceSchema = "verse8.ads.reward.v1";
@@ -0,0 +1 @@
1
+ export const verse8AdsRewardEvidenceSchema = 'verse8.ads.reward.v1';
@@ -0,0 +1,83 @@
1
+ import { type GetVerifiedLeaderboardSnapshotRequest, type RecordVerifiedLeaderboardAttemptRequest, type RecordVerifiedLeaderboardAttemptResponse, type VerifiedLeaderboardService, type VerifiedLeaderboardSnapshot } from '@mpgd/game-services/verified-leaderboard';
2
+ import type { StorageLoadResult } from '@mpgd/platform';
3
+ export interface Verse8Agent8StateContext {
4
+ getUserState(account: string): Promise<Readonly<Record<string, unknown>>>;
5
+ updateUserState(account: string, state: Readonly<Record<string, unknown>>): Promise<Readonly<Record<string, unknown>>>;
6
+ lock<T>(key: string, callback: () => T | Promise<T>): Promise<T>;
7
+ }
8
+ export interface Verse8Agent8CollectionOptions {
9
+ limit?: number;
10
+ }
11
+ export interface Verse8Agent8CollectionItem extends Readonly<Record<string, unknown>> {
12
+ readonly __id: string;
13
+ }
14
+ export interface Verse8Agent8ServiceContext extends Verse8Agent8StateContext {
15
+ getCollectionItems(collectionId: string, options?: Verse8Agent8CollectionOptions): Promise<readonly Verse8Agent8CollectionItem[]>;
16
+ addCollectionItem(collectionId: string, item: Readonly<Record<string, unknown>>): Promise<Verse8Agent8CollectionItem>;
17
+ updateCollectionItem(collectionId: string, item: Readonly<Record<string, unknown>> & {
18
+ readonly __id: string;
19
+ }): Promise<Verse8Agent8CollectionItem>;
20
+ }
21
+ export interface Verse8Agent8StorageOptions {
22
+ readonly persistenceSecret: string;
23
+ readonly codec: Verse8Agent8PrivateStorageCodec;
24
+ readonly stateNamespace?: string;
25
+ readonly maximumEntries?: number;
26
+ readonly maximumValueBytes?: number;
27
+ readonly maximumStateBytes?: number;
28
+ }
29
+ export interface Verse8Agent8PrivateStorageEnvelope {
30
+ readonly keyId: string;
31
+ readonly ciphertext: string;
32
+ }
33
+ export interface Verse8Agent8PrivateStorageCodec {
34
+ readonly security: 'authenticated-encryption';
35
+ seal(input: {
36
+ readonly account: string;
37
+ readonly key: string;
38
+ readonly value: unknown;
39
+ }): Promise<Verse8Agent8PrivateStorageEnvelope>;
40
+ open(input: {
41
+ readonly account: string;
42
+ readonly key: string;
43
+ readonly envelope: Verse8Agent8PrivateStorageEnvelope;
44
+ }): Promise<unknown>;
45
+ }
46
+ export interface Verse8Agent8StorageService {
47
+ load(account: string, input: {
48
+ readonly key: string;
49
+ }, context: Pick<Verse8Agent8StateContext, 'getUserState'>): Promise<StorageLoadResult | null>;
50
+ save(account: string, input: {
51
+ readonly key: string;
52
+ readonly value: unknown;
53
+ }, context: Verse8Agent8StateContext): Promise<void>;
54
+ }
55
+ export declare function createVerse8Agent8StorageService(options: Verse8Agent8StorageOptions): Verse8Agent8StorageService;
56
+ export interface Verse8Agent8VerifiedLeaderboardOptions {
57
+ readonly persistenceSecret: string;
58
+ readonly collectionNamespace?: string;
59
+ readonly maximumParticipants?: number;
60
+ readonly now?: () => string;
61
+ }
62
+ export type Verse8Agent8LeaderboardPageRequest = Omit<GetVerifiedLeaderboardSnapshotRequest, 'participantId'>;
63
+ export interface Verse8Agent8LeaderboardVerificationInput<TSubmission> {
64
+ readonly account: string;
65
+ readonly submission: TSubmission;
66
+ }
67
+ export type Verse8Agent8LeaderboardBoundaryOptions<TSubmission> = Verse8Agent8VerifiedLeaderboardOptions & {
68
+ readonly context: Verse8Agent8ServiceContext;
69
+ readonly verifySubmission: (input: Verse8Agent8LeaderboardVerificationInput<TSubmission>) => Promise<RecordVerifiedLeaderboardAttemptRequest | null>;
70
+ };
71
+ export type Verse8Agent8LeaderboardSubmissionResult = {
72
+ readonly accepted: true;
73
+ readonly record: RecordVerifiedLeaderboardAttemptResponse;
74
+ } | {
75
+ readonly accepted: false;
76
+ readonly reason: 'VERIFICATION_REJECTED';
77
+ };
78
+ export interface Verse8Agent8LeaderboardBoundary<TSubmission> {
79
+ submit(account: string, submission: TSubmission): Promise<Verse8Agent8LeaderboardSubmissionResult>;
80
+ getSnapshot(account: string, input: Verse8Agent8LeaderboardPageRequest): Promise<VerifiedLeaderboardSnapshot | undefined>;
81
+ }
82
+ export declare function createVerse8Agent8LeaderboardBoundary<TSubmission>(options: Verse8Agent8LeaderboardBoundaryOptions<TSubmission>): Verse8Agent8LeaderboardBoundary<TSubmission>;
83
+ export declare function createVerse8Agent8VerifiedLeaderboardProvider(context: Verse8Agent8ServiceContext, options: Verse8Agent8VerifiedLeaderboardOptions): VerifiedLeaderboardService;