cabloy 5.1.112 → 5.1.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/.cabloy-version +1 -1
  2. package/.claude/skills/cabloy-backend-scaffold/SKILL.md +2 -0
  3. package/.claude/skills/cabloy-backend-scaffold/references/follow-up-checklist.md +9 -0
  4. package/.github/workflows/playwright-e2e.yml +34 -2
  5. package/.github/workflows/vona-test-pg.yml +8 -0
  6. package/CHANGELOG.md +13 -0
  7. package/CLAUDE.md +2 -0
  8. package/cabloy-docs/backend/migration-and-changes.md +13 -9
  9. package/cabloy-docs/backend/unit-testing.md +25 -0
  10. package/e2e/scripts/startE2eVona.ts +51 -13
  11. package/e2e/specs/a-commerce/commerce.spec.ts +1 -0
  12. package/e2e/specs/cabloy-basic/basic.spec.ts +12 -7
  13. package/package.json +1 -1
  14. package/vona/packages-cli/cli/package.json +1 -1
  15. package/vona/packages-cli/cli-set-api/package.json +1 -1
  16. package/vona/packages-cli/cli-set-api/src/lib/bean/cli.bin.test.ts +6 -9
  17. package/vona/packages-cli/cli-set-api/toolsIsolate/test.ts +50 -21
  18. package/vona/packages-vona/vona/package.json +1 -1
  19. package/vona/pnpm-lock.yaml +67 -67
  20. package/vona/src/backend/config/config/config.test.ts +1 -1
  21. package/vona/src/suite/a-commerce/modules/commerce-catalog/test/catalog.test.ts +234 -0
  22. package/vona/src/suite/a-commerce/modules/commerce-seed/src/bean/meta.version.ts +3 -3
  23. package/vona/src/suite/a-commerce/modules/commerce-trade/src/bean/meta.version.ts +4 -0
  24. package/vona/src/suite/a-commerce/modules/commerce-trade/src/config/locale/en-us.ts +4 -0
  25. package/vona/src/suite/a-commerce/modules/commerce-trade/src/config/locale/zh-cn.ts +4 -0
  26. package/vona/src/suite/a-commerce/modules/commerce-trade/src/entity/stockAudit.tsx +39 -7
  27. package/vona/src/suite/a-commerce/modules/commerce-trade/src/service/stockBalance.ts +38 -1
  28. package/vona/src/suite/a-commerce/modules/commerce-trade/test/stockBalance.test.ts +268 -65
  29. package/vona/src/suite/a-commerce/modules/commerce-trade/test/stockReservation.test.ts +276 -81
  30. package/vona/src/suite-vendor/a-vona/modules/a-startup/package.json +1 -1
  31. package/vona/src/suite-vendor/a-vona/modules/a-startup/src/service/startup.ts +2 -2
  32. package/vona/src/suite-vendor/a-vona/modules/a-version/package.json +1 -1
  33. package/vona/src/suite-vendor/a-vona/modules/a-version/src/service/version.ts +12 -12
  34. package/vona/src/suite-vendor/a-vona/modules/a-version/src/types/version.ts +4 -4
  35. package/vona/src/suite-vendor/a-vona/package.json +1 -1
  36. package/zova/pnpm-lock.yaml +14 -14
  37. package/zova/src/suite/a-commerce/modules/commerce-catalog/src/page/product/controller.tsx +0 -1
  38. package/zova/src/suite/a-commerce/modules/commerce-trade/src/model/cart.ts +1 -0
  39. package/zova/src/suite/a-home/modules/home-layoutadmin/src/component/layoutAdmin/controller.tsx +17 -7
  40. package/zova/src/suite/a-home/modules/home-layoutadmin/src/component/layoutAdmin/render.header.tsx +1 -1
  41. package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/controller.tsx +17 -7
@@ -531,8 +531,8 @@ importers:
531
531
  specifier: npm:@cabloy/zod@4.3.8
532
532
  version: '@cabloy/zod@4.3.8'
533
533
  zova:
534
- specifier: ^5.1.138
535
- version: 5.1.138(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3))
534
+ specifier: ^5.1.139
535
+ version: 5.1.139(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3))
536
536
  zova-jsx:
537
537
  specifier: ^1.1.78
538
538
  version: 1.1.78(typescript@5.9.3)
@@ -540,8 +540,8 @@ importers:
540
540
  specifier: ^5.1.21
541
541
  version: 5.1.21
542
542
  zova-module-a-bean:
543
- specifier: ^5.1.31
544
- version: 5.1.31
543
+ specifier: ^5.1.32
544
+ version: 5.1.32
545
545
  zova-module-a-behavior:
546
546
  specifier: ^5.1.25
