squarecommonblhelper 6.0.0 → 7.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 +10 -0
- package/dist/authentication.d.ts +2 -0
- package/dist/greeting.d.ts +1 -1
- package/dist/greeting.js +4 -14
- package/dist/types/AuthenticationResponses.d.ts +10 -0
- package/dist/types/AuthenticationResponses.js +2 -0
- package/dist/types/GreetingResponses.d.ts +3 -3
- package/dist/types/GreetingResponses.js +2 -2
- package/example.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,16 @@ helper for common bl for my projects.
|
|
|
15
15
|
|
|
16
16
|
## changelog
|
|
17
17
|
|
|
18
|
+
### v7.0.0
|
|
19
|
+
|
|
20
|
+
- GreetingCommonBL:
|
|
21
|
+
- **breaking change**: replace createGreetingV0 with createAnonymousGreetingV0.
|
|
22
|
+
|
|
23
|
+
### v6.1.0
|
|
24
|
+
|
|
25
|
+
- AuthenticationCommonBL:
|
|
26
|
+
- update output types of sendResetPasswordEmailV0ResponseZ and sendVerificationEmailV0ResponseZ.
|
|
27
|
+
|
|
18
28
|
### v6.0.0
|
|
19
29
|
|
|
20
30
|
- AuthenticationCommonBL:
|
package/dist/authentication.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ declare class AuthenticationCommonBL {
|
|
|
88
88
|
message: string | null;
|
|
89
89
|
data: {
|
|
90
90
|
expires_at: string;
|
|
91
|
+
cooldown_reset_at: string;
|
|
91
92
|
};
|
|
92
93
|
log?: any;
|
|
93
94
|
}>;
|
|
@@ -102,6 +103,7 @@ declare class AuthenticationCommonBL {
|
|
|
102
103
|
message: string | null;
|
|
103
104
|
data: {
|
|
104
105
|
expires_at: string;
|
|
106
|
+
cooldown_reset_at: string;
|
|
105
107
|
} | null;
|
|
106
108
|
log?: any;
|
|
107
109
|
}>;
|
package/dist/greeting.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare class GreetingCommonBL {
|
|
2
2
|
private commonBLBaseURL;
|
|
3
3
|
constructor(commonBLBaseURL?: string);
|
|
4
|
-
|
|
4
|
+
createAnonymousGreetingV0(greetingAnonymousSenderName?: string, greetingText?: string): Promise<{
|
|
5
5
|
message: string | null;
|
|
6
6
|
data: {
|
|
7
7
|
main: {
|
package/dist/greeting.js
CHANGED
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
import { fetchJSONData } from "squarecommons";
|
|
2
|
-
import {
|
|
2
|
+
import { CreateAnonymousGreetingV0ResponseZ } from "./types/GreetingResponses.js";
|
|
3
3
|
class GreetingCommonBL {
|
|
4
4
|
commonBLBaseURL;
|
|
5
5
|
constructor(commonBLBaseURL = "http://localhost:10110") {
|
|
6
6
|
this.commonBLBaseURL = commonBLBaseURL;
|
|
7
7
|
}
|
|
8
|
-
async
|
|
8
|
+
async createAnonymousGreetingV0(greetingAnonymousSenderName, greetingText) {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
if (accessToken) {
|
|
12
|
-
headers = {
|
|
13
|
-
access_token: accessToken,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
headers = undefined;
|
|
18
|
-
}
|
|
19
|
-
const data = await fetchJSONData(this.commonBLBaseURL, "create_greeting/v0", "POST", headers, {
|
|
20
|
-
greeting_is_anonymous: greetingIsAnonymous,
|
|
10
|
+
const data = await fetchJSONData(this.commonBLBaseURL, "create_anonymous_greeting/v0", "POST", undefined, {
|
|
21
11
|
greeting_anonymous_sender_name: greetingAnonymousSenderName,
|
|
22
12
|
greeting_text: greetingText,
|
|
23
13
|
});
|
|
24
|
-
return
|
|
14
|
+
return CreateAnonymousGreetingV0ResponseZ.parse(data);
|
|
25
15
|
}
|
|
26
16
|
catch (error) {
|
|
27
17
|
throw error;
|
|
@@ -409,21 +409,26 @@ declare const sendResetPasswordEmailV0ResponseZ: z.ZodObject<z.objectUtil.extend
|
|
|
409
409
|
}, {
|
|
410
410
|
data: z.ZodObject<{
|
|
411
411
|
expires_at: z.ZodString;
|
|
412
|
+
cooldown_reset_at: z.ZodString;
|
|
412
413
|
}, "strict", z.ZodTypeAny, {
|
|
413
414
|
expires_at: string;
|
|
415
|
+
cooldown_reset_at: string;
|
|
414
416
|
}, {
|
|
415
417
|
expires_at: string;
|
|
418
|
+
cooldown_reset_at: string;
|
|
416
419
|
}>;
|
|
417
420
|
}>, "strict", z.ZodTypeAny, {
|
|
418
421
|
message: string | null;
|
|
419
422
|
data: {
|
|
420
423
|
expires_at: string;
|
|
424
|
+
cooldown_reset_at: string;
|
|
421
425
|
};
|
|
422
426
|
log?: any;
|
|
423
427
|
}, {
|
|
424
428
|
message: string | null;
|
|
425
429
|
data: {
|
|
426
430
|
expires_at: string;
|
|
431
|
+
cooldown_reset_at: string;
|
|
427
432
|
};
|
|
428
433
|
log?: any;
|
|
429
434
|
}>;
|
|
@@ -463,21 +468,26 @@ declare const sendVerificationEmailV0ResponseZ: z.ZodObject<z.objectUtil.extendS
|
|
|
463
468
|
}, {
|
|
464
469
|
data: z.ZodNullable<z.ZodObject<{
|
|
465
470
|
expires_at: z.ZodString;
|
|
471
|
+
cooldown_reset_at: z.ZodString;
|
|
466
472
|
}, "strict", z.ZodTypeAny, {
|
|
467
473
|
expires_at: string;
|
|
474
|
+
cooldown_reset_at: string;
|
|
468
475
|
}, {
|
|
469
476
|
expires_at: string;
|
|
477
|
+
cooldown_reset_at: string;
|
|
470
478
|
}>>;
|
|
471
479
|
}>, "strict", z.ZodTypeAny, {
|
|
472
480
|
message: string | null;
|
|
473
481
|
data: {
|
|
474
482
|
expires_at: string;
|
|
483
|
+
cooldown_reset_at: string;
|
|
475
484
|
} | null;
|
|
476
485
|
log?: any;
|
|
477
486
|
}, {
|
|
478
487
|
message: string | null;
|
|
479
488
|
data: {
|
|
480
489
|
expires_at: string;
|
|
490
|
+
cooldown_reset_at: string;
|
|
481
491
|
} | null;
|
|
482
492
|
log?: any;
|
|
483
493
|
}>;
|
|
@@ -67,6 +67,7 @@ const updateProfileDetailsZ = APIOutputZ.extend({
|
|
|
67
67
|
const sendResetPasswordEmailV0ResponseZ = APIOutputZ.extend({
|
|
68
68
|
data: z.strictObject({
|
|
69
69
|
expires_at: z.string(),
|
|
70
|
+
cooldown_reset_at: z.string(),
|
|
70
71
|
}),
|
|
71
72
|
});
|
|
72
73
|
const RecoveryMethodEnumZ = z.enum(["EMAIL", "BACKUP_CODE"]);
|
|
@@ -78,6 +79,7 @@ const updateUserRecoveryMethodsV0ResponseZ = APIOutputZ.extend({
|
|
|
78
79
|
const sendVerificationEmailV0ResponseZ = APIOutputZ.extend({
|
|
79
80
|
data: z.nullable(z.strictObject({
|
|
80
81
|
expires_at: z.string(),
|
|
82
|
+
cooldown_reset_at: z.string(),
|
|
81
83
|
})),
|
|
82
84
|
});
|
|
83
85
|
const validateEmailVerificationCodeV0ResponseZ = APIOutputZ.extend({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
declare const
|
|
2
|
+
declare const CreateAnonymousGreetingV0ResponseZ: z.ZodObject<z.objectUtil.extendShape<{
|
|
3
3
|
data: z.ZodAny;
|
|
4
4
|
message: z.ZodNullable<z.ZodString>;
|
|
5
5
|
log: z.ZodAny;
|
|
@@ -73,5 +73,5 @@ declare const CreateGreetingV0ResponseZ: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
73
73
|
};
|
|
74
74
|
log?: any;
|
|
75
75
|
}>;
|
|
76
|
-
type
|
|
77
|
-
export {
|
|
76
|
+
type CreateAnonymousGreetingV0Response = z.infer<typeof CreateAnonymousGreetingV0ResponseZ>;
|
|
77
|
+
export { CreateAnonymousGreetingV0ResponseZ, CreateAnonymousGreetingV0Response, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { APIOutputZ } from "squarecommons";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
const
|
|
3
|
+
const CreateAnonymousGreetingV0ResponseZ = APIOutputZ.extend({
|
|
4
4
|
data: z.strictObject({
|
|
5
5
|
main: z.array(z.strictObject({
|
|
6
6
|
greeting_anonymous_sender_name: z.string().nullable(),
|
|
@@ -12,4 +12,4 @@ const CreateGreetingV0ResponseZ = APIOutputZ.extend({
|
|
|
12
12
|
})),
|
|
13
13
|
}),
|
|
14
14
|
});
|
|
15
|
-
export {
|
|
15
|
+
export { CreateAnonymousGreetingV0ResponseZ, };
|
package/example.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GreetingCommonBL, AuthenticationCommonBL } from "./dist/index.js";
|
|
2
2
|
|
|
3
3
|
let greetingCommonBL = new GreetingCommonBL();
|
|
4
|
-
console.log(await greetingCommonBL.
|
|
4
|
+
console.log(await greetingCommonBL.createAnonymousGreetingV0(true));
|
|
5
5
|
|
|
6
6
|
let authenticationCommonBL = new AuthenticationCommonBL();
|
|
7
7
|
|