UNPKG

5.59 kBPlain TextView Raw
1{"code":"function iter$__(a){ let v; return a ? ((v=a.toIterable) ? v.call(a) : a) : a; };;\nfunction 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};\nimport {accessor as imba_accessor} from 'imba';\nvar $1 = Symbol('id'), $2 = Symbol(), $3 = Symbol('name'), $4 = Symbol(), $5 = Symbol('secret'), $6 = Symbol(), $7 = Symbol(), $9, $10, $11;\nconst $__init__$ = Symbol.for('#__init__'), $__patch__$ = Symbol.for('#__patch__'), $__initor__$ = Symbol.for('#__initor__'), $__inited__$ = Symbol.for('#__inited__'), $__hooks__$ = Symbol.for('#__hooks__');\n\n/*body*/\nexport class OPUser extends OPObject {\n\t[$__patch__$]($$ = {},fields = true){\n\t\tvar $8;\n\t\tsuper[$__patch__$] && super[$__patch__$]($$,fields);\n\t\tfields && ($8 = $$.id) !== undefined && this.ααid.$init($8,this,$1,'id',$$);\n\t\tfields && ($8 = $$.name) !== undefined && this.ααname.$init($8,this,$3,'name',$$);\n\t\tfields && ($8 = $$.secret) !== undefined && this.ααsecret.$init($8,this,$5,'secret',$$);\n\t\t\n\t}\n\tconstructor(){\n\t\tsuper(...arguments);\n\t\tsuper[$__init__$] || this[$__init__$]();this[$__initor__$]===$7 && (this[$__hooks__$]&&this[$__hooks__$].inited(this),this[$__inited__$] && this[$__inited__$]());\n\t}\n\t[$__init__$]($$ = null,deep = true,fields = true){\n\t\tdeep && super[$__init__$] && super[$__init__$](...arguments);\n\t\tfields && this.ααid.$init($$ ? $$.id : undefined,this,$1,'id',$$);\n\t\tfields && this.ααname.$init($$ ? $$.name : undefined,this,$3,'name',$$);\n\t\tfields && this.ααsecret.$init($$ ? $$.secret : undefined,this,$5,'secret',$$);\n\t\t\n\t}\n\tset id(val){ this.ααid.$set(val,this,$1,'id') }\n\tget id(){ return this.ααid.$get(this,$1,'id') }\n\tget ααid(){ return this[$2] || imba_accessor(($9 = this.αkey(),($9.system instanceof Function) ? $9.system() : ($9.system = true),($9.c instanceof Function) ? $9.c(OP.SRV) : ($9.c = OP.SRV),$9),this,$1,'id',$2,OPUser.prototype) }\n\tset name(val){ this.ααname.$set(val,this,$3,'name') }\n\tget name(){ return this.ααname.$get(this,$3,'name') }\n\tget ααname(){ return this[$4] || imba_accessor(($10 = this.αstring(),$10),this,$3,'name',$4,OPUser.prototype) }\n\tset secret(val){ this.ααsecret.$set(val,this,$5,'secret') }\n\tget secret(){ return this.ααsecret.$get(this,$5,'secret') }\n\tget ααsecret(){ return this[$6] || imba_accessor(($11 = this.αstring(),($11.hidden instanceof Function) ? $11.hidden() : ($11.hidden = true),$11),this,$5,'secret',$6,OPUser.prototype) }\n\t\n\trolesΞfor(pov){\n\t\t\n\t\treturn super.rolesΞfor(...arguments) | ((pov === this) ? OP.OWNER : 0);\n\t}\n\t\n\t/**\n\t\n\t\tThe base role a user has - based on any OP.Role with a user-only checks function\n\t\t\n\t*/\n\tget $roles(){\n\t\t\n\t\tlet curr = this.$memo.$roles;\n\t\tif (curr !== undefined) { return curr };\n\t\t\n\t\tlet v = 0;\n\t\tfor (let $12 = 0, $13 = iter$__(OP.roles), $14 = $13.length; $12 < $14; $12++) {\n\t\t\tlet role = $13[$12];\n\t\t\tif (!(role.check)) { continue; };\n\t\t\t\n\t\t\t// when a role check has only one argument\n\t\t\t// it will be true/false for any item\n\t\t\tif (role.check.length == 1) {\n\t\t\t\t\n\t\t\t\tif (role.check(this)) {\n\t\t\t\t\t\n\t\t\t\t\tv |= role;\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t\treturn this.$memo.$roles = v;\n\t}\n\tstatic {\n\t\tthis.prototype[$__initor__$] = $7;defineName$__(this,'OPUser');this.alias = 'U';\n\t\tinheritClass$__(this);}\n}; globalThis.OPUser = OPUser;\n","map":{"version":3,"file":"user.js","sourceRoot":"","sources":["/Users/abdellah/workspace/scrimba/op/src/types/user.imba"],"sourcesContent":["export global class OPUser < OPObject\n\tstatic alias = 'U'\n\n\tid @key.system.c(OP.SRV)\n\tname @string\n\tsecret @string.hidden\n\n\tdef roles-for pov\n\t\tsuper | (pov === self ? OP.OWNER : 0)\n\n\t###\n\tThe base role a user has - based on any OP.Role with a user-only checks function\n\t###\n\tget $roles\n\t\tlet curr = $memo.$roles\n\t\treturn curr if curr !== undefined\n\n\t\tlet v = 0\n\t\tfor role in OP.roles when role.check\n\t\t\t# when a role check has only one argument\n\t\t\t# it will be true/false for any item\n\t\t\tif role.check.length == 1\n\t\t\t\tif role.check(self)\n\t\t\t\t\tv |= role\n\t\t$memo.$roles = v"],"names":[],"mappings":";;;;;;;;;;;;AAAA,MAAM,CAAQ,KAAK,CAAC,MAAM,SAAG,QAAQ,EAAA;qCAArC;;;qBAGC,EAAE,CAAA;qBACF,IAAI,CAAA;qBACJ,MAAM,CAAA;;EALP;cAAA;;;EAAA;kDAAA;;oCAGC,EAAE;sCACF,IAAI;wCACJ,MAAM;;EALP;KAGC,EAAE;KAAF,EAAE;KAAF,IAAE,gDAAC,IAAI,EAAA,KAAC,MAAM,2BAAN,MAAM,EAAA,OAAN,MAAM,aAAC,CAAC,2BAAD,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,OAAT,CAAC,GAAC,EAAE,CAAC,GAAG,sBAHJ,MAAM;KAIzB,IAAI;KAAJ,IAAI;KAAJ,MAAI,iDAAC,OAAO,EAAA,wBAJO,MAAM;KAKzB,MAAM;KAAN,MAAM;KAAN,QAAM,iDAAC,OAAO,EAAA,MAAC,MAAM,4BAAN,MAAM,EAAA,QAAN,MAAM,kCALF,MAAM;;CAOrB,SAAS,CAAC,GAAG,CAAA;;EAChB,OAAA,MADG,SAAS,cACP,CAAC,CAAC,EAAE,CAAA,GAAG,CAAC,GAAG,CAAC,IAAI,CAAA,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC;EAAC;;;;;;;CAKtC,GAAG,CAAC,MAAM,EA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