547
547
  version: 5.1.25
@@ -561,11 +561,11 @@ importers:
561
561
  specifier: ^5.1.33
562
562
  version: 5.1.33(vue@3.5.39(typescript@5.9.3))
563
563
  zova-module-a-openapi:
564
- specifier: ^5.1.45
565
- version: 5.1.45
564
+ specifier: ^5.1.46
565
+ version: 5.1.46
566
566
  zova-module-a-router:
567
- specifier: ^5.1.30
568
- version: 5.1.30
567
+ specifier: ^5.1.31
568
+ version: 5.1.31
569
569
  zova-module-a-routertabs:
570
570
  specifier: ^5.1.33
571
571
  version: 5.1.33
@@ -579,8 +579,8 @@ importers:
579
579
  specifier: ^5.1.37
580
580
  version: 5.1.37(vue@3.5.39(typescript@5.9.3))
581
581
  zova-module-rest-resource:
582
- specifier: ^5.1.41
583
- version: 5.1.41
582
+ specifier: ^5.1.42
583
+ version: 5.1.42
584
584
 
585
585
  .zova-rest/cabloy-basic-web:
586
586
  dependencies:
@@ -603,8 +603,8 @@ importers:
603
603
  specifier: npm:@cabloy/zod@4.3.8
604
604
  version: '@cabloy/zod@4.3.8'
605
605
  zova:
606
- specifier: ^5.1.138
607
- version: 5.1.138(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3))
606
+ specifier: ^5.1.139
607
+ version: 5.1.139(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3))
608
608
  zova-jsx:
609
609
  specifier: ^1.1.78
610
610
  version: 1.1.78(typescript@5.9.3)
@@ -612,8 +612,8 @@ importers:
612
612
  specifier: ^5.1.21
613
613
  version: 5.1.21
614
614
  zova-module-a-bean:
615
- specifier: ^5.1.31
616
- version: 5.1.31
615
+ specifier: ^5.1.32
616
+ version: 5.1.32
617
617
  zova-module-a-behavior:
618
618
  specifier: ^5.1.25
619
619
  version: 5.1.25
@@ -633,11 +633,11 @@ importers:
633
633
  specifier: ^5.1.33
634
634
  version: 5.1.33(vue@3.5.39(typescript@5.9.3))
635
635
  zova-module-a-openapi:
636
- specifier: ^5.1.45
637
- version: 5.1.45
636
+ specifier: ^5.1.46
637
+ version: 5.1.46
638
638
  zova-module-a-router:
639
- specifier: ^5.1.30
640
- version: 5.1.30
639
+ specifier: ^5.1.31
640
+ version: 5.1.31
641
641
  zova-module-a-routertabs:
642
642
  specifier: ^5.1.33
643
643
  version: 5.1.33
@@ -651,8 +651,8 @@ importers:
651
651
  specifier: ^5.1.37
652
652
  version: 5.1.37(vue@3.5.39(typescript@5.9.3))
653
653
  zova-module-rest-resource:
654
- specifier: ^5.1.41
655
- version: 5.1.41
654
+ specifier: ^5.1.42
655
+ version: 5.1.42
656
656
 
657
657
  .zova-rest/cabloy-commerce:
658
658
  dependencies:
@@ -675,8 +675,8 @@ importers:
675
675
  specifier: npm:@cabloy/zod@4.3.8
676
676
  version: '@cabloy/zod@4.3.8'
677
677
  zova:
678
- specifier: ^5.1.138
679
- version: 5.1.138(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3))
678
+ specifier: ^5.1.139
679
+ version: 5.1.139(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3))
680
680
  zova-jsx:
681
681
  specifier: ^1.1.78
682
682
  version: 1.1.78(typescript@5.9.3)
@@ -684,8 +684,8 @@ importers:
684
684
  specifier: ^5.1.21
685
685
  version: 5.1.21
686
686
  zova-module-a-bean:
687
- specifier: ^5.1.31
688
- version: 5.1.31
687
+ specifier: ^5.1.32
688
+ version: 5.1.32
689
689
  zova-module-a-behavior:
690
690
  specifier: ^5.1.25
691
691
  version: 5.1.25
@@ -705,11 +705,11 @@ importers:
705
705
  specifier: ^5.1.33
706
706
  version: 5.1.33(vue@3.5.39(typescript@5.9.3))
707
707
  zova-module-a-openapi:
708
- specifier: ^5.1.45
709
- version: 5.1.45
708
+ specifier: ^5.1.46
709
+ version: 5.1.46
710
710
  zova-module-a-router:
