squarecommonblhelper 4.0.0 → 4.2.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
CHANGED
|
@@ -15,6 +15,16 @@ helper for common bl for my projects.
|
|
|
15
15
|
|
|
16
16
|
## changelog
|
|
17
17
|
|
|
18
|
+
### v4.2.0
|
|
19
|
+
|
|
20
|
+
- AuthenticationCommonBL:
|
|
21
|
+
- add logoutAppsV0.
|
|
22
|
+
|
|
23
|
+
### v4.1.0
|
|
24
|
+
|
|
25
|
+
- AuthenticationCommonBL:
|
|
26
|
+
- add logoutAllV0.
|
|
27
|
+
|
|
18
28
|
### v4.0.0
|
|
19
29
|
|
|
20
30
|
- AuthenticationCommonBL:
|
package/dist/authentication.d.ts
CHANGED
|
@@ -38,5 +38,15 @@ declare class AuthenticationCommonBL {
|
|
|
38
38
|
};
|
|
39
39
|
log?: any;
|
|
40
40
|
}>;
|
|
41
|
+
logoutAllV0(accessToken: string): Promise<{
|
|
42
|
+
message: string | null;
|
|
43
|
+
data: null;
|
|
44
|
+
log?: any;
|
|
45
|
+
}>;
|
|
46
|
+
logoutAppsV0(accessToken: string, appNames: string[]): Promise<{
|
|
47
|
+
message: string | null;
|
|
48
|
+
data: null;
|
|
49
|
+
log?: any;
|
|
50
|
+
}>;
|
|
41
51
|
}
|
|
42
52
|
export { AuthenticationCommonBL };
|
package/dist/authentication.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fetchJSONData } from "squarecommons";
|
|
2
|
-
import { DeleteUserV0Z, GetUserDetailsV0ResponseZ, UpdatePasswordV0ResponseZ, UpdateUsernameV0ResponseZ } from "./types/AuthenticationResponses.js";
|
|
2
|
+
import { DeleteUserV0Z, GetUserDetailsV0ResponseZ, LogoutAllV0Z, LogoutAppsV0Z, UpdatePasswordV0ResponseZ, UpdateUsernameV0ResponseZ, } from "./types/AuthenticationResponses.js";
|
|
3
3
|
class AuthenticationCommonBL {
|
|
4
4
|
commonBLBaseURL;
|
|
5
5
|
constructor(commonBLBaseURL = "http://localhost:10110") {
|
|
@@ -89,5 +89,47 @@ class AuthenticationCommonBL {
|
|
|
89
89
|
throw error;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
+
async logoutAllV0(accessToken) {
|
|
93
|
+
try {
|
|
94
|
+
const data = await fetchJSONData(
|
|
95
|
+
// base url
|
|
96
|
+
this.commonBLBaseURL,
|
|
97
|
+
// endpoint
|
|
98
|
+
"logout/all/v0",
|
|
99
|
+
// method
|
|
100
|
+
"DELETE",
|
|
101
|
+
// headers
|
|
102
|
+
{ access_token: accessToken },
|
|
103
|
+
// body
|
|
104
|
+
undefined,
|
|
105
|
+
// query params
|
|
106
|
+
undefined);
|
|
107
|
+
return LogoutAllV0Z.parse(data);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async logoutAppsV0(accessToken, appNames) {
|
|
114
|
+
try {
|
|
115
|
+
const data = await fetchJSONData(
|
|
116
|
+
// base url
|
|
117
|
+
this.commonBLBaseURL,
|
|
118
|
+
// endpoint
|
|
119
|
+
"logout/apps/v0",
|
|
120
|
+
// method
|
|
121
|
+
"DELETE",
|
|
122
|
+
// headers
|
|
123
|
+
{ access_token: accessToken },
|
|
124
|
+
// body
|
|
125
|
+
{ app_names: appNames },
|
|
126
|
+
// query params
|
|
127
|
+
undefined);
|
|
128
|
+
return LogoutAppsV0Z.parse(data);
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
92
134
|
}
|
|
93
135
|
export { AuthenticationCommonBL };
|
|
@@ -184,4 +184,36 @@ declare const DeleteUserV0Z: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
184
184
|
log?: any;
|
|
185
185
|
}>;
|
|
186
186
|
type DeleteUserV0 = z.infer<typeof DeleteUserV0Z>;
|
|
187
|
-
|
|
187
|
+
declare const LogoutAllV0Z: z.ZodObject<z.objectUtil.extendShape<{
|
|
188
|
+
data: z.ZodAny;
|
|
189
|
+
message: z.ZodNullable<z.ZodString>;
|
|
190
|
+
log: z.ZodAny;
|
|
191
|
+
}, {
|
|
192
|
+
data: z.ZodNull;
|
|
193
|
+
}>, "strip", z.ZodTypeAny, {
|
|
194
|
+
message: string | null;
|
|
195
|
+
data: null;
|
|
196
|
+
log?: any;
|
|
197
|
+
}, {
|
|
198
|
+
message: string | null;
|
|
199
|
+
data: null;
|
|
200
|
+
log?: any;
|
|
201
|
+
}>;
|
|
202
|
+
type LogoutAllV0 = z.infer<typeof LogoutAllV0Z>;
|
|
203
|
+
declare const LogoutAppsV0Z: z.ZodObject<z.objectUtil.extendShape<{
|
|
204
|
+
data: z.ZodAny;
|
|
205
|
+
message: z.ZodNullable<z.ZodString>;
|
|
206
|
+
log: z.ZodAny;
|
|
207
|
+
}, {
|
|
208
|
+
data: z.ZodNull;
|
|
209
|
+
}>, "strip", z.ZodTypeAny, {
|
|
210
|
+
message: string | null;
|
|
211
|
+
data: null;
|
|
212
|
+
log?: any;
|
|
213
|
+
}, {
|
|
214
|
+
message: string | null;
|
|
215
|
+
data: null;
|
|
216
|
+
log?: any;
|
|
217
|
+
}>;
|
|
218
|
+
type LogoutAppsV0 = z.infer<typeof LogoutAppsV0Z>;
|
|
219
|
+
export { UpdateUsernameV0ResponseZ, UpdateUsernameV0Response, UpdatePasswordV0ResponseZ, UpdatePasswordV0Response, GetUserDetailsV0ResponseZ, GetUserDetailsV0Response, DeleteUserV0, DeleteUserV0Z, LogoutAllV0, LogoutAllV0Z, LogoutAppsV0, LogoutAppsV0Z, };
|
|
@@ -29,4 +29,10 @@ const GetUserDetailsV0ResponseZ = APIOutputZ.extend({
|
|
|
29
29
|
const DeleteUserV0Z = APIOutputZ.extend({
|
|
30
30
|
data: z.null(),
|
|
31
31
|
});
|
|
32
|
-
|
|
32
|
+
const LogoutAllV0Z = APIOutputZ.extend({
|
|
33
|
+
data: z.null(),
|
|
34
|
+
});
|
|
35
|
+
const LogoutAppsV0Z = APIOutputZ.extend({
|
|
36
|
+
data: z.null(),
|
|
37
|
+
});
|
|
38
|
+
export { UpdateUsernameV0ResponseZ, UpdatePasswordV0ResponseZ, GetUserDetailsV0ResponseZ, DeleteUserV0Z, LogoutAllV0Z, LogoutAppsV0Z, };
|
package/example.js
CHANGED
|
@@ -24,3 +24,7 @@ console.log(
|
|
|
24
24
|
console.log(
|
|
25
25
|
await authenticationCommonBL.deleteUserV0("dummy_access_token", "password")
|
|
26
26
|
);
|
|
27
|
+
console.log(await authenticationCommonBL.logoutAllV0("dummy_access_token"));
|
|
28
|
+
console.log(
|
|
29
|
+
await authenticationCommonBL.logoutAppsV0("dummy_access_token", ["test"])
|
|
30
|
+
);
|