{"code":"function defineName$__(cls,name){\n\tObject.defineProperty(cls,\"name\",{value:name,configurable:true});\n};;\nfunction inheritClass$__(cls){\n\tObject.getPrototypeOf(cls.prototype).constructor?.inherited?.(cls);\n};;\nfunction extend$__(target,ext){\n\t// @ts-ignore\n\tconst descriptors = Object.getOwnPropertyDescriptors(ext);\n\tdelete descriptors.constructor;\n\tif(target.extend__ instanceof Function){\n\t\ttarget.extend__(descriptors,ext);\n\t} else {\n\t\t// @ts-ignore\n\t\tObject.defineProperties(target,descriptors);\n\t}\n\treturn target;\n};\nconst $setup$ = Symbol.for('#setup'), $__init__$ = Symbol.for('#__init__'), $__patch__$ = Symbol.for('#__patch__'), $__initor__$ = Symbol.for('#__initor__'), $__inited__$ = Symbol.for('#__inited__'), $__hooks__$ = Symbol.for('#__hooks__');\nvar $1 = Symbol();\n\n/*body*/\nimport './any';\nimport {Message,MessageRequest} from '../protocol';\n\nexport class RPCField extends OPField {\n\t[$__patch__$]($$ = {},fields = true){\n\t\tvar $2;\n\t\tsuper[$__patch__$] && super[$__patch__$]($$,fields);\n\t\t($2 = $$.pgtype) !== undefined && (this.pgtype = $2);\n\t\t($2 = $$.timeout) !== undefined && (this.timeout = $2);\n\t\t($2 = $$.isolate) !== undefined && (this.isolate = $2);\n\t\t($2 = $$.virtual) !== undefined && (this.virtual = $2);\n\t\t\n\t}\n\tconstructor(){\n\t\tsuper(...arguments);\n\t\tsuper[$__init__$] || this[$__init__$]();this[$__initor__$]===$1 && (this[$__hooks__$]&&this[$__hooks__$].inited(this),this[$__inited__$] && this[$__inited__$]());\n\t}\n\t[$__init__$]($$ = null,deep = true,fields = true){\n\t\tvar $3;\n\t\tdeep && super[$__init__$] && super[$__init__$](...arguments);\n\t\tthis.pgtype = ($$ && ($3 = $$.pgtype) !== undefined) ? ($3) : null;\n\t\tthis.timeout = ($$ && ($3 = $$.timeout) !== undefined) ? ($3) : null;\n\t\tthis.isolate = ($$ && ($3 = $$.isolate) !== undefined) ? ($3) : false;\n\t\tthis.virtual = ($$ && ($3 = $$.virtual) !== undefined) ? ($3) : true;\n\t\t\n\t}\n\t\n\t\n\t// should the call timeout?\n\t\n\t\n\t// should we create a temporary nested store for this?\n\t\n\t\n\t\n\t\n\t// should we expect a response?\n\t\n\t// should it throttle?\n\t\n\t// should it spam / try multiple routes?\n\t\n\t// unordered - deliver via udp if peer connection established?\n\t\n\t/**\n\t@returns { Function }\n\t*/\n\t$get(target){\n\t\t\n\t\treturn this.callback;\n\t}\n\t\n\t$set(value,target){\n\t\t\n\t\treturn console.log('rpcfield set',value);\n\t}\n\t\n\t[$setup$](){\n\t\tvar self = this;\n\t\t\n\t\tlet method = this.callback;\n\t\t\n\t\tlet wrapper = function(...params) {\n\t\t\t\n\t\t\t// what is the destination for this?\n\t\t\t// we might only hae the server\n\t\t\t// if the object is a client or a server it\n\t\t\t// would be specific.\n\t\t\t\n\t\t\t// what is the source? Do we need to include the source always\n\t\t\tlet msg = new MessageRequest(\n\t\t\t\t{action: self.name,\n\t\t\t\tparams: params}\n\t\t\t);\n\t\t\tmsg.now = Date.now();\n\t\t\t// only if this is sent from ourself!\n\t\t\tOP.$send(msg,this);\n\t\t\treturn msg;\n\t\t};\n\t\t\n\t\tObject.defineProperty(this.model.prototype,this.name,{\n\t\t\tvalue: wrapper\n\t\t});\n\t\treturn this;\n\t}\n\tstatic {\n\t\tthis.prototype[$__initor__$] = $1;defineName$__(this,'RPCField');inheritClass$__(this);}\n};\n\nclass ΩOPObject {\n\t\n\t\n\t// @template [T=any]\n\t/**\n\t@returns { RPCField }\n\t*/\n\tαrpc(...params){\n\t\t\n\t\tlet field = new RPCField(...params);\n\t\treturn field;\n\t}\n\tstatic {\n\t\tdefineName$__(this,'OPObject');}\n};\nextend$__(OPObject.prototype,ΩOPObject.prototype);\n;\n","map":{"version":3,"file":"rpc.js","sourceRoot":"","sources":["/Users/abdellah/workspace/scrimba/op/src/fields/rpc.imba"],"sourcesContent":["import './any'\nimport {Message,MessageRequest} from '../protocol'\n\nexport class RPCField < OPField\n\tpgtype = null\n\n\t# should the call timeout?\n\ttimeout = null\n\n\t# should we create a temporary nested store for this?\n\tisolate = no\n\n\tvirtual = yes\n\n\t# should we expect a response?\n\n\t# should it throttle?\n\n\t# should it spam / try multiple routes?\n\n\t# unordered - deliver via udp if peer connection established?\n\n\tdef $get\\Function target\n\t\tcallback\n\n\tdef $set value, target\n\t\tconsole.log 'rpcfield set',value\n\n\tdef #setup\n\t\tlet method = callback\n\n\t\tlet wrapper = do(...params)\n\t\t\t# what is the destination for this?\n\t\t\t# we might only hae the server\n\t\t\t# if the object is a client or a server it\n\t\t\t# would be specific.\n\n\t\t\t# what is the source? Do we need to include the source always\n\t\t\tlet msg = new MessageRequest(\n\t\t\t\taction: name\n\t\t\t\tparams: params\n\t\t\t)\n\t\t\tmsg.now = Date.now!\n\t\t\t# only if this is sent from ourself!\n\t\t\tOP.$send(msg,this)\n\t\t\treturn msg\n\n\t\tObject.defineProperty(model.prototype,name,{\n\t\t\tvalue: wrapper\n\t\t})\n\t\tself\n\nextend class OPObject\n\n\t# @template [T=any]\n\tdef @rpc\\RPCField ...params\n\t\tlet field = new RPCField(...params)\n\t\treturn field\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,CAAC,OAAO;AACd,MAAM,EAAE,OAAO,CAAC,cAAc,OAAO,aAAa;;AAElD,MAAM,CAAC,KAAK,CAAC,QAAQ,SAAG,OAAO,EAAA;qCAH/B;;;WAIC,MAAM,CAAA,wBAAN,MAAM;WAGN,OAAO,CAAA,wBAAP,OAAO;WAGP,OAAO,CAAA,wBAAP,OAAO;WAEP,OAAO,CAAA,wBAAP,OAAO;;EAZR;cAAA;;;EAAA;kDAAA;;;OAIC,MAAM,mBAAN,MAAM,CAAA,qBAAA,IAAG,IAAI;OAGb,OAAO,mBAAP,OAAO,CAAA,qBAAA,IAAG,IAAI;OAGd,OAAO,mBAAP,OAAO,CAAA,qBAAA,IAAG,KAAE;OAEZ,OAAO,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