/** * webapi/message.ts — 镜像 web 端 msgCenter/notice + msgTemplate (v0.11+ Phase 2) * * 镜像 2 个 web 文件 (12 函数): * - web/api/msgCenter/notice.ts (5): getNoticeList, create, update, delNotice, sendNotice * - web/api/msgCenter/msgTemplate.ts (7): getMsgTemplateList, create, update, getInfo, delMsgTemplate, copy, testMsgTemplate */ import { JnpfClient } from '../core/client.ts' import { loadWebModule } from './_loader.ts' const NOTICE_SRC = '/home/ubuntu/ccWorkDir/web/apps/jnpf-web-apps-main/src/api/system/message.ts' const MSG_TEMPLATE_SRC = '/home/ubuntu/ccWorkDir/web/apps/jnpf-web-apps-main/src/api/msgCenter/msgTemplate.ts' let cached: { notice: any; template: any } | null = null export async function initWebapi(client: JnpfClient): Promise { if (cached) return const { initDefHttpShim } = await import('./_defhttp_shim.ts') initDefHttpShim(client) const notice = await loadWebModule(NOTICE_SRC) const template = await loadWebModule(MSG_TEMPLATE_SRC) cached = { notice, template } } export function isWebapiLoaded(): boolean { return cached !== null } export const loadNotice: any = new Proxy({} as any, { get(_target, prop) { if (!cached) throw new Error('message/notice 模块未初始化, 请先 await initWebapi(client)') return cached.notice[prop] }, }) export const loadMsgTemplate: any = new Proxy({} as any, { get(_target, prop) { if (!cached) throw new Error('message/template 模块未初始化, 请先 await initWebapi(client)') return cached.template[prop] }, })