@naisys/erp-shared 3.0.0-beta.4 → 3.0.0-beta.41

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 (54) hide show
  1. package/dist/admin-types.js +6 -2
  2. package/dist/api-types.js +1 -0
  3. package/dist/audit-types.js +1 -0
  4. package/dist/auth-types.js +1 -0
  5. package/dist/error-types.js +7 -0
  6. package/dist/field-ref-types.js +1 -0
  7. package/dist/field-types.js +1 -0
  8. package/dist/hateoas-types.js +1 -0
  9. package/dist/index.js +2 -0
  10. package/dist/inventory-types.js +3 -2
  11. package/dist/item-instance-types.js +3 -2
  12. package/dist/item-types.js +3 -2
  13. package/dist/labor-ticket-types.js +1 -0
  14. package/dist/mutation-types.js +1 -1
  15. package/dist/operation-dependency-types.js +1 -0
  16. package/dist/operation-run-comment-types.js +1 -0
  17. package/dist/operation-run-types.js +3 -0
  18. package/dist/operation-types.js +1 -0
  19. package/dist/order-revision-types.js +3 -2
  20. package/dist/order-run-types.js +38 -6
  21. package/dist/order-types.js +4 -2
  22. package/dist/pagination-types.js +53 -0
  23. package/dist/revision-diff-types.js +1 -0
  24. package/dist/step-run-types.js +1 -0
  25. package/dist/step-types.js +1 -0
  26. package/dist/user-types.js +4 -3
  27. package/dist/work-center-types.js +3 -2
  28. package/package.json +6 -4
  29. package/dist/admin-types.d.ts +0 -80
  30. package/dist/api-types.d.ts +0 -6
  31. package/dist/audit-types.d.ts +0 -32
  32. package/dist/auth-types.d.ts +0 -21
  33. package/dist/error-types.d.ts +0 -8
  34. package/dist/field-ref-types.d.ts +0 -178
  35. package/dist/field-types.d.ts +0 -190
  36. package/dist/hateoas-types.d.ts +0 -2
  37. package/dist/index.d.ts +0 -26
  38. package/dist/inventory-types.d.ts +0 -53
  39. package/dist/item-instance-types.d.ts +0 -188
  40. package/dist/item-types.d.ts +0 -262
  41. package/dist/labor-ticket-types.d.ts +0 -94
  42. package/dist/mutation-types.d.ts +0 -381
  43. package/dist/operation-dependency-types.d.ts +0 -60
  44. package/dist/operation-run-comment-types.d.ts +0 -92
  45. package/dist/operation-run-types.d.ts +0 -274
  46. package/dist/operation-types.d.ts +0 -145
  47. package/dist/order-revision-types.d.ts +0 -162
  48. package/dist/order-run-types.d.ts +0 -361
  49. package/dist/order-types.d.ts +0 -143
  50. package/dist/revision-diff-types.d.ts +0 -196
  51. package/dist/step-run-types.d.ts +0 -431
  52. package/dist/step-types.d.ts +0 -276
  53. package/dist/user-types.d.ts +0 -109
  54. package/dist/work-center-types.d.ts +0 -151
@@ -1,8 +1,12 @@
1
1
  import { z } from "zod/v4";
2
2
  import { HateoasActionSchema, HateoasLinkSchema } from "./hateoas-types.js";
3
+ import { paginationQuery } from "./pagination-types.js";
3
4
  export const AdminInfoResponseSchema = z.object({
5
+ erpVersion: z.string(),
4
6
  erpDbPath: z.string(),
5
7
  erpDbSize: z.number().optional(),
8
+ erpDbVersion: z.number(),
9
+ targetVersion: z.string().optional(),
6
10
  _actions: z.array(HateoasActionSchema).optional(),
7
11
  });
