cabloy 5.1.140 → 5.1.141

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 (62) hide show
  1. package/.cabloy-version +1 -1
  2. package/CHANGELOG.md +11 -0
  3. package/cabloy-docs/fullstack/framework-performance.md +3 -3
  4. package/e2e/specs/a-commerce/commerce.spec.ts +3 -3
  5. package/e2e/specs/cabloy-basic/basic.spec.ts +6 -8
  6. package/package.json +1 -1
  7. package/vona/pnpm-lock.yaml +71 -628
  8. package/zova/packages-zova/zova/package.json +2 -2
  9. package/zova/src/suite/a-commerce/modules/commerce-catalog/src/api/openapi/schemas.ts +0 -11
  10. package/zova/src/suite/a-commerce/modules/commerce-catalog/src/api/openapi/types.ts +23 -170
  11. package/zova/src/suite/a-commerce/modules/commerce-member/src/api/openapi/schemas.ts +0 -11
  12. package/zova/src/suite/a-commerce/modules/commerce-member/src/api/openapi/types.ts +23 -170
  13. package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/schemas.ts +0 -11
  14. package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/types.ts +23 -170
  15. package/zova/src/suite/a-commerce/modules/commerce-siteadmin/src/api/openapi/schemas.ts +0 -11
  16. package/zova/src/suite/a-commerce/modules/commerce-siteadmin/src/api/openapi/types.ts +23 -170
  17. package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/schemas.ts +0 -11
  18. package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/types.ts +23 -170
  19. package/zova/src/suite/a-home/modules/home-api/src/api/openapi/schemas.ts +0 -11
  20. package/zova/src/suite/a-home/modules/home-api/src/api/openapi/types.ts +23 -170
  21. package/zova/src/suite/a-training/modules/training-student/src/api/openapi/schemas.ts +0 -11
  22. package/zova/src/suite/a-training/modules/training-student/src/api/openapi/types.ts +23 -170
  23. package/zova/src/suite/cabloy-basic/modules/basic-file/src/api/openapi/schemas.ts +0 -11
  24. package/zova/src/suite/cabloy-basic/modules/basic-file/src/api/openapi/types.ts +23 -170
  25. package/zova/src/suite/cabloy-basic/modules/basic-image/src/api/openapi/schemas.ts +0 -11
  26. package/zova/src/suite/cabloy-basic/modules/basic-image/src/api/openapi/types.ts +23 -170
  27. package/zova/src/suite-vendor/a-pay/modules/a-pay/package.json +1 -1
  28. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/schemas.ts +0 -11
  29. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/types.ts +23 -170
  30. package/zova/src/suite-vendor/a-pay/modules/pay-mock/package.json +1 -1
  31. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/schemas.ts +0 -11
  32. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/types.ts +23 -170
  33. package/zova/src/suite-vendor/a-pay/package.json +3 -3
  34. package/zova/src/suite-vendor/a-zova/modules/a-ssrserver/package.json +1 -1
  35. package/zova/src/suite-vendor/a-zova/modules/a-ssrserver/src/service/ssrHandler.ts +1 -1
  36. package/zova/src/suite-vendor/a-zova/package.json +2 -2
  37. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/package.json +0 -56
  38. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/.metadata/index.ts +0 -404
  39. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/.metadata/locales.ts +0 -18
  40. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/.metadata/this.ts +0 -2
  41. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/bean/bean.paypal.ts +0 -99
  42. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/bean/event.paypalCancelOrder.ts +0 -15
  43. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/bean/event.paypalCaptureOrder.ts +0 -22
  44. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/bean/meta.version.ts +0 -24
  45. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/config/config.ts +0 -14
  46. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/config/errors.ts +0 -3
  47. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/config/locale/en-us.ts +0 -3
  48. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/config/locale/zh-cn.ts +0 -3
  49. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/controller/paypal.ts +0 -39
  50. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/dto/paypalOrderRecordOptions.tsx +0 -31
  51. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/dto/paypalOrderRecordPayload.tsx +0 -18
  52. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/entity/paypalRecord.tsx +0 -30
  53. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/index.ts +0 -3
  54. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/model/paypalRecord.ts +0 -10
  55. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/service/paypal.ts +0 -83
  56. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/types/index.ts +0 -1
  57. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/types/paypal.ts +0 -18
  58. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/tsconfig.build.json +0 -11
  59. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/tsconfig.json +0 -7
  60. package/vona/src/suite-vendor/a-paypal/package.json +0 -13
  61. package/vona/src/suite-vendor/a-paypal/tsconfig.base.json +0 -4
  62. package/vona/src/suite-vendor/a-paypal/tsconfig.json +0 -10
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "zova-suite-a-pay",
3
- "version": "5.0.4",
3
+ "version": "5.0.5",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "files": [],
7
7
  "type": "module",
