@pksep/zod-shared 0.0.562 → 0.0.564

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 (32) 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 +32 -38
  5. package/dist/ai-mcp/schemas/ai-mcp-entity-editor.schema.js +26 -21
  6. package/dist/ai-mcp/schemas/ai-mcp-technology.schema.d.ts +225 -0
  7. package/dist/ai-mcp/schemas/ai-mcp-technology.schema.js +156 -0
  8. package/dist/ai-mcp/schemas/ai-mcp.schema.d.ts +4 -1
  9. package/dist/ai-mcp/schemas/ai-mcp.schema.js +6 -1
  10. package/dist/bull-queue/index.d.ts +1 -0
  11. package/dist/bull-queue/index.js +17 -0
  12. package/dist/bull-queue/schemas/queue-ownership.schema.d.ts +74 -0
  13. package/dist/bull-queue/schemas/queue-ownership.schema.js +33 -0
  14. package/dist/deficit/index.d.ts +1 -0
  15. package/dist/deficit/index.js +1 -0
  16. package/dist/deficit/schemas/deficit-queue.schema.d.ts +2 -0
  17. package/dist/deficit/schemas/deficit-queue.schema.js +7 -0
  18. package/dist/excel-export/excel-export.dto.d.ts +3215 -620
  19. package/dist/excel-export/excel-export.dto.js +219 -2
  20. package/dist/excel-export/index.d.ts +1 -0
  21. package/dist/excel-export/index.js +1 -0
  22. package/dist/excel-export/warehouse-excel-export.d.ts +269 -0
  23. package/dist/excel-export/warehouse-excel-export.js +76 -0
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.js +1 -0
  26. package/dist/production-tasks/dto/split-production-task.dto.js +1 -1
  27. package/dist/production-tasks/interfaces/production-tasks.d.ts +2 -0
  28. package/dist/production-tasks/methods/methods.d.ts +3 -3
  29. package/dist/production-tasks/methods/methods.js +3 -3
  30. package/dist/specification/dto/mutate-specification.dto.d.ts +13 -0
  31. package/dist/specification/dto/mutate-specification.dto.js +14 -6
  32. package/package.json +2 -2
