@edgenets/utils 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,50 +1,92 @@
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 InviterType = "user" | "channel";
5
+ export type PointTransactionType = "earn" | "spend" | "expire";
6
+ export type PointTransactionReason = "purchase" | "bonus" | "refund" | "manual" | "other";
7
+ export interface PointTransaction {
8
+ userId: string;
9
+ type: PointTransactionType;
10
+ reason: string;
11
+ amount: number;
12
+ timestamp: number;
13
+ metadata?: Record<string, unknown>;
6
14
  }
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;
15
+ export interface GameEntry {
16
+ gameId: string;
17
+ name?: string;
18
+ enteredAt: number;
19
+ metadata?: Record<string, unknown>;
25
20
  }
26
- export interface UserProfile {
21
+ export interface Inviter {
22
+ type: InviterType;
27
23
  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;
24
+ name?: string;
38
25
  metadata?: Record<string, unknown>;
39
26
  }
40
- export declare enum UserRole {
41
- Admin = "admin",
42
- User = "user",
43
- Guest = "guest"
27
+ export interface UserAddress {
28
+ addressLine1: string;
29
+ addressLine2?: string;
30
+ city: string;
31
+ state?: string;
32
+ postalCode: string;
33
+ country: string;
34
+ }
35
+ export interface Wallet {
36
+ type: WalletType;
37
+ address: string;
38
+ metadata?: Record<string, unknown>;
44
39
  }
45
- export interface UserCredentials {
46
- username: string;
47
- password: string;
40
+ export interface Badge {
41
+ id: string;
42
+ name: string;
43
+ awardedAt: number;
44
+ level?: number;
45
+ metadata?: Record<string, unknown>;
46
+ }
47
+ export interface User {
48
+ id: string;
49
+ name: string;
50
+ email: string;
51
+ phone?: string;
52
+ avatarUrl?: string;
53
+ role: UserRole;
54
+ status: UserStatus;
55
+ points?: number;
56
+ rankLevel?: string;
57
+ rankPosition?: number;
58
+ badges?: Badge[];
59
+ inviter?: Inviter;
60
+ inviteCode?: string;
61
+ inviteCount?: number;
62
+ addresses?: UserAddress[];
63
+ wallets?: Wallet[];
64
+ isVip?: boolean;
65
+ /**
66
+ * metadata 信息可能包含如下信息
67
+ *
68
+ * iss: string; // issuer - 发放令牌的机构
69
+ * aud: string; // audience - 接收令牌的一方
70
+ * sub: string; // subject - 通常是与 `userId` 一致
71
+ * iat: number; // issued at - 令牌签发时间
72
+ * exp: number; // expiration - 令牌过期时间
73
+ * authTime: number; // 认证时间
74
+ * firebase: FirebaseInfo;
75
+ * telegram {
76
+ * id: number;
77
+ * username?: string;
78
+ * firstName?: string;
79
+ * lastName?: string;
80
+ * languageCode?: string;
81
+ * isPremium?: boolean;
82
+ * };
83
+ * discord: {};
84
+ */
85
+ metadata?: Record<string, unknown>;
86
+ preferences?: Record<string, unknown>;
87
+ gamesPlayed?: GameEntry[];
88
+ createdAt?: number;
89
+ updatedAt?: number;
90
+ lastLoginAt?: number;
48
91
  }
49
- export {};
50
92
  //# 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,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC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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.19",
4
4
  "description": "Edgenets utilities package containing common types and utilities.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",