squarecommonblhelper 1.3.0 → 1.5.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 +11 -0
- package/dist/authentication.d.ts +7 -2
- package/dist/authentication.js +5 -5
- package/dist/greeting.d.ts +1 -1
- package/dist/types/AuthenticationResponses.d.ts +64 -1
- package/dist/types/AuthenticationResponses.js +12 -1
- package/dist/types/GreetingResponses.d.ts +6 -6
- package/example.js +13 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,17 @@ helper for common bl for my projects.
|
|
|
15
15
|
|
|
16
16
|
## changelog
|
|
17
17
|
|
|
18
|
+
### v1.5.0
|
|
19
|
+
|
|
20
|
+
- AuthenticationCommonBL:
|
|
21
|
+
- add types for updatePasswordV0
|
|
22
|
+
|
|
23
|
+
### v1.4.0
|
|
24
|
+
|
|
25
|
+
- AuthenticationCommonBL:
|
|
26
|
+
- bug fix in updateUsernameV0
|
|
27
|
+
- add types for updateUsernameV0
|
|
28
|
+
|
|
18
29
|
### v1.3.0
|
|
19
30
|
|
|
20
31
|
- add types in AuthenticationCommonBL:
|
package/dist/authentication.d.ts
CHANGED
|
@@ -22,12 +22,17 @@ declare class AuthenticationCommonBL {
|
|
|
22
22
|
}>;
|
|
23
23
|
updateUsernameV0(accessToken: string, newUsername: string): Promise<{
|
|
24
24
|
message: string | null;
|
|
25
|
-
data
|
|
25
|
+
data: {
|
|
26
|
+
main: {
|
|
27
|
+
user_id: string;
|
|
28
|
+
username: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
26
31
|
log?: any;
|
|
27
32
|
}>;
|
|
28
33
|
updatePasswordV0(accessToken: string, oldPassword: string, newPassword: string): Promise<{
|
|
29
34
|
message: string | null;
|
|
30
|
-
data
|
|
35
|
+
data: null;
|
|
31
36
|
log?: any;
|
|
32
37
|
}>;
|
|
33
38
|
getUserDetailsV0(accessToken: string): Promise<{
|
package/dist/authentication.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fetchJSONData } from "squarecommons";
|
|
2
|
-
import { GenerateAccessTokenV0ResponseZ } from "./types/AuthenticationResponses.js";
|
|
2
|
+
import { GenerateAccessTokenV0ResponseZ, UpdatePasswordV0ResponseZ, UpdateUsernameV0ResponseZ, } from "./types/AuthenticationResponses.js";
|
|
3
3
|
class AuthenticationCommonBL {
|
|
4
4
|
commonBLBaseURL;
|
|
5
5
|
constructor(commonBLBaseURL = "http://localhost:10110") {
|
|
@@ -80,10 +80,10 @@ class AuthenticationCommonBL {
|
|
|
80
80
|
// headers
|
|
81
81
|
{ access_token: accessToken },
|
|
82
82
|
// body
|
|
83
|
-
|
|
83
|
+
undefined,
|
|
84
84
|
// query params
|
|
85
|
-
|
|
86
|
-
return data;
|
|
85
|
+
{ new_username: newUsername });
|
|
86
|
+
return UpdateUsernameV0ResponseZ.parse(data);
|
|
87
87
|
}
|
|
88
88
|
catch (error) {
|
|
89
89
|
throw error;
|
|
@@ -104,7 +104,7 @@ class AuthenticationCommonBL {
|
|
|
104
104
|
{ old_password: oldPassword, new_password: newPassword },
|
|
105
105
|
// query params
|
|
106
106
|
undefined);
|
|
107
|
-
return data;
|
|
107
|
+
return UpdatePasswordV0ResponseZ.parse(data);
|
|
108
108
|
}
|
|
109
109
|
catch (error) {
|
|
110
110
|
throw error;
|
package/dist/greeting.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ declare class GreetingCommonBL {
|
|
|
5
5
|
message: string | null;
|
|
6
6
|
data: {
|
|
7
7
|
main: {
|
|
8
|
-
greeting_anonymous_sender_name: string | null;
|
|
9
8
|
user_id: string | null;
|
|
9
|
+
greeting_anonymous_sender_name: string | null;
|
|
10
10
|
greeting_id: number;
|
|
11
11
|
greeting_datetime: string;
|
|
12
12
|
greeting_is_anonymous: boolean;
|
|
@@ -39,4 +39,67 @@ declare const GenerateAccessTokenV0ResponseZ: z.ZodObject<z.objectUtil.extendSha
|
|
|
39
39
|
log?: any;
|
|
40
40
|
}>;
|
|
41
41
|
type GenerateAccessTokenV0Response = z.infer<typeof GenerateAccessTokenV0ResponseZ>;
|
|
42
|
-
|
|
42
|
+
declare const UpdateUsernameV0ResponseZ: z.ZodObject<z.objectUtil.extendShape<{
|
|
43
|
+
data: z.ZodAny;
|
|
44
|
+
message: z.ZodNullable<z.ZodString>;
|
|
45
|
+
log: z.ZodAny;
|
|
46
|
+
}, {
|
|
47
|
+
data: z.ZodObject<{
|
|
48
|
+
main: z.ZodObject<{
|
|
49
|
+
user_id: z.ZodString;
|
|
50
|
+
username: z.ZodString;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
user_id: string;
|
|
53
|
+
username: string;
|
|
54
|
+
}, {
|
|
55
|
+
user_id: string;
|
|
56
|
+
username: string;
|
|
57
|
+
}>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
main: {
|
|
60
|
+
user_id: string;
|
|
61
|
+
username: string;
|
|
62
|
+
};
|
|
63
|
+
}, {
|
|
64
|
+
main: {
|
|
65
|
+
user_id: string;
|
|
66
|
+
username: string;
|
|
67
|
+
};
|
|
68
|
+
}>;
|
|
69
|
+
}>, "strip", z.ZodTypeAny, {
|
|
70
|
+
message: string | null;
|
|
71
|
+
data: {
|
|
72
|
+
main: {
|
|
73
|
+
user_id: string;
|
|
74
|
+
username: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
log?: any;
|
|
78
|
+
}, {
|
|
79
|
+
message: string | null;
|
|
80
|
+
data: {
|
|
81
|
+
main: {
|
|
82
|
+
user_id: string;
|
|
83
|
+
username: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
log?: any;
|
|
87
|
+
}>;
|
|
88
|
+
type UpdateUsernameV0Response = z.infer<typeof UpdateUsernameV0ResponseZ>;
|
|
89
|
+
declare const UpdatePasswordV0ResponseZ: z.ZodObject<z.objectUtil.extendShape<{
|
|
90
|
+
data: z.ZodAny;
|
|
91
|
+
message: z.ZodNullable<z.ZodString>;
|
|
92
|
+
log: z.ZodAny;
|
|
93
|
+
}, {
|
|
94
|
+
data: z.ZodNull;
|
|
95
|
+
}>, "strip", z.ZodTypeAny, {
|
|
96
|
+
message: string | null;
|
|
97
|
+
data: null;
|
|
98
|
+
log?: any;
|
|
99
|
+
}, {
|
|
100
|
+
message: string | null;
|
|
101
|
+
data: null;
|
|
102
|
+
log?: any;
|
|
103
|
+
}>;
|
|
104
|
+
type UpdatePasswordV0Response = z.infer<typeof UpdatePasswordV0ResponseZ>;
|
|
105
|
+
export { GenerateAccessTokenV0ResponseZ, GenerateAccessTokenV0Response, UpdateUsernameV0ResponseZ, UpdateUsernameV0Response, UpdatePasswordV0ResponseZ, UpdatePasswordV0Response, };
|
|
@@ -7,4 +7,15 @@ const GenerateAccessTokenV0ResponseZ = APIOutputZ.extend({
|
|
|
7
7
|
}),
|
|
8
8
|
}),
|
|
9
9
|
});
|
|
10
|
-
|
|
10
|
+
const UpdateUsernameV0ResponseZ = APIOutputZ.extend({
|
|
11
|
+
data: z.object({
|
|
12
|
+
main: z.object({
|
|
13
|
+
user_id: z.string(),
|
|
14
|
+
username: z.string(),
|
|
15
|
+
}),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
const UpdatePasswordV0ResponseZ = APIOutputZ.extend({
|
|
19
|
+
data: z.null(),
|
|
20
|
+
});
|
|
21
|
+
export { GenerateAccessTokenV0ResponseZ, UpdateUsernameV0ResponseZ, UpdatePasswordV0ResponseZ, };
|
|
@@ -13,15 +13,15 @@ declare const CreateGreetingV0ResponseZ: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
13
13
|
greeting_is_anonymous: z.ZodBoolean;
|
|
14
14
|
greeting_text: z.ZodNullable<z.ZodString>;
|
|
15
15
|
}, "strip", z.ZodTypeAny, {
|
|
16
|
-
greeting_anonymous_sender_name: string | null;
|
|
17
16
|
user_id: string | null;
|
|
17
|
+
greeting_anonymous_sender_name: string | null;
|
|
18
18
|
greeting_id: number;
|
|
19
19
|
greeting_datetime: string;
|
|
20
20
|
greeting_is_anonymous: boolean;
|
|
21
21
|
greeting_text: string | null;
|
|
22
22
|
}, {
|
|
23
|
-
greeting_anonymous_sender_name: string | null;
|
|
24
23
|
user_id: string | null;
|
|
24
|
+
greeting_anonymous_sender_name: string | null;
|
|
25
25
|
greeting_id: number;
|
|
26
26
|
greeting_datetime: string;
|
|
27
27
|
greeting_is_anonymous: boolean;
|
|
@@ -29,8 +29,8 @@ declare const CreateGreetingV0ResponseZ: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
29
29
|
}>, "many">;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
31
|
main: {
|
|
32
|
-
greeting_anonymous_sender_name: string | null;
|
|
33
32
|
user_id: string | null;
|
|
33
|
+
greeting_anonymous_sender_name: string | null;
|
|
34
34
|
greeting_id: number;
|
|
35
35
|
greeting_datetime: string;
|
|
36
36
|
greeting_is_anonymous: boolean;
|
|
@@ -38,8 +38,8 @@ declare const CreateGreetingV0ResponseZ: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
38
38
|
}[];
|
|
39
39
|
}, {
|
|
40
40
|
main: {
|
|
41
|
-
greeting_anonymous_sender_name: string | null;
|
|
42
41
|
user_id: string | null;
|
|
42
|
+
greeting_anonymous_sender_name: string | null;
|
|
43
43
|
greeting_id: number;
|
|
44
44
|
greeting_datetime: string;
|
|
45
45
|
greeting_is_anonymous: boolean;
|
|
@@ -50,8 +50,8 @@ declare const CreateGreetingV0ResponseZ: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
50
50
|
message: string | null;
|
|
51
51
|
data: {
|
|
52
52
|
main: {
|
|
53
|
-
greeting_anonymous_sender_name: string | null;
|
|
54
53
|
user_id: string | null;
|
|
54
|
+
greeting_anonymous_sender_name: string | null;
|
|
55
55
|
greeting_id: number;
|
|
56
56
|
greeting_datetime: string;
|
|
57
57
|
greeting_is_anonymous: boolean;
|
|
@@ -63,8 +63,8 @@ declare const CreateGreetingV0ResponseZ: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
63
63
|
message: string | null;
|
|
64
64
|
data: {
|
|
65
65
|
main: {
|
|
66
|
-
greeting_anonymous_sender_name: string | null;
|
|
67
66
|
user_id: string | null;
|
|
67
|
+
greeting_anonymous_sender_name: string | null;
|
|
68
68
|
greeting_id: number;
|
|
69
69
|
greeting_datetime: string;
|
|
70
70
|
greeting_is_anonymous: boolean;
|
package/example.js
CHANGED
|
@@ -14,3 +14,16 @@ let authenticationCommonBL = new AuthenticationCommonBL();
|
|
|
14
14
|
console.log(
|
|
15
15
|
await authenticationCommonBL.generateAccessTokenV0("dummy_refresh_token")
|
|
16
16
|
);
|
|
17
|
+
console.log(
|
|
18
|
+
await authenticationCommonBL.updateUsernameV0(
|
|
19
|
+
"dummy_access_token",
|
|
20
|
+
"new_username"
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
console.log(
|
|
24
|
+
await authenticationCommonBL.updatePasswordV0(
|
|
25
|
+
"dummy_access_token",
|
|
26
|
+
"oldPassword",
|
|
27
|
+
"newPassword"
|
|
28
|
+
)
|
|
29
|
+
);
|