@pksep/zod-shared 0.0.563 → 0.0.565

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.
Files changed (34) hide show
  1. package/dist/ai-mcp/index.d.ts +3 -0
  2. package/dist/ai-mcp/index.js +3 -0
  3. package/dist/ai-mcp/interfaces/ai-mcp.interface.d.ts +149 -1
  4. package/dist/ai-mcp/schemas/ai-mcp-entity-editor.schema.d.ts +124 -0
  5. package/dist/ai-mcp/schemas/ai-mcp-entity-editor.schema.js +123 -0
  6. package/dist/ai-mcp/schemas/ai-mcp-specification.schema.d.ts +123 -0
  7. package/dist/ai-mcp/schemas/ai-mcp-specification.schema.js +110 -0
  8. package/dist/ai-mcp/schemas/ai-mcp-technology.schema.d.ts +225 -0
  9. package/dist/ai-mcp/schemas/ai-mcp-technology.schema.js +156 -0
  10. package/dist/ai-mcp/schemas/ai-mcp.schema.d.ts +4 -1
  11. package/dist/ai-mcp/schemas/ai-mcp.schema.js +6 -1
  12. package/dist/bull-queue/index.d.ts +1 -0
  13. package/dist/bull-queue/index.js +17 -0
  14. package/dist/bull-queue/schemas/queue-ownership.schema.d.ts +74 -0
  15. package/dist/bull-queue/schemas/queue-ownership.schema.js +33 -0
  16. package/dist/deficit/index.d.ts +1 -0
  17. package/dist/deficit/index.js +1 -0
  18. package/dist/deficit/schemas/deficit-queue.schema.d.ts +2 -0
  19. package/dist/deficit/schemas/deficit-queue.schema.js +7 -0
  20. package/dist/excel-export/excel-export.dto.d.ts +2021 -585
  21. package/dist/excel-export/excel-export.dto.js +65 -2
  22. package/dist/excel-export/index.d.ts +1 -0
  23. package/dist/excel-export/index.js +1 -0
  24. package/dist/excel-export/warehouse-excel-export.d.ts +269 -0
  25. package/dist/excel-export/warehouse-excel-export.js +76 -0
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.js +1 -0
  28. package/dist/production-tasks/dto/split-production-task.dto.js +1 -1
  29. package/dist/production-tasks/interfaces/production-tasks.d.ts +2 -0
  30. package/dist/production-tasks/methods/methods.d.ts +3 -3
  31. package/dist/production-tasks/methods/methods.js +3 -3
  32. package/dist/specification/dto/mutate-specification.dto.d.ts +13 -0
  33. package/dist/specification/dto/mutate-specification.dto.js +14 -6
  34. package/package.json +1 -1
@@ -1,2 +1,5 @@
1
1
  export * from './schemas/ai-mcp.schema';
2
+ export * from './schemas/ai-mcp-specification.schema';
3
+ export * from './schemas/ai-mcp-entity-editor.schema';
4
+ export * from './schemas/ai-mcp-technology.schema';
2
5
  export * from './interfaces/ai-mcp.interface';
@@ -15,4 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./schemas/ai-mcp.schema"), exports);
18
+ __exportStar(require("./schemas/ai-mcp-specification.schema"), exports);
19
+ __exportStar(require("./schemas/ai-mcp-entity-editor.schema"), exports);
20
+ __exportStar(require("./schemas/ai-mcp-technology.schema"), exports);
18
21
  __exportStar(require("./interfaces/ai-mcp.interface"), exports);
@@ -1,6 +1,10 @@
1
1
  import { EntityCommonSpecificationArray, ProductionTimeType, UnitsEnum } from '../../utils';
2
2
  import { AiMcpCommandStatusEnum, AiMcpOperationNameEnum, AiMcpOperationStatusEnum, ErpProductSpecificationKindEnum, ErpProductSpecificationViewEnum, ErpProductStateEnum, ErpProductTechnologyStateEnum, TErpEntityFilesListInput } from '../schemas/ai-mcp.schema';
3
3
  import { TAiMcpEntityType } from '../schemas/ai-mcp.schema';
