@edgenets/utils 0.0.18 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,50 +1,94 @@
1
- interface FirebaseInfo {
2
- identities: {
3
- email: string[];
4
- };
5
- sign_in_provider: string;
1
+ export type UserRole = "admin" | "member" | "guest";
2
+ export type UserStatus = "active" | "inactive" | "banned";
3
+ export type WalletType = "ton" | "evm" | "btc";
4
+ export type BadgeType = "season" | "special";
5
+ export type InviterType = "user" | "channel";
6
+ export type PointTransactionType = "earn" | "spend" | "expire";
7
+ export type PointTransactionReason = "purchase" | "bonus" | "refund" | "manual" | "other";
8
+ export interface PointTransaction {
9
+ userId: string;
10
+ type: PointTransactionType;
11
+ reason: string;
12
+ amount: number;
13
+ timestamp: number;
14
+ metadata?: Record<string, unknown>;
6
15
  }
7
- export interface User {
8
- id: string;
9
- name: string;
10
- email: string;
11
- emailVerified: boolean;
12
- iss: string;
13
- aud: string;
14
- sub: string;
15
- iat: number;
16
- exp: number;
17
- authTime: number;
18
- firebase: FirebaseInfo;
19
- telegram_uid: number;
20
- username?: string;
21
- firstName?: string;
22
- lastName?: string;
23
- languageCode?: string;
24
- isPremium?: boolean;
16
+ export interface GameEntry {
17
+ gameId: string;
18
+ name?: string;
19
+ enteredAt: number;
20
+ metadata?: Record<string, unknown>;
25
21
  }
26
- export interface UserProfile {
22
+ export interface Inviter {
23
+ type: InviterType;
27
24
  id: string;
28
- telegram_uid?: number;
29
- username?: string;
30
- firstName?: string;
31
- lastName?: string;
32
- languageCode?: string;
33
- isPremium?: boolean;
34
- email?: string;
35
- emailVerified?: boolean;
36
- createdAt?: Date;
37
- updatedAt?: Date;
25
+ name?: string;
38
26
  metadata?: Record<string, unknown>;
39
27
  }
40
- export declare enum UserRole {
41
- Admin = "admin",
42
- User = "user",
43
- Guest = "guest"
28
+ export interface UserAddress {
29
+ addressLine1: string;
30
+ addressLine2?: string;
31
+ city: string;
32
+ state?: string;
33
+ postalCode: string;
34
+ country: string;
35
+ }
36
+ export interface Wallet {
37
+ type: WalletType;
38
+ address: string;
39
+ metadata?: Record<string, unknown>;
44
40
  }
45
- export interface UserCredentials {
46
- username: string;
47
- password: string;
41
+ export interface Badge {
42
+ id: string;
43
+ name: string;
44
+ type: BadgeType;
45
+ awardedAt: number;
46
+ level?: number;
47
+ metadata?: Record<string, unknown>;
48
+ }
49
+ export interface User {
50
+ id: string;
51
+ name: string;
52
+ email: string;
53
+ phone?: string;
54
+ avatarUrl?: string;
55
+ role: UserRole;
56
+ status: UserStatus;
57
+ points?: number;
58
+ rankLevel?: string;
59
+ rankPosition?: number;
60
+ badges?: Badge[];
61
+ inviter?: Inviter;
62
+ inviteCode?: string;
63
+ inviteCount?: number;
64
+ addresses?: UserAddress[];
65
+ wallets?: Wallet[];
66
+ isVip?: boolean;
67
+ /**
68
+ * metadata 信息可能包含如下信息
69
+ *
70
+ * iss: string; // issuer - 发放令牌的机构
71
+ * aud: string; // audience - 接收令牌的一方
72
+ * sub: string; // subject - 通常是与 `userId` 一致
73
+ * iat: number; // issued at - 令牌签发时间
74
+ * exp: number; // expiration - 令牌过期时间
75
+ * authTime: number; // 认证时间
76
+ * firebase: FirebaseInfo;
77
+ * telegram {
78
+ * id: number;
79
+ * username?: string;
80
+ * firstName?: string;
81
+ * lastName?: string;
82
+ * languageCode?: string;
83
+ * isPremium?: boolean;
84
+ * };
85
+ * discord: {};
86
+ */
87
+ metadata?: Record<string, unknown>;
88
+ preferences?: Record<string, unknown>;
89
+ gamesPlayed?: GameEntry[];
90
+ createdAt?: number;
91
+ updatedAt?: number;
92
+ lastLoginAt?: number;
48
93
  }
49
- export {};
50
94
  //# sourceMappingURL=user.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/types/user.ts"],"names":[],"mappings":"AAAA,UAAU,YAAY;IACpB,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;IACF,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAGD,MAAM,W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IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEtC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC;IAE1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -1,7 +1,2 @@
1
- export var UserRole;
2
- (function (UserRole) {
3
- UserRole["Admin"] = "admin";
4
- UserRole["User"] = "user";
5
- UserRole["Guest"] = "guest";
6
- })(UserRole || (UserRole = {}));
1
+ export {};
7
2
  //# sourceMappingURL=user.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/types/user.ts"],"names":[],"mappings":"AAgDA,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,2BAAe,CAAA;AACjB,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB"}
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/types/user.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgenets/utils",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "Edgenets utilities package containing common types and utilities.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",