@floristcloud/api-lib 1.2.26 → 1.2.27

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.
@@ -16,6 +16,14 @@ const GetMoyskladStatusResponseSchema = zod_1.z.object({
16
16
  nameProcessingConvention: zod_1.z.nativeEnum(consignment_import_name_convention_enum_1.ConsignmentImportNameConventionEnum).nullable(),
17
17
  isRemoveSizeFromName: zod_1.z.boolean(),
18
18
  isCutCategoryFromName: zod_1.z.boolean(),
19
+ lastStockSyncedAt: zod_1.z.string().datetime().nullable(),
20
+ stockSyncStatus: zod_1.z.enum(['PENDING', 'RUNNING', 'DEAD', 'IDLE']),
21
+ stockSyncDeadInfo: zod_1.z
22
+ .object({
23
+ errorCode: zod_1.z.string(),
24
+ errorMessage: zod_1.z.string(),
25
+ })
26
+ .nullable(),
19
27
  }),
20
28
  });
21
29
  var GetMoyskladStatusContractQuery;
@@ -26,3 +26,4 @@ __exportStar(require("./scan-moysklad-clients-import.query"), exports);
26
26
  __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
+ __exportStar(require("./sync-moysklad-stock.command"), exports);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SyncMoyskladStockContractCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const SyncMoyskladStockResponseSchema = zod_1.z.object({
6
+ message: zod_1.z.string().optional(),
7
+ data: zod_1.z.object({
8
+ jobUUID: zod_1.z.string().uuid(),
9
+ status: zod_1.z.enum(['PENDING', 'RUNNING']),
10
+ wasAlreadyQueued: zod_1.z.boolean(),
11
+ }),
12
+ });
13
+ var SyncMoyskladStockContractCommand;
14
+ (function (SyncMoyskladStockContractCommand) {
15
+ SyncMoyskladStockContractCommand.ResponseSchema = SyncMoyskladStockResponseSchema;
16
+ })(SyncMoyskladStockContractCommand || (exports.SyncMoyskladStockContractCommand = SyncMoyskladStockContractCommand = {}));
@@ -986,7 +986,11 @@ exports.ERRORS = {
986
986
  MOYSKLAD_NOT_CONNECTED: { code: 'MS003', message: 'MoySklad integration is not connected for this company', httpCode: 404 },
987
987
  MOYSKLAD_API_ERROR: { code: 'MS004', message: 'MoySklad API request failed', httpCode: 502 },
988
988
  MOYSKLAD_DISCONNECT_FAILED: { code: 'MS005', message: 'Failed to disconnect MoySklad integration', httpCode: 500 },
989
- MOYSKLAD_SETTINGS_INVALID: { code: 'MS006', message: 'Provided organization or store does not belong to the connected MoySklad account', httpCode: 400 },
989
+ MOYSKLAD_SETTINGS_INVALID: {
990
+ code: 'MS006',
991
+ message: 'Provided organization or store does not belong to the connected MoySklad account',
992
+ httpCode: 400,
993
+ },
990
994
  INTEGRATION_ENC_KEY_NOT_SET: { code: 'MS007', message: 'Integration encryption key is not configured on the server', httpCode: 500 },
991
995
  MOYSKLAD_IMPORT_IN_PROGRESS: { code: 'MS008', message: 'MoySklad import is already in progress for this company', httpCode: 409 },
992
996
  MOYSKLAD_CLIENTS_IMPORT_IN_PROGRESS: {
@@ -1029,4 +1033,19 @@ exports.ERRORS = {
1029
1033
  message: 'Outbound sync entity type is not supported by this provider',
1030
1034
  httpCode: 400,
1031
1035
  },
1036
+ MOYSKLAD_STOCK_SYNC_CAP_EXCEEDED: {
1037
+ code: 'MS015',
1038
+ message: 'MoySklad stock-sync concurrency cap exceeded; will retry shortly',
1039
+ httpCode: 429,
1040
+ },
1041
+ MOYSKLAD_STOCK_SYNC_LOCK_BUSY: {
1042
+ code: 'MS016',
1043
+ message: 'MoySklad sync lock is held by another job for this company; will retry shortly',
1044
+ httpCode: 409,
1045
+ },
1046
+ MOYSKLAD_INTEGRATION_DISABLED: {
1047
+ code: 'MS017',
1048
+ message: 'MoySklad integration is disabled for this company',
1049
+ httpCode: 409,
1050
+ },
1032
1051
  };
@@ -14,6 +14,14 @@ const GetMoyskladStatusResponseSchema = z.object({
14
14
  nameProcessingConvention: z.nativeEnum(ConsignmentImportNameConventionEnum).nullable(),
15
15
  isRemoveSizeFromName: z.boolean(),
16
16
  isCutCategoryFromName: z.boolean(),
17
+ lastStockSyncedAt: z.string().datetime().nullable(),
18
+ stockSyncStatus: z.enum(['PENDING', 'RUNNING', 'DEAD', 'IDLE']),
19
+ stockSyncDeadInfo: z
20
+ .object({
21
+ errorCode: z.string(),
22
+ errorMessage: z.string(),
23
+ })
24
+ .nullable(),
17
25
  }),
18
26
  });
