@floristcloud/api-lib 1.2.3 → 1.2.5
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/build/commands/auth/get-available-channels.command.js +17 -0
- package/build/commands/auth/index.js +2 -0
- package/build/commands/auth/list-mobile-buyer-tenants-by-phone.command.js +20 -0
- package/build/commands/auth/restore-password-by-security-code.command.js +2 -0
- package/build/constant/error.js +7 -0
- package/build/enum/device-platform.enum.js +8 -0
- package/build/enum/index.js +1 -0
- package/build/enum/notification-channel.enum.js +3 -0
- package/commands/auth/get-available-channels.command.ts +19 -0
- package/commands/auth/index.ts +2 -0
- package/commands/auth/list-mobile-buyer-tenants-by-phone.command.ts +23 -0
- package/commands/auth/restore-password-by-security-code.command.ts +2 -0
- package/constant/error.ts +9 -0
- package/enum/device-platform.enum.ts +4 -0
- package/enum/index.ts +1 -0
- package/enum/notification-channel.enum.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetAvailableChannelsContractCommand = exports.GetAvailableChannelsResponseSchema = exports.GetAvailableChannelsRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const enum_1 = require("../../enum");
|
|
6
|
+
exports.GetAvailableChannelsRequestSchema = zod_1.z.object({
|
|
7
|
+
email: zod_1.z.email().toLowerCase().optional(),
|
|
8
|
+
phone: zod_1.z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
exports.GetAvailableChannelsResponseSchema = zod_1.z.object({
|
|
11
|
+
channels: zod_1.z.array(zod_1.z.nativeEnum(enum_1.NotificationChannelEnum)),
|
|
12
|
+
});
|
|
13
|
+
var GetAvailableChannelsContractCommand;
|
|
14
|
+
(function (GetAvailableChannelsContractCommand) {
|
|
15
|
+
GetAvailableChannelsContractCommand.RequestSchema = exports.GetAvailableChannelsRequestSchema;
|
|
16
|
+
GetAvailableChannelsContractCommand.ResponseSchema = exports.GetAvailableChannelsResponseSchema;
|
|
17
|
+
})(GetAvailableChannelsContractCommand || (exports.GetAvailableChannelsContractCommand = GetAvailableChannelsContractCommand = {}));
|
|
@@ -18,7 +18,9 @@ __exportStar(require("./register-user.command"), exports);
|
|
|
18
18
|
__exportStar(require("./reset-password-by-user.command"), exports);
|
|
19
19
|
__exportStar(require("./reset-password-by-admin.command"), exports);
|
|
20
20
|
__exportStar(require("./login-user.command"), exports);
|
|
21
|
+
__exportStar(require("./list-mobile-buyer-tenants-by-phone.command"), exports);
|
|
21
22
|
__exportStar(require("./reset-password-by-token.command"), exports);
|
|
22
23
|
__exportStar(require("./restore-password-by-security-code.command"), exports);
|
|
23
24
|
__exportStar(require("./reset-password-by-security-code.command"), exports);
|
|
24
25
|
__exportStar(require("./mobile-login-user.command"), exports);
|
|
26
|
+
__exportStar(require("./get-available-channels.command"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListMobileBuyerTenantsByPhoneContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ListMobileBuyerTenantsByPhoneRequestSchema = zod_1.z.object({
|
|
6
|
+
phone: zod_1.z.string().min(1),
|
|
7
|
+
});
|
|
8
|
+
const MobileBuyerTenantItemSchema = zod_1.z.object({
|
|
9
|
+
companyUUID: zod_1.z.uuid(),
|
|
10
|
+
displayName: zod_1.z.string(),
|
|
11
|
+
domain: zod_1.z.string().nullable(),
|
|
12
|
+
});
|
|
13
|
+
const ListMobileBuyerTenantsByPhoneResponseSchema = zod_1.z.object({
|
|
14
|
+
items: zod_1.z.array(MobileBuyerTenantItemSchema),
|
|
15
|
+
});
|
|
16
|
+
var ListMobileBuyerTenantsByPhoneContractCommand;
|
|
17
|
+
(function (ListMobileBuyerTenantsByPhoneContractCommand) {
|
|
18
|
+
ListMobileBuyerTenantsByPhoneContractCommand.RequestSchema = ListMobileBuyerTenantsByPhoneRequestSchema;
|
|
19
|
+
ListMobileBuyerTenantsByPhoneContractCommand.ResponseSchema = ListMobileBuyerTenantsByPhoneResponseSchema;
|
|
20
|
+
})(ListMobileBuyerTenantsByPhoneContractCommand || (exports.ListMobileBuyerTenantsByPhoneContractCommand = ListMobileBuyerTenantsByPhoneContractCommand = {}));
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RestorePasswordBySecurityCodeContractCommand = exports.RestorePasswordBySecurityCodeResponseSchema = exports.RestorePasswordBySecurityCodeRequestSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const enum_1 = require("../../enum");
|
|
5
6
|
exports.RestorePasswordBySecurityCodeRequestSchema = zod_1.z.object({
|
|
6
7
|
email: zod_1.z.email().toLowerCase().optional(),
|
|
7
8
|
phone: zod_1.z.string().optional(),
|
|
9
|
+
channel: zod_1.z.nativeEnum(enum_1.NotificationChannelEnum).optional(),
|
|
8
10
|
});
|
|
9
11
|
exports.RestorePasswordBySecurityCodeResponseSchema = zod_1.z.object({
|
|
10
12
|
message: zod_1.z.string().optional(),
|
package/build/constant/error.js
CHANGED
|
@@ -912,4 +912,11 @@ exports.ERRORS = {
|
|
|
912
912
|
MOBILE_RATE_LIMIT_EXCEEDED: { code: 'MOB002', message: 'Too many requests to mobile login endpoint', httpCode: 429 },
|
|
913
913
|
// UNIFIED AUTH (replaces separate USER_NOT_FOUND / INCORRECT_CREDENTIALS for login)
|
|
914
914
|
INVALID_CREDENTIALS: { code: 'AUTH001', message: 'Invalid credentials', httpCode: 401 },
|
|
915
|
+
// DEVICE TOKEN
|
|
916
|
+
DEVICE_TOKEN_NOT_CREATED: { code: 'DT001', message: 'Failed to register device token', httpCode: 500 },
|
|
917
|
+
DEVICE_TOKEN_NOT_FOUND: { code: 'DT002', message: 'Device token not found', httpCode: 404 },
|
|
918
|
+
DEVICE_TOKEN_NOT_DELETED: { code: 'DT003', message: 'Failed to delete device token', httpCode: 500 },
|
|
919
|
+
// PUSH NOTIFICATION
|
|
920
|
+
PUSH_NOTIFICATION_SEND_FAILED: { code: 'PN001', message: 'Failed to send push notification', httpCode: 500 },
|
|
921
|
+
PUSH_NOTIFICATION_NO_DEVICES: { code: 'PN002', message: 'No active devices found for user', httpCode: 404 },
|
|
915
922
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DevicePlatformEnum = void 0;
|
|
4
|
+
var DevicePlatformEnum;
|
|
5
|
+
(function (DevicePlatformEnum) {
|
|
6
|
+
DevicePlatformEnum["IOS"] = "IOS";
|
|
7
|
+
DevicePlatformEnum["ANDROID"] = "ANDROID";
|
|
8
|
+
})(DevicePlatformEnum || (exports.DevicePlatformEnum = DevicePlatformEnum = {}));
|
package/build/enum/index.js
CHANGED
|
@@ -80,3 +80,4 @@ __exportStar(require("./chat-has-manager-mode.enum"), exports);
|
|
|
80
80
|
__exportStar(require("./chat-no-manager-mode.enum"), exports);
|
|
81
81
|
__exportStar(require("./match-confidence.enum"), exports);
|
|
82
82
|
__exportStar(require("./session-platform.enum"), exports);
|
|
83
|
+
__exportStar(require("./device-platform.enum"), exports);
|
|
@@ -4,6 +4,8 @@ exports.NotificationChannelEnum = void 0;
|
|
|
4
4
|
var NotificationChannelEnum;
|
|
5
5
|
(function (NotificationChannelEnum) {
|
|
6
6
|
NotificationChannelEnum["MOBIZON_SMS"] = "MOBIZON_SMS";
|
|
7
|
+
NotificationChannelEnum["SMSPILOT_SMS"] = "SMSPILOT_SMS";
|
|
8
|
+
NotificationChannelEnum["SMSPILOT_FLASHCALL"] = "SMSPILOT_FLASHCALL";
|
|
7
9
|
NotificationChannelEnum["NOTISEND_VOICE"] = "NOTISEND_VOICE";
|
|
8
10
|
NotificationChannelEnum["NOTISEND_TG"] = "NOTISEND_TG";
|
|
9
11
|
NotificationChannelEnum["WHATSAPP"] = "WHATSAPP";
|
|
@@ -11,5 +13,6 @@ var NotificationChannelEnum;
|
|
|
11
13
|
NotificationChannelEnum["EMAIL"] = "EMAIL";
|
|
12
14
|
NotificationChannelEnum["TELEGRAM_BOT"] = "TELEGRAM_BOT";
|
|
13
15
|
NotificationChannelEnum["TELEGRAM_STAFF_BOT"] = "TELEGRAM_STAFF_BOT";
|
|
16
|
+
NotificationChannelEnum["MOBILE_PUSH"] = "MOBILE_PUSH";
|
|
14
17
|
NotificationChannelEnum["SYSTEM"] = "SYSTEM";
|
|
15
18
|
})(NotificationChannelEnum || (exports.NotificationChannelEnum = NotificationChannelEnum = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { NotificationChannelEnum } from '../../enum';
|
|
3
|
+
|
|
4
|
+
export const GetAvailableChannelsRequestSchema = z.object({
|
|
5
|
+
email: z.email().toLowerCase().optional(),
|
|
6
|
+
phone: z.string().optional(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const GetAvailableChannelsResponseSchema = z.object({
|
|
10
|
+
channels: z.array(z.nativeEnum(NotificationChannelEnum)),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export namespace GetAvailableChannelsContractCommand {
|
|
14
|
+
export const RequestSchema = GetAvailableChannelsRequestSchema;
|
|
15
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseSchema = GetAvailableChannelsResponseSchema;
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
package/commands/auth/index.ts
CHANGED
|
@@ -2,7 +2,9 @@ export * from './register-user.command';
|
|
|
2
2
|
export * from './reset-password-by-user.command';
|
|
3
3
|
export * from './reset-password-by-admin.command';
|
|
4
4
|
export * from './login-user.command';
|
|
5
|
+
export * from './list-mobile-buyer-tenants-by-phone.command';
|
|
5
6
|
export * from './reset-password-by-token.command';
|
|
6
7
|
export * from './restore-password-by-security-code.command';
|
|
7
8
|
export * from './reset-password-by-security-code.command';
|
|
8
9
|
export * from './mobile-login-user.command';
|
|
10
|
+
export * from './get-available-channels.command';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const ListMobileBuyerTenantsByPhoneRequestSchema = z.object({
|
|
4
|
+
phone: z.string().min(1),
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const MobileBuyerTenantItemSchema = z.object({
|
|
8
|
+
companyUUID: z.uuid(),
|
|
9
|
+
displayName: z.string(),
|
|
10
|
+
domain: z.string().nullable(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const ListMobileBuyerTenantsByPhoneResponseSchema = z.object({
|
|
14
|
+
items: z.array(MobileBuyerTenantItemSchema),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export namespace ListMobileBuyerTenantsByPhoneContractCommand {
|
|
18
|
+
export const RequestSchema = ListMobileBuyerTenantsByPhoneRequestSchema;
|
|
19
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
20
|
+
|
|
21
|
+
export const ResponseSchema = ListMobileBuyerTenantsByPhoneResponseSchema;
|
|
22
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
23
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { NotificationChannelEnum } from '../../enum';
|
|
2
3
|
|
|
3
4
|
export const RestorePasswordBySecurityCodeRequestSchema = z.object({
|
|
4
5
|
email: z.email().toLowerCase().optional(),
|
|
5
6
|
phone: z.string().optional(),
|
|
7
|
+
channel: z.nativeEnum(NotificationChannelEnum).optional(),
|
|
6
8
|
});
|
|
7
9
|
|
|
8
10
|
export const RestorePasswordBySecurityCodeResponseSchema = z.object({
|
package/constant/error.ts
CHANGED
|
@@ -968,4 +968,13 @@ export const ERRORS = {
|
|
|
968
968
|
|
|
969
969
|
// UNIFIED AUTH (replaces separate USER_NOT_FOUND / INCORRECT_CREDENTIALS for login)
|
|
970
970
|
INVALID_CREDENTIALS: { code: 'AUTH001', message: 'Invalid credentials', httpCode: 401 },
|
|
971
|
+
|
|
972
|
+
// DEVICE TOKEN
|
|
973
|
+
DEVICE_TOKEN_NOT_CREATED: { code: 'DT001', message: 'Failed to register device token', httpCode: 500 },
|
|
974
|
+
DEVICE_TOKEN_NOT_FOUND: { code: 'DT002', message: 'Device token not found', httpCode: 404 },
|
|
975
|
+
DEVICE_TOKEN_NOT_DELETED: { code: 'DT003', message: 'Failed to delete device token', httpCode: 500 },
|
|
976
|
+
|
|
977
|
+
// PUSH NOTIFICATION
|
|
978
|
+
PUSH_NOTIFICATION_SEND_FAILED: { code: 'PN001', message: 'Failed to send push notification', httpCode: 500 },
|
|
979
|
+
PUSH_NOTIFICATION_NO_DEVICES: { code: 'PN002', message: 'No active devices found for user', httpCode: 404 },
|
|
971
980
|
} as const;
|
package/enum/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export enum NotificationChannelEnum {
|
|
2
2
|
MOBIZON_SMS = 'MOBIZON_SMS',
|
|
3
|
+
SMSPILOT_SMS = 'SMSPILOT_SMS',
|
|
4
|
+
SMSPILOT_FLASHCALL = 'SMSPILOT_FLASHCALL',
|
|
3
5
|
NOTISEND_VOICE = 'NOTISEND_VOICE',
|
|
4
6
|
NOTISEND_TG = 'NOTISEND_TG',
|
|
5
7
|
WHATSAPP = 'WHATSAPP',
|
|
@@ -7,5 +9,6 @@ export enum NotificationChannelEnum {
|
|
|
7
9
|
EMAIL = 'EMAIL',
|
|
8
10
|
TELEGRAM_BOT = 'TELEGRAM_BOT',
|
|
9
11
|
TELEGRAM_STAFF_BOT = 'TELEGRAM_STAFF_BOT',
|
|
12
|
+
MOBILE_PUSH = 'MOBILE_PUSH',
|
|
10
13
|
SYSTEM = 'SYSTEM',
|
|
11
14
|
}
|