711
- specifier: ^5.1.30
712
- version: 5.1.30
711
+ specifier: ^5.1.31
712
+ version: 5.1.31
713
713
  zova-module-a-routertabs:
714
714
  specifier: ^5.1.33
715
715
  version: 5.1.33
@@ -723,8 +723,8 @@ importers:
723
723
  specifier: ^5.1.37
724
724
  version: 5.1.37(vue@3.5.39(typescript@5.9.3))
725
725
  zova-module-rest-resource:
726
- specifier: ^5.1.41
727
- version: 5.1.41
726
+ specifier: ^5.1.42
727
+ version: 5.1.42
728
728
 
729
729
  .zova-rest/cabloy-commerce-admin:
730
730
  dependencies:
@@ -747,8 +747,8 @@ importers:
747
747
  specifier: npm:@cabloy/zod@4.3.8
748
748
  version: '@cabloy/zod@4.3.8'
749
749
  zova:
750
- specifier: ^5.1.138
751
- version: 5.1.138(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3))
750
+ specifier: ^5.1.139
751
+ version: 5.1.139(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3))
752
752
  zova-jsx:
753
753
  specifier: ^1.1.78
754
754
  version: 1.1.78(typescript@5.9.3)
@@ -756,8 +756,8 @@ importers:
756
756
  specifier: ^5.1.21
757
757
  version: 5.1.21
758
758
  zova-module-a-bean:
759
- specifier: ^5.1.31
760
- version: 5.1.31
759
+ specifier: ^5.1.32
760
+ version: 5.1.32
761
761
  zova-module-a-behavior:
762
762
  specifier: ^5.1.25
763
763
  version: 5.1.25
@@ -777,11 +777,11 @@ importers:
777
777
  specifier: ^5.1.33
778
778
  version: 5.1.33(vue@3.5.39(typescript@5.9.3))
779
779
  zova-module-a-openapi:
780
- specifier: ^5.1.45
781
- version: 5.1.45
780
+ specifier: ^5.1.46
781
+ version: 5.1.46
782
782
  zova-module-a-router:
783
- specifier: ^5.1.30
784
- version: 5.1.30
783
+ specifier: ^5.1.31
784
+ version: 5.1.31
785
785
  zova-module-a-routertabs:
786
786
  specifier: ^5.1.33
787
787
  version: 5.1.33
@@ -795,8 +795,8 @@ importers:
795
795
  specifier: ^5.1.37
796
796
  version: 5.1.37(vue@3.5.39(typescript@5.9.3))
797
797
  zova-module-rest-resource:
798
- specifier: ^5.1.41
799
- version: 5.1.41
798
+ specifier: ^5.1.42
799
+ version: 5.1.42
800
800
 
801
801
  packages-cli/cabloy-cli:
802
802
  dependencies:
@@ -1691,7 +1691,7 @@ importers:
1691
1691
  src/suite-vendor/a-file:
1692
1692
  dependencies:
1693
1693
  vona-module-a-file:
1694
- specifier: ^5.0.5
1694
+ specifier: ^5.0.6
1695
1695
  version: link:modules/a-file
1696
1696
  vona-module-file-cloudflare:
1697
1697
  specifier: ^5.0.4
@@ -8233,8 +8233,8 @@ packages:
8233
8233
  zova-module-a-app@5.1.25:
8234
8234
  resolution: {integrity: sha512-lLSVjDtYfO1KWDL+l3eMLMFl/aUS2GDgCSEuim5frkTqIJ6OAmW3O6k2XUkzBe31SzzN/tpEYL+pP+HkfULf6g==}
8235
8235
 
8236
- zova-module-a-bean@5.1.31:
8237
- resolution: {integrity: sha512-CkvXhY0Pf9fmBuZbSRZL+PVc/Q1zYVED7EWSmlQzqKIDAGNi2ikdmsBiB1weT1OIS4OEVFBR0I86Dx8z4xrrNg==}
8236
+ zova-module-a-bean@5.1.32:
8237
+ resolution: {integrity: sha512-z2+SvEy+PD2Q8TU3GH1Tb9wXeM9iXlkrW9HXb4Fiw8F00BLffOsXMt02GjLbWdu6LIBDRD98wQeYnNhhg0NCUg==}
8238
8238
 
8239
8239
  zova-module-a-behavior@5.1.25:
8240
8240
  resolution: {integrity: sha512-73DV9BT91wrKh7LPAklr7eU/+GtHSWEEZqxx9jXUL9DoI/M0KAod61Sl+eECqflrcipdQy4w8k3H9HKrSUaTbg==}
@@ -8248,8 +8248,8 @@ packages:
8248
8248
  zova-module-a-command@5.1.33:
