squarecommonblhelper 1.2.0 → 1.3.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
package/dist/authentication.d.ts
CHANGED
|
@@ -8,7 +8,11 @@ declare class AuthenticationCommonBL {
|
|
|
8
8
|
}>;
|
|
9
9
|
generateAccessTokenV0(refreshToken: string): Promise<{
|
|
10
10
|
message: string | null;
|
|
11
|
-
data
|
|
11
|
+
data: {
|
|
12
|
+
main: {
|
|
13
|
+
access_token: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
12
16
|
log?: any;
|
|
13
17
|
}>;
|
|
14
18
|
deleteUserV0(accessToken: string, password: string): Promise<{
|
package/dist/authentication.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { fetchJSONData } from "squarecommons";
|
|
2
|
+
import { GenerateAccessTokenV0ResponseZ } from "./types/AuthenticationResponses.js";
|
|
2
3
|
class AuthenticationCommonBL {
|
|
3
4
|
commonBLBaseURL;
|
|
4
5
|
constructor(commonBLBaseURL = "http://localhost:10110") {
|
|
@@ -40,7 +41,7 @@ class AuthenticationCommonBL {
|
|
|
40
41
|
undefined,
|
|
41
42
|
// query params
|
|
42
43
|
undefined);
|
|
43
|
-
return data;
|
|
44
|
+
return GenerateAccessTokenV0ResponseZ.parse(data);
|
|
44
45
|
}
|
|
45
46
|
catch (error) {
|
|
46
47
|
throw error;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const GenerateAccessTokenV0ResponseZ: z.ZodObject<z.objectUtil.extendShape<{
|
|
3
|
+
data: z.ZodAny;
|
|
4
|
+
message: z.ZodNullable<z.ZodString>;
|
|
5
|
+
log: z.ZodAny;
|
|
6
|
+
}, {
|
|
7
|
+
data: z.ZodObject<{
|
|
8
|
+
main: z.ZodObject<{
|
|
9
|
+
access_token: z.ZodString;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
access_token: string;
|
|
12
|
+
}, {
|
|
13
|
+
access_token: string;
|
|
14
|
+
}>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
main: {
|
|
17
|
+
access_token: string;
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
main: {
|
|
21
|
+
access_token: string;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
}>, "strip", z.ZodTypeAny, {
|
|
25
|
+
message: string | null;
|
|
26
|
+
data: {
|
|
27
|
+
main: {
|
|
28
|
+
access_token: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
log?: any;
|
|
32
|
+
}, {
|
|
33
|
+
message: string | null;
|
|
34
|
+
data: {
|
|
35
|
+
main: {
|
|
36
|
+
access_token: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
log?: any;
|
|
40
|
+
}>;
|
|
41
|
+
type GenerateAccessTokenV0Response = z.infer<typeof GenerateAccessTokenV0ResponseZ>;
|
|
42
|
+
export { GenerateAccessTokenV0ResponseZ, GenerateAccessTokenV0Response };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { APIOutputZ } from "squarecommons";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const GenerateAccessTokenV0ResponseZ = APIOutputZ.extend({
|
|
4
|
+
data: z.object({
|
|
5
|
+
main: z.object({
|
|
6
|
+
access_token: z.string(),
|
|
7
|
+
}),
|
|
8
|
+
}),
|
|
9
|
+
});
|
|
10
|
+
export { GenerateAccessTokenV0ResponseZ };
|
package/example.js
CHANGED
|
@@ -11,4 +11,6 @@ let utilsCommonBL = new UtilsCommonBL();
|
|
|
11
11
|
console.log(await utilsCommonBL.getAppIdV0("test"));
|
|
12
12
|
|
|
13
13
|
let authenticationCommonBL = new AuthenticationCommonBL();
|
|
14
|
-
console.log(
|
|
14
|
+
console.log(
|
|
15
|
+
await authenticationCommonBL.generateAccessTokenV0("dummy_refresh_token")
|
|
16
|
+
);
|