squarecommonblhelper 4.0.0 → 4.1.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,11 @@ helper for common bl for my projects.
15
15
 
16
16
  ## changelog
17
17
 
18
+ ### v4.1.0
19
+
20
+ - AuthenticationCommonBL:
21
+ - add logoutAllV0.
22
+
18
23
  ### v4.0.0
19
24
 
20
25
  - AuthenticationCommonBL:
@@ -38,5 +38,10 @@ 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
+ }>;
41
46
  }
42
47
  export { AuthenticationCommonBL };
@@ -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, UpdatePasswordV0ResponseZ, UpdateUsernameV0ResponseZ, } from "./types/AuthenticationResponses.js";
3
3
  class AuthenticationCommonBL {
4
4
  commonBLBaseURL;
5
5
  constructor(commonBLBaseURL = "http://localhost:10110") {
@@ -89,5 +89,26 @@ 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
+ }
92
113
  }
93
114
  export { AuthenticationCommonBL };
@@ -184,4 +184,20 @@ declare const DeleteUserV0Z: z.ZodObject<z.objectUtil.extendShape<{
184
184
  log?: any;
185
185
  }>;
186
186
  type DeleteUserV0 = z.infer<typeof DeleteUserV0Z>;
187
- export { UpdateUsernameV0ResponseZ, UpdateUsernameV0Response, UpdatePasswordV0ResponseZ, UpdatePasswordV0Response, GetUserDetailsV0ResponseZ, GetUserDetailsV0Response, DeleteUserV0, DeleteUserV0Z, };
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
+ export { UpdateUsernameV0ResponseZ, UpdateUsernameV0Response, UpdatePasswordV0ResponseZ, UpdatePasswordV0Response, GetUserDetailsV0ResponseZ, GetUserDetailsV0Response, DeleteUserV0, DeleteUserV0Z, LogoutAllV0, LogoutAllV0Z, };
@@ -29,4 +29,7 @@ const GetUserDetailsV0ResponseZ = APIOutputZ.extend({
29
29
  const DeleteUserV0Z = APIOutputZ.extend({
30
30
  data: z.null(),
31
31
  });
32
- export { UpdateUsernameV0ResponseZ, UpdatePasswordV0ResponseZ, GetUserDetailsV0ResponseZ, DeleteUserV0Z, };
32
+ const LogoutAllV0Z = APIOutputZ.extend({
33
+ data: z.null(),
34
+ });
35
+ export { UpdateUsernameV0ResponseZ, UpdatePasswordV0ResponseZ, GetUserDetailsV0ResponseZ, DeleteUserV0Z, LogoutAllV0Z, };
package/example.js CHANGED
@@ -24,3 +24,4 @@ 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"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarecommonblhelper",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "helper for common bl for my projects.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",