@machhub-dev/sdk-ts 1.0.8 → 1.0.9
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/cjs/classes/auth.d.ts +3 -3
- package/dist/cjs/classes/auth.js +4 -4
- package/dist/cjs/sdk-ts.js +1 -1
- package/dist/classes/auth.d.ts +3 -3
- package/dist/classes/auth.js +4 -4
- package/dist/sdk-ts.js +1 -1
- package/package.json +1 -1
- package/src/classes/auth.ts +4 -4
- package/src/sdk-ts.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTTPService } from "../services/http.service.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ActionResponse, Feature, Group, LoginResponse, User, ValidateJWTResponse } from "../types/auth.models.js";
|
|
3
3
|
export declare class Auth {
|
|
4
4
|
private httpService;
|
|
5
5
|
private applicationID;
|
|
@@ -16,8 +16,8 @@ export declare class Auth {
|
|
|
16
16
|
getJWTData(): Promise<any>;
|
|
17
17
|
getCurrentUser(): Promise<User>;
|
|
18
18
|
validateCurrentUser(): Promise<ValidateJWTResponse>;
|
|
19
|
-
checkAction(feature: string
|
|
20
|
-
checkPermission(feature: string,
|
|
19
|
+
checkAction(feature: string): Promise<ActionResponse>;
|
|
20
|
+
checkPermission(feature: string, action: string): Promise<ActionResponse>;
|
|
21
21
|
getUsers(): Promise<User[]>;
|
|
22
22
|
getUserById(userId: string): Promise<User>;
|
|
23
23
|
createUser(firstName: string, lastName: string, username: string, email: string, password: string, number: string, userImage: string): Promise<User>;
|
package/dist/cjs/classes/auth.js
CHANGED
|
@@ -68,18 +68,18 @@ class Auth {
|
|
|
68
68
|
}
|
|
69
69
|
return await this.validateJWT(token);
|
|
70
70
|
}
|
|
71
|
-
async checkAction(feature
|
|
71
|
+
async checkAction(feature) {
|
|
72
72
|
try {
|
|
73
|
-
const res = await this.httpService.request.get(`/auth/permission/action/feature/${feature}
|
|
73
|
+
const res = await this.httpService.request.get(`/auth/permission/action/feature/${feature}`);
|
|
74
74
|
return res;
|
|
75
75
|
}
|
|
76
76
|
catch (e) {
|
|
77
77
|
throw new Error("failed to checkAction : " + e.message);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
async checkPermission(feature,
|
|
80
|
+
async checkPermission(feature, action) {
|
|
81
81
|
try {
|
|
82
|
-
const res = await this.httpService.request.get(`/auth/permission/check/feature/${feature}/
|
|
82
|
+
const res = await this.httpService.request.get(`/auth/permission/check/feature/${feature}/action/${action}`);
|
|
83
83
|
return res;
|
|
84
84
|
}
|
|
85
85
|
catch (e) {
|
package/dist/cjs/sdk-ts.js
CHANGED
|
@@ -280,7 +280,7 @@ async function findConfigEndpoint() {
|
|
|
280
280
|
'Accept': 'application/json',
|
|
281
281
|
},
|
|
282
282
|
signal: AbortSignal.timeout(2000)
|
|
283
|
-
}).catch(() =>
|
|
283
|
+
}).catch(() => null); // Catch fetch errors silently
|
|
284
284
|
if (!testResponse || !testResponse.ok) {
|
|
285
285
|
continue; // Skip to next candidate
|
|
286
286
|
}
|
package/dist/classes/auth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTTPService } from "../services/http.service.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ActionResponse, Feature, Group, LoginResponse, User, ValidateJWTResponse } from "../types/auth.models.js";
|
|
3
3
|
export declare class Auth {
|
|
4
4
|
private httpService;
|
|
5
5
|
private applicationID;
|
|
@@ -16,8 +16,8 @@ export declare class Auth {
|
|
|
16
16
|
getJWTData(): Promise<any>;
|
|
17
17
|
getCurrentUser(): Promise<User>;
|
|
18
18
|
validateCurrentUser(): Promise<ValidateJWTResponse>;
|
|
19
|
-
checkAction(feature: string
|
|
20
|
-
checkPermission(feature: string,
|
|
19
|
+
checkAction(feature: string): Promise<ActionResponse>;
|
|
20
|
+
checkPermission(feature: string, action: string): Promise<ActionResponse>;
|
|
21
21
|
getUsers(): Promise<User[]>;
|
|
22
22
|
getUserById(userId: string): Promise<User>;
|
|
23
23
|
createUser(firstName: string, lastName: string, username: string, email: string, password: string, number: string, userImage: string): Promise<User>;
|
package/dist/classes/auth.js
CHANGED
|
@@ -65,18 +65,18 @@ export class Auth {
|
|
|
65
65
|
}
|
|
66
66
|
return await this.validateJWT(token);
|
|
67
67
|
}
|
|
68
|
-
async checkAction(feature
|
|
68
|
+
async checkAction(feature) {
|
|
69
69
|
try {
|
|
70
|
-
const res = await this.httpService.request.get(`/auth/permission/action/feature/${feature}
|
|
70
|
+
const res = await this.httpService.request.get(`/auth/permission/action/feature/${feature}`);
|
|
71
71
|
return res;
|
|
72
72
|
}
|
|
73
73
|
catch (e) {
|
|
74
74
|
throw new Error("failed to checkAction : " + e.message);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
async checkPermission(feature,
|
|
77
|
+
async checkPermission(feature, action) {
|
|
78
78
|
try {
|
|
79
|
-
const res = await this.httpService.request.get(`/auth/permission/check/feature/${feature}/
|
|
79
|
+
const res = await this.httpService.request.get(`/auth/permission/check/feature/${feature}/action/${action}`);
|
|
80
80
|
return res;
|
|
81
81
|
}
|
|
82
82
|
catch (e) {
|
package/dist/sdk-ts.js
CHANGED
|
@@ -276,7 +276,7 @@ async function findConfigEndpoint() {
|
|
|
276
276
|
'Accept': 'application/json',
|
|
277
277
|
},
|
|
278
278
|
signal: AbortSignal.timeout(2000)
|
|
279
|
-
}).catch(() =>
|
|
279
|
+
}).catch(() => null); // Catch fetch errors silently
|
|
280
280
|
if (!testResponse || !testResponse.ok) {
|
|
281
281
|
continue; // Skip to next candidate
|
|
282
282
|
}
|
package/package.json
CHANGED
package/src/classes/auth.ts
CHANGED
|
@@ -81,9 +81,9 @@ export class Auth {
|
|
|
81
81
|
return await this.validateJWT(token);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
public async checkAction(feature: string
|
|
84
|
+
public async checkAction(feature: string): Promise<ActionResponse> {
|
|
85
85
|
try {
|
|
86
|
-
const res: ActionResponse = await this.httpService.request.get(`/auth/permission/action/feature/${feature}
|
|
86
|
+
const res: ActionResponse = await this.httpService.request.get(`/auth/permission/action/feature/${feature}`);
|
|
87
87
|
return res
|
|
88
88
|
}
|
|
89
89
|
catch (e: unknown) {
|
|
@@ -91,9 +91,9 @@ export class Auth {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
public async checkPermission(feature: string,
|
|
94
|
+
public async checkPermission(feature: string, action: string): Promise<ActionResponse> {
|
|
95
95
|
try {
|
|
96
|
-
const res: ActionResponse = await this.httpService.request.get(`/auth/permission/check/feature/${feature}/
|
|
96
|
+
const res: ActionResponse = await this.httpService.request.get(`/auth/permission/check/feature/${feature}/action/${action}`);
|
|
97
97
|
return res
|
|
98
98
|
}
|
|
99
99
|
catch (e: unknown) {
|
package/src/sdk-ts.ts
CHANGED
|
@@ -324,7 +324,7 @@ async function findConfigEndpoint(): Promise<string> {
|
|
|
324
324
|
'Accept': 'application/json',
|
|
325
325
|
},
|
|
326
326
|
signal: AbortSignal.timeout(2000)
|
|
327
|
-
}).catch(() =>
|
|
327
|
+
}).catch(() => null); // Catch fetch errors silently
|
|
328
328
|
|
|
329
329
|
if (!testResponse || !testResponse.ok) {
|
|
330
330
|
continue; // Skip to next candidate
|