4
+ import { SpecificationMutationOperation, SpecificationParentType } from '../../specification/dto/mutate-specification.dto';
5
+ import { SpetificationEntityKeys } from '../../utils';
6
+ import { Transaction } from 'sequelize';
7
+ import { ErpTechnologyReferenceKindEnum } from '../schemas/ai-mcp-technology.schema';
4
8
  export interface IAiMcpAuthContext {
5
9
  actorUserId?: number;
6
10
  clientId: string;
@@ -94,6 +98,33 @@ export interface IArchiveDetailResult {
94
98
  };
95
99
  message: string;
96
100
  }
101
+ export interface IErpSpecificationMutationResult {
102
+ applied: true;
103
+ replayed: boolean;
104
+ operation: SpecificationMutationOperation;
105
+ parent: {
106
+ type: SpecificationParentType;
107
+ name: string;
108
+ designation: string | null;
109
+ };
110
+ item: {
111
+ section: SpetificationEntityKeys;
112
+ name: string;
113
+ designation: string | null;
114
+ };
115
+ quantity: number | null;
116
+ measureId: number | null;
117
+ position: number | null;
118
+ message: string;
119
+ }
120
+ export interface IErpSpecificationResolvedItem {
121
+ id: number;
122
+ name: string;
123
+ designation?: string | null;
124
+ discontinued?: boolean;
125
+ quantity?: number;
126
+ measureId?: number;
127
+ }
97
128
  export interface IErpFileItem {
98
129
  id: number;
99
130
  name: string;
@@ -355,4 +386,121 @@ export interface IAiMcpUserRow {
355
386
  login?: string | null;
356
387
  initial?: string | null;
357
388
  }
358
- export type TAiMcpOperationResult = ICreateDetailAndAddToCbedResult | IArchiveDetailResult | IErpDocumentActionResult;
389
+ export interface IErpEditableVariable {
390
+ name: string;
391
+ unit: string;
392
+ value: string | number;
393
+ }
394
+ export interface IErpEntityEditorCard {
395
+ type: TAiMcpEntityType;
396
+ name: string;
397
+ designation: string | null;
398
+ responsibleName: string | null;
399
+ description: string;
400
+ attention: boolean;
401
+ discontinued: boolean;
402
+ parameters: IErpEditableVariable[];
403
+ characteristics: IErpEditableVariable[];
404
+ article?: string;
405
+ custom?: boolean;
406
+ detailProductionTimes?: {
407
+ preparation: string | number;
408
+ helper: string | number;
409
+ main: string | number;
410
+ };
411
+ workpieceCharacteristics?: {
412
+ diameter: number;
413
+ billetLength: number;
414
+ length: number;
415
+ width: number;
416
+ height: number;
417
+ wallThickness: number;
418
+ outsideDiameter: number;
419
+ thickness: number;
420
+ crossSectionArea: number;
421
+ acrossFlats: number;
422
+ massPerMeter: number;
423
+ density: number;
424
+ mass: number;
425
+ waste: number;
426
+ };
427
+ mainMaterialName?: string | null;
428
+ replacementMaterialName?: string | null;
429
+ }
430
+ export interface IErpEntityEditorCardResult {
431
+ dataAsOf: string;
432
+ item: IErpEntityEditorCard;
433
+ }
434
+ export interface IErpEntityEditorUpdateResult {
435
+ applied: true;
436
+ replayed: boolean;
437
+ entity: {
438
+ type: TAiMcpEntityType;
439
+ name: string;
440
+ designation: string | null;
441
+ };
442
+ changedFields: string[];
443
+ message: string;
444
+ }
445
+ export interface IErpTechnologyResult {
446
+ dataAsOf: string;
447
+ entity: {
448
+ type: TAiMcpEntityType;
449
+ name: string;
450
+ designation: string | null;
451
+ };
452
+ configured: boolean;
453
+ editable: boolean;
454
+ note: string;
455
+ operations: Array<{
456
+ position: number;
457
+ name: string;
458
+ note: string;
459
+ preparationTime: number;
460
+ helperTime: number;
461
+ mainTime: number;
462
+ totalTime: number;
463
+ resources: {
464
+ equipment: string[];
465
+ instruments: string[];
466
+ tooling: string[];
467
+ measuringInstruments: string[];
468
+ };
469
+ }>;
470
+ }
471
+ export interface IErpTechnologyReferenceSearchResult {
472
+ dataAsOf: string;
473
+ kind: ErpTechnologyReferenceKindEnum;
474
+ query: string;
475
+ count: number;
476
+ items: Array<{
477
+ name: string;
478
+ }>;
479
+ }
480
+ export type ErpTechnologyMutationOperation = 'add' | 'update' | 'move' | 'remove' | 'update-process';
481
+ export interface IErpTechnologyMutationResult {
482
+ applied: true;
483
+ replayed: boolean;
484
+ operation: ErpTechnologyMutationOperation;
485
+ entity: {
486
+ type: TAiMcpEntityType;
487
+ name: string;
488
+ designation: string | null;
489
+ };
490
+ operationName: string | null;
491
+ position: number | null;
492
+ changedFields: string[];
493
+ message: string;
494
+ }
495
+ export type TAiMcpOperationResult = ICreateDetailAndAddToCbedResult | IArchiveDetailResult | IErpSpecificationMutationResult | IErpDocumentActionResult | IErpEntityEditorUpdateResult | IErpTechnologyMutationResult;
496
+ export interface IAiMcpOperationExecution<T extends TAiMcpOperationResult = TAiMcpOperationResult> {
497
+ operation: AiMcpOperationNameEnum;
498
+ idempotencyKey: string;
499
+ request: object;
500
+ context: IAiMcpCommandContext;
501
+ failureMessage: string;
502
+ execute: (data: {
503
+ transaction: Transaction;
504
+ actorUserId: number;
505
+ }) => Promise<T>;
506
+ }
@@ -0,0 +1,124 @@
1
+ import * as z from 'zod/v4';
2
+ export declare const ErpEntityEditorGetInputShape: {
3
+ includeArchived: z.ZodDefault<z.ZodBoolean>;
4
+ type: z.ZodEnum<{
5
+ product: import("../..").IzdType.product;
6
+ cbed: import("../..").IzdType.cbed;
7
+ detal: import("../..").IzdType.detal;
8
+ }>;
9
+ entityName: z.ZodOptional<z.ZodString>;
10
+ entityDesignation: z.ZodOptional<z.ZodString>;
11
+ };
12
+ export declare const ErpEntityEditorUpdateInputShape: {
13
+ changes: z.ZodObject<{
14
+ name: z.ZodOptional<z.ZodString>;
15
+ designation: z.ZodOptional<z.ZodString>;
16
+ article: z.ZodOptional<z.ZodString>;
17
+ responsibleName: z.ZodOptional<z.ZodString>;
18
+ description: z.ZodOptional<z.ZodString>;
19
+ attention: z.ZodOptional<z.ZodBoolean>;
20
+ custom: z.ZodOptional<z.ZodBoolean>;
21
+ discontinued: z.ZodOptional<z.ZodBoolean>;
22
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
23
+ name: z.ZodString;
24
+ unit: z.ZodOptional<z.ZodString>;
25
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
26
+ }, z.core.$strip>>>;
27
+ characteristics: z.ZodOptional<z.ZodArray<z.ZodObject<{
28
+ name: z.ZodString;
29
+ unit: z.ZodOptional<z.ZodString>;
30
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
31
+ }, z.core.$strip>>>;
32
+ detailProductionTimes: z.ZodOptional<z.ZodObject<{
33
+ preparation: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
34
+ helper: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
35
+ main: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
36
+ }, z.core.$strip>>;
37
+ workpieceCharacteristics: z.ZodOptional<z.ZodObject<{
38
+ diameter: z.ZodOptional<z.ZodNumber>;
39
+ billetLength: z.ZodOptional<z.ZodNumber>;
40
+ length: z.ZodOptional<z.ZodNumber>;
41
+ width: z.ZodOptional<z.ZodNumber>;
42
+ height: z.ZodOptional<z.ZodNumber>;
43
+ wallThickness: z.ZodOptional<z.ZodNumber>;
44
+ outsideDiameter: z.ZodOptional<z.ZodNumber>;
45
+ thickness: z.ZodOptional<z.ZodNumber>;
46
+ crossSectionArea: z.ZodOptional<z.ZodNumber>;
47
+ acrossFlats: z.ZodOptional<z.ZodNumber>;
48
+ massPerMeter: z.ZodOptional<z.ZodNumber>;
49
+ }, z.core.$strip>>;
50
+ mainMaterialName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
+ replacementMaterialName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ }, z.core.$strip>;
53
+ idempotencyKey: z.ZodString;
54
+ type: z.ZodEnum<{
55
+ product: import("../..").IzdType.product;
56
+ cbed: import("../..").IzdType.cbed;
57
+ detal: import("../..").IzdType.detal;
58
+ }>;
59
+ entityName: z.ZodOptional<z.ZodString>;
60
+ entityDesignation: z.ZodOptional<z.ZodString>;
61
+ };
62
+ export declare const ErpEntityEditorGetInputZod: z.ZodObject<{
63
+ includeArchived: z.ZodDefault<z.ZodBoolean>;
64
+ type: z.ZodEnum<{
65
+ product: import("../..").IzdType.product;
66
+ cbed: import("../..").IzdType.cbed;
67
+ detal: import("../..").IzdType.detal;
68
+ }>;
69
+ entityName: z.ZodOptional<z.ZodString>;
70
+ entityDesignation: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strip>;
72
+ export declare const ErpEntityEditorUpdateInputZod: z.ZodObject<{
73
+ changes: z.ZodObject<{
74
+ name: z.ZodOptional<z.ZodString>;
75
+ designation: z.ZodOptional<z.ZodString>;
76
+ article: z.ZodOptional<z.ZodString>;
77
+ responsibleName: z.ZodOptional<z.ZodString>;
78
+ description: z.ZodOptional<z.ZodString>;
79
+ attention: z.ZodOptional<z.ZodBoolean>;
80
+ custom: z.ZodOptional<z.ZodBoolean>;
81
+ discontinued: z.ZodOptional<z.ZodBoolean>;
82
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
83
+ name: z.ZodString;
84
+ unit: z.ZodOptional<z.ZodString>;
85
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
86
+ }, z.core.$strip>>>;
87
+ characteristics: z.ZodOptional<z.ZodArray<z.ZodObject<{
88
+ name: z.ZodString;
89
+ unit: z.ZodOptional<z.ZodString>;
90
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
91
+ }, z.core.$strip>>>;
92
+ detailProductionTimes: z.ZodOptional<z.ZodObject<{
93
+ preparation: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
94
+ helper: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
95
+ main: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
96
+ }, z.core.$strip>>;
97
+ workpieceCharacteristics: z.ZodOptional<z.ZodObject<{
98
+ diameter: z.ZodOptional<z.ZodNumber>;
99
+ billetLength: z.ZodOptional<z.ZodNumber>;
100
+ length: z.ZodOptional<z.ZodNumber>;
101
+ width: z.ZodOptional<z.ZodNumber>;
102
+ height: z.ZodOptional<z.ZodNumber>;
103
+ wallThickness: z.ZodOptional<z.ZodNumber>;
104
+ outsideDiameter: z.ZodOptional<z.ZodNumber>;
105
+ thickness: z.ZodOptional<z.ZodNumber>;
106
+ crossSectionArea: z.ZodOptional<z.ZodNumber>;
107
+ acrossFlats: z.ZodOptional<z.ZodNumber>;
108
+ massPerMeter: z.ZodOptional<z.ZodNumber>;
109
+ }, z.core.$strip>>;
110
+ mainMaterialName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
111
+ replacementMaterialName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
112
+ }, z.core.$strip>;
113
+ idempotencyKey: z.ZodString;
114
+ type: z.ZodEnum<{
115
+ product: import("../..").IzdType.product;
116
+ cbed: import("../..").IzdType.cbed;
117
+ detal: import("../..").IzdType.detal;
118
+ }>;
119
+ entityName: z.ZodOptional<z.ZodString>;
120
+ entityDesignation: z.ZodOptional<z.ZodString>;
121
+ }, z.core.$strip>;
122
+ export type TErpEntityEditorGetInput = z.infer<typeof ErpEntityEditorGetInputZod>;
123
+ export type TErpEntityEditorUpdateInput = z.infer<typeof ErpEntityEditorUpdateInputZod>;
124
+ export type TErpEntityEditorChanges = TErpEntityEditorUpdateInput['changes'];
@@ -0,0 +1,123 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ErpEntityEditorUpdateInputZod = exports.ErpEntityEditorGetInputZod = exports.ErpEntityEditorUpdateInputShape = exports.ErpEntityEditorGetInputShape = void 0;
37
+ const z = __importStar(require("zod/v4"));
38
+ const ai_mcp_schema_1 = require("./ai-mcp.schema");
39
+ const entityReferenceShape = {
40
+ type: ai_mcp_schema_1.AiMcpEntityTypeZod,
41
+ entityName: z.string().trim().min(1).max(255).optional(),
42
+ entityDesignation: z.string().trim().min(1).max(255).optional()
43
+ };
44
+ const editableVariableZod = z.object({
45
+ name: z.string().trim().min(1).max(255),
46
+ unit: z.string().trim().max(50).optional(),
47
+ value: z.union([z.string().max(1000), z.number()])
48
+ });
49
+ const detailProductionTimesZod = z
50
+ .object({
51
+ preparation: z.union([z.string().max(100), z.number()]).optional(),
52
+ helper: z.union([z.string().max(100), z.number()]).optional(),
53
+ main: z.union([z.string().max(100), z.number()]).optional()
54
+ })
55
+ .refine(value => Object.keys(value).length > 0, {
56
+ message: 'Укажите хотя бы одну норму времени детали.'
57
+ });
58
+ const detailWorkpieceCharacteristicsZod = z
59
+ .object({
60
+ diameter: z.number().nonnegative().optional(),
61
+ billetLength: z.number().nonnegative().optional(),
62
+ length: z.number().nonnegative().optional(),
63
+ width: z.number().nonnegative().optional(),
64
+ height: z.number().nonnegative().optional(),
65
+ wallThickness: z.number().nonnegative().optional(),
66
+ outsideDiameter: z.number().nonnegative().optional(),
67
+ thickness: z.number().nonnegative().optional(),
68
+ crossSectionArea: z.number().nonnegative().optional(),
69
+ acrossFlats: z.number().nonnegative().optional(),
70
+ massPerMeter: z.number().nonnegative().optional()
71
+ })
72
+ .refine(value => Object.keys(value).length > 0, {
73
+ message: 'Укажите хотя бы одну редактируемую характеристику заготовки. Масса и отходы рассчитываются автоматически.'
74
+ });
75
+ exports.ErpEntityEditorGetInputShape = Object.assign(Object.assign({}, entityReferenceShape), { includeArchived: z.boolean().default(false) });
76
+ exports.ErpEntityEditorUpdateInputShape = Object.assign(Object.assign({}, entityReferenceShape), { changes: z.object({
77
+ name: z.string().trim().min(1).max(255).optional(),
78
+ designation: z.string().trim().max(255).optional(),
79
+ article: z.string().trim().max(255).optional(),
80
+ responsibleName: z.string().trim().min(1).max(255).optional(),
81
+ description: z.string().max(4000).optional(),
82
+ attention: z.boolean().optional(),
83
+ custom: z.boolean().optional(),
84
+ discontinued: z.boolean().optional(),
85
+ parameters: z.array(editableVariableZod).min(1).max(100).optional(),
86
+ characteristics: z.array(editableVariableZod).min(1).max(100).optional(),
87
+ detailProductionTimes: detailProductionTimesZod.optional(),
88
+ workpieceCharacteristics: detailWorkpieceCharacteristicsZod.optional(),
89
+ mainMaterialName: z.string().trim().min(1).max(255).nullable().optional(),
90
+ replacementMaterialName: z
91
+ .string()
92
+ .trim()
93
+ .min(1)
94
+ .max(255)
95
+ .nullable()
96
+ .optional()
97
+ }), idempotencyKey: z
98
+ .string()
99
+ .trim()
100
+ .min(8)
101
+ .max(128)
102
+ .regex(/^[a-zA-Z0-9._:-]+$/) });
103
+ exports.ErpEntityEditorGetInputZod = z
104
+ .object(exports.ErpEntityEditorGetInputShape)
105
+ .refine(input => input.entityName || input.entityDesignation, {
106
+ message: 'Укажите название или обозначение сущности ERP.'
107
+ });
108
+ exports.ErpEntityEditorUpdateInputZod = z
109
+ .object(exports.ErpEntityEditorUpdateInputShape)
110
+ .superRefine((input, context) => {
111
+ if (!input.entityName && !input.entityDesignation) {
112
+ context.addIssue({
113
+ code: 'custom',
114
+ message: 'Укажите название или обозначение сущности ERP.'
115
+ });
116
+ }
117
+ if (Object.keys(input.changes).length === 0) {
118
+ context.addIssue({
119
+ code: 'custom',
120
+ message: 'Укажите хотя бы одно изменение карточки ERP.'
121
+ });
122
+ }
123
+ });
@@ -0,0 +1,123 @@
1
+ import * as z from 'zod/v4';
2
+ import { IzdType, SpetificationEntityKeys } from '../../utils';
3
+ export declare const ErpSpecificationItemAddInputShape: {
4
+ quantity: z.ZodNumber;
5
+ measureId: z.ZodOptional<z.ZodNumber>;
6
+ position: z.ZodOptional<z.ZodNumber>;
7
+ parentType: z.ZodEnum<{
8
+ product: IzdType.product;
9
+ cbed: IzdType.cbed;
10
+ detal: IzdType.detal;
11
+ }>;
12
+ parentName: z.ZodOptional<z.ZodString>;
13
+ parentDesignation: z.ZodOptional<z.ZodString>;
14
+ section: z.ZodEnum<typeof SpetificationEntityKeys>;
15
+ itemName: z.ZodOptional<z.ZodString>;
16
+ itemDesignation: z.ZodOptional<z.ZodString>;
17
+ idempotencyKey: z.ZodString;
18
+ };
19
+ export declare const ErpSpecificationItemUpdateInputShape: {
20
+ quantity: z.ZodOptional<z.ZodNumber>;
21
+ measureId: z.ZodOptional<z.ZodNumber>;
22
+ parentType: z.ZodEnum<{
23
+ product: IzdType.product;
24
+ cbed: IzdType.cbed;
25
+ detal: IzdType.detal;
26
+ }>;
27
+ parentName: z.ZodOptional<z.ZodString>;
28
+ parentDesignation: z.ZodOptional<z.ZodString>;
29
+ section: z.ZodEnum<typeof SpetificationEntityKeys>;
30
+ itemName: z.ZodOptional<z.ZodString>;
31
+ itemDesignation: z.ZodOptional<z.ZodString>;
32
+ idempotencyKey: z.ZodString;
33
+ };
34
+ export declare const ErpSpecificationItemMoveInputShape: {
35
+ position: z.ZodNumber;
36
+ parentType: z.ZodEnum<{
37
+ product: IzdType.product;
38
+ cbed: IzdType.cbed;
39
+ detal: IzdType.detal;
40
+ }>;
41
+ parentName: z.ZodOptional<z.ZodString>;
42
+ parentDesignation: z.ZodOptional<z.ZodString>;
43
+ section: z.ZodEnum<typeof SpetificationEntityKeys>;
44
+ itemName: z.ZodOptional<z.ZodString>;
45
+ itemDesignation: z.ZodOptional<z.ZodString>;
46
+ idempotencyKey: z.ZodString;
47
+ };
48
+ export declare const ErpSpecificationItemRemoveInputShape: {
49
+ parentType: z.ZodEnum<{
50
+ product: IzdType.product;
51
+ cbed: IzdType.cbed;
52
+ detal: IzdType.detal;
53
+ }>;
54
+ parentName: z.ZodOptional<z.ZodString>;
55
+ parentDesignation: z.ZodOptional<z.ZodString>;
56
+ section: z.ZodEnum<typeof SpetificationEntityKeys>;
57
+ itemName: z.ZodOptional<z.ZodString>;
58
+ itemDesignation: z.ZodOptional<z.ZodString>;
59
+ idempotencyKey: z.ZodString;
60
+ };
61
+ export declare const ErpSpecificationItemAddInputZod: z.ZodObject<{
62
+ quantity: z.ZodNumber;
63
+ measureId: z.ZodOptional<z.ZodNumber>;
64
+ position: z.ZodOptional<z.ZodNumber>;
65
+ parentType: z.ZodEnum<{
66
+ product: IzdType.product;
67
+ cbed: IzdType.cbed;
68
+ detal: IzdType.detal;
69
+ }>;
70
+ parentName: z.ZodOptional<z.ZodString>;
71
+ parentDesignation: z.ZodOptional<z.ZodString>;
72
+ section: z.ZodEnum<typeof SpetificationEntityKeys>;
73
+ itemName: z.ZodOptional<z.ZodString>;
74
+ itemDesignation: z.ZodOptional<z.ZodString>;
75
+ idempotencyKey: z.ZodString;
76
+ }, z.core.$strip>;
77
+ export declare const ErpSpecificationItemUpdateInputZod: z.ZodObject<{
78
+ quantity: z.ZodOptional<z.ZodNumber>;
79
+ measureId: z.ZodOptional<z.ZodNumber>;
80
+ parentType: z.ZodEnum<{
81
+ product: IzdType.product;
82
+ cbed: IzdType.cbed;
83
+ detal: IzdType.detal;
84
+ }>;
85
+ parentName: z.ZodOptional<z.ZodString>;
86
+ parentDesignation: z.ZodOptional<z.ZodString>;
87
+ section: z.ZodEnum<typeof SpetificationEntityKeys>;
88
+ itemName: z.ZodOptional<z.ZodString>;
89
+ itemDesignation: z.ZodOptional<z.ZodString>;
90
+ idempotencyKey: z.ZodString;
91
+ }, z.core.$strip>;
92
+ export declare const ErpSpecificationItemMoveInputZod: z.ZodObject<{
93
+ position: z.ZodNumber;
94
+ parentType: z.ZodEnum<{
95
+ product: IzdType.product;
96
+ cbed: IzdType.cbed;
97
+ detal: IzdType.detal;
98
+ }>;
99
+ parentName: z.ZodOptional<z.ZodString>;
100
+ parentDesignation: z.ZodOptional<z.ZodString>;
101
+ section: z.ZodEnum<typeof SpetificationEntityKeys>;
102
+ itemName: z.ZodOptional<z.ZodString>;
103
+ itemDesignation: z.ZodOptional<z.ZodString>;
104
+ idempotencyKey: z.ZodString;
105
+ }, z.core.$strip>;
106
+ export declare const ErpSpecificationItemRemoveInputZod: z.ZodObject<{
107
+ parentType: z.ZodEnum<{
108
+ product: IzdType.product;
109
+ cbed: IzdType.cbed;
110
+ detal: IzdType.detal;
111
+ }>;
112
+ parentName: z.ZodOptional<z.ZodString>;
113
+ parentDesignation: z.ZodOptional<z.ZodString>;
114
+ section: z.ZodEnum<typeof SpetificationEntityKeys>;
115
+ itemName: z.ZodOptional<z.ZodString>;
116
+ itemDesignation: z.ZodOptional<z.ZodString>;
117
+ idempotencyKey: z.ZodString;
118
+ }, z.core.$strip>;
119
+ export type TErpSpecificationItemAddInput = z.infer<typeof ErpSpecificationItemAddInputZod>;
120
+ export type TErpSpecificationItemUpdateInput = z.infer<typeof ErpSpecificationItemUpdateInputZod>;
121
+ export type TErpSpecificationItemMoveInput = z.infer<typeof ErpSpecificationItemMoveInputZod>;
122
+ export type TErpSpecificationItemRemoveInput = z.infer<typeof ErpSpecificationItemRemoveInputZod>;
123
+ export type TErpSpecificationMutationInput = TErpSpecificationItemAddInput | TErpSpecificationItemUpdateInput | TErpSpecificationItemMoveInput | TErpSpecificationItemRemoveInput;
@@ -0,0 +1,110 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ErpSpecificationItemRemoveInputZod = exports.ErpSpecificationItemMoveInputZod = exports.ErpSpecificationItemUpdateInputZod = exports.ErpSpecificationItemAddInputZod = exports.ErpSpecificationItemRemoveInputShape = exports.ErpSpecificationItemMoveInputShape = exports.ErpSpecificationItemUpdateInputShape = exports.ErpSpecificationItemAddInputShape = void 0;
37
+ const z = __importStar(require("zod/v4"));
38
+ const mutate_specification_dto_1 = require("../../specification/dto/mutate-specification.dto");
39
+ const utils_1 = require("../../utils");
40
+ /** MCP SDK использует Zod v4; итоговая команда дополнительно проверяется общим DTO ERP на Zod v3. */
41
+ const SpecificationParentTypeMcpZod = z.enum([
42
+ utils_1.IzdType.product,
43
+ utils_1.IzdType.cbed,
44
+ utils_1.IzdType.detal
45
+ ]);
46
+ const SpecificationSectionMcpZod = z.nativeEnum(utils_1.SpetificationEntityKeys);
47
+ const idempotencyKeyZod = z
48
+ .string()
49
+ .trim()
50
+ .min(8)
51
+ .max(128)
52
+ .regex(/^[a-zA-Z0-9._:-]+$/);
53
+ const entityReferenceShape = {
54
+ parentType: SpecificationParentTypeMcpZod,
55
+ parentName: z.string().trim().min(1).max(255).optional(),
56
+ parentDesignation: z.string().trim().min(1).max(255).optional(),
57
+ section: SpecificationSectionMcpZod,
58
+ itemName: z.string().trim().min(1).max(255).optional(),
59
+ itemDesignation: z.string().trim().min(1).max(255).optional(),
60
+ idempotencyKey: idempotencyKeyZod
61
+ };
62
+ /** Требует человекочитаемые ссылки на родителя и позицию без внутренних ID. */
63
+ const validateReferences = (input, context) => {
64
+ if (!input.parentName && !input.parentDesignation) {
65
+ context.addIssue({
66
+ code: z.ZodIssueCode.custom,
67
+ path: ['parentName'],
68
+ message: 'Укажите название или обозначение родительской сущности'
69
+ });
70
+ }
71
+ if (!input.itemName && !input.itemDesignation) {
72
+ context.addIssue({
73
+ code: z.ZodIssueCode.custom,
74
+ path: ['itemName'],
75
+ message: 'Укажите название или обозначение позиции спецификации'
76
+ });
77
+ }
78
+ };
79
+ exports.ErpSpecificationItemAddInputShape = Object.assign(Object.assign({}, entityReferenceShape), { quantity: z
80
+ .number()
81
+ .min(mutate_specification_dto_1.SPECIFICATION_QUANTITY_MIN)
82
+ .max(mutate_specification_dto_1.SPECIFICATION_QUANTITY_MAX), measureId: z.number().int().min(1).optional(), position: z.number().int().min(mutate_specification_dto_1.SPECIFICATION_POSITION_MIN).optional() });
83
+ exports.ErpSpecificationItemUpdateInputShape = Object.assign(Object.assign({}, entityReferenceShape), { quantity: z
84
+ .number()
85
+ .min(mutate_specification_dto_1.SPECIFICATION_QUANTITY_MIN)
86
+ .max(mutate_specification_dto_1.SPECIFICATION_QUANTITY_MAX)
87
+ .optional(), measureId: z.number().int().min(1).optional() });
88
+ exports.ErpSpecificationItemMoveInputShape = Object.assign(Object.assign({}, entityReferenceShape), { position: z.number().int().min(mutate_specification_dto_1.SPECIFICATION_POSITION_MIN) });
89
+ exports.ErpSpecificationItemRemoveInputShape = entityReferenceShape;
90
+ exports.ErpSpecificationItemAddInputZod = z
91
+ .object(exports.ErpSpecificationItemAddInputShape)
92
+ .superRefine(validateReferences);
93
+ exports.ErpSpecificationItemUpdateInputZod = z
94
+ .object(exports.ErpSpecificationItemUpdateInputShape)
95
+ .superRefine((input, context) => {
96
+ validateReferences(input, context);
97
+ if (input.quantity === undefined && input.measureId === undefined) {
98
+ context.addIssue({
99
+ code: z.ZodIssueCode.custom,
100
+ path: ['quantity'],
101
+ message: 'Укажите новое количество или единицу измерения'
102
+ });
103
+ }
104
+ });
105
+ exports.ErpSpecificationItemMoveInputZod = z
106
+ .object(exports.ErpSpecificationItemMoveInputShape)
107
+ .superRefine(validateReferences);
108
+ exports.ErpSpecificationItemRemoveInputZod = z
109
+ .object(exports.ErpSpecificationItemRemoveInputShape)
110
+ .superRefine(validateReferences);