cabloy 5.1.140 → 5.1.142

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 (142) hide show
  1. package/.cabloy-version +1 -1
  2. package/.github/workflows/playwright-e2e.yml +2 -2
  3. package/CHANGELOG.md +32 -0
  4. package/cabloy-docs/frontend/form-guide.md +47 -0
  5. package/cabloy-docs/frontend/markdown-guide.md +50 -17
  6. package/cabloy-docs/frontend/route-alias-guide.md +20 -0
  7. package/cabloy-docs/frontend/scripts.md +9 -11
  8. package/cabloy-docs/frontend/zova-form-under-the-hood.md +25 -0
  9. package/cabloy-docs/fullstack/framework-performance.md +3 -3
  10. package/cabloy-docs/fullstack/parallel-worktree-environment.md +1 -1
  11. package/cabloy-docs/fullstack/quickstart.md +5 -4
  12. package/cabloy-docs/reference/repo-scripts.md +29 -42
  13. package/e2e/config/playwright.config.ts +34 -0
  14. package/e2e/scripts/e2e.ts +2 -27
  15. package/e2e/scripts/runE2e.ts +62 -0
  16. package/e2e/scripts/runE2eArgs.test.ts +75 -0
  17. package/e2e/scripts/runE2eArgs.ts +158 -0
  18. package/e2e/specs/{a-commerce/commerce.spec.ts → a-commerce.spec.ts} +364 -33
  19. package/e2e/specs/{cabloy-basic/account.spec.ts → account.spec.ts} +1 -2
  20. package/e2e/specs/{cabloy-basic/basic.spec.ts → cabloy-basic.spec.ts} +6 -8
  21. package/oxlint.config.ts +3 -0
  22. package/package.json +3 -9
  23. package/scripts/upgrade.ts +63 -68
  24. package/vona/packages-utils/lint/package.json +1 -1
  25. package/vona/packages-utils/lint/src/oxc/lint.ts +1 -1
  26. package/vona/packages-utils/lint/src/oxc/lintVue.ts +1 -1
  27. package/vona/pnpm-lock.yaml +100 -657
  28. package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/refundRecoveryView.tsx +7 -2
  29. package/vona/src/suite/a-commerce/modules/commerce-trade/src/service/order.ts +31 -15
  30. package/vona/src/suite/a-home/modules/home-user/package.json +1 -0
  31. package/vona/src/suite/a-home/modules/home-user/src/service/account.ts +15 -2
  32. package/vona/src/suite/a-home/modules/home-user/test/accountActivation.test.ts +34 -4
  33. package/vona/src/suite-vendor/a-cabloy/modules/a-markdown/package.json +2 -1
  34. package/vona/src/suite-vendor/a-cabloy/modules/a-markdown/src/.metadata/index.ts +26 -0
  35. package/vona/src/suite-vendor/a-cabloy/modules/a-markdown/src/bean/imageScene.markdown.ts +13 -0
  36. package/vona/src/suite-vendor/a-cabloy/package.json +2 -2
  37. package/vona/src/suite-vendor/a-pay/modules/a-pay/package.json +1 -1
  38. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/providerOperation.ts +23 -0
  39. package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/refundOperation.ts +7 -0
  40. package/vona/src/suite-vendor/a-pay/modules/pay-mock/package.json +1 -1
  41. package/vona/src/suite-vendor/a-pay/modules/pay-paypal/package.json +1 -1
  42. package/vona/src/suite-vendor/a-pay/modules/pay-stripe/package.json +1 -1
  43. package/vona/src/suite-vendor/a-pay/package.json +5 -5
  44. package/zova/packages-utils/zova-jsx/package.json +2 -2
  45. package/zova/packages-zova/zova/package.json +3 -3
  46. package/zova/packages-zova/zova-core/package.json +1 -1
  47. package/zova/packages-zova/zova-core/src/bean/resource/locale/type.ts +1 -0
  48. package/zova/pnpm-lock.yaml +63 -18
  49. package/zova/src/front/config/config/config.cabloyBasicWeb.ts +3 -1
  50. package/zova/src/front/config/config/config.cabloyCommerce.ts +4 -2
  51. package/zova/src/suite/a-commerce/modules/commerce-catalog/src/api/openapi/schemas.ts +0 -11
  52. package/zova/src/suite/a-commerce/modules/commerce-catalog/src/api/openapi/types.ts +23 -170
  53. package/zova/src/suite/a-commerce/modules/commerce-member/src/api/openapi/schemas.ts +0 -11
  54. package/zova/src/suite/a-commerce/modules/commerce-member/src/api/openapi/types.ts +23 -170
  55. package/zova/src/suite/a-commerce/modules/commerce-member/src/page/address/controller.tsx +64 -63
  56. package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/schemas.ts +0 -11
  57. package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/types.ts +23 -170
  58. package/zova/src/suite/a-commerce/modules/commerce-siteadmin/src/api/openapi/schemas.ts +0 -11
  59. package/zova/src/suite/a-commerce/modules/commerce-siteadmin/src/api/openapi/types.ts +23 -170
  60. package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/schemas.ts +0 -11
  61. package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/types.ts +29 -171
  62. package/zova/src/suite/a-commerce/modules/commerce-trade/src/component/tableCellActionRefund/controller.tsx +413 -134
  63. package/zova/src/suite/a-commerce/modules/commerce-trade/src/config/locale/en-us.ts +76 -0
  64. package/zova/src/suite/a-commerce/modules/commerce-trade/src/config/locale/zh-cn.ts +67 -0
  65. package/zova/src/suite/a-commerce/modules/commerce-trade/src/model/order.ts +1 -0
  66. package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/cart/controller.tsx +1 -1
  67. package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/checkout/controller.tsx +7 -7
  68. package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/order/controller.tsx +46 -9
  69. package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/payment/controller.tsx +50 -30
  70. package/zova/src/suite/a-home/modules/home-api/src/api/openapi/schemas.ts +0 -11
  71. package/zova/src/suite/a-home/modules/home-api/src/api/openapi/types.ts +23 -170
  72. package/zova/src/suite/a-training/modules/training-student/src/api/openapi/schemas.ts +0 -11
  73. package/zova/src/suite/a-training/modules/training-student/src/api/openapi/types.ts +23 -170
  74. package/zova/src/suite/cabloy-basic/modules/basic-captcha/src/component/formFieldCaptcha/controller.tsx +6 -2
  75. package/zova/src/suite/cabloy-basic/modules/basic-file/src/api/openapi/schemas.ts +0 -11
  76. package/zova/src/suite/cabloy-basic/modules/basic-file/src/api/openapi/types.ts +23 -170
  77. package/zova/src/suite/cabloy-basic/modules/basic-image/src/api/openapi/schemas.ts +0 -11
  78. package/zova/src/suite/cabloy-basic/modules/basic-image/src/api/openapi/types.ts +23 -170
  79. package/zova/src/suite/cabloy-basic/modules/basic-image/src/component/formFieldImage/controller.tsx +9 -15
  80. package/zova/src/suite/cabloy-basic/modules/basic-markdown/package.json +10 -2
  81. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/.metadata/index.ts +11 -2
  82. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/.metadata/locales.ts +7 -0
  83. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/component/formFieldMarkdown/controller.tsx +723 -5
  84. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/component/formFieldMarkdown/render.tsx +461 -2
  85. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/config/locale/en-us.ts +59 -0
  86. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/config/locale/zh-cn.ts +59 -0
  87. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/index.ts +1 -0
  88. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/lib/codeBlockLanguages.ts +42 -0
  89. package/zova/src/suite/cabloy-basic/modules/basic-markdown/src/lib/richTextContentStyle.ts +20 -0
  90. package/zova/src/suite/cabloy-basic/modules/basic-markdown/test/lib/codeBlockLanguages.test.ts +25 -0
  91. package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/package.json +1 -1
  92. package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/model/resource.ts +1 -0
  93. package/zova/src/suite-vendor/a-cabloy/package.json +2 -2
  94. package/zova/src/suite-vendor/a-pay/modules/a-pay/package.json +1 -1
  95. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/schemas.ts +0 -11
  96. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/types.ts +23 -170
  97. package/zova/src/suite-vendor/a-pay/modules/a-pay/src/component/paymentNextAction/controller.tsx +26 -12
  98. package/zova/src/suite-vendor/a-pay/modules/pay-mock/cli/openapi.config.ts +1 -1
  99. package/zova/src/suite-vendor/a-pay/modules/pay-mock/package.json +1 -1
  100. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/schemas.ts +0 -11
  101. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/openapi/types.ts +23 -170
  102. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/api/payMockMockPayment.ts +26 -0
  103. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/apiSchema/payMockMockPayment.ts +8 -1
  104. package/zova/src/suite-vendor/a-pay/modules/pay-mock/src/model/payMockPayment.ts +13 -1
  105. package/zova/src/suite-vendor/a-pay/package.json +3 -3
  106. package/zova/src/suite-vendor/a-zova/modules/a-form/package.json +1 -1
  107. package/zova/src/suite-vendor/a-zova/modules/a-form/src/component/formField/controller.tsx +2 -0
  108. package/zova/src/suite-vendor/a-zova/modules/a-form/src/types/formField.ts +7 -6
  109. package/zova/src/suite-vendor/a-zova/modules/a-ssrserver/package.json +1 -1
  110. package/zova/src/suite-vendor/a-zova/modules/a-ssrserver/src/service/ssrHandler.ts +1 -1
  111. package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
  112. package/zova/src/suite-vendor/a-zova/package.json +4 -4
  113. package/e2e/config/playwright.basic.config.ts +0 -3
  114. package/e2e/config/playwright.commerce.config.ts +0 -3
  115. package/e2e/config/playwright.shared.config.ts +0 -38
  116. package/e2e/scripts/testE2eClean.ts +0 -56
  117. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/package.json +0 -56
  118. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/.metadata/index.ts +0 -404
  119. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/.metadata/locales.ts +0 -18
  120. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/.metadata/this.ts +0 -2
  121. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/bean/bean.paypal.ts +0 -99
  122. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/bean/event.paypalCancelOrder.ts +0 -15
  123. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/bean/event.paypalCaptureOrder.ts +0 -22
  124. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/bean/meta.version.ts +0 -24
  125. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/config/config.ts +0 -14
  126. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/config/errors.ts +0 -3
  127. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/config/locale/en-us.ts +0 -3
  128. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/config/locale/zh-cn.ts +0 -3
  129. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/controller/paypal.ts +0 -39
  130. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/dto/paypalOrderRecordOptions.tsx +0 -31
  131. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/dto/paypalOrderRecordPayload.tsx +0 -18
  132. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/entity/paypalRecord.tsx +0 -30
  133. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/index.ts +0 -3
  134. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/model/paypalRecord.ts +0 -10
  135. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/service/paypal.ts +0 -83
  136. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/types/index.ts +0 -1
  137. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/src/types/paypal.ts +0 -18
  138. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/tsconfig.build.json +0 -11
  139. package/vona/src/suite-vendor/a-paypal/modules/a-paypal/tsconfig.json +0 -7
  140. package/vona/src/suite-vendor/a-paypal/package.json +0 -13
  141. package/vona/src/suite-vendor/a-paypal/tsconfig.base.json +0 -4
  142. package/vona/src/suite-vendor/a-paypal/tsconfig.json +0 -10
