meet-my-ride 1.0.4 → 1.0.7
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/dist/client.d.ts +1 -1
- package/dist/client.js +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -1
- package/dist/models/user.d.ts +47 -0
- package/dist/models/user.js +3 -0
- package/dist/users/user.service.d.ts +4 -4
- package/dist/users/user.service.js +11 -6
- package/dist/users/user.types.d.ts +19 -5
- package/dist/users/user.types.js +1 -0
- package/package.json +31 -31
package/dist/client.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MeetMyRideClient = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const
|
|
8
|
+
const user_service_1 = require("./users/user.service");
|
|
9
9
|
class MeetMyRideClient {
|
|
10
10
|
constructor(baseUrl, apiKey) {
|
|
11
11
|
this.baseUrl = baseUrl;
|
|
@@ -18,7 +18,7 @@ class MeetMyRideClient {
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
// Initialize modules/services
|
|
21
|
-
this.user = new
|
|
21
|
+
this.user = new user_service_1.UserService(this.http, this.setToken.bind(this));
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Allow services (like login/refresh) to update the Authorization header.
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { MeetMyRideClient } from "./client";
|
|
2
|
+
export * from "./models/user";
|
package/dist/index.js
CHANGED
|
@@ -14,4 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
17
|
+
exports.MeetMyRideClient = void 0;
|
|
18
|
+
var client_1 = require("./client");
|
|
19
|
+
Object.defineProperty(exports, "MeetMyRideClient", { enumerable: true, get: function () { return client_1.MeetMyRideClient; } });
|
|
20
|
+
__exportStar(require("./models/user"), exports);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface User {
|
|
2
|
+
id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
emailVerified?: string;
|
|
5
|
+
firstName: string;
|
|
6
|
+
lastName: string;
|
|
7
|
+
username: string;
|
|
8
|
+
}
|
|
9
|
+
export interface UserLogin {
|
|
10
|
+
email: string;
|
|
11
|
+
password: string;
|
|
12
|
+
}
|
|
13
|
+
export interface AuthResponse {
|
|
14
|
+
user: User;
|
|
15
|
+
accessToken?: string;
|
|
16
|
+
refreshToken?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface UserRegister {
|
|
19
|
+
email: string;
|
|
20
|
+
password: string;
|
|
21
|
+
firstName: string;
|
|
22
|
+
lastName: string;
|
|
23
|
+
username: string;
|
|
24
|
+
}
|
|
25
|
+
export interface UserRegisterResponse {
|
|
26
|
+
id: string;
|
|
27
|
+
username: string;
|
|
28
|
+
firstName: string;
|
|
29
|
+
lastName: string;
|
|
30
|
+
email: string;
|
|
31
|
+
}
|
|
32
|
+
export interface UserUpdate {
|
|
33
|
+
email?: string;
|
|
34
|
+
firstName?: string;
|
|
35
|
+
lastName?: string;
|
|
36
|
+
password?: string;
|
|
37
|
+
username?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface UserRefreshResponse {
|
|
40
|
+
accessToken: string;
|
|
41
|
+
refreshToken?: string;
|
|
42
|
+
expiresIn?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface VerifyEmailResponse {
|
|
45
|
+
message: string;
|
|
46
|
+
isVerified: boolean;
|
|
47
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
import { UserLogin,
|
|
2
|
+
import { UserLogin, UserRegister, User, UserUpdate, UserRefreshResponse, AuthResponse, UserRegisterResponse, VerifyEmailResponse } from "../models/user";
|
|
3
3
|
export declare class UserService {
|
|
4
4
|
private http;
|
|
5
5
|
private updateToken;
|
|
@@ -13,11 +13,11 @@ export declare class UserService {
|
|
|
13
13
|
/** DELETE /api/Users/{userId} */
|
|
14
14
|
delete(userId: string): Promise<void>;
|
|
15
15
|
/** POST /api/Users/register */
|
|
16
|
-
register(data: UserRegister): Promise<
|
|
16
|
+
register(data: UserRegister): Promise<UserRegisterResponse>;
|
|
17
17
|
/** POST /api/Users/login */
|
|
18
|
-
login(data: UserLogin): Promise<
|
|
18
|
+
login(data: UserLogin): Promise<AuthResponse>;
|
|
19
19
|
/** POST /api/Users/refresh */
|
|
20
20
|
refresh(refreshToken: string): Promise<UserRefreshResponse>;
|
|
21
21
|
/** POST /api/Users/verify-email */
|
|
22
|
-
verifyEmail(
|
|
22
|
+
verifyEmail(userId: string, token: string): Promise<VerifyEmailResponse>;
|
|
23
23
|
}
|
|
@@ -34,8 +34,9 @@ class UserService {
|
|
|
34
34
|
async login(data) {
|
|
35
35
|
const response = await this.http.post("/api/Users/login", data);
|
|
36
36
|
const resData = response.data;
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
// Only update token if it exists
|
|
38
|
+
if (resData.accessToken) {
|
|
39
|
+
this.updateToken(resData.accessToken);
|
|
39
40
|
}
|
|
40
41
|
return resData;
|
|
41
42
|
}
|
|
@@ -45,14 +46,18 @@ class UserService {
|
|
|
45
46
|
refreshToken
|
|
46
47
|
});
|
|
47
48
|
const resData = response.data;
|
|
48
|
-
if (resData.
|
|
49
|
-
this.updateToken(resData.
|
|
49
|
+
if (resData.accessToken) {
|
|
50
|
+
this.updateToken(resData.accessToken);
|
|
50
51
|
}
|
|
51
52
|
return resData;
|
|
52
53
|
}
|
|
53
54
|
/** POST /api/Users/verify-email */
|
|
54
|
-
async verifyEmail(
|
|
55
|
-
await this.http.post("/api/Users/
|
|
55
|
+
async verifyEmail(userId, token) {
|
|
56
|
+
const response = await this.http.post("/api/Users/verifyEmail", {
|
|
57
|
+
userId,
|
|
58
|
+
token
|
|
59
|
+
});
|
|
60
|
+
return response.data;
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
63
|
exports.UserService = UserService;
|
|
@@ -1,33 +1,47 @@
|
|
|
1
1
|
export interface User {
|
|
2
2
|
id: string;
|
|
3
3
|
email: string;
|
|
4
|
+
emailVerified?: string;
|
|
4
5
|
firstName: string;
|
|
5
6
|
lastName: string;
|
|
7
|
+
username: string;
|
|
6
8
|
}
|
|
7
9
|
export interface UserLogin {
|
|
8
10
|
email: string;
|
|
9
11
|
password: string;
|
|
10
12
|
}
|
|
11
|
-
export interface
|
|
12
|
-
|
|
13
|
+
export interface AuthResponse {
|
|
14
|
+
user: User;
|
|
15
|
+
accessToken?: string;
|
|
13
16
|
refreshToken?: string;
|
|
14
|
-
userId?: string;
|
|
15
|
-
expiresIn?: number;
|
|
16
17
|
}
|
|
17
18
|
export interface UserRegister {
|
|
18
19
|
email: string;
|
|
19
20
|
password: string;
|
|
20
21
|
firstName: string;
|
|
21
22
|
lastName: string;
|
|
23
|
+
username: string;
|
|
24
|
+
}
|
|
25
|
+
export interface UserRegisterResponse {
|
|
26
|
+
id: string;
|
|
27
|
+
username: string;
|
|
28
|
+
firstName: string;
|
|
29
|
+
lastName: string;
|
|
30
|
+
email: string;
|
|
22
31
|
}
|
|
23
32
|
export interface UserUpdate {
|
|
24
33
|
email?: string;
|
|
25
34
|
firstName?: string;
|
|
26
35
|
lastName?: string;
|
|
27
36
|
password?: string;
|
|
37
|
+
username?: string;
|
|
28
38
|
}
|
|
29
39
|
export interface UserRefreshResponse {
|
|
30
|
-
|
|
40
|
+
accessToken: string;
|
|
31
41
|
refreshToken?: string;
|
|
32
42
|
expiresIn?: number;
|
|
33
43
|
}
|
|
44
|
+
export interface VerifyEmailResponse {
|
|
45
|
+
message: string;
|
|
46
|
+
isVerified: boolean;
|
|
47
|
+
}
|
package/dist/users/user.types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "meet-my-ride",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Private library for the MeetMyRide applications",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "https://MightyMitta@dev.azure.com/MightyMitta/MeetMyRide/_git/NodeLibrary"
|
|
8
|
-
},
|
|
9
|
-
"license": "ISC",
|
|
10
|
-
"author": "MightyMitta",
|
|
11
|
-
"main": "dist/index.js",
|
|
12
|
-
"types": "dist/index.d.ts",
|
|
13
|
-
"files": [
|
|
14
|
-
"dist"
|
|
15
|
-
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "tsc",
|
|
18
|
-
"publish:patch": "npm version patch && npm run build && npm publish",
|
|
19
|
-
"publish:minor": "npm version minor && npm run build && npm publish",
|
|
20
|
-
"publish:major": "npm version major && npm run build && npm publish",
|
|
21
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
|
-
},
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"axios": "^1.13.2"
|
|
25
|
-
},
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@types/node": "^24.10.1",
|
|
28
|
-
"ts-node": "^10.9.2",
|
|
29
|
-
"typescript": "^5.9.3"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "meet-my-ride",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "Private library for the MeetMyRide applications",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://MightyMitta@dev.azure.com/MightyMitta/MeetMyRide/_git/NodeLibrary"
|
|
8
|
+
},
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"author": "MightyMitta",
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"publish:patch": "npm version patch && npm run build && npm publish",
|
|
19
|
+
"publish:minor": "npm version minor && npm run build && npm publish",
|
|
20
|
+
"publish:major": "npm version major && npm run build && npm publish",
|
|
21
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"axios": "^1.13.2"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^24.10.1",
|
|
28
|
+
"ts-node": "^10.9.2",
|
|
29
|
+
"typescript": "^5.9.3"
|
|
30
|
+
}
|
|
31
|
+
}
|