cabloy 5.1.122 → 5.1.124
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/.cabloy-version +1 -1
- package/.claude/skills/cabloy-frontend-scaffold/SKILL.md +13 -3
- package/.claude/skills/cabloy-workflow/SKILL.md +6 -0
- package/.claude/skills/cabloy-workflow/evals/evals.json +6 -0
- package/CHANGELOG.md +24 -0
- package/CLAUDE.md +1 -1
- package/cabloy-docs/.vitepress/config.mjs +4 -0
- package/cabloy-docs/frontend/form-layout-guide.md +29 -7
- package/cabloy-docs/fullstack/parallel-worktree-environment.md +87 -0
- package/e2e/scripts/e2e.ts +13 -1
- package/e2e/scripts/startE2eVona.ts +4 -1
- package/e2e/specs/a-commerce/commerce.spec.ts +129 -32
- package/package.json +2 -1
- package/playwright-report/data/24ac790ec112339c76cfb0c8e2c2539c2f953a0b.zip +0 -0
- package/playwright-report/data/2fddcabcdbd0b695061a565acfff243cb3a4f5e3.zip +0 -0
- package/playwright-report/data/4738038d9e861d63fd25937c9a3570934786a62f.zip +0 -0
- package/playwright-report/data/72f99c7da67c7f6ea53cab7d8681798b70d79a10.md +222 -0
- package/playwright-report/data/7b9684a7c793e9798b898f8ff50177b660a7a733.md +222 -0
- package/playwright-report/data/8b31595f5f1cc9d23863af51a592e6b90dcbc4ce.zip +0 -0
- package/playwright-report/data/95b578407a68806202dda917a61c50c750bd285b.md +222 -0
- package/playwright-report/data/ad960b3a58f224f5b4cad04a24067600064ffb7b.md +222 -0
- package/playwright-report/index.html +90 -0
- package/playwright-report/trace/assets/codeMirrorModule-LEHpjmcn.js +32 -0
- package/playwright-report/trace/assets/defaultSettingsView-BNmKHKpQ.js +264 -0
- package/playwright-report/trace/assets/urlMatch-BYQrIQwR.js +1 -0
- package/playwright-report/trace/codeMirrorModule.DYBRYzYX.css +1 -0
- package/playwright-report/trace/codicon.DCmgc-ay.ttf +0 -0
- package/playwright-report/trace/defaultSettingsView.CjdS-WJx.css +1 -0
- package/playwright-report/trace/index.CzXZzn5A.css +1 -0
- package/playwright-report/trace/index.DMMX1gXU.js +2 -0
- package/playwright-report/trace/index.html +44 -0
- package/playwright-report/trace/manifest.webmanifest +16 -0
- package/playwright-report/trace/playwright-logo.svg +9 -0
- package/playwright-report/trace/snapshot.html +10 -0
- package/playwright-report/trace/snapshot.v8KI4P3m.js +2 -0
- package/playwright-report/trace/sw.bundle.js +5 -0
- package/playwright-report/trace/uiMode.BZQ54Kgt.css +1 -0
- package/playwright-report/trace/uiMode.Ut8wwJNp.js +6 -0
- package/playwright-report/trace/uiMode.html +18 -0
- package/playwright-report/trace/xtermModule.DYP7pi_n.css +32 -0
- package/vona/env/.env +12 -0
- package/vona/env/.env.test +7 -0
- package/vona/packages-cli/cli/package.json +1 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/dto/{{resourceName}}Create.tsx_ +19 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/dto/{{resourceName}}Update.tsx_ +19 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/dto/{{resourceName}}View.tsx_ +19 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/snippets/3-en-us.ts +6 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/snippets/4-zh-cn.ts +6 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/dto/{{resourceName}}Create.tsx_ +19 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/dto/{{resourceName}}Update.tsx_ +19 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/dto/{{resourceName}}View.tsx_ +19 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/snippets/3-en-us.ts +6 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/snippets/4-zh-cn.ts +6 -1
- package/vona/packages-cli/cli-set-api/package.json +1 -1
- package/vona/pnpm-lock.yaml +255 -12
- package/vona/pnpm-workspace.yaml +1 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/package.json +4 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/.metadata/index.ts +45 -3
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/meta.index.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/meta.version.ts +25 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/payScene.commerceOrder.ts +20 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/entity/paymentAttempt.tsx +9 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/entity/paymentAudit.tsx +5 -2
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/entity/refundAttempt.tsx +6 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/index.ts +2 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/lib/index.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/service/commercePayScene.ts +54 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/service/paymentAttempt.ts +7 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/types/index.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/test/paymentAttempt.test.ts +21 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/.metadata/index.ts +30 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/config/locale/en-us.ts +4 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/config/locale/zh-cn.ts +4 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateCreate.tsx +88 -1
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateUpdate.tsx +44 -1
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateView.tsx +72 -1
- package/vona/src/suite/a-commerce/modules/commerce-promotion/test/couponTemplateFormLayout.test.ts +121 -0
- package/vona/src/suite/a-commerce/modules/commerce-siteweb/src/bean/ssrMenu.home.ts +4 -1
- package/vona/src/suite/a-commerce/modules/commerce-trade/package.json +4 -1
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/.metadata/index.ts +0 -21
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/checkoutResult.tsx +3 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/service/order.ts +79 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/orderSnapshot.test.ts +227 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/paymentOutcome.test.ts +121 -13
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/refundLifecycle.test.ts +312 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/package.json +76 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/index.ts +842 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/this.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/bean.payProvider.ts +92 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/bean.payScene.ts +105 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/meta.index.ts +28 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/meta.redlock.ts +11 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/meta.version.ts +113 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/queue.outboxDispatch.ts +31 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/schedule.outboxDispatch.ts +11 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/controller/paymentSession.ts +55 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/controller/webhook.ts +47 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/dto/paymentSessionStart.tsx +8 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/dto/paymentSessionView.tsx +69 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/dto/webhookReceipt.tsx +12 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/outboxEvent.tsx +46 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/paymentAudit.tsx +36 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/paymentSession.tsx +72 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/providerOperation.tsx +54 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/refundOperation.tsx +37 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/entity/webhookInbox.tsx +59 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/index.ts +3 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/lib/index.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/lib/payProvider.ts +7 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/lib/payScene.ts +7 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/outboxEvent.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/paymentAudit.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/paymentSession.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/providerOperation.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/refundOperation.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/model/webhookInbox.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/outbox.ts +156 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/paymentSession.ts +278 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/providerOperation.ts +5 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/webhook.ts +127 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/index.ts +3 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/payProvider.ts +74 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/payScene.ts +63 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/payment.ts +151 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/test/outbox.test.ts +209 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/test/paymentSession.test.ts +153 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/test/webhook.test.ts +278 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/tsconfig.build.json +11 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/tsconfig.json +7 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/package.json +55 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/.metadata/index.ts +182 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/.metadata/this.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/bean/payProvider.mock.ts +149 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/controller/mockPayment.ts +25 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/dto/mockPaymentComplete.tsx +13 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/dto/mockPaymentReceipt.tsx +16 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/index.ts +3 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/lib/index.ts +1 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/service/payMock.ts +78 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/types/index.ts +10 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/test/payMock.test.ts +141 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/tsconfig.build.json +11 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/tsconfig.json +7 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/package.json +55 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/.metadata/index.ts +62 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/.metadata/this.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/bean/payProvider.paypal.ts +91 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/index.ts +3 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/lib/index.ts +1 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/types/index.ts +9 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/tsconfig.build.json +11 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/tsconfig.json +7 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/package.json +55 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/.metadata/index.ts +62 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/.metadata/this.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/bean/payProvider.stripe.ts +88 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/index.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/types/index.ts +8 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/tsconfig.build.json +11 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/tsconfig.json +7 -0
- package/vona/src/suite-vendor/a-pay/package.json +15 -0
- package/vona/src/suite-vendor/a-pay/tsconfig.base.json +4 -0
- package/vona/src/suite-vendor/a-pay/tsconfig.json +19 -0
- package/zova/env/.env +1 -0
- package/zova/openapi.config.ts +5 -1
- package/zova/package.original.json +1 -1
- package/zova/packages-cli/cli/package.json +2 -2
- package/zova/packages-cli/cli-set-front/cli/templates/openapi/config/boilerplate/project/openapi.config.ts +5 -1
- package/zova/packages-cli/cli-set-front/package.json +1 -1
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.openapi.generate.ts +8 -0
- package/zova/packages-cli/cli-set-front/src/lib/common/cliCreatePage.ts +7 -24
- package/zova/packages-cli/cli-set-front/src/lib/common/utils.ts +10 -1
- package/zova/packages-utils/zova-jsx/package.json +2 -2
- package/zova/packages-zova/zova/package.json +3 -3
- package/zova/packages-zova/zova-core/package.json +1 -1
- package/zova/packages-zova/zova-core/src/types/interface/component.ts +5 -0
- package/zova/pnpm-lock.yaml +96 -26
- package/zova/src/front/config/config/config.cabloyCommerce.ts +1 -1
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/schemas.ts +110 -12
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/types.ts +1292 -160
- package/zova/src/suite/a-commerce/modules/commerce-trade/cli/openapi.config.ts +0 -1
- package/zova/src/suite/a-commerce/modules/commerce-trade/package.json +4 -1
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/.metadata/index.ts +1 -47
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/schemas.ts +23 -8
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/types.ts +249 -62
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/checkout/controller.tsx +5 -1
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/payment/controller.tsx +152 -39
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/routes.ts +1 -1
- package/zova/src/suite-vendor/a-pay/modules/a-pay/cli/openapi.config.ts +9 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/package.json +53 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/component/paymentNextAction.ts +31 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/index.ts +217 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/this.ts +2 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/baseURL.ts +5 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/index.ts +3 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/schemas.ts +584 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/types.ts +9324 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/paymentSession.ts +52 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/apiSchema/paymentSession.ts +20 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/component/paymentNextAction/controller.tsx +76 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/index.ts +3 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/lib/index.ts +1 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/model/paymentSession.ts +32 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/service/paymentCoordinator.ts +13 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/types/index.ts +1 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/types/payment.ts +25 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/tsconfig.build.json +13 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/tsconfig.json +5 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/cli/openapi.config.ts +9 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/package.json +53 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/.metadata/index.ts +140 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/.metadata/this.ts +2 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/baseURL.ts +5 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/index.ts +3 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/schemas.ts +584 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/types.ts +9324 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/payMockPayment.ts +34 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/apiSchema/payMockPayment.ts +13 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/index.ts +1 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/model/payMockPayment.ts +20 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/tsconfig.build.json +13 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-mock/tsconfig.json +5 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-paypal/package.json +52 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-paypal/src/.metadata/index.ts +26 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-paypal/src/.metadata/this.ts +2 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-paypal/src/index.ts +1 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-paypal/tsconfig.build.json +13 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-paypal/tsconfig.json +5 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-stripe/package.json +52 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-stripe/src/.metadata/index.ts +26 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-stripe/src/.metadata/this.ts +2 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-stripe/src/index.ts +1 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-stripe/tsconfig.build.json +13 -0
- package/zova/src/suite-vendor/a-pay/modules/pay-stripe/tsconfig.json +5 -0
- package/zova/src/suite-vendor/a-pay/package.json +15 -0
- package/zova/src/suite-vendor/a-pay/tsconfig.base.json +4 -0
- package/zova/src/suite-vendor/a-pay/tsconfig.json +4 -0
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/package.json +2 -2
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/controller/payment.ts +0 -23
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/commerceTradePayment.ts +0 -36
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/apiSchema/commerceTradePayment.ts +0 -13
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/model/payment.ts +0 -25
- /package/vona/patches/{zova-core@5.1.79.patch → zova-core@5.1.81.patch} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
|
|
3
|
+
|
|
4
|
+
import { Api, v } from 'vona-module-a-openapiutils';
|
|
5
|
+
import { Entity, EntityBase } from 'vona-module-a-orm';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
import type { TypePaymentNextAction, TypePaymentSessionState } from '../types/payment.ts';
|
|
9
|
+
|
|
10
|
+
export interface IEntityOptionsPaymentSession extends IDecoratorEntityOptions {}
|
|
11
|
+
|
|
12
|
+
@Entity<IEntityOptionsPaymentSession>('payPaymentSession')
|
|
13
|
+
export class EntityPaymentSession extends EntityBase {
|
|
14
|
+
@Api.field(v.tableIdentity())
|
|
15
|
+
userId: TableIdentity;
|
|
16
|
+
|
|
17
|
+
@Api.field(z.string())
|
|
18
|
+
payScene: string;
|
|
19
|
+
|
|
20
|
+
@Api.field(v.required(), v.min(1), v.max(100))
|
|
21
|
+
businessReference: string;
|
|
22
|
+
|
|
23
|
+
@Api.field(z.string())
|
|
24
|
+
providerName: string;
|
|
25
|
+
|
|
26
|
+
@Api.field(v.required(), v.min(1), v.max(100))
|
|
27
|
+
clientName: string;
|
|
28
|
+
|
|
29
|
+
@Api.field(z.enum(['sandbox', 'live']))
|
|
30
|
+
environment: 'sandbox' | 'live';
|
|
31
|
+
|
|
32
|
+
@Api.field(z.number().int().nonnegative())
|
|
33
|
+
amountMinor: number;
|
|
34
|
+
|
|
35
|
+
@Api.field(v.required(), v.min(3), v.max(3))
|
|
36
|
+
currency: string;
|
|
37
|
+
|
|
38
|
+
@Api.field(
|
|
39
|
+
z.enum([
|
|
40
|
+
'created',
|
|
41
|
+
'starting',
|
|
42
|
+
'requires_action',
|
|
43
|
+
'processing',
|
|
44
|
+
'succeeded',
|
|
45
|
+
'failed',
|
|
46
|
+
'cancelled',
|
|
47
|
+
'expired',
|
|
48
|
+
]),
|
|
49
|
+
)
|
|
50
|
+
state: TypePaymentSessionState;
|
|
51
|
+
|
|
52
|
+
@Api.field(v.optional())
|
|
53
|
+
nextAction?: TypePaymentNextAction;
|
|
54
|
+
|
|
55
|
+
@Api.field(v.optional(), v.max(255))
|
|
56
|
+
providerPaymentId?: string;
|
|
57
|
+
|
|
58
|
+
@Api.field(v.optional(), v.max(255))
|
|
59
|
+
providerOrderId?: string;
|
|
60
|
+
|
|
61
|
+
@Api.field(v.optional(), v.max(255))
|
|
62
|
+
providerCaptureId?: string;
|
|
63
|
+
|
|
64
|
+
@Api.field(v.required(), v.min(1), v.max(100))
|
|
65
|
+
correlationId: string;
|
|
66
|
+
|
|
67
|
+
@Api.field(v.required())
|
|
68
|
+
expiresAt: Date;
|
|
69
|
+
|
|
70
|
+
@Api.field(v.optional())
|
|
71
|
+
finalizedAt?: Date;
|
|
72
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
|
|
3
|
+
|
|
4
|
+
import { Api, v } from 'vona-module-a-openapiutils';
|
|
5
|
+
import { Entity, EntityBase } from 'vona-module-a-orm';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
import type { TypeProviderOperationKind, TypeProviderOperationState } from '../types/payment.ts';
|
|
9
|
+
|
|
10
|
+
export interface IEntityOptionsProviderOperation extends IDecoratorEntityOptions {}
|
|
11
|
+
|
|
12
|
+
@Entity<IEntityOptionsProviderOperation>('payProviderOperation')
|
|
13
|
+
export class EntityProviderOperation extends EntityBase {
|
|
14
|
+
@Api.field(v.tableIdentity())
|
|
15
|
+
paymentSessionId: TableIdentity;
|
|
16
|
+
|
|
17
|
+
@Api.field(z.enum(['start', 'confirm', 'query', 'refund']))
|
|
18
|
+
kind: TypeProviderOperationKind;
|
|
19
|
+
|
|
20
|
+
@Api.field(
|
|
21
|
+
z.enum(['created', 'claimed', 'submitted', 'succeeded', 'failed', 'reconciliation_required']),
|
|
22
|
+
)
|
|
23
|
+
state: TypeProviderOperationState;
|
|
24
|
+
|
|
25
|
+
@Api.field(v.required(), v.min(1), v.max(100))
|
|
26
|
+
idempotencyKey: string;
|
|
27
|
+
|
|
28
|
+
@Api.field(v.required(), v.min(1), v.max(100))
|
|
29
|
+
correlationId: string;
|
|
30
|
+
|
|
31
|
+
@Api.field(v.optional(), v.max(255))
|
|
32
|
+
providerRequestId?: string;
|
|
33
|
+
|
|
34
|
+
@Api.field(v.optional(), v.max(255))
|
|
35
|
+
providerResourceId?: string;
|
|
36
|
+
|
|
37
|
+
@Api.field(z.number().int().nonnegative())
|
|
38
|
+
attemptCount: number;
|
|
39
|
+
|
|
40
|
+
@Api.field(v.optional())
|
|
41
|
+
claimedAt?: Date;
|
|
42
|
+
|
|
43
|
+
@Api.field(v.optional())
|
|
44
|
+
nextAttemptAt?: Date;
|
|
45
|
+
|
|
46
|
+
@Api.field(v.optional(), v.max(100))
|
|
47
|
+
errorCode?: string;
|
|
48
|
+
|
|
49
|
+
@Api.field(v.optional(), v.max(255))
|
|
50
|
+
errorSummary?: string;
|
|
51
|
+
|
|
52
|
+
@Api.field(v.optional())
|
|
53
|
+
finalizedAt?: Date;
|
|
54
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
|
|
3
|
+
|
|
4
|
+
import { Api, v } from 'vona-module-a-openapiutils';
|
|
5
|
+
import { Entity, EntityBase } from 'vona-module-a-orm';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
import type { TypeRefundOperationState } from '../types/payment.ts';
|
|
9
|
+
|
|
10
|
+
export interface IEntityOptionsRefundOperation extends IDecoratorEntityOptions {}
|
|
11
|
+
|
|
12
|
+
@Entity<IEntityOptionsRefundOperation>('payRefundOperation')
|
|
13
|
+
export class EntityRefundOperation extends EntityBase {
|
|
14
|
+
@Api.field(v.tableIdentity())
|
|
15
|
+
paymentSessionId: TableIdentity;
|
|
16
|
+
|
|
17
|
+
@Api.field(v.required(), v.min(1), v.max(100))
|
|
18
|
+
businessReference: string;
|
|
19
|
+
|
|
20
|
+
@Api.field(z.number().int().positive())
|
|
21
|
+
amountMinor: number;
|
|
22
|
+
|
|
23
|
+
@Api.field(v.required(), v.min(3), v.max(3))
|
|
24
|
+
currency: string;
|
|
25
|
+
|
|
26
|
+
@Api.field(z.enum(['created', 'submitting', 'pending', 'succeeded', 'failed', 'cancelled']))
|
|
27
|
+
state: TypeRefundOperationState;
|
|
28
|
+
|
|
29
|
+
@Api.field(v.required(), v.min(1), v.max(100))
|
|
30
|
+
idempotencyKey: string;
|
|
31
|
+
|
|
32
|
+
@Api.field(v.optional(), v.max(255))
|
|
33
|
+
providerRefundId?: string;
|
|
34
|
+
|
|
35
|
+
@Api.field(v.optional())
|
|
36
|
+
finalizedAt?: Date;
|
|
37
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
|
|
3
|
+
|
|
4
|
+
import { Api, v } from 'vona-module-a-openapiutils';
|
|
5
|
+
import { Entity, EntityBase } from 'vona-module-a-orm';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
export interface IEntityOptionsWebhookInbox extends IDecoratorEntityOptions {}
|
|
9
|
+
|
|
10
|
+
@Entity<IEntityOptionsWebhookInbox>('payWebhookInbox')
|
|
11
|
+
export class EntityWebhookInbox extends EntityBase {
|
|
12
|
+
@Api.field(v.required(), v.min(1), v.max(100))
|
|
13
|
+
providerName: string;
|
|
14
|
+
|
|
15
|
+
@Api.field(v.required(), v.min(1), v.max(100))
|
|
16
|
+
clientName: string;
|
|
17
|
+
|
|
18
|
+
@Api.field(z.enum(['sandbox', 'live']))
|
|
19
|
+
environment: 'sandbox' | 'live';
|
|
20
|
+
|
|
21
|
+
@Api.field(v.required(), v.min(1), v.max(255))
|
|
22
|
+
providerEventId: string;
|
|
23
|
+
|
|
24
|
+
@Api.field(v.required(), v.min(1), v.max(100))
|
|
25
|
+
eventType: string;
|
|
26
|
+
|
|
27
|
+
@Api.field(v.optional(), v.tableIdentity())
|
|
28
|
+
paymentSessionId?: TableIdentity;
|
|
29
|
+
|
|
30
|
+
@Api.field(v.optional(), v.tableIdentity())
|
|
31
|
+
refundOperationId?: TableIdentity;
|
|
32
|
+
|
|
33
|
+
@Api.field(v.optional(), z.enum(['succeeded', 'failed', 'cancelled']))
|
|
34
|
+
paymentState?: 'succeeded' | 'failed' | 'cancelled';
|
|
35
|
+
|
|
36
|
+
@Api.field(v.optional(), z.number().int().nonnegative())
|
|
37
|
+
amountMinor?: number;
|
|
38
|
+
|
|
39
|
+
@Api.field(v.optional(), v.min(3), v.max(3))
|
|
40
|
+
currency?: string;
|
|
41
|
+
|
|
42
|
+
@Api.field(v.optional(), v.max(255))
|
|
43
|
+
providerCaptureId?: string;
|
|
44
|
+
|
|
45
|
+
@Api.field(v.required(), v.min(64), v.max(64))
|
|
46
|
+
payloadHash: string;
|
|
47
|
+
|
|
48
|
+
@Api.field(z.enum(['received', 'processed', 'failed']))
|
|
49
|
+
state: 'received' | 'processed' | 'failed';
|
|
50
|
+
|
|
51
|
+
@Api.field(z.number().int().nonnegative())
|
|
52
|
+
retryCount: number;
|
|
53
|
+
|
|
54
|
+
@Api.field(v.optional())
|
|
55
|
+
processedAt?: Date;
|
|
56
|
+
|
|
57
|
+
@Api.field(v.optional(), v.max(255))
|
|
58
|
+
errorSummary?: string;
|
|
59
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createBeanDecorator } from 'vona';
|
|
2
|
+
|
|
3
|
+
import type { IDecoratorPayProviderOptions } from '../types/payProvider.ts';
|
|
4
|
+
|
|
5
|
+
export function PayProvider<T extends IDecoratorPayProviderOptions>(options?: T): ClassDecorator {
|
|
6
|
+
return createBeanDecorator('payProvider', options);
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDecoratorModelOptions } from 'vona-module-a-orm';
|
|
2
|
+
|
|
3
|
+
import { BeanModelBase, Model } from 'vona-module-a-orm';
|
|
4
|
+
|
|
5
|
+
import { EntityOutboxEvent } from '../entity/outboxEvent.tsx';
|
|
6
|
+
|
|
7
|
+
export interface IModelOptionsOutboxEvent extends IDecoratorModelOptions<EntityOutboxEvent> {}
|
|
8
|
+
|
|
9
|
+
@Model<IModelOptionsOutboxEvent>({ entity: EntityOutboxEvent })
|
|
10
|
+
export class ModelOutboxEvent extends BeanModelBase<EntityOutboxEvent> {}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDecoratorModelOptions } from 'vona-module-a-orm';
|
|
2
|
+
|
|
3
|
+
import { BeanModelBase, Model } from 'vona-module-a-orm';
|
|
4
|
+
|
|
5
|
+
import { EntityPaymentAudit } from '../entity/paymentAudit.tsx';
|
|
6
|
+
|
|
7
|
+
export interface IModelOptionsPaymentAudit extends IDecoratorModelOptions<EntityPaymentAudit> {}
|
|
8
|
+
|
|
9
|
+
@Model<IModelOptionsPaymentAudit>({ entity: EntityPaymentAudit })
|
|
10
|
+
export class ModelPaymentAudit extends BeanModelBase<EntityPaymentAudit> {}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDecoratorModelOptions } from 'vona-module-a-orm';
|
|
2
|
+
|
|
3
|
+
import { BeanModelBase, Model } from 'vona-module-a-orm';
|
|
4
|
+
|
|
5
|
+
import { EntityPaymentSession } from '../entity/paymentSession.tsx';
|
|
6
|
+
|
|
7
|
+
export interface IModelOptionsPaymentSession extends IDecoratorModelOptions<EntityPaymentSession> {}
|
|
8
|
+
|
|
9
|
+
@Model<IModelOptionsPaymentSession>({ entity: EntityPaymentSession })
|
|
10
|
+
export class ModelPaymentSession extends BeanModelBase<EntityPaymentSession> {}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDecoratorModelOptions } from 'vona-module-a-orm';
|
|
2
|
+
|
|
3
|
+
import { BeanModelBase, Model } from 'vona-module-a-orm';
|
|
4
|
+
|
|
5
|
+
import { EntityProviderOperation } from '../entity/providerOperation.tsx';
|
|
6
|
+
|
|
7
|
+
export interface IModelOptionsProviderOperation extends IDecoratorModelOptions<EntityProviderOperation> {}
|
|
8
|
+
|
|
9
|
+
@Model<IModelOptionsProviderOperation>({ entity: EntityProviderOperation })
|
|
10
|
+
export class ModelProviderOperation extends BeanModelBase<EntityProviderOperation> {}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDecoratorModelOptions } from 'vona-module-a-orm';
|
|
2
|
+
|
|
3
|
+
import { BeanModelBase, Model } from 'vona-module-a-orm';
|
|
4
|
+
|
|
5
|
+
import { EntityRefundOperation } from '../entity/refundOperation.tsx';
|
|
6
|
+
|
|
7
|
+
export interface IModelOptionsRefundOperation extends IDecoratorModelOptions<EntityRefundOperation> {}
|
|
8
|
+
|
|
9
|
+
@Model<IModelOptionsRefundOperation>({ entity: EntityRefundOperation })
|
|
10
|
+
export class ModelRefundOperation extends BeanModelBase<EntityRefundOperation> {}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDecoratorModelOptions } from 'vona-module-a-orm';
|
|
2
|
+
|
|
3
|
+
import { BeanModelBase, Model } from 'vona-module-a-orm';
|
|
4
|
+
|
|
5
|
+
import { EntityWebhookInbox } from '../entity/webhookInbox.tsx';
|
|
6
|
+
|
|
7
|
+
export interface IModelOptionsWebhookInbox extends IDecoratorModelOptions<EntityWebhookInbox> {}
|
|
8
|
+
|
|
9
|
+
@Model<IModelOptionsWebhookInbox>({ entity: EntityWebhookInbox })
|
|
10
|
+
export class ModelWebhookInbox extends BeanModelBase<EntityWebhookInbox> {}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
|
|
3
|
+
import { randomUUID } from 'node:crypto';
|
|
4
|
+
import { BeanBase } from 'vona';
|
|
5
|
+
import { Service } from 'vona-module-a-bean';
|
|
6
|
+
import { Core } from 'vona-module-a-core';
|
|
7
|
+
|
|
8
|
+
import type { IPaymentOutcomeEvent } from '../types/payment.ts';
|
|
9
|
+
|
|
10
|
+
const ClaimLeaseMilliseconds = 60_000;
|
|
11
|
+
const MaxAttempts = 10;
|
|
12
|
+
|
|
13
|
+
@Service()
|
|
14
|
+
export class ServiceOutbox extends BeanBase {
|
|
15
|
+
async enqueue(
|
|
16
|
+
paymentSessionId: TableIdentity,
|
|
17
|
+
eventType: 'payment.outcome.v1',
|
|
18
|
+
payload: IPaymentOutcomeEvent,
|
|
19
|
+
) {
|
|
20
|
+
const event = await this.scope.model.outboxEvent.insert({
|
|
21
|
+
eventType,
|
|
22
|
+
paymentSessionId,
|
|
23
|
+
payload,
|
|
24
|
+
state: 'pending',
|
|
25
|
+
attemptCount: 0,
|
|
26
|
+
nextAttemptAt: new Date(),
|
|
27
|
+
});
|
|
28
|
+
if (!this.app.meta.isTest) {
|
|
29
|
+
this.ctx.db.commit(() => {
|
|
30
|
+
this.scope.queue.outboxDispatch.push({ outboxEventId: event.id });
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return event;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@Core.transaction()
|
|
37
|
+
async claim(id: TableIdentity) {
|
|
38
|
+
const event = await this.scope.model.outboxEvent.getByIdForUpdate(id);
|
|
39
|
+
if (!event || event.state === 'dispatched' || event.state === 'failed') return undefined;
|
|
40
|
+
const now = new Date();
|
|
41
|
+
const eligible =
|
|
42
|
+
(event.state === 'pending' && (!event.nextAttemptAt || event.nextAttemptAt <= now)) ||
|
|
43
|
+
(event.state === 'claimed' && !!event.claimExpiresAt && event.claimExpiresAt <= now);
|
|
44
|
+
if (!eligible) return undefined;
|
|
45
|
+
if (event.attemptCount >= MaxAttempts) {
|
|
46
|
+
await this.scope.model.outboxEvent.updateById(event.id, {
|
|
47
|
+
state: 'failed',
|
|
48
|
+
errorSummary: 'outbox delivery attempts exhausted',
|
|
49
|
+
});
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const claimToken = randomUUID();
|
|
53
|
+
const claimedAt = now;
|
|
54
|
+
const claimExpiresAt = new Date(now.getTime() + ClaimLeaseMilliseconds);
|
|
55
|
+
await this.scope.model.outboxEvent.updateById(event.id, {
|
|
56
|
+
state: 'claimed',
|
|
57
|
+
claimedAt,
|
|
58
|
+
claimToken,
|
|
59
|
+
claimExpiresAt,
|
|
60
|
+
attemptCount: event.attemptCount + 1,
|
|
61
|
+
errorSummary: undefined,
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
...event,
|
|
65
|
+
state: 'claimed' as const,
|
|
66
|
+
claimedAt,
|
|
67
|
+
claimToken,
|
|
68
|
+
claimExpiresAt,
|
|
69
|
+
attemptCount: event.attemptCount + 1,
|
|
70
|
+
errorSummary: undefined,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@Core.transaction()
|
|
75
|
+
async markDispatched(id: TableIdentity, claimToken: string) {
|
|
76
|
+
const event = await this.scope.model.outboxEvent.getByIdForUpdate(id);
|
|
77
|
+
if (!event || event.state !== 'claimed' || event.claimToken !== claimToken) return undefined;
|
|
78
|
+
const dispatchedAt = new Date();
|
|
79
|
+
await this.scope.model.outboxEvent.updateById(event.id, {
|
|
80
|
+
state: 'dispatched',
|
|
81
|
+
dispatchedAt,
|
|
82
|
+
claimedAt: undefined,
|
|
83
|
+
claimToken: undefined,
|
|
84
|
+
claimExpiresAt: undefined,
|
|
85
|
+
errorSummary: undefined,
|
|
86
|
+
});
|
|
87
|
+
return { ...event, state: 'dispatched' as const, dispatchedAt };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@Core.transaction()
|
|
91
|
+
async release(id: TableIdentity, claimToken: string, error: unknown) {
|
|
92
|
+
const event = await this.scope.model.outboxEvent.getByIdForUpdate(id);
|
|
93
|
+
if (!event || event.state !== 'claimed' || event.claimToken !== claimToken) return undefined;
|
|
94
|
+
const errorSummary = summarizeError(error);
|
|
95
|
+
if (event.attemptCount >= MaxAttempts) {
|
|
96
|
+
await this.scope.model.outboxEvent.updateById(event.id, {
|
|
97
|
+
state: 'failed',
|
|
98
|
+
claimedAt: undefined,
|
|
99
|
+
claimToken: undefined,
|
|
100
|
+
claimExpiresAt: undefined,
|
|
101
|
+
errorSummary,
|
|
102
|
+
});
|
|
103
|
+
return { ...event, state: 'failed' as const, errorSummary };
|
|
104
|
+
}
|
|
105
|
+
const nextAttemptAt = new Date(Date.now() + retryDelayMilliseconds(event.attemptCount));
|
|
106
|
+
await this.scope.model.outboxEvent.updateById(event.id, {
|
|
107
|
+
state: 'pending',
|
|
108
|
+
claimedAt: undefined,
|
|
109
|
+
claimToken: undefined,
|
|
110
|
+
claimExpiresAt: undefined,
|
|
111
|
+
nextAttemptAt,
|
|
112
|
+
errorSummary,
|
|
113
|
+
});
|
|
114
|
+
return { ...event, state: 'pending' as const, nextAttemptAt, errorSummary };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async queueDue(limit = 100) {
|
|
118
|
+
const now = new Date();
|
|
119
|
+
const pending = await this.scope.model.outboxEvent.select({
|
|
120
|
+
where: {
|
|
121
|
+
state: 'pending',
|
|
122
|
+
nextAttemptAt: { _lte_: now },
|
|
123
|
+
},
|
|
124
|
+
orders: [
|
|
125
|
+
['nextAttemptAt', 'asc'],
|
|
126
|
+
['id', 'asc'],
|
|
127
|
+
],
|
|
128
|
+
limit,
|
|
129
|
+
});
|
|
130
|
+
const claimed = await this.scope.model.outboxEvent.select({
|
|
131
|
+
where: {
|
|
132
|
+
state: 'claimed',
|
|
133
|
+
claimExpiresAt: { _lte_: now },
|
|
134
|
+
},
|
|
135
|
+
orders: [
|
|
136
|
+
['claimExpiresAt', 'asc'],
|
|
137
|
+
['id', 'asc'],
|
|
138
|
+
],
|
|
139
|
+
limit: Math.max(0, limit - pending.length),
|
|
140
|
+
});
|
|
141
|
+
const events = [...pending, ...claimed];
|
|
142
|
+
for (const event of events) {
|
|
143
|
+
await this.scope.queue.outboxDispatch.pushAsync({ outboxEventId: event.id });
|
|
144
|
+
}
|
|
145
|
+
return events.length;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function retryDelayMilliseconds(attemptCount: number) {
|
|
150
|
+
return Math.min(60_000, 1_000 * 2 ** Math.max(0, attemptCount - 1));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function summarizeError(error: unknown) {
|
|
154
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
155
|
+
return message.slice(0, 255);
|
|
156
|
+
}
|