@floristcloud/api-lib 1.2.27 → 1.2.28
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/index.js +1 -0
- package/build/commands/integration/one-c/connect-one-c.command.js +15 -0
- package/build/commands/integration/one-c/disconnect-one-c.command.js +14 -0
- package/build/commands/integration/one-c/get-one-c-status.query.js +18 -0
- package/build/commands/integration/one-c/index.js +20 -0
- package/build/commands/integration/one-c/rotate-one-c-password.command.js +15 -0
- package/build/commands/order-product/group/update-group-order-product-order.command.js +8 -4
- package/build/constant/error.js +16 -0
- package/build/enum/action-log-type.enum.js +1 -0
- package/build/enum/integration-provider.enum.js +1 -0
- package/build/schemas/consignment/consignment.schema.js +0 -1
- package/build/schemas/order/order.schema.js +0 -1
- package/build/schemas/product/product.schema.js +0 -1
- package/commands/integration/index.ts +1 -1
- package/commands/integration/one-c/connect-one-c.command.ts +14 -0
- package/commands/integration/one-c/disconnect-one-c.command.ts +13 -0
- package/commands/integration/one-c/get-one-c-status.query.ts +17 -0
- package/commands/integration/one-c/index.ts +4 -0
- package/commands/integration/one-c/rotate-one-c-password.command.ts +14 -0
- package/commands/order-product/group/update-group-order-product-order.command.ts +11 -6
- package/constant/error.ts +17 -0
- package/enum/action-log-type.enum.ts +1 -0
- package/enum/integration-provider.enum.ts +1 -0
- package/package.json +1 -1
- package/schemas/consignment/consignment.schema.ts +0 -1
- package/schemas/order/order.schema.ts +0 -1
- package/schemas/product/product.schema.ts +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConnectOneCContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ConnectOneCResponseSchema = zod_1.z.object({
|
|
6
|
+
message: zod_1.z.string().optional(),
|
|
7
|
+
data: zod_1.z.object({
|
|
8
|
+
username: zod_1.z.string(),
|
|
9
|
+
password: zod_1.z.string(),
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
var ConnectOneCContractCommand;
|
|
13
|
+
(function (ConnectOneCContractCommand) {
|
|
14
|
+
ConnectOneCContractCommand.ResponseSchema = ConnectOneCResponseSchema;
|
|
15
|
+
})(ConnectOneCContractCommand || (exports.ConnectOneCContractCommand = ConnectOneCContractCommand = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DisconnectOneCContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const DisconnectOneCResponseSchema = zod_1.z.object({
|
|
6
|
+
message: zod_1.z.string().optional(),
|
|
7
|
+
data: zod_1.z.object({
|
|
8
|
+
success: zod_1.z.literal(true),
|
|
9
|
+
}),
|
|
10
|
+
});
|
|
11
|
+
var DisconnectOneCContractCommand;
|
|
12
|
+
(function (DisconnectOneCContractCommand) {
|
|
13
|
+
DisconnectOneCContractCommand.ResponseSchema = DisconnectOneCResponseSchema;
|
|
14
|
+
})(DisconnectOneCContractCommand || (exports.DisconnectOneCContractCommand = DisconnectOneCContractCommand = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetOneCStatusContractQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const GetOneCStatusResponseSchema = zod_1.z.object({
|
|
6
|
+
message: zod_1.z.string().optional(),
|
|
7
|
+
data: zod_1.z.object({
|
|
8
|
+
isConnected: zod_1.z.boolean(),
|
|
9
|
+
isEnabled: zod_1.z.boolean(),
|
|
10
|
+
username: zod_1.z.string().nullable(),
|
|
11
|
+
lastCheckauthAt: zod_1.z.string().datetime().nullable(),
|
|
12
|
+
lastSyncAt: zod_1.z.string().datetime().nullable(),
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
var GetOneCStatusContractQuery;
|
|
16
|
+
(function (GetOneCStatusContractQuery) {
|
|
17
|
+
GetOneCStatusContractQuery.ResponseSchema = GetOneCStatusResponseSchema;
|
|
18
|
+
})(GetOneCStatusContractQuery || (exports.GetOneCStatusContractQuery = GetOneCStatusContractQuery = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./connect-one-c.command"), exports);
|
|
18
|
+
__exportStar(require("./rotate-one-c-password.command"), exports);
|
|
19
|
+
__exportStar(require("./disconnect-one-c.command"), exports);
|
|
20
|
+
__exportStar(require("./get-one-c-status.query"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RotateOneCPasswordContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const RotateOneCPasswordResponseSchema = zod_1.z.object({
|
|
6
|
+
message: zod_1.z.string().optional(),
|
|
7
|
+
data: zod_1.z.object({
|
|
8
|
+
username: zod_1.z.string(),
|
|
9
|
+
password: zod_1.z.string(),
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
var RotateOneCPasswordContractCommand;
|
|
13
|
+
(function (RotateOneCPasswordContractCommand) {
|
|
14
|
+
RotateOneCPasswordContractCommand.ResponseSchema = RotateOneCPasswordResponseSchema;
|
|
15
|
+
})(RotateOneCPasswordContractCommand || (exports.RotateOneCPasswordContractCommand = RotateOneCPasswordContractCommand = {}));
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UpdateGroupOrderProductOrderContractCommand = void 0;
|
|
3
|
+
exports.UpdateGroupOrderProductOrderContractCommand = exports.BULK_MOVE_ORDER_PRODUCT_LIMIT = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
exports.BULK_MOVE_ORDER_PRODUCT_LIMIT = 200;
|
|
5
6
|
const UpdateGroupOrderProductOrderRequestSchema = zod_1.z.object({
|
|
6
|
-
orderProductUUIDList: zod_1.z
|
|
7
|
+
orderProductUUIDList: zod_1.z
|
|
8
|
+
.array(zod_1.z.object({
|
|
7
9
|
uuid: zod_1.z.string(),
|
|
8
|
-
quantity: zod_1.z.coerce.number(),
|
|
9
|
-
}))
|
|
10
|
+
quantity: zod_1.z.coerce.number().int().positive(),
|
|
11
|
+
}))
|
|
12
|
+
.min(1)
|
|
13
|
+
.max(exports.BULK_MOVE_ORDER_PRODUCT_LIMIT),
|
|
10
14
|
newOrderUUID: zod_1.z.uuid(),
|
|
11
15
|
isDelete: zod_1.z.coerce.boolean().optional().default(true),
|
|
12
16
|
isComment: zod_1.z.coerce.boolean().optional().default(true),
|
package/build/constant/error.js
CHANGED
|
@@ -430,6 +430,16 @@ exports.ERRORS = {
|
|
|
430
430
|
message: 'Another bulk operation on this order is in progress, retry later',
|
|
431
431
|
httpCode: 409,
|
|
432
432
|
},
|
|
433
|
+
ORDER_PRODUCT_HAS_WRITE_OFF: {
|
|
434
|
+
code: 'OP019',
|
|
435
|
+
message: 'Cannot move order-product: it has a write-off attached',
|
|
436
|
+
httpCode: 400,
|
|
437
|
+
},
|
|
438
|
+
ORDER_MOVE_BULK_OPERATION_IN_PROGRESS: {
|
|
439
|
+
code: 'OP020',
|
|
440
|
+
message: 'Another bulk-move operation on this pair of orders is in progress, retry later',
|
|
441
|
+
httpCode: 409,
|
|
442
|
+
},
|
|
433
443
|
//TRANSACTION
|
|
434
444
|
TRANSACTION_NOT_CREATED: { code: 'TR001', message: 'Failed to transaction product', httpCode: 500 },
|
|
435
445
|
TRANSACTION_FETCH_FAILED: { code: 'TR002', message: 'Error when retrieving a transaction', httpCode: 500 },
|
|
@@ -1048,4 +1058,10 @@ exports.ERRORS = {
|
|
|
1048
1058
|
message: 'MoySklad integration is disabled for this company',
|
|
1049
1059
|
httpCode: 409,
|
|
1050
1060
|
},
|
|
1061
|
+
// 1C COMMERCEML INTEGRATION
|
|
1062
|
+
ONE_C_NOT_CONNECTED: { code: 'OC001', message: '1C integration is not connected for this company', httpCode: 404 },
|
|
1063
|
+
ONE_C_CONNECT_FAILED: { code: 'OC002', message: 'Failed to connect 1C integration', httpCode: 500 },
|
|
1064
|
+
ONE_C_INVALID_CREDENTIALS: { code: 'OC003', message: '1C credentials are invalid', httpCode: 401 },
|
|
1065
|
+
ONE_C_INTEGRATION_DISABLED: { code: 'OC004', message: '1C integration is disabled for this company', httpCode: 409 },
|
|
1066
|
+
ONE_C_SESSION_INVALID: { code: 'OC005', message: '1C session is missing or expired', httpCode: 401 },
|
|
1051
1067
|
};
|
|
@@ -9,6 +9,7 @@ var ActionLogTypeEnum;
|
|
|
9
9
|
ActionLogTypeEnum["DELETE_ORDER"] = "DELETE_ORDER";
|
|
10
10
|
ActionLogTypeEnum["DELETE_ORDER_ITEM"] = "DELETE_ORDER_ITEM";
|
|
11
11
|
ActionLogTypeEnum["UPDATE_ORDER_ITEM"] = "UPDATE_ORDER_ITEM";
|
|
12
|
+
ActionLogTypeEnum["MOVE_ORDER_ITEM"] = "MOVE_ORDER_ITEM";
|
|
12
13
|
ActionLogTypeEnum["ADD_PAYMENT"] = "ADD_PAYMENT";
|
|
13
14
|
ActionLogTypeEnum["DELETE_PAYMENT"] = "DELETE_PAYMENT";
|
|
14
15
|
ActionLogTypeEnum["CREATE_PREORDER"] = "CREATE_PREORDER";
|
|
@@ -4,4 +4,5 @@ exports.IntegrationProviderEnum = void 0;
|
|
|
4
4
|
var IntegrationProviderEnum;
|
|
5
5
|
(function (IntegrationProviderEnum) {
|
|
6
6
|
IntegrationProviderEnum["MOYSKLAD"] = "MOYSKLAD";
|
|
7
|
+
IntegrationProviderEnum["ONE_C"] = "ONE_C";
|
|
7
8
|
})(IntegrationProviderEnum || (exports.IntegrationProviderEnum = IntegrationProviderEnum = {}));
|
|
@@ -15,7 +15,6 @@ exports.ConsignmentSchema = zod_1.z.object({
|
|
|
15
15
|
isInStock: zod_1.z.boolean(),
|
|
16
16
|
status: zod_1.z.nativeEnum(enum_1.ConsignmentStatusEnum),
|
|
17
17
|
url: zod_1.z.string().nullable(),
|
|
18
|
-
isWithSync: zod_1.z.boolean(),
|
|
19
18
|
createdAt: zod_1.z.date(),
|
|
20
19
|
updatedAt: zod_1.z.date(),
|
|
21
20
|
deletedAt: zod_1.z.date().nullable(),
|
|
@@ -13,7 +13,6 @@ exports.OrderSchema = zod_1.z.object({
|
|
|
13
13
|
clientUUID: zod_1.z.uuid(),
|
|
14
14
|
branchUUID: zod_1.z.uuid().nullable(),
|
|
15
15
|
creatorUserUUID: zod_1.z.uuid(),
|
|
16
|
-
isSync: zod_1.z.boolean(),
|
|
17
16
|
totalCost: zod_1.z.number(),
|
|
18
17
|
subtotal: zod_1.z.number(),
|
|
19
18
|
deliveryCost: zod_1.z.number(),
|
|
@@ -11,7 +11,6 @@ const discount_rules_schema_1 = require("../discount-rules/discount-rules.schema
|
|
|
11
11
|
const __1 = require("../..");
|
|
12
12
|
exports.ProductSchema = zod_1.z.object({
|
|
13
13
|
uuid: zod_1.z.uuid(),
|
|
14
|
-
dataSyncId: zod_1.z.string().nullable(),
|
|
15
14
|
consignmentUUID: zod_1.z.uuid(),
|
|
16
15
|
categoryUUID: zod_1.z.uuid().nullable(),
|
|
17
16
|
name: zod_1.z.string(),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const ConnectOneCResponseSchema = z.object({
|
|
4
|
+
message: z.string().optional(),
|
|
5
|
+
data: z.object({
|
|
6
|
+
username: z.string(),
|
|
7
|
+
password: z.string(),
|
|
8
|
+
}),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export namespace ConnectOneCContractCommand {
|
|
12
|
+
export const ResponseSchema = ConnectOneCResponseSchema;
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const DisconnectOneCResponseSchema = z.object({
|
|
4
|
+
message: z.string().optional(),
|
|
5
|
+
data: z.object({
|
|
6
|
+
success: z.literal(true),
|
|
7
|
+
}),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export namespace DisconnectOneCContractCommand {
|
|
11
|
+
export const ResponseSchema = DisconnectOneCResponseSchema;
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const GetOneCStatusResponseSchema = z.object({
|
|
4
|
+
message: z.string().optional(),
|
|
5
|
+
data: z.object({
|
|
6
|
+
isConnected: z.boolean(),
|
|
7
|
+
isEnabled: z.boolean(),
|
|
8
|
+
username: z.string().nullable(),
|
|
9
|
+
lastCheckauthAt: z.string().datetime().nullable(),
|
|
10
|
+
lastSyncAt: z.string().datetime().nullable(),
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export namespace GetOneCStatusContractQuery {
|
|
15
|
+
export const ResponseSchema = GetOneCStatusResponseSchema;
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const RotateOneCPasswordResponseSchema = z.object({
|
|
4
|
+
message: z.string().optional(),
|
|
5
|
+
data: z.object({
|
|
6
|
+
username: z.string(),
|
|
7
|
+
password: z.string(),
|
|
8
|
+
}),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export namespace RotateOneCPasswordContractCommand {
|
|
12
|
+
export const ResponseSchema = RotateOneCPasswordResponseSchema;
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
export const BULK_MOVE_ORDER_PRODUCT_LIMIT = 200;
|
|
4
|
+
|
|
3
5
|
const UpdateGroupOrderProductOrderRequestSchema = z.object({
|
|
4
|
-
orderProductUUIDList: z
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
orderProductUUIDList: z
|
|
7
|
+
.array(
|
|
8
|
+
z.object({
|
|
9
|
+
uuid: z.string(),
|
|
10
|
+
quantity: z.coerce.number().int().positive(),
|
|
11
|
+
}),
|
|
12
|
+
)
|
|
13
|
+
.min(1)
|
|
14
|
+
.max(BULK_MOVE_ORDER_PRODUCT_LIMIT),
|
|
10
15
|
newOrderUUID: z.uuid(),
|
|
11
16
|
isDelete: z.coerce.boolean().optional().default(true),
|
|
12
17
|
isComment: z.coerce.boolean().optional().default(true),
|
package/constant/error.ts
CHANGED
|
@@ -446,6 +446,16 @@ export const ERRORS = {
|
|
|
446
446
|
message: 'Another bulk operation on this order is in progress, retry later',
|
|
447
447
|
httpCode: 409,
|
|
448
448
|
},
|
|
449
|
+
ORDER_PRODUCT_HAS_WRITE_OFF: {
|
|
450
|
+
code: 'OP019',
|
|
451
|
+
message: 'Cannot move order-product: it has a write-off attached',
|
|
452
|
+
httpCode: 400,
|
|
453
|
+
},
|
|
454
|
+
ORDER_MOVE_BULK_OPERATION_IN_PROGRESS: {
|
|
455
|
+
code: 'OP020',
|
|
456
|
+
message: 'Another bulk-move operation on this pair of orders is in progress, retry later',
|
|
457
|
+
httpCode: 409,
|
|
458
|
+
},
|
|
449
459
|
|
|
450
460
|
//TRANSACTION
|
|
451
461
|
TRANSACTION_NOT_CREATED: { code: 'TR001', message: 'Failed to transaction product', httpCode: 500 },
|
|
@@ -1108,4 +1118,11 @@ export const ERRORS = {
|
|
|
1108
1118
|
message: 'MoySklad integration is disabled for this company',
|
|
1109
1119
|
httpCode: 409,
|
|
1110
1120
|
},
|
|
1121
|
+
|
|
1122
|
+
// 1C COMMERCEML INTEGRATION
|
|
1123
|
+
ONE_C_NOT_CONNECTED: { code: 'OC001', message: '1C integration is not connected for this company', httpCode: 404 },
|
|
1124
|
+
ONE_C_CONNECT_FAILED: { code: 'OC002', message: 'Failed to connect 1C integration', httpCode: 500 },
|
|
1125
|
+
ONE_C_INVALID_CREDENTIALS: { code: 'OC003', message: '1C credentials are invalid', httpCode: 401 },
|
|
1126
|
+
ONE_C_INTEGRATION_DISABLED: { code: 'OC004', message: '1C integration is disabled for this company', httpCode: 409 },
|
|
1127
|
+
ONE_C_SESSION_INVALID: { code: 'OC005', message: '1C session is missing or expired', httpCode: 401 },
|
|
1111
1128
|
} as const;
|
|
@@ -5,6 +5,7 @@ export enum ActionLogTypeEnum {
|
|
|
5
5
|
DELETE_ORDER = 'DELETE_ORDER',
|
|
6
6
|
DELETE_ORDER_ITEM = 'DELETE_ORDER_ITEM',
|
|
7
7
|
UPDATE_ORDER_ITEM = 'UPDATE_ORDER_ITEM',
|
|
8
|
+
MOVE_ORDER_ITEM = 'MOVE_ORDER_ITEM',
|
|
8
9
|
ADD_PAYMENT = 'ADD_PAYMENT',
|
|
9
10
|
DELETE_PAYMENT = 'DELETE_PAYMENT',
|
|
10
11
|
CREATE_PREORDER = 'CREATE_PREORDER',
|
package/package.json
CHANGED