@jayfong/x-server 2.1.7 → 2.2.1
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/lib/_cjs/cli/templates/crons.ts +1 -1
- package/lib/_cjs/cli/templates/handlers.ts +1 -1
- package/lib/_cjs/cli/templates/hooks.ts +1 -1
- package/lib/_cjs/cli/templates/routes.ts +2 -2
- package/lib/_cjs/services/pay.js +3 -2
- package/lib/cli/templates/crons.ts +1 -1
- package/lib/cli/templates/handlers.ts +1 -1
- package/lib/cli/templates/hooks.ts +1 -1
- package/lib/cli/templates/routes.ts +2 -2
- package/lib/services/pay.d.ts +2 -0
- package/lib/services/pay.js +3 -2
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// @index(['../../src/crons/**/*.ts', '!**/_*'], (f, _) => `import '${f.path}'`)
|
|
1
|
+
// @index(['../../src/crons/**/*.ts', '!**/_*', '!**/_*/**'], (f, _) => `import '${f.path}'`)
|
|
2
2
|
// @endindex
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// @index(['../../src/handlers/**/*.ts', '!**/_*'], (f, _) => `export * as __${_.pascal(f.path.replace('/src/handlers/', ''))}__ from '${f.path}'`)
|
|
1
|
+
// @index(['../../src/handlers/**/*.ts', '!**/_*', '!**/_*/**'], (f, _) => `export * as __${_.pascal(f.path.replace('/src/handlers/', ''))}__ from '${f.path}'`)
|
|
2
2
|
|
|
3
3
|
// @endindex
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// @index(['../../src/hooks/**/*.ts', '!**/_*'], (f, _) => `import '${f.path}'`)
|
|
1
|
+
// @index(['../../src/hooks/**/*.ts', '!**/_*', '!**/_*/**'], (f, _) => `import '${f.path}'`)
|
|
2
2
|
// @endindex
|
|
@@ -2,7 +2,7 @@ import * as handlers from './handlers'
|
|
|
2
2
|
import { Handler, XServer } from '@jayfong/x-server'
|
|
3
3
|
|
|
4
4
|
const basePathWithHandlers: Array<[string, Record<string, Handler>]> = [
|
|
5
|
-
// @index(['../../src/handlers/**/*.ts', '!**/_*'], (f, _) => `['${(f.path+'/').replace('../../src/handlers/', '/').replace(/\/index\/$/, '/').split('/').map(v => _.snake(v)).join('/')}', handlers.__${_.pascal(f.path.replace('/src/handlers/', ''))}__ as any],`)
|
|
5
|
+
// @index(['../../src/handlers/**/*.ts', '!**/_*', '!**/_*/**'], (f, _) => `['${(f.path+'/').replace('../../src/handlers/', '/').replace(/\/index\/$/, '/').split('/').map(v => _.snake(v)).join('/')}', handlers.__${_.pascal(f.path.replace('/src/handlers/', ''))}__ as any],`)
|
|
6
6
|
// @endindex
|
|
7
7
|
]
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
|
|
|
13
13
|
? I
|
|
14
14
|
: never
|
|
15
15
|
type RouteMap = {
|
|
16
|
-
// @index(['../../src/handlers/**/*.ts', '!**/_*'], (f, _) => `'${(f.path+'/').replace('../../src/handlers/', '/').replace(/\/index\/$/, '/').split('/').map(v => _.snake(v)).join('/')}': typeof handlers.__${_.pascal(f.path.replace('/src/handlers/', ''))}__,`)
|
|
16
|
+
// @index(['../../src/handlers/**/*.ts', '!**/_*', '!**/_*/**'], (f, _) => `'${(f.path+'/').replace('../../src/handlers/', '/').replace(/\/index\/$/, '/').split('/').map(v => _.snake(v)).join('/')}': typeof handlers.__${_.pascal(f.path.replace('/src/handlers/', ''))}__,`)
|
|
17
17
|
// @endindex
|
|
18
18
|
}
|
|
19
19
|
export type HandlerMap = UnionToIntersection<
|
package/lib/_cjs/services/pay.js
CHANGED
|
@@ -56,8 +56,9 @@ class PayService {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
async prepareWepay(options) {
|
|
59
|
+
const appId = options.appId || this.options.wepay.appId;
|
|
59
60
|
const res = await this.wepayRequest('https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi', {
|
|
60
|
-
appid:
|
|
61
|
+
appid: appId,
|
|
61
62
|
mchid: this.options.wepay.merchantId,
|
|
62
63
|
description: options.goodsName,
|
|
63
64
|
out_trade_no: options.tradeNumber,
|
|
@@ -78,7 +79,7 @@ class PayService {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
const params = {
|
|
81
|
-
appId:
|
|
82
|
+
appId: appId,
|
|
82
83
|
timestamp: String(Math.round(Date.now() / 1000)),
|
|
83
84
|
nonceStr: Math.random().toString().substr(2, 12),
|
|
84
85
|
package: `prepay_id=${res.prepay_id}`,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// @index(['../../src/crons/**/*.ts', '!**/_*'], (f, _) => `import '${f.path}'`)
|
|
1
|
+
// @index(['../../src/crons/**/*.ts', '!**/_*', '!**/_*/**'], (f, _) => `import '${f.path}'`)
|
|
2
2
|
// @endindex
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// @index(['../../src/handlers/**/*.ts', '!**/_*'], (f, _) => `export * as __${_.pascal(f.path.replace('/src/handlers/', ''))}__ from '${f.path}'`)
|
|
1
|
+
// @index(['../../src/handlers/**/*.ts', '!**/_*', '!**/_*/**'], (f, _) => `export * as __${_.pascal(f.path.replace('/src/handlers/', ''))}__ from '${f.path}'`)
|
|
2
2
|
|
|
3
3
|
// @endindex
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// @index(['../../src/hooks/**/*.ts', '!**/_*'], (f, _) => `import '${f.path}'`)
|
|
1
|
+
// @index(['../../src/hooks/**/*.ts', '!**/_*', '!**/_*/**'], (f, _) => `import '${f.path}'`)
|
|
2
2
|
// @endindex
|
|
@@ -2,7 +2,7 @@ import * as handlers from './handlers'
|
|
|
2
2
|
import { Handler, XServer } from '@jayfong/x-server'
|
|
3
3
|
|
|
4
4
|
const basePathWithHandlers: Array<[string, Record<string, Handler>]> = [
|
|
5
|
-
// @index(['../../src/handlers/**/*.ts', '!**/_*'], (f, _) => `['${(f.path+'/').replace('../../src/handlers/', '/').replace(/\/index\/$/, '/').split('/').map(v => _.snake(v)).join('/')}', handlers.__${_.pascal(f.path.replace('/src/handlers/', ''))}__ as any],`)
|
|
5
|
+
// @index(['../../src/handlers/**/*.ts', '!**/_*', '!**/_*/**'], (f, _) => `['${(f.path+'/').replace('../../src/handlers/', '/').replace(/\/index\/$/, '/').split('/').map(v => _.snake(v)).join('/')}', handlers.__${_.pascal(f.path.replace('/src/handlers/', ''))}__ as any],`)
|
|
6
6
|
// @endindex
|
|
7
7
|
]
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
|
|
|
13
13
|
? I
|
|
14
14
|
: never
|
|
15
15
|
type RouteMap = {
|
|
16
|
-
// @index(['../../src/handlers/**/*.ts', '!**/_*'], (f, _) => `'${(f.path+'/').replace('../../src/handlers/', '/').replace(/\/index\/$/, '/').split('/').map(v => _.snake(v)).join('/')}': typeof handlers.__${_.pascal(f.path.replace('/src/handlers/', ''))}__,`)
|
|
16
|
+
// @index(['../../src/handlers/**/*.ts', '!**/_*', '!**/_*/**'], (f, _) => `'${(f.path+'/').replace('../../src/handlers/', '/').replace(/\/index\/$/, '/').split('/').map(v => _.snake(v)).join('/')}': typeof handlers.__${_.pascal(f.path.replace('/src/handlers/', ''))}__,`)
|
|
17
17
|
// @endindex
|
|
18
18
|
}
|
|
19
19
|
export type HandlerMap = UnionToIntersection<
|
package/lib/services/pay.d.ts
CHANGED
package/lib/services/pay.js
CHANGED
|
@@ -44,8 +44,9 @@ export class PayService {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
async prepareWepay(options) {
|
|
47
|
+
const appId = options.appId || this.options.wepay.appId;
|
|
47
48
|
const res = await this.wepayRequest('https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi', {
|
|
48
|
-
appid:
|
|
49
|
+
appid: appId,
|
|
49
50
|
mchid: this.options.wepay.merchantId,
|
|
50
51
|
description: options.goodsName,
|
|
51
52
|
out_trade_no: options.tradeNumber,
|
|
@@ -66,7 +67,7 @@ export class PayService {
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
const params = {
|
|
69
|
-
appId:
|
|
70
|
+
appId: appId,
|
|
70
71
|
timestamp: String(Math.round(Date.now() / 1000)),
|
|
71
72
|
nonceStr: Math.random().toString().substr(2, 12),
|
|
72
73
|
package: `prepay_id=${res.prepay_id}`,
|