@@ -0,0 +1,156 @@
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.ErpTechnologyProcessUpdateInputZod = exports.ErpTechnologyOperationRemoveInputZod = exports.ErpTechnologyOperationMoveInputZod = exports.ErpTechnologyOperationUpdateInputZod = exports.ErpTechnologyOperationAddInputZod = exports.ErpTechnologyReferenceSearchInputZod = exports.ErpTechnologyGetInputZod = exports.ErpTechnologyProcessUpdateInputShape = exports.ErpTechnologyOperationRemoveInputShape = exports.ErpTechnologyOperationMoveInputShape = exports.ErpTechnologyOperationUpdateInputShape = exports.ErpTechnologyOperationAddInputShape = exports.ErpTechnologyReferenceSearchInputShape = exports.ErpTechnologyGetInputShape = exports.ErpTechnologyReferenceKindEnum = void 0;
37
+ const z = __importStar(require("zod/v4"));
38
+ const ai_mcp_schema_1 = require("./ai-mcp.schema");
39
+ var ErpTechnologyReferenceKindEnum;
40
+ (function (ErpTechnologyReferenceKindEnum) {
41
+ ErpTechnologyReferenceKindEnum["operationType"] = "operationType";
42
+ ErpTechnologyReferenceKindEnum["equipment"] = "equipment";
43
+ ErpTechnologyReferenceKindEnum["instrument"] = "instrument";
44
+ ErpTechnologyReferenceKindEnum["tooling"] = "tooling";
45
+ ErpTechnologyReferenceKindEnum["measuringInstrument"] = "measuringInstrument";
46
+ })(ErpTechnologyReferenceKindEnum || (exports.ErpTechnologyReferenceKindEnum = ErpTechnologyReferenceKindEnum = {}));
47
+ const idempotencyKeyZod = z
48
+ .string()
49
+ .trim()
50
+ .min(8)
51
+ .max(128)
52
+ .regex(/^[a-zA-Z0-9._:-]+$/);
53
+ const entityReferenceShape = {
54
+ entityType: ai_mcp_schema_1.AiMcpEntityTypeZod,
55
+ entityName: z.string().trim().min(1).max(255).optional(),
56
+ entityDesignation: z.string().trim().min(1).max(255).optional()
57
+ };
58
+ const operationReferenceShape = {
59
+ operationName: z.string().trim().min(1).max(255).optional(),
60
+ operationPosition: z.number().int().min(1).optional()
61
+ };
62
+ const resourceNamesZod = z.array(z.string().trim().min(1).max(255)).max(20);
63
+ const hasNames = (names) => Boolean(names === null || names === void 0 ? void 0 : names.length);
64
+ const resourceSelectionZod = z
65
+ .object({
66
+ equipment: resourceNamesZod.optional(),
67
+ instruments: resourceNamesZod.optional(),
68
+ tooling: resourceNamesZod.optional(),
69
+ measuringInstruments: resourceNamesZod.optional()
70
+ })
71
+ .refine(resources => Object.values(resources).some(hasNames), {
72
+ message: 'Укажите хотя бы один производственный ресурс.'
73
+ });
74
+ const resourceMutationZod = z
75
+ .object({
76
+ add: resourceNamesZod.optional(),
77
+ remove: resourceNamesZod.optional()
78
+ })
79
+ .refine(change => hasNames(change.add) || hasNames(change.remove), {
80
+ message: 'Укажите ресурсы для добавления или удаления.'
81
+ });
82
+ const resourceChangesZod = z.object({
83
+ equipment: resourceMutationZod.optional(),
84
+ instruments: resourceMutationZod.optional(),
85
+ tooling: resourceMutationZod.optional(),
86
+ measuringInstruments: resourceMutationZod.optional()
87
+ });
88
+ const validateEntityReference = (input, context) => {
89
+ if (!input.entityName && !input.entityDesignation) {
90
+ context.addIssue({
91
+ code: 'custom',
92
+ path: ['entityName'],
93
+ message: 'Укажите название или обозначение сущности ERP.'
94
+ });
95
+ }
96
+ };
97
+ const validateOperationReference = (input, context) => {
98
+ if (!input.operationName && !input.operationPosition) {
99
+ context.addIssue({
100
+ code: 'custom',
101
+ path: ['operationName'],
102
+ message: 'Укажите название или позицию операции.'
103
+ });
104
+ }
105
+ };
106
+ exports.ErpTechnologyGetInputShape = entityReferenceShape;
107
+ exports.ErpTechnologyReferenceSearchInputShape = {
108
+ kind: z.nativeEnum(ErpTechnologyReferenceKindEnum),
109
+ query: z.string().trim().max(200).default(''),
110
+ limit: z.number().int().min(1).max(20).default(10)
111
+ };
112
+ exports.ErpTechnologyOperationAddInputShape = Object.assign(Object.assign({}, entityReferenceShape), { operationTypeName: z.string().trim().min(1).max(255), position: z.number().int().min(1).optional(), mainTime: z.number().min(0).max(1000000).default(0), note: z.string().max(4000).default(''), resources: resourceSelectionZod.optional(), idempotencyKey: idempotencyKeyZod });
113
+ exports.ErpTechnologyOperationUpdateInputShape = Object.assign(Object.assign(Object.assign({}, entityReferenceShape), operationReferenceShape), { changes: z.object({
114
+ operationTypeName: z.string().trim().min(1).max(255).optional(),
115
+ mainTime: z.number().min(0).max(1000000).optional(),
116
+ note: z.string().max(4000).optional(),
117
+ resources: resourceChangesZod.optional()
118
+ }), idempotencyKey: idempotencyKeyZod });
119
+ exports.ErpTechnologyOperationMoveInputShape = Object.assign(Object.assign(Object.assign({}, entityReferenceShape), operationReferenceShape), { position: z.number().int().min(1), idempotencyKey: idempotencyKeyZod });
120
+ exports.ErpTechnologyOperationRemoveInputShape = Object.assign(Object.assign(Object.assign({}, entityReferenceShape), operationReferenceShape), { idempotencyKey: idempotencyKeyZod });
121
+ exports.ErpTechnologyProcessUpdateInputShape = Object.assign(Object.assign({}, entityReferenceShape), { note: z.string().max(4000), idempotencyKey: idempotencyKeyZod });
122
+ exports.ErpTechnologyGetInputZod = z
123
+ .object(exports.ErpTechnologyGetInputShape)
124
+ .superRefine(validateEntityReference);
125
+ exports.ErpTechnologyReferenceSearchInputZod = z.object(exports.ErpTechnologyReferenceSearchInputShape);
126
+ exports.ErpTechnologyOperationAddInputZod = z
127
+ .object(exports.ErpTechnologyOperationAddInputShape)
128
+ .superRefine(validateEntityReference);
129
+ exports.ErpTechnologyOperationUpdateInputZod = z
130
+ .object(exports.ErpTechnologyOperationUpdateInputShape)
131
+ .superRefine((input, context) => {
132
+ validateEntityReference(input, context);
133
+ validateOperationReference(input, context);
134
+ if (Object.keys(input.changes).length === 0) {
135
+ context.addIssue({
136
+ code: 'custom',
137
+ path: ['changes'],
138
+ message: 'Укажите хотя бы одно изменение операции.'
139
+ });
140
+ }
141
+ });
142
+ exports.ErpTechnologyOperationMoveInputZod = z
143
+ .object(exports.ErpTechnologyOperationMoveInputShape)
144
+ .superRefine((input, context) => {
145
+ validateEntityReference(input, context);
146
+ validateOperationReference(input, context);
147
+ });
148
+ exports.ErpTechnologyOperationRemoveInputZod = z
149
+ .object(exports.ErpTechnologyOperationRemoveInputShape)
150
+ .superRefine((input, context) => {
151
+ validateEntityReference(input, context);
152
+ validateOperationReference(input, context);
153
+ });
154
+ exports.ErpTechnologyProcessUpdateInputZod = z
155
+ .object(exports.ErpTechnologyProcessUpdateInputShape)
156
+ .superRefine(validateEntityReference);
@@ -7,13 +7,16 @@ export declare enum AiMcpOperationStatusEnum {
7
7
  export declare enum AiMcpOperationNameEnum {
8
8
  createDetailAndAddToCbed = "create-detail-and-add-to-cbed",
9
9
  archiveDetail = "archive-detail",
10
+ mutateSpecification = "mutate-specification",
10
11
  uploadAndAttachEntityDocument = "upload-and-attach-entity-document",
11
12
  attachEntityDocument = "attach-entity-document",
12
13
  detachEntityDocument = "detach-entity-document",
13
14
  setMainEntityDocument = "set-main-entity-document",
14
15
  updateDocument = "update-document",
15
16
  archiveDocument = "archive-document",
16
- restoreDocument = "restore-document"
17
+ restoreDocument = "restore-document",
18
+ updateEntityEditor = "update-entity-editor",
19
+ mutateTechnology = "mutate-technology"
17
20
  }
18
21
  export declare enum AiMcpCommandStatusEnum {
19
22
  queued = "queued"
@@ -45,6 +45,7 @@ var AiMcpOperationNameEnum;
45
45
  (function (AiMcpOperationNameEnum) {
46
46
  AiMcpOperationNameEnum["createDetailAndAddToCbed"] = "create-detail-and-add-to-cbed";
47
47
  AiMcpOperationNameEnum["archiveDetail"] = "archive-detail";
48
+ AiMcpOperationNameEnum["mutateSpecification"] = "mutate-specification";
48
49
  AiMcpOperationNameEnum["uploadAndAttachEntityDocument"] = "upload-and-attach-entity-document";
49
50
  AiMcpOperationNameEnum["attachEntityDocument"] = "attach-entity-document";
50
51
  AiMcpOperationNameEnum["detachEntityDocument"] = "detach-entity-document";
@@ -52,6 +53,8 @@ var AiMcpOperationNameEnum;
52
53
  AiMcpOperationNameEnum["updateDocument"] = "update-document";
53
54
  AiMcpOperationNameEnum["archiveDocument"] = "archive-document";
54
55
  AiMcpOperationNameEnum["restoreDocument"] = "restore-document";
56
+ AiMcpOperationNameEnum["updateEntityEditor"] = "update-entity-editor";
57
+ AiMcpOperationNameEnum["mutateTechnology"] = "mutate-technology";
55
58
  })(AiMcpOperationNameEnum || (exports.AiMcpOperationNameEnum = AiMcpOperationNameEnum = {}));
56
59
  var AiMcpCommandStatusEnum;
57
60
  (function (AiMcpCommandStatusEnum) {
@@ -179,7 +182,9 @@ exports.ErpEntityFilesListInputShape = {
179
182
  };
180
183
  exports.ErpFilesSearchInputShape = {
181
184
  query: z.string().trim().min(1).max(200),
182
- state: z.nativeEnum(ErpDocumentStateEnum).default(ErpDocumentStateEnum.active),
185
+ state: z
186
+ .nativeEnum(ErpDocumentStateEnum)
187
+ .default(ErpDocumentStateEnum.active),
183
188
  limit: z.number().int().min(1).max(20).default(10)
184
189
  };
185
190
  exports.ErpEntityFileAttachInputShape = Object.assign(Object.assign(Object.assign({}, erpDocumentEntityReferenceShape), erpDocumentReferenceShape), { makeMain: z.boolean().default(false), idempotencyKey: idempotencyKeyZod });
@@ -0,0 +1 @@
1
+ export * from './schemas/queue-ownership.schema';
@@ -0,0 +1,17 @@
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("./schemas/queue-ownership.schema"), exports);
@@ -0,0 +1,74 @@
1
+ import { z } from 'zod';
2
+ export declare const QueueOwnershipKeysSchema: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
3
+ export declare const QueueOwnershipBatchIdSchema: z.ZodString;
4
+ export declare const QueueOwnershipReservationSchema: z.ZodObject<{
5
+ batchId: z.ZodString;
6
+ ownershipKeys: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ batchId: string;
9
+ ownershipKeys: string[];
10
+ }, {
11
+ batchId: string;
12
+ ownershipKeys: string[];
13
+ }>;
14
+ export declare const QueueOwnershipClaimSchema: z.ZodObject<{
15
+ registered: z.ZodBoolean;
16
+ batchId: z.ZodNullable<z.ZodString>;
17
+ ownershipKeys: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
18
+ }, "strip", z.ZodTypeAny, {
19
+ batchId: string | null;
20
+ ownershipKeys: string[];
21
+ registered: boolean;
22
+ }, {
23
+ batchId: string | null;
24
+ ownershipKeys: string[];
25
+ registered: boolean;
26
+ }>;
27
+ export declare const QueueOwnershipJobProgressSchema: z.ZodObject<{
28
+ stage: z.ZodLiteral<"deduplication">;
29
+ status: z.ZodEnum<["processed", "partially_skipped", "skipped"]>;
30
+ requestedData: z.ZodUnknown;
31
+ processedData: z.ZodUnknown;
32
+ skippedData: z.ZodUnknown;
33
+ reason: z.ZodNullable<z.ZodLiteral<"superseded_by_newer_job">>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ status: "processed" | "partially_skipped" | "skipped";
36
+ stage: "deduplication";
37
+ reason: "superseded_by_newer_job" | null;
38
+ requestedData?: unknown;
39
+ processedData?: unknown;
40
+ skippedData?: unknown;
41
+ }, {
42
+ status: "processed" | "partially_skipped" | "skipped";
43
+ stage: "deduplication";
44
+ reason: "superseded_by_newer_job" | null;
45
+ requestedData?: unknown;
46
+ processedData?: unknown;
47
+ skippedData?: unknown;
48
+ }>;
49
+ export declare const ProductDeficitConcurrencyTestResultSchema: z.ZodObject<{
50
+ productId: z.ZodNumber;
51
+ overlapProductId: z.ZodNumber;
52
+ requestedJobs: z.ZodNumber;
53
+ createdJobs: z.ZodNumber;
54
+ jobIds: z.ZodArray<z.ZodString, "many">;
55
+ submittedPayloads: z.ZodArray<z.ZodArray<z.ZodNumber, "many">, "many">;
56
+ }, "strip", z.ZodTypeAny, {
57
+ productId: number;
58
+ overlapProductId: number;
59
+ requestedJobs: number;
60
+ createdJobs: number;
61
+ jobIds: string[];
62
+ submittedPayloads: number[][];
63
+ }, {
64
+ productId: number;
65
+ overlapProductId: number;
66
+ requestedJobs: number;
67
+ createdJobs: number;
68
+ jobIds: string[];
69
+ submittedPayloads: number[][];
70
+ }>;
71
+ export type QueueOwnershipReservation = z.infer<typeof QueueOwnershipReservationSchema>;
72
+ export type QueueOwnershipClaim = z.infer<typeof QueueOwnershipClaimSchema>;
73
+ export type QueueOwnershipJobProgress = z.infer<typeof QueueOwnershipJobProgressSchema>;
74
+ export type ProductDeficitConcurrencyTestResult = z.infer<typeof ProductDeficitConcurrencyTestResultSchema>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductDeficitConcurrencyTestResultSchema = exports.QueueOwnershipJobProgressSchema = exports.QueueOwnershipClaimSchema = exports.QueueOwnershipReservationSchema = exports.QueueOwnershipBatchIdSchema = exports.QueueOwnershipKeysSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.QueueOwnershipKeysSchema = zod_1.z
6
+ .array(zod_1.z.string().trim().min(1))
7
+ .transform(ownershipKeys => Array.from(new Set(ownershipKeys)));
8
+ exports.QueueOwnershipBatchIdSchema = zod_1.z.string().uuid();
9
+ exports.QueueOwnershipReservationSchema = zod_1.z.object({
10
+ batchId: exports.QueueOwnershipBatchIdSchema,
11
+ ownershipKeys: exports.QueueOwnershipKeysSchema
12
+ });
13
+ exports.QueueOwnershipClaimSchema = zod_1.z.object({
14
+ registered: zod_1.z.boolean(),
15
+ batchId: exports.QueueOwnershipBatchIdSchema.nullable(),
16
+ ownershipKeys: exports.QueueOwnershipKeysSchema
17
+ });
18
+ exports.QueueOwnershipJobProgressSchema = zod_1.z.object({
19
+ stage: zod_1.z.literal('deduplication'),
20
+ status: zod_1.z.enum(['processed', 'partially_skipped', 'skipped']),
21
+ requestedData: zod_1.z.unknown(),
22
+ processedData: zod_1.z.unknown(),
23
+ skippedData: zod_1.z.unknown(),
24
+ reason: zod_1.z.literal('superseded_by_newer_job').nullable()
25
+ });
26
+ exports.ProductDeficitConcurrencyTestResultSchema = zod_1.z.object({
27
+ productId: zod_1.z.number().int().positive(),
28
+ overlapProductId: zod_1.z.number().int().positive(),
29
+ requestedJobs: zod_1.z.number().int().positive(),
30
+ createdJobs: zod_1.z.number().int().nonnegative(),
31
+ jobIds: zod_1.z.array(zod_1.z.string()),
32
+ submittedPayloads: zod_1.z.array(zod_1.z.array(zod_1.z.number().int().positive()))
33
+ });
@@ -1,4 +1,5 @@
1
1
  export * from './schemas/deficit.schema';
2
+ export * from './schemas/deficit-queue.schema';
2
3
  export * from './interfaces/interface';
3
4
  export * from './dto/create-deficite.dto';
4
5
  export * from './dto/deficit-material.dto';
@@ -15,6 +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/deficit.schema"), exports);
18
+ __exportStar(require("./schemas/deficit-queue.schema"), exports);
18
19
  __exportStar(require("./interfaces/interface"), exports);
19
20
  __exportStar(require("./dto/create-deficite.dto"), exports);
20
21
  __exportStar(require("./dto/deficit-material.dto"), exports);
@@ -0,0 +1,2 @@
1
+ import { z } from 'zod';
2
+ export declare const DeficitQueueEntityIdsSchema: z.ZodEffects<z.ZodArray<z.ZodNumber, "many">, number[], number[]>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeficitQueueEntityIdsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.DeficitQueueEntityIdsSchema = zod_1.z
6
+ .array(zod_1.z.coerce.number().int().positive())
7
+ .transform(entityIds => Array.from(new Set(entityIds)));