8249
8249
  resolution: {integrity: sha512-NLfhe27CMjtHAxtpo0F1fwe/a0SlXyKdqJcGAJ3/gf5mATGwA7HMDCiGCfj/ghczUadb2kCSkAqxHZZDCD7iVA==}
8250
8250
 
8251
- zova-module-a-fetch@5.1.23:
8252
- resolution: {integrity: sha512-druyz1WsNTnSuuXVuScRfkA7yv9oNWAEJuf+3PuuHH5Cv4Q2XYqf5i4DWKevc+Ewct6ls5QXPj4Z1X6D2HYrSQ==}
8251
+ zova-module-a-fetch@5.1.24:
8252
+ resolution: {integrity: sha512-V3phmL02BrC3xcEny+3q7pOnLX+ukKh6YhVpf/XUABsW3I/Va7Zq0AHPMbJw08rCKCrzFfSgL/gZ5GiQT+bXog==}
8253
8253
 
8254
8254
  zova-module-a-form@5.1.45:
8255
8255
  resolution: {integrity: sha512-1WqkRMjQNS161/15vifkE82bGpmZCa20QWSDHKhJS9NbaunM4idSUXyYlv0yA+99Knk+ciwm/sPO0V3QxtYB9A==}
@@ -8269,11 +8269,11 @@ packages:
8269
8269
  zova-module-a-model@5.1.33:
8270
8270
  resolution: {integrity: sha512-NwxCguvESPLUSA2zo5vVH3Qx29o5znmUL2qU9khwjXUmDPbOTeYTkgPCI33fTsy8VnkguoWBLMgUdOsaJF+7OA==}
8271
8271
 
8272
- zova-module-a-openapi@5.1.45:
8273
- resolution: {integrity: sha512-0vEtQvMacEtPJI9rJ9QXNmxnlpCqpqaUtgAB7+hbb8HYI+KbY9LlBGxuArmYEuKFGpv60YD9NEdwAodcrOiMkA==}
8272
+ zova-module-a-openapi@5.1.46:
8273
+ resolution: {integrity: sha512-eBC28HIEQv5AMZHvoCCfaP7PtQvTC/623sBp2PbcT1CVw23OFWCBw7QOJzlzQ2DbevyBZZ546D0xG/TURKXd1w==}
8274
8274
 
8275
- zova-module-a-router@5.1.30:
8276
- resolution: {integrity: sha512-pfKeZdZUMTfkjEVZfLHj21UKjKBhTd79rfF4Mr+OLwV4avK8sDPAudseaAInVvh+T/0Ayq5w9fLhzFYeU1If8A==}
8275
+ zova-module-a-router@5.1.31:
8276
+ resolution: {integrity: sha512-bTtj3JmJKGZwUYwWpsuhigXYseYab/gOmT18WyNw0KetZGY03Y+JnU74oidrK1KtIY384+my1ZQefBlbIZjNeg==}
8277
8277
 
8278
8278
  zova-module-a-routerstack@5.1.26:
8279
8279
  resolution: {integrity: sha512-uu4tFw2DUruanPR7cojM5p6rvyCIh+tnwPmq7s0jZdg+5XBr+YMy1RGjnE8vPFSLHW8C71hlNbps6VpKvKMiiQ==}
@@ -8302,14 +8302,14 @@ packages:
8302
8302
  zova-module-a-zova@5.1.93:
8303
8303
  resolution: {integrity: sha512-pZ7JGNvDoSLdgbQZLj/LtppDWinpd6W+u0WYQvXLuJH3Hnf0Satcpz5fQS+zseJLxm5jhXjmG3ngoYoOfv72RQ==}
8304
8304
 
8305
- zova-module-rest-resource@5.1.41:
8306
- resolution: {integrity: sha512-7Y8rLmHdw0pynlWqsyHPWuCWFLwr/0HsNvfef64cPw91LRujf/7OlulVWqH8ZoFNioZZUpfumB+t/+mICoYfFg==}
8305
+ zova-module-rest-resource@5.1.42:
8306
+ resolution: {integrity: sha512-eMWhc4428U5Hs4BHqFJoF7yaH+bK8t71scIrCnpLbQS7M80lNkoHxY9s/Kl4i8Uo3+lVWbSbuaXWtR+zVLNqpA==}
8307
8307
 
8308
- zova-suite-a-zova@5.1.137:
8309
- resolution: {integrity: sha512-wRq5ZE6+/l2/wU00+TIcfzUtX8AVEfAhp5Gbqc97m+HtQaXREnBuFM1BhyaD1Nn/gxjlVNUixvh1EkkDYfEBng==}
8308
+ zova-suite-a-zova@5.1.138:
8309
+ resolution: {integrity: sha512-KiX37VxKcZxEi+inDva3iTpeA90vNlEGxBvLqDMPgBYIpkiX8iAoGZmEHhV5iKtbvFoq3gcbGAki+iO6R8mtCw==}
8310
8310
 
