meet-my-ride 1.0.0 → 1.0.3
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 +12 -0
- package/dist/client.js +30 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -0
- package/dist/users/index.d.ts +1 -0
- package/dist/users/index.js +17 -0
- package/dist/users/user.service.d.ts +14 -0
- package/dist/users/user.service.js +46 -0
- package/package.json +18 -3
- package/.idea/copilot.data.migration.agent.xml +0 -6
- package/.idea/copilot.data.migration.ask.xml +0 -6
- package/.idea/copilot.data.migration.ask2agent.xml +0 -6
- package/.idea/copilot.data.migration.edit.xml +0 -6
- package/.idea/jsLibraryMappings.xml +0 -6
- package/.idea/meet-my-ride.iml +0 -12
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/index.js +0 -3
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UserService } from "./users";
|
|
2
|
+
export declare class MeetMyRideClient {
|
|
3
|
+
private baseUrl;
|
|
4
|
+
private apiKey?;
|
|
5
|
+
private http;
|
|
6
|
+
user: UserService;
|
|
7
|
+
constructor(baseUrl: string, apiKey?: string | undefined);
|
|
8
|
+
/**
|
|
9
|
+
* Allow services (like login/refresh) to update the Authorization header.
|
|
10
|
+
*/
|
|
11
|
+
private setToken;
|
|
12
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MeetMyRideClient = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const users_1 = require("./users");
|
|
9
|
+
class MeetMyRideClient {
|
|
10
|
+
constructor(baseUrl, apiKey) {
|
|
11
|
+
this.baseUrl = baseUrl;
|
|
12
|
+
this.apiKey = apiKey;
|
|
13
|
+
this.http = axios_1.default.create({
|
|
14
|
+
baseURL: baseUrl,
|
|
15
|
+
headers: {
|
|
16
|
+
"Content-Type": "application/json",
|
|
17
|
+
...(apiKey ? { "Authorization": `Bearer ${apiKey}` } : {})
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
// Initialize modules/services
|
|
21
|
+
this.user = new users_1.UserService(this.http, this.setToken.bind(this));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Allow services (like login/refresh) to update the Authorization header.
|
|
25
|
+
*/
|
|
26
|
+
setToken(token) {
|
|
27
|
+
this.http.defaults.headers["Authorization"] = `Bearer ${token}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.MeetMyRideClient = MeetMyRideClient;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./client"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./user.service";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./user.service"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
export declare class UserService {
|
|
3
|
+
private http;
|
|
4
|
+
private updateToken;
|
|
5
|
+
constructor(http: AxiosInstance, updateToken: (token: string) => void);
|
|
6
|
+
getAll(): Promise<any>;
|
|
7
|
+
getById(userId: string): Promise<any>;
|
|
8
|
+
update(userId: string, data: any): Promise<any>;
|
|
9
|
+
delete(userId: string): Promise<any>;
|
|
10
|
+
register(data: any): Promise<any>;
|
|
11
|
+
login(data: any): Promise<any>;
|
|
12
|
+
refresh(refreshToken: string): Promise<any>;
|
|
13
|
+
verifyEmail(code: string): Promise<any>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserService = void 0;
|
|
4
|
+
class UserService {
|
|
5
|
+
constructor(http, updateToken) {
|
|
6
|
+
this.http = http;
|
|
7
|
+
this.updateToken = updateToken;
|
|
8
|
+
}
|
|
9
|
+
getAll() {
|
|
10
|
+
return this.http.get("/api/Users").then(r => r.data);
|
|
11
|
+
}
|
|
12
|
+
getById(userId) {
|
|
13
|
+
return this.http.get(`/api/Users/${userId}`).then(r => r.data);
|
|
14
|
+
}
|
|
15
|
+
update(userId, data) {
|
|
16
|
+
return this.http.put(`/api/Users/${userId}`, data).then(r => r.data);
|
|
17
|
+
}
|
|
18
|
+
delete(userId) {
|
|
19
|
+
return this.http.delete(`/api/Users/${userId}`).then(r => r.data);
|
|
20
|
+
}
|
|
21
|
+
register(data) {
|
|
22
|
+
return this.http.post("/api/Users/register", data).then(r => r.data);
|
|
23
|
+
}
|
|
24
|
+
login(data) {
|
|
25
|
+
return this.http.post("/api/Users/login", data).then(response => {
|
|
26
|
+
var _a;
|
|
27
|
+
if ((_a = response.data) === null || _a === void 0 ? void 0 : _a.token) {
|
|
28
|
+
this.updateToken(response.data.token);
|
|
29
|
+
}
|
|
30
|
+
return response.data;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
refresh(refreshToken) {
|
|
34
|
+
return this.http.post("/api/Users/refresh", { refreshToken }).then(r => {
|
|
35
|
+
var _a;
|
|
36
|
+
if ((_a = r.data) === null || _a === void 0 ? void 0 : _a.token) {
|
|
37
|
+
this.updateToken(r.data.token);
|
|
38
|
+
}
|
|
39
|
+
return r.data;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
verifyEmail(code) {
|
|
43
|
+
return this.http.post("/api/Users/verify-email", { code }).then(r => r.data);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.UserService = UserService;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meet-my-ride",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Private library for the MeetMyRide applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,9 +8,24 @@
|
|
|
8
8
|
},
|
|
9
9
|
"license": "ISC",
|
|
10
10
|
"author": "MightyMitta",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
13
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",
|
|
14
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"
|
|
15
30
|
}
|
|
16
31
|
}
|
package/.idea/meet-my-ride.iml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
9
|
-
<orderEntry type="inheritedJdk" />
|
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
-
</component>
|
|
12
|
-
</module>
|
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/meet-my-ride.iml" filepath="$PROJECT_DIR$/.idea/meet-my-ride.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
package/.idea/vcs.xml
DELETED
package/index.js
DELETED