- 命令规范化: 13 个违规子命令重命名 (switch-app→switchapp, fix-columndata→fixcolumndata, type-list→typelist, data-list→datalist, email-test→emailtest, sms-test→smstest, webhook-test→webhooktest, reset-pwd→resetpwd, notice-list→noticelist, notice-send→noticesend, notice-create→noticecreate, template-list→templatelist, template-create→templatecreate) - 旧名保留为 alias 向后兼容 - help.ts 拦截器也认 alias - tdca app (可信数据空间增强C版) 端到端: 5 form (tdcaDept/Employee/Salary/Leave/Performance) state=2 + 6 业务表 + 8 菜单 (5 form + 3 spa) + 3 no-spa-page 扩展页 (hr-dashboard/attendance/help) - Playwright 8/8 端到端测试 PASS (state 验证 + 物理表字段 + 菜单 + 浏览器渲染 + CRUD 链路) - 实战发现新盲点 30/31/32/33 (JNPF 6.2 OnlineDev 端点 + List bug + Create 不返 id + 跨应用 clone release 失败) 已写入 troubleshooting.md - tsc 0 错 + 103/103 单测全过 + 8/8 e2e 全过 Co-Authored-By: Claude <[email protected]>
56 lines
1.8 KiB
TypeScript
56 lines
1.8 KiB
TypeScript
/**
|
|
* commands/integration/webhooktest.ts — Webhook 测试发送
|
|
*/
|
|
import { Command } from 'commander'
|
|
import { JnpfClient } from '../../core/client.ts'
|
|
import { installAiHelpHook } from '../../core/help.ts'
|
|
import { log } from '../../core/log.ts'
|
|
|
|
interface WebhookTestOpts {
|
|
url: string
|
|
payload?: string
|
|
}
|
|
|
|
export function buildIntegrationWebhookTestCommand(): Command {
|
|
const cmd = new Command('webhookTest')
|
|
.alias('webhook-test')
|
|
.description('Webhook 测试发送')
|
|
.requiredOption('--url <u>', '目标 URL')
|
|
.option('--payload <p>', 'JSON payload (字符串)')
|
|
.action(async (opts: WebhookTestOpts) => {
|
|
const c = await JnpfClient.fromToken()
|
|
let payload: unknown = { test: true }
|
|
if (opts.payload) {
|
|
try {
|
|
payload = JSON.parse(opts.payload)
|
|
} catch (e) {
|
|
log.error(`--payload JSON 解析失败: ${(e as Error).message}`)
|
|
process.exit(2)
|
|
}
|
|
}
|
|
// 走 SendMessageConfig/testSendConfig (channel=webhook)
|
|
const r = await c.postJson('/message/SendMessageConfig/testSendConfig', {
|
|
url: opts.url,
|
|
channel: 'webhook',
|
|
payload,
|
|
})
|
|
if (r.code !== 200) {
|
|
log.error(`integration webhooktest 失败: ${r.msg}`)
|
|
process.exit(1)
|
|
}
|
|
log.info(`✓ Webhook 测试发送 OK (url=${opts.url})`)
|
|
})
|
|
installAiHelpHook(cmd, {
|
|
purpose: 'Webhook 测试发送',
|
|
required: { '--url': '目标 URL' },
|
|
optional: { '--payload': 'JSON payload' },
|
|
example: 'dacli integration webhooktest --url=https://example.com/hook --payload=\'{"key":"value"}\'',
|
|
source: {
|
|
web: 'web/apps/jnpf-web-apps-main/src/views/integrationCenter/webhook/index.vue',
|
|
api: 'POST /api/message/SendMessageConfig/testSendConfig',
|
|
ref: 'doc/v0.8-endpoints.md §3.3',
|
|
},
|
|
})
|
|
return cmd
|
|
}
|