@naisys/erp-shared 3.0.0-beta.10
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/dist/admin-types.js +41 -0
- package/dist/api-types.js +4 -0
- package/dist/audit-types.js +19 -0
- package/dist/auth-types.js +15 -0
- package/dist/error-types.js +6 -0
- package/dist/field-ref-types.js +55 -0
- package/dist/field-types.js +61 -0
- package/dist/hateoas-types.js +1 -0
- package/dist/index.js +25 -0
- package/dist/inventory-types.js +26 -0
- package/dist/item-instance-types.js +52 -0
- package/dist/item-types.js +55 -0
- package/dist/labor-ticket-types.js +31 -0
- package/dist/mutation-types.js +97 -0
- package/dist/operation-dependency-types.js +24 -0
- package/dist/operation-run-comment-types.js +30 -0
- package/dist/operation-run-types.js +82 -0
- package/dist/operation-types.js +58 -0
- package/dist/order-revision-types.js +61 -0
- package/dist/order-run-types.js +141 -0
- package/dist/order-types.js +61 -0
- package/dist/revision-diff-types.js +55 -0
- package/dist/step-run-types.js +148 -0
- package/dist/step-types.js +51 -0
- package/dist/user-types.js +79 -0
- package/dist/work-center-types.js +79 -0
- package/package.json +32 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
import { HateoasActionSchema, HateoasLinkSchema, HateoasLinkTemplateSchema, } from "./hateoas-types.js";
|
|
3
|
+
// Work center user assignment (embedded in detail response)
|
|
4
|
+
export const WorkCenterUserSchema = z.object({
|
|
5
|
+
userId: z.number(),
|
|
6
|
+
username: z.string(),
|
|
7
|
+
createdAt: z.string(),
|
|
8
|
+
createdBy: z.string().nullable(),
|
|
9
|
+
_actions: z.array(HateoasActionSchema).optional(),
|
|
10
|
+
});
|
|
11
|
+
// Full work center response
|
|
12
|
+
export const WorkCenterSchema = z.object({
|
|
13
|
+
id: z.number(),
|
|
14
|
+
key: z.string(),
|
|
15
|
+
description: z.string(),
|
|
16
|
+
userAssignments: z.array(WorkCenterUserSchema),
|
|
17
|
+
createdAt: z.iso.datetime(),
|
|
18
|
+
createdBy: z.string(),
|
|
19
|
+
updatedAt: z.iso.datetime(),
|
|
20
|
+
updatedBy: z.string(),
|
|
21
|
+
_links: z.array(HateoasLinkSchema),
|
|
22
|
+
_actions: z.array(HateoasActionSchema).optional(),
|
|
23
|
+
});
|
|
24
|
+
// Input for creating a work center
|
|
25
|
+
export const CreateWorkCenterSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
key: z
|
|
28
|
+
.string()
|
|
29
|
+
.min(1)
|
|
30
|
+
.max(100)
|
|
31
|
+
.regex(/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/, "Key must be alphanumeric with hyphens"),
|
|
32
|
+
description: z.string().max(2000).optional().default(""),
|
|
33
|
+
})
|
|
34
|
+
.strict();
|
|
35
|
+
// Input for updating a work center
|
|
36
|
+
export const UpdateWorkCenterSchema = z
|
|
37
|
+
.object({
|
|
38
|
+
key: z
|
|
39
|
+
.string()
|
|
40
|
+
.min(1)
|
|
41
|
+
.max(100)
|
|
42
|
+
.regex(/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/, "Key must be alphanumeric with hyphens")
|
|
43
|
+
.optional(),
|
|
44
|
+
description: z.string().max(2000).optional(),
|
|
45
|
+
})
|
|
46
|
+
.strict();
|
|
47
|
+
// Input for assigning a user to a work center
|
|
48
|
+
export const AssignWorkCenterUserSchema = z
|
|
49
|
+
.object({
|
|
50
|
+
username: z.string().min(1),
|
|
51
|
+
})
|
|
52
|
+
.strict();
|
|
53
|
+
// Query params for listing work centers
|
|
54
|
+
export const WorkCenterListQuerySchema = z.object({
|
|
55
|
+
page: z.coerce.number().int().min(1).optional().default(1),
|
|
56
|
+
pageSize: z.coerce.number().int().min(1).max(100).optional().default(20),
|
|
57
|
+
search: z.string().optional(),
|
|
58
|
+
});
|
|
59
|
+
// Work center list item (lighter response)
|
|
60
|
+
export const WorkCenterListItemSchema = z.object({
|
|
61
|
+
id: z.number(),
|
|
62
|
+
key: z.string(),
|
|
63
|
+
description: z.string(),
|
|
64
|
+
userCount: z.number(),
|
|
65
|
+
createdAt: z.iso.datetime(),
|
|
66
|
+
createdBy: z.string(),
|
|
67
|
+
updatedAt: z.iso.datetime(),
|
|
68
|
+
updatedBy: z.string(),
|
|
69
|
+
});
|
|
70
|
+
// List response
|
|
71
|
+
export const WorkCenterListResponseSchema = z.object({
|
|
72
|
+
items: z.array(WorkCenterListItemSchema),
|
|
73
|
+
total: z.number(),
|
|
74
|
+
page: z.number(),
|
|
75
|
+
pageSize: z.number(),
|
|
76
|
+
_links: z.array(HateoasLinkSchema),
|
|
77
|
+
_linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
|
|
78
|
+
_actions: z.array(HateoasActionSchema).optional(),
|
|
79
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@naisys/erp-shared",
|
|
3
|
+
"version": "3.0.0-beta.10",
|
|
4
|
+
"description": "[internal] NAISYS ERP shared types and validation schemas",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"!dist/**/*.map",
|
|
9
|
+
"!dist/**/*.d.ts",
|
|
10
|
+
"!dist/**/*.d.ts.map"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"clean": "rimraf dist",
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"type-check": "tsc --noEmit",
|
|
16
|
+
"npm:publish:dryrun": "npm publish --dry-run",
|
|
17
|
+
"npm:publish": "npm publish --access public"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^5.9.3"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@naisys/common": "3.0.0-beta.10",
|
|
24
|
+
"zod": "^4.3.6"
|
|
25
|
+
},
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|