@tailor-platform/erp-kit 0.5.0 → 0.6.0
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/CHANGELOG.md +24 -0
- package/dist/cli.mjs +139 -35
- package/package.json +1 -1
- package/skills/erp-kit-app-5-impl-backend/SKILL.md +10 -5
- package/skills/erp-kit-app-7-impl-review/SKILL.md +1 -1
- package/skills/erp-kit-module-6-impl-review/SKILL.md +39 -17
- package/src/commands/generate-doc.ts +1 -1
- package/src/commands/init-module.test.ts +17 -3
- package/src/commands/init-module.ts +0 -12
- package/src/commands/lib/discovery.test.ts +13 -3
- package/src/commands/lib/discovery.ts +10 -2
- package/src/commands/lib/paths.ts +4 -2
- package/src/commands/lib/sync-check-tests.test.ts +84 -6
- package/src/commands/lib/sync-check-tests.ts +63 -3
- package/src/commands/sync-check.ts +7 -3
- package/src/generator/generate-app-code.ts +51 -16
- package/src/generator/generate-code-boilerplate.test.ts +9 -1
- package/src/generator/generate-stubs.ts +4 -0
- package/src/generator/scaffold.ts +6 -2
- package/src/generator/stub-templates.test.ts +11 -0
- package/src/generator/stub-templates.ts +22 -1
- package/src/mdschema.ts +39 -3
- package/src/modules/inventory/docs/features/inventory-adjustment.md +2 -1
- package/src/modules/inventory/docs/features/scrap-management.md +39 -1
- package/src/modules/manufacturing/README.md +63 -0
- package/src/modules/manufacturing/command/activateBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/activateBillOfMaterial.test.ts +166 -0
- package/src/modules/manufacturing/command/activateBillOfMaterial.ts +173 -0
- package/src/modules/manufacturing/command/activateRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/activateRouting.test.ts +152 -0
- package/src/modules/manufacturing/command/activateRouting.ts +92 -0
- package/src/modules/manufacturing/command/activateWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/activateWorkCenter.test.ts +135 -0
- package/src/modules/manufacturing/command/activateWorkCenter.ts +91 -0
- package/src/modules/manufacturing/command/cancelProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/cancelProductionOrder.test.ts +151 -0
- package/src/modules/manufacturing/command/cancelProductionOrder.ts +114 -0
- package/src/modules/manufacturing/command/closeProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/closeProductionOrder.test.ts +126 -0
- package/src/modules/manufacturing/command/closeProductionOrder.ts +87 -0
- package/src/modules/manufacturing/command/completeProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/completeProductionOrder.test.ts +132 -0
- package/src/modules/manufacturing/command/completeProductionOrder.ts +97 -0
- package/src/modules/manufacturing/command/completeWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/completeWorkOrder.test.ts +369 -0
- package/src/modules/manufacturing/command/completeWorkOrder.ts +212 -0
- package/src/modules/manufacturing/command/createBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/createBillOfMaterial.test.ts +210 -0
- package/src/modules/manufacturing/command/createBillOfMaterial.ts +176 -0
- package/src/modules/manufacturing/command/createProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/createProductionOrder.test.ts +160 -0
- package/src/modules/manufacturing/command/createProductionOrder.ts +129 -0
- package/src/modules/manufacturing/command/createRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/createRouting.test.ts +168 -0
- package/src/modules/manufacturing/command/createRouting.ts +128 -0
- package/src/modules/manufacturing/command/createWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/createWorkCenter.test.ts +148 -0
- package/src/modules/manufacturing/command/createWorkCenter.ts +131 -0
- package/src/modules/manufacturing/command/deactivateBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/deactivateBillOfMaterial.test.ts +103 -0
- package/src/modules/manufacturing/command/deactivateBillOfMaterial.ts +78 -0
- package/src/modules/manufacturing/command/deactivateRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/deactivateRouting.test.ts +112 -0
- package/src/modules/manufacturing/command/deactivateRouting.ts +76 -0
- package/src/modules/manufacturing/command/deactivateWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/deactivateWorkCenter.test.ts +113 -0
- package/src/modules/manufacturing/command/deactivateWorkCenter.ts +85 -0
- package/src/modules/manufacturing/command/pauseWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/pauseWorkOrder.test.ts +118 -0
- package/src/modules/manufacturing/command/pauseWorkOrder.ts +82 -0
- package/src/modules/manufacturing/command/recordInventoryIssueOutcome.generated.ts +6 -0
- package/src/modules/manufacturing/command/recordInventoryIssueOutcome.test.ts +183 -0
- package/src/modules/manufacturing/command/recordInventoryIssueOutcome.ts +139 -0
- package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.generated.ts +6 -0
- package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.test.ts +120 -0
- package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.ts +110 -0
- package/src/modules/manufacturing/command/releaseProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/releaseProductionOrder.test.ts +220 -0
- package/src/modules/manufacturing/command/releaseProductionOrder.ts +450 -0
- package/src/modules/manufacturing/command/reopenProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/reopenProductionOrder.test.ts +196 -0
- package/src/modules/manufacturing/command/reopenProductionOrder.ts +98 -0
- package/src/modules/manufacturing/command/reportWorkOrderProgress.generated.ts +6 -0
- package/src/modules/manufacturing/command/reportWorkOrderProgress.test.ts +204 -0
- package/src/modules/manufacturing/command/reportWorkOrderProgress.ts +129 -0
- package/src/modules/manufacturing/command/rescheduleProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/rescheduleProductionOrder.test.ts +185 -0
- package/src/modules/manufacturing/command/rescheduleProductionOrder.ts +95 -0
- package/src/modules/manufacturing/command/resumeWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/resumeWorkOrder.test.ts +122 -0
- package/src/modules/manufacturing/command/resumeWorkOrder.ts +94 -0
- package/src/modules/manufacturing/command/reviewManufacturingCostSummary.generated.ts +6 -0
- package/src/modules/manufacturing/command/reviewManufacturingCostSummary.test.ts +231 -0
- package/src/modules/manufacturing/command/reviewManufacturingCostSummary.ts +137 -0
- package/src/modules/manufacturing/command/startWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/startWorkOrder.test.ts +118 -0
- package/src/modules/manufacturing/command/startWorkOrder.ts +126 -0
- package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.test.ts +153 -0
- package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.ts +106 -0
- package/src/modules/manufacturing/command/unreleaseProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/unreleaseProductionOrder.test.ts +140 -0
- package/src/modules/manufacturing/command/unreleaseProductionOrder.ts +131 -0
- package/src/modules/manufacturing/command/updateBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateBillOfMaterial.test.ts +149 -0
- package/src/modules/manufacturing/command/updateBillOfMaterial.ts +174 -0
- package/src/modules/manufacturing/command/updateProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateProductionOrder.test.ts +112 -0
- package/src/modules/manufacturing/command/updateProductionOrder.ts +145 -0
- package/src/modules/manufacturing/command/updateRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateRouting.test.ts +211 -0
- package/src/modules/manufacturing/command/updateRouting.ts +124 -0
- package/src/modules/manufacturing/command/updateWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateWorkCenter.test.ts +152 -0
- package/src/modules/manufacturing/command/updateWorkCenter.ts +137 -0
- package/src/modules/manufacturing/db/.gitkeep +0 -0
- package/src/modules/manufacturing/db/billOfMaterial.ts +70 -0
- package/src/modules/manufacturing/db/billOfMaterialLine.ts +49 -0
- package/src/modules/manufacturing/db/costVarianceLine.ts +53 -0
- package/src/modules/manufacturing/db/manufacturingCostLine.ts +35 -0
- package/src/modules/manufacturing/db/manufacturingCostSettlementRecord.ts +39 -0
- package/src/modules/manufacturing/db/manufacturingCostSummary.ts +59 -0
- package/src/modules/manufacturing/db/productionOrder.ts +83 -0
- package/src/modules/manufacturing/db/productionOrderBomSnapshot.ts +44 -0
- package/src/modules/manufacturing/db/productionOrderCostBaseline.ts +44 -0
- package/src/modules/manufacturing/db/productionOrderMaterialRequirement.ts +57 -0
- package/src/modules/manufacturing/db/productionOrderRoutingSnapshot.ts +43 -0
- package/src/modules/manufacturing/db/routing.ts +63 -0
- package/src/modules/manufacturing/db/routingOperation.ts +57 -0
- package/src/modules/manufacturing/db/workCenter.ts +87 -0
- package/src/modules/manufacturing/db/workOrder.ts +65 -0
- package/src/modules/manufacturing/db/workOrderExecutionEvent.ts +54 -0
- package/src/modules/manufacturing/docs/commands/ActivateBillOfMaterial.md +50 -0
- package/src/modules/manufacturing/docs/commands/ActivateRouting.md +48 -0
- package/src/modules/manufacturing/docs/commands/ActivateWorkCenter.md +49 -0
- package/src/modules/manufacturing/docs/commands/CancelProductionOrder.md +48 -0
- package/src/modules/manufacturing/docs/commands/CloseProductionOrder.md +46 -0
- package/src/modules/manufacturing/docs/commands/CompleteProductionOrder.md +48 -0
- package/src/modules/manufacturing/docs/commands/CompleteWorkOrder.md +66 -0
- package/src/modules/manufacturing/docs/commands/CreateBillOfMaterial.md +54 -0
- package/src/modules/manufacturing/docs/commands/CreateProductionOrder.md +49 -0
- package/src/modules/manufacturing/docs/commands/CreateRouting.md +50 -0
- package/src/modules/manufacturing/docs/commands/CreateWorkCenter.md +51 -0
- package/src/modules/manufacturing/docs/commands/DeactivateBillOfMaterial.md +45 -0
- package/src/modules/manufacturing/docs/commands/DeactivateRouting.md +45 -0
- package/src/modules/manufacturing/docs/commands/DeactivateWorkCenter.md +45 -0
- package/src/modules/manufacturing/docs/commands/PauseWorkOrder.md +44 -0
- package/src/modules/manufacturing/docs/commands/RecordInventoryIssueOutcome.md +59 -0
- package/src/modules/manufacturing/docs/commands/RecordManufacturingCostSettlementAcknowledgment.md +49 -0
- package/src/modules/manufacturing/docs/commands/ReleaseProductionOrder.md +57 -0
- package/src/modules/manufacturing/docs/commands/ReopenProductionOrder.md +54 -0
- package/src/modules/manufacturing/docs/commands/ReportWorkOrderProgress.md +53 -0
- package/src/modules/manufacturing/docs/commands/RescheduleProductionOrder.md +45 -0
- package/src/modules/manufacturing/docs/commands/ResumeWorkOrder.md +44 -0
- package/src/modules/manufacturing/docs/commands/ReviewManufacturingCostSummary.md +52 -0
- package/src/modules/manufacturing/docs/commands/StartWorkOrder.md +46 -0
- package/src/modules/manufacturing/docs/commands/TechnicallyCompleteProductionOrder.md +51 -0
- package/src/modules/manufacturing/docs/commands/UnreleaseProductionOrder.md +46 -0
- package/src/modules/manufacturing/docs/commands/UpdateBillOfMaterial.md +48 -0
- package/src/modules/manufacturing/docs/commands/UpdateProductionOrder.md +48 -0
- package/src/modules/manufacturing/docs/commands/UpdateRouting.md +52 -0
- package/src/modules/manufacturing/docs/commands/UpdateWorkCenter.md +48 -0
- package/src/modules/manufacturing/docs/features/bill-of-material-management.md +83 -0
- package/src/modules/manufacturing/docs/features/manufacturing-cost-and-variance.md +191 -0
- package/src/modules/manufacturing/docs/features/production-order-lifecycle.md +103 -0
- package/src/modules/manufacturing/docs/features/routing-and-work-center-definition.md +63 -0
- package/src/modules/manufacturing/docs/features/work-order-execution.md +115 -0
- package/src/modules/manufacturing/docs/models/BillOfMaterial.md +60 -0
- package/src/modules/manufacturing/docs/models/ManufacturingCostSummary.md +66 -0
- package/src/modules/manufacturing/docs/models/ProductionOrder.md +76 -0
- package/src/modules/manufacturing/docs/models/Routing.md +58 -0
- package/src/modules/manufacturing/docs/models/WorkCenter.md +56 -0
- package/src/modules/manufacturing/docs/models/WorkOrder.md +63 -0
- package/src/modules/manufacturing/docs/queries/DetectBillOfMaterialCircularReference.md +39 -0
- package/src/modules/manufacturing/docs/queries/ExplodeBillOfMaterial.md +56 -0
- package/src/modules/manufacturing/docs/queries/GetBillOfMaterial.md +37 -0
- package/src/modules/manufacturing/docs/queries/GetManufacturingCostSummary.md +39 -0
- package/src/modules/manufacturing/docs/queries/GetProductionOrder.md +37 -0
- package/src/modules/manufacturing/docs/queries/GetRouting.md +39 -0
- package/src/modules/manufacturing/docs/queries/GetWorkCenter.md +35 -0
- package/src/modules/manufacturing/docs/queries/GetWorkOrder.md +38 -0
- package/src/modules/manufacturing/docs/queries/ListBillOfMaterialsByItem.md +42 -0
- package/src/modules/manufacturing/docs/queries/ListManufacturingCostSummariesByStatus.md +41 -0
- package/src/modules/manufacturing/docs/queries/ListProductionOrdersByStatus.md +41 -0
- package/src/modules/manufacturing/docs/queries/ListRoutingsByItem.md +42 -0
- package/src/modules/manufacturing/docs/queries/ListWorkCentersBySite.md +38 -0
- package/src/modules/manufacturing/docs/queries/ListWorkOrdersByProductionOrder.md +39 -0
- package/src/modules/manufacturing/docs/queries/ListWorkOrdersByWorkCenter.md +43 -0
- package/src/modules/manufacturing/executor/.gitkeep +0 -0
- package/src/modules/manufacturing/generated/enums.ts +113 -0
- package/src/modules/manufacturing/generated/kysely-tailordb.ts +247 -0
- package/src/modules/manufacturing/index.ts +2 -0
- package/src/modules/manufacturing/lib/_db_deps.ts +22 -0
- package/src/modules/manufacturing/lib/errors.generated.ts +592 -0
- package/src/modules/manufacturing/lib/permissions.generated.ts +35 -0
- package/src/modules/manufacturing/lib/types.ts +111 -0
- package/src/modules/manufacturing/module.ts +226 -0
- package/src/modules/manufacturing/permissions.ts +3 -0
- package/src/modules/manufacturing/query/.gitkeep +0 -0
- package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.generated.ts +5 -0
- package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.test.ts +115 -0
- package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.ts +79 -0
- package/src/modules/manufacturing/query/explodeBillOfMaterial.generated.ts +5 -0
- package/src/modules/manufacturing/query/explodeBillOfMaterial.test.ts +445 -0
- package/src/modules/manufacturing/query/explodeBillOfMaterial.ts +306 -0
- package/src/modules/manufacturing/query/getBillOfMaterial.generated.ts +5 -0
- package/src/modules/manufacturing/query/getBillOfMaterial.test.ts +64 -0
- package/src/modules/manufacturing/query/getBillOfMaterial.ts +27 -0
- package/src/modules/manufacturing/query/getManufacturingCostSummary.generated.ts +5 -0
- package/src/modules/manufacturing/query/getManufacturingCostSummary.test.ts +147 -0
- package/src/modules/manufacturing/query/getManufacturingCostSummary.ts +46 -0
- package/src/modules/manufacturing/query/getProductionOrder.generated.ts +5 -0
- package/src/modules/manufacturing/query/getProductionOrder.test.ts +139 -0
- package/src/modules/manufacturing/query/getProductionOrder.ts +84 -0
- package/src/modules/manufacturing/query/getRouting.generated.ts +5 -0
- package/src/modules/manufacturing/query/getRouting.test.ts +71 -0
- package/src/modules/manufacturing/query/getRouting.ts +34 -0
- package/src/modules/manufacturing/query/getWorkCenter.generated.ts +5 -0
- package/src/modules/manufacturing/query/getWorkCenter.test.ts +37 -0
- package/src/modules/manufacturing/query/getWorkCenter.ts +21 -0
- package/src/modules/manufacturing/query/getWorkOrder.generated.ts +5 -0
- package/src/modules/manufacturing/query/getWorkOrder.test.ts +73 -0
- package/src/modules/manufacturing/query/getWorkOrder.ts +28 -0
- package/src/modules/manufacturing/query/listBillOfMaterialsByItem.generated.ts +5 -0
- package/src/modules/manufacturing/query/listBillOfMaterialsByItem.test.ts +107 -0
- package/src/modules/manufacturing/query/listBillOfMaterialsByItem.ts +58 -0
- package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.generated.ts +5 -0
- package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.test.ts +96 -0
- package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.ts +77 -0
- package/src/modules/manufacturing/query/listProductionOrdersByStatus.generated.ts +5 -0
- package/src/modules/manufacturing/query/listProductionOrdersByStatus.test.ts +121 -0
- package/src/modules/manufacturing/query/listProductionOrdersByStatus.ts +83 -0
- package/src/modules/manufacturing/query/listRoutingsByItem.generated.ts +5 -0
- package/src/modules/manufacturing/query/listRoutingsByItem.test.ts +110 -0
- package/src/modules/manufacturing/query/listRoutingsByItem.ts +54 -0
- package/src/modules/manufacturing/query/listWorkCentersBySite.generated.ts +5 -0
- package/src/modules/manufacturing/query/listWorkCentersBySite.test.ts +81 -0
- package/src/modules/manufacturing/query/listWorkCentersBySite.ts +70 -0
- package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.generated.ts +5 -0
- package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.test.ts +102 -0
- package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.ts +53 -0
- package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.generated.ts +5 -0
- package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.test.ts +143 -0
- package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.ts +56 -0
- package/src/modules/manufacturing/seed/index.ts +19 -0
- package/src/modules/manufacturing/tailor.config.ts +13 -0
- package/src/modules/manufacturing/tailor.d.ts +13 -0
- package/src/modules/manufacturing/testing/commandTestUtils.ts +29 -0
- package/src/modules/manufacturing/testing/fixtures.ts +402 -0
- package/templates/scaffold/app/backend/package.json +9 -2
- package/templates/scaffold/app/backend/src/tests/utils/graphql-client.ts +66 -0
- package/templates/scaffold/app/backend/src/tests/utils/setup.ts +21 -0
- package/templates/scaffold/app/backend/tsconfig.json +9 -2
- package/templates/scaffold/app/backend/vitest.config.ts +35 -0
- package/templates/scaffold/app/frontend/package.json +2 -2
- package/templates/scaffold/module/__dot__gitignore +3 -0
- package/templates/scaffold/module/eslint.config.js +31 -0
- package/templates/scaffold/module/generated/kysely-tailordb.ts +3 -0
- package/templates/scaffold/module/lib/types.ts +1 -6
- package/templates/scaffold/module/package.json +26 -0
- package/templates/scaffold/module/tsconfig.json +16 -0
- /package/{templates/scaffold/module/generated → src/modules/manufacturing/command}/.gitkeep +0 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
WorkCenter,
|
|
3
|
+
Routing,
|
|
4
|
+
RoutingOperation,
|
|
5
|
+
BillOfMaterial,
|
|
6
|
+
BillOfMaterialLine,
|
|
7
|
+
ProductionOrder,
|
|
8
|
+
ProductionOrderMaterialRequirement,
|
|
9
|
+
ProductionOrderBomSnapshot,
|
|
10
|
+
ProductionOrderRoutingSnapshot,
|
|
11
|
+
ProductionOrderCostBaseline,
|
|
12
|
+
WorkOrder,
|
|
13
|
+
WorkOrderExecutionEvent,
|
|
14
|
+
ManufacturingCostSummary,
|
|
15
|
+
ManufacturingCostLine,
|
|
16
|
+
CostVarianceLine,
|
|
17
|
+
ManufacturingCostSettlementRecord,
|
|
18
|
+
Schema,
|
|
19
|
+
} from "../lib/types";
|
|
20
|
+
|
|
21
|
+
// WorkCenter fixtures
|
|
22
|
+
export const baseDraftWorkCenter = {
|
|
23
|
+
id: "work-center-1",
|
|
24
|
+
code: "WC-001",
|
|
25
|
+
companyId: "company-1",
|
|
26
|
+
siteId: "site-1",
|
|
27
|
+
status: "DRAFT",
|
|
28
|
+
capacityAssumptions: 100,
|
|
29
|
+
laborRate: 25.0,
|
|
30
|
+
machineRate: 50.0,
|
|
31
|
+
calendarReference: "cal-standard",
|
|
32
|
+
overheadAbsorptionMethod: null,
|
|
33
|
+
overheadAbsorptionCurrency: null,
|
|
34
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
35
|
+
updatedAt: null,
|
|
36
|
+
} as const satisfies WorkCenter<Schema>;
|
|
37
|
+
|
|
38
|
+
export const baseActiveWorkCenter = {
|
|
39
|
+
...baseDraftWorkCenter,
|
|
40
|
+
id: "work-center-2",
|
|
41
|
+
code: "WC-002",
|
|
42
|
+
status: "ACTIVE",
|
|
43
|
+
} as const satisfies WorkCenter<Schema>;
|
|
44
|
+
|
|
45
|
+
export const baseInactiveWorkCenter = {
|
|
46
|
+
...baseDraftWorkCenter,
|
|
47
|
+
id: "work-center-3",
|
|
48
|
+
code: "WC-003",
|
|
49
|
+
status: "INACTIVE",
|
|
50
|
+
} as const satisfies WorkCenter<Schema>;
|
|
51
|
+
|
|
52
|
+
// Routing fixtures
|
|
53
|
+
export const baseDraftRouting = {
|
|
54
|
+
id: "routing-1",
|
|
55
|
+
parentItemId: "item-1",
|
|
56
|
+
companyId: "company-1",
|
|
57
|
+
siteId: null,
|
|
58
|
+
revisionNumber: "R1",
|
|
59
|
+
status: "DRAFT",
|
|
60
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
61
|
+
updatedAt: null,
|
|
62
|
+
} as const satisfies Routing<Schema>;
|
|
63
|
+
|
|
64
|
+
export const baseActiveRouting = {
|
|
65
|
+
...baseDraftRouting,
|
|
66
|
+
id: "routing-2",
|
|
67
|
+
revisionNumber: "R2",
|
|
68
|
+
status: "ACTIVE",
|
|
69
|
+
} as const satisfies Routing<Schema>;
|
|
70
|
+
|
|
71
|
+
export const baseInactiveRouting = {
|
|
72
|
+
...baseDraftRouting,
|
|
73
|
+
id: "routing-3",
|
|
74
|
+
revisionNumber: "R3",
|
|
75
|
+
status: "INACTIVE",
|
|
76
|
+
} as const satisfies Routing<Schema>;
|
|
77
|
+
|
|
78
|
+
// RoutingOperation fixtures
|
|
79
|
+
export const baseRoutingOperation = {
|
|
80
|
+
id: "operation-1",
|
|
81
|
+
routingId: "routing-1",
|
|
82
|
+
sequenceNumber: 10,
|
|
83
|
+
operationDescription: "Assembly step",
|
|
84
|
+
workCenterId: "work-center-2",
|
|
85
|
+
standardSetupTime: 30,
|
|
86
|
+
standardRunTime: 60,
|
|
87
|
+
operatorInstructions: null,
|
|
88
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
89
|
+
updatedAt: null,
|
|
90
|
+
} as const satisfies RoutingOperation<Schema>;
|
|
91
|
+
|
|
92
|
+
export const baseRoutingOperation2 = {
|
|
93
|
+
...baseRoutingOperation,
|
|
94
|
+
id: "operation-2",
|
|
95
|
+
sequenceNumber: 20,
|
|
96
|
+
operationDescription: "Quality check",
|
|
97
|
+
standardSetupTime: 10,
|
|
98
|
+
standardRunTime: 15,
|
|
99
|
+
} as const satisfies RoutingOperation<Schema>;
|
|
100
|
+
|
|
101
|
+
// BillOfMaterial fixtures
|
|
102
|
+
export const baseDraftBom = {
|
|
103
|
+
id: "bom-1",
|
|
104
|
+
parentItemId: "item-1",
|
|
105
|
+
companyId: "company-1",
|
|
106
|
+
siteId: null,
|
|
107
|
+
bomType: "MANUFACTURE",
|
|
108
|
+
effectivityStartDate: null,
|
|
109
|
+
effectivityEndDate: null,
|
|
110
|
+
defaultSelection: true,
|
|
111
|
+
revisionNumber: "V1",
|
|
112
|
+
status: "DRAFT",
|
|
113
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
114
|
+
updatedAt: null,
|
|
115
|
+
} as const satisfies BillOfMaterial<Schema>;
|
|
116
|
+
|
|
117
|
+
export const baseActiveBom = {
|
|
118
|
+
...baseDraftBom,
|
|
119
|
+
id: "bom-2",
|
|
120
|
+
revisionNumber: "V2",
|
|
121
|
+
status: "ACTIVE",
|
|
122
|
+
} as const satisfies BillOfMaterial<Schema>;
|
|
123
|
+
|
|
124
|
+
export const baseInactiveBom = {
|
|
125
|
+
...baseDraftBom,
|
|
126
|
+
id: "bom-3",
|
|
127
|
+
revisionNumber: "V3",
|
|
128
|
+
status: "INACTIVE",
|
|
129
|
+
} as const satisfies BillOfMaterial<Schema>;
|
|
130
|
+
|
|
131
|
+
// BillOfMaterialLine fixtures
|
|
132
|
+
export const baseBomLine = {
|
|
133
|
+
id: "bom-line-1",
|
|
134
|
+
billOfMaterialId: "bom-1",
|
|
135
|
+
itemId: "item-2",
|
|
136
|
+
requiredQuantity: 2.0,
|
|
137
|
+
unitOfMeasure: "EA",
|
|
138
|
+
scrapAssumption: 5.0,
|
|
139
|
+
isSubassembly: false,
|
|
140
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
141
|
+
updatedAt: null,
|
|
142
|
+
} as const satisfies BillOfMaterialLine<Schema>;
|
|
143
|
+
|
|
144
|
+
export const baseBomLine2 = {
|
|
145
|
+
...baseBomLine,
|
|
146
|
+
id: "bom-line-2",
|
|
147
|
+
itemId: "item-3",
|
|
148
|
+
requiredQuantity: 1.0,
|
|
149
|
+
scrapAssumption: null,
|
|
150
|
+
} as const satisfies BillOfMaterialLine<Schema>;
|
|
151
|
+
|
|
152
|
+
// ProductionOrder fixtures
|
|
153
|
+
export const baseDraftProductionOrder = {
|
|
154
|
+
id: "production-order-1",
|
|
155
|
+
orderedItemId: "item-1",
|
|
156
|
+
companyId: "company-1",
|
|
157
|
+
siteId: "site-1",
|
|
158
|
+
plannedQuantity: 100,
|
|
159
|
+
plannedStartDate: new Date("2024-03-01T00:00:00.000Z"),
|
|
160
|
+
plannedEndDate: new Date("2024-03-15T00:00:00.000Z"),
|
|
161
|
+
selectedBomVersionId: null,
|
|
162
|
+
selectedRoutingRevisionId: null,
|
|
163
|
+
status: "DRAFT",
|
|
164
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
165
|
+
updatedAt: null,
|
|
166
|
+
} as const satisfies ProductionOrder<Schema>;
|
|
167
|
+
|
|
168
|
+
export const baseReleasedProductionOrder = {
|
|
169
|
+
...baseDraftProductionOrder,
|
|
170
|
+
id: "production-order-2",
|
|
171
|
+
selectedBomVersionId: "bom-2",
|
|
172
|
+
selectedRoutingRevisionId: "routing-2",
|
|
173
|
+
status: "RELEASED",
|
|
174
|
+
} as const satisfies ProductionOrder<Schema>;
|
|
175
|
+
|
|
176
|
+
export const baseInProgressProductionOrder = {
|
|
177
|
+
...baseReleasedProductionOrder,
|
|
178
|
+
id: "production-order-3",
|
|
179
|
+
status: "IN_PROGRESS",
|
|
180
|
+
} as const satisfies ProductionOrder<Schema>;
|
|
181
|
+
|
|
182
|
+
export const baseCompletedProductionOrder = {
|
|
183
|
+
...baseReleasedProductionOrder,
|
|
184
|
+
id: "production-order-4",
|
|
185
|
+
status: "COMPLETED",
|
|
186
|
+
} as const satisfies ProductionOrder<Schema>;
|
|
187
|
+
|
|
188
|
+
export const baseTechCompleteProductionOrder = {
|
|
189
|
+
...baseReleasedProductionOrder,
|
|
190
|
+
id: "production-order-5",
|
|
191
|
+
status: "TECHNICALLY_COMPLETE",
|
|
192
|
+
} as const satisfies ProductionOrder<Schema>;
|
|
193
|
+
|
|
194
|
+
export const baseClosedProductionOrder = {
|
|
195
|
+
...baseReleasedProductionOrder,
|
|
196
|
+
id: "production-order-6",
|
|
197
|
+
status: "CLOSED",
|
|
198
|
+
} as const satisfies ProductionOrder<Schema>;
|
|
199
|
+
|
|
200
|
+
export const baseCancelledProductionOrder = {
|
|
201
|
+
...baseDraftProductionOrder,
|
|
202
|
+
id: "production-order-7",
|
|
203
|
+
status: "CANCELLED",
|
|
204
|
+
} as const satisfies ProductionOrder<Schema>;
|
|
205
|
+
|
|
206
|
+
// ProductionOrderMaterialRequirement fixtures
|
|
207
|
+
export const baseMaterialRequirement = {
|
|
208
|
+
id: "material-req-1",
|
|
209
|
+
productionOrderId: "production-order-2",
|
|
210
|
+
itemId: "item-2",
|
|
211
|
+
requiredQuantity: 200,
|
|
212
|
+
unitOfMeasure: "EA",
|
|
213
|
+
plannedUnitCost: 10.0,
|
|
214
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
215
|
+
updatedAt: null,
|
|
216
|
+
} as const satisfies ProductionOrderMaterialRequirement<Schema>;
|
|
217
|
+
|
|
218
|
+
// ProductionOrderBomSnapshot fixtures
|
|
219
|
+
export const baseBomSnapshot = {
|
|
220
|
+
id: "bom-snapshot-1",
|
|
221
|
+
productionOrderId: "production-order-2",
|
|
222
|
+
parentItemId: "item-1",
|
|
223
|
+
bomType: "MANUFACTURE",
|
|
224
|
+
snapshotData: null,
|
|
225
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
226
|
+
updatedAt: null,
|
|
227
|
+
} as const satisfies ProductionOrderBomSnapshot<Schema>;
|
|
228
|
+
|
|
229
|
+
// ProductionOrderRoutingSnapshot fixtures
|
|
230
|
+
export const baseRoutingSnapshot = {
|
|
231
|
+
id: "routing-snapshot-1",
|
|
232
|
+
productionOrderId: "production-order-2",
|
|
233
|
+
routingId: "routing-2",
|
|
234
|
+
snapshotData: null,
|
|
235
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
236
|
+
updatedAt: null,
|
|
237
|
+
} as const satisfies ProductionOrderRoutingSnapshot<Schema>;
|
|
238
|
+
|
|
239
|
+
// ProductionOrderCostBaseline fixtures
|
|
240
|
+
export const baseCostBaseline = {
|
|
241
|
+
id: "cost-baseline-1",
|
|
242
|
+
productionOrderId: "production-order-2",
|
|
243
|
+
plannedMaterialCost: 2000,
|
|
244
|
+
plannedLaborCost: 500,
|
|
245
|
+
plannedMachineCost: 1000,
|
|
246
|
+
plannedOverheadCost: 300,
|
|
247
|
+
currencyCode: "USD",
|
|
248
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
249
|
+
updatedAt: null,
|
|
250
|
+
} as const satisfies ProductionOrderCostBaseline<Schema>;
|
|
251
|
+
|
|
252
|
+
// WorkOrder fixtures
|
|
253
|
+
export const basePendingWorkOrder = {
|
|
254
|
+
id: "work-order-1",
|
|
255
|
+
productionOrderId: "production-order-2",
|
|
256
|
+
routingOperationSequenceNumber: 10,
|
|
257
|
+
workCenterId: "work-center-2",
|
|
258
|
+
plannedQuantity: 100,
|
|
259
|
+
completedQuantity: 0,
|
|
260
|
+
scrapQuantity: 0,
|
|
261
|
+
actualSetupTime: 0,
|
|
262
|
+
actualRunTime: 0,
|
|
263
|
+
actualStartDate: null,
|
|
264
|
+
pauseReason: null,
|
|
265
|
+
executionNotes: null,
|
|
266
|
+
status: "PENDING",
|
|
267
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
268
|
+
updatedAt: null,
|
|
269
|
+
} as const satisfies WorkOrder<Schema>;
|
|
270
|
+
|
|
271
|
+
export const baseInProgressWorkOrder = {
|
|
272
|
+
...basePendingWorkOrder,
|
|
273
|
+
id: "work-order-2",
|
|
274
|
+
status: "IN_PROGRESS",
|
|
275
|
+
actualStartDate: new Date("2024-03-01T08:00:00.000Z"),
|
|
276
|
+
completedQuantity: 50,
|
|
277
|
+
actualSetupTime: 30,
|
|
278
|
+
actualRunTime: 120,
|
|
279
|
+
} as const satisfies WorkOrder<Schema>;
|
|
280
|
+
|
|
281
|
+
export const basePausedWorkOrder = {
|
|
282
|
+
...baseInProgressWorkOrder,
|
|
283
|
+
id: "work-order-3",
|
|
284
|
+
status: "PAUSED",
|
|
285
|
+
pauseReason: "Machine maintenance",
|
|
286
|
+
} as const satisfies WorkOrder<Schema>;
|
|
287
|
+
|
|
288
|
+
export const baseCompleteWorkOrder = {
|
|
289
|
+
...baseInProgressWorkOrder,
|
|
290
|
+
id: "work-order-4",
|
|
291
|
+
status: "COMPLETE",
|
|
292
|
+
completedQuantity: 100,
|
|
293
|
+
actualRunTime: 240,
|
|
294
|
+
} as const satisfies WorkOrder<Schema>;
|
|
295
|
+
|
|
296
|
+
export const baseCancelledWorkOrder = {
|
|
297
|
+
...basePendingWorkOrder,
|
|
298
|
+
id: "work-order-5",
|
|
299
|
+
status: "CANCELLED",
|
|
300
|
+
} as const satisfies WorkOrder<Schema>;
|
|
301
|
+
|
|
302
|
+
// WorkOrderExecutionEvent fixtures
|
|
303
|
+
export const baseStartedEvent = {
|
|
304
|
+
id: "event-1",
|
|
305
|
+
workOrderId: "work-order-2",
|
|
306
|
+
eventType: "STARTED",
|
|
307
|
+
timestamp: new Date("2024-03-01T08:00:00.000Z"),
|
|
308
|
+
quantity: null,
|
|
309
|
+
timeValue: null,
|
|
310
|
+
scrapValue: null,
|
|
311
|
+
notes: null,
|
|
312
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
313
|
+
updatedAt: null,
|
|
314
|
+
} as const satisfies WorkOrderExecutionEvent<Schema>;
|
|
315
|
+
|
|
316
|
+
export const baseProgressEvent = {
|
|
317
|
+
...baseStartedEvent,
|
|
318
|
+
id: "event-2",
|
|
319
|
+
eventType: "PROGRESS_REPORTED",
|
|
320
|
+
timestamp: new Date("2024-03-01T10:00:00.000Z"),
|
|
321
|
+
quantity: 25,
|
|
322
|
+
timeValue: 60,
|
|
323
|
+
scrapValue: 2,
|
|
324
|
+
} as const satisfies WorkOrderExecutionEvent<Schema>;
|
|
325
|
+
|
|
326
|
+
// ManufacturingCostSummary fixtures
|
|
327
|
+
export const baseCollectingCostSummary = {
|
|
328
|
+
id: "cost-summary-1",
|
|
329
|
+
productionOrderId: "production-order-2",
|
|
330
|
+
plannedMaterialCost: 2000,
|
|
331
|
+
plannedLaborCost: 500,
|
|
332
|
+
plannedMachineCost: 1000,
|
|
333
|
+
plannedOverheadCost: 300,
|
|
334
|
+
actualMaterialCost: 0,
|
|
335
|
+
actualLaborCost: 0,
|
|
336
|
+
actualMachineCost: 0,
|
|
337
|
+
actualOverheadCost: 0,
|
|
338
|
+
currencyCode: "USD",
|
|
339
|
+
reviewedDate: null,
|
|
340
|
+
reviewerNotes: null,
|
|
341
|
+
status: "COLLECTING",
|
|
342
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
343
|
+
updatedAt: null,
|
|
344
|
+
} as const satisfies ManufacturingCostSummary<Schema>;
|
|
345
|
+
|
|
346
|
+
export const basePendingReviewCostSummary = {
|
|
347
|
+
...baseCollectingCostSummary,
|
|
348
|
+
id: "cost-summary-2",
|
|
349
|
+
actualMaterialCost: 2100,
|
|
350
|
+
actualLaborCost: 480,
|
|
351
|
+
actualMachineCost: 1050,
|
|
352
|
+
actualOverheadCost: 50,
|
|
353
|
+
status: "PENDING_VARIANCE_REVIEW",
|
|
354
|
+
} as const satisfies ManufacturingCostSummary<Schema>;
|
|
355
|
+
|
|
356
|
+
export const baseReviewedCostSummary = {
|
|
357
|
+
...basePendingReviewCostSummary,
|
|
358
|
+
id: "cost-summary-3",
|
|
359
|
+
status: "VARIANCE_REVIEWED",
|
|
360
|
+
reviewedDate: new Date("2024-04-01T00:00:00.000Z"),
|
|
361
|
+
reviewerNotes: "Variances within acceptable range",
|
|
362
|
+
} as const satisfies ManufacturingCostSummary<Schema>;
|
|
363
|
+
|
|
364
|
+
export const baseSettledCostSummary = {
|
|
365
|
+
...baseReviewedCostSummary,
|
|
366
|
+
id: "cost-summary-4",
|
|
367
|
+
status: "SETTLED",
|
|
368
|
+
} as const satisfies ManufacturingCostSummary<Schema>;
|
|
369
|
+
|
|
370
|
+
// ManufacturingCostLine fixtures
|
|
371
|
+
export const baseCostLine = {
|
|
372
|
+
id: "cost-line-1",
|
|
373
|
+
costSummaryId: "cost-summary-1",
|
|
374
|
+
costType: "MATERIAL",
|
|
375
|
+
plannedAmount: 2000,
|
|
376
|
+
actualAmount: 0,
|
|
377
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
378
|
+
updatedAt: null,
|
|
379
|
+
} as const satisfies ManufacturingCostLine<Schema>;
|
|
380
|
+
|
|
381
|
+
// CostVarianceLine fixtures
|
|
382
|
+
export const baseVarianceLine = {
|
|
383
|
+
id: "variance-line-1",
|
|
384
|
+
costSummaryId: "cost-summary-3",
|
|
385
|
+
varianceType: "MATERIAL_PRICE",
|
|
386
|
+
amount: 100,
|
|
387
|
+
accountReference: "acct-5001",
|
|
388
|
+
variancePercentage: 5.0,
|
|
389
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
390
|
+
updatedAt: null,
|
|
391
|
+
} as const satisfies CostVarianceLine<Schema>;
|
|
392
|
+
|
|
393
|
+
// ManufacturingCostSettlementRecord fixtures
|
|
394
|
+
export const baseSettlementRecord = {
|
|
395
|
+
id: "settlement-1",
|
|
396
|
+
costSummaryId: "cost-summary-4",
|
|
397
|
+
settlementDate: new Date("2024-04-15T00:00:00.000Z"),
|
|
398
|
+
settlementReference: "SETTLE-2024-001",
|
|
399
|
+
acknowledgedDate: new Date("2024-04-15T00:00:00.000Z"),
|
|
400
|
+
createdAt: new Date("2024-01-01T00:00:00.000Z"),
|
|
401
|
+
updatedAt: null,
|
|
402
|
+
} as const satisfies ManufacturingCostSettlementRecord<Schema>;
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
"lint:fix": "eslint --cache --fix .",
|
|
11
11
|
"seed": "node --env-file-if-exists=.env seed/exec.mjs",
|
|
12
12
|
"seed:reset": "node --env-file-if-exists=.env seed/exec.mjs --truncate --yes",
|
|
13
|
-
"
|
|
13
|
+
"test": "vitest run --project unit",
|
|
14
|
+
"test:unit": "vitest run --project unit",
|
|
15
|
+
"test:integration": "vitest run --project integration",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"gql-tada:check": "gql-tada check"
|
|
14
18
|
},
|
|
15
19
|
"dependencies": {
|
|
16
20
|
"@tailor-platform/erp-kit": "workspace:*",
|
|
@@ -24,7 +28,10 @@
|
|
|
24
28
|
"eslint": "10.0.3",
|
|
25
29
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
26
30
|
"eslint-plugin-import-x": "4.16.2",
|
|
31
|
+
"gql.tada": "1.9.0",
|
|
27
32
|
"typescript": "5.9.3",
|
|
28
|
-
"typescript-eslint": "8.57.0"
|
|
33
|
+
"typescript-eslint": "8.57.0",
|
|
34
|
+
"urql": "5.0.1",
|
|
35
|
+
"vitest": "4.0.18"
|
|
29
36
|
}
|
|
30
37
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { initGraphQLTada } from "gql.tada";
|
|
2
|
+
import { createClient, Client, fetchExchange } from "urql";
|
|
3
|
+
import type { OperationResult } from "urql";
|
|
4
|
+
|
|
5
|
+
import type { introspection } from "../../../../frontend/src/graphql/generated/graphql-env.d";
|
|
6
|
+
|
|
7
|
+
export const graphql = initGraphQLTada<{
|
|
8
|
+
introspection: introspection;
|
|
9
|
+
scalars: {
|
|
10
|
+
DateTime: string;
|
|
11
|
+
Date: string;
|
|
12
|
+
Time: string;
|
|
13
|
+
};
|
|
14
|
+
}>();
|
|
15
|
+
|
|
16
|
+
export type { FragmentOf, ResultOf, VariablesOf } from "gql.tada";
|
|
17
|
+
|
|
18
|
+
export function createGraphQLClient(appUrl: string, token: string): Client {
|
|
19
|
+
const endpoint = new URL("/query", appUrl).href;
|
|
20
|
+
|
|
21
|
+
const client = createClient({
|
|
22
|
+
url: endpoint,
|
|
23
|
+
exchanges: [fetchExchange],
|
|
24
|
+
requestPolicy: "network-only",
|
|
25
|
+
preferGetMethod: false,
|
|
26
|
+
fetchOptions: () => ({
|
|
27
|
+
method: "POST",
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: `Bearer ${token}`,
|
|
30
|
+
"Content-Type": "application/json",
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const wrapToPromise = <T extends OperationResult>(originalToPromise: () => Promise<T>) => {
|
|
36
|
+
return async (): Promise<T> => {
|
|
37
|
+
const result = await originalToPromise();
|
|
38
|
+
if (result.error) {
|
|
39
|
+
throw result.error;
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
...client,
|
|
47
|
+
mutation: <Data = unknown, Variables extends Record<string, unknown> = Record<string, unknown>>(
|
|
48
|
+
query: string,
|
|
49
|
+
variables?: Variables,
|
|
50
|
+
) => {
|
|
51
|
+
const original = client.mutation<Data, Variables>(query, variables!);
|
|
52
|
+
return Object.assign(original, {
|
|
53
|
+
toPromise: wrapToPromise(original.toPromise.bind(original)),
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
query: <Data = unknown, Variables extends Record<string, unknown> = Record<string, unknown>>(
|
|
57
|
+
query: string,
|
|
58
|
+
variables?: Variables,
|
|
59
|
+
) => {
|
|
60
|
+
const original = client.query<Data, Variables>(query, variables!);
|
|
61
|
+
return Object.assign(original, {
|
|
62
|
+
toPromise: wrapToPromise(original.toPromise.bind(original)),
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
} as Client;
|
|
66
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TestProject } from "vitest/node";
|
|
2
|
+
import { show, listMachineUsers, getMachineUserToken } from "@tailor-platform/sdk/cli";
|
|
3
|
+
|
|
4
|
+
declare module "vitest" {
|
|
5
|
+
export interface ProvidedContext {
|
|
6
|
+
url: string;
|
|
7
|
+
token: string;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function setup(project: TestProject) {
|
|
12
|
+
const app = await show();
|
|
13
|
+
const url = app.url;
|
|
14
|
+
|
|
15
|
+
const machineUsers = await listMachineUsers();
|
|
16
|
+
const tokens = await getMachineUserToken({ name: machineUsers[0].name });
|
|
17
|
+
const token = tokens.accessToken;
|
|
18
|
+
|
|
19
|
+
project.provide("url", url);
|
|
20
|
+
project.provide("token", token);
|
|
21
|
+
}
|
|
@@ -10,10 +10,17 @@
|
|
|
10
10
|
"noEmit": true,
|
|
11
11
|
"skipLibCheck": true,
|
|
12
12
|
"resolveJsonModule": true,
|
|
13
|
-
"types": ["node", "@tailor-platform/function-types"],
|
|
13
|
+
"types": ["node", "@tailor-platform/function-types", "vitest/globals"],
|
|
14
14
|
"paths": {
|
|
15
15
|
"@/*": ["./src/*"]
|
|
16
|
-
}
|
|
16
|
+
},
|
|
17
|
+
"plugins": [
|
|
18
|
+
{
|
|
19
|
+
"name": "gql.tada/ts-plugin",
|
|
20
|
+
"schema": "../frontend/src/graphql/generated/schema.graphql",
|
|
21
|
+
"tadaOutputLocation": "../frontend/src/graphql/generated/graphql-env.d.ts"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
17
24
|
},
|
|
18
25
|
"include": ["**/*.ts"]
|
|
19
26
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { defineConfig } from "vitest/config";
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
resolve: {
|
|
6
|
+
alias: {
|
|
7
|
+
"@": path.resolve(__dirname, "./src"),
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
test: {
|
|
11
|
+
watch: false,
|
|
12
|
+
passWithNoTests: true,
|
|
13
|
+
projects: [
|
|
14
|
+
{
|
|
15
|
+
extends: true,
|
|
16
|
+
test: {
|
|
17
|
+
name: "unit",
|
|
18
|
+
environment: "node",
|
|
19
|
+
include: ["./src/resolvers/**/*.test.ts"],
|
|
20
|
+
testTimeout: 30_000,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
extends: true,
|
|
25
|
+
test: {
|
|
26
|
+
name: "integration",
|
|
27
|
+
environment: "node",
|
|
28
|
+
include: ["./src/tests/**/*.test.ts"],
|
|
29
|
+
globalSetup: ["./src/tests/utils/setup.ts"],
|
|
30
|
+
testTimeout: 60_000,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
});
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"gql-tada:check": "gql-tada check -c tsconfig.app.json",
|
|
11
11
|
"lint": "eslint .",
|
|
12
12
|
"lint:fix": "eslint --fix .",
|
|
13
|
-
"typecheck": "tsc
|
|
13
|
+
"typecheck": "tsc -b"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@hookform/resolvers": "5.2.2",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@eslint/js": "10.0.1",
|
|
33
|
-
"@rolldown/plugin-babel": "0.2.
|
|
33
|
+
"@rolldown/plugin-babel": "0.2.2",
|
|
34
34
|
"@tailor-platform/app-shell-vite-plugin": "0.1.0",
|
|
35
35
|
"@tailwindcss/vite": "4.2.1",
|
|
36
36
|
"@types/node": "25.5.0",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import eslint from "@eslint/js";
|
|
2
|
+
import { defineConfig, globalIgnores } from "eslint/config";
|
|
3
|
+
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
4
|
+
import importX from "eslint-plugin-import-x";
|
|
5
|
+
import tseslint from "typescript-eslint";
|
|
6
|
+
|
|
7
|
+
export default defineConfig([
|
|
8
|
+
globalIgnores([".tailor-sdk/", "seed/", "generated/", "tailor.d.ts"]),
|
|
9
|
+
{
|
|
10
|
+
files: ["**/*.ts"],
|
|
11
|
+
extends: [
|
|
12
|
+
eslint.configs.recommended,
|
|
13
|
+
tseslint.configs.recommendedTypeChecked,
|
|
14
|
+
tseslint.configs.stylisticTypeChecked,
|
|
15
|
+
importX.flatConfigs.recommended,
|
|
16
|
+
importX.flatConfigs.typescript,
|
|
17
|
+
],
|
|
18
|
+
languageOptions: {
|
|
19
|
+
parserOptions: {
|
|
20
|
+
projectService: true,
|
|
21
|
+
tsconfigRootDir: import.meta.dirname,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
settings: {
|
|
25
|
+
"import-x/resolver-next": [createTypeScriptImportResolver()],
|
|
26
|
+
},
|
|
27
|
+
rules: {
|
|
28
|
+
"import-x/order": "error",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
]);
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
+
import type { InferSchema } from "@tailor-platform/erp-kit/module";
|
|
1
2
|
import type { DB } from "../generated/kysely-tailordb";
|
|
2
|
-
import type {
|
|
3
|
-
InferSchema,
|
|
4
|
-
Selectable,
|
|
5
|
-
Insertable,
|
|
6
|
-
Updateable,
|
|
7
|
-
} from "@tailor-platform/erp-kit/module";
|
|
8
3
|
|
|
9
4
|
export type Schema = InferSchema<DB>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "template-module",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"generate": "tailor-sdk generate",
|
|
7
|
+
"lint": "eslint --cache .",
|
|
8
|
+
"lint:fix": "eslint --cache --fix .",
|
|
9
|
+
"typecheck": "tsc --noEmit"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@tailor-platform/erp-kit": "workspace:*",
|
|
13
|
+
"@tailor-platform/sdk": "1.25.4"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@eslint/js": "10.0.1",
|
|
17
|
+
"@tailor-platform/function-types": "0.8.2",
|
|
18
|
+
"@types/node": "24.12.0",
|
|
19
|
+
"@typescript-eslint/parser": "^8.57.0",
|
|
20
|
+
"eslint": "10.0.3",
|
|
21
|
+
"eslint-import-resolver-typescript": "4.4.4",
|
|
22
|
+
"eslint-plugin-import-x": "4.16.2",
|
|
23
|
+
"typescript": "5.9.3",
|
|
24
|
+
"typescript-eslint": "8.57.0"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"allowSyntheticDefaultImports": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"types": ["node", "@tailor-platform/function-types"]
|
|
14
|
+
},
|
|
15
|
+
"include": ["**/*.ts"]
|
|
16
|
+
}
|
|
File without changes
|