server-tools.js.map 4.1 KB

1
  1. {"version":3,"sources":["../../src/tools/server-tools.js"],"names":["usage","text","console","log","args","process","argv","slice","length","exit","command","option","JSON","parse","error","shift","socket","require","emit","response"],"mappings":"AAAA,a,CAEA;;AACA,IAAIA,KAAK,GAAG,SAARA,KAAQ,GAAW;AACrB,MAAIC,IAAI,6lCAAR;AAqBAC,EAAAA,OAAO,CAACC,GAAR,CAAYF,IAAZ;AACD,CAvBD;;AAyBA,IAAIG,IAAI,GAAGC,OAAO,CAACC,IAAR,CAAaC,KAAb,CAAmB,CAAnB,CAAX;;AAEA,IAAIH,IAAI,CAACI,MAAL,KAAgB,CAApB,EAAuB;AACrBR,EAAAA,KAAK;AACLK,EAAAA,OAAO,CAACI,IAAR,CAAa,CAAb;AACD;;AACD,IAAIC,OAAO,GAAG,EAAd;AACA,IAAIC,MAAM,GAAG,EAAb;;AACA,QAAQP,IAAI,CAAC,CAAD,CAAZ;AACE,OAAK,SAAL;AACA,OAAK,QAAL;AACEM,IAAAA,OAAO,GAAGN,IAAI,CAAC,CAAD,CAAd;AACA;;AAEF,OAAK,YAAL;AACA,OAAK,eAAL;AACA,OAAK,UAAL;AACA,OAAK,aAAL;AACE,QAAIA,IAAI,CAAC,CAAD,CAAJ,KAAY,aAAZ,IAA6BA,IAAI,CAACI,MAAL,GAAc,CAA/C,EAAkD;AAChDR,MAAAA,KAAK;AACLK,MAAAA,OAAO,CAACI,IAAR,CAAa,CAAb;AACD;;AACD,QAAIL,IAAI,CAAC,CAAD,CAAJ,IAAWA,IAAI,CAAC,CAAD,CAAJ,KAAY,EAA3B,EAA+B;AAC7BM,MAAAA,OAAO,GAAGN,IAAI,CAAC,CAAD,CAAd;;AACA,UAAIA,IAAI,CAAC,CAAD,CAAJ,KAAY,UAAhB,EAA4B;AAC1B,YAAI;AACFO,UAAAA,MAAM,GAAG,CAACC,IAAI,CAACC,KAAL,CAAWT,IAAI,CAAC,CAAD,CAAf,CAAD,CAAT;AACD,SAFD,CAEE,OAAOU,KAAP,EAAc;AACdZ,UAAAA,OAAO,CAACC,GAAR,CAAYW,KAAZ;AACAT,UAAAA,OAAO,CAACI,IAAR,CAAa,CAAb;AACD;AACF,OAPD,MAOO;AACLL,QAAAA,IAAI,CAACW,KAAL;AACAJ,QAAAA,MAAM,GAAGP,IAAT;AACD;AACF,KAbD,MAaO;AACLF,MAAAA,OAAO,CAACC,GAAR,CAAY,4BAAZ;AACAH,MAAAA,KAAK;AACN;;AACD;;AAEF;AACEA,IAAAA,KAAK;AACL;AAnCJ;;AAsCA,IAAIU,OAAO,KAAK,EAAhB,EAAoB;AAClBR,EAAAA,OAAO,CAACC,GAAR,CAAY,yBAAZ;;AACA,MAAIa,MAAM,GAAGC,OAAO,CAAC,kBAAD,CAAP,CAA4B,uBAA5B,CAAb;;AACAD,EAAAA,MAAM,CAACE,IAAP,CAAYR,OAAZ,EAAqBC,MAArB,EAA6B,UAASQ,QAAT,EAAmB;AAC9CjB,IAAAA,OAAO,CAACC,GAAR,CAAY,+BAAZ,EAA6CgB,QAA7C;AACD,GAFD;AAGD","sourcesContent":["'use strict';\n\n// process.exit(1);\nvar usage = function() {\n var text = `\n USAGE : npm run tools <option>\n with <option> :\n - players : get authorized players\n - add-player <username> : Add a new authorized player\n - remove-player <username> : Remove an authorized player\n - syncdb : Force server to sync with db\n - add-game <json>: Add new game into DB\n '{\"player1\":\"\",\"player2\":\"\",\"deck\":\"\",\"advRules\":[],\"status\":\"\",\"data\":\"{}\"}'\n deck : faction tournament draft (one of these)\n advRules : popularity discard (0 or any of these)\n status : CREATED ONGOING FINISHED (one of these)\n - remove-game <method> <filter> : Remove game(s) from DB\n <method> / <filter>\n byId gameId\n byPlayer1 username\n byPlayerAny username\n byStatus CREATED ONGOING FINISHED (one of these)\n byDays number of days old is last connection\n finishedByDays number of days old is last connection(only finished)\n `;\n console.log(text);\n};\n\nvar args = process.argv.slice(2);\n\nif (args.length === 0) {\n usage();\n process.exit(0);\n}\nvar command = '';\nvar option = '';\nswitch (args[0]) {\n case 'players':\n case 'syncdb':\n command = args[0];\n break;\n\n case 'add-player':\n case 'remove-player':\n case 'add-game':\n case 'remove-game':\n if (args[0] === 'remove-game' && args.length < 3) {\n usage();\n process.exit(0);\n }\n if (args[1] && args[1] !== '') {\n command = args[0];\n if (args[0] === 'add-game') {\n try {\n option = [JSON.parse(args[1])];\n } catch (error) {\n console.log(error);\n process.exit(0);\n }\n } else {\n args.shift();\n option = args;\n }\n } else {\n console.log('error ; specify a username');\n usage();\n }\n break;\n\n default:\n usage();\n break;\n}\n\nif (command !== '') {\n console.log('Connecting to server...');\n var socket = require('socket.io-client')('http://localhost:1664');\n socket.emit(command, option, function(response) {\n console.log('Done, response from server : ', response);\n });\n}\n"],"file":"server-tools.js"}