@@ -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
- > {}
@@ -1,24 +0,0 @@
1
- import type { IMetaVersionUpdate, IMetaVersionUpdateOptions } from 'vona-module-a-version';
2
-
3
- import { BeanBase } from 'vona';
4
- import { Meta } from 'vona-module-a-meta';
5
-
6
- @Meta()
7
- export class MetaVersion extends BeanBase implements IMetaVersionUpdate {
8
- async update(options: IMetaVersionUpdateOptions) {
9
- if (options.version === 1) {
10
- const entityPaypalRecord = this.scope.entity.paypalRecord;
11
- await this.bean.model.createTable(entityPaypalRecord.$table, table => {
12
- table.comment(entityPaypalRecord.$comment.$table);
13
- table.basicFields();
14
- table.userId();
15
- table.int0(entityPaypalRecord.status).comment(entityPaypalRecord.$comment.status);
16
- table
17
- .string(entityPaypalRecord.prepayId, 255)
18
- .comment(entityPaypalRecord.$comment.prepayId);
19
- table.json(entityPaypalRecord.payload).comment(entityPaypalRecord.$comment.payload);
20
- table.json(entityPaypalRecord.options).comment(entityPaypalRecord.$comment.options);
21
- });
22
- }
23
- }
24
- }
@@ -1,14 +0,0 @@
1
- import type { VonaApplication } from 'vona';
2
-
3
- export function config(_app: VonaApplication) {
4
- return {
5
- client: {
6
- clientId: '',
7
- clientSecret: '',
8
- logging: false,
9
- },
10
- paypal: {
11
- payFeeRate: 0.1,
12
- },
13
- };
14
- }
@@ -1,3 +0,0 @@
1
- export const errors = {
2
- TransactionException: 1001,
3
- } as const;
@@ -1,3 +0,0 @@
1
- export default {
2
- TransactionException: 'Transaction exception, please try again later',
3
- };
@@ -1,3 +0,0 @@
1
- export default {
2
- TransactionException: '交易异常,请稍后重试',
3
- };
@@ -1,39 +0,0 @@
1
- import type { TableIdentity } from 'table-identity';
2
- import type { IUser } from 'vona-module-a-user';
3
- import type { IDecoratorControllerOptions } from 'vona-module-a-web';
4
-
5
- import { BeanBase } from 'vona';
6
- import { Api, v } from 'vona-module-a-openapiutils';
7
- import { Arg, Controller, Web } from 'vona-module-a-web';
8
-
9
- import { EntityPaypalRecord } from '../entity/paypalRecord.tsx';
10
-
11
- export interface IControllerOptionsPaypal extends IDecoratorControllerOptions {}
12
-
13
- @Controller<IControllerOptionsPaypal>('paypal')
14
- export class ControllerPaypal extends BeanBase {
15
- @Web.get('getRecord/:recordId')
16
- @Api.body(EntityPaypalRecord)
17
- async getRecord(
18
- @Arg.user() user: IUser,
19
- @Arg.param('recordId', v.tableIdentity()) recordId: TableIdentity,
20
- ): Promise<EntityPaypalRecord> {
21
- return await this.scope.service.paypal.getRecord(user.id, recordId);
22
- }
23
-
24
- @Web.post('captureOrder/:recordId')
25
- async captureOrder(
26
- @Arg.user() user: IUser,
27
- @Arg.param('recordId', v.tableIdentity()) recordId: TableIdentity,
28
- ): Promise<void> {
29
- return await this.scope.service.paypal.captureOrder(user.id, recordId);
30
- }
31
-
32
- @Web.post('cancelOrder/:recordId')
33
- async cancelOrder(
34
- @Arg.user() user: IUser,
35
- @Arg.param('recordId', v.tableIdentity()) recordId: TableIdentity,
36
- ): Promise<void> {
37
- return await this.scope.service.paypal.cancelOrder(user.id, recordId);
38
- }
39
- }