19
27
 
@@ -10,3 +10,4 @@ export * from './scan-moysklad-clients-import.query';
10
10
  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
+ export * from './sync-moysklad-stock.command';
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+
3
+ const SyncMoyskladStockResponseSchema = z.object({
4
+ message: z.string().optional(),
5
+ data: z.object({
6
+ jobUUID: z.string().uuid(),
7
+ status: z.enum(['PENDING', 'RUNNING']),
8
+ wasAlreadyQueued: z.boolean(),
9
+ }),
10
+ });
11
+
12
+ export namespace SyncMoyskladStockContractCommand {
13
+ export const ResponseSchema = SyncMoyskladStockResponseSchema;
14
+ export type Response = z.infer<typeof ResponseSchema>;
15
+ }
package/constant/error.ts CHANGED
@@ -1046,7 +1046,11 @@ export const ERRORS = {
1046
1046
  MOYSKLAD_NOT_CONNECTED: { code: 'MS003', message: 'MoySklad integration is not connected for this company', httpCode: 404 },
1047
1047
  MOYSKLAD_API_ERROR: { code: 'MS004', message: 'MoySklad API request failed', httpCode: 502 },
1048
1048
  MOYSKLAD_DISCONNECT_FAILED: { code: 'MS005', message: 'Failed to disconnect MoySklad integration', httpCode: 500 },
1049
- MOYSKLAD_SETTINGS_INVALID: { code: 'MS006', message: 'Provided organization or store does not belong to the connected MoySklad account', httpCode: 400 },
1049
+ MOYSKLAD_SETTINGS_INVALID: {
1050
+ code: 'MS006',
1051
+ message: 'Provided organization or store does not belong to the connected MoySklad account',
1052
+ httpCode: 400,
1053
+ },
1050
1054
  INTEGRATION_ENC_KEY_NOT_SET: { code: 'MS007', message: 'Integration encryption key is not configured on the server', httpCode: 500 },
1051
1055
  MOYSKLAD_IMPORT_IN_PROGRESS: { code: 'MS008', message: 'MoySklad import is already in progress for this company', httpCode: 409 },
1052
1056
  MOYSKLAD_CLIENTS_IMPORT_IN_PROGRESS: {
@@ -1089,4 +1093,19 @@ export const ERRORS = {
1089
1093
  message: 'Outbound sync entity type is not supported by this provider',
1090
1094
  httpCode: 400,
1091
1095
  },
1096
+ MOYSKLAD_STOCK_SYNC_CAP_EXCEEDED: {
1097
+ code: 'MS015',
1098
+ message: 'MoySklad stock-sync concurrency cap exceeded; will retry shortly',
1099
+ httpCode: 429,
1100
+ },
1101
+ MOYSKLAD_STOCK_SYNC_LOCK_BUSY: {
1102
+ code: 'MS016',
1103
+ message: 'MoySklad sync lock is held by another job for this company; will retry shortly',
1104
+ httpCode: 409,
1105
+ },
1106
+ MOYSKLAD_INTEGRATION_DISABLED: {
1107
+ code: 'MS017',
1108
+ message: 'MoySklad integration is disabled for this company',
1109
+ httpCode: 409,
1110
+ },
1092
1111
  } as const;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floristcloud/api-lib",
3
- "version": "1.2.26",
3
+ "version": "1.2.27",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {