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 CHANGED
@@ -15,6 +15,15 @@ helper for common bl for my projects.
15
15
 
16
16
  ## changelog
17
17
 
18
+ ### v2.0.0
19
+
20
+ - remove UtilsCommonBL
21
+
22
+ ### v1.8.0
23
+
24
+ - AuthenticationCommonBL:
25
+ - add types for deleteUserV0
26
+
18
27
  ### v1.7.0
19
28
 
20
29
  - AuthenticationCommonBL:
@@ -17,7 +17,7 @@ declare class AuthenticationCommonBL {
17
17
  }>;
18
18
  deleteUserV0(accessToken: string, password: string): Promise<{
19
19
  message: string | null;
20
- data?: any;
20
+ data: null;
21
21
  log?: any;
22
22
  }>;
23
23
  updateUsernameV0(accessToken: string, newUsername: string): Promise<{
@@ -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
@@ -1,3 +1,2 @@
1
1
  export * from "./greeting.js";
2
- export * from "./utils.js";
3
2
  export * from "./authentication.js";
package/dist/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from "./greeting.js";
2
- export * from "./utils.js";
3
2
  export * from "./authentication.js";
@@ -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
- export { GenerateAccessTokenV0ResponseZ, GenerateAccessTokenV0Response, UpdateUsernameV0ResponseZ, UpdateUsernameV0Response, UpdatePasswordV0ResponseZ, UpdatePasswordV0Response, GetUserDetailsV0ResponseZ, GetUserDetailsV0Response, LogoutV0, LogoutV0Z, };
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
- export { GenerateAccessTokenV0ResponseZ, UpdateUsernameV0ResponseZ, UpdatePasswordV0ResponseZ, GetUserDetailsV0ResponseZ, LogoutV0Z, };
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("dumm_refresh_token"));
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarecommonblhelper",
3
- "version": "1.7.0",
3
+ "version": "2.0.0",
4
4
  "description": "helper for common bl for my projects.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/dist/utils.d.ts DELETED
@@ -1,10 +0,0 @@
1
- declare class UtilsCommonBL {
2
- private commonBLBaseURL;
3
- constructor(commonBLBaseURL?: string);
4
- getAppIdV0(appName: string): Promise<{
5
- message: string | null;
6
- data?: any;
7
- log?: any;
8
- }>;
9
- }
10
- export { UtilsCommonBL };
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 };