8311
- zova@5.1.138:
8312
- resolution: {integrity: sha512-qN6XeRF4fqrmRF6ymOJkQ/wrxYdSr9aHGOME7YwYVX+muaAO0ERUxuVjAwT2BKuU5RIlTi6p9cRVqvqf7FFPmw==}
8311
+ zova@5.1.139:
8312
+ resolution: {integrity: sha512-6gA4pfdrSv6ZLp/aeE2nZx8Tu6KwKpuHrIbmZ3zrdHazYRkz51l4y//fBLk45lIfiR7uCIlKb9ziFdvOQQ3F7A==}
8313
8313
 
8314
8314
  zwitch@1.0.5:
8315
8315
  resolution: {integrity: sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==}
@@ -14172,7 +14172,7 @@ snapshots:
14172
14172
 
14173
14173
  zova-module-a-app@5.1.25: {}
14174
14174
 
14175
- zova-module-a-bean@5.1.31:
14175
+ zova-module-a-bean@5.1.32:
14176
14176
  dependencies:
14177
14177
  globby: 14.1.0
14178
14178
 
@@ -14184,7 +14184,7 @@ snapshots:
14184
14184
 
14185
14185
  zova-module-a-command@5.1.33: {}
14186
14186
 
14187
- zova-module-a-fetch@5.1.23:
14187
+ zova-module-a-fetch@5.1.24:
14188
14188
  dependencies:
14189
14189
  axios: 1.18.1
14190
14190
  transitivePeerDependencies:
@@ -14221,13 +14221,13 @@ snapshots:
14221
14221
  - '@vue/composition-api'
14222
14222
  - vue
14223
14223
 
14224
- zova-module-a-openapi@5.1.45:
14224
+ zova-module-a-openapi@5.1.46:
14225
14225
  dependencies:
14226
14226
  '@cabloy/json-schema-to-zod': 2.6.5
14227
14227
  openapi3-ts: 4.6.0
14228
14228
  typestyle: 2.4.0
14229
14229
 
14230
- zova-module-a-router@5.1.30: {}
14230
+ zova-module-a-router@5.1.31: {}
14231
14231
 
14232
14232
  zova-module-a-routerstack@5.1.26: {}
14233
14233
 
@@ -14282,26 +14282,26 @@ snapshots:
14282
14282
  - typescript
14283
14283
  - vue
14284
14284
 
14285
- zova-module-rest-resource@5.1.41: {}
14285
+ zova-module-rest-resource@5.1.42: {}
14286
14286
 
14287
- zova-suite-a-zova@5.1.137(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3)):
14287
+ zova-suite-a-zova@5.1.138(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3)):
14288
14288
  dependencies:
14289
14289
  zova-module-a-api: 5.1.21
14290
14290
  zova-module-a-app: 5.1.25
14291
- zova-module-a-bean: 5.1.31
14291
+ zova-module-a-bean: 5.1.32
14292
14292
  zova-module-a-behavior: 5.1.25
14293
14293
  zova-module-a-behaviors: 5.1.21
14294
14294
  zova-module-a-boundary: 5.1.21
14295
14295
  zova-module-a-command: 5.1.33
14296
- zova-module-a-fetch: 5.1.23
14296
+ zova-module-a-fetch: 5.1.24
14297
14297
  zova-module-a-form: 5.1.45(vue@3.5.39(typescript@5.9.3))
14298
14298
  zova-module-a-icon: 5.1.26
14299
14299
  zova-module-a-interceptor: 5.1.29
14300
14300
  zova-module-a-logger: 5.1.26
14301
14301
  zova-module-a-meta: 5.1.21
14302
14302
  zova-module-a-model: 5.1.33(vue@3.5.39(typescript@5.9.3))
14303
- zova-module-a-openapi: 5.1.45
14304
- zova-module-a-router: 5.1.30
14303
+ zova-module-a-openapi: 5.1.46
14304
+ zova-module-a-router: 5.1.31
14305
14305
  zova-module-a-routerstack: 5.1.26
14306
14306
  zova-module-a-routertabs: 5.1.33
14307
14307
  zova-module-a-ssr: 5.1.31
@@ -14318,10 +14318,10 @@ snapshots:
14318
14318
  - typescript
14319
14319
  - vue
14320
14320
 
14321
- zova@5.1.138(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3)):
14321
+ zova@5.1.139(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3)):
14322
14322
  dependencies:
