@tailor-platform/erp-kit 0.1.1 → 0.2.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 +12 -0
- package/README.md +158 -62
- package/dist/cli.js +1010 -270
- package/package.json +11 -8
- package/schemas/module/command.yml +1 -0
- package/schemas/module/model.yml +14 -0
- package/schemas/module/query.yml +53 -0
- package/skills/{app-compose-1-requirement-analysis → erp-kit-app-1-requirements}/SKILL.md +2 -2
- package/skills/{app-compose-2-requirements-breakdown → erp-kit-app-2-breakdown}/SKILL.md +3 -3
- package/skills/{app-compose-3-doc-review → erp-kit-app-3-doc-review}/SKILL.md +2 -2
- package/skills/{app-compose-4-design-mock → erp-kit-app-4-design}/SKILL.md +3 -3
- package/skills/{app-compose-5-design-mock-review → erp-kit-app-5-design-review}/SKILL.md +4 -4
- package/skills/{app-compose-6-implementation-spec → erp-kit-app-6-impl-spec}/SKILL.md +3 -3
- package/skills/{mock-scenario → erp-kit-mock-scenario}/SKILL.md +1 -1
- package/skills/{1-module-docs → erp-kit-module-1-docs}/SKILL.md +2 -2
- package/skills/{2-module-feature-breakdown → erp-kit-module-2-feature-breakdown}/SKILL.md +13 -9
- package/skills/erp-kit-module-2-feature-breakdown/references/naming.md +59 -0
- package/skills/{3-module-doc-review → erp-kit-module-3-doc-review}/SKILL.md +83 -25
- package/skills/erp-kit-module-4-tdd/SKILL.md +94 -0
- package/skills/erp-kit-module-4-tdd/references/cross-module-dependency.md +133 -0
- package/skills/{4-module-tdd-implementation → erp-kit-module-4-tdd}/references/db-relations.md +5 -1
- package/skills/{4-module-tdd-implementation → erp-kit-module-4-tdd}/references/exports.md +1 -1
- package/skills/erp-kit-module-4-tdd/references/generated-code.md +32 -0
- package/skills/{5-module-implementation-review → erp-kit-module-5-impl-review}/SKILL.md +46 -44
- package/skills/erp-kit-module-5-impl-review/references/commands.md +62 -0
- package/skills/erp-kit-module-5-impl-review/references/errors.md +10 -0
- package/skills/{5-module-implementation-review → erp-kit-module-5-impl-review}/references/testing.md +1 -1
- package/skills/erp-kit-module-shared/SKILL.md +16 -0
- package/skills/erp-kit-module-shared/references/commands.md +203 -0
- package/skills/erp-kit-module-shared/references/errors.md +35 -0
- package/skills/erp-kit-module-shared/references/queries.md +168 -0
- package/skills/erp-kit-module-shared/references/structure.md +36 -0
- package/skills/{3-module-doc-review → erp-kit-module-shared}/references/testing.md +4 -3
- package/skills/erp-kit-update/SKILL.md +64 -0
- package/src/cli.doc.test.ts +65 -0
- package/src/cli.ts +3 -117
- package/src/commands/app/index.ts +74 -0
- package/src/commands/check.test.ts +3 -2
- package/src/commands/check.ts +3 -2
- package/src/commands/index.ts +73 -0
- package/src/commands/init.test.ts +22 -5
- package/src/commands/init.ts +25 -16
- package/src/commands/license.ts +193 -0
- package/src/commands/mock/index.ts +2 -2
- package/src/commands/mock/start.ts +1 -1
- package/src/commands/mock/validate.test.ts +1 -1
- package/src/commands/module/generate.ts +35 -0
- package/src/commands/module/index.ts +87 -0
- package/src/commands/module/list.test.ts +57 -0
- package/src/commands/module/list.ts +64 -0
- package/src/commands/scaffold-templates.ts +65 -0
- package/src/commands/scaffold.test.ts +97 -2
- package/src/commands/scaffold.ts +24 -3
- package/src/commands/sync-check.test.ts +88 -1
- package/src/commands/sync-check.ts +41 -2
- package/src/generator/generate-code.test.ts +200 -0
- package/src/generator/generate-code.ts +260 -0
- package/src/generator/parse-command-doc.test.ts +159 -0
- package/src/generator/parse-command-doc.ts +116 -0
- package/src/integration.test.ts +6 -8
- package/src/module.ts +10 -9
- package/src/modules/item-management/README.md +38 -0
- package/src/modules/item-management/command/activateItem.generated.ts +6 -0
- package/src/modules/item-management/command/activateItem.test.ts +76 -0
- package/src/modules/item-management/command/activateItem.ts +42 -0
- package/src/modules/item-management/command/assignItemToTaxonomy.generated.ts +6 -0
- package/src/modules/item-management/command/assignItemToTaxonomy.test.ts +88 -0
- package/src/modules/item-management/command/assignItemToTaxonomy.ts +63 -0
- package/src/modules/item-management/command/createItem.generated.ts +6 -0
- package/src/modules/item-management/command/createItem.test.ts +152 -0
- package/src/modules/item-management/command/createItem.ts +72 -0
- package/src/modules/item-management/command/createTaxonomyNode.generated.ts +6 -0
- package/src/modules/item-management/command/createTaxonomyNode.test.ts +126 -0
- package/src/modules/item-management/command/createTaxonomyNode.ts +70 -0
- package/src/modules/item-management/command/deactivateItem.generated.ts +6 -0
- package/src/modules/item-management/command/deactivateItem.test.ts +76 -0
- package/src/modules/item-management/command/deactivateItem.ts +42 -0
- package/src/modules/item-management/command/deleteItem.generated.ts +6 -0
- package/src/modules/item-management/command/deleteItem.test.ts +61 -0
- package/src/modules/item-management/command/deleteItem.ts +38 -0
- package/src/modules/item-management/command/deleteTaxonomyNode.generated.ts +6 -0
- package/src/modules/item-management/command/deleteTaxonomyNode.test.ts +73 -0
- package/src/modules/item-management/command/deleteTaxonomyNode.ts +50 -0
- package/src/modules/item-management/command/moveTaxonomyNode.generated.ts +6 -0
- package/src/modules/item-management/command/moveTaxonomyNode.test.ts +136 -0
- package/src/modules/item-management/command/moveTaxonomyNode.ts +85 -0
- package/src/modules/item-management/command/reactivateItem.generated.ts +6 -0
- package/src/modules/item-management/command/reactivateItem.test.ts +76 -0
- package/src/modules/item-management/command/reactivateItem.ts +42 -0
- package/src/modules/item-management/command/removeItemFromTaxonomy.generated.ts +6 -0
- package/src/modules/item-management/command/removeItemFromTaxonomy.test.ts +43 -0
- package/src/modules/item-management/command/removeItemFromTaxonomy.ts +30 -0
- package/src/modules/item-management/command/updateItem.generated.ts +6 -0
- package/src/modules/item-management/command/updateItem.test.ts +178 -0
- package/src/modules/item-management/command/updateItem.ts +103 -0
- package/src/modules/item-management/command/updateTaxonomyNode.generated.ts +6 -0
- package/src/modules/item-management/command/updateTaxonomyNode.test.ts +88 -0
- package/src/modules/item-management/command/updateTaxonomyNode.ts +62 -0
- package/src/modules/item-management/db/item.ts +47 -0
- package/src/modules/item-management/db/itemTaxonomyAssignment.ts +49 -0
- package/src/modules/item-management/db/taxonomyNode.ts +34 -0
- package/src/modules/item-management/docs/commands/ActivateItem.md +32 -0
- package/src/modules/item-management/docs/commands/AssignItemToTaxonomy.md +38 -0
- package/src/modules/item-management/docs/commands/CreateItem.md +44 -0
- package/src/modules/item-management/docs/commands/CreateTaxonomyNode.md +44 -0
- package/src/modules/item-management/docs/commands/DeactivateItem.md +34 -0
- package/src/modules/item-management/docs/commands/DeleteItem.md +35 -0
- package/src/modules/item-management/docs/commands/DeleteTaxonomyNode.md +39 -0
- package/src/modules/item-management/docs/commands/MoveTaxonomyNode.md +45 -0
- package/src/modules/item-management/docs/commands/ReactivateItem.md +34 -0
- package/src/modules/item-management/docs/commands/RemoveItemFromTaxonomy.md +30 -0
- package/src/modules/item-management/docs/commands/UpdateItem.md +55 -0
- package/src/modules/item-management/docs/commands/UpdateTaxonomyNode.md +36 -0
- package/src/modules/item-management/docs/features/item-lifecycle.md +60 -0
- package/src/modules/item-management/docs/features/item-taxonomy.md +65 -0
- package/src/modules/item-management/docs/models/ItemTaxonomyAssignment.md +36 -0
- package/src/modules/item-management/docs/models/TaxonomyNode.md +47 -0
- package/src/modules/item-management/docs/models/item.md +59 -0
- package/src/modules/item-management/docs/queries/CalculateNodeDepth.md +36 -0
- package/src/modules/item-management/docs/queries/CalculateSubtreeDepth.md +40 -0
- package/src/modules/item-management/docs/queries/DetectCircularReference.md +41 -0
- package/src/modules/item-management/docs/queries/GetItem.md +38 -0
- package/src/modules/item-management/docs/queries/GetItemTaxonomyAssignment.md +29 -0
- package/src/modules/item-management/docs/queries/GetTaxonomyNode.md +35 -0
- package/src/modules/item-management/docs/queries/GetTaxonomyNodeAssignments.md +29 -0
- package/src/modules/item-management/docs/queries/GetTaxonomyNodeChildren.md +29 -0
- package/src/modules/item-management/generated/enums.ts +9 -0
- package/src/modules/item-management/generated/kysely-tailordb.ts +62 -0
- package/src/modules/item-management/index.ts +53 -0
- package/src/modules/item-management/lib/_db_deps.ts +13 -0
- package/src/modules/item-management/lib/errors.generated.ts +117 -0
- package/src/modules/item-management/lib/permissions.generated.ts +17 -0
- package/src/modules/item-management/lib/types.ts +19 -0
- package/src/modules/item-management/module.ts +97 -0
- package/src/modules/item-management/query/calculateNodeDepth.generated.ts +5 -0
- package/src/modules/item-management/query/calculateNodeDepth.test.ts +56 -0
- package/src/modules/item-management/query/calculateNodeDepth.ts +28 -0
- package/src/modules/item-management/query/calculateSubtreeDepth.generated.ts +5 -0
- package/src/modules/item-management/query/calculateSubtreeDepth.test.ts +75 -0
- package/src/modules/item-management/query/calculateSubtreeDepth.ts +29 -0
- package/src/modules/item-management/query/detectCircularReference.generated.ts +5 -0
- package/src/modules/item-management/query/detectCircularReference.test.ts +61 -0
- package/src/modules/item-management/query/detectCircularReference.ts +32 -0
- package/src/modules/item-management/query/getItem.generated.ts +5 -0
- package/src/modules/item-management/query/getItem.test.ts +67 -0
- package/src/modules/item-management/query/getItem.ts +20 -0
- package/src/modules/item-management/query/getItemTaxonomyAssignment.generated.ts +5 -0
- package/src/modules/item-management/query/getItemTaxonomyAssignment.test.ts +25 -0
- package/src/modules/item-management/query/getItemTaxonomyAssignment.ts +18 -0
- package/src/modules/item-management/query/getTaxonomyNode.generated.ts +5 -0
- package/src/modules/item-management/query/getTaxonomyNode.test.ts +47 -0
- package/src/modules/item-management/query/getTaxonomyNode.ts +18 -0
- package/src/modules/item-management/query/getTaxonomyNodeAssignments.generated.ts +5 -0
- package/src/modules/item-management/query/getTaxonomyNodeAssignments.test.ts +25 -0
- package/src/modules/item-management/query/getTaxonomyNodeAssignments.ts +16 -0
- package/src/modules/item-management/query/getTaxonomyNodeChildren.generated.ts +5 -0
- package/src/modules/item-management/query/getTaxonomyNodeChildren.test.ts +34 -0
- package/src/modules/item-management/query/getTaxonomyNodeChildren.ts +16 -0
- package/src/modules/item-management/tailor.config.ts +11 -0
- package/src/modules/item-management/testing/fixtures.ts +81 -0
- package/src/modules/primitives/command/activateCategory.generated.ts +6 -0
- package/src/modules/primitives/command/activateCategory.test.ts +11 -29
- package/src/modules/primitives/command/activateCategory.ts +27 -34
- package/src/modules/primitives/command/activateCurrency.generated.ts +6 -0
- package/src/modules/primitives/command/activateCurrency.test.ts +11 -29
- package/src/modules/primitives/command/activateCurrency.ts +27 -34
- package/src/modules/primitives/command/activateUnit.generated.ts +6 -0
- package/src/modules/primitives/command/activateUnit.test.ts +11 -15
- package/src/modules/primitives/command/activateUnit.ts +27 -34
- package/src/modules/primitives/command/createCategory.generated.ts +6 -0
- package/src/modules/primitives/command/createCategory.test.ts +27 -39
- package/src/modules/primitives/command/createCategory.ts +53 -62
- package/src/modules/primitives/command/createCurrency.generated.ts +6 -0
- package/src/modules/primitives/command/createCurrency.test.ts +78 -71
- package/src/modules/primitives/command/createCurrency.ts +43 -48
- package/src/modules/primitives/command/createExchangeRate.generated.ts +6 -0
- package/src/modules/primitives/command/createExchangeRate.test.ts +101 -100
- package/src/modules/primitives/command/createExchangeRate.ts +50 -59
- package/src/modules/primitives/command/createUnit.generated.ts +6 -0
- package/src/modules/primitives/command/createUnit.test.ts +92 -95
- package/src/modules/primitives/command/createUnit.ts +54 -57
- package/src/modules/primitives/command/deactivateCategory.generated.ts +6 -0
- package/src/modules/primitives/command/deactivateCategory.test.ts +27 -28
- package/src/modules/primitives/command/deactivateCategory.ts +43 -50
- package/src/modules/primitives/command/deactivateCurrency.generated.ts +6 -0
- package/src/modules/primitives/command/deactivateCurrency.test.ts +23 -38
- package/src/modules/primitives/command/deactivateCurrency.ts +31 -38
- package/src/modules/primitives/command/deactivateUnit.generated.ts +6 -0
- package/src/modules/primitives/command/deactivateUnit.test.ts +27 -23
- package/src/modules/primitives/command/deactivateUnit.ts +39 -49
- package/src/modules/primitives/command/setBaseCurrency.generated.ts +6 -0
- package/src/modules/primitives/command/setBaseCurrency.test.ts +40 -33
- package/src/modules/primitives/command/setBaseCurrency.ts +43 -50
- package/src/modules/primitives/command/setReferenceUnit.generated.ts +6 -0
- package/src/modules/primitives/command/setReferenceUnit.test.ts +39 -35
- package/src/modules/primitives/command/setReferenceUnit.ts +46 -59
- package/src/modules/primitives/db/unit.ts +13 -3
- package/src/modules/primitives/docs/commands/ActivateCategory.md +1 -2
- package/src/modules/primitives/docs/commands/ActivateCurrency.md +1 -2
- package/src/modules/primitives/docs/commands/ActivateUnit.md +1 -2
- package/src/modules/primitives/docs/commands/CreateCategory.md +1 -4
- package/src/modules/primitives/docs/commands/CreateCurrency.md +3 -4
- package/src/modules/primitives/docs/commands/CreateExchangeRate.md +4 -5
- package/src/modules/primitives/docs/commands/CreateUnit.md +5 -5
- package/src/modules/primitives/docs/commands/DeactivateCategory.md +2 -3
- package/src/modules/primitives/docs/commands/DeactivateCurrency.md +2 -3
- package/src/modules/primitives/docs/commands/DeactivateUnit.md +2 -3
- package/src/modules/primitives/docs/commands/SetBaseCurrency.md +2 -3
- package/src/modules/primitives/docs/commands/SetReferenceUnit.md +2 -3
- package/src/modules/primitives/docs/models/Currency.md +4 -0
- package/src/modules/primitives/docs/models/ExchangeRate.md +4 -1
- package/src/modules/primitives/docs/models/Unit.md +4 -1
- package/src/modules/primitives/docs/models/UoMCategory.md +2 -0
- package/src/modules/primitives/docs/{commands → queries}/ConvertAmount.md +3 -5
- package/src/modules/primitives/docs/{commands → queries}/ConvertQuantity.md +3 -5
- package/src/modules/primitives/docs/queries/GetBaseCurrency.md +32 -0
- package/src/modules/primitives/docs/queries/GetCurrency.md +36 -0
- package/src/modules/primitives/docs/queries/GetUnit.md +36 -0
- package/src/modules/primitives/docs/queries/GetUoMCategory.md +36 -0
- package/src/modules/primitives/docs/queries/ListUnitsByCategory.md +26 -0
- package/src/modules/primitives/generated/kysely-tailordb.ts +24 -45
- package/src/modules/primitives/index.ts +17 -6
- package/src/modules/primitives/lib/errors.generated.ts +112 -0
- package/src/modules/primitives/{permissions.ts → lib/permissions.generated.ts} +9 -10
- package/src/modules/primitives/module.ts +39 -27
- package/src/modules/primitives/query/convertAmount.generated.ts +5 -0
- package/src/modules/primitives/{command → query}/convertAmount.test.ts +4 -21
- package/src/modules/primitives/query/convertAmount.ts +121 -0
- package/src/modules/primitives/query/convertQuantity.generated.ts +5 -0
- package/src/modules/primitives/{command → query}/convertQuantity.test.ts +8 -15
- package/src/modules/primitives/query/convertQuantity.ts +63 -0
- package/src/modules/primitives/query/getBaseCurrency.generated.ts +5 -0
- package/src/modules/primitives/query/getBaseCurrency.test.ts +28 -0
- package/src/modules/primitives/query/getBaseCurrency.ts +16 -0
- package/src/modules/primitives/query/getCurrency.generated.ts +5 -0
- package/src/modules/primitives/query/getCurrency.test.ts +47 -0
- package/src/modules/primitives/query/getCurrency.ts +18 -0
- package/src/modules/primitives/query/getUnit.generated.ts +5 -0
- package/src/modules/primitives/query/getUnit.test.ts +47 -0
- package/src/modules/primitives/query/getUnit.ts +18 -0
- package/src/modules/primitives/query/getUoMCategory.generated.ts +5 -0
- package/src/modules/primitives/query/getUoMCategory.test.ts +47 -0
- package/src/modules/primitives/query/getUoMCategory.ts +18 -0
- package/src/modules/primitives/query/listUnitsByCategory.generated.ts +5 -0
- package/src/modules/primitives/query/listUnitsByCategory.ts +16 -0
- package/src/modules/primitives/tailor.config.ts +3 -3
- package/src/modules/shared/defineCommand.test.ts +23 -10
- package/src/modules/shared/defineCommand.ts +23 -10
- package/src/modules/shared/defineQuery.test.ts +28 -0
- package/src/modules/shared/defineQuery.ts +16 -0
- package/src/modules/shared/internal.ts +3 -1
- package/src/modules/shared/requirePermission.test.ts +22 -21
- package/src/modules/shared/requirePermission.ts +8 -2
- package/src/modules/shared/result.ts +12 -0
- package/src/modules/shared/types.ts +8 -0
- package/src/modules/testing/index.ts +36 -11
- package/src/modules/user-management/command/activateUser.generated.ts +6 -0
- package/src/modules/user-management/command/activateUser.test.ts +27 -27
- package/src/modules/user-management/command/activateUser.ts +40 -48
- package/src/modules/user-management/command/assignPermissionToRole.generated.ts +6 -0
- package/src/modules/user-management/command/assignPermissionToRole.test.ts +42 -43
- package/src/modules/user-management/command/assignPermissionToRole.ts +59 -62
- package/src/modules/user-management/command/assignRoleToUser.generated.ts +6 -0
- package/src/modules/user-management/command/assignRoleToUser.test.ts +70 -63
- package/src/modules/user-management/command/assignRoleToUser.ts +63 -66
- package/src/modules/user-management/command/createPermission.generated.ts +6 -0
- package/src/modules/user-management/command/createPermission.test.ts +45 -38
- package/src/modules/user-management/command/createPermission.ts +42 -46
- package/src/modules/user-management/command/createRole.generated.ts +6 -0
- package/src/modules/user-management/command/createRole.test.ts +30 -29
- package/src/modules/user-management/command/createRole.ts +33 -33
- package/src/modules/user-management/command/createUser.generated.ts +6 -0
- package/src/modules/user-management/command/createUser.test.ts +64 -42
- package/src/modules/user-management/command/createUser.ts +54 -56
- package/src/modules/user-management/command/deactivateUser.generated.ts +6 -0
- package/src/modules/user-management/command/deactivateUser.test.ts +27 -27
- package/src/modules/user-management/command/deactivateUser.ts +40 -48
- package/src/modules/user-management/command/logAuditEvent.generated.ts +6 -0
- package/src/modules/user-management/command/logAuditEvent.test.ts +50 -42
- package/src/modules/user-management/command/logAuditEvent.ts +25 -28
- package/src/modules/user-management/command/reactivateUser.generated.ts +6 -0
- package/src/modules/user-management/command/reactivateUser.test.ts +31 -27
- package/src/modules/user-management/command/reactivateUser.ts +40 -48
- package/src/modules/user-management/command/revokePermissionFromRole.generated.ts +6 -0
- package/src/modules/user-management/command/revokePermissionFromRole.test.ts +52 -51
- package/src/modules/user-management/command/revokePermissionFromRole.ts +60 -57
- package/src/modules/user-management/command/revokeRoleFromUser.generated.ts +6 -0
- package/src/modules/user-management/command/revokeRoleFromUser.test.ts +53 -48
- package/src/modules/user-management/command/revokeRoleFromUser.ts +58 -57
- package/src/modules/user-management/docs/commands/CreatePermission.md +2 -2
- package/src/modules/user-management/docs/commands/CreateRole.md +1 -1
- package/src/modules/user-management/docs/models/AuditEvent.md +2 -0
- package/src/modules/user-management/docs/models/Permission.md +2 -0
- package/src/modules/user-management/docs/models/Role.md +2 -0
- package/src/modules/user-management/docs/models/RolePermission.md +2 -0
- package/src/modules/user-management/docs/models/User.md +2 -0
- package/src/modules/user-management/docs/models/UserRole.md +2 -0
- package/src/modules/user-management/generated/enums.ts +11 -11
- package/src/modules/user-management/generated/kysely-tailordb.ts +27 -56
- package/src/modules/user-management/index.ts +2 -2
- package/src/modules/user-management/lib/errors.generated.ts +67 -0
- package/src/modules/user-management/{permissions.ts → lib/permissions.generated.ts} +8 -7
- package/src/modules/user-management/module.ts +22 -22
- package/src/modules/user-management/tailor.config.ts +3 -3
- package/src/schemas.ts +2 -1
- package/skills/1-module-docs/references/structure.md +0 -22
- package/skills/2-module-feature-breakdown/references/commands.md +0 -48
- package/skills/2-module-feature-breakdown/references/structure.md +0 -22
- package/skills/3-module-doc-review/references/commands.md +0 -54
- package/skills/3-module-doc-review/references/models.md +0 -29
- package/skills/4-module-tdd-implementation/SKILL.md +0 -74
- package/skills/4-module-tdd-implementation/references/commands.md +0 -45
- package/skills/4-module-tdd-implementation/references/errors.md +0 -7
- package/skills/4-module-tdd-implementation/references/models.md +0 -30
- package/skills/4-module-tdd-implementation/references/structure.md +0 -22
- package/skills/4-module-tdd-implementation/references/testing.md +0 -37
- package/skills/5-module-implementation-review/references/commands.md +0 -45
- package/skills/5-module-implementation-review/references/errors.md +0 -7
- package/skills/5-module-implementation-review/references/exports.md +0 -8
- package/skills/5-module-implementation-review/references/models.md +0 -30
- package/src/modules/primitives/command/convertAmount.ts +0 -126
- package/src/modules/primitives/command/convertQuantity.ts +0 -73
- package/src/modules/primitives/lib/errors.ts +0 -138
- package/src/modules/user-management/lib/errors.ts +0 -81
- /package/skills/{app-compose-1-requirement-analysis → erp-kit-app-1-requirements}/references/structure.md +0 -0
- /package/skills/{app-compose-2-requirements-breakdown → erp-kit-app-2-breakdown}/references/screen-detailview.md +0 -0
- /package/skills/{app-compose-2-requirements-breakdown → erp-kit-app-2-breakdown}/references/screen-form.md +0 -0
- /package/skills/{app-compose-2-requirements-breakdown → erp-kit-app-2-breakdown}/references/screen-listview.md +0 -0
- /package/skills/{app-compose-2-requirements-breakdown → erp-kit-app-2-breakdown}/references/structure.md +0 -0
- /package/skills/{app-compose-3-doc-review → erp-kit-app-3-doc-review}/references/structure.md +0 -0
- /package/skills/{app-compose-4-design-mock → erp-kit-app-4-design}/references/component.md +0 -0
- /package/skills/{app-compose-4-design-mock → erp-kit-app-4-design}/references/screen-detailview.md +0 -0
- /package/skills/{app-compose-4-design-mock → erp-kit-app-4-design}/references/screen-form.md +0 -0
- /package/skills/{app-compose-4-design-mock → erp-kit-app-4-design}/references/screen-listview.md +0 -0
- /package/skills/{app-compose-4-design-mock → erp-kit-app-4-design}/references/structure.md +0 -0
- /package/skills/{app-compose-5-design-mock-review → erp-kit-app-5-design-review}/references/component.md +0 -0
- /package/skills/{app-compose-5-design-mock-review → erp-kit-app-5-design-review}/references/screen-detailview.md +0 -0
- /package/skills/{app-compose-5-design-mock-review → erp-kit-app-5-design-review}/references/screen-form.md +0 -0
- /package/skills/{app-compose-5-design-mock-review → erp-kit-app-5-design-review}/references/screen-listview.md +0 -0
- /package/skills/{app-compose-6-implementation-spec → erp-kit-app-6-impl-spec}/references/auth.md +0 -0
- /package/skills/{app-compose-6-implementation-spec → erp-kit-app-6-impl-spec}/references/structure.md +0 -0
- /package/skills/{2-module-feature-breakdown → erp-kit-module-4-tdd}/references/models.md +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# CreateTaxonomyNode
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
createTaxonomyNode establishes a new node in the taxonomy hierarchy. A node can be a root node (no parent) or a child node positioned under an existing parent. Each node has a globally unique code for stable API references and integrations, and a display name.
|
|
6
|
+
|
|
7
|
+
This command supports both initial taxonomy setup and incremental expansion of the classification tree.
|
|
8
|
+
|
|
9
|
+
## Business Rules
|
|
10
|
+
|
|
11
|
+
- Node code is required and must be globally unique across all taxonomy nodes
|
|
12
|
+
- Node name is required
|
|
13
|
+
- Parent node ID is optional — omitting it creates a root node
|
|
14
|
+
- When parent is specified, the parent node must exist
|
|
15
|
+
- Creating a child node must not cause the tree to exceed the configurable maximum depth (default 10)
|
|
16
|
+
- Root nodes have a null parent reference
|
|
17
|
+
|
|
18
|
+
## Process Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
A[Receive create request] --> B{Validate code format}
|
|
23
|
+
B -->|Invalid| C[Return error: invalid code]
|
|
24
|
+
B -->|Valid| D{Code unique?}
|
|
25
|
+
D -->|No| E[Return error: duplicate code]
|
|
26
|
+
D -->|Yes| F{Parent specified?}
|
|
27
|
+
F -->|Yes| G{Parent exists?}
|
|
28
|
+
G -->|No| H[Return error: parent not found]
|
|
29
|
+
G -->|Yes| I{Depth limit exceeded?}
|
|
30
|
+
I -->|Yes| J[Return error: max depth exceeded]
|
|
31
|
+
I -->|No| K[Create node with parent]
|
|
32
|
+
F -->|No| K[Create root node]
|
|
33
|
+
K --> L[Return created node]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## External Dependencies
|
|
37
|
+
|
|
38
|
+
- None
|
|
39
|
+
|
|
40
|
+
## Error Scenarios
|
|
41
|
+
|
|
42
|
+
- **DUPLICATE_NODE_CODE**: A node with the same code already exists
|
|
43
|
+
- **PARENT_NODE_NOT_FOUND**: Specified parent node ID does not exist
|
|
44
|
+
- **MAX_DEPTH_EXCEEDED**: Adding this child would exceed the configurable tree depth limit
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# DeactivateItem
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
deactivateItem transitions an item from ACTIVE to INACTIVE status, removing it from availability for new transactions while preserving it for historical reference and audit trails. This supports scenarios such as discontinuing a product line or seasonal item removal.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target item must exist in the system
|
|
10
|
+
- Target item must be in ACTIVE status
|
|
11
|
+
- Deactivated items remain in the system for reporting and audit purposes
|
|
12
|
+
- Deactivation prevents the item from being used in new transactions
|
|
13
|
+
- Existing transactions referencing this item are not affected
|
|
14
|
+
|
|
15
|
+
## Process Flow
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
A[Receive deactivate request] --> B{Item exists?}
|
|
20
|
+
B -->|No| C[Return error: not found]
|
|
21
|
+
B -->|Yes| D{Status is ACTIVE?}
|
|
22
|
+
D -->|No| E[Return error: invalid state transition]
|
|
23
|
+
D -->|Yes| F[Update status to INACTIVE]
|
|
24
|
+
F --> G[Return deactivated item]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## External Dependencies
|
|
28
|
+
|
|
29
|
+
- None
|
|
30
|
+
|
|
31
|
+
## Error Scenarios
|
|
32
|
+
|
|
33
|
+
- **ITEM_NOT_FOUND**: Specified item ID does not exist
|
|
34
|
+
- **INVALID_STATE_TRANSITION**: Item is not in ACTIVE status
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# DeleteItem
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
deleteItem permanently removes a DRAFT item from the system. Only items in DRAFT status can be deleted — ACTIVE and INACTIVE items are preserved for audit trails and historical reference. This supports draft cleanup workflows where unwanted items are removed before activation.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target item must exist in the system
|
|
10
|
+
- Target item must be in DRAFT status
|
|
11
|
+
- ACTIVE and INACTIVE items cannot be deleted — they must be preserved for audit trails
|
|
12
|
+
- Deletion is permanent and cannot be undone
|
|
13
|
+
- Any taxonomy assignments for the item should be removed before or as part of deletion
|
|
14
|
+
|
|
15
|
+
## Process Flow
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
A[Receive delete request] --> B{Item exists?}
|
|
20
|
+
B -->|No| C[Return error: not found]
|
|
21
|
+
B -->|Yes| D{Status is DRAFT?}
|
|
22
|
+
D -->|No| E[Return error: cannot delete non-draft item]
|
|
23
|
+
D -->|Yes| F[Remove taxonomy assignments]
|
|
24
|
+
F --> G[Delete item record]
|
|
25
|
+
G --> H[Return success]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## External Dependencies
|
|
29
|
+
|
|
30
|
+
- None
|
|
31
|
+
|
|
32
|
+
## Error Scenarios
|
|
33
|
+
|
|
34
|
+
- **ITEM_NOT_FOUND**: Specified item ID does not exist
|
|
35
|
+
- **DELETE_NON_DRAFT**: Item is in ACTIVE or INACTIVE status — only DRAFT items can be deleted
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# DeleteTaxonomyNode
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
deleteTaxonomyNode permanently removes a taxonomy node from the hierarchy. Deletion is only allowed for leaf nodes (no children) with no item assignments. This ensures the classification tree remains consistent and no item classifications are silently lost.
|
|
6
|
+
|
|
7
|
+
For node consolidation scenarios, item assignments should first be moved to another node using assignItemToTaxonomy and removeItemFromTaxonomy before deleting the empty node.
|
|
8
|
+
|
|
9
|
+
## Business Rules
|
|
10
|
+
|
|
11
|
+
- Target node must exist in the system
|
|
12
|
+
- Node must have no child nodes — a node with children cannot be deleted
|
|
13
|
+
- Node must have no item assignments — a node with assigned items cannot be deleted
|
|
14
|
+
- Deletion is permanent and cannot be undone
|
|
15
|
+
- The node's code becomes available for reuse after deletion
|
|
16
|
+
|
|
17
|
+
## Process Flow
|
|
18
|
+
|
|
19
|
+
```mermaid
|
|
20
|
+
flowchart TD
|
|
21
|
+
A[Receive delete request] --> B{Node exists?}
|
|
22
|
+
B -->|No| C[Return error: not found]
|
|
23
|
+
B -->|Yes| D{Has child nodes?}
|
|
24
|
+
D -->|Yes| E[Return error: has children]
|
|
25
|
+
D -->|No| F{Has item assignments?}
|
|
26
|
+
F -->|Yes| G[Return error: has assignments]
|
|
27
|
+
F -->|No| H[Delete node record]
|
|
28
|
+
H --> I[Return success]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## External Dependencies
|
|
32
|
+
|
|
33
|
+
- None
|
|
34
|
+
|
|
35
|
+
## Error Scenarios
|
|
36
|
+
|
|
37
|
+
- **NODE_NOT_FOUND**: Specified node ID does not exist
|
|
38
|
+
- **NODE_HAS_CHILDREN**: Node has one or more child nodes — children must be moved or deleted first
|
|
39
|
+
- **NODE_HAS_ASSIGNMENTS**: Node has one or more item assignments — assignments must be removed first
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# MoveTaxonomyNode
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
moveTaxonomyNode reparents a taxonomy node by changing its parent reference. The node and all its descendants move together, preserving the subtree structure and all item assignments. This supports taxonomy restructuring scenarios such as promoting a branch to root level or reorganizing classification hierarchies.
|
|
6
|
+
|
|
7
|
+
Moving to a null parent promotes the node to a root node.
|
|
8
|
+
|
|
9
|
+
## Business Rules
|
|
10
|
+
|
|
11
|
+
- Target node must exist in the system
|
|
12
|
+
- New parent node must exist when specified (null for root promotion)
|
|
13
|
+
- A node cannot be moved under itself or any of its descendants (circular reference prevention)
|
|
14
|
+
- All child nodes and their item assignments are preserved during the move
|
|
15
|
+
- The move must not cause the tree to exceed the configurable maximum depth
|
|
16
|
+
- Node code and item assignments are unchanged by the move
|
|
17
|
+
|
|
18
|
+
## Process Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
A[Receive move request] --> B{Node exists?}
|
|
23
|
+
B -->|No| C[Return error: not found]
|
|
24
|
+
B -->|Yes| D{New parent specified?}
|
|
25
|
+
D -->|Yes| E{New parent exists?}
|
|
26
|
+
E -->|No| F[Return error: parent not found]
|
|
27
|
+
E -->|Yes| G{New parent is descendant of node?}
|
|
28
|
+
G -->|Yes| H[Return error: circular reference]
|
|
29
|
+
G -->|No| I{Depth limit exceeded?}
|
|
30
|
+
I -->|Yes| J[Return error: max depth exceeded]
|
|
31
|
+
I -->|No| K[Update parent reference]
|
|
32
|
+
D -->|No/null| K[Promote to root]
|
|
33
|
+
K --> L[Return moved node]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## External Dependencies
|
|
37
|
+
|
|
38
|
+
- None
|
|
39
|
+
|
|
40
|
+
## Error Scenarios
|
|
41
|
+
|
|
42
|
+
- **NODE_NOT_FOUND**: Specified node ID does not exist
|
|
43
|
+
- **PARENT_NODE_NOT_FOUND**: Specified new parent node ID does not exist
|
|
44
|
+
- **CIRCULAR_REFERENCE**: New parent is the node itself or one of its descendants
|
|
45
|
+
- **MAX_DEPTH_EXCEEDED**: Moving this subtree would exceed the configurable tree depth limit
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# ReactivateItem
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
reactivateItem transitions an item from INACTIVE back to ACTIVE status, making a previously discontinued SKU available for transactions again. This supports scenarios such as bringing back seasonal products or restoring items after a temporary suspension.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target item must exist in the system
|
|
10
|
+
- Target item must be in INACTIVE status
|
|
11
|
+
- After reactivation, the item can participate in new transactions
|
|
12
|
+
- All item data (SKU, barcode, UoM, name) is preserved from before deactivation
|
|
13
|
+
- Bulk reactivation is not supported — reactivation is expected to be a targeted, individual operation since bringing back discontinued items requires deliberate per-item review
|
|
14
|
+
|
|
15
|
+
## Process Flow
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
A[Receive reactivate request] --> B{Item exists?}
|
|
20
|
+
B -->|No| C[Return error: not found]
|
|
21
|
+
B -->|Yes| D{Status is INACTIVE?}
|
|
22
|
+
D -->|No| E[Return error: invalid state transition]
|
|
23
|
+
D -->|Yes| F[Update status to ACTIVE]
|
|
24
|
+
F --> G[Return reactivated item]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## External Dependencies
|
|
28
|
+
|
|
29
|
+
- None
|
|
30
|
+
|
|
31
|
+
## Error Scenarios
|
|
32
|
+
|
|
33
|
+
- **ITEM_NOT_FOUND**: Specified item ID does not exist
|
|
34
|
+
- **INVALID_STATE_TRANSITION**: Item is not in INACTIVE status
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# RemoveItemFromTaxonomy
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
removeItemFromTaxonomy deletes the link between an item and a taxonomy node. Removing an assignment does not affect the item itself, the taxonomy node, or any other assignments the item may have. This supports scenarios such as reclassification, node consolidation, and cleanup of incorrect assignments.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- The assignment (item + taxonomy node link) must exist in the system
|
|
10
|
+
- Removing an assignment does not affect the item or its other taxonomy assignments
|
|
11
|
+
- Removing an assignment does not affect the taxonomy node or its other item assignments
|
|
12
|
+
- Removal is permanent and cannot be undone
|
|
13
|
+
|
|
14
|
+
## Process Flow
|
|
15
|
+
|
|
16
|
+
```mermaid
|
|
17
|
+
flowchart TD
|
|
18
|
+
A[Receive remove request] --> B{Assignment exists?}
|
|
19
|
+
B -->|No| C[Return error: assignment not found]
|
|
20
|
+
B -->|Yes| D[Delete assignment record]
|
|
21
|
+
D --> E[Return success]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## External Dependencies
|
|
25
|
+
|
|
26
|
+
- None
|
|
27
|
+
|
|
28
|
+
## Error Scenarios
|
|
29
|
+
|
|
30
|
+
- **ASSIGNMENT_NOT_FOUND**: No assignment exists for the specified item and taxonomy node combination
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# UpdateItem
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
updateItem modifies mutable fields of an existing item — name, barcode, and unit of measure (UoM). SKU is immutable and cannot be changed after creation. The set of updatable fields depends on the item's current lifecycle status.
|
|
6
|
+
|
|
7
|
+
This command supports the DRAFT review workflow (correcting barcodes, setting names before activation) as well as post-activation updates to non-transactional fields.
|
|
8
|
+
|
|
9
|
+
## Business Rules
|
|
10
|
+
|
|
11
|
+
- Target item must exist in the system
|
|
12
|
+
- SKU is immutable — any attempt to change SKU returns an error
|
|
13
|
+
- Name can be updated in any status (DRAFT, ACTIVE, INACTIVE)
|
|
14
|
+
- Barcode can be updated in any status; must remain unique across all items when provided
|
|
15
|
+
- Barcode can be cleared (set to null) to remove it from the item
|
|
16
|
+
- UoM can be updated only when the item is in DRAFT status — once activated, UoM is locked to preserve transaction consistency
|
|
17
|
+
- UoM must reference an existing active Unit from the primitives module
|
|
18
|
+
- At least one field must be provided for update (no-op updates are rejected)
|
|
19
|
+
|
|
20
|
+
## Process Flow
|
|
21
|
+
|
|
22
|
+
```mermaid
|
|
23
|
+
flowchart TD
|
|
24
|
+
A[Receive update request] --> B{Item exists?}
|
|
25
|
+
B -->|No| C[Return error: not found]
|
|
26
|
+
B -->|Yes| D{SKU change attempted?}
|
|
27
|
+
D -->|Yes| E[Return error: SKU immutable]
|
|
28
|
+
D -->|No| F{Any field provided?}
|
|
29
|
+
F -->|No| G[Return error: no fields to update]
|
|
30
|
+
F -->|Yes| H{Barcode provided?}
|
|
31
|
+
H -->|Yes| I{Barcode unique?}
|
|
32
|
+
I -->|No| J[Return error: duplicate barcode]
|
|
33
|
+
I -->|Yes| K{UoM change requested?}
|
|
34
|
+
H -->|No| K
|
|
35
|
+
K -->|Yes| L{Status is DRAFT?}
|
|
36
|
+
L -->|No| M[Return error: UoM locked after activation]
|
|
37
|
+
L -->|Yes| N{UoM valid and active?}
|
|
38
|
+
N -->|No| O[Return error: invalid UoM]
|
|
39
|
+
N -->|Yes| P[Apply updates]
|
|
40
|
+
K -->|No| P
|
|
41
|
+
P --> Q[Return updated item]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## External Dependencies
|
|
45
|
+
|
|
46
|
+
- [primitives::Unit](../../../primitives/docs/models/Unit.md) - Validates that the referenced UoM exists and is active (when UoM is being updated)
|
|
47
|
+
|
|
48
|
+
## Error Scenarios
|
|
49
|
+
|
|
50
|
+
- **ITEM_NOT_FOUND**: Specified item ID does not exist
|
|
51
|
+
- **SKU_IMMUTABLE**: Attempt to change the SKU field
|
|
52
|
+
- **DUPLICATE_BARCODE**: An item with the same barcode already exists
|
|
53
|
+
- **UNIT_NOT_FOUND**: Referenced unit does not exist or is inactive
|
|
54
|
+
- **UOM_LOCKED**: UoM cannot be changed after item has been activated (status is ACTIVE or INACTIVE)
|
|
55
|
+
- **NO_FIELDS_TO_UPDATE**: No updatable fields were provided in the request
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# UpdateTaxonomyNode
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
updateTaxonomyNode modifies the display name of an existing taxonomy node. The node code is immutable and cannot be changed after creation — only the name (display label) can be updated. This supports scenarios such as renaming a classification branch to better reflect its contents or aligning terminology across the organization.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target node must exist in the system
|
|
10
|
+
- Node code is immutable — any attempt to change the code returns an error
|
|
11
|
+
- Name is required and must not be empty
|
|
12
|
+
- Name update does not affect the node's position in the tree, child nodes, or item assignments
|
|
13
|
+
|
|
14
|
+
## Process Flow
|
|
15
|
+
|
|
16
|
+
```mermaid
|
|
17
|
+
flowchart TD
|
|
18
|
+
A[Receive update request] --> B{Node exists?}
|
|
19
|
+
B -->|No| C[Return error: not found]
|
|
20
|
+
B -->|Yes| D{Code change attempted?}
|
|
21
|
+
D -->|Yes| E[Return error: code immutable]
|
|
22
|
+
D -->|No| F{Name provided and non-empty?}
|
|
23
|
+
F -->|No| G[Return error: name required]
|
|
24
|
+
F -->|Yes| H[Update node name]
|
|
25
|
+
H --> I[Return updated node]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## External Dependencies
|
|
29
|
+
|
|
30
|
+
- None
|
|
31
|
+
|
|
32
|
+
## Error Scenarios
|
|
33
|
+
|
|
34
|
+
- **NODE_NOT_FOUND**: Specified node ID does not exist
|
|
35
|
+
- **CODE_IMMUTABLE**: Attempt to change the node code
|
|
36
|
+
- **MISSING_REQUIRED_FIELDS**: Name not provided or empty
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Item Lifecycle
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Items are the fundamental SKU-level entity in the ERP system — the sellable, purchasable, and trackable unit. Each item has its own lifecycle state machine, unique SKU identifier, and optional barcode. Items manage their unit of measure independently.
|
|
6
|
+
|
|
7
|
+
Items can be created in DRAFT or ACTIVE status. DRAFT items require explicit activation before they can participate in transactions.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
Items serve as the universal SKU entity across the ERP system. Downstream domains reference items as the fundamental tradeable/trackable unit:
|
|
12
|
+
|
|
13
|
+
- Sales module creates order lines linked to Items
|
|
14
|
+
- Inventory module tracks stock quantities per Item
|
|
15
|
+
- Purchasing module creates purchase order lines linked to Items
|
|
16
|
+
- Manufacturing module references Items in Bill of Materials
|
|
17
|
+
|
|
18
|
+
The lifecycle state machine ensures:
|
|
19
|
+
|
|
20
|
+
- Items are reviewed before becoming transactionally available (DRAFT → ACTIVE)
|
|
21
|
+
- Discontinued items are preserved for historical reference (ACTIVE → INACTIVE)
|
|
22
|
+
- Previously discontinued items can return to active use (INACTIVE → ACTIVE)
|
|
23
|
+
- Only DRAFT items can be permanently deleted; ACTIVE/INACTIVE items are preserved for audit trails
|
|
24
|
+
|
|
25
|
+
## Process Flow
|
|
26
|
+
|
|
27
|
+
```mermaid
|
|
28
|
+
stateDiagram-v2
|
|
29
|
+
[*] --> Draft: createItem (draft)
|
|
30
|
+
[*] --> Active: createItem (active)
|
|
31
|
+
Draft --> Active: activateItem
|
|
32
|
+
Active --> Inactive: deactivateItem
|
|
33
|
+
Inactive --> Active: reactivateItem
|
|
34
|
+
Draft --> [*]: deleteItem
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Scenario Patterns
|
|
38
|
+
|
|
39
|
+
- **New Item**: An item is created with a unique SKU, name, UoM, and optional barcode
|
|
40
|
+
- **Draft Item Review**: Items created in DRAFT status are reviewed, barcodes corrected, and activated
|
|
41
|
+
- **Item Deactivation**: A specific SKU is discontinued while other items remain active
|
|
42
|
+
- **Item Reactivation**: A previously discontinued SKU is brought back into active use (INACTIVE → ACTIVE)
|
|
43
|
+
- **Draft Item Cleanup**: Unwanted items in DRAFT status are deleted before activation
|
|
44
|
+
- **SKU Assignment**: Each item receives a globally unique SKU that is immutable once assigned
|
|
45
|
+
|
|
46
|
+
## Test Cases
|
|
47
|
+
|
|
48
|
+
- Item lifecycle follows DRAFT → ACTIVE ↔ INACTIVE state machine
|
|
49
|
+
- Items can be created in either DRAFT or ACTIVE status
|
|
50
|
+
- SKU is required, globally unique, and immutable after assignment
|
|
51
|
+
- Barcode must be unique when provided, can be updated
|
|
52
|
+
- Only DRAFT items can be deleted; ACTIVE and INACTIVE items cannot
|
|
53
|
+
- Only ACTIVE items can be referenced in new transactions (sales orders, purchase orders)
|
|
54
|
+
- Items can be activated, deactivated, and reactivated individually
|
|
55
|
+
- Item UoM can be updated in DRAFT status; once activated, UoM is locked to preserve transaction consistency
|
|
56
|
+
|
|
57
|
+
## Reference Links
|
|
58
|
+
|
|
59
|
+
- [Oracle Item Master](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/25a/fammi/define-items-and-item-structures.html)
|
|
60
|
+
- [NetSuite Item Master Data](https://www.netsuite.com/portal/resource/articles/inventory-management/item-master-data.shtml)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Item Taxonomy
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Item Taxonomy organizes items using a structured, hierarchical classification system. Taxonomy nodes form a tree where each node can have a parent, creating multi-level classification (e.g., "Electronics > Computers > Laptops"). Items are linked to taxonomy nodes through a many-to-many relationship, allowing a single item to belong to multiple classification branches simultaneously (e.g., both "Electronics > Smartphones" and "Gift Ideas > Tech Gifts").
|
|
6
|
+
|
|
7
|
+
## Business Purpose
|
|
8
|
+
|
|
9
|
+
As item catalogs grow, a single flat category structure is insufficient. Item Taxonomy addresses this by:
|
|
10
|
+
|
|
11
|
+
- Enabling multi-dimensional item classification — an item can belong to multiple taxonomy branches
|
|
12
|
+
- Supporting hierarchical browsing and filtering of large item catalogs
|
|
13
|
+
- Enabling consistent item grouping for operations and reporting
|
|
14
|
+
- Organizing items for different audiences (internal operations, eCommerce, procurement)
|
|
15
|
+
- Providing a flexible foundation for future classification needs without restructuring existing data
|
|
16
|
+
- Stable node identification via globally unique code for API references and integrations
|
|
17
|
+
|
|
18
|
+
## Process Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
A[Create Root Taxonomy Node] --> B[Create Child Node]
|
|
23
|
+
B --> C{More Levels?}
|
|
24
|
+
C -->|Yes| B
|
|
25
|
+
C -->|No| D[Assign Items to Taxonomy Nodes]
|
|
26
|
+
D --> E{Move Node?}
|
|
27
|
+
E -->|Yes| F[Validate No Circular Reference]
|
|
28
|
+
F --> G[Update Parent]
|
|
29
|
+
G --> H[Children Move With Parent]
|
|
30
|
+
E -->|No| I{Delete Node?}
|
|
31
|
+
I -->|Yes| J{Has Children or Item Assignments?}
|
|
32
|
+
J -->|Yes| K[Block Deletion]
|
|
33
|
+
J -->|No| L[Delete Node]
|
|
34
|
+
I -->|No| M[Node Active]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Scenario Patterns
|
|
38
|
+
|
|
39
|
+
- **Initial Taxonomy Setup**: Administrator creates root nodes with unique codes (e.g., "electronics", "clothing") and populates child nodes for each classification branch
|
|
40
|
+
- **Deep Hierarchy**: "Clothing > Men > Outerwear > Jackets > Winter Jackets" — five levels deep for detailed classification
|
|
41
|
+
- **Multi-Classification**: A "Bluetooth Headset" item is assigned to both "Electronics > Audio" and "Accessories > Travel" taxonomy nodes simultaneously
|
|
42
|
+
- **Node Reparenting**: "Accessories" node moved from under "Clothing" to a root-level node, all child nodes and item assignments preserved
|
|
43
|
+
- **Taxonomy Standards**: "Electronics" node groups items such as laptops, monitors, and accessories under a common branch for operational consistency
|
|
44
|
+
- **Node Rename**: Administrator renames "Accessories" to "Travel Accessories" to better reflect the node's contents — child nodes and item assignments are unaffected
|
|
45
|
+
- **Node Merge**: Two similar nodes consolidated by moving item assignments from one to the other, then deleting the empty node
|
|
46
|
+
- **Reporting by Taxonomy**: Sales report grouped by top-level taxonomy node shows revenue breakdown across item groups (cross-module dependency: reporting/analytics module consumes taxonomy hierarchy)
|
|
47
|
+
|
|
48
|
+
## Test Cases
|
|
49
|
+
|
|
50
|
+
- Node code must be globally unique across all taxonomy nodes
|
|
51
|
+
- Node code is immutable after creation; only the display name can be updated
|
|
52
|
+
- Moving a node under its own descendant should fail (circular reference prevention)
|
|
53
|
+
- Deleting a node with child nodes should be blocked
|
|
54
|
+
- Deleting a node with assigned items should be blocked
|
|
55
|
+
- Root nodes have no parent (null parent reference)
|
|
56
|
+
- An item can be assigned to multiple taxonomy nodes
|
|
57
|
+
- Removing an item-taxonomy assignment does not affect the item or other assignments
|
|
58
|
+
- Duplicate item-taxonomy assignments (same item + same node) should be rejected
|
|
59
|
+
- Node tree depth should have a configurable maximum to prevent excessively deep hierarchies
|
|
60
|
+
|
|
61
|
+
## Reference Links
|
|
62
|
+
|
|
63
|
+
- [Akeneo Product Classification](https://docs.akeneo.com/serenity-2025-02/articles/manage-your-categories.html)
|
|
64
|
+
- [Salsify Taxonomy Management](https://www.salsify.com/resources/content/product-taxonomy-management)
|
|
65
|
+
- [Odoo Product Categories](https://www.odoo.com/documentation/19.0/applications/inventory_and_mrp/inventory/product_management.html)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# ItemTaxonomyAssignment
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
ItemTaxonomyAssignment is a join entity that links an Item to a TaxonomyNode, enabling many-to-many classification. A single item can belong to multiple taxonomy branches simultaneously (e.g., both "Electronics > Smartphones" and "Gift Ideas > Tech Gifts"), and a single taxonomy node can have multiple items assigned.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Standard
|
|
12
|
+
|
|
13
|
+
### Command Definitions
|
|
14
|
+
|
|
15
|
+
- [assignItemToTaxonomy](../commands/AssignItemToTaxonomy.md) - Link an item to a taxonomy node
|
|
16
|
+
- [removeItemFromTaxonomy](../commands/RemoveItemFromTaxonomy.md) - Remove a link between an item and a taxonomy node
|
|
17
|
+
|
|
18
|
+
### Query Definitions
|
|
19
|
+
|
|
20
|
+
- [GetItemTaxonomyAssignment](../queries/GetItemTaxonomyAssignment.md) - Retrieve an assignment by itemId and taxonomyNodeId
|
|
21
|
+
- [GetTaxonomyNodeAssignments](../queries/GetTaxonomyNodeAssignments.md) - Retrieve item assignments for a given taxonomy node
|
|
22
|
+
|
|
23
|
+
### Models
|
|
24
|
+
|
|
25
|
+
- ItemTaxonomyAssignment
|
|
26
|
+
|
|
27
|
+
### Invariants
|
|
28
|
+
|
|
29
|
+
- The combination of item and taxonomy node must be unique (no duplicate assignments)
|
|
30
|
+
- The referenced item must exist
|
|
31
|
+
- The referenced taxonomy node must exist
|
|
32
|
+
|
|
33
|
+
### Relationships
|
|
34
|
+
|
|
35
|
+
- **References Item**: Each assignment references exactly one Item
|
|
36
|
+
- **References TaxonomyNode**: Each assignment references exactly one TaxonomyNode
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# TaxonomyNode
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
TaxonomyNode represents a single node in a hierarchical classification tree used to organize items. Each node has a globally unique code, a display name, and an optional parent reference that defines its position in the tree. Root nodes have no parent. Nodes can be reparented to restructure the tree, and children move with their parent.
|
|
6
|
+
|
|
7
|
+
Examples: "electronics", "electronics > computers", "electronics > computers > laptops".
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Standard
|
|
14
|
+
|
|
15
|
+
### Command Definitions
|
|
16
|
+
|
|
17
|
+
- [createTaxonomyNode](../commands/CreateTaxonomyNode.md) - Create a new root or child taxonomy node
|
|
18
|
+
- [updateTaxonomyNode](../commands/UpdateTaxonomyNode.md) - Update the display name of an existing node
|
|
19
|
+
- [moveTaxonomyNode](../commands/MoveTaxonomyNode.md) - Reparent a node within the tree
|
|
20
|
+
- [deleteTaxonomyNode](../commands/DeleteTaxonomyNode.md) - Delete a leaf node with no item assignments
|
|
21
|
+
|
|
22
|
+
### Query Definitions
|
|
23
|
+
|
|
24
|
+
- [GetTaxonomyNode](../queries/GetTaxonomyNode.md) - Retrieve a taxonomy node by id or code
|
|
25
|
+
- [GetTaxonomyNodeChildren](../queries/GetTaxonomyNodeChildren.md) - Retrieve direct child nodes of a given node
|
|
26
|
+
- [CalculateNodeDepth](../queries/CalculateNodeDepth.md) - Calculate the depth of a node from root by walking the ancestor chain
|
|
27
|
+
- [CalculateSubtreeDepth](../queries/CalculateSubtreeDepth.md) - Recursively calculate the maximum depth of a node's subtree
|
|
28
|
+
- [DetectCircularReference](../queries/DetectCircularReference.md) - Validate that reparenting would not create a cycle
|
|
29
|
+
|
|
30
|
+
### Models
|
|
31
|
+
|
|
32
|
+
- TaxonomyNode
|
|
33
|
+
|
|
34
|
+
### Invariants
|
|
35
|
+
|
|
36
|
+
- Node code must be globally unique across all taxonomy nodes
|
|
37
|
+
- Node code is immutable after creation — it cannot be changed once assigned
|
|
38
|
+
- Root nodes have a null parent reference
|
|
39
|
+
- A node cannot be moved under its own descendant (circular reference prevention)
|
|
40
|
+
- Node tree depth has a configurable maximum (default 10) to prevent excessively deep hierarchies
|
|
41
|
+
- A node with child nodes cannot be deleted
|
|
42
|
+
- A node with assigned items cannot be deleted
|
|
43
|
+
|
|
44
|
+
### Relationships
|
|
45
|
+
|
|
46
|
+
- **Self-Referential Parent-Child**: Each node optionally references another TaxonomyNode as its parent, forming a tree
|
|
47
|
+
- **Referenced By Item Assignments**: TaxonomyNodes are linked to Items via ItemTaxonomyAssignment (many-to-many)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# item
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Item is the fundamental SKU-level entity in the ERP system — the sellable, purchasable, and trackable unit referenced by all downstream modules (Sales, Purchasing, Inventory, Manufacturing). Each item has a lifecycle state machine (DRAFT → ACTIVE ↔ INACTIVE), a globally unique SKU identifier, an optional barcode, and an assigned unit of measure.
|
|
6
|
+
|
|
7
|
+
Items can be created in either DRAFT or ACTIVE status. DRAFT items require explicit activation before participating in transactions.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Stateful
|
|
14
|
+
|
|
15
|
+
#### State Transitions
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
stateDiagram-v2
|
|
19
|
+
[*] --> Draft: createItem (draft)
|
|
20
|
+
[*] --> Active: createItem (active)
|
|
21
|
+
Draft --> Active: activateItem
|
|
22
|
+
Active --> Inactive: deactivateItem
|
|
23
|
+
Inactive --> Active: reactivateItem
|
|
24
|
+
Draft --> [*]: deleteItem
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Command Definitions
|
|
28
|
+
|
|
29
|
+
- [createItem](../commands/CreateItem.md) - Create a new item in DRAFT or ACTIVE status
|
|
30
|
+
- [updateItem](../commands/UpdateItem.md) - Update mutable fields (name, barcode, UoM) of an existing item
|
|
31
|
+
- [activateItem](../commands/ActivateItem.md) - Transition item from DRAFT to ACTIVE
|
|
32
|
+
- [deactivateItem](../commands/DeactivateItem.md) - Transition item from ACTIVE to INACTIVE
|
|
33
|
+
- [reactivateItem](../commands/ReactivateItem.md) - Transition item from INACTIVE to ACTIVE
|
|
34
|
+
- [deleteItem](../commands/DeleteItem.md) - Permanently delete a DRAFT item
|
|
35
|
+
|
|
36
|
+
### Query Definitions
|
|
37
|
+
|
|
38
|
+
- [GetItem](../queries/GetItem.md) - Retrieve an item by id, sku, or barcode
|
|
39
|
+
|
|
40
|
+
### Models
|
|
41
|
+
|
|
42
|
+
- Item
|
|
43
|
+
|
|
44
|
+
### Invariants
|
|
45
|
+
|
|
46
|
+
- SKU is required and must be globally unique across all items regardless of status
|
|
47
|
+
- SKU is immutable after assignment (cannot be changed once set)
|
|
48
|
+
- Barcode must be unique across all items when provided
|
|
49
|
+
- Barcode can be updated after creation
|
|
50
|
+
- Only DRAFT items can be deleted; ACTIVE and INACTIVE items are preserved for audit trails
|
|
51
|
+
- Only ACTIVE items can be referenced in new transactions (sales orders, purchase orders)
|
|
52
|
+
- Name is required at creation time
|
|
53
|
+
- UoM can be updated only in DRAFT status — once activated, UoM is locked to preserve transaction consistency
|
|
54
|
+
|
|
55
|
+
### Relationships
|
|
56
|
+
|
|
57
|
+
- **References Unit**: Each item references a Unit from the primitives module as its unit of measure
|
|
58
|
+
- **Referenced By Taxonomy Assignments**: Items are linked to TaxonomyNodes via ItemTaxonomyAssignment (many-to-many)
|
|
59
|
+
- **Referenced By Downstream Modules**: Items are referenced by Sales, Purchasing, Inventory, and Manufacturing modules
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# CalculateNodeDepth
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
CalculateNodeDepth determines the depth of a taxonomy node in the tree hierarchy by walking up the ancestor chain from a given node to the root. Depth is defined as the number of nodes in the path from root to the target node (root = depth 1). This is essential for enforcing maximum depth constraints when creating or moving taxonomy nodes.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Depth is calculated by traversing parentId references from the target node up to the root
|
|
10
|
+
- Root nodes (parentId = null) have depth 1
|
|
11
|
+
- Each additional ancestor increments the depth by 1
|
|
12
|
+
- The traversal stops when a node with parentId = null is reached or a parent is not found
|
|
13
|
+
- Used together with maxDepth parameter (default: 10) to enforce tree depth limits
|
|
14
|
+
|
|
15
|
+
## Process Flow
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
A[Receive nodeId] --> B[Initialize depth = 1, currentId = nodeId]
|
|
20
|
+
B --> C[SELECT node where id = currentId]
|
|
21
|
+
C --> D{Node found?}
|
|
22
|
+
D -->|No| E[Return current depth]
|
|
23
|
+
D -->|Yes| F{parentId is null?}
|
|
24
|
+
F -->|Yes| E
|
|
25
|
+
F -->|No| G[Increment depth]
|
|
26
|
+
G --> H[Set currentId = parentId]
|
|
27
|
+
H --> C
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## External Dependencies
|
|
31
|
+
|
|
32
|
+
- None
|
|
33
|
+
|
|
34
|
+
## Error Scenarios
|
|
35
|
+
|
|
36
|
+
- **NODE_NOT_FOUND**: The starting node or an ancestor in the chain is not found — traversal stops and returns partial depth
|