squarecommonblhelper 1.7.0 → 2.0.0
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/README.md +9 -0
- package/dist/authentication.d.ts +1 -1
- package/dist/authentication.js +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/types/AuthenticationResponses.d.ts +17 -1
- package/dist/types/AuthenticationResponses.js +4 -1
- package/example.js +6 -9
- package/package.json +1 -1
- package/dist/utils.d.ts +0 -10
- package/dist/utils.js +0 -17
package/README.md
CHANGED
package/dist/authentication.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare class AuthenticationCommonBL {
|
|
|
17
17
|
}>;
|
|
18
18
|
deleteUserV0(accessToken: string, password: string): Promise<{
|
|
19
19
|
message: string | null;
|
|
20
|
-
data
|
|
20
|
+
data: null;
|
|
21
21
|
log?: any;
|
|
22
22
|
}>;
|
|
23
23
|
updateUsernameV0(accessToken: string, newUsername: string): Promise<{
|
package/dist/authentication.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fetchJSONData } from "squarecommons";
|
|
2
|
-
import { GenerateAccessTokenV0ResponseZ, GetUserDetailsV0ResponseZ, LogoutV0Z, UpdatePasswordV0ResponseZ, UpdateUsernameV0ResponseZ, } from "./types/AuthenticationResponses.js";
|
|
2
|
+
import { DeleteUserV0Z, GenerateAccessTokenV0ResponseZ, GetUserDetailsV0ResponseZ, LogoutV0Z, UpdatePasswordV0ResponseZ, UpdateUsernameV0ResponseZ, } from "./types/AuthenticationResponses.js";
|
|
3
3
|
class AuthenticationCommonBL {
|
|
4
4
|
commonBLBaseURL;
|
|
5
5
|
constructor(commonBLBaseURL = "http://localhost:10110") {
|
|
@@ -62,7 +62,7 @@ class AuthenticationCommonBL {
|
|
|
62
62
|
{ password: password },
|
|
63
63
|
// query params
|
|
64
64
|
undefined);
|
|
65
|
-
return data;
|
|
65
|
+
return DeleteUserV0Z.parse(data);
|
|
66
66
|
}
|
|
67
67
|
catch (error) {
|
|
68
68
|
throw error;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -224,4 +224,20 @@ declare const LogoutV0Z: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
224
224
|
log?: any;
|
|
225
225
|
}>;
|
|
226
226
|
type LogoutV0 = z.infer<typeof LogoutV0Z>;
|
|
227
|
-
|
|
227
|
+
declare const DeleteUserV0Z: z.ZodObject<z.objectUtil.extendShape<{
|
|
228
|
+
data: z.ZodAny;
|
|
229
|
+
message: z.ZodNullable<z.ZodString>;
|
|
230
|
+
log: z.ZodAny;
|
|
231
|
+
}, {
|
|
232
|
+
data: z.ZodNull;
|
|
233
|
+
}>, "strip", z.ZodTypeAny, {
|
|
234
|
+
message: string | null;
|
|
235
|
+
data: null;
|
|
236
|
+
log?: any;
|
|
237
|
+
}, {
|
|
238
|
+
message: string | null;
|
|
239
|
+
data: null;
|
|
240
|
+
log?: any;
|
|
241
|
+
}>;
|
|
242
|
+
type DeleteUserV0 = z.infer<typeof DeleteUserV0Z>;
|
|
243
|
+
export { GenerateAccessTokenV0ResponseZ, GenerateAccessTokenV0Response, UpdateUsernameV0ResponseZ, UpdateUsernameV0Response, UpdatePasswordV0ResponseZ, UpdatePasswordV0Response, GetUserDetailsV0ResponseZ, GetUserDetailsV0Response, LogoutV0, LogoutV0Z, DeleteUserV0, DeleteUserV0Z, };
|
|
@@ -36,4 +36,7 @@ const GetUserDetailsV0ResponseZ = APIOutputZ.extend({
|
|
|
36
36
|
const LogoutV0Z = APIOutputZ.extend({
|
|
37
37
|
data: z.null(),
|
|
38
38
|
});
|
|
39
|
-
|
|
39
|
+
const DeleteUserV0Z = APIOutputZ.extend({
|
|
40
|
+
data: z.null(),
|
|
41
|
+
});
|
|
42
|
+
export { GenerateAccessTokenV0ResponseZ, UpdateUsernameV0ResponseZ, UpdatePasswordV0ResponseZ, GetUserDetailsV0ResponseZ, LogoutV0Z, DeleteUserV0Z, };
|
package/example.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GreetingCommonBL,
|
|
3
|
-
UtilsCommonBL,
|
|
4
|
-
AuthenticationCommonBL,
|
|
5
|
-
} from "./dist/index.js";
|
|
1
|
+
import { GreetingCommonBL, AuthenticationCommonBL } from "./dist/index.js";
|
|
6
2
|
|
|
7
3
|
let greetingCommonBL = new GreetingCommonBL();
|
|
8
4
|
console.log(await greetingCommonBL.createGreetingV0(true));
|
|
9
5
|
|
|
10
|
-
let utilsCommonBL = new UtilsCommonBL();
|
|
11
|
-
console.log(await utilsCommonBL.getAppIdV0("test"));
|
|
12
|
-
|
|
13
6
|
let authenticationCommonBL = new AuthenticationCommonBL();
|
|
14
7
|
console.log(
|
|
15
8
|
await authenticationCommonBL.generateAccessTokenV0("dummy_refresh_token")
|
|
@@ -30,4 +23,8 @@ console.log(
|
|
|
30
23
|
console.log(
|
|
31
24
|
await authenticationCommonBL.getUserDetailsV0("dummy_access_token")
|
|
32
25
|
);
|
|
33
|
-
console.log(await authenticationCommonBL.logoutV0("
|
|
26
|
+
console.log(await authenticationCommonBL.logoutV0("dummy_refresh_token"));
|
|
27
|
+
|
|
28
|
+
console.log(
|
|
29
|
+
await authenticationCommonBL.deleteUserV0("dummy_access_token", "password")
|
|
30
|
+
);
|
package/package.json
CHANGED
package/dist/utils.d.ts
DELETED
package/dist/utils.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { fetchJSONData } from "squarecommons";
|
|
2
|
-
class UtilsCommonBL {
|
|
3
|
-
commonBLBaseURL;
|
|
4
|
-
constructor(commonBLBaseURL = "http://localhost:10110") {
|
|
5
|
-
this.commonBLBaseURL = commonBLBaseURL;
|
|
6
|
-
}
|
|
7
|
-
async getAppIdV0(appName) {
|
|
8
|
-
try {
|
|
9
|
-
const data = await fetchJSONData(this.commonBLBaseURL, "get_app_id/v0", "GET", undefined, undefined, { app_name: appName });
|
|
10
|
-
return data;
|
|
11
|
-
}
|
|
12
|
-
catch (error) {
|
|
13
|
-
throw error;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export { UtilsCommonBL };
|