@floristcloud/api-lib 1.2.25 → 1.2.26
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/get-order-sync-status.query.js +38 -0
- package/build/commands/integration/moysklad/get-orders-batch-sync-status.query.js +24 -0
- package/build/commands/integration/moysklad/index.js +2 -0
- package/build/constant/error.js +0 -5
- package/build/enum/color-code.enum.js +36 -0
- package/build/enum/index.js +1 -0
- package/commands/integration/moysklad/get-order-sync-status.query.ts +41 -0
- package/commands/integration/moysklad/get-orders-batch-sync-status.query.ts +27 -0
- package/commands/integration/moysklad/index.ts +2 -0
- package/constant/error.ts +0 -5
- package/enum/color-code.enum.ts +32 -0
- package/enum/index.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetOrderSyncStatusContractQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const outbound_sync_intent_enum_1 = require("../../../enum/outbound-sync-intent.enum");
|
|
6
|
+
const PendingJobSchema = zod_1.z.object({
|
|
7
|
+
intent: zod_1.z.nativeEnum(outbound_sync_intent_enum_1.OutboundSyncIntentEnum),
|
|
8
|
+
attempts: zod_1.z.number().int().nonnegative(),
|
|
9
|
+
errorCode: zod_1.z.string().nullable(),
|
|
10
|
+
errorMessage: zod_1.z.string().nullable(),
|
|
11
|
+
nextAttemptAt: zod_1.z.string().datetime(),
|
|
12
|
+
});
|
|
13
|
+
const DeadJobSchema = zod_1.z.object({
|
|
14
|
+
intent: zod_1.z.nativeEnum(outbound_sync_intent_enum_1.OutboundSyncIntentEnum),
|
|
15
|
+
errorCode: zod_1.z.string(),
|
|
16
|
+
errorMessage: zod_1.z.string(),
|
|
17
|
+
});
|
|
18
|
+
const OrderSyncStatusSchema = zod_1.z.object({
|
|
19
|
+
orderUUID: zod_1.z.string().uuid(),
|
|
20
|
+
isLinked: zod_1.z.boolean(),
|
|
21
|
+
externalHref: zod_1.z.string().nullable(),
|
|
22
|
+
isClientLinked: zod_1.z.boolean(),
|
|
23
|
+
hasUnlinkedProducts: zod_1.z.boolean(),
|
|
24
|
+
missingProductUUIDs: zod_1.z.array(zod_1.z.string().uuid()),
|
|
25
|
+
lastSyncedAt: zod_1.z.string().datetime().nullable(),
|
|
26
|
+
pendingJob: PendingJobSchema.nullable(),
|
|
27
|
+
isDead: zod_1.z.boolean(),
|
|
28
|
+
deadJob: DeadJobSchema.nullable(),
|
|
29
|
+
});
|
|
30
|
+
const GetOrderSyncStatusResponseSchema = zod_1.z.object({
|
|
31
|
+
message: zod_1.z.string().optional(),
|
|
32
|
+
data: OrderSyncStatusSchema,
|
|
33
|
+
});
|
|
34
|
+
var GetOrderSyncStatusContractQuery;
|
|
35
|
+
(function (GetOrderSyncStatusContractQuery) {
|
|
36
|
+
GetOrderSyncStatusContractQuery.ResponseSchema = GetOrderSyncStatusResponseSchema;
|
|
37
|
+
GetOrderSyncStatusContractQuery.StatusSchema = OrderSyncStatusSchema;
|
|
38
|
+
})(GetOrderSyncStatusContractQuery || (exports.GetOrderSyncStatusContractQuery = GetOrderSyncStatusContractQuery = {}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetOrdersBatchSyncStatusContractQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const GetOrdersBatchSyncStatusRequestSchema = zod_1.z.object({
|
|
6
|
+
orderUUIDs: zod_1.z.array(zod_1.z.string().uuid()).min(1).max(200),
|
|
7
|
+
});
|
|
8
|
+
const OrderSyncStatusSlimSchema = zod_1.z.object({
|
|
9
|
+
orderUUID: zod_1.z.string().uuid(),
|
|
10
|
+
isLinked: zod_1.z.boolean(),
|
|
11
|
+
hasIssues: zod_1.z.boolean(),
|
|
12
|
+
});
|
|
13
|
+
const GetOrdersBatchSyncStatusResponseSchema = zod_1.z.object({
|
|
14
|
+
message: zod_1.z.string().optional(),
|
|
15
|
+
data: zod_1.z.object({
|
|
16
|
+
statuses: zod_1.z.array(OrderSyncStatusSlimSchema),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
var GetOrdersBatchSyncStatusContractQuery;
|
|
20
|
+
(function (GetOrdersBatchSyncStatusContractQuery) {
|
|
21
|
+
GetOrdersBatchSyncStatusContractQuery.RequestSchema = GetOrdersBatchSyncStatusRequestSchema;
|
|
22
|
+
GetOrdersBatchSyncStatusContractQuery.ResponseSchema = GetOrdersBatchSyncStatusResponseSchema;
|
|
23
|
+
GetOrdersBatchSyncStatusContractQuery.SlimStatusSchema = OrderSyncStatusSlimSchema;
|
|
24
|
+
})(GetOrdersBatchSyncStatusContractQuery || (exports.GetOrdersBatchSyncStatusContractQuery = GetOrdersBatchSyncStatusContractQuery = {}));
|
|
@@ -24,3 +24,5 @@ __exportStar(require("./scan-moysklad-import.query"), exports);
|
|
|
24
24
|
__exportStar(require("./execute-moysklad-import.command"), exports);
|
|
25
25
|
__exportStar(require("./scan-moysklad-clients-import.query"), exports);
|
|
26
26
|
__exportStar(require("./execute-moysklad-clients-import.command"), exports);
|
|
27
|
+
__exportStar(require("./get-order-sync-status.query"), exports);
|
|
28
|
+
__exportStar(require("./get-orders-batch-sync-status.query"), exports);
|
package/build/constant/error.js
CHANGED
|
@@ -1004,11 +1004,6 @@ exports.ERRORS = {
|
|
|
1004
1004
|
message: 'Order client has no MoySklad link; import clients first',
|
|
1005
1005
|
httpCode: 400,
|
|
1006
1006
|
},
|
|
1007
|
-
MOYSKLAD_ORDER_PRODUCT_NOT_LINKED: {
|
|
1008
|
-
code: 'MS012',
|
|
1009
|
-
message: 'One or more order products have no MoySklad link',
|
|
1010
|
-
httpCode: 400,
|
|
1011
|
-
},
|
|
1012
1007
|
MOYSKLAD_INTEGRATION_INCOMPLETE: {
|
|
1013
1008
|
code: 'MS013',
|
|
1014
1009
|
message: 'MoySklad integration is missing default organization or store',
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isColorCode = exports.COLOR_CODE_LIST = exports.ColorCodeEnum = void 0;
|
|
4
|
+
var ColorCodeEnum;
|
|
5
|
+
(function (ColorCodeEnum) {
|
|
6
|
+
ColorCodeEnum["RED"] = "red";
|
|
7
|
+
ColorCodeEnum["PINK"] = "pink";
|
|
8
|
+
ColorCodeEnum["WHITE"] = "white";
|
|
9
|
+
ColorCodeEnum["YELLOW"] = "yellow";
|
|
10
|
+
ColorCodeEnum["ORANGE"] = "orange";
|
|
11
|
+
ColorCodeEnum["PURPLE"] = "purple";
|
|
12
|
+
ColorCodeEnum["BLUE"] = "blue";
|
|
13
|
+
ColorCodeEnum["LIGHT_BLUE"] = "light-blue";
|
|
14
|
+
ColorCodeEnum["GREEN"] = "green";
|
|
15
|
+
ColorCodeEnum["MINT"] = "mint";
|
|
16
|
+
ColorCodeEnum["CREAM"] = "cream";
|
|
17
|
+
ColorCodeEnum["PEACH"] = "peach";
|
|
18
|
+
ColorCodeEnum["BURGUNDY"] = "burgundy";
|
|
19
|
+
ColorCodeEnum["LAVENDER"] = "lavender";
|
|
20
|
+
ColorCodeEnum["CORAL"] = "coral";
|
|
21
|
+
ColorCodeEnum["BLACK"] = "black";
|
|
22
|
+
ColorCodeEnum["BROWN"] = "brown";
|
|
23
|
+
ColorCodeEnum["GOLD"] = "gold";
|
|
24
|
+
ColorCodeEnum["SILVER"] = "silver";
|
|
25
|
+
ColorCodeEnum["BEIGE"] = "beige";
|
|
26
|
+
ColorCodeEnum["MIX"] = "mix";
|
|
27
|
+
})(ColorCodeEnum || (exports.ColorCodeEnum = ColorCodeEnum = {}));
|
|
28
|
+
const COLOR_CODE_KEYS = Object.keys(ColorCodeEnum);
|
|
29
|
+
exports.COLOR_CODE_LIST = COLOR_CODE_KEYS.map(k => ColorCodeEnum[k]);
|
|
30
|
+
const isColorCode = (value) => {
|
|
31
|
+
if (typeof value !== 'string')
|
|
32
|
+
return false;
|
|
33
|
+
const list = exports.COLOR_CODE_LIST;
|
|
34
|
+
return list.indexOf(value) !== -1;
|
|
35
|
+
};
|
|
36
|
+
exports.isColorCode = isColorCode;
|
package/build/enum/index.js
CHANGED
|
@@ -80,6 +80,7 @@ __exportStar(require("./order-delivery-status.enum"), exports);
|
|
|
80
80
|
__exportStar(require("./consignment-write-off-archives-status.enum"), exports);
|
|
81
81
|
__exportStar(require("./context-message-context-type.enum"), exports);
|
|
82
82
|
__exportStar(require("./country-code.enum"), exports);
|
|
83
|
+
__exportStar(require("./color-code.enum"), exports);
|
|
83
84
|
__exportStar(require("./pre-order-aggregation-mode.enum"), exports);
|
|
84
85
|
__exportStar(require("./order-webshop-available-status-list"), exports);
|
|
85
86
|
__exportStar(require("./transaction-type-groups"), exports);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { OutboundSyncIntentEnum } from '../../../enum/outbound-sync-intent.enum';
|
|
3
|
+
|
|
4
|
+
const PendingJobSchema = z.object({
|
|
5
|
+
intent: z.nativeEnum(OutboundSyncIntentEnum),
|
|
6
|
+
attempts: z.number().int().nonnegative(),
|
|
7
|
+
errorCode: z.string().nullable(),
|
|
8
|
+
errorMessage: z.string().nullable(),
|
|
9
|
+
nextAttemptAt: z.string().datetime(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const DeadJobSchema = z.object({
|
|
13
|
+
intent: z.nativeEnum(OutboundSyncIntentEnum),
|
|
14
|
+
errorCode: z.string(),
|
|
15
|
+
errorMessage: z.string(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const OrderSyncStatusSchema = z.object({
|
|
19
|
+
orderUUID: z.string().uuid(),
|
|
20
|
+
isLinked: z.boolean(),
|
|
21
|
+
externalHref: z.string().nullable(),
|
|
22
|
+
isClientLinked: z.boolean(),
|
|
23
|
+
hasUnlinkedProducts: z.boolean(),
|
|
24
|
+
missingProductUUIDs: z.array(z.string().uuid()),
|
|
25
|
+
lastSyncedAt: z.string().datetime().nullable(),
|
|
26
|
+
pendingJob: PendingJobSchema.nullable(),
|
|
27
|
+
isDead: z.boolean(),
|
|
28
|
+
deadJob: DeadJobSchema.nullable(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const GetOrderSyncStatusResponseSchema = z.object({
|
|
32
|
+
message: z.string().optional(),
|
|
33
|
+
data: OrderSyncStatusSchema,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export namespace GetOrderSyncStatusContractQuery {
|
|
37
|
+
export const ResponseSchema = GetOrderSyncStatusResponseSchema;
|
|
38
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
39
|
+
export const StatusSchema = OrderSyncStatusSchema;
|
|
40
|
+
export type Status = z.infer<typeof OrderSyncStatusSchema>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const GetOrdersBatchSyncStatusRequestSchema = z.object({
|
|
4
|
+
orderUUIDs: z.array(z.string().uuid()).min(1).max(200),
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const OrderSyncStatusSlimSchema = z.object({
|
|
8
|
+
orderUUID: z.string().uuid(),
|
|
9
|
+
isLinked: z.boolean(),
|
|
10
|
+
hasIssues: z.boolean(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const GetOrdersBatchSyncStatusResponseSchema = z.object({
|
|
14
|
+
message: z.string().optional(),
|
|
15
|
+
data: z.object({
|
|
16
|
+
statuses: z.array(OrderSyncStatusSlimSchema),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export namespace GetOrdersBatchSyncStatusContractQuery {
|
|
21
|
+
export const RequestSchema = GetOrdersBatchSyncStatusRequestSchema;
|
|
22
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
23
|
+
export const ResponseSchema = GetOrdersBatchSyncStatusResponseSchema;
|
|
24
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
25
|
+
export const SlimStatusSchema = OrderSyncStatusSlimSchema;
|
|
26
|
+
export type SlimStatus = z.infer<typeof OrderSyncStatusSlimSchema>;
|
|
27
|
+
}
|
|
@@ -8,3 +8,5 @@ export * from './scan-moysklad-import.query';
|
|
|
8
8
|
export * from './execute-moysklad-import.command';
|
|
9
9
|
export * from './scan-moysklad-clients-import.query';
|
|
10
10
|
export * from './execute-moysklad-clients-import.command';
|
|
11
|
+
export * from './get-order-sync-status.query';
|
|
12
|
+
export * from './get-orders-batch-sync-status.query';
|
package/constant/error.ts
CHANGED
|
@@ -1064,11 +1064,6 @@ export const ERRORS = {
|
|
|
1064
1064
|
message: 'Order client has no MoySklad link; import clients first',
|
|
1065
1065
|
httpCode: 400,
|
|
1066
1066
|
},
|
|
1067
|
-
MOYSKLAD_ORDER_PRODUCT_NOT_LINKED: {
|
|
1068
|
-
code: 'MS012',
|
|
1069
|
-
message: 'One or more order products have no MoySklad link',
|
|
1070
|
-
httpCode: 400,
|
|
1071
|
-
},
|
|
1072
1067
|
MOYSKLAD_INTEGRATION_INCOMPLETE: {
|
|
1073
1068
|
code: 'MS013',
|
|
1074
1069
|
message: 'MoySklad integration is missing default organization or store',
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export enum ColorCodeEnum {
|
|
2
|
+
RED = 'red',
|
|
3
|
+
PINK = 'pink',
|
|
4
|
+
WHITE = 'white',
|
|
5
|
+
YELLOW = 'yellow',
|
|
6
|
+
ORANGE = 'orange',
|
|
7
|
+
PURPLE = 'purple',
|
|
8
|
+
BLUE = 'blue',
|
|
9
|
+
LIGHT_BLUE = 'light-blue',
|
|
10
|
+
GREEN = 'green',
|
|
11
|
+
MINT = 'mint',
|
|
12
|
+
CREAM = 'cream',
|
|
13
|
+
PEACH = 'peach',
|
|
14
|
+
BURGUNDY = 'burgundy',
|
|
15
|
+
LAVENDER = 'lavender',
|
|
16
|
+
CORAL = 'coral',
|
|
17
|
+
BLACK = 'black',
|
|
18
|
+
BROWN = 'brown',
|
|
19
|
+
GOLD = 'gold',
|
|
20
|
+
SILVER = 'silver',
|
|
21
|
+
BEIGE = 'beige',
|
|
22
|
+
MIX = 'mix',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const COLOR_CODE_KEYS = Object.keys(ColorCodeEnum) as Array<keyof typeof ColorCodeEnum>;
|
|
26
|
+
export const COLOR_CODE_LIST: readonly ColorCodeEnum[] = COLOR_CODE_KEYS.map(k => ColorCodeEnum[k]) as readonly ColorCodeEnum[];
|
|
27
|
+
|
|
28
|
+
export const isColorCode = (value: unknown): value is ColorCodeEnum => {
|
|
29
|
+
if (typeof value !== 'string') return false;
|
|
30
|
+
const list = COLOR_CODE_LIST as readonly string[];
|
|
31
|
+
return list.indexOf(value) !== -1;
|
|
32
|
+
};
|
package/enum/index.ts
CHANGED
|
@@ -64,6 +64,7 @@ export * from './order-delivery-status.enum';
|
|
|
64
64
|
export * from './consignment-write-off-archives-status.enum';
|
|
65
65
|
export * from './context-message-context-type.enum';
|
|
66
66
|
export * from './country-code.enum';
|
|
67
|
+
export * from './color-code.enum';
|
|
67
68
|
export * from './pre-order-aggregation-mode.enum';
|
|
68
69
|
export * from './order-webshop-available-status-list';
|
|
69
70
|
export * from './transaction-type-groups';
|