@floristcloud/api-lib 1.2.48 → 1.2.50
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/integration/moysklad/enable-moysklad.command.js +6 -1
- package/build/commands/integration/moysklad/get-moysklad-status.query.js +3 -2
- package/build/commands/integration/moysklad/index.js +1 -0
- package/build/commands/integration/moysklad/sync-moysklad-supplier-orders.command.js +17 -0
- package/build/commands/notification/index.js +1 -0
- package/build/commands/notification/send-chat-message-to-client-s2s.command.js +23 -0
- package/build/constant/error.js +10 -0
- package/build/enum/external-entity-type.enum.js +2 -0
- package/build/enum/index.js +1 -0
- package/build/enum/moysklad-sync-status.enum.js +14 -0
- package/build/enum/notification-type.enum.js +1 -0
- package/commands/integration/moysklad/enable-moysklad.command.ts +6 -1
- package/commands/integration/moysklad/get-moysklad-status.query.ts +3 -2
- package/commands/integration/moysklad/index.ts +1 -0
- package/commands/integration/moysklad/sync-moysklad-supplier-orders.command.ts +16 -0
- package/commands/notification/index.ts +1 -0
- package/commands/notification/send-chat-message-to-client-s2s.command.ts +25 -0
- package/constant/error.ts +10 -0
- package/enum/external-entity-type.enum.ts +2 -0
- package/enum/index.ts +1 -0
- package/enum/moysklad-sync-status.enum.ts +10 -0
- package/enum/notification-type.enum.ts +1 -0
- package/package.json +1 -1
|
@@ -6,9 +6,14 @@ const consignment_import_name_convention_enum_1 = require("../../../enum/consign
|
|
|
6
6
|
const EnableMoyskladRequestSchema = zod_1.z.object({
|
|
7
7
|
defaultOrgId: zod_1.z.string().min(1),
|
|
8
8
|
defaultStoreId: zod_1.z.string().min(1),
|
|
9
|
-
nameProcessingConvention: zod_1.z
|
|
9
|
+
nameProcessingConvention: zod_1.z
|
|
10
|
+
.nativeEnum(consignment_import_name_convention_enum_1.ConsignmentImportNameConventionEnum)
|
|
11
|
+
.nullable()
|
|
12
|
+
.optional()
|
|
13
|
+
.default(consignment_import_name_convention_enum_1.ConsignmentImportNameConventionEnum.INVOICE_V1),
|
|
10
14
|
isRemoveSizeFromName: zod_1.z.boolean().optional().default(true),
|
|
11
15
|
isCutCategoryFromName: zod_1.z.boolean().optional().default(true),
|
|
16
|
+
isSupplierOrderSyncEnabled: zod_1.z.boolean().optional().default(false),
|
|
12
17
|
});
|
|
13
18
|
const EnableMoyskladResponseSchema = zod_1.z.object({
|
|
14
19
|
message: zod_1.z.string().optional(),
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GetMoyskladStatusContractQuery = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const consignment_import_name_convention_enum_1 = require("../../../enum/consignment-import-name-convention.enum");
|
|
6
|
+
const moysklad_sync_status_enum_1 = require("../../../enum/moysklad-sync-status.enum");
|
|
6
7
|
const order_state_mapping_schema_1 = require("./order-state-mapping.schema");
|
|
7
8
|
const GetMoyskladStatusResponseSchema = zod_1.z.object({
|
|
8
9
|
message: zod_1.z.string().optional(),
|
|
@@ -18,7 +19,7 @@ const GetMoyskladStatusResponseSchema = zod_1.z.object({
|
|
|
18
19
|
isRemoveSizeFromName: zod_1.z.boolean(),
|
|
19
20
|
isCutCategoryFromName: zod_1.z.boolean(),
|
|
20
21
|
lastStockSyncedAt: zod_1.z.string().datetime().nullable(),
|
|
21
|
-
stockSyncStatus: zod_1.z.
|
|
22
|
+
stockSyncStatus: zod_1.z.nativeEnum(moysklad_sync_status_enum_1.MoyskladSyncStatusEnum),
|
|
22
23
|
stockSyncDeadInfo: zod_1.z
|
|
23
24
|
.object({
|
|
24
25
|
errorCode: zod_1.z.string(),
|
|
@@ -26,7 +27,7 @@ const GetMoyskladStatusResponseSchema = zod_1.z.object({
|
|
|
26
27
|
})
|
|
27
28
|
.nullable(),
|
|
28
29
|
hasAdminToken: zod_1.z.boolean(),
|
|
29
|
-
quickRefreshStatus: zod_1.z.
|
|
30
|
+
quickRefreshStatus: zod_1.z.nativeEnum(moysklad_sync_status_enum_1.MoyskladSyncStatusEnum),
|
|
30
31
|
quickRefreshDeadInfo: zod_1.z
|
|
31
32
|
.object({
|
|
32
33
|
errorCode: zod_1.z.string(),
|
|
@@ -27,6 +27,7 @@ __exportStar(require("./execute-moysklad-clients-import.command"), exports);
|
|
|
27
27
|
__exportStar(require("./get-order-sync-status.query"), exports);
|
|
28
28
|
__exportStar(require("./get-orders-batch-sync-status.query"), exports);
|
|
29
29
|
__exportStar(require("./sync-moysklad-stock.command"), exports);
|
|
30
|
+
__exportStar(require("./sync-moysklad-supplier-orders.command"), exports);
|
|
30
31
|
__exportStar(require("./retry-moysklad-order-sync.command"), exports);
|
|
31
32
|
__exportStar(require("./get-moysklad-order-states.query"), exports);
|
|
32
33
|
__exportStar(require("./update-moysklad-order-state-mapping.command"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SyncMoyskladSupplierOrdersContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const moysklad_sync_status_enum_1 = require("../../../enum/moysklad-sync-status.enum");
|
|
6
|
+
const SyncMoyskladSupplierOrdersResponseSchema = zod_1.z.object({
|
|
7
|
+
message: zod_1.z.string().optional(),
|
|
8
|
+
data: zod_1.z.object({
|
|
9
|
+
jobUUID: zod_1.z.string().uuid(),
|
|
10
|
+
status: zod_1.z.nativeEnum(moysklad_sync_status_enum_1.MoyskladSyncStatusEnum),
|
|
11
|
+
wasAlreadyQueued: zod_1.z.boolean(),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
14
|
+
var SyncMoyskladSupplierOrdersContractCommand;
|
|
15
|
+
(function (SyncMoyskladSupplierOrdersContractCommand) {
|
|
16
|
+
SyncMoyskladSupplierOrdersContractCommand.ResponseSchema = SyncMoyskladSupplierOrdersResponseSchema;
|
|
17
|
+
})(SyncMoyskladSupplierOrdersContractCommand || (exports.SyncMoyskladSupplierOrdersContractCommand = SyncMoyskladSupplierOrdersContractCommand = {}));
|
|
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./send-staff-notification-s2s.command"), exports);
|
|
18
|
+
__exportStar(require("./send-chat-message-to-client-s2s.command"), exports);
|
|
18
19
|
__exportStar(require("./get-notifications-status.query"), exports);
|
|
19
20
|
__exportStar(require("./get-notifications-by-order.query"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SendChatMessageToClientS2SContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const SendChatMessageToClientS2SRequestSchema = zod_1.z.object({
|
|
6
|
+
companyUUID: zod_1.z.string().uuid(),
|
|
7
|
+
recipientUserUUID: zod_1.z.string().uuid(),
|
|
8
|
+
chatId: zod_1.z.string().min(1),
|
|
9
|
+
unreadCount: zod_1.z.number().int().nonnegative().optional(),
|
|
10
|
+
});
|
|
11
|
+
const SendChatMessageToClientS2SResponseSchema = zod_1.z.object({
|
|
12
|
+
data: zod_1.z
|
|
13
|
+
.object({
|
|
14
|
+
notificationUUID: zod_1.z.string().uuid().optional(),
|
|
15
|
+
skipped: zod_1.z.boolean().optional(),
|
|
16
|
+
})
|
|
17
|
+
.optional(),
|
|
18
|
+
});
|
|
19
|
+
var SendChatMessageToClientS2SContractCommand;
|
|
20
|
+
(function (SendChatMessageToClientS2SContractCommand) {
|
|
21
|
+
SendChatMessageToClientS2SContractCommand.RequestSchema = SendChatMessageToClientS2SRequestSchema;
|
|
22
|
+
SendChatMessageToClientS2SContractCommand.ResponseSchema = SendChatMessageToClientS2SResponseSchema;
|
|
23
|
+
})(SendChatMessageToClientS2SContractCommand || (exports.SendChatMessageToClientS2SContractCommand = SendChatMessageToClientS2SContractCommand = {}));
|
package/build/constant/error.js
CHANGED
|
@@ -1077,6 +1077,16 @@ exports.ERRORS = {
|
|
|
1077
1077
|
message: 'MoySklad order state UUID is not present in the integration account',
|
|
1078
1078
|
httpCode: 400,
|
|
1079
1079
|
},
|
|
1080
|
+
MOYSKLAD_SUPPLIER_ORDER_SYNC_DISABLED: {
|
|
1081
|
+
code: 'MS020',
|
|
1082
|
+
message: 'MoySklad supplier-order sync is disabled for this company',
|
|
1083
|
+
httpCode: 409,
|
|
1084
|
+
},
|
|
1085
|
+
MOYSKLAD_SUPPLIER_ORDER_SYNC_LOCK_BUSY: {
|
|
1086
|
+
code: 'MS021',
|
|
1087
|
+
message: 'MoySklad sync lock is held by another job for this company; will retry shortly',
|
|
1088
|
+
httpCode: 409,
|
|
1089
|
+
},
|
|
1080
1090
|
// 1C COMMERCEML INTEGRATION
|
|
1081
1091
|
ONE_C_NOT_CONNECTED: { code: 'OC001', message: '1C integration is not connected for this company', httpCode: 404 },
|
|
1082
1092
|
ONE_C_CONNECT_FAILED: { code: 'OC002', message: 'Failed to connect 1C integration', httpCode: 500 },
|
|
@@ -7,4 +7,6 @@ var ExternalEntityTypeEnum;
|
|
|
7
7
|
ExternalEntityTypeEnum["CATEGORY"] = "CATEGORY";
|
|
8
8
|
ExternalEntityTypeEnum["CLIENT"] = "CLIENT";
|
|
9
9
|
ExternalEntityTypeEnum["ORDER"] = "ORDER";
|
|
10
|
+
ExternalEntityTypeEnum["SUPPLIER_ORDER"] = "SUPPLIER_ORDER";
|
|
11
|
+
ExternalEntityTypeEnum["SUPPLIER_ORDER_POSITION"] = "SUPPLIER_ORDER_POSITION";
|
|
10
12
|
})(ExternalEntityTypeEnum || (exports.ExternalEntityTypeEnum = ExternalEntityTypeEnum = {}));
|
package/build/enum/index.js
CHANGED
|
@@ -95,3 +95,4 @@ __exportStar(require("./account-deletion-request-status.enum"), exports);
|
|
|
95
95
|
__exportStar(require("./account-deletion-request-source.enum"), exports);
|
|
96
96
|
__exportStar(require("./bulk-create-product-image-alias-skip-reason.enum"), exports);
|
|
97
97
|
__exportStar(require("./bulk-create-product-image-alias-from-pre-order-collection-item-skip-reason.enum"), exports);
|
|
98
|
+
__exportStar(require("./moysklad-sync-status.enum"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MoyskladSyncStatusEnum = void 0;
|
|
4
|
+
// Lifecycle status of a MoySklad background sync (stock-sync, quick-refresh,
|
|
5
|
+
// supplier-order sync) as surfaced to the client. PENDING/RUNNING mirror an active
|
|
6
|
+
// OutboundSyncJob; DEAD is the latest failed job with no active one; IDLE means no
|
|
7
|
+
// history. Force-refresh responses only ever carry PENDING/RUNNING.
|
|
8
|
+
var MoyskladSyncStatusEnum;
|
|
9
|
+
(function (MoyskladSyncStatusEnum) {
|
|
10
|
+
MoyskladSyncStatusEnum["PENDING"] = "PENDING";
|
|
11
|
+
MoyskladSyncStatusEnum["RUNNING"] = "RUNNING";
|
|
12
|
+
MoyskladSyncStatusEnum["DEAD"] = "DEAD";
|
|
13
|
+
MoyskladSyncStatusEnum["IDLE"] = "IDLE";
|
|
14
|
+
})(MoyskladSyncStatusEnum || (exports.MoyskladSyncStatusEnum = MoyskladSyncStatusEnum = {}));
|
|
@@ -9,6 +9,7 @@ var NotificationTypeEnum;
|
|
|
9
9
|
NotificationTypeEnum["CART_EXPIRATION"] = "CART_EXPIRATION";
|
|
10
10
|
NotificationTypeEnum["WRITE_OFF_REJECTED"] = "WRITE_OFF_REJECTED";
|
|
11
11
|
NotificationTypeEnum["CLIENT_MESSAGE_TO_EMPLOYEE"] = "CLIENT_MESSAGE_TO_EMPLOYEE";
|
|
12
|
+
NotificationTypeEnum["CHAT_MESSAGE_TO_CLIENT"] = "CHAT_MESSAGE_TO_CLIENT";
|
|
12
13
|
NotificationTypeEnum["PASSWORD_CHANGED"] = "PASSWORD_CHANGED";
|
|
13
14
|
NotificationTypeEnum["ACCOUNT_DELETION_REQUEST_CREATED"] = "ACCOUNT_DELETION_REQUEST_CREATED";
|
|
14
15
|
NotificationTypeEnum["ACCOUNT_DELETION_REQUEST_APPROVED"] = "ACCOUNT_DELETION_REQUEST_APPROVED";
|
|
@@ -4,9 +4,14 @@ import { ConsignmentImportNameConventionEnum } from '../../../enum/consignment-i
|
|
|
4
4
|
const EnableMoyskladRequestSchema = z.object({
|
|
5
5
|
defaultOrgId: z.string().min(1),
|
|
6
6
|
defaultStoreId: z.string().min(1),
|
|
7
|
-
nameProcessingConvention: z
|
|
7
|
+
nameProcessingConvention: z
|
|
8
|
+
.nativeEnum(ConsignmentImportNameConventionEnum)
|
|
9
|
+
.nullable()
|
|
10
|
+
.optional()
|
|
11
|
+
.default(ConsignmentImportNameConventionEnum.INVOICE_V1),
|
|
8
12
|
isRemoveSizeFromName: z.boolean().optional().default(true),
|
|
9
13
|
isCutCategoryFromName: z.boolean().optional().default(true),
|
|
14
|
+
isSupplierOrderSyncEnabled: z.boolean().optional().default(false),
|
|
10
15
|
});
|
|
11
16
|
|
|
12
17
|
const EnableMoyskladResponseSchema = z.object({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ConsignmentImportNameConventionEnum } from '../../../enum/consignment-import-name-convention.enum';
|
|
3
|
+
import { MoyskladSyncStatusEnum } from '../../../enum/moysklad-sync-status.enum';
|
|
3
4
|
import { MoyskladOrderStateMappingSchema } from './order-state-mapping.schema';
|
|
4
5
|
|
|
5
6
|
const GetMoyskladStatusResponseSchema = z.object({
|
|
@@ -16,7 +17,7 @@ const GetMoyskladStatusResponseSchema = z.object({
|
|
|
16
17
|
isRemoveSizeFromName: z.boolean(),
|
|
17
18
|
isCutCategoryFromName: z.boolean(),
|
|
18
19
|
lastStockSyncedAt: z.string().datetime().nullable(),
|
|
19
|
-
stockSyncStatus: z.
|
|
20
|
+
stockSyncStatus: z.nativeEnum(MoyskladSyncStatusEnum),
|
|
20
21
|
stockSyncDeadInfo: z
|
|
21
22
|
.object({
|
|
22
23
|
errorCode: z.string(),
|
|
@@ -24,7 +25,7 @@ const GetMoyskladStatusResponseSchema = z.object({
|
|
|
24
25
|
})
|
|
25
26
|
.nullable(),
|
|
26
27
|
hasAdminToken: z.boolean(),
|
|
27
|
-
quickRefreshStatus: z.
|
|
28
|
+
quickRefreshStatus: z.nativeEnum(MoyskladSyncStatusEnum),
|
|
28
29
|
quickRefreshDeadInfo: z
|
|
29
30
|
.object({
|
|
30
31
|
errorCode: z.string(),
|
|
@@ -11,6 +11,7 @@ export * from './execute-moysklad-clients-import.command';
|
|
|
11
11
|
export * from './get-order-sync-status.query';
|
|
12
12
|
export * from './get-orders-batch-sync-status.query';
|
|
13
13
|
export * from './sync-moysklad-stock.command';
|
|
14
|
+
export * from './sync-moysklad-supplier-orders.command';
|
|
14
15
|
export * from './retry-moysklad-order-sync.command';
|
|
15
16
|
export * from './get-moysklad-order-states.query';
|
|
16
17
|
export * from './update-moysklad-order-state-mapping.command';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MoyskladSyncStatusEnum } from '../../../enum/moysklad-sync-status.enum';
|
|
3
|
+
|
|
4
|
+
const SyncMoyskladSupplierOrdersResponseSchema = z.object({
|
|
5
|
+
message: z.string().optional(),
|
|
6
|
+
data: z.object({
|
|
7
|
+
jobUUID: z.string().uuid(),
|
|
8
|
+
status: z.nativeEnum(MoyskladSyncStatusEnum),
|
|
9
|
+
wasAlreadyQueued: z.boolean(),
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export namespace SyncMoyskladSupplierOrdersContractCommand {
|
|
14
|
+
export const ResponseSchema = SyncMoyskladSupplierOrdersResponseSchema;
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const SendChatMessageToClientS2SRequestSchema = z.object({
|
|
4
|
+
companyUUID: z.string().uuid(),
|
|
5
|
+
recipientUserUUID: z.string().uuid(),
|
|
6
|
+
chatId: z.string().min(1),
|
|
7
|
+
unreadCount: z.number().int().nonnegative().optional(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const SendChatMessageToClientS2SResponseSchema = z.object({
|
|
11
|
+
data: z
|
|
12
|
+
.object({
|
|
13
|
+
notificationUUID: z.string().uuid().optional(),
|
|
14
|
+
skipped: z.boolean().optional(),
|
|
15
|
+
})
|
|
16
|
+
.optional(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export namespace SendChatMessageToClientS2SContractCommand {
|
|
20
|
+
export const RequestSchema = SendChatMessageToClientS2SRequestSchema;
|
|
21
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
22
|
+
|
|
23
|
+
export const ResponseSchema = SendChatMessageToClientS2SResponseSchema;
|
|
24
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
25
|
+
}
|
package/constant/error.ts
CHANGED
|
@@ -1137,6 +1137,16 @@ export const ERRORS = {
|
|
|
1137
1137
|
message: 'MoySklad order state UUID is not present in the integration account',
|
|
1138
1138
|
httpCode: 400,
|
|
1139
1139
|
},
|
|
1140
|
+
MOYSKLAD_SUPPLIER_ORDER_SYNC_DISABLED: {
|
|
1141
|
+
code: 'MS020',
|
|
1142
|
+
message: 'MoySklad supplier-order sync is disabled for this company',
|
|
1143
|
+
httpCode: 409,
|
|
1144
|
+
},
|
|
1145
|
+
MOYSKLAD_SUPPLIER_ORDER_SYNC_LOCK_BUSY: {
|
|
1146
|
+
code: 'MS021',
|
|
1147
|
+
message: 'MoySklad sync lock is held by another job for this company; will retry shortly',
|
|
1148
|
+
httpCode: 409,
|
|
1149
|
+
},
|
|
1140
1150
|
|
|
1141
1151
|
// 1C COMMERCEML INTEGRATION
|
|
1142
1152
|
ONE_C_NOT_CONNECTED: { code: 'OC001', message: '1C integration is not connected for this company', httpCode: 404 },
|
package/enum/index.ts
CHANGED
|
@@ -79,3 +79,4 @@ export * from './account-deletion-request-status.enum';
|
|
|
79
79
|
export * from './account-deletion-request-source.enum';
|
|
80
80
|
export * from './bulk-create-product-image-alias-skip-reason.enum';
|
|
81
81
|
export * from './bulk-create-product-image-alias-from-pre-order-collection-item-skip-reason.enum';
|
|
82
|
+
export * from './moysklad-sync-status.enum';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Lifecycle status of a MoySklad background sync (stock-sync, quick-refresh,
|
|
2
|
+
// supplier-order sync) as surfaced to the client. PENDING/RUNNING mirror an active
|
|
3
|
+
// OutboundSyncJob; DEAD is the latest failed job with no active one; IDLE means no
|
|
4
|
+
// history. Force-refresh responses only ever carry PENDING/RUNNING.
|
|
5
|
+
export enum MoyskladSyncStatusEnum {
|
|
6
|
+
PENDING = 'PENDING',
|
|
7
|
+
RUNNING = 'RUNNING',
|
|
8
|
+
DEAD = 'DEAD',
|
|
9
|
+
IDLE = 'IDLE',
|
|
10
|
+
}
|
|
@@ -5,6 +5,7 @@ export enum NotificationTypeEnum {
|
|
|
5
5
|
CART_EXPIRATION = 'CART_EXPIRATION',
|
|
6
6
|
WRITE_OFF_REJECTED = 'WRITE_OFF_REJECTED',
|
|
7
7
|
CLIENT_MESSAGE_TO_EMPLOYEE = 'CLIENT_MESSAGE_TO_EMPLOYEE',
|
|
8
|
+
CHAT_MESSAGE_TO_CLIENT = 'CHAT_MESSAGE_TO_CLIENT',
|
|
8
9
|
PASSWORD_CHANGED = 'PASSWORD_CHANGED',
|
|
9
10
|
ACCOUNT_DELETION_REQUEST_CREATED = 'ACCOUNT_DELETION_REQUEST_CREATED',
|
|
10
11
|
ACCOUNT_DELETION_REQUEST_APPROVED = 'ACCOUNT_DELETION_REQUEST_APPROVED',
|