diff --git a/cli/defaults/chainqueryConfig.json b/cli/defaults/chainqueryConfig.json new file mode 100644 index 00000000..94c1898a --- /dev/null +++ b/cli/defaults/chainqueryConfig.json @@ -0,0 +1,8 @@ +{ + "host": "localhost", + "port": "3306", + "timeout": 30, + "database": "chainquery", + "username": "lbry", + "password": "root" +} diff --git a/package-lock.json b/package-lock.json index f45c2e93..794cfec8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -984,6 +984,15 @@ } } }, + "agent-base": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", + "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", + "dev": true, + "requires": { + "es6-promisify": "5.0.0" + } + }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", @@ -1079,6 +1088,12 @@ "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "dev": true }, + "arch": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/arch/-/arch-2.1.1.tgz", + "integrity": "sha512-BLM56aPo9vLLFVa8+/+pJLnrZ7QGGTVHWsCwieAWT9o9K8UeGaQbzZbGoabWLOo2ksBCztoXdqBZBplqLDDCSg==", + "dev": true + }, "are-we-there-yet": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", @@ -1238,6 +1253,12 @@ "integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=", "dev": true }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", + "dev": true + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -1914,6 +1935,16 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=" }, + "bl": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", + "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", + "dev": true, + "requires": { + "readable-stream": "2.3.6", + "safe-buffer": "5.1.2" + } + }, "block-stream": { "version": "0.0.9", "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", @@ -2131,6 +2162,35 @@ } } }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dev": true, + "requires": { + "buffer-alloc-unsafe": "1.1.0", + "buffer-fill": "1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "dev": true + }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true, + "optional": true + }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", + "dev": true + }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -2545,6 +2605,33 @@ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=" }, + "clipboardy": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-1.2.3.tgz", + "integrity": "sha512-2WNImOvCRe6r63Gk9pShfkwXsVtKCroMAevIbiae021mS850UkWPbevxsBz3tnvjZIEGvlwaqCPsw+4ulzNgJA==", + "dev": true, + "requires": { + "arch": "2.1.1", + "execa": "0.8.0" + }, + "dependencies": { + "execa": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.8.0.tgz", + "integrity": "sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=", + "dev": true, + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } + } + } + }, "cliui": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", @@ -3161,6 +3248,138 @@ "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" }, + "decompress": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.0.tgz", + "integrity": "sha1-eu3YVCflqS2s/lVnSnxQXpbQH50=", + "dev": true, + "optional": true, + "requires": { + "decompress-tar": "4.1.1", + "decompress-tarbz2": "4.1.1", + "decompress-targz": "4.1.1", + "decompress-unzip": "4.0.1", + "graceful-fs": "4.1.11", + "make-dir": "1.3.0", + "pify": "2.3.0", + "strip-dirs": "2.1.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true, + "optional": true + } + } + }, + "decompress-tar": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", + "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", + "dev": true, + "requires": { + "file-type": "5.2.0", + "is-stream": "1.1.0", + "tar-stream": "1.6.1" + } + }, + "decompress-tarbz2": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", + "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", + "dev": true, + "optional": true, + "requires": { + "decompress-tar": "4.1.1", + "file-type": "6.2.0", + "is-stream": "1.1.0", + "seek-bzip": "1.0.5", + "unbzip2-stream": "1.2.5" + }, + "dependencies": { + "file-type": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", + "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==", + "dev": true, + "optional": true + } + } + }, + "decompress-targz": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", + "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", + "dev": true, + "requires": { + "decompress-tar": "4.1.1", + "file-type": "5.2.0", + "is-stream": "1.1.0" + } + }, + "decompress-unzip": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", + "integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=", + "dev": true, + "optional": true, + "requires": { + "file-type": "3.9.0", + "get-stream": "2.3.1", + "pify": "2.3.0", + "yauzl": "2.10.0" + }, + "dependencies": { + "fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "dev": true, + "optional": true, + "requires": { + "pend": "1.2.0" + } + }, + "file-type": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", + "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=", + "dev": true, + "optional": true + }, + "get-stream": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", + "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", + "dev": true, + "optional": true, + "requires": { + "object-assign": "4.1.1", + "pinkie-promise": "2.0.1" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true, + "optional": true + }, + "yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "dev": true, + "optional": true, + "requires": { + "buffer-crc32": "0.2.13", + "fd-slicer": "1.1.0" + } + } + } + }, "deep-eql": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", @@ -3433,6 +3652,15 @@ "iconv-lite": "0.4.23" } }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "dev": true, + "requires": { + "once": "1.4.0" + } + }, "enhanced-resolve": { "version": "3.4.1", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz", @@ -3517,6 +3745,23 @@ "event-emitter": "0.3.5" } }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dev": true, + "requires": { + "es6-promise": "4.2.4" + }, + "dependencies": { + "es6-promise": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz", + "integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==", + "dev": true + } + } + }, "es6-set": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", @@ -4235,6 +4480,29 @@ } } }, + "extract-zip": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", + "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", + "dev": true, + "requires": { + "concat-stream": "1.6.2", + "debug": "2.6.9", + "mkdirp": "0.5.1", + "yauzl": "2.4.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", @@ -4353,6 +4621,12 @@ } } }, + "file-type": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=", + "dev": true + }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -4522,6 +4796,18 @@ "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", "dev": true }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, + "fs-copy-file-sync": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/fs-copy-file-sync/-/fs-copy-file-sync-1.1.1.tgz", + "integrity": "sha512-2QY5eeqVv4m2PfyMiEuy9adxNP+ajf+8AR05cEi+OAzPcOj90hvFImeZhTmKLBgSd9EvG33jsD7ZRxsx9dThkQ==", + "dev": true + }, "fs-extra": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", @@ -5280,6 +5566,13 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true, + "optional": true + }, "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", @@ -5553,6 +5846,16 @@ "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=" }, + "https-proxy-agent": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", + "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", + "dev": true, + "requires": { + "agent-base": "4.2.1", + "debug": "3.1.0" + } + }, "husky": { "version": "0.14.3", "resolved": "https://registry.npmjs.org/husky/-/husky-0.14.3.tgz", @@ -5899,6 +6202,13 @@ "ip-regex": "2.1.0" } }, + "is-natural-number": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", + "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=", + "dev": true, + "optional": true + }, "is-npm": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", @@ -6030,11 +6340,26 @@ "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", + "dev": true + }, "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" }, + "isbinaryfile": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-3.0.3.tgz", + "integrity": "sha512-8cJBL5tTd2OS0dM4jz07wQd5g0dCCqIhUxPIGtZfa5L6hWlvV5MHTITy/DBAsF+Oe2LS1X3krBUhNwaGUWpWxw==", + "dev": true, + "requires": { + "buffer-alloc": "1.2.0" + } + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -6867,6 +7192,46 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "ndb": { + "version": "1.0.24", + "resolved": "https://registry.npmjs.org/ndb/-/ndb-1.0.24.tgz", + "integrity": "sha512-GS72oSI/jrI+A/hh+qmGPPav/2+qLeup0txS3SbnFBKkH0KD/WXZhvmTO4LlEXOSV23v7x62EnqcQkrnCk2ZTA==", + "dev": true, + "requires": { + "chokidar": "2.0.4", + "clipboardy": "1.2.3", + "fs-copy-file-sync": "1.1.1", + "isbinaryfile": "3.0.3", + "mime": "2.3.1", + "ndb-node-pty-prebuilt": "0.8.0", + "opn": "5.3.0", + "puppeteer": "1.6.1", + "rimraf": "2.6.2", + "update-notifier": "2.5.0", + "ws": "6.0.0", + "xterm": "3.6.0" + }, + "dependencies": { + "mime": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz", + "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==", + "dev": true + } + } + }, + "ndb-node-pty-prebuilt": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/ndb-node-pty-prebuilt/-/ndb-node-pty-prebuilt-0.8.0.tgz", + "integrity": "sha512-j3XcGQgISib600/12hz56jaFsmpmDdFOKMHRq94+aWkxk0LqoPM5yAeJwacaPLnGm2NRFC3gTUocTIS+GSmQDQ==", + "dev": true, + "optional": true, + "requires": { + "decompress": "4.2.0", + "decompress-targz": "4.1.1", + "nan": "2.10.0" + } + }, "negotiator": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", @@ -10049,6 +10414,15 @@ "mimic-fn": "1.2.0" } }, + "opn": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/opn/-/opn-5.3.0.tgz", + "integrity": "sha512-bYJHo/LOmoTd+pfiYhfZDnf9zekVJrY+cnS2a5F2x+w5ppvTqObojTP7WiFG+kVZs9Inw+qQ/lw7TroWwhdd2g==", + "dev": true, + "requires": { + "is-wsl": "1.1.0" + } + }, "optimist": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", @@ -10933,6 +11307,12 @@ "ipaddr.js": "1.8.0" } }, + "proxy-from-env": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", + "integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4=", + "dev": true + }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -10984,6 +11364,39 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" }, + "puppeteer": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.1.tgz", + "integrity": "sha512-qz6DLwK+PhlBMjJZOMOsgVCnweYLtmiqnmJYUDPT++ElMz+cQgbsCNKPw4YDVpg3RTbsRX/pqQqr20zrp0cuKw==", + "dev": true, + "requires": { + "debug": "3.1.0", + "extract-zip": "1.6.7", + "https-proxy-agent": "2.2.1", + "mime": "2.3.1", + "progress": "2.0.0", + "proxy-from-env": "1.0.0", + "rimraf": "2.6.2", + "ws": "5.2.2" + }, + "dependencies": { + "mime": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz", + "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==", + "dev": true + }, + "ws": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", + "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", + "dev": true, + "requires": { + "async-limiter": "1.0.0" + } + } + } + }, "q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -11909,6 +12322,28 @@ "source-map": "0.4.4" } }, + "seek-bzip": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.5.tgz", + "integrity": "sha1-z+kXyz0nS8/6x5J1ivUxc+sfq9w=", + "dev": true, + "optional": true, + "requires": { + "commander": "2.8.1" + }, + "dependencies": { + "commander": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", + "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", + "dev": true, + "optional": true, + "requires": { + "graceful-readlink": "1.0.1" + } + } + } + }, "semver": { "version": "5.5.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", @@ -12546,6 +12981,16 @@ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" }, + "strip-dirs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", + "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", + "dev": true, + "optional": true, + "requires": { + "is-natural-number": "4.0.1" + } + }, "strip-eof": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", @@ -12717,6 +13162,21 @@ "inherits": "2.0.3" } }, + "tar-stream": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.1.tgz", + "integrity": "sha512-IFLM5wp3QrJODQFPm6/to3LJZrONdBY/otxcvDIQzu217zKye6yVR3hhi9lAjrC2Z+m/j5oDxMPb1qcd8cIvpA==", + "dev": true, + "requires": { + "bl": "1.2.2", + "buffer-alloc": "1.2.0", + "end-of-stream": "1.4.1", + "fs-constants": "1.0.0", + "readable-stream": "2.3.6", + "to-buffer": "1.1.1", + "xtend": "4.0.1" + } + }, "term-size": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", @@ -12806,6 +13266,12 @@ "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=" }, + "to-buffer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", + "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==", + "dev": true + }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -13021,6 +13487,45 @@ "resolve": "1.8.1" } }, + "unbzip2-stream": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.2.5.tgz", + "integrity": "sha512-izD3jxT8xkzwtXRUZjtmRwKnZoeECrfZ8ra/ketwOcusbZEp4mjULMnJOCfTDZBgGQAAY1AJ/IgxcwkavcX9Og==", + "dev": true, + "optional": true, + "requires": { + "buffer": "3.6.0", + "through": "2.3.8" + }, + "dependencies": { + "base64-js": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.8.tgz", + "integrity": "sha1-EQHpVE9KdrG8OybUUsqW16NeeXg=", + "dev": true, + "optional": true + }, + "buffer": { + "version": "3.6.0", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-3.6.0.tgz", + "integrity": "sha1-pyyTb3e5a/UvX357RnGAYoVR3vs=", + "dev": true, + "optional": true, + "requires": { + "base64-js": "0.0.8", + "ieee754": "1.1.12", + "isarray": "1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true, + "optional": true + } + } + }, "undefsafe": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.2.tgz", @@ -13647,9 +14152,6 @@ } } }, - "winston-slack-webhook": { - "version": "github:billbitt/winston-slack-webhook#ce99792bdf6473a9da69c91772eb4ecec4979b6c" - }, "wkx": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/wkx/-/wkx-0.4.5.tgz", @@ -13730,6 +14232,15 @@ "signal-exit": "3.0.2" } }, + "ws": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.0.0.tgz", + "integrity": "sha512-c2UlYcAZp1VS8AORtpq6y4RJIkJ9dQz18W32SpR/qXGfLDZ2jU4y4wKvvZwqbi7U6gxFQTeE+urMbXU/tsDy4w==", + "dev": true, + "requires": { + "async-limiter": "1.0.0" + } + }, "x-xss-protection": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/x-xss-protection/-/x-xss-protection-1.1.0.tgz", @@ -13746,6 +14257,12 @@ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" }, + "xterm": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/xterm/-/xterm-3.6.0.tgz", + "integrity": "sha512-D/7/fm7oGzZksLFQdpn1TD63V+T4Ad3LZR2JfZ1QrPZ1yDjKedIKWAZXgzeHQw8S/5HYD08GdkLnjeLm/e6Yog==", + "dev": true + }, "y18n": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", @@ -13781,6 +14298,15 @@ "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" } } + }, + "yauzl": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", + "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "dev": true, + "requires": { + "fd-slicer": "1.0.1" + } } } } diff --git a/package.json b/package.json index 524db99f..0a671a5e 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,8 @@ "prestart": "builder run bundle", "start": "node server.js", "start:build": "builder run start", + "devtools:server": "ndb server.js", + "devtools:chainquery": "ndb ./server/chainquery/index.debug.js", "test": "mocha --recursive", "test:no-lbc": "npm test -- --grep @usesLbc --invert", "test:server": "mocha --recursive './server/**/*.test.js'", @@ -108,6 +110,7 @@ "file-loader": "^1.1.11", "husky": "^0.14.3", "mocha": "^5.2.0", + "ndb": "^1.0.24", "node-sass": "^4.9.3", "nodemon": "^1.17.5", "redux-devtools": "^3.4.1", diff --git a/server/chainquery/index.debug.js b/server/chainquery/index.debug.js new file mode 100644 index 00000000..0563fa8f --- /dev/null +++ b/server/chainquery/index.debug.js @@ -0,0 +1,10 @@ +console.log('Loading `chainquery`, please wait...') + +require('@babel/polyfill'); +require('@babel/register'); + +const chainquery = require('./'); + +global.chainquery = chainquery.default ? chainquery.default : chainquery; + +console.log('`chainquery` has been loaded into the global context.') diff --git a/server/chainquery/index.js b/server/chainquery/index.js new file mode 100644 index 00000000..92a451ab --- /dev/null +++ b/server/chainquery/index.js @@ -0,0 +1,80 @@ +const Sequelize = require('sequelize'); +const logger = require('winston'); + +import abnormalClaimTable from './tables/abnormalClaimTable'; +import addressTable from './tables/addressTable'; +import applicationStatusTable from './tables/applicationStatusTable'; +import blockTable from './tables/blockTable'; +import claimTable from './tables/claimTable'; +import gorpMigrationsTable from './tables/gorpMigrationsTable'; +import inputTable from './tables/inputTable'; +import jobStatusTable from './tables/jobStatusTable'; +import outputTable from './tables/outputTable'; +import supportTable from './tables/supportTable'; +import transactionAddressTable from './tables/transactionAddressTable'; +import transactionTable from './tables/transactionTable'; + +const { + host, + port, + database, + username, + password, +} = require('../../config/chainqueryConfig'); // TODO: Make '@config/siteConfig' work outside Webpack for testing/dev + +if (!database || !username || !password) { + logger.warn('missing database, user, or password from chainqueryConfig'); +} + +// set sequelize options +const sequelize = new Sequelize(database, username, password, { + host : host, + import : port, + dialect : 'mysql', + dialectOptions: { + decimalNumbers: true, + }, + logging: false, + pool : { + max : 5, + min : 0, + idle : 10000, + acquire: 10000, + }, + operatorsAliases: false, +}); + +const db = {}; +db.abnormal_claim = sequelize.import('abnormal_claim', abnormalClaimTable.createModel); +db.application_status = sequelize.import('application_status', applicationStatusTable.createModel); +db.address = sequelize.import('address', addressTable.createModel); +db.block = sequelize.import('block', blockTable.createModel); +db.claim = sequelize.import('claim', claimTable.createModel); +db.gorp_migrations = sequelize.import('gorp_migrations', gorpMigrationsTable.createModel); +db.input = sequelize.import('input', inputTable.createModel); +db.job_status = sequelize.import('job_status', jobStatusTable.createModel); +db.output = sequelize.import('output', outputTable.createModel); +db.support = sequelize.import('support', supportTable.createModel); +db.transaction_address = sequelize.import('transaction_address', transactionAddressTable.createModel); +db.transaction = sequelize.import('transaction', transactionTable.createModel); + +// run model.association for each model in the db object that has an association +logger.info('associating chainquery db models...'); +Object.keys(db).forEach(modelName => { + if (db[modelName].associate) { + logger.info('Associating chainquery model:', modelName); + db[modelName].associate(db); + } +}); + +// establish mysql connection +sequelize + .authenticate() + .then(() => { + logger.info('Sequelize has established mysql connection for chainquery successfully.'); + }) + .catch(err => { + logger.error('Sequelize was unable to connect to the chainquery database:', err); + }); + +export default db; diff --git a/server/chainquery/models/AbnormalClaimModel.js b/server/chainquery/models/AbnormalClaimModel.js new file mode 100644 index 00000000..665953ff --- /dev/null +++ b/server/chainquery/models/AbnormalClaimModel.js @@ -0,0 +1,65 @@ +const getterMethods = { + // Add as needed, prefix all methods with `generated` +} + +export default (sequelize, { + STRING, BOOLEAN, INTEGER, TEXT, DECIMAL +}) => sequelize.define( + 'abnormal_claim', + { + id: { + primaryKey: true, + type: INTEGER, + set() { }, + }, + name: { + type: STRING, + set() { }, + }, + claim_id: { + type: STRING, + set() { }, + }, + is_update: { + type: INTEGER, + set() { }, + }, + block_hash: { + type: STRING, + set() { }, + }, + transaction_hash: { + type: STRING, + set() { }, + }, + vout: { + type: INTEGER, + set() { }, + }, + output_id: { + type: INTEGER, + set() { }, + }, + value_as_hex: { + type: TEXT, + set() { }, + }, + value_as_json: { + type: TEXT, + set() { }, + }, + created_at: { + type: INTEGER, + set() { }, + }, + modified_at: { + type: INTEGER, + set() { }, + }, + }, + { + freezeTableName: true, + getterMethods, + timestamps: false, // don't use default timestamps columns + } +); diff --git a/server/chainquery/models/AddressModel.js b/server/chainquery/models/AddressModel.js new file mode 100644 index 00000000..1d0d6ad1 --- /dev/null +++ b/server/chainquery/models/AddressModel.js @@ -0,0 +1,37 @@ +const getterMethods = { + // Add as needed, prefix all methods with `generated` +} + +export default (sequelize, { + STRING, BOOLEAN, INTEGER, TEXT, DECIMAL +}) => sequelize.define( + 'address', + { + id: { + primaryKey: true, + type: INTEGER, + set() { }, + }, + address: { + type: STRING, + set() { }, + }, + first_seen: { + type: INTEGER, + set() { }, + }, + created_at: { + type: INTEGER, + set() { }, + }, + modified_at: { + type: INTEGER, + set() { }, + }, + }, + { + freezeTableName: true, + getterMethods, + timestamps: false, // don't use default timestamps columns + } +); diff --git a/server/chainquery/models/ApplicationStatusModel.js b/server/chainquery/models/ApplicationStatusModel.js new file mode 100644 index 00000000..643d075f --- /dev/null +++ b/server/chainquery/models/ApplicationStatusModel.js @@ -0,0 +1,33 @@ +const getterMethods = { + // Add as needed, prefix all methods with `generated` +} + +export default (sequelize, { + STRING, BOOLEAN, INTEGER, TEXT, DECIMAL +}) => sequelize.define( + 'application_status', + { + id: { + primaryKey: true, + type: INTEGER, + set() { }, + }, + app_version: { + type: INTEGER, + set() { }, + }, + data_version: { + type: INTEGER, + set() { }, + }, + api_version: { + type: INTEGER, + set() { }, + }, + }, + { + freezeTableName: true, + getterMethods, + timestamps: false, // don't use default timestamps columns + } +); diff --git a/server/chainquery/models/BlockModel.js b/server/chainquery/models/BlockModel.js new file mode 100644 index 00000000..522156a5 --- /dev/null +++ b/server/chainquery/models/BlockModel.js @@ -0,0 +1,97 @@ +const getterMethods = { + // Add as needed, prefix all methods with `generated` +} + +export default (sequelize, { + STRING, BOOLEAN, INTEGER, TEXT, DECIMAL +}) => sequelize.define( + 'block', + { + id: { + primaryKey: true, + type: INTEGER, + set() { }, + }, + bits: { + type: STRING, + set() { }, + }, + chainwork: { + type: STRING, + set() { }, + }, + confirmations: { + type: STRING, + set() { }, + }, + difficulty: { + type: STRING, + set() { }, + }, + hash: { + type: STRING, + set() { }, + }, + height: { + type: STRING, + set() { }, + }, + merkle_root: { + type: STRING, + set() { }, + }, + name_claim_root: { + type: STRING, + set() { }, + }, + nonce: { + type: STRING, + set() { }, + }, + previous_block_hash: { + type: STRING, + set() { }, + }, + next_block_hash: { + type: STRING, + set() { }, + }, + block_size: { + type: STRING, + set() { }, + }, + block_time: { + type: STRING, + set() { }, + }, + version: { + type: STRING, + set() { }, + }, + version_hex: { + type: STRING, + set() { }, + }, + transaction_hashes: { + type: STRING, + set() { }, + }, + transactions_processed: { + type: STRING, + set() { }, + }, + created_at: { + type: INTEGER, + set() { }, + }, + modified_at: { + type: INTEGER, + set() { }, + }, + }, + { + freezeTableName: true, + getterMethods, + timestamps: false, // don't use default timestamps columns + } +); diff --git a/server/chainquery/models/ClaimModel.js b/server/chainquery/models/ClaimModel.js new file mode 100644 index 00000000..260b96f4 --- /dev/null +++ b/server/chainquery/models/ClaimModel.js @@ -0,0 +1,177 @@ +const logger = require('winston'); + +const { + assetDefaults: { thumbnail: defaultThumbnail }, + details: { host } +} = require('../../../config/siteConfig'); // TODO: Change back to '@config/siteConfig' when done testing + +const getterMethods = { + generated_extension() { + switch (this.content_type) { + case 'image/jpeg': + case 'image/jpg': + return 'jpg'; + case 'image/png': + return 'png'; + case 'image/gif': + return 'gif'; + case 'video/mp4': + return 'mp4'; + default: + logger.debug('setting unknown file type as file extension jpg'); + return 'jpg'; + } + }, + + // TODO: Factor this out. + generated_thumbnail() { + return this.thumbnail_url || defaultThumbnail; + }, + + generated_channel() { + console.log(this); + // + } +} + +export default (sequelize, { + STRING, BOOLEAN, INTEGER, TEXT, DECIMAL +}) => sequelize.define( + 'claim', + { + id: { + primaryKey: true, + type: INTEGER, + set() { }, + }, + transaction_hash_id: { + type: STRING, + set() { }, + }, + vout: { + type: INTEGER, + set() { }, + }, + name: { + type: STRING, + set() { }, + }, + claim_id: { + type: STRING, + set() { }, + }, + claim_type: { + type: INTEGER, + set() { }, + }, + publisher_id: { + type: STRING, + set() { }, + }, + publisher_sig: { + type: STRING, + set() { }, + }, + certificate: { + type: STRING, + set() { }, + }, + sd_hash: { + type: STRING, + set() { }, + }, + transaction_time: { + type: INTEGER, + set() { }, + }, + version: { + type: STRING, + set() { }, + }, + value_as_hex: { + type: STRING, + set() { }, + }, + value_as_json: { + type: STRING, + set() { }, + }, + valid_at_height: { + type: INTEGER, + set() { }, + }, + height: { + type: INTEGER, + set() { }, + }, + effective_amount: { + type: INTEGER, + set() { }, + }, + author: { + type: STRING, + set() { }, + }, + description: { + type: STRING, + set() { }, + }, + content_type: { + type: STRING, + set() { }, + }, + is_nsfw: { + type: INTEGER, + set() { }, + }, + language: { + type: STRING, + set() { }, + }, + thumbnail_url: { + type: STRING, + set() { }, + }, + title: { + type: STRING, + set() { }, + }, + fee: { + type: DECIMAL(58, 8), + set() { }, + }, + fee_currency: { + type: STRING, + set() { }, + }, + is_filtered: { + type: INTEGER, + set() { }, + }, + bid_state: { + type: STRING, + set() { }, + }, + created_at: { + type: INTEGER, + set() { }, + }, + modified_at: { + type: INTEGER, + set() { }, + }, + fee_address: { + type: STRING, + set() { }, + }, + claim_address: { + type: STRING, + set() { }, + }, + }, + { + freezeTableName: true, + getterMethods, + timestamps: false, // don't use default timestamps columns + } +); diff --git a/server/chainquery/models/GorpMigrationsModel.js b/server/chainquery/models/GorpMigrationsModel.js new file mode 100644 index 00000000..cbbb9614 --- /dev/null +++ b/server/chainquery/models/GorpMigrationsModel.js @@ -0,0 +1,25 @@ +const getterMethods = { + // Add as needed, prefix all methods with `generated` +} + +export default (sequelize, { + STRING, BOOLEAN, INTEGER, TEXT, DECIMAL +}) => sequelize.define( + 'gorp_migrations', + { + id: { + primaryKey: true, + type: INTEGER, + set() { }, + }, + applied_at: { + type: INTEGER, + set() { }, + }, + }, + { + freezeTableName: true, + getterMethods, + timestamps: false, // don't use default timestamps columns + } +); diff --git a/server/chainquery/models/InputModel.js b/server/chainquery/models/InputModel.js new file mode 100644 index 00000000..e77ec76f --- /dev/null +++ b/server/chainquery/models/InputModel.js @@ -0,0 +1,77 @@ +const getterMethods = { + // Add as needed, prefix all methods with `generated` +} + +export default (sequelize, { + STRING, BOOLEAN, INTEGER, TEXT, DECIMAL +}) => sequelize.define( + 'input', + { + id: { + primaryKey: true, + type: INTEGER, + set() { }, + }, + transaction_id: { + type: INTEGER, + set() { }, + }, + transaction_hash: { + type: STRING, + set() { }, + }, + input_address_id: { + type: INTEGER, + set() { }, + }, + is_coinbase: { + type: INTEGER, + set() { }, + }, + coinbase: { + type: STRING, + set() { }, + }, + prevout_hash: { + type: STRING, + set() { }, + }, + prevout_n: { + type: INTEGER, + set() { }, + }, + prevout_spend_updated: { + type: INTEGER, + set() { }, + }, + sequence: { + type: INTEGER, + set() { }, + }, + value: { + type: DECIMAL(18, 8), + set() { }, + }, + script_sig_asm: { + type: TEXT, + set() { }, + }, + script_sig_hex: { + type: TEXT, + set() { }, + }, + created: { + type: INTEGER, + set() { }, + }, + modified: { + type: INTEGER, + set() { }, + }, + }, + { + freezeTableName: true, + getterMethods, + timestamps: false, // don't use default timestamps columns + } +); diff --git a/server/chainquery/models/JobStatusModel.js b/server/chainquery/models/JobStatusModel.js new file mode 100644 index 00000000..768c4247 --- /dev/null +++ b/server/chainquery/models/JobStatusModel.js @@ -0,0 +1,33 @@ +const getterMethods = { + // Add as needed, prefix all methods with `generated` +} + +export default (sequelize, { + STRING, BOOLEAN, INTEGER, TEXT, DECIMAL +}) => sequelize.define( + 'job_status', + { + job_name: { + primaryKey: true, + type: STRING, + set() { }, + }, + last_sync: { + type: INTEGER, + set() { }, + }, + is_success: { + type: INTEGER, + set() { }, + }, + error_message: { + type: TEXT, + set() { }, + } + }, + { + freezeTableName: true, + getterMethods, + timestamps: false, // don't use default timestamps columns + } +); diff --git a/server/chainquery/models/OutputModel.js b/server/chainquery/models/OutputModel.js new file mode 100644 index 00000000..e2007115 --- /dev/null +++ b/server/chainquery/models/OutputModel.js @@ -0,0 +1,77 @@ +const getterMethods = { + // Add as needed, prefix all methods with `generated` +} + +export default (sequelize, { + STRING, BOOLEAN, INTEGER, TEXT, DECIMAL +}) => sequelize.define( + 'output', + { + id: { + primaryKey: true, + type: INTEGER, + set() { }, + }, + transaction_id: { + type: INTEGER, + set() { }, + }, + transaction_hash: { + type: STRING, + set() { }, + }, + value: { + type: DECIMAL(18, 8), + set() { }, + }, + vout: { + type: INTEGER, + set() { }, + }, + type: { + type: STRING, + set() { }, + }, + script_pub_key_asm: { + type: TEXT, + set() { }, + }, + script_pub_key_hex: { + type: TEXT, + set() { }, + }, + required_signatures: { + type: INTEGER, + set() { }, + }, + address_list: { + type: TEXT, + set() { }, + }, + is_spent: { + type: INTEGER, + set() { }, + }, + spent_by_input_id: { + type: INTEGER, + set() { }, + }, + created_at: { + type: INTEGER, + set() { }, + }, + modified_at: { + type: INTEGER, + set() { }, + }, + claim_id: { + type: STRING, + set() { }, + } + }, + { + freezeTableName: true, + getterMethods, + timestamps: false, // don't use default timestamps columns + } +); diff --git a/server/chainquery/models/SupportModel.js b/server/chainquery/models/SupportModel.js new file mode 100644 index 00000000..ffe29972 --- /dev/null +++ b/server/chainquery/models/SupportModel.js @@ -0,0 +1,49 @@ +const getterMethods = { + // Add as needed, prefix all methods with `generated` +} + +export default (sequelize, { + STRING, BOOLEAN, INTEGER, TEXT, DECIMAL +}) => sequelize.define( + 'support', + { + id: { + primaryKey: true, + type: INTEGER, + set() { }, + }, + supported_claim_id: { + type: STRING, + set() { }, + }, + support_amount: { + type: DECIMAL(18, 8), + set() { }, + }, + bid_state: { + type: STRING, + set() { }, + }, + transaction_hash_id: { + type: STRING, + set() { }, + }, + vout: { + type: INTEGER, + set() { }, + }, + created_at: { + type: INTEGER, + set() { }, + }, + modified_at: { + type: INTEGER, + set() { }, + }, + }, + { + freezeTableName: true, + getterMethods, + timestamps: false, // don't use default timestamps columns + } +); diff --git a/server/chainquery/models/TransactionAddressModel.js b/server/chainquery/models/TransactionAddressModel.js new file mode 100644 index 00000000..8bea1fcf --- /dev/null +++ b/server/chainquery/models/TransactionAddressModel.js @@ -0,0 +1,34 @@ +const getterMethods = { + // Add as needed, prefix all methods with `generated` +} + +export default (sequelize, { + STRING, BOOLEAN, INTEGER, TEXT, DECIMAL +}) => sequelize.define( + 'transaction_address', + { + transaction_id: { + primaryKey: true, + type: INTEGER, + set() { }, + }, + addess_id: { + primaryKey: true, + type: INTEGER, + set() { }, + }, + debit_amount: { + type: DECIMAL(18, 8), + set() { }, + }, + credit_amount: { + type: DECIMAL(18, 8), + set() { }, + }, + }, + { + freezeTableName: true, + getterMethods, + timestamps: false, // don't use default timestamps columns + } +); diff --git a/server/chainquery/models/TransactionModel.js b/server/chainquery/models/TransactionModel.js new file mode 100644 index 00000000..57b8b74b --- /dev/null +++ b/server/chainquery/models/TransactionModel.js @@ -0,0 +1,73 @@ +const getterMethods = { + // Add as needed, prefix all methods with `generated` +} + +export default (sequelize, { + STRING, BOOLEAN, INTEGER, TEXT, DECIMAL +}) => sequelize.define( + 'transaction', + { + id: { + primaryKey: true, + type: INTEGER, + set() { }, + }, + block_hash_id: { + type: STRING, + set() { }, + }, + input_count: { + type: INTEGER, + set() { }, + }, + output_count: { + type: INTEGER, + set() { }, + }, + fee: { + type: DECIMAL(18, 8), + set() { }, + }, + transaction_time: { + type: INTEGER, + set() { }, + }, + transaction_size: { + type: INTEGER, + set() { }, + }, + hash: { + type: STRING, + set() { }, + }, + version: { + type: INTEGER, + set() { }, + }, + lock_time: { + type: INTEGER, + set() { }, + }, + raw: { + type: TEXT, + set() { }, + }, + created_at: { + type: INTEGER, + set() { }, + }, + modified_at: { + type: INTEGER, + set() { }, + }, + created_time: { + type: INTEGER, + set() {}, + }, + }, + { + freezeTableName: true, + getterMethods, + timestamps: false, // don't use default timestamps columns + } +); diff --git a/server/chainquery/tables/abnormalClaimTable.js b/server/chainquery/tables/abnormalClaimTable.js new file mode 100644 index 00000000..1d696ce6 --- /dev/null +++ b/server/chainquery/tables/abnormalClaimTable.js @@ -0,0 +1,11 @@ +import AbnormalClaimModel from '../models/AbnormalClaimModel'; + +export default { + createModel(...args) { + return AbnormalClaimModel(...args); + }, + + associate(db) { + // associate + } +} diff --git a/server/chainquery/tables/addressTable.js b/server/chainquery/tables/addressTable.js new file mode 100644 index 00000000..a1bf2061 --- /dev/null +++ b/server/chainquery/tables/addressTable.js @@ -0,0 +1,11 @@ +import AddressModel from '../models/AddressModel'; + +export default { + createModel(...args) { + return AddressModel(...args); + }, + + associate(db) { + // associate + } +} diff --git a/server/chainquery/tables/applicationStatusTable.js b/server/chainquery/tables/applicationStatusTable.js new file mode 100644 index 00000000..2b8b14e9 --- /dev/null +++ b/server/chainquery/tables/applicationStatusTable.js @@ -0,0 +1,11 @@ +import ApplicationStatusModel from '../models/ApplicationStatusModel'; + +export default { + createModel(...args) { + return ApplicationStatusModel(...args); + }, + + associate(db) { + // associate + } +} diff --git a/server/chainquery/tables/blockTable.js b/server/chainquery/tables/blockTable.js new file mode 100644 index 00000000..86bafdc4 --- /dev/null +++ b/server/chainquery/tables/blockTable.js @@ -0,0 +1,11 @@ +import BlockModel from '../models/BlockModel'; + +export default { + createModel(...args) { + return BlockModel(...args); + }, + + associate(db) { + // associate + } +} diff --git a/server/chainquery/tables/claimTable.js b/server/chainquery/tables/claimTable.js new file mode 100644 index 00000000..ee43638d --- /dev/null +++ b/server/chainquery/tables/claimTable.js @@ -0,0 +1,11 @@ +import ClaimModel from '../models/ClaimModel'; + +export default { + createModel(...args) { + return ClaimModel(...args); + }, + + associate(db) { + // associate + } +} diff --git a/server/chainquery/tables/gorpMigrationsTable.js b/server/chainquery/tables/gorpMigrationsTable.js new file mode 100644 index 00000000..173ef6a9 --- /dev/null +++ b/server/chainquery/tables/gorpMigrationsTable.js @@ -0,0 +1,11 @@ +import GorpMigrationsModel from '../models/GorpMigrationsModel'; + +export default { + createModel(...args) { + return GorpMigrationsModel(...args); + }, + + associate(db) { + // associate + } +} diff --git a/server/chainquery/tables/inputTable.js b/server/chainquery/tables/inputTable.js new file mode 100644 index 00000000..3add28f7 --- /dev/null +++ b/server/chainquery/tables/inputTable.js @@ -0,0 +1,11 @@ +import InputModel from '../models/InputModel'; + +export default { + createModel(...args) { + return InputModel(...args); + }, + + associate(db) { + // associate + } +} diff --git a/server/chainquery/tables/jobStatusTable.js b/server/chainquery/tables/jobStatusTable.js new file mode 100644 index 00000000..76042c1b --- /dev/null +++ b/server/chainquery/tables/jobStatusTable.js @@ -0,0 +1,11 @@ +import JobStatusModel from '../models/JobStatusModel'; + +export default { + createModel(...args) { + return JobStatusModel(...args); + }, + + associate(db) { + // associate + } +} diff --git a/server/chainquery/tables/outputTable.js b/server/chainquery/tables/outputTable.js new file mode 100644 index 00000000..d00d0bac --- /dev/null +++ b/server/chainquery/tables/outputTable.js @@ -0,0 +1,11 @@ +import OutputModel from '../models/OutputModel'; + +export default { + createModel(...args) { + return OutputModel(...args); + }, + + associate(db) { + // associate + } +} diff --git a/server/chainquery/tables/supportTable.js b/server/chainquery/tables/supportTable.js new file mode 100644 index 00000000..82a81dcd --- /dev/null +++ b/server/chainquery/tables/supportTable.js @@ -0,0 +1,11 @@ +import SupportModel from '../models/SupportModel'; + +export default { + createModel(...args) { + return SupportModel(...args); + }, + + associate(db) { + // associate + } +} diff --git a/server/chainquery/tables/transactionAddressTable.js b/server/chainquery/tables/transactionAddressTable.js new file mode 100644 index 00000000..4d19bb09 --- /dev/null +++ b/server/chainquery/tables/transactionAddressTable.js @@ -0,0 +1,11 @@ +import TransactionAddressModel from '../models/TransactionAddressModel'; + +export default { + createModel(...args) { + return TransactionAddressModel(...args); + }, + + associate(db) { + // associate + } +} diff --git a/server/chainquery/tables/transactionTable.js b/server/chainquery/tables/transactionTable.js new file mode 100644 index 00000000..771c8a76 --- /dev/null +++ b/server/chainquery/tables/transactionTable.js @@ -0,0 +1,11 @@ +import TransactionModel from '../models/TransactionModel'; + +export default { + createModel(...args) { + return TransactionModel(...args); + }, + + associate(db) { + // associate + } +}