squarecommonblhelper 4.1.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,11 @@ 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
+
18
23
  ### v4.1.0
19
24
 
20
25
  - AuthenticationCommonBL:
@@ -43,5 +43,10 @@ declare class AuthenticationCommonBL {
43
43
  data: null;
44
44
  log?: any;
45
45
  }>;
46
+ logoutAppsV0(accessToken: string, appNames: string[]): Promise<{
47
+ message: string | null;
48
+ data: null;
49
+ log?: any;
50
+ }>;
46
51
  }
47
52
  export { AuthenticationCommonBL };
@@ -1,5 +1,5 @@
1
1
  import { fetchJSONData } from "squarecommons";
2
- import { DeleteUserV0Z, GetUserDetailsV0ResponseZ, LogoutAllV0Z, 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") {
@@ -110,5 +110,26 @@ class AuthenticationCommonBL {
110
110
  throw error;
111
111
  }
112
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
+ }
113
134
  }
114
135
  export { AuthenticationCommonBL };
@@ -200,4 +200,20 @@ declare const LogoutAllV0Z: z.ZodObject<z.objectUtil.extendShape<{
200
200
  log?: any;
201
201
  }>;
202
202
  type LogoutAllV0 = z.infer<typeof LogoutAllV0Z>;
203
- export { UpdateUsernameV0ResponseZ, UpdateUsernameV0Response, UpdatePasswordV0ResponseZ, UpdatePasswordV0Response, GetUserDetailsV0ResponseZ, GetUserDetailsV0Response, DeleteUserV0, DeleteUserV0Z, LogoutAllV0, 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, };
@@ -32,4 +32,7 @@ const DeleteUserV0Z = APIOutputZ.extend({
32
32
  const LogoutAllV0Z = APIOutputZ.extend({
33
33
  data: z.null(),
34
34
  });
35
- export { UpdateUsernameV0ResponseZ, UpdatePasswordV0ResponseZ, GetUserDetailsV0ResponseZ, DeleteUserV0Z, LogoutAllV0Z, };
35
+ const LogoutAppsV0Z = APIOutputZ.extend({
36
+ data: z.null(),
37
+ });
38
+ export { UpdateUsernameV0ResponseZ, UpdatePasswordV0ResponseZ, GetUserDetailsV0ResponseZ, DeleteUserV0Z, LogoutAllV0Z, LogoutAppsV0Z, };
package/example.js CHANGED
@@ -25,3 +25,6 @@ console.log(
25
25
  await authenticationCommonBL.deleteUserV0("dummy_access_token", "password")
26
26
  );
27
27
  console.log(await authenticationCommonBL.logoutAllV0("dummy_access_token"));
28
+ console.log(
29
+ await authenticationCommonBL.logoutAppsV0("dummy_access_token", ["test"])
30
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarecommonblhelper",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "helper for common bl for my projects.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",