14323
14323
  zova-core: 5.1.78(patch_hash=ff659aa5f659be32501f56841b72f148c24acf1546f79cce551586e27fcde2ce)(typescript@5.9.3)
14324
- zova-suite-a-zova: 5.1.137(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3))
14324
+ zova-suite-a-zova: 5.1.138(typescript@5.9.3)(vue@3.5.39(typescript@5.9.3))
14325
14325
  transitivePeerDependencies:
14326
14326
  - '@vue/composition-api'
14327
14327
  - debug
@@ -32,7 +32,7 @@ export default async function (_app: VonaApplication) {
32
32
  config.database = {
33
33
  testDatabase: true,
34
34
  base: {
35
- pool: { min: 0, max: 1 },
35
+ pool: { min: 0, max: 3 },
36
36
  },
37
37
  clients: {},
38
38
  };
@@ -1,3 +1,4 @@
1
+ import { catchError } from '@cabloy/utils';
1
2
  import assert from 'node:assert';
2
3
  import { describe, it } from 'node:test';
3
4
  import { app } from 'vona-mock';
@@ -355,4 +356,237 @@ describe('catalog.test.ts', () => {
355
356
  { instanceName: 'shareTest' as any },
356
357
  );
357
358
  });
359
+
360
+ it('treats foreign operator catalogue resources as absent', async () => {
361
+ const prefix = `__catalog-foreign-${Date.now()}__`;
362
+ let defaultCatalog!: Awaited<ReturnType<typeof createCatalog>>;
363
+ await app.bean.executor.mockCtx(async () => {
364
+ defaultCatalog = await createCatalog(prefix, 'active');
365
+ });
366
+
367
+ await app.bean.executor.mockCtx(
368
+ async () => {
369
+ await app.bean.passport.signinMock();
370
+ try {
371
+ const resources = [
372
+ ['category', defaultCatalog.categoryId, { name: 'foreign category', published: false }],
373
+ [
374
+ 'product',
375
+ defaultCatalog.productId,
376
+ {
377
+ categoryId: defaultCatalog.categoryId,
378
+ title: 'foreign product',
379
+ published: false,
380
+ },
381
+ ],
382
+ [
383
+ 'sku',
384
+ defaultCatalog.skuId,
385
+ {
386
+ productId: defaultCatalog.productId,
387
+ code: 'foreign-sku',
388
+ priceCents: 100,
389
+ lifecycle: 'inactive',
390
+ },
391
+ ],
392
+ ] as const;
393
+ for (const [resource, id, body] of resources) {
394
+ assert.equal(
395
+ await app.bean.executor.performAction('get', `/commerce/catalog/${resource}/:id`, {
396
+ params: { id },
397
+ }),
398
+ undefined,
399
+ );
400
+ const selected = await app.bean.executor.performAction(
401
+ 'get',
402
+ `/commerce/catalog/${resource}`,
403
+ );
404
+ assert.equal(
405
+ selected.list.some((item: { id: unknown }) => String(item.id) === String(id)),
406
+ false,
407
+ );
408
+ const update = () =>
409
+ app.bean.executor.performAction('patch', `/commerce/catalog/${resource}/:id`, {
410
+ params: { id },
411
+ body,
412
+ });
413
+ if (resource === 'category') {
414
+ assert.equal(await update(), null);
415
+ } else {
416
+ await assert.rejects(update);
417
+ }
418
+ assert.equal(
419
+ await app.bean.executor.performAction('delete', `/commerce/catalog/${resource}/:id`, {
420
+ params: { id },
421
+ }),
422
+ null,
423
+ );
424
+ }
425
+ } finally {
426
+ await app.bean.passport.signout();
427
+ }
428
+ },
429
+ { instanceName: 'shareTest' as any },
430
+ );
431
+
432
+ await app.bean.executor.mockCtx(async () => {
433
+ const category = await app
434
+ .scope('commerce-catalog')
435
+ .model.category.getById(defaultCatalog.categoryId);
436
+ const product = await app
437
+ .scope('commerce-catalog')
438
+ .model.product.getById(defaultCatalog.productId);
439
+ const sku = await app.scope('commerce-catalog').model.sku.getById(defaultCatalog.skuId);
440
+ assert.equal(category?.name, `${prefix} category`);
441
+ assert.equal(product?.title, `${prefix} product`);
442
+ assert.equal(sku?.code, `${prefix}-sku`);
443
+ });
444
+ });
445
+
446
+ it('rejects foreign catalogue relation identifiers without local writes', async () => {
447
+ const suffix = `${Date.now()}`;
448
+ let foreignCatalog!: Awaited<ReturnType<typeof createCatalog>>;
449
+ await app.bean.executor.mockCtx(
450
+ async () => {
451
+ foreignCatalog = await createCatalog(`__catalog-relation-foreign-${suffix}__`, 'active');
452
+ },
453
+ { instanceName: 'shareTest' as any },
454
+ );
455
+
456
+ await app.bean.executor.mockCtx(async () => {
457
+ await app.bean.passport.signinMock();
458
+ try {
459
+ const parentCategoryId = await app.bean.executor.performAction(
460
+ 'post',
461
+ '/commerce/catalog/category',
462
+ { body: { name: `relation-parent-${suffix}`, published: true } },
463
+ );
464
+ const categoryId = await app.bean.executor.performAction(
465
+ 'post',
466
+ '/commerce/catalog/category',
467
+ {
468
+ body: {
469
+ name: `relation-category-${suffix}`,
470
+ parentId: parentCategoryId,
471
+ published: true,
472
+ },
473
+ },
474
+ );
475
+ const productId = await app.bean.executor.performAction(
476
+ 'post',
477
+ '/commerce/catalog/product',
478
+ {
479
+ body: {
480
+ categoryId,
481
+ title: `relation-product-${suffix}`,
482
+ published: true,
483
+ },
484
+ },
485
+ );
486
+ const skuId = await app.bean.executor.performAction('post', '/commerce/catalog/sku', {
487
+ body: {
488
+ productId,
489
+ code: `relation-sku-${suffix}`,
490
+ priceCents: 100,
491
+ lifecycle: 'draft',
492
+ },
493
+ });
494
+ const operations = [
495
+ () =>
496
+ app.bean.executor.performAction('post', '/commerce/catalog/category', {
497
+ body: {
498
+ name: `foreign-parent-category-${suffix}`,
499
+ parentId: foreignCatalog.categoryId,
500
+ published: true,
501
+ },
502
+ }),
503
+ () =>
504
+ app.bean.executor.performAction('patch', '/commerce/catalog/category/:id', {
505
+ params: { id: categoryId },
506
+ body: {
507
+ name: `relation-category-updated-${suffix}`,
508
+ parentId: foreignCatalog.categoryId,
509
+ published: false,
510
+ },
511
+ }),
512
+ () =>
513
+ app.bean.executor.performAction('post', '/commerce/catalog/product', {
514
+ body: {
515
+ categoryId: foreignCatalog.categoryId,
516
+ title: `foreign-category-product-${suffix}`,
517
+ published: true,
518
+ },
519
+ }),
520
+ () =>
521
+ app.bean.executor.performAction('patch', '/commerce/catalog/product/:id', {
522
+ params: { id: productId },
523
+ body: {
524
+ categoryId: foreignCatalog.categoryId,
525
+ title: `relation-product-updated-${suffix}`,
526
+ published: false,
527
+ },
528
+ }),
529
+ () =>
530
+ app.bean.executor.performAction('post', '/commerce/catalog/sku', {
531
+ body: {
532
+ productId: foreignCatalog.productId,
533
+ code: `foreign-product-sku-${suffix}`,
534
+ priceCents: 100,
535
+ lifecycle: 'draft',
536
+ },
537
+ }),
538
+ () =>
539
+ app.bean.executor.performAction('patch', '/commerce/catalog/sku/:id', {
540
+ params: { id: skuId },
541
+ body: {
542
+ productId: foreignCatalog.productId,
543
+ code: `relation-sku-updated-${suffix}`,
544
+ priceCents: 200,
545
+ lifecycle: 'active',
546
+ },
547
+ }),
548
+ ];
549
+ for (const operation of operations) {
550
+ const [_, err] = await catchError(operation);
551
+ assert.equal(err?.code, 404);
552
+ }
553
+
554
+ const category = await app.scope('commerce-catalog').model.category.getById(categoryId);
555
+ const product = await app.scope('commerce-catalog').model.product.getById(productId);
556
+ const sku = await app.scope('commerce-catalog').model.sku.getById(skuId);
557
+ assert.deepEqual(
558
+ [category?.name, category?.parentId, category?.published],
559
+ [`relation-category-${suffix}`, parentCategoryId, true],
560
+ );
561
+ assert.deepEqual(
562
+ [product?.categoryId, product?.title, product?.published],
563
+ [categoryId, `relation-product-${suffix}`, true],
564
+ );
565
+ assert.deepEqual(
566
+ [sku?.productId, sku?.code, sku?.priceCents, sku?.lifecycle],
567
+ [productId, `relation-sku-${suffix}`, 100, 'draft'],
568
+ );
569
+ assert.equal(
570
+ await app.scope('commerce-catalog').model.category.get({
571
+ name: `foreign-parent-category-${suffix}`,
572
+ }),
573
+ undefined,
574
+ );
575
+ assert.equal(
576
+ await app.scope('commerce-catalog').model.product.get({
577
+ title: `foreign-category-product-${suffix}`,
578
+ }),
579
+ undefined,
580
+ );
581
+ assert.equal(
582
+ await app.scope('commerce-catalog').model.sku.get({
583
+ code: `foreign-product-sku-${suffix}`,
584
+ }),
585
+ undefined,
586
+ );
587
+ } finally {
588
+ await app.bean.passport.signout();
589
+ }
590
+ });
591
+ });
358
592
  });
