cabloy 5.1.113 → 5.1.114
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-backend-scaffold/references/follow-up-checklist.md +4 -0
- package/.github/workflows/vona-test-mysql.yml +12 -0
- package/.github/workflows/vona-test-pg.yml +5 -1
- package/CHANGELOG.md +14 -0
- package/CLAUDE.md +4 -0
- package/cabloy-docs/backend/internal-aop-guide.md +35 -0
- package/cabloy-docs/backend/unit-testing.md +72 -1
- package/package.json +1 -1
- package/vona/packages-cli/cli/package.json +1 -1
- package/vona/packages-cli/cli-set-api/package.json +1 -1
- package/vona/packages-cli/cli-set-api/toolsIsolate/test.ts +26 -13
- package/vona/packages-utils/compose/package.json +1 -1
- package/vona/packages-utils/compose/src/index.ts +19 -11
- package/vona/packages-vona/vona/package.json +1 -1
- package/vona/packages-vona/vona-core/package.json +1 -1
- package/vona/packages-vona/vona-core/src/lib/bean/beanContainer.ts +15 -3
- package/vona/packages-vona/vona-mock/package.json +1 -1
- package/vona/pnpm-lock.yaml +15 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/.metadata/index.ts +8 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/bean/meta.version.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/config/locale/en-us.ts +3 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/config/locale/zh-cn.ts +3 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/dto/skuAttribute.tsx +17 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/entity/sku.tsx +10 -1
- package/vona/src/suite/a-commerce/modules/commerce-catalog/test/catalog.test.ts +1 -1
- package/vona/src/suite/a-commerce/modules/commerce-member/test/addressOwnership.test.ts +6 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/package.json +2 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/.metadata/index.ts +228 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/meta.index.ts +15 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/meta.version.ts +35 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/dto/paymentAttemptView.tsx +26 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/entity/paymentAttempt.tsx +34 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/model/paymentAttempt.ts +10 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/service/paymentAttempt.ts +41 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/test/paymentAttempt.test.ts +33 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/package.json +4 -2
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/.metadata/index.ts +533 -2
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/.metadata/locales.ts +18 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/bean/meta.index.ts +24 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/bean/meta.version.ts +137 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/bean/ssrMenu.couponTemplate.ts +30 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/config/locale/en-us.ts +37 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/config/locale/zh-cn.ts +37 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/controller/coupon.ts +37 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/controller/couponTemplate.ts +65 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponIssue.tsx +22 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponMineItem.tsx +32 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateCreate.tsx +43 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateSelectReq.tsx +28 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateSelectRes.tsx +11 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateSelectResItem.tsx +39 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateUpdate.tsx +19 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateView.tsx +25 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/entity/couponAudit.tsx +73 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/entity/couponGrant.tsx +83 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/entity/couponTemplate.tsx +82 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/index.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/model/couponAudit.ts +10 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/model/couponGrant.ts +10 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/model/couponTemplate.ts +10 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/service/coupon.ts +397 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/service/couponTemplate.ts +52 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/test/couponReservation.test.ts +162 -0
- package/vona/src/suite/a-commerce/modules/commerce-seed/src/bean/meta.version.ts +8 -10
- 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 +277 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/bean/bean.scheduleOrderExpiry.ts +26 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/bean/meta.index.ts +9 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/bean/meta.version.ts +75 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/config/locale/en-us.ts +11 -2
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/config/locale/zh-cn.ts +11 -2
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/controller/checkout.ts +19 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/checkoutCreate.tsx +19 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/checkoutResult.tsx +32 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/orderAddressSnapshot.tsx +33 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/orderCouponSnapshot.tsx +35 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/orderLineSkuAttributeSnapshot.tsx +15 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/entity/order.tsx +90 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/entity/orderAudit.tsx +36 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/entity/orderLine.tsx +52 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/entity/stockReservation.tsx +4 -1
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/model/order.ts +15 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/model/orderAudit.ts +10 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/model/orderLine.ts +10 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/service/order.ts +556 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/service/stockBalance.ts +15 -20
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/cartOwnership.test.ts +8 -3
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/checkoutReservation.test.ts +158 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/orderSnapshot.test.ts +203 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/reservationExpiry.test.ts +163 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/stockBalance.test.ts +11 -6
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/stockReservation.test.ts +11 -6
- package/vona/src/suite-vendor/a-image/modules/image-cloudflare/package.json +1 -1
- package/vona/src/suite-vendor/a-image/modules/image-cloudflare/src/service/imageCloudflare.ts +10 -7
- package/vona/src/suite-vendor/a-image/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-aspect/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-aspect/src/types/aopMethod.ts +16 -3
- package/vona/src/suite-vendor/a-vona/modules/a-core/package.json +4 -2
- package/vona/src/suite-vendor/a-vona/modules/a-core/src/bean/bean.core.ts +6 -0
- package/vona/src/suite-vendor/a-vona/modules/a-core/src/index.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-core/src/lib/core.ts +6 -0
- package/vona/src/suite-vendor/a-vona/modules/a-core/src/types/fetch.ts +7 -0
- package/vona/src/suite-vendor/a-vona/modules/a-core/src/types/index.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-executor/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-executor/src/lib/utils.ts +5 -3
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/package.json +50 -0
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/src/.metadata/index.ts +55 -0
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/src/.metadata/this.ts +2 -0
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/src/bean/aopMethod.retryable.ts +45 -0
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/src/index.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/tsconfig.build.json +11 -0
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/tsconfig.json +7 -0
- package/vona/src/suite-vendor/a-vona/modules/a-vona/package.json +2 -1
- package/vona/src/suite-vendor/a-vona/package.json +2 -1
- package/vona/src/suite-vendor/a-vona/tsconfig.json +3 -0
- package/zova/packages-utils/zova-jsx/package.json +3 -3
- package/zova/packages-zova/zova/package.json +3 -3
- package/zova/packages-zova/zova-core/package.json +2 -2
- package/zova/src/suite/a-commerce/modules/commerce-promotion/cli/openapi.config.ts +9 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/package.json +2 -1
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/.metadata/index.ts +115 -1
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/commercePromotionCoupon.ts +24 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/baseURL.ts +5 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/index.ts +3 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/schemas.ts +478 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/types.ts +8187 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/apiSchema/commercePromotionCoupon.ts +13 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/model/coupon.ts +19 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/cli/openapi.config.ts +1 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/.metadata/index.ts +30 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/commerceTradeCheckout.ts +27 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/schemas.ts +92 -52
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/types.ts +1389 -848
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/apiSchema/commerceTradeCheckout.ts +13 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/model/cart.ts +13 -0
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +3 -3
- package/zova/src/suite-vendor/a-zova/package.json +2 -2
package/vona/src/suite-vendor/a-image/modules/image-cloudflare/src/service/imageCloudflare.ts
CHANGED
|
@@ -162,7 +162,7 @@ export class ServiceImageCloudflare extends BeanBase {
|
|
|
162
162
|
options: IImageProviderCloudflareClientOptions,
|
|
163
163
|
) {
|
|
164
164
|
const normalized = this._normalizeClientOptions(options);
|
|
165
|
-
const response = await fetch(
|
|
165
|
+
const response = await this.bean.core.fetch(
|
|
166
166
|
`${normalized.apiBaseUrl}/accounts/${normalized.accountId}/images/v1/${encodeURIComponent(image.resourceId)}`,
|
|
167
167
|
{
|
|
168
168
|
method: 'DELETE',
|
|
@@ -247,13 +247,16 @@ export class ServiceImageCloudflare extends BeanBase {
|
|
|
247
247
|
apiPath: string,
|
|
248
248
|
init: RequestInit,
|
|
249
249
|
) {
|
|
250
|
-
const response = await fetch(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
...
|
|
254
|
-
|
|
250
|
+
const response = await this.bean.core.fetch(
|
|
251
|
+
`${options.apiBaseUrl}/accounts/${options.accountId}${apiPath}`,
|
|
252
|
+
{
|
|
253
|
+
...init,
|
|
254
|
+
headers: {
|
|
255
|
+
...this._createHeaders(options),
|
|
256
|
+
...(init.headers ?? {}),
|
|
257
|
+
},
|
|
255
258
|
},
|
|
256
|
-
|
|
259
|
+
);
|
|
257
260
|
return await this._parseEnvelope<T>(response);
|
|
258
261
|
}
|
|
259
262
|
|
|
@@ -15,15 +15,28 @@ export interface IUseAopMethodPropMetadataInner<T extends keyof IAopMethodRecord
|
|
|
15
15
|
|
|
16
16
|
export interface IAopMethodRecord {}
|
|
17
17
|
|
|
18
|
+
export type AopMethodNext = Next & {
|
|
19
|
+
replay: Next;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type AopMethodNextSync = NextSync & {
|
|
23
|
+
replay: NextSync;
|
|
24
|
+
};
|
|
25
|
+
|
|
18
26
|
export interface IAopMethodGet {
|
|
19
|
-
get(
|
|
27
|
+
get(
|
|
28
|
+
options: IDecoratorAopMethodOptions,
|
|
29
|
+
next: AopMethodNextSync,
|
|
30
|
+
receiver: any,
|
|
31
|
+
prop: string,
|
|
32
|
+
): any;
|
|
20
33
|
}
|
|
21
34
|
|
|
22
35
|
export interface IAopMethodSet {
|
|
23
36
|
set(
|
|
24
37
|
options: IDecoratorAopMethodOptions,
|
|
25
38
|
value: any,
|
|
26
|
-
next:
|
|
39
|
+
next: AopMethodNextSync,
|
|
27
40
|
receiver: any,
|
|
28
41
|
prop: string,
|
|
29
42
|
): boolean;
|
|
@@ -33,7 +46,7 @@ export interface IAopMethodExecute {
|
|
|
33
46
|
execute(
|
|
34
47
|
options: IDecoratorAopMethodOptions,
|
|
35
48
|
args: [],
|
|
36
|
-
next:
|
|
49
|
+
next: AopMethodNext | AopMethodNextSync,
|
|
37
50
|
receiver: any,
|
|
38
51
|
prop: string,
|
|
39
52
|
): Promise<any> | any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-module-a-core",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.45",
|
|
4
4
|
"gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -84,7 +84,9 @@
|
|
|
84
84
|
},
|
|
85
85
|
"title": "a-core",
|
|
86
86
|
"vonaModule": {
|
|
87
|
-
"dependencies": {
|
|
87
|
+
"dependencies": {
|
|
88
|
+
"a-retryable": "5.0.0"
|
|
89
|
+
},
|
|
88
90
|
"globalDependencies": {
|
|
89
91
|
"@babel/core": true,
|
|
90
92
|
"@babel/traverse": true,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BeanBase } from 'vona';
|
|
2
2
|
import { Bean } from 'vona-module-a-bean';
|
|
3
3
|
|
|
4
|
+
import type { TypeContextFetch } from '../types/fetch.ts';
|
|
5
|
+
|
|
4
6
|
@Bean()
|
|
5
7
|
export class BeanCore extends BeanBase {
|
|
6
8
|
get protocol() {
|
|
@@ -11,6 +13,10 @@ export class BeanCore extends BeanBase {
|
|
|
11
13
|
return this.app.util.host;
|
|
12
14
|
}
|
|
13
15
|
|
|
16
|
+
get fetch(): TypeContextFetch {
|
|
17
|
+
return this.ctx.state.fetch ?? globalThis.fetch;
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
getAbsoluteUrl(path?: string) {
|
|
15
21
|
return this.app.util.getAbsoluteUrl(path);
|
|
16
22
|
}
|
|
@@ -3,6 +3,7 @@ import type { IFilterOptionsError } from 'vona-module-a-error';
|
|
|
3
3
|
import type { IAopMethodOptionsLog } from 'vona-module-a-logger';
|
|
4
4
|
import type { TypeUseOnionOmitOptionsGlobal } from 'vona-module-a-onion';
|
|
5
5
|
import type { IAopMethodOptionsTransaction } from 'vona-module-a-orm';
|
|
6
|
+
import type { IAopMethodOptionsRetryable } from 'vona-module-a-retryable';
|
|
6
7
|
import type { IInterceptorOptionsUpload } from 'vona-module-a-upload';
|
|
7
8
|
|
|
8
9
|
import { Aspect } from 'vona-module-a-aspect';
|
|
@@ -29,6 +30,10 @@ function Transaction(options?: Partial<IAopMethodOptionsTransaction>): MethodDec
|
|
|
29
30
|
return Aspect.aopMethod('a-orm:transaction', options);
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
function Retryable(options: IAopMethodOptionsRetryable): MethodDecorator {
|
|
34
|
+
return Aspect.aopMethod('a-retryable:retryable', options);
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
function CaptchaVerify(options?: Partial<IInterceptorOptionsCaptchaVerify>): MethodDecorator {
|
|
33
38
|
return Aspect.interceptor('a-captcha:captchaVerify', options);
|
|
34
39
|
}
|
|
@@ -46,6 +51,7 @@ export const Core = {
|
|
|
46
51
|
error: Error,
|
|
47
52
|
log: Log,
|
|
48
53
|
transaction: Transaction,
|
|
54
|
+
retryable: Retryable,
|
|
49
55
|
captchaVerify: CaptchaVerify,
|
|
50
56
|
fileUpload: FileUpload,
|
|
51
57
|
serializer: Serializer,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fetch.ts';
|
|
@@ -2,9 +2,11 @@ export function __delegateProperties(ctx, ctxCaller) {
|
|
|
2
2
|
for (const property of ['state']) {
|
|
3
3
|
__delegateProperty(ctx, ctxCaller, property);
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
if (ctxCaller.request) {
|
|
6
|
+
for (const property of ['headers']) {
|
|
7
|
+
__delegateProperty(ctx.request, ctxCaller.request, property);
|
|
8
|
+
// if (ctx.request[property]) req[property] = ctx.request[property];
|
|
9
|
+
}
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
12
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vona-module-a-retryable",
|
|
3
|
+
"version": "5.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Vona Module"
|
|
7
|
+
],
|
|
8
|
+
"author": "",
|
|
9
|
+
"files": [
|
|
10
|
+
"assets",
|
|
11
|
+
"dist",
|
|
12
|
+
"src"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": [
|
|
18
|
+
"./src/index.ts",
|
|
19
|
+
"./dist/index.d.ts"
|
|
20
|
+
],
|
|
21
|
+
"import": "./src/index.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"clean": "rimraf dist tsconfig.build.tsbuildinfo",
|
|
28
|
+
"tsc:publish": "npm run clean && node ../../../../../packages-cli/cli/src/bin/vona.ts :bin:buildModule --sourcemap && tsc -p tsconfig.build.json",
|
|
29
|
+
"prepublishOnly": "npm run tsc:publish",
|
|
30
|
+
"prepack": "clean-package",
|
|
31
|
+
"postpack": "clean-package restore"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"clean-package": "^2.2.0",
|
|
36
|
+
"rimraf": "^6.1.3"
|
|
37
|
+
},
|
|
38
|
+
"clean-package": {
|
|
39
|
+
"indent": 2,
|
|
40
|
+
"remove": [
|
|
41
|
+
"clean-package",
|
|
42
|
+
"devDependencies",
|
|
43
|
+
"exports.\\..import"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"title": "a-retryable",
|
|
47
|
+
"vonaModule": {
|
|
48
|
+
"dependencies": {}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// eslint-disable
|
|
2
|
+
/** aopMethod: begin */
|
|
3
|
+
export * from '../bean/aopMethod.retryable.ts';
|
|
4
|
+
import type { IAopMethodOptionsRetryable } from '../bean/aopMethod.retryable.ts';
|
|
5
|
+
import 'vona-module-a-aspect';
|
|
6
|
+
declare module 'vona-module-a-aspect' {
|
|
7
|
+
|
|
8
|
+
export interface IAopMethodRecord {
|
|
9
|
+
'a-retryable:retryable': IAopMethodOptionsRetryable;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
declare module 'vona-module-a-retryable' {
|
|
15
|
+
|
|
16
|
+
export interface AopMethodRetryable {
|
|
17
|
+
/** @internal */
|
|
18
|
+
get scope(): ScopeModuleARetryable;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface AopMethodRetryable {
|
|
22
|
+
get $beanFullName(): 'a-retryable.aopMethod.retryable';
|
|
23
|
+
get $onionName(): 'a-retryable:retryable';
|
|
24
|
+
get $onionOptions(): IAopMethodOptionsRetryable;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** aopMethod: end */
|
|
28
|
+
/** scope: begin */
|
|
29
|
+
import { BeanScopeBase, type BeanScopeUtil } from 'vona';
|
|
30
|
+
import { Scope } from 'vona-module-a-bean';
|
|
31
|
+
|
|
32
|
+
@Scope()
|
|
33
|
+
export class ScopeModuleARetryable extends BeanScopeBase {}
|
|
34
|
+
|
|
35
|
+
export interface ScopeModuleARetryable {
|
|
36
|
+
util: BeanScopeUtil;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
import 'vona';
|
|
40
|
+
declare module 'vona' {
|
|
41
|
+
export interface IBeanScopeRecord {
|
|
42
|
+
'a-retryable': ScopeModuleARetryable;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface IBeanScopeContainer {
|
|
46
|
+
retryable: ScopeModuleARetryable;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
/** scope: end */
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AopMethodNext,
|
|
3
|
+
IAopMethodExecute,
|
|
4
|
+
IDecoratorAopMethodOptions,
|
|
5
|
+
} from 'vona-module-a-aspect';
|
|
6
|
+
|
|
7
|
+
import { BeanAopMethodBase, Retry } from 'vona';
|
|
8
|
+
import { AopMethod } from 'vona-module-a-aspect';
|
|
9
|
+
|
|
10
|
+
export interface IAopMethodOptionsRetryable extends IDecoratorAopMethodOptions, Retry.WrapOptions {
|
|
11
|
+
errorCodes: string[];
|
|
12
|
+
ownerOnly?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@AopMethod<IAopMethodOptionsRetryable>()
|
|
16
|
+
export class AopMethodRetryable extends BeanAopMethodBase implements IAopMethodExecute {
|
|
17
|
+
async execute(
|
|
18
|
+
options: IAopMethodOptionsRetryable,
|
|
19
|
+
_args: [],
|
|
20
|
+
next: AopMethodNext,
|
|
21
|
+
_receiver: any,
|
|
22
|
+
_prop: string,
|
|
23
|
+
): Promise<any> {
|
|
24
|
+
if (options.ownerOnly && this.bean.database.current.transaction.inTransaction) {
|
|
25
|
+
return await next.replay();
|
|
26
|
+
}
|
|
27
|
+
const operation = Retry.operation(options);
|
|
28
|
+
return await new Promise((resolve, reject) => {
|
|
29
|
+
operation.attempt(() => {
|
|
30
|
+
next
|
|
31
|
+
.replay()
|
|
32
|
+
.then(resolve)
|
|
33
|
+
.catch(error => {
|
|
34
|
+
if (this._shouldRetry(error, options) && operation.retry(error)) return;
|
|
35
|
+
reject(error);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private _shouldRetry(error: unknown, options: IAopMethodOptionsRetryable) {
|
|
42
|
+
const code = (error as { code?: unknown })?.code;
|
|
43
|
+
return typeof code === 'string' && options.errorCodes?.includes(code) === true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './.metadata/index.ts';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-module-a-vona",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.13",
|
|
4
4
|
"gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"a-queue": "5.0.0",
|
|
85
85
|
"a-redis": "5.0.0",
|
|
86
86
|
"a-redlock": "5.0.0",
|
|
87
|
+
"a-retryable": "5.0.0",
|
|
87
88
|
"a-runtime": "5.0.0",
|
|
88
89
|
"a-schedule": "5.0.0",
|
|
89
90
|
"a-security": "5.0.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-suite-a-vona",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.72",
|
|
4
4
|
"gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"vona-module-a-queue": "workspace:^",
|
|
45
45
|
"vona-module-a-redis": "workspace:^",
|
|
46
46
|
"vona-module-a-redlock": "workspace:^",
|
|
47
|
+
"vona-module-a-retryable": "workspace:^",
|
|
47
48
|
"vona-module-a-runtime": "workspace:^",
|
|
48
49
|
"vona-module-a-schedule": "workspace:^",
|
|
49
50
|
"vona-module-a-security": "workspace:^",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-jsx",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.79",
|
|
4
4
|
"gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
|
|
5
5
|
"description": "Zova JSX",
|
|
6
6
|
"keywords": [
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"postpack": "clean-package restore"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@cabloy/compose": "^2.1.
|
|
48
|
+
"@cabloy/compose": "^2.1.9",
|
|
49
49
|
"@cabloy/utils": "^2.1.26",
|
|
50
50
|
"@cabloy/word-utils": "^2.1.14",
|
|
51
51
|
"typestyle": "^2.4.0",
|
|
52
52
|
"vue": "^3.5.38",
|
|
53
|
-
"zova-core": "^5.1.
|
|
53
|
+
"zova-core": "^5.1.79"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"clean-package": "^2.2.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.140",
|
|
4
4
|
"gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
|
|
5
5
|
"description": "A vue3 framework with ioc",
|
|
6
6
|
"keywords": [
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"postpack": "clean-package restore"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"zova-core": "^5.1.
|
|
49
|
-
"zova-suite-a-zova": "^5.1.
|
|
48
|
+
"zova-core": "^5.1.79",
|
|
49
|
+
"zova-suite-a-zova": "^5.1.139"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"clean-package": "^2.2.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-core",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.79",
|
|
4
4
|
"gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
|
|
5
5
|
"description": "A vue3 framework with ioc",
|
|
6
6
|
"keywords": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"postpack": "clean-package restore"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@cabloy/compose": "^2.1.
|
|
49
|
+
"@cabloy/compose": "^2.1.9",
|
|
50
50
|
"@cabloy/extend": "^3.2.8",
|
|
51
51
|
"@cabloy/json5": "^1.1.9",
|
|
52
52
|
"@cabloy/localeutil": "^2.1.8",
|
|
@@ -1,4 +1,116 @@
|
|
|
1
1
|
// eslint-disable
|
|
2
|
+
/** model: begin */
|
|
3
|
+
export * from '../model/coupon.js';
|
|
4
|
+
import { IModelOptionsCoupon } from '../model/coupon.js';
|
|
5
|
+
import 'zova-module-a-model';
|
|
6
|
+
declare module 'zova-module-a-model' {
|
|
7
|
+
|
|
8
|
+
export interface IModelRecord {
|
|
9
|
+
'commerce-promotion:coupon': IModelOptionsCoupon;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
declare module 'zova-module-commerce-promotion' {
|
|
15
|
+
|
|
16
|
+
export interface ModelCoupon {
|
|
17
|
+
/** @internal */
|
|
18
|
+
get scope(): ScopeModuleCommercePromotion;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ModelCoupon {
|
|
22
|
+
get $beanFullName(): 'commerce-promotion.model.coupon';
|
|
23
|
+
get $onionName(): 'commerce-promotion:coupon';
|
|
24
|
+
get $onionOptions(): IModelOptionsCoupon;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** model: end */
|
|
28
|
+
/** model: begin */
|
|
29
|
+
import { ModelCoupon } from '../model/coupon.js';
|
|
30
|
+
import 'zova';
|
|
31
|
+
declare module 'zova' {
|
|
32
|
+
export interface IBeanRecordGeneral {
|
|
33
|
+
'commerce-promotion.model.coupon': ModelCoupon;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** model: end */
|
|
37
|
+
/** api: begin */
|
|
38
|
+
export * from '../api/commercePromotionCoupon.js';
|
|
39
|
+
|
|
40
|
+
import 'zova';
|
|
41
|
+
declare module 'zova' {
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
declare module 'zova-module-commerce-promotion' {
|
|
46
|
+
|
|
47
|
+
export interface ApiCommercePromotionCoupon {
|
|
48
|
+
/** @internal */
|
|
49
|
+
get scope(): ScopeModuleCommercePromotion;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ApiCommercePromotionCoupon {
|
|
53
|
+
get $beanFullName(): 'commerce-promotion.api.commercePromotionCoupon';
|
|
54
|
+
get $onionName(): 'commerce-promotion:commercePromotionCoupon';
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** api: end */
|
|
59
|
+
/** api: begin */
|
|
60
|
+
import { ApiCommercePromotionCoupon } from '../api/commercePromotionCoupon.js';
|
|
61
|
+
export interface IModuleApi {
|
|
62
|
+
'commercePromotionCoupon': ApiCommercePromotionCoupon;
|
|
63
|
+
}
|
|
64
|
+
/** api: end */
|
|
65
|
+
/** api: begin */
|
|
66
|
+
|
|
67
|
+
import 'zova';
|
|
68
|
+
declare module 'zova' {
|
|
69
|
+
export interface IBeanRecordGeneral {
|
|
70
|
+
'commerce-promotion.api.commercePromotionCoupon': ApiCommercePromotionCoupon;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** api: end */
|
|
74
|
+
/** openapi: begin */
|
|
75
|
+
export * from '../api/openapi/index.js';
|
|
76
|
+
/** openapi: end */
|
|
77
|
+
/** apiSchema: begin */
|
|
78
|
+
export * from '../apiSchema/commercePromotionCoupon.js';
|
|
79
|
+
|
|
80
|
+
import 'zova';
|
|
81
|
+
declare module 'zova' {
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
declare module 'zova-module-commerce-promotion' {
|
|
86
|
+
|
|
87
|
+
export interface ApiSchemaCommercePromotionCoupon {
|
|
88
|
+
/** @internal */
|
|
89
|
+
get scope(): ScopeModuleCommercePromotion;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface ApiSchemaCommercePromotionCoupon {
|
|
93
|
+
get $beanFullName(): 'commerce-promotion.apiSchema.commercePromotionCoupon';
|
|
94
|
+
get $onionName(): 'commerce-promotion:commercePromotionCoupon';
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** apiSchema: end */
|
|
99
|
+
/** apiSchema: begin */
|
|
100
|
+
import { ApiSchemaCommercePromotionCoupon } from '../apiSchema/commercePromotionCoupon.js';
|
|
101
|
+
export interface IModuleApiSchema {
|
|
102
|
+
'commercePromotionCoupon': ApiSchemaCommercePromotionCoupon;
|
|
103
|
+
}
|
|
104
|
+
/** apiSchema: end */
|
|
105
|
+
/** apiSchema: begin */
|
|
106
|
+
|
|
107
|
+
import 'zova';
|
|
108
|
+
declare module 'zova' {
|
|
109
|
+
export interface IBeanRecordGeneral {
|
|
110
|
+
'commerce-promotion.apiSchema.commercePromotionCoupon': ApiSchemaCommercePromotionCoupon;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** apiSchema: end */
|
|
2
114
|
/** scope: begin */
|
|
3
115
|
import { BeanScopeBase, type BeanScopeUtil } from 'zova';
|
|
4
116
|
import { Scope } from 'zova-module-a-bean';
|
|
@@ -8,6 +120,8 @@ export class ScopeModuleCommercePromotion extends BeanScopeBase {}
|
|
|
8
120
|
|
|
9
121
|
export interface ScopeModuleCommercePromotion {
|
|
10
122
|
util: BeanScopeUtil;
|
|
123
|
+
api: IModuleApi;
|
|
124
|
+
apiSchema: IModuleApiSchema;
|
|
11
125
|
}
|
|
12
126
|
|
|
13
127
|
import 'zova';
|
|
@@ -22,5 +136,5 @@ declare module 'zova' {
|
|
|
22
136
|
|
|
23
137
|
|
|
24
138
|
}
|
|
25
|
-
|
|
139
|
+
|
|
26
140
|
/** scope: end */
|
package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/commercePromotionCoupon.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IApiActionOptions } from 'zova-module-a-api';
|
|
2
|
+
|
|
3
|
+
import { Api, BeanApiBase } from 'zova-module-a-api';
|
|
4
|
+
|
|
5
|
+
import type { paths } from './openapi/index.js';
|
|
6
|
+
|
|
7
|
+
import { OpenApiBaseURL } from './openapi/index.js';
|
|
8
|
+
|
|
9
|
+
/** CommercePromotionCoupon_mine */
|
|
10
|
+
export const ApiApiCommercePromotionCouponminePath = '/api/commerce/promotion/coupon/mine';
|
|
11
|
+
export type ApiApiCommercePromotionCouponminePath = '/api/commerce/promotion/coupon/mine';
|
|
12
|
+
export type ApiApiCommercePromotionCouponmineMethod = 'get';
|
|
13
|
+
export type ApiApiCommercePromotionCouponmineResponseBody =
|
|
14
|
+
paths[ApiApiCommercePromotionCouponminePath][ApiApiCommercePromotionCouponmineMethod]['responses']['200']['content']['application/json']['data'];
|
|
15
|
+
|
|
16
|
+
@Api()
|
|
17
|
+
export class ApiCommercePromotionCoupon extends BeanApiBase {
|
|
18
|
+
mine(options?: IApiActionOptions) {
|
|
19
|
+
return this.$fetch.get<any, ApiApiCommercePromotionCouponmineResponseBody>(
|
|
20
|
+
ApiApiCommercePromotionCouponminePath,
|
|
21
|
+
this.$configPrepare(OpenApiBaseURL(this.sys), options, true),
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|