@weimob-cloud/msg-wos
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -18,3 +18,5 @@ import { ACK, MsgRequestBody, MsgStandardCallback } from './types'; | ||
static ListenerNotFound: MsgStandardCallback<any>; | ||
private isInit; | ||
constructor(); | ||
registerMsg(): Promise<void>; | ||
register(topic: string, event: string, callback: MsgStandardCallback<any>): void; | ||
@@ -21,0 +23,0 @@ execute(incoming: MsgRequestBody): Promise<ACK | undefined> | ACK | undefined; |
@@ -1,1 +0,1 @@ | ||
var c=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var y=(s,e,t)=>e in s?c(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var i=(s,e)=>c(s,"name",{value:e,configurable:!0});var h=(s,e)=>{for(var t in e)c(s,t,{get:e[t],enumerable:!0})},k=(s,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of l(e))!m.call(s,n)&&n!==t&&c(s,n,{get:()=>e[n],enumerable:!(o=f(e,n))||o.enumerable});return s};var p=s=>k(c({},"__esModule",{value:!0}),s);var g=(s,e,t)=>(y(s,typeof e!="symbol"?e+"":e,t),t);var M={};h(M,{default:()=>L});module.exports=p(M);var u=require("@weimob-cloud/common"),r;let a,I=(r=class{constructor(){g(this,"store",new Map);return a||this}static getInstance(){return a||(a=new r),a}register(e,t,o){this.store.set(this.key(e,t),o),u.config.getClientInfoList().forEach(d=>{(0,u.registerMsg)({sdkVersion:u.config.get("msg.wos.version"),specsType:2},d)})}execute(e){const{topic:t,event:o,msgBody:n}=e||{};return(this.store.get(this.key(t,o))||r.ListenerNotFound)(n)}key(e,t){return e+"::"+t}},i(r,"MsgManager"),g(r,"OK",i(()=>({code:{errcode:0,errmsg:"success"}}),"OK")),g(r,"FAIL",i(()=>({code:{errcode:-1,errmsg:"fail"}}),"FAIL")),g(r,"ListenerNotFound",i(e=>{},"ListenerNotFound")),r);var L=I; | ||
var c=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var y=(s,e,t)=>e in s?c(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var a=(s,e)=>c(s,"name",{value:e,configurable:!0});var h=(s,e)=>{for(var t in e)c(s,t,{get:e[t],enumerable:!0})},I=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of f(e))!m.call(s,n)&&n!==t&&c(s,n,{get:()=>e[n],enumerable:!(i=l(e,n))||i.enumerable});return s};var p=s=>I(c({},"__esModule",{value:!0}),s);var o=(s,e,t)=>(y(s,typeof e!="symbol"?e+"":e,t),t);var M={};h(M,{default:()=>w});module.exports=p(M);var u=require("@weimob-cloud/common"),r;let g,k=(r=class{constructor(){o(this,"store",new Map);o(this,"isInit",!1);return g||this}static getInstance(){return g||(g=new r),g}async registerMsg(){if(this.isInit)return;this.isInit=!0;const t=u.config.getClientInfoList().map(async i=>{const n=await(0,u.registerMsg)({sdkVersion:u.config.get("msg.wos.version"),specsType:2},i),d=String(n.errcode);if(!(d==="0"||d==="000000"))return Promise.reject(new Error("\u6CE8\u518CWOS\u6D88\u606F\u5931\u8D25"))});await Promise.all(t)}register(e,t,i){this.registerMsg(),this.store.set(this.key(e,t),i)}execute(e){const{topic:t,event:i,msgBody:n}=e||{};return(this.store.get(this.key(t,i))||r.ListenerNotFound)(n)}key(e,t){return e+"::"+t}},a(r,"MsgManager"),o(r,"OK",a(()=>({code:{errcode:0,errmsg:"success"}}),"OK")),o(r,"FAIL",a(()=>({code:{errcode:-1,errmsg:"fail"}}),"FAIL")),o(r,"ListenerNotFound",a(e=>{},"ListenerNotFound")),r);var w=k; |
{ | ||
"name": "@weimob-cloud/msg-wos", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "msg wos for wcsdk", | ||
@@ -29,3 +29,3 @@ "main": "dist/index.js", | ||
"@nestjs/common": "^10.1.2", | ||
"@weimob-cloud/common": "^1.0.1" | ||
"@weimob-cloud/common": "^1.0.2" | ||
}, | ||
@@ -32,0 +32,0 @@ "scripts": { |
170208
3314