@@ -1,11 +1,11 @@
1
- import type { IMetaVersionTest, IMetaVersionTestOptions } from 'vona-module-a-version';
1
+ import type { IMetaVersionSeed, IMetaVersionSeedOptions } from 'vona-module-a-version';
2
2
 
3
3
  import { BeanBase } from 'vona';
4
4
  import { Meta } from 'vona-module-a-meta';
5
5
 
6
6
  @Meta()
7
- export class MetaVersion extends BeanBase implements IMetaVersionTest {
8
- async test(_options: IMetaVersionTestOptions) {
7
+ export class MetaVersion extends BeanBase implements IMetaVersionSeed {
8
+ async seed(_options: IMetaVersionSeedOptions) {
9
9
  const scopeCatalog = this.$scope.commerceCatalog;
10
10
  const scopeTrade = this.$scope.commerceTrade;
11
11
 
@@ -49,12 +49,16 @@ export class MetaVersion extends BeanBase implements IMetaVersionUpdate {
49
49
  .tableIdentity(entityStockAudit.stockReservationId)
50
50
  .nullable()
51
51
  .comment(entityStockAudit.$comment.stockReservationId);
52
+ table.userId(entityStockAudit.actorId).nullable().comment(entityStockAudit.$comment.actorId);
52
53
  table.string(entityStockAudit.operation, 20).comment(entityStockAudit.$comment.operation);
53
54
  table.integer(entityStockAudit.delta).comment(entityStockAudit.$comment.delta);
54
55
  table.string(entityStockAudit.reason, 255).comment(entityStockAudit.$comment.reason);
55
56
  table
56
57
  .string(entityStockAudit.correlationId, 100)
57
58
  .comment(entityStockAudit.$comment.correlationId);
59
+ table.int0(entityStockAudit.priorOnHand).comment(entityStockAudit.$comment.priorOnHand);
60
+ table.int0(entityStockAudit.priorReserved).comment(entityStockAudit.$comment.priorReserved);
61
+ table.int0(entityStockAudit.priorAvailable).comment(entityStockAudit.$comment.priorAvailable);
58
62
  table.int0(entityStockAudit.onHand).comment(entityStockAudit.$comment.onHand);
59
63
  table.int0(entityStockAudit.reserved).comment(entityStockAudit.$comment.reserved);
60
64
  table.int0(entityStockAudit.available).comment(entityStockAudit.$comment.available);
@@ -2,6 +2,7 @@ export default {
2
2
  AdjustStock: 'Adjust Stock',
3
3
  Available: 'Available',
4
4
  AddCartItem: 'Add Cart Item',
5
+ ActorId: 'Actor ID',
5
6
  Cart: 'Cart',
6
7
  CartItem: 'Cart Item',
7
8
  CorrelationId: 'Correlation ID',
@@ -10,6 +11,9 @@ export default {
10
11
  Name: 'Name',
11
12
  OnHand: 'On Hand',
12
13
  Operations: 'Operations',
14
+ PriorAvailable: 'Prior Available',
15
+ PriorOnHand: 'Prior On Hand',
16
+ PriorReserved: 'Prior Reserved',
13
17
  Quantity: 'Quantity',
14
18
  Reason: 'Reason',
15
19
  ReservationState: 'Reservation State',
@@ -2,6 +2,7 @@ export default {
2
2
  AdjustStock: '调整库存',
3
3
  Available: '可用库存',
4
4
  AddCartItem: '添加购物车商品',
5
+ ActorId: '操作人 ID',
5
6
  Cart: '购物车',
6
7
  CartItem: '购物车商品',
7
8
  CorrelationId: '关联 ID',
@@ -10,6 +11,9 @@ export default {
10
11
  Name: '名称',
11
12
  OnHand: '现货库存',
12
13
  Operations: '操作',
14
+ PriorAvailable: '变更前可用库存',
15
+ PriorOnHand: '变更前现货库存',
16
+ PriorReserved: '变更前预留库存',
13
17
  Quantity: '数量',
14
18
  Reason: '原因',
15
19
  ReservationState: '预留状态',