8
12
  export const AdminAttachmentItemSchema = z.object({
@@ -14,8 +18,7 @@ export const AdminAttachmentItemSchema = z.object({
14
18
  createdAt: z.string(),
15
19
  });
16
20
  export const AdminAttachmentListRequestSchema = z.object({
17
- page: z.coerce.number().optional().default(1),
18
- pageSize: z.coerce.number().optional().default(50),
21
+ ...paginationQuery(50),
19
22
  });
20
23
  export const AdminAttachmentListResponseSchema = z.object({
21
24
  attachments: z.array(AdminAttachmentItemSchema),
@@ -39,3 +42,4 @@ export const ServerLogResponseSchema = z.object({
39
42
  fileName: z.string(),
40
43
  fileSize: z.number().optional(),
41
44
  });
45
+ //# sourceMappingURL=admin-types.js.map
package/dist/api-types.js CHANGED
@@ -2,3 +2,4 @@ import { z } from "zod/v4";
2
2
  export const HelloResponseSchema = z.object({
3
3
  message: z.string(),
4
4
  });
5
+ //# sourceMappingURL=api-types.js.map
@@ -17,3 +17,4 @@ export const AuditQuerySchema = z.object({
17
17
  entityType: z.string(),
18
18
  entityId: z.coerce.number().int(),
19
19
  });
20
+ //# sourceMappingURL=audit-types.js.map
@@ -13,3 +13,4 @@ export const AuthUserSchema = z.object({
13
13
  export const LoginResponseSchema = z.object({
14
14
  user: AuthUserSchema,
15
15
  });
16
+ //# sourceMappingURL=auth-types.js.map
@@ -3,4 +3,11 @@ export const ErrorResponseSchema = z.object({
3
3
  statusCode: z.number().int(),
4
4
  error: z.string(),
5
5
  message: z.string(),
6
+ /**
7
+ * For 403 responses raised by a permission check, the name of the
8
+ * missing permission. Lets clients react structurally without having
9
+ * to parse the human-readable `message`.
10
+ */
11
+ missingPermission: z.string().optional(),
6
12
  });
13
+ //# sourceMappingURL=error-types.js.map
@@ -53,3 +53,4 @@ export const FieldRefValueSummarySchema = z.object({
53
53
  multiSet: z.boolean(),
54
54
  fieldValues: z.array(FieldValueEntrySchema),
55
55
  });
56
+ //# sourceMappingURL=field-ref-types.js.map
@@ -59,3 +59,4 @@ export const FieldListResponseSchema = z.object({
59
59
  _linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
60
60
  _actions: z.array(HateoasActionSchema).optional(),
61
61
  });
62
+ //# sourceMappingURL=field-types.js.map
@@ -1 +1,2 @@
1
1
  export { HateoasActionSchema, HateoasActionTemplateSchema, HateoasLinkSchema, HateoasLinksSchema, HateoasLinkTemplateSchema, } from "@naisys/common";
2
+ //# sourceMappingURL=hateoas-types.js.map
package/dist/index.js CHANGED
@@ -18,8 +18,10 @@ export * from "./operation-types.js";
18
18
  export * from "./order-revision-types.js";
19
19
  export * from "./order-run-types.js";
20
20
  export * from "./order-types.js";
21
+ export * from "./pagination-types.js";
21
22
  export * from "./revision-diff-types.js";
22
23
  export * from "./step-run-types.js";
23
24
  export * from "./step-types.js";
24
25
  export * from "./user-types.js";
25
26
  export * from "./work-center-types.js";
27
+ //# sourceMappingURL=index.js.map
@@ -1,9 +1,9 @@
1
1
  import { z } from "zod/v4";
2
2
  import { HateoasActionTemplateSchema, HateoasLinkSchema, } from "./hateoas-types.js";
3
+ import { paginationQuery } from "./pagination-types.js";
3
4
  // Query params for inventory list (all item instances across all items)
4
5
  export const InventoryListQuerySchema = z.object({
5
- page: z.coerce.number().int().min(1).optional().default(1),
6
- pageSize: z.coerce.number().int().min(1).max(100).optional().default(20),
6
+ ...paginationQuery(),
7
7
  search: z.string().optional(),
8
8
  });
9
9
  // Flattened inventory item for the list
@@ -24,3 +24,4 @@ export const InventoryListResponseSchema = z.object({
24
24
  _links: z.array(HateoasLinkSchema),
25
25
  _actionTemplates: z.array(HateoasActionTemplateSchema).optional(),
26
26
  });
27
+ //# sourceMappingURL=inventory-types.js.map
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
  import { HateoasActionSchema, HateoasActionTemplateSchema, HateoasLinkSchema, HateoasLinkTemplateSchema, } from "./hateoas-types.js";
3
+ import { paginationQuery } from "./pagination-types.js";
3
4
  import { FieldValueEntrySchema } from "./step-run-types.js";
4
5
  // Full item instance response shape
5
6
  export const ItemInstanceSchema = z.object({
@@ -36,8 +37,7 @@ export const UpdateItemInstanceSchema = z
36
37
  .strict();
37
38
  // Query params for listing item instances
38
39
  export const ItemInstanceListQuerySchema = z.object({
39
- page: z.coerce.number().int().min(1).optional().default(1),
40
- pageSize: z.coerce.number().int().min(1).max(100).optional().default(20),
40
+ ...paginationQuery(),
41
41
  search: z.string().optional(),
42
42
  });
43
43
  // List response
@@ -50,3 +50,4 @@ export const ItemInstanceListResponseSchema = z.object({
50
50
  _linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
51
51
  _actions: z.array(HateoasActionSchema).optional(),
52
52
  });
53
+ //# sourceMappingURL=item-instance-types.js.map
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod/v4";
2
2
  import { FieldListResponseSchema } from "./field-types.js";
3
3
  import { HateoasActionSchema, HateoasLinkSchema, HateoasLinkTemplateSchema, } from "./hateoas-types.js";
4
+ import { paginationQuery } from "./pagination-types.js";
4
5
  // Full item response shape
5
6
  export const ItemSchema = z.object({
6
7
  id: z.number(),
@@ -39,8 +40,7 @@ export const UpdateItemSchema = z
39
40
  .strict();
40
41
  // Query params for listing items
41
42
  export const ItemListQuerySchema = z.object({
42
- page: z.coerce.number().int().min(1).optional().default(1),
43
- pageSize: z.coerce.number().int().min(1).max(100).optional().default(20),
43
+ ...paginationQuery(),
44
44
  search: z.string().optional(),
45
45
  });
46
46
  // List response
@@ -53,3 +53,4 @@ export const ItemListResponseSchema = z.object({
53
53
  _linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
54
54
  _actions: z.array(HateoasActionSchema).optional(),
55
55
  });
56
+ //# sourceMappingURL=item-types.js.map
@@ -29,3 +29,4 @@ export const LaborTicketListResponseSchema = z.object({
29
29
  _actions: z.array(HateoasActionSchema).optional(),
30
30
  _actionTemplates: z.array(HateoasActionTemplateSchema).optional(),
31
31
  });
32
+ //# sourceMappingURL=labor-ticket-types.js.map
@@ -48,7 +48,6 @@ export const RunCreateResponseSchema = CreateResponseSchema.extend({
48
48
  export const UserCreateResponseSchema = z.object({
49
49
  id: z.number(),
50
50
  username: z.string(),
51
- apiKey: z.string().nullable().optional(),
52
51
  _links: z.array(HateoasLinkSchema).optional(),
53
52
  _actions: z.array(HateoasActionSchema).optional(),
54
53
  });
@@ -95,3 +94,4 @@ export const DeleteSetMutateResponseSchema = z.object({
95
94
  setCount: z.number(),
96
95
  _actions: z.array(HateoasActionSchema).optional(),
97
96
  });
97
+ //# sourceMappingURL=mutation-types.js.map
@@ -22,3 +22,4 @@ export const OperationDependencyListResponseSchema = z.object({
22
22
  _actions: z.array(HateoasActionSchema).optional(),
23
23
  _actionTemplates: z.array(HateoasActionTemplateSchema).optional(),
24
24
  });
25
+ //# sourceMappingURL=operation-dependency-types.js.map
@@ -28,3 +28,4 @@ export const OperationRunCommentListResponseSchema = z.object({
28
28
  _linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
29
29
  _actions: z.array(HateoasActionSchema).optional(),
30
30
  });
31
+ //# sourceMappingURL=operation-run-comment-types.js.map
@@ -22,6 +22,8 @@ export const OperationRunSchema = z.object({
22
22
  id: z.number(),
23
23
  orderRunId: z.number(),
24
24
  operationId: z.number(),
25
+ revNo: z.number(),
26
+ orderDescription: z.string(),
25
27
  seqNo: z.number(),
26
28
  title: z.string(),
27
29
  description: z.string(),
@@ -80,3 +82,4 @@ export const OperationRunListResponseSchema = z.object({
80
82
  _linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
81
83
  _actions: z.array(HateoasActionSchema).optional(),
82
84
  });
85
+ //# sourceMappingURL=operation-run-types.js.map
@@ -56,3 +56,4 @@ export const OperationListResponseSchema = z.object({
56
56
  _linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
57
57
  _actions: z.array(HateoasActionSchema).optional(),
58
58
  });
59
+ //# sourceMappingURL=operation-types.js.map
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
  import { HateoasActionSchema, HateoasLinkSchema, HateoasLinkTemplateSchema, } from "./hateoas-types.js";
3
+ import { paginationQuery } from "./pagination-types.js";
3
4
  // Operation summary embedded in revision GET responses
4
5
  export const RevisionOperationSummarySchema = z.object({
5
6
  seqNo: z.number(),
@@ -40,8 +41,7 @@ export const UpdateOrderRevisionSchema = z
40
41
  .strict();
41
42
  // Query params for listing revisions
42
43
  export const OrderRevisionListQuerySchema = z.object({
43
- page: z.coerce.number().int().min(1).optional().default(1),
44
- pageSize: z.coerce.number().int().min(1).max(100).optional().default(20),
44
+ ...paginationQuery(),
45
45
  status: RevisionStatusEnum.optional(),
46
46
  includeObsolete: z
47
47
  .enum(["true", "false"])
@@ -59,3 +59,4 @@ export const OrderRevisionListResponseSchema = z.object({
59
59
  _linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
60
60
  _actions: z.array(HateoasActionSchema).optional(),
61
61
  });
62
+ //# sourceMappingURL=order-revision-types.js.map
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod/v4";
2
2
  import { HateoasActionSchema, HateoasActionTemplateSchema, HateoasLinkSchema, HateoasLinkTemplateSchema, } from "./hateoas-types.js";
3
3
  import { OperationRunStatusEnum } from "./operation-run-types.js";
4
+ import { paginationQuery } from "./pagination-types.js";
4
5
  // Operation summary embedded in order run GET responses
5
6
  export const OperationRunSummarySchema = z.object({
6
7
  seqNo: z.number(),
@@ -28,6 +29,7 @@ export const OrderRunSchema = z.object({
28
29
  orderId: z.number(),
29
30
  orderKey: z.string(),
30
31
  revNo: z.number(),
32
+ description: z.string(),
31
33
  itemKey: z.string().nullable(),
32
34
  instanceId: z.number().nullable(),
33
35
  instanceKey: z.string().nullable(),
@@ -65,14 +67,18 @@ export const UpdateOrderRunSchema = z
65
67
  releaseNote: z.string().max(2000).nullable().optional(),
66
68
  })
67
69
  .strict();
68
- // Input for completing an order run (creates item instance + closes run)
70
+ // Input for completing an order run (creates item instance + closes run).
71
+ // `fieldValues[].fieldSeqNo` is the per-item field sequence number — matches
72
+ // the field-update endpoint at /items/{key}/instances/{instanceId}/fields/{fieldSeqNo}.
73
+ // If any required item field is empty, the endpoint returns 400 with the
74
+ // missing field labels rather than creating an invalid instance.
69
75
  export const CompleteOrderRunSchema = z
70
76
  .object({
71
77
  instanceKey: z.string().max(200).optional(),
72
78
  quantity: z.number().nullable().optional(),
73
79
  fieldValues: z
74
80
  .array(z.object({
75
- fieldId: z.number().int(),
81
+ fieldSeqNo: z.number().int(),
76
82
  value: z.string().max(2000),
77
83
  setIndex: z.number().int().min(0).optional(),
78
84
  }))
@@ -81,8 +87,7 @@ export const CompleteOrderRunSchema = z
81
87
  .strict();
82
88
  // Query params for listing order runs
83
89
  export const OrderRunListQuerySchema = z.object({
84
- page: z.coerce.number().int().min(1).optional().default(1),
85
- pageSize: z.coerce.number().int().min(1).max(100).optional().default(20),
90
+ ...paginationQuery(),
86
91
  status: OrderRunStatusEnum.optional(),
87
92
  priority: OrderRunPriorityEnum.optional(),
88
93
  search: z.string().optional(),
@@ -99,8 +104,7 @@ export const OrderRunListResponseSchema = z.object({
99
104
  });
100
105
  // Query params for dispatch view (operation runs across open orders)
101
106
  export const DispatchListQuerySchema = z.object({
102
- page: z.coerce.number().int().min(1).optional().default(1),
103
- pageSize: z.coerce.number().int().min(1).max(100).optional().default(20),
107
+ ...paginationQuery(),
104
108
  status: OperationRunStatusEnum.optional(),
105
109
  priority: OrderRunPriorityEnum.optional(),
106
110
  search: z.string().optional(),
@@ -139,3 +143,31 @@ export const DispatchListResponseSchema = z.object({
139
143
  _linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
140
144
  _actionTemplates: z.array(HateoasActionTemplateSchema).optional(),
141
145
  });
146
+ // Query params for ready-to-close view: open order runs with no open ops
147
+ export const ReadyToCloseListQuerySchema = z.object({
148
+ ...paginationQuery(),
149
+ priority: OrderRunPriorityEnum.optional(),
150
+ search: z.string().optional(),
151
+ });
152
+ // Ready-to-close item = order run whose ops are all completed/skipped
153
+ export const ReadyToCloseItemSchema = z.object({
154
+ id: z.number(),
155
+ orderKey: z.string(),
156
+ revNo: z.number(),
157
+ runNo: z.number(),
158
+ description: z.string(),
159
+ status: OrderRunStatusEnum,
160
+ priority: OrderRunPriorityEnum,
161
+ dueAt: z.string().nullable(),
162
+ opCount: z.number(),
163
+ createdAt: z.iso.datetime(),
164
+ });
165
+ export const ReadyToCloseListResponseSchema = z.object({
166
+ items: z.array(ReadyToCloseItemSchema),
167
+ total: z.number(),
168
+ page: z.number(),
169
+ pageSize: z.number(),
170
+ _links: z.array(HateoasLinkSchema),
171
+ _linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
172
+ });
173
+ //# sourceMappingURL=order-run-types.js.map
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
  import { HateoasActionSchema, HateoasLinkSchema, HateoasLinkTemplateSchema, } from "./hateoas-types.js";
3
+ import { paginationQuery } from "./pagination-types.js";
3
4
  export const OrderStatusEnum = z.enum(["active", "archived"]);
4
5
  export const OrderStatus = OrderStatusEnum.enum;
5
6
  // Full order response shape
@@ -9,6 +10,7 @@ export const OrderSchema = z.object({
9
10
  description: z.string(),
10
11
  status: OrderStatusEnum,
11
12
  itemKey: z.string().nullable(),
13
+ latestApprovedRevNo: z.number().int().nullable().optional(),
12
14
  createdBy: z.string(),
13
15
  createdAt: z.iso.datetime(),
14
16
  updatedBy: z.string(),
@@ -44,8 +46,7 @@ export const UpdateOrderSchema = z
44
46
  .strict();
45
47
  // Query params for listing orders
46
48
  export const OrderListQuerySchema = z.object({
47
- page: z.coerce.number().int().min(1).optional().default(1),
48
- pageSize: z.coerce.number().int().min(1).max(100).optional().default(20),
49
+ ...paginationQuery(),
49
50
  status: z.enum(["active", "archived"]).optional(),
50
51
  search: z.string().optional(),
51
52
  });
@@ -59,3 +60,4 @@ export const OrderListResponseSchema = z.object({
59
60
  _linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
60
61
  _actions: z.array(HateoasActionSchema).optional(),
61
62
  });
63
+ //# sourceMappingURL=order-types.js.map
@@ -0,0 +1,53 @@
1
+ import { z } from "zod/v4";
2
+ /**
3
+ * Maximum allowed pageSize for any list endpoint.
4
+ *
5
+ * Callers may request a larger pageSize, but it will be silently clamped
6
+ * to this value. This is documented in the OpenAPI spec via the schema
7
+ * description so callers can discover the limit.
8
+ */
9
+ export const MAX_PAGE_SIZE = 100;
10
+ /**
11
+ * Build a `pageSize` query-param schema with a documented cap.
12
+ *
13
+ * Behaviour:
14
+ * - Coerces strings → numbers (querystrings are always strings).
15
+ * - Rejects values < 1 (floor of 1, then defaults).
16
+ * - Silently clamps oversized values to {@link MAX_PAGE_SIZE}.
17
+ * - Defaults to {@link defaultValue} when omitted.
18
+ *
19
+ * Apply via the shared {@link paginationQuery} helper rather than per-route.
20
+ */
21
+ export function pageSizeSchema(defaultValue = 20) {
22
+ return z.coerce
23
+ .number()
24
+ .int()
25
+ .min(1)
26
+ .optional()
27
+ .default(defaultValue)
28
+ .transform((n) => Math.min(n, MAX_PAGE_SIZE))
29
+ .describe(`Items per page. Values above ${MAX_PAGE_SIZE} are silently clamped to ${MAX_PAGE_SIZE}.`);
30
+ }
31
+ /**
32
+ * Page-number schema — coerced int >= 1, defaulting to 1.
33
+ */
34
+ export function pageSchema() {
35
+ return z.coerce.number().int().min(1).optional().default(1);
36
+ }
37
+ /**
38
+ * Standard pagination query fields. Spread into a list-query Zod object:
39
+ *
40
+ * ```ts
41
+ * export const InventoryListQuerySchema = z.object({
42
+ * ...paginationQuery(),
43
+ * search: z.string().optional(),
44
+ * });
45
+ * ```
46
+ */
47
+ export function paginationQuery(defaultPageSize = 20) {
48
+ return {
49
+ page: pageSchema(),
50
+ pageSize: pageSizeSchema(defaultPageSize),
51
+ };
52
+ }
53
+ //# sourceMappingURL=pagination-types.js.map
@@ -53,3 +53,4 @@ export const RevisionDiffQuerySchema = z.object({
53
53
  from: z.coerce.number().int().min(1),
54
54
  to: z.coerce.number().int().min(1),
55
55
  });
56
+ //# sourceMappingURL=revision-diff-types.js.map
@@ -146,3 +146,4 @@ export const StepRunListResponseSchema = z.object({
146
146
  _linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
147
147
  _actions: z.array(HateoasActionSchema).optional(),
148
148
  });
149
+ //# sourceMappingURL=step-run-types.js.map
@@ -49,3 +49,4 @@ export const StepListResponseSchema = z.object({
49
49
  _linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
50
50
  _actions: z.array(HateoasActionSchema).optional(),
51
51
  });
52
+ //# sourceMappingURL=step-types.js.map
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod/v4";
2
+ import { paginationQuery } from "./pagination-types.js";
2
3
  export const ErpPermissionEnum = z.enum([
3
4
  "erp_admin",
4
5
  "order_planner",
@@ -51,7 +52,7 @@ export const UserSchema = z.object({
51
52
  isAgent: z.boolean(),
52
53
  createdAt: z.string(),
53
54
  updatedAt: z.string(),
54
- apiKey: z.string().nullable().optional(),
55
+ hasApiKey: z.boolean(),
55
56
  permissions: z.array(UserPermissionSchema),
56
57
  _links: z.array(z.any()).optional(),
57
58
  _actions: z.array(z.any()).optional(),
@@ -73,7 +74,7 @@ export const UserListResponseSchema = z.object({
73
74
  _actions: z.array(z.any()).optional(),
74
75
  });
75
76
  export const UserListQuerySchema = z.object({
76
- page: z.coerce.number().int().min(1).default(1),
77
- pageSize: z.coerce.number().int().min(1).max(100).default(20),
77
+ ...paginationQuery(),
78
78
  search: z.string().optional(),
79
79
  });
80
+ //# sourceMappingURL=user-types.js.map
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
  import { HateoasActionSchema, HateoasLinkSchema, HateoasLinkTemplateSchema, } from "./hateoas-types.js";
3
+ import { paginationQuery } from "./pagination-types.js";
3
4
  // Work center user assignment (embedded in detail response)
4
5
  export const WorkCenterUserSchema = z.object({
5
6
  userId: z.number(),
@@ -52,8 +53,7 @@ export const AssignWorkCenterUserSchema = z
52
53
  .strict();
53
54
  // Query params for listing work centers
54
55
  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),
56
+ ...paginationQuery(),
57
57
  search: z.string().optional(),
58
58
  });
59
59
  // Work center list item (lighter response)
@@ -77,3 +77,4 @@ export const WorkCenterListResponseSchema = z.object({
77
77
  _linkTemplates: z.array(HateoasLinkTemplateSchema).optional(),
78
78
  _actions: z.array(HateoasActionSchema).optional(),
79
79
  });
80
+ //# sourceMappingURL=work-center-types.js.map
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@naisys/erp-shared",
3
- "version": "3.0.0-beta.4",
3
+ "version": "3.0.0-beta.41",
4
4
  "description": "[internal] NAISYS ERP shared types and validation schemas",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
8
- "!dist/**/*.map"
8
+ "!dist/**/*.map",
9
+ "!dist/**/*.d.ts",
10
+ "!dist/**/*.d.ts.map"
9
11
  ],
10
12
  "scripts": {
11
- "clean": "rimraf dist",
13
+ "clean": "npx rimraf dist",
12
14
  "build": "tsc",
13
15
  "type-check": "tsc --noEmit",
14
16
  "npm:publish:dryrun": "npm publish --dry-run",
@@ -18,7 +20,7 @@
18
20
  "typescript": "^5.9.3"
19
21
  },
20
22
  "dependencies": {
21
- "@naisys/common": "3.0.0-beta.4",
23
+ "@naisys/common": "3.0.0-beta.41",
22
24
  "zod": "^4.3.6"
23
25
  },
24
26
  "exports": {
@@ -1,80 +0,0 @@
1
- import { z } from "zod/v4";
2
- export declare const AdminInfoResponseSchema: z.ZodObject<{
3
- erpDbPath: z.ZodString;
4
- erpDbSize: z.ZodOptional<z.ZodNumber>;
5
- _actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
6
- rel: z.ZodString;
7
- href: z.ZodString;
8
- method: z.ZodString;
9
- title: z.ZodOptional<z.ZodString>;
10
- schema: z.ZodOptional<z.ZodString>;
11
- body: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
12
- alternateEncoding: z.ZodOptional<z.ZodObject<{
13
- contentType: z.ZodString;
14
- description: z.ZodOptional<z.ZodString>;
15
- fileFields: z.ZodArray<z.ZodString>;
16
- }, z.core.$strip>>;
17
- disabled: z.ZodOptional<z.ZodBoolean>;
18
- disabledReason: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
19
- }, z.core.$strip>>>;
20
- }, z.core.$strip>;
21
- export declare const AdminAttachmentItemSchema: z.ZodObject<{
22
- id: z.ZodString;
23
- filename: z.ZodString;
24
- fileSize: z.ZodNumber;
25
- fileHash: z.ZodString;
26
- uploadedBy: z.ZodString;
27
- createdAt: z.ZodString;
28
- }, z.core.$strip>;
29
- export type AdminAttachmentItem = z.infer<typeof AdminAttachmentItemSchema>;
30
- export declare const AdminAttachmentListRequestSchema: z.ZodObject<{
31
- page: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
32
- pageSize: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
33
- }, z.core.$strip>;
34
- export type AdminAttachmentListRequest = z.infer<typeof AdminAttachmentListRequestSchema>;
35
- export declare const AdminAttachmentListResponseSchema: z.ZodObject<{
36
- attachments: z.ZodArray<z.ZodObject<{
37
- id: z.ZodString;
38
- filename: z.ZodString;
39
- fileSize: z.ZodNumber;
40
- fileHash: z.ZodString;
41
- uploadedBy: z.ZodString;
42
- createdAt: z.ZodString;
43
- }, z.core.$strip>>;
44
- total: z.ZodNumber;
45
- page: z.ZodNumber;
46
- pageSize: z.ZodNumber;
47
- _links: z.ZodArray<z.ZodObject<{
48
- rel: z.ZodString;
49
- href: z.ZodString;
50
- method: z.ZodOptional<z.ZodString>;
51
- title: z.ZodOptional<z.ZodString>;
52
- schema: z.ZodOptional<z.ZodString>;
53
- }, z.core.$strip>>;
54
- }, z.core.$strip>;
55
- export type AdminAttachmentListResponse = z.infer<typeof AdminAttachmentListResponseSchema>;
56
- export type AdminInfoResponse = z.infer<typeof AdminInfoResponseSchema>;
57
- export declare const PinoLogEntrySchema: z.ZodObject<{
58
- level: z.ZodNumber;
59
- time: z.ZodNumber;
60
- msg: z.ZodString;
61
- detail: z.ZodOptional<z.ZodString>;
62
- }, z.core.$strip>;
63
- export type PinoLogEntry = z.infer<typeof PinoLogEntrySchema>;
64
- export declare const ServerLogRequestSchema: z.ZodObject<{
65
- lines: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
66
- minLevel: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
67
- }, z.core.$strip>;
68
- export type ServerLogRequest = z.infer<typeof ServerLogRequestSchema>;
69
- export declare const ServerLogResponseSchema: z.ZodObject<{
70
- entries: z.ZodArray<z.ZodObject<{
71
- level: z.ZodNumber;
72
- time: z.ZodNumber;
73
- msg: z.ZodString;
74
- detail: z.ZodOptional<z.ZodString>;
75
- }, z.core.$strip>>;
76
- fileName: z.ZodString;
77
- fileSize: z.ZodOptional<z.ZodNumber>;
78
- }, z.core.$strip>;
79
- export type ServerLogResponse = z.infer<typeof ServerLogResponseSchema>;
80
- //# sourceMappingURL=admin-types.d.ts.map
@@ -1,6 +0,0 @@
1
- import { z } from "zod/v4";
2
- export declare const HelloResponseSchema: z.ZodObject<{
3
- message: z.ZodString;
4
- }, z.core.$strip>;
5
- export type HelloResponse = z.infer<typeof HelloResponseSchema>;
6
- //# sourceMappingURL=api-types.d.ts.map
@@ -1,32 +0,0 @@
1
- import { z } from "zod/v4";
2
- export declare const AuditEntrySchema: z.ZodObject<{
3
- id: z.ZodNumber;
4
- entityType: z.ZodString;
5
- entityId: z.ZodNumber;
6
- action: z.ZodString;
7
- field: z.ZodString;
8
- oldValue: z.ZodNullable<z.ZodString>;
9
- newValue: z.ZodNullable<z.ZodString>;
10
- userId: z.ZodNumber;
11
- createdAt: z.ZodISODateTime;
12
- }, z.core.$strip>;
13
- export type AuditEntry = z.infer<typeof AuditEntrySchema>;
14
- export declare const AuditListResponseSchema: z.ZodObject<{
15
- items: z.ZodArray<z.ZodObject<{
16
- id: z.ZodNumber;
17
- entityType: z.ZodString;
18
- entityId: z.ZodNumber;
19
- action: z.ZodString;
20
- field: z.ZodString;
21
- oldValue: z.ZodNullable<z.ZodString>;
22
- newValue: z.ZodNullable<z.ZodString>;
23
- userId: z.ZodNumber;
24
- createdAt: z.ZodISODateTime;
25
- }, z.core.$strip>>;
26
- }, z.core.$strip>;
27
- export type AuditListResponse = z.infer<typeof AuditListResponseSchema>;
28
- export declare const AuditQuerySchema: z.ZodObject<{
29
- entityType: z.ZodString;
30
- entityId: z.ZodCoercedNumber<unknown>;
31
- }, z.core.$strip>;
32
- //# sourceMappingURL=audit-types.d.ts.map
@@ -1,21 +0,0 @@
1
- import { z } from "zod/v4";
2
- export declare const LoginRequestSchema: z.ZodObject<{
3
- username: z.ZodString;
4
- password: z.ZodString;
5
- }, z.core.$strict>;
6
- export type LoginRequest = z.infer<typeof LoginRequestSchema>;
7
- export declare const AuthUserSchema: z.ZodObject<{
8
- id: z.ZodNumber;
9
- username: z.ZodString;
10
- permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
- }, z.core.$strip>;
12
- export type AuthUser = z.infer<typeof AuthUserSchema>;
13
- export declare const LoginResponseSchema: z.ZodObject<{
14
- user: z.ZodObject<{
15
- id: z.ZodNumber;
16
- username: z.ZodString;
17
- permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
18
- }, z.core.$strip>;
19
- }, z.core.$strip>;
20
- export type LoginResponse = z.infer<typeof LoginResponseSchema>;
21
- //# sourceMappingURL=auth-types.d.ts.map
@@ -1,8 +0,0 @@
1
- import { z } from "zod/v4";
2
- export declare const ErrorResponseSchema: z.ZodObject<{
3
- statusCode: z.ZodNumber;
4
- error: z.ZodString;
5
- message: z.ZodString;
6
- }, z.core.$strip>;
7
- export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
8
- //# sourceMappingURL=error-types.d.ts.map