@ooneex/user 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ooneex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @ooneex/user
@@ -0,0 +1,122 @@
1
+ import { IImage } from "@ooneex/image";
2
+ import { ERole } from "@ooneex/role";
3
+ import { IBase } from "@ooneex/types";
4
+ declare enum EAccountType {
5
+ OAUTH = "oauth",
6
+ EMAIL = "email",
7
+ CREDENTIALS = "credentials",
8
+ WEBAUTHN = "webauthn"
9
+ }
10
+ declare enum EVerificationType {
11
+ EMAIL = "email",
12
+ PHONE = "phone",
13
+ PASSWORD_RESET = "password_reset",
14
+ TWO_FACTOR = "two_factor",
15
+ ACCOUNT_ACTIVATION = "account_activation"
16
+ }
17
+ declare enum EProfileUpdateStatus {
18
+ PENDING = "pending",
19
+ COMPLETED = "completed",
20
+ FAILED = "failed",
21
+ REVERTED = "reverted"
22
+ }
23
+ type AccountType = `${EAccountType}`;
24
+ type VerificationType = `${EVerificationType}`;
25
+ type ProfileUpdateStatusType = `${EProfileUpdateStatus}`;
26
+ interface IUser extends IBase {
27
+ email: string;
28
+ roles: ERole[];
29
+ name?: string;
30
+ lastName?: string;
31
+ firstName?: string;
32
+ username?: string;
33
+ avatar?: IImage;
34
+ bio?: string;
35
+ phone?: string;
36
+ birthDate?: Date;
37
+ timezone?: string;
38
+ isEmailVerified?: boolean;
39
+ isPhoneVerified?: boolean;
40
+ lastActiveAt?: Date;
41
+ emailVerifiedAt?: Date;
42
+ phoneVerifiedAt?: Date;
43
+ lastLoginAt?: Date;
44
+ passwordChangedAt?: Date;
45
+ twoFactorEnabled?: boolean;
46
+ twoFactorSecret?: string;
47
+ recoveryTokens?: string[];
48
+ sessions?: ISession[];
49
+ accounts?: IAccount[];
50
+ verifications?: IVerification[];
51
+ }
52
+ interface ISession extends IBase {
53
+ token: string;
54
+ refreshToken?: string;
55
+ userAgent?: string;
56
+ ipAddress?: string;
57
+ deviceType?: string;
58
+ deviceName?: string;
59
+ browser?: string;
60
+ operatingSystem?: string;
61
+ location?: string;
62
+ isActive: boolean;
63
+ expiresAt: Date;
64
+ lastAccessAt?: Date;
65
+ revokedAt?: Date;
66
+ revokedReason?: string;
67
+ user?: IUser;
68
+ }
69
+ interface IAccount extends IBase {
70
+ provider?: string;
71
+ providerAccountId?: string;
72
+ type: EAccountType;
73
+ password?: string;
74
+ accessToken?: string;
75
+ accessTokenExpiresAt?: Date;
76
+ refreshToken?: string;
77
+ refreshTokenExpiresAt?: Date;
78
+ expiresAt?: Date;
79
+ tokenType?: string;
80
+ scope?: string;
81
+ idToken?: string;
82
+ sessionState?: string;
83
+ email?: string;
84
+ emailVerified?: boolean;
85
+ name?: string;
86
+ picture?: string;
87
+ profile?: Record<string, unknown>;
88
+ user?: IUser;
89
+ }
90
+ interface IVerification extends IBase {
91
+ email?: string;
92
+ phone?: string;
93
+ token: string;
94
+ type: EVerificationType;
95
+ code?: string;
96
+ isUsed: boolean;
97
+ usedAt?: Date;
98
+ expiresAt: Date;
99
+ attemptsCount: number;
100
+ maxAttempts: number;
101
+ ipAddress?: string;
102
+ userAgent?: string;
103
+ metadata?: Record<string, unknown>;
104
+ description?: string;
105
+ user?: IUser;
106
+ }
107
+ interface IUserProfileUpdate extends IBase {
108
+ changedFields: string[];
109
+ previousValues?: Record<string, unknown>;
110
+ newValues?: Record<string, unknown>;
111
+ updateReason?: string;
112
+ ipAddress?: string;
113
+ userAgent?: string;
114
+ requiresVerification?: boolean;
115
+ status: EProfileUpdateStatus;
116
+ appliedAt?: Date;
117
+ metadata?: Record<string, unknown>;
118
+ description?: string;
119
+ user?: IUser;
120
+ verification?: IVerification;
121
+ }
122
+ export { VerificationType, ProfileUpdateStatusType, IVerification, IUserProfileUpdate, IUser, ISession, IAccount, EVerificationType, EProfileUpdateStatus, EAccountType, AccountType };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ var b;((m)=>{m.OAUTH="oauth";m.EMAIL="email";m.CREDENTIALS="credentials";m.WEBAUTHN="webauthn"})(b||={});var g;((x)=>{x.EMAIL="email";x.PHONE="phone";x.PASSWORD_RESET="password_reset";x.TWO_FACTOR="two_factor";x.ACCOUNT_ACTIVATION="account_activation"})(g||={});var h;((m)=>{m.PENDING="pending";m.COMPLETED="completed";m.FAILED="failed";m.REVERTED="reverted"})(h||={});export{g as EVerificationType,h as EProfileUpdateStatus,b as EAccountType};
2
+
3
+ //# debugId=F14F79B7E6C44C2164756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["src/types.ts"],
4
+ "sourcesContent": [
5
+ "import type { IImage } from \"@ooneex/image\";\nimport type { ERole } from \"@ooneex/role\";\nimport type { IBase } from \"@ooneex/types\";\n\nexport enum EAccountType {\n OAUTH = \"oauth\",\n EMAIL = \"email\",\n CREDENTIALS = \"credentials\",\n WEBAUTHN = \"webauthn\",\n}\n\nexport enum EVerificationType {\n EMAIL = \"email\",\n PHONE = \"phone\",\n PASSWORD_RESET = \"password_reset\",\n TWO_FACTOR = \"two_factor\",\n ACCOUNT_ACTIVATION = \"account_activation\",\n}\n\nexport enum EProfileUpdateStatus {\n PENDING = \"pending\",\n COMPLETED = \"completed\",\n FAILED = \"failed\",\n REVERTED = \"reverted\",\n}\n\nexport type AccountType = `${EAccountType}`;\nexport type VerificationType = `${EVerificationType}`;\nexport type ProfileUpdateStatusType = `${EProfileUpdateStatus}`;\n\nexport interface IUser extends IBase {\n email: string;\n roles: ERole[];\n name?: string;\n lastName?: string;\n firstName?: string;\n username?: string;\n avatar?: IImage;\n bio?: string;\n phone?: string;\n birthDate?: Date;\n timezone?: string;\n isEmailVerified?: boolean;\n isPhoneVerified?: boolean;\n lastActiveAt?: Date;\n emailVerifiedAt?: Date;\n phoneVerifiedAt?: Date;\n lastLoginAt?: Date;\n passwordChangedAt?: Date;\n twoFactorEnabled?: boolean;\n twoFactorSecret?: string;\n recoveryTokens?: string[];\n sessions?: ISession[];\n accounts?: IAccount[];\n verifications?: IVerification[];\n}\n\nexport interface ISession extends IBase {\n // Unique authentication token for the session\n token: string;\n // Token used to refresh the main session token when it expires\n refreshToken?: string;\n // Browser user agent string for device/browser identification\n userAgent?: string;\n // IP address from which the session was created\n ipAddress?: string;\n // Type of device (e.g., \"mobile\", \"desktop\", \"tablet\")\n deviceType?: string;\n // User-friendly device name (e.g., \"John's iPhone\", \"MacBook Pro\")\n deviceName?: string;\n // Browser name and version (e.g., \"Chrome 120.0\", \"Safari 17.1\")\n browser?: string;\n // Operating system information (e.g., \"macOS 14.2\", \"Windows 11\")\n operatingSystem?: string;\n // Geographic location where session was created (e.g., \"New York, US\")\n location?: string;\n // Whether the session is currently active and valid\n isActive: boolean;\n // When the session expires and becomes invalid\n expiresAt: Date;\n // Last time this session was used for authentication\n lastAccessAt?: Date;\n // When the session was manually revoked/terminated\n revokedAt?: Date;\n // Reason for session revocation (e.g., \"user_logout\", \"admin_revoked\", \"security_breach\")\n revokedReason?: string;\n user?: IUser;\n}\n\nexport interface IAccount extends IBase {\n // OAuth provider name (e.g., \"google\", \"github\", \"facebook\", \"microsoft\")\n provider?: string;\n // Unique account ID from the external provider\n providerAccountId?: string;\n // Authentication method used for this account\n type: EAccountType;\n // Hashed password for credentials-based accounts\n password?: string;\n // Token for accessing provider APIs on behalf of the user\n accessToken?: string;\n // When the access token expires and needs refresh\n accessTokenExpiresAt?: Date;\n // Token used to obtain new access tokens\n refreshToken?: string;\n // When the refresh token expires\n refreshTokenExpiresAt?: Date;\n // General expiration date for the account connection\n expiresAt?: Date;\n // e.g., \"Bearer\", \"Basic\", \"JWT\" - defines how the access token should be used\n tokenType?: string;\n // OAuth scopes granted (e.g., \"read:user,user:email\")\n scope?: string;\n // OpenID Connect ID token containing user identity claims\n idToken?: string;\n // OAuth session state parameter for security\n sessionState?: string;\n // Email address associated with this provider account\n email?: string;\n // Whether the email is verified by the provider\n emailVerified?: boolean;\n // Display name from the provider profile\n name?: string;\n // Profile picture/avatar from the provider\n picture?: string;\n // Additional profile data from the provider\n profile?: Record<string, unknown>;\n user?: IUser;\n}\n\nexport interface IVerification extends IBase {\n // Email address to be verified (for email verification types)\n email?: string;\n // Phone number to be verified (for phone verification types)\n phone?: string;\n // Secure token used for verification (typically UUID or similar)\n token: string;\n // Type of verification being performed\n type: EVerificationType;\n // Short numeric code sent to user (alternative to token for SMS/email)\n code?: string;\n // Whether this verification has been successfully completed\n isUsed: boolean;\n // When the verification was successfully completed\n usedAt?: Date;\n // When this verification expires and becomes invalid\n expiresAt: Date;\n // Number of verification attempts made so far\n attemptsCount: number;\n // Maximum allowed verification attempts before blocking\n maxAttempts: number;\n // IP address from which verification was requested\n ipAddress?: string;\n // Browser user agent string for security tracking\n userAgent?: string;\n // Additional data specific to the verification type\n metadata?: Record<string, unknown>;\n description?: string;\n user?: IUser;\n}\n\nexport interface IUserProfileUpdate extends IBase {\n // What fields were changed in this update\n changedFields: string[];\n // Previous values before the update (for audit trail)\n previousValues?: Record<string, unknown>;\n // New values after the update\n newValues?: Record<string, unknown>;\n // Reason for the update (e.g., \"profile_completion\", \"user_edit\", \"admin_correction\")\n updateReason?: string;\n // IP address from which the update was made\n ipAddress?: string;\n // Browser user agent string for security tracking\n userAgent?: string;\n // Whether this update requires verification (e.g., email/phone changes)\n requiresVerification?: boolean;\n // Status of the update (e.g., \"pending\", \"completed\", \"failed\", \"reverted\")\n status: EProfileUpdateStatus;\n // When the update was applied/completed\n appliedAt?: Date;\n // Additional metadata specific to the update\n metadata?: Record<string, unknown>;\n description?: string;\n user?: IUser;\n // Reference to verification if update requires it\n verification?: IVerification;\n}\n"
6
+ ],
7
+ "mappings": "AAIO,IAAK,GAAL,CAAK,IAAL,CACL,QAAQ,QACR,QAAQ,QACR,cAAc,cACd,WAAW,aAJD,QAOL,IAAK,GAAL,CAAK,IAAL,CACL,QAAQ,QACR,QAAQ,QACR,iBAAiB,iBACjB,aAAa,aACb,qBAAqB,uBALX,QAQL,IAAK,GAAL,CAAK,IAAL,CACL,UAAU,UACV,YAAY,YACZ,SAAS,SACT,WAAW,aAJD",
8
+ "debugId": "F14F79B7E6C44C2164756E2164756E21",
9
+ "names": []
10
+ }
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@ooneex/user",
3
+ "description": "",
4
+ "version": "0.0.1",
5
+ "type": "module",
6
+ "files": [
7
+ "dist",
8
+ "LICENSE",
9
+ "README.md",
10
+ "package.json"
11
+ ],
12
+ "module": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "import": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ }
20
+ },
21
+ "./package.json": "./package.json"
22
+ },
23
+ "license": "MIT",
24
+ "scripts": {
25
+ "build": "bunup",
26
+ "lint": "tsgo --noEmit && bunx biome lint",
27
+ "publish:prod": "bun publish --tolerate-republish --access public",
28
+ "publish:pack": "bun pm pack --destination ./dist",
29
+ "publish:dry": "bun publish --dry-run"
30
+ },
31
+ "dependencies": {},
32
+ "devDependencies": {
33
+ "@ooneex/image": "0.0.1",
34
+ "@ooneex/role": "0.0.1",
35
+ "@ooneex/types": "0.0.1"
36
+ },
37
+ "peerDependencies": {}
38
+ }