8
8
  "dependencies": {
9
- "zova-module-a-pay": "^5.0.5",
10
- "zova-module-pay-mock": "^5.0.3",
9
+ "zova-module-a-pay": "^5.0.6",
10
+ "zova-module-pay-mock": "^5.0.4",
11
11
  "zova-module-pay-paypal": "^5.0.2",
12
12
  "zova-module-pay-stripe": "^5.0.2"
13
13
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-module-a-ssrserver",
3
- "version": "5.1.25",
3
+ "version": "5.1.26",
4
4
  "gitHead": "09d901d17140a80ee0764211b441cda72fd94663",
5
5
  "description": "",
6
6
  "keywords": [
@@ -294,7 +294,7 @@ export class ServiceSsrHandler extends BeanBase {
294
294
  typeof responseCacheExpires === 'string'
295
295
  ? ms(responseCacheExpires) / 1000
296
296
  : responseCacheExpires;
297
- if (expires === 0) {
297
+ if (expires === 0 || this.sys.env.META_MODE === 'development') {
298
298
  res.setHeader('cache-control', 'no-cache, no-store, must-revalidate');
299
299
  } else {
300
300
  res.setHeader('cache-control', `public, max-age=${expires}`);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-suite-a-zova",
3
- "version": "5.1.149",
3
+ "version": "5.1.150",
4
4
  "gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
5
5
  "description": "zova",
6
6
  "license": "MIT",
@@ -28,7 +28,7 @@
28
28
  "zova-module-a-routertabs": "^5.1.34",
29
29
  "zova-module-a-ssr": "^5.1.37",
30
30
  "zova-module-a-ssrhmr": "^5.1.23",
31
- "zova-module-a-ssrserver": "^5.1.25",
31
+ "zova-module-a-ssrserver": "^5.1.26",
32
32
  "zova-module-a-style": "^5.1.35",
33
33
  "zova-module-a-table": "^5.1.38",
34
34
  "zova-module-a-zod": "^5.1.37",
@@ -1,56 +0,0 @@
1
- {
2
- "name": "vona-module-a-paypal",
3
- "version": "5.1.15",
4
- "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
5
- "description": "",
6
- "keywords": [
7
- "Vona Module"
8
- ],
9
- "author": "",
10
- "files": [
11
- "assets",
12
- "dist",
13
- "src"
14
- ],
15
- "type": "module",
16
- "exports": {
17
- ".": {
18
- "types": [
19
- "./src/index.ts",
20
- "./dist/index.d.ts"
21
- ],
22
- "import": "./src/index.ts",
23
- "default": "./dist/index.js"
24
- },
25
- "./package.json": "./package.json"
26
- },
27
- "scripts": {
28
- "clean": "rimraf dist tsconfig.build.tsbuildinfo",
29
- "tsc:publish": "npm run clean && node ../../../../../packages-cli/cli/src/bin/vona.ts :bin:buildModule --sourcemap && tsc -p tsconfig.build.json",
30
- "prepublishOnly": "npm run tsc:publish",
31
- "prepack": "clean-package",
32
- "postpack": "clean-package restore"
33
- },
34
- "dependencies": {
35
- "@cabloy/paypal-server-sdk": "^2.2.0"
36
- },
37
- "devDependencies": {
38
- "clean-package": "^2.2.0",
39
- "rimraf": "^6.1.3"
40
- },
41
- "clean-package": {
42
- "indent": 2,
43
- "remove": [
44
- "clean-package",
45
- "devDependencies",
46
- "exports.\\..import"
47
- ]
48
- },
49
- "title": "a-paypal",
50
- "vonaModule": {
51
- "dependencies": {
52
- "a-vona": "5.0.0"
53
- },
54
- "fileVersion": 1
55
- }
56
- }
@@ -1,404 +0,0 @@
1
- // eslint-disable
2
- import type { TypeEntityMeta,TypeModelsClassLikeGeneral,TypeSymbolKeyFieldsMore } from 'vona-module-a-orm';
3
- import type { TypeEntityOptionsFields,TypeControllerOptionsActions } from 'vona-module-a-openapi';
4
- import type { TableIdentity } from 'table-identity';
5
- /** entity: begin */
6
- export * from '../entity/paypalRecord.tsx';
7
- import type { IEntityOptionsPaypalRecord } from '../entity/paypalRecord.tsx';
8
- import 'vona-module-a-orm';
9
- declare module 'vona-module-a-orm' {
10
-
11
- export interface IEntityRecord {
12
- 'a-paypal:paypalRecord': IEntityOptionsPaypalRecord;
13
- }
14
-
15
-
16
- }
17
- declare module 'vona-module-a-paypal' {
18
-
19
- }
20
- /** entity: end */
21
- /** entity: begin */
22
- import type { EntityPaypalRecord } from '../entity/paypalRecord.tsx';
23
- export interface IModuleEntity {
24
- 'paypalRecord': EntityPaypalRecordMeta;
25
- }
26
- /** entity: end */
27
- /** entity: begin */
28
- export type EntityPaypalRecordTableName = 'paypalRecord';
29
- export type EntityPaypalRecordMeta=TypeEntityMeta<EntityPaypalRecord,EntityPaypalRecordTableName>;
30
- declare module 'vona-module-a-orm' {
31
- export interface ITableRecord {
32
- 'paypalRecord': EntityPaypalRecordMeta;
33
- }
34
- }
35
- declare module 'vona-module-a-paypal' {
36
-
37
- export interface IEntityOptionsPaypalRecord {
38
- fields?: TypeEntityOptionsFields<EntityPaypalRecord, IEntityOptionsPaypalRecord[TypeSymbolKeyFieldsMore]>;
39
- }
40
- }
41
- /** entity: end */
42
- /** model: begin */
43
- export * from '../model/paypalRecord.ts';
44
- import type { IModelOptionsPaypalRecord } from '../model/paypalRecord.ts';
45
- import 'vona-module-a-orm';
46
- declare module 'vona-module-a-orm' {
47
-
48
- export interface IModelRecord {
49
- 'a-paypal:paypalRecord': IModelOptionsPaypalRecord;
50
- }
51
-
52
-
53
- }
54
- declare module 'vona-module-a-paypal' {
55
-
56
- export interface ModelPaypalRecord {
57
- /** @internal */
58
- get scope(): ScopeModuleAPaypal;
59
- }
60
-
61
- export interface ModelPaypalRecord {
62
- get $beanFullName(): 'a-paypal.model.paypalRecord';
63
- get $onionName(): 'a-paypal:paypalRecord';
64
- get $onionOptions(): IModelOptionsPaypalRecord;
65
- }
66
- }
67
- /** model: end */
68
- /** model: begin */
69
- import type { ModelPaypalRecord } from '../model/paypalRecord.ts';
70
- export interface IModuleModel {
71
- 'paypalRecord': ModelPaypalRecord;
72
- }
73
- /** model: end */
74
- /** model: begin */
75
-
76
- import 'vona';
77
- declare module 'vona' {
78
- export interface IBeanRecordGeneral {
79
- 'a-paypal.model.paypalRecord': ModelPaypalRecord;
80
- }
81
- }
82
- /** model: end */
83
- /** model: begin */
84
- import type { IModelGetOptions, IModelMethodOptions, IModelSelectParams, TypeModelSelectAndCount, TypeModelRelationResult, TypeModelWhere, IModelInsertOptions, TypeModelMutateRelationData, IModelDeleteOptions, IModelUpdateOptions, IModelMutateOptions, IModelSelectCountParams, IModelIncrementParams, IModelSelectAggrParams, TypeModelAggrRelationResult, IModelSelectGroupParams, TypeModelGroupRelationResult } from 'vona-module-a-orm';
85
- import { SymbolKeyEntity, SymbolKeyEntityMeta, SymbolKeyModelOptions } from 'vona-module-a-orm';
86
- declare module 'vona-module-a-paypal' {
87
-
88
- export interface ModelPaypalRecord {
89
- [SymbolKeyEntity]: EntityPaypalRecord;
90
- [SymbolKeyEntityMeta]: EntityPaypalRecordMeta;
91
- [SymbolKeyModelOptions]: IModelOptionsPaypalRecord;
92
- get<T extends IModelGetOptions<EntityPaypalRecord,ModelPaypalRecord>>(where: TypeModelWhere<EntityPaypalRecord>, options?: T): Promise<TypeModelRelationResult<EntityPaypalRecord, ModelPaypalRecord, T> | undefined>;
93
- /**
94
- * Retrieves one matching primary row with a pessimistic FOR UPDATE lock.
95
- * Requires an active transaction. The lock is released when that transaction completes.
96
- * Entity and query caches are bypassed.
97
- */
98
- getForUpdate<T extends IModelGetOptions<EntityPaypalRecord,ModelPaypalRecord>>(where: TypeModelWhere<EntityPaypalRecord>, options?: T): Promise<TypeModelRelationResult<EntityPaypalRecord, ModelPaypalRecord, T> | undefined>;
99
- /**
100
- * Retrieves a primary row by ID with the same pessimistic FOR UPDATE lock semantics.
101
- * Requires an active transaction. The lock is released when that transaction completes.
102
- * Entity and query caches are bypassed.
103
- */
104
- getByIdForUpdate<T extends IModelGetOptions<EntityPaypalRecord,ModelPaypalRecord>>(id: TableIdentity, options?: T): Promise<TypeModelRelationResult<EntityPaypalRecord, ModelPaypalRecord, T> | undefined>;
105
- mget<T extends IModelGetOptions<EntityPaypalRecord,ModelPaypalRecord>>(ids: TableIdentity[], options?: T): Promise<TypeModelRelationResult<EntityPaypalRecord, ModelPaypalRecord, T>[]>;
106
- selectAndCount<T extends IModelSelectParams<EntityPaypalRecord,ModelPaypalRecord,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<TypeModelSelectAndCount<EntityPaypalRecord, ModelPaypalRecord, T>>;
107
- select<T extends IModelSelectParams<EntityPaypalRecord,ModelPaypalRecord,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<TypeModelRelationResult<EntityPaypalRecord, ModelPaypalRecord, T>[]>;
108
- insert<T extends IModelInsertOptions<EntityPaypalRecord,ModelPaypalRecord>>(data?: TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T>, options?: T): Promise<TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T, true>>;
109
- insertBulk<T extends IModelInsertOptions<EntityPaypalRecord,ModelPaypalRecord>>(items: TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T>[], options?: T): Promise<TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T, true>[]>;
110
- update<T extends IModelUpdateOptions<EntityPaypalRecord,ModelPaypalRecord>>(data: TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T>, options?: T): Promise<TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T>>;
111
- updateBulk<T extends IModelUpdateOptions<EntityPaypalRecord,ModelPaypalRecord>>(items: TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T>[], options?: T): Promise<TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T>[]>;
112
- delete<T extends IModelDeleteOptions<EntityPaypalRecord,ModelPaypalRecord>>(where?: TypeModelWhere<EntityPaypalRecord>, options?: T): Promise<void>;
113
- deleteBulk<T extends IModelDeleteOptions<EntityPaypalRecord,ModelPaypalRecord>>(ids: TableIdentity[], options?: T): Promise<void>;
114
- mutate<T extends IModelMutateOptions<EntityPaypalRecord,ModelPaypalRecord>>(data?: TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T>, options?: T): Promise<TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T>>;
115
- mutateBulk<T extends IModelMutateOptions<EntityPaypalRecord,ModelPaypalRecord>>(items: TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T>[], options?: T): Promise<TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T>[]>;
116
- count<T extends IModelSelectCountParams<EntityPaypalRecord,ModelPaypalRecord,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<string | undefined>;
117
- increment<T extends IModelIncrementParams<EntityPaypalRecord,ModelPaypalRecord,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<number>;
118
- decrement<T extends IModelIncrementParams<EntityPaypalRecord,ModelPaypalRecord,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<number>;
119
- aggregate<T extends IModelSelectAggrParams<EntityPaypalRecord,ModelPaypalRecord,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<TypeModelAggrRelationResult<T>>;
120
- group<T extends IModelSelectGroupParams<EntityPaypalRecord,ModelPaypalRecord,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<TypeModelGroupRelationResult<EntityPaypalRecord, T>[]>;
121
- getById<T extends IModelGetOptions<EntityPaypalRecord,ModelPaypalRecord>>(id: TableIdentity, options?: T): Promise<TypeModelRelationResult<EntityPaypalRecord, ModelPaypalRecord, T> | undefined>;
122
- updateById<T extends IModelUpdateOptions<EntityPaypalRecord,ModelPaypalRecord>>(id: TableIdentity, data: TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T>, options?: T): Promise<TypeModelMutateRelationData<EntityPaypalRecord,ModelPaypalRecord, T>>;
123
- deleteById<T extends IModelDeleteOptions<EntityPaypalRecord,ModelPaypalRecord>>(id: TableIdentity, options?: T): Promise<void>;
124
- }
125
- }
126
- declare module 'vona-module-a-orm' {
127
- export interface IModelClassRecord {
128
- 'a-paypal:paypalRecord': ModelPaypalRecord;
129
- }
130
- }
131
- /** model: end */
132
- /** bean: begin */
133
- export * from '../bean/bean.paypal.ts';
134
-
135
- import 'vona';
136
- declare module 'vona' {
137
-
138
-
139
- }
140
- declare module 'vona-module-a-paypal' {
141
-
142
- export interface BeanPaypal {
143
- /** @internal */
144
- get scope(): ScopeModuleAPaypal;
145
- }
146
- }
147
- /** bean: end */
148
- /** bean: begin */
149
- import type { BeanPaypal } from '../bean/bean.paypal.ts';
150
- import 'vona';
151
- declare module 'vona' {
152
- export interface IBeanRecordGlobal {
153
- 'paypal': BeanPaypal;
154
- }
155
- }
156
- /** bean: end */
157
- /** service: begin */
158
- export * from '../service/paypal.ts';
159
-
160
- import 'vona-module-a-bean';
161
- declare module 'vona-module-a-bean' {
162
-
163
- export interface IServiceRecord {
164
- 'a-paypal:paypal': never;
165
- }
166
-
167
-
168
- }
169
- declare module 'vona-module-a-paypal' {
170
-
171
- export interface ServicePaypal {
172
- /** @internal */
173
- get scope(): ScopeModuleAPaypal;
174
- }
175
-
176
- export interface ServicePaypal {
177
- get $beanFullName(): 'a-paypal.service.paypal';
178
- get $onionName(): 'a-paypal:paypal';
179
- }
180
- }
181
- /** service: end */
182
- /** service: begin */
183
- import type { ServicePaypal } from '../service/paypal.ts';
184
- export interface IModuleService {
185
- 'paypal': ServicePaypal;
186
- }
187
- /** service: end */
188
- /** service: begin */
189
-
190
- import 'vona';
191
- declare module 'vona' {
192
- export interface IBeanRecordGeneral {
193
- 'a-paypal.service.paypal': ServicePaypal;
194
- }
195
- }
196
- /** service: end */
197
- /** event: begin */
198
- export * from '../bean/event.paypalCancelOrder.ts';
199
- export * from '../bean/event.paypalCaptureOrder.ts';
200
-
201
- import 'vona';
202
- declare module 'vona' {
203
-
204
-
205
- }
206
- declare module 'vona-module-a-paypal' {
207
-
208
- export interface EventPaypalCancelOrder {
209
- /** @internal */
210
- get scope(): ScopeModuleAPaypal;
211
- }
212
-
213
- export interface EventPaypalCancelOrder {
214
- get $beanFullName(): 'a-paypal.event.paypalCancelOrder';
215
- get $onionName(): 'a-paypal:paypalCancelOrder';
216
- }
217
-
218
- export interface EventPaypalCaptureOrder {
219
- /** @internal */
220
- get scope(): ScopeModuleAPaypal;
221
- }
222
-
223
- export interface EventPaypalCaptureOrder {
224
- get $beanFullName(): 'a-paypal.event.paypalCaptureOrder';
225
- get $onionName(): 'a-paypal:paypalCaptureOrder';
226
- }
227
- }
228
- /** event: end */
229
- /** event: begin */
230
- import type { EventPaypalCancelOrder } from '../bean/event.paypalCancelOrder.ts';
231
- import type { EventPaypalCaptureOrder } from '../bean/event.paypalCaptureOrder.ts';
232
- export interface IModuleEvent {
233
- 'paypalCancelOrder': EventPaypalCancelOrder;
234
- 'paypalCaptureOrder': EventPaypalCaptureOrder;
235
- }
236
- /** event: end */
237
- /** event: begin */
238
- import type { TypeEventPaypalCancelOrderData, TypeEventPaypalCancelOrderResult } from '../bean/event.paypalCancelOrder.ts';
239
- import type { TypeEventPaypalCaptureOrderData, TypeEventPaypalCaptureOrderResult } from '../bean/event.paypalCaptureOrder.ts';
240
- import type { EventOn } from 'vona-module-a-event';
241
- declare module 'vona-module-a-event' {
242
- export interface IEventRecord {
243
- 'a-paypal:paypalCancelOrder': EventOn<TypeEventPaypalCancelOrderData, TypeEventPaypalCancelOrderResult>;
244
- 'a-paypal:paypalCaptureOrder': EventOn<TypeEventPaypalCaptureOrderData, TypeEventPaypalCaptureOrderResult>;
245
- }
246
- }
247
- /** event: end */
248
- /** meta: begin */
249
- export * from '../bean/meta.version.ts';
250
-
251
- import 'vona-module-a-meta';
252
- declare module 'vona-module-a-meta' {
253
-
254
- export interface IMetaRecord {
255
- 'a-paypal:version': never;
256
- }
257
-
258
-
259
- }
260
- declare module 'vona-module-a-paypal' {
261
-
262
- export interface MetaVersion {
263
- /** @internal */
264
- get scope(): ScopeModuleAPaypal;
265
- }
266
-
267
- export interface MetaVersion {
268
- get $beanFullName(): 'a-paypal.meta.version';
269
- get $onionName(): 'a-paypal:version';
270
- }
271
- }
272
- /** meta: end */
273
- /** dto: begin */
274
- export * from '../dto/paypalOrderRecordOptions.tsx';
275
- export * from '../dto/paypalOrderRecordPayload.tsx';
276
- import type { IDtoOptionsPaypalOrderRecordOptions } from '../dto/paypalOrderRecordOptions.tsx';
277
- import type { IDtoOptionsPaypalOrderRecordPayload } from '../dto/paypalOrderRecordPayload.tsx';
278
- import 'vona-module-a-web';
279
- declare module 'vona-module-a-web' {
280
-
281
- export interface IDtoRecord {
282
- 'a-paypal:paypalOrderRecordOptions': IDtoOptionsPaypalOrderRecordOptions;
283
- 'a-paypal:paypalOrderRecordPayload': IDtoOptionsPaypalOrderRecordPayload;
284
- }
285
-
286
-
287
- }
288
- declare module 'vona-module-a-paypal' {
289
-
290
- }
291
- /** dto: end */
292
- /** dto: begin */
293
- import type { DtoPaypalOrderRecordOptions } from '../dto/paypalOrderRecordOptions.tsx';
294
- import type { DtoPaypalOrderRecordPayload } from '../dto/paypalOrderRecordPayload.tsx';
295
- declare module 'vona-module-a-paypal' {
296
-
297
- export interface IDtoOptionsPaypalOrderRecordOptions {
298
- fields?: TypeEntityOptionsFields<DtoPaypalOrderRecordOptions, IDtoOptionsPaypalOrderRecordOptions[TypeSymbolKeyFieldsMore]>;
299
- }
300
-
301
- export interface IDtoOptionsPaypalOrderRecordPayload {
302
- fields?: TypeEntityOptionsFields<DtoPaypalOrderRecordPayload, IDtoOptionsPaypalOrderRecordPayload[TypeSymbolKeyFieldsMore]>;
303
- }
304
- }
305
- /** dto: end */
306
- /** controller: begin */
307
- export * from '../controller/paypal.ts';
308
- import type { IControllerOptionsPaypal } from '../controller/paypal.ts';
309
- import 'vona-module-a-web';
310
- declare module 'vona-module-a-web' {
311
-
312
- export interface IControllerRecord {
313
- 'a-paypal:paypal': IControllerOptionsPaypal;
314
- }
315
-
316
-
317
- }
318
- declare module 'vona-module-a-paypal' {
319
-
320
- export interface ControllerPaypal {
321
- /** @internal */
322
- get scope(): ScopeModuleAPaypal;
323
- }
324
-
325
- export interface ControllerPaypal {
326
- get $beanFullName(): 'a-paypal.controller.paypal';
327
- get $onionName(): 'a-paypal:paypal';
328
- get $onionOptions(): IControllerOptionsPaypal;
329
- }
330
- }
331
- /** controller: end */
332
- /** controller: begin */
333
- // @ts-ignore ignore
334
- import type { ControllerPaypal } from '../controller/paypal.ts';
335
- declare module 'vona-module-a-paypal' {
336
-
337
- export interface IControllerOptionsPaypal {
338
- actions?: TypeControllerOptionsActions<ControllerPaypal>;
339
- }
340
- }
341
- declare module 'vona-module-a-web' {
342
- export interface IApiPathGetRecord{
343
- '/paypal/getRecord/:recordId': undefined;
344
- }
345
- export interface IApiPathPostRecord{
346
- '/paypal/captureOrder/:recordId': undefined;
347
- '/paypal/cancelOrder/:recordId': undefined;
348
- }
349
-
350
- }
351
-
352
- /** controller: end */
353
- /** config: begin */
354
- export * from '../config/config.ts';
355
- import type { config } from '../config/config.ts';
356
- /** config: end */
357
- /** locale: begin */
358
- import { locales } from './locales.ts';
359
- /** locale: end */
360
- /** error: begin */
361
- export * from '../config/errors.ts';
362
- import type { errors } from '../config/errors.ts';
363
- /** error: end */
364
- /** scope: begin */
365
- import { BeanScopeBase, type BeanScopeUtil, type TypeModuleConfig, type TypeModuleErrors, type TypeModuleLocales, type TypeLocaleBase } from 'vona';
366
- import { Scope } from 'vona-module-a-bean';
367
-
368
- @Scope()
369
- export class ScopeModuleAPaypal extends BeanScopeBase {}
370
-
371
- export interface ScopeModuleAPaypal {
372
- util: BeanScopeUtil;
373
- config: TypeModuleConfig<typeof config>;
374
- error: TypeModuleErrors<typeof errors>;
375
- locale: TypeModuleLocales<(typeof locales)[TypeLocaleBase]>;
376
- entity: IModuleEntity;
377
- model: IModuleModel;
378
- service: IModuleService;
379
- event: IModuleEvent;
380
- }
381
-
382
- import 'vona';
383
- declare module 'vona' {
384
- export interface IBeanScopeRecord {
385
- 'a-paypal': ScopeModuleAPaypal;
386
- }
387
-
388
- export interface IBeanScopeContainer {
389
- paypal: ScopeModuleAPaypal;
390
- }
391
-
392
- export interface IBeanScopeConfig {
393
- 'a-paypal': ReturnType<typeof config>;
394
- }
395
-
396
- export interface IBeanScopeLocale {
397
- 'a-paypal': (typeof locales)[TypeLocaleBase];
398
- }
399
-
400
- export interface IBeanScopeErrors {
401
- 'a-paypal': typeof errors;
402
- }
403
- }
404
- /** scope: end */
@@ -1,18 +0,0 @@
1
- import type { TypeLocaleBase } from 'vona';
2
-
3
- import { $makeLocaleMagic } from 'vona';
4
-
5
- import locale_en_us from '../config/locale/en-us.ts';
6
- import locale_zh_cn from '../config/locale/zh-cn.ts';
7
-
8
- export const locales = {
9
- 'en-us': locale_en_us,
10
- 'zh-cn': locale_zh_cn,
11
- };
12
-
13
- export function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(
14
- key: K,
15
- ...args: any[]
16
- ): any {
17
- return $makeLocaleMagic(`a-paypal::${key}`, ...args);
18
- }
@@ -1,2 +0,0 @@
1
- export const __ThisModule__ = 'a-paypal';
2
- export { ScopeModuleAPaypal as ScopeModule } from './index.ts';
@@ -1,99 +0,0 @@
1
- import type { TableIdentity } from 'table-identity';
2
-
3
- import { Client, OrdersController } from '@cabloy/paypal-server-sdk';
4
- import {
5
- CheckoutPaymentIntent,
6
- Environment,
7
- LogLevel,
8
- OrderStatus,
9
- } from '@cabloy/paypal-server-sdk';
10
- import { combineQueries } from '@cabloy/utils';
11
- import { BeanBase } from 'vona';
12
- import { Bean } from 'vona-module-a-bean';
13
-
14
- import type { IPaypalOrderRecordOptions, IPaypalOrderRecordPayload } from '../types/paypal.ts';
15
-
16
- @Bean()
17
- export class BeanPaypal extends BeanBase {
18
- createClient() {
19
- return new Client({
20
- clientCredentialsAuthCredentials: {
21
- oAuthClientId: this.scope.config.client.clientId,
22
- oAuthClientSecret: this.scope.config.client.clientSecret,
23
- },
24
- timeout: 0,
25
- environment: this.app.meta.isProd ? Environment.Production : Environment.Sandbox,
26
- logging: this.scope.config.client.logging
27
- ? {
28
- logLevel: LogLevel.Info,
29
- logRequest: {
30
- logBody: true,
31
- },
32
- logResponse: {
33
- logHeaders: true,
34
- },
35
- }
36
- : undefined,
37
- });
38
- }
39
-
40
- async createOrder(
41
- userId: TableIdentity,
42
- payload: IPaypalOrderRecordPayload,
43
- options: IPaypalOrderRecordOptions,
44
- ) {
45
- // create record
46
- const record = await this.scope.model.paypalRecord.insert({
47
- userId,
48
- status: 0,
49
- prepayId: undefined,
50
- payload,
51
- options,
52
- });
53
- const recordId = record.id;
54
- // test
55
- if (this.app.meta.isTest) {
56
- this.ctx.commit(async () => {
57
- await this.scope.service.paypal.captureOrder(userId, recordId);
58
- });
59
- return { recordId, approveUrl: undefined };
60
- }
61
- // url
62
- const returnUrl = combineQueries(options.returnUrl, { recordId });
63
- const cancelUrl = combineQueries(options.cancelUrl, { recordId });
64
- // create order
65
- const ordersController = new OrdersController(this.createClient());
66
- const res = await ordersController.createOrder({
67
- body: {
68
- intent: CheckoutPaymentIntent.Capture,
69
- applicationContext: {
70
- brandName: options.brandName,
71
- returnUrl,
72
- cancelUrl,
73
- },
74
- purchaseUnits: [
75
- {
76
- description: payload.remark,
77
- amount: {
78
- currencyCode: payload.currencyCode,
79
- value: payload.total,
80
- },
81
- },
82
- ],
83
- },
84
- });
85
- if (!res.result || res.result.status !== OrderStatus.Created) {
86
- this.scope.error.TransactionException.throw();
87
- }
88
- // prepayId
89
- const prepayId = res.result.id;
90
- const approveUrl = res.result.links?.find(item => item.rel === 'approve')?.href;
91
- // save prepayId
92
- await this.scope.model.paypalRecord.update({
93
- id: recordId,
94
- prepayId,
95
- });
96
- // ok
97
- return { recordId, approveUrl };
98
- }
99
- }
@@ -1,15 +0,0 @@
1
- import { BeanEventBase, Event } from 'vona-module-a-event';
2
-
3
- import type { EntityPaypalRecord } from '../entity/paypalRecord.tsx';
4
-
5
- export interface TypeEventPaypalCancelOrderData {
6
- record: EntityPaypalRecord;
7
- }
8
-
9
- export type TypeEventPaypalCancelOrderResult = void;
10
-
11
- @Event()
12
- export class EventPaypalCancelOrder extends BeanEventBase<
13
- TypeEventPaypalCancelOrderData,
14
- TypeEventPaypalCancelOrderResult
15
- > {}
@@ -1,22 +0,0 @@
1
- import { BeanEventBase, Event } from 'vona-module-a-event';
2
-
3
- import type { EntityPaypalRecord } from '../entity/paypalRecord.tsx';
4
-
5
- export interface IPaypalCaptureOrderBreakdown {
6
- grossAmount: number;
7
- payFee: number;
8
- netAmount: number;
9
- }
10
- export interface TypeEventPaypalCaptureOrderData {
11
- record: EntityPaypalRecord;
12
- breakdown: IPaypalCaptureOrderBreakdown;
13
- orderResult?: {};
14
- }
15
-
16
- export type TypeEventPaypalCaptureOrderResult = void;
17
-
18
- @Event()
19
- export class EventPaypalCaptureOrder extends BeanEventBase<
20
- TypeEventPaypalCaptureOrderData,
21
- TypeEventPaypalCaptureOrderResult
22
- > {}