Commit aba3e1985d92153bb647ab36392f4c4b98b45589
1 parent
ea230db8
Exists in
develop
update mockup
Showing
17 changed files
with
2157 additions
and
19 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,89 @@ |
| 1 | + | |
| 2 | +module.exports.accountPayables = async (req, res) => { | |
| 3 | + console.log('===== GET accountPayables =====') | |
| 4 | + console.log('url', req.originalUrl); | |
| 5 | + console.log('headers', req.headers); | |
| 6 | + console.log('query', req.query); | |
| 7 | + console.log('params', req.params); | |
| 8 | + console.log('body', req.body); | |
| 9 | + | |
| 10 | + let response = { | |
| 11 | + "link": { | |
| 12 | + "prev": "ip:port/sgl/api/v1/accounting-management/accounting?transactionId=$transactionId&page=$page&limit=$limit&sortby=$sortby", | |
| 13 | + "next": "ip:port/sgl/api/v1/accounting-management/accounting?transactionId=$transactionId&page=$page&limit=$limit&sortby=$sortby" | |
| 14 | + }, | |
| 15 | + "meta": { | |
| 16 | + "currentPage": 1, | |
| 17 | + "totalPages": 1, | |
| 18 | + "limit": 10 | |
| 19 | + }, | |
| 20 | + "total": 4, | |
| 21 | + "results": [ | |
| 22 | + { | |
| 23 | + "_id": "ia09igfyJD3", | |
| 24 | + "vendorCode": "6100103130", | |
| 25 | + "accountName": "บริษัท เคเอสไอ โซลูชั่น จำกัด", | |
| 26 | + "partnerBank": "0001", | |
| 27 | + "tradingPartner": "", | |
| 28 | + "branch": "00000", | |
| 29 | + "taxId": "0105556143098", | |
| 30 | + "memberId": "75EzpNZ0Twt", | |
| 31 | + "createdBy": "System", | |
| 32 | + "createdDate": "2022-06-20T08:52:08.655Z", | |
| 33 | + "updatedBy": "System", | |
| 34 | + "updatedDate": "2022-06-20T08:52:08.655Z" | |
| 35 | + } | |
| 36 | + // , | |
| 37 | + // { | |
| 38 | + // "_id": "LkStgv7Pqjv", | |
| 39 | + // "vendorCode": "7100000010", | |
| 40 | + // "accountName": "บจ.แอดวานซ์ ไวร์เลส เน็ทเวอร์ค", | |
| 41 | + // "partnerBank": null, | |
| 42 | + // "tradingPartner": "1200", | |
| 43 | + // "branch": "00000", | |
| 44 | + // "memberId": "7tZlEVVBDiq", | |
| 45 | + // "createdBy": "System", | |
| 46 | + // "createdDate": "2021-06-22T09:51:37.907Z", | |
| 47 | + // "updatedBy": "System", | |
| 48 | + // "updatedDate": "2021-06-22T09:51:37.907Z", | |
| 49 | + // "taxId": "0105548115897" | |
| 50 | + // }, | |
| 51 | + // { | |
| 52 | + // "_id": "u2fc0do5gaB", | |
| 53 | + // "vendorCode": "6300000003", | |
| 54 | + // "accountName": "บจ.เกมมี่", | |
| 55 | + // "partnerBank": "0601", | |
| 56 | + // "tradingPartner": "", | |
| 57 | + // "branch": "00001", | |
| 58 | + // "memberId": "suVHEKylHuq", | |
| 59 | + // "createdBy": "System", | |
| 60 | + // "createdDate": "2021-05-21T09:51:37.907Z", | |
| 61 | + // "updatedBy": "System", | |
| 62 | + // "updatedDate": "2021-05-21T09:51:37.907Z", | |
| 63 | + // "taxId": "1234567891113" | |
| 64 | + // }, | |
| 65 | + // { | |
| 66 | + // "_id": "NEqCwA4l9Cv", | |
| 67 | + // "vendorCode": "7100000030", | |
| 68 | + // "accountName": "แอดวานซ์ ไวร์เลส เน็ทเวอร์ค", | |
| 69 | + // "partnerBank": "0001", | |
| 70 | + // "tradingPartner": "", | |
| 71 | + // "branch": "00000", | |
| 72 | + // "taxId": "0105548115897", | |
| 73 | + // "memberId": "VsIsSNY9peQ", | |
| 74 | + // "createdBy": "System", | |
| 75 | + // "createdDate": "2022-09-26T06:52:42.875Z", | |
| 76 | + // "updatedBy": "System", | |
| 77 | + // "updatedDate": "2022-09-26T06:52:42.875Z" | |
| 78 | + // } | |
| 79 | + ] | |
| 80 | + } | |
| 81 | + | |
| 82 | + | |
| 83 | + // let response = { | |
| 84 | + // "resultCode":"40109", | |
| 85 | + // "resultDescription":"Authentication failed. Invalid username or password" | |
| 86 | + // } | |
| 87 | + | |
| 88 | + res.send(response) | |
| 89 | +} | |
| 0 | 90 | \ No newline at end of file | ... | ... |
admd.js
| ... | ... | @@ -40,10 +40,20 @@ module.exports.oauthToken = async (req, res) => { |
| 40 | 40 | // resultDescription: 'admd something error' |
| 41 | 41 | // } |
| 42 | 42 | |
| 43 | + // response = { | |
| 44 | + // resultCode: "40401", | |
| 45 | + // resultDescription: 'Data not found' | |
| 46 | + // } | |
| 47 | + | |
| 43 | 48 | // response = {error : 'invalid_grant'} |
| 44 | 49 | |
| 45 | 50 | } |
| 46 | 51 | |
| 52 | + response = { | |
| 53 | + resultCode: "40401", | |
| 54 | + resultDescription: 'Data not found' | |
| 55 | + } | |
| 56 | + | |
| 47 | 57 | res.send(response) |
| 48 | 58 | } |
| 49 | 59 | ... | ... |
app.js
| ... | ... | @@ -373,6 +373,8 @@ app.post('/auth/v3.1/oauth/token', require('./admd').oauthToken); |
| 373 | 373 | app.post('/auth/v3.1/logout', require('./admd').logout); |
| 374 | 374 | app.post('/validate/token', require('./admd').validateToken); |
| 375 | 375 | |
| 376 | +app.post('/auth/v3.2/oauth/token', require('./admd').oauthToken); | |
| 377 | + | |
| 376 | 378 | app.post('/point/v1/deleteCustomer', require('./micro_point').deleteCustomer); |
| 377 | 379 | app.post('/privilege/v1/history/delete', require('./privilege').deleteCustomer); |
| 378 | 380 | |
| ... | ... | @@ -447,6 +449,14 @@ app.post('/api/v1/cst/wallets/checkWallet', require('./bot_gateway').checkWallet |
| 447 | 449 | app.get('/api/v2/Account/:accountId/Destinations', require('./magellan').getAccountDestination); |
| 448 | 450 | app.get('/api/v2/Account/:accountId/Things', require('./magellan').getAccountThings); |
| 449 | 451 | |
| 452 | +app.get('/api/v1/pam-js/apiList/partner/:username', require('./pam').getApiForPartner); | |
| 453 | + | |
| 454 | +app.post('/api/authen/application', require('./cmsp-authen').authen); | |
| 455 | + | |
| 456 | +app.post('/graphql', require('./cirr').graphql); | |
| 457 | + | |
| 458 | +app.get('/sgl/api/v1/accounting-management/accountpayables', require('./account-api').accountPayables); | |
| 459 | + | |
| 450 | 460 | app.get('/api/random/leader', function (req, res) { |
| 451 | 461 | const months = ["เกมส์", "โน๊ต setup", "โน๊ต วัศรุต", "แบงค์", "มอส", "ปิ๊ค", "เต้นพอไม่ต้องตื่น", "เปา", "นัท", "kik", "new", "ann","na", "boky", "eve", "miki", "pla", "sugar"]; |
| 452 | 462 | // const months = [ "ann"]; |
| ... | ... | @@ -614,28 +624,525 @@ q.on('success', function (result, job) { |
| 614 | 624 | |
| 615 | 625 | app.listen(port, () => console.log('app listening on port ' + port + '!')) |
| 616 | 626 | |
| 617 | -//test | |
| 627 | +decryptAes256 = function (text) { | |
| 628 | + const crypto = require('crypto'); | |
| 629 | + try { | |
| 630 | + const pwd = "l;ylfu;yo/o9drkp6g-hk#ohemj;,0hk" | |
| 631 | + const iv = Buffer.alloc(16, 0); | |
| 632 | + var mykey = crypto.createDecipheriv('aes-256-cbc', pwd, iv); | |
| 633 | + var mystr = mykey.update(text, 'hex', 'utf8') | |
| 634 | + mystr += mykey.final('utf8'); | |
| 635 | + return mystr.toString() | |
| 636 | + } catch (e) { | |
| 637 | + return text | |
| 638 | + } | |
| 639 | + } | |
| 640 | + | |
| 641 | +console.log('decryptAes256', decryptAes256('54848fc27a3ecd9340da85bc201769d180721cedb4e472781920b05d09d9daf6')) | |
| 618 | 642 | |
| 643 | +//test | |
| 644 | +const NodeRSA = require('node-rsa'); | |
| 645 | +const jwt = require('jsonwebtoken') | |
| 646 | +const crypto = require('crypto'); | |
| 619 | 647 | test = () => { |
| 620 | - z = 0 | |
| 621 | - j = 1 | |
| 622 | - k = 0 | |
| 623 | - while (!(j > 10)) { | |
| 624 | - z = z + 1 | |
| 625 | - k = 1 | |
| 626 | - while(!(k > 10)) { | |
| 627 | - k = k + 1 | |
| 628 | - z = z + 1 | |
| 648 | + // let key = new NodeRSA() | |
| 649 | + // // key.importKey( Buffer.from(result.encryptPublicKey, 'base64') , 'pkcs8-public-der');; | |
| 650 | + // key.importKey( Buffer.from(`MIIEpAIBAAKCAQEAtENoPR+2r0O/AaPcLwHPv67du7ZHE4XIPDT59oo5pL/vdQrmfapjYDsHdt9GW1ch8xfOWX4TERkBnTqudbNkN0uGzKzGCnJ6DUDfhURelTXpfl2wPLnf4G1EHxtN4AG9Juy+NTT3QDTRriHHUaw07Ra/ExbXB2uV1yDIg+zVTuZRmFDvkIsWMCconrSp1no0C6oz1i2sF+QFQ8atObtYPOf008NusZGfwk9d/RS3G6EQD5K9dgIzvkZB27lgQ+cCg7pifF6pNLvUkTEkbF6v3Uo5lD4gs7d0LfJ94DP2PbOqXDSBO1WtZWh950QtBS71CRnhJpGXt6XBgJMB4QlfZwIDAQABAoIBAQCugO6g9VlxU2DNoqXdL6DAi/SE6hDmWkUb26D7RJZG4bNal6HHlzG6j4pLThubAr+Px8Tvp3envpBsd8k5kd77FHc7HipdJLL4r4tyRFxXj6got2OLddi/NqeSgWki6CwHSXlcopiUJE2zh2mfq9hUiAeS4DJrMYANkOPrqlJYnEfOAlAHt0a2Q0GJ+6xpQqZ/EyklSpxBsPoFI2Wjll0hFzL472hg3NBqIU37O25JBLkQjhX5aM+t5M0sYvOZ00aDqBoCWV09KIX+zw8fLK1MvqxfGyUoRCaHUnjVq2cwdswOIzHQ6csRMcTh3/7PnKVr5XV9CdP3Lr6kilf5Rx/BAoGBAN4G8iTaNBs0n/0hj9rg3B8+03OOlhGWZk+8RPHhzdAPhNllhq4tgoWkyKcts6w4Rh545btr7U/p01NNqn0dXfcKvOHheWhEKhbivOAVDcyKc45afXRlTon2YyC+kIUVKrg6e+jD2q5Gp88lxAPNMdx6epo7s5CYSiDMrvJl9sNHAoGBAM/YhmurQhKeOmcN5hS4BWvueyUbfD07nCSjzrHL45pH8ejj5VJkcWyzy4+TD3qFmWgxEih9947uo5Mu1TizMSV+0IELBqJCuKKEBUkMkwSCv2PI42b7Nmd1Bd7cIOgR3JZzN6Q2Z1Vg/3PfcRMxTPV3Lbosr9Z6pkxeGatCDVLhAoGATsRED1Lh/WzT/Wd0s3/mV6dgOLSzBJZIwazXAMDM1S1MQhvEhfJbRbJKBRUvkr98EL9vMOh/DkSz1e/Ntgk/Fq9WhwQIoDbef7P8sbqGZLQRfsUXkL2H+WXRkQJKHwx9VVJaNx+UaxNh4RlSys53C/Lfn+viLj/4vF4hCpmly20CgYAJR5OIzxaeGi5lV3uERUsIrJcW6wk6+qRYBnA+A+pfgwLL8RDWAuIFhml6OYihYcGdo0M6R5V77i+jbJ3ccDOrhuPsPv/G0s/Hgblyr3sI4oWFAP0WJfUh3Vmrv4xAkDuXBAHh9QPcDf6Zv8oenz7eXrnN7BzVqJgwJKtkuAg8QQKBgQDQWOIB6rGZvzNFcmR6NOCCXo/n6LLO8yFbE/bnC8VhV9a+lvBvbF/5ydAQ59pF6HucG9CvCehaTURpLk8AIzPbX0YAp8vUz0uxQEqxZTliix5OQDOgGziKx2j5dEKiL3QyeVpcWgtR6H7j3FAveVfFsEZ4Z41klRFtDtlfoxRpcg==`, 'base64'), 'pkcs1-private-der' ); | |
| 651 | + // // console.log(key.isPrivate()) | |
| 652 | + // // const text = JSON.stringify(contentRSA); | |
| 653 | + // // const encrypted = key.encrypt(text, 'base64'); | |
| 654 | + // // console.log('encrypted:', encrypted); | |
| 655 | + // let encrypted = "fWPDV0Pe7aXrobnTQykCStZ1wAdLEe3jd37sNcSai9O950qza4yE1e03eiWseFYNT480oKvvV774kZOIsM05ESVhsDEKscA/EMomuFyA15By7zENXSPx3TDaTyKMJ4ebGm1riXtODz9jlEWp8RPGIAi3Md9zItH7xsg0nKBqqffbblBFbZtVYjOFVRIG1notBSzqKiMk1M97TwuuPFEKj4rbGMZeQEl5LASr157+zqA3WtQewnHHf1v+BzHgMGmBUjzNDICvfHpAerZK5Krgn8STtvajHYcqX6qIRhCaKSDHpCncol3jCGuL5I47k/OiIg6uvdM7qZDWC/jhptvLfQ==" | |
| 656 | + // const decrypted = key.decrypt(encrypted, 'utf8'); | |
| 657 | + // console.log('decrypted:', decrypted); | |
| 658 | + | |
| 659 | + rsaPrivateKey = `-----BEGIN RSA PRIVATE KEY----- | |
| 660 | +MIIEpAIBAAKCAQEAtENoPR+2r0O/AaPcLwHPv67du7ZHE4XIPDT59oo5pL/vdQrm | |
| 661 | +fapjYDsHdt9GW1ch8xfOWX4TERkBnTqudbNkN0uGzKzGCnJ6DUDfhURelTXpfl2w | |
| 662 | +PLnf4G1EHxtN4AG9Juy+NTT3QDTRriHHUaw07Ra/ExbXB2uV1yDIg+zVTuZRmFDv | |
| 663 | +kIsWMCconrSp1no0C6oz1i2sF+QFQ8atObtYPOf008NusZGfwk9d/RS3G6EQD5K9 | |
| 664 | +dgIzvkZB27lgQ+cCg7pifF6pNLvUkTEkbF6v3Uo5lD4gs7d0LfJ94DP2PbOqXDSB | |
| 665 | +O1WtZWh950QtBS71CRnhJpGXt6XBgJMB4QlfZwIDAQABAoIBAQCugO6g9VlxU2DN | |
| 666 | +oqXdL6DAi/SE6hDmWkUb26D7RJZG4bNal6HHlzG6j4pLThubAr+Px8Tvp3envpBs | |
| 667 | +d8k5kd77FHc7HipdJLL4r4tyRFxXj6got2OLddi/NqeSgWki6CwHSXlcopiUJE2z | |
| 668 | +h2mfq9hUiAeS4DJrMYANkOPrqlJYnEfOAlAHt0a2Q0GJ+6xpQqZ/EyklSpxBsPoF | |
| 669 | +I2Wjll0hFzL472hg3NBqIU37O25JBLkQjhX5aM+t5M0sYvOZ00aDqBoCWV09KIX+ | |
| 670 | +zw8fLK1MvqxfGyUoRCaHUnjVq2cwdswOIzHQ6csRMcTh3/7PnKVr5XV9CdP3Lr6k | |
| 671 | +ilf5Rx/BAoGBAN4G8iTaNBs0n/0hj9rg3B8+03OOlhGWZk+8RPHhzdAPhNllhq4t | |
| 672 | +goWkyKcts6w4Rh545btr7U/p01NNqn0dXfcKvOHheWhEKhbivOAVDcyKc45afXRl | |
| 673 | +Ton2YyC+kIUVKrg6e+jD2q5Gp88lxAPNMdx6epo7s5CYSiDMrvJl9sNHAoGBAM/Y | |
| 674 | +hmurQhKeOmcN5hS4BWvueyUbfD07nCSjzrHL45pH8ejj5VJkcWyzy4+TD3qFmWgx | |
| 675 | +Eih9947uo5Mu1TizMSV+0IELBqJCuKKEBUkMkwSCv2PI42b7Nmd1Bd7cIOgR3JZz | |
| 676 | +N6Q2Z1Vg/3PfcRMxTPV3Lbosr9Z6pkxeGatCDVLhAoGATsRED1Lh/WzT/Wd0s3/m | |
| 677 | +V6dgOLSzBJZIwazXAMDM1S1MQhvEhfJbRbJKBRUvkr98EL9vMOh/DkSz1e/Ntgk/ | |
| 678 | +Fq9WhwQIoDbef7P8sbqGZLQRfsUXkL2H+WXRkQJKHwx9VVJaNx+UaxNh4RlSys53 | |
| 679 | +C/Lfn+viLj/4vF4hCpmly20CgYAJR5OIzxaeGi5lV3uERUsIrJcW6wk6+qRYBnA+ | |
| 680 | +A+pfgwLL8RDWAuIFhml6OYihYcGdo0M6R5V77i+jbJ3ccDOrhuPsPv/G0s/Hgbly | |
| 681 | +r3sI4oWFAP0WJfUh3Vmrv4xAkDuXBAHh9QPcDf6Zv8oenz7eXrnN7BzVqJgwJKtk | |
| 682 | +uAg8QQKBgQDQWOIB6rGZvzNFcmR6NOCCXo/n6LLO8yFbE/bnC8VhV9a+lvBvbF/5 | |
| 683 | +ydAQ59pF6HucG9CvCehaTURpLk8AIzPbX0YAp8vUz0uxQEqxZTliix5OQDOgGziK | |
| 684 | +x2j5dEKiL3QyeVpcWgtR6H7j3FAveVfFsEZ4Z41klRFtDtlfoxRpcg== | |
| 685 | +-----END RSA PRIVATE KEY-----` | |
| 686 | + | |
| 687 | + let token = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWdpdGFsLmFpcy50aC9hdXRoIiwic3ViIjoiaWRUb2tlbiIsImp0aSI6Ik45TmdVTmpJUUpyIiwiaW5mbyI6IkhhZ3V1SmdtVG5wbDVKZ2dIeUZ3cnlyMGRkbVlBNEtadlN6VlIwczZlMlM4NXRUMmVnMEM2RWhRSGNnTXdaSGRJdys5NFdOcUs2M1lVQVJXM2E4OEY1YVdyVnRzQWNTMC94dnQvOHl0VmcwR3BrM0Rqb2xMcWxCNFVCTXcwYjhsTjFtb0dzVTMwN2xXYXlzMVZUWDVaZHVxdk5kWEpaWHpLekRPSFhzSUhRbERGY1U5SmlkMW1lb2RJQnllL2tCVHRaMTVMWnlNRWpscm9adndlVVJSMXg4aEJiQ2RxZDJYQ05iWUNCOU1yaHcvQmR0RmszMUF5MzUxa3lJSkNUZkdmaVlNTWNMcHdPTlZQUEgzRHNrclU3UFh1TDR4eGVWSEVGQWRhTlJWQ3E4T25NU0s4cTY1S2VqKy9ncUNRRFJYa0FLRlplbzFKNCthcGtXUzNBMXBDQT09IiwiaWF0IjoxNjYwMTkyODIxLCJleHAiOjE2NjAxOTM0MjF9.MiQ92QxQ8t8atL9Kw12QEaT6f3HGY5uXHWNJrmti3zZR8QC9DO6XGEbEpR03cgT4Ialb2jZD2WzOums2CN08nbwiSvvEWaRL8Vl8j4w3f1vePw25w64E7rc426PY-nYlk-U-AoErYxzSw8iLo6pyVDUg7psZHZh73-OshSC4xySV2oJAdEwsFv5VlGdNrBJZitP7OVdF7Qu7UUQqQPFR76bkMcOEmyDsBGzXUT3A0AlK2ilCwV1a_VCnfmdaQiMbXZ4v2iyRB0LsTha7OBi51AredQ5HYIwcLF0Mu7r1CFMRd0zqDTycO3Aaag5Pb82zJwfsr2JyRcDSiGB8nKKCrQ' | |
| 688 | + jwtPublicKey = `-----BEGIN PUBLIC KEY----- | |
| 689 | +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA84UZfRnq6v9WTTA2zKLT | |
| 690 | +pKW8Zh7p0wipwTT59e7aT2znqGFD9xB5zx8BPIRGZ86aookOtI4CYGNS8TK8PMqB | |
| 691 | +RcdBRt4xMO+bzHeHE0ichFg46eCU7Bj5NIGDb8n2rWPRTk/jmkAYPIhMuWy2Jcw+ | |
| 692 | +u3Mu7lhvlnDAzQvaL45Reg4CqbRtjuNFFcLmTkWNzJidrOmrS9lFuy6wKrLvHNmP | |
| 693 | +eQHFKVUU9qcmtODdmjsTJKekVnXO13fTE+PWQnWB0NbPpSyH8k3YlkoTDBFeZoY+ | |
| 694 | +HH8M+vaXXg6OLNS8Ry8exz8iV5ofiwthNp3Ya/YzXMzrxSrewDNr4VBj3Ckv9IYW | |
| 695 | +FQIDAQAB | |
| 696 | +-----END PUBLIC KEY-----` | |
| 697 | + let jwtDecoded = jwt.verify(token, jwtPublicKey) | |
| 698 | + | |
| 699 | + console.log('jwt decode:', jwtDecoded) | |
| 700 | + | |
| 701 | + const crypto = require('crypto'); | |
| 702 | + const decryptedData = crypto.privateDecrypt( | |
| 703 | + { | |
| 704 | + key: rsaPrivateKey, | |
| 705 | + padding: crypto.constants.RSA_PKCS1_PADDING, | |
| 706 | + }, | |
| 707 | + Buffer.from(jwtDecoded.info, 'base64') | |
| 708 | + ); | |
| 709 | + | |
| 710 | + // The decrypted data is of the Buffer type, which we can convert to a | |
| 711 | + // string to reveal the original data | |
| 712 | + console.log("decrypted info data:", decryptedData.toString()); | |
| 713 | + | |
| 714 | +} | |
| 715 | + | |
| 716 | +// test() | |
| 717 | + | |
| 718 | + | |
| 719 | +test1 = (text) => { | |
| 720 | + try { | |
| 721 | + const iv = Buffer.alloc(16, 0); | |
| 722 | + var mykey = crypto.createDecipheriv('aes-256-cbc', 'mypasswordmypasswordmypassword12', iv); | |
| 723 | + var mystr = mykey.update(text, 'hex', 'utf8') | |
| 724 | + mystr += mykey.final('utf8'); | |
| 725 | + return mystr.toString() | |
| 726 | + } catch (e) { | |
| 727 | + console.log(e) | |
| 728 | + return text | |
| 729 | + } | |
| 730 | +} | |
| 731 | + | |
| 732 | +// console.log(test1('5B346775BE1213611D4E77D63795296E')) | |
| 733 | + | |
| 734 | +const fs = require('fs'); | |
| 735 | +const { time } = require('console'); | |
| 736 | +test2 = () => { | |
| 737 | + var jwtPrivate = fs.readFileSync('./jwt.pem'); // get private key | |
| 738 | + const token = jwt.sign({ | |
| 739 | + "username": "dev@mail.com", | |
| 740 | + "ssid": "747GSS5FMkJqcU45KUiMws", | |
| 741 | + "refresh_token_expires_in": 86400 | |
| 742 | + }, Buffer.from(jwtPrivate) , { algorithm: 'RS256' }); | |
| 743 | + return token | |
| 744 | +} | |
| 745 | + | |
| 746 | +// console.log(test2()) | |
| 747 | + | |
| 748 | +test3 = (seq) => { | |
| 749 | + let most = 0; | |
| 750 | + for(i in seq){ | |
| 751 | + if((+i + 1) <= seq.length) { | |
| 752 | + let v = shum(seq[i], seq.slice((+i + 1)), seq[i]) | |
| 753 | + if(v > most) { | |
| 754 | + most = v | |
| 755 | + } | |
| 629 | 756 | } |
| 630 | - j = j + 1 | |
| 631 | 757 | } |
| 632 | - let a = "ABCDab" | |
| 633 | - console.log(typeof a == 'string') | |
| 634 | - if(typeof a == 'string') { | |
| 635 | - console.log(a.toLowerCase()) | |
| 758 | + console.log('result', most) | |
| 759 | +} | |
| 760 | + | |
| 761 | +shum = (value, array, shummary) => { | |
| 762 | + for(a in array) { | |
| 763 | + if(value === array[a]) { | |
| 764 | + return shummary + array[a] | |
| 765 | + } else { | |
| 766 | + return shum(value, array.slice(1), array[a] + shummary) | |
| 767 | + } | |
| 768 | + } | |
| 769 | + return 0 | |
| 770 | +} | |
| 771 | + | |
| 772 | +let arr = [1,2,1,4,5,6,1,8,9,2] | |
| 773 | + | |
| 774 | +// console.time('test3') | |
| 775 | +// test3(arr) | |
| 776 | +// console.timeEnd('test3') | |
| 777 | + | |
| 778 | +test4 = (seq) => { | |
| 779 | + let most = 0 | |
| 780 | + for(s in seq) { | |
| 781 | + let i = seq.indexOf(seq[s], +s + 1) | |
| 782 | + if(i !== -1) { | |
| 783 | + let sum = seq[s] | |
| 784 | + for(let j = s; j < i; j++) { | |
| 785 | + sum += seq[j] | |
| 786 | + } | |
| 787 | + if(sum > most) { | |
| 788 | + most = sum | |
| 789 | + } | |
| 790 | + } | |
| 791 | + } | |
| 792 | + console.log('result', most) | |
| 793 | +} | |
| 794 | + | |
| 795 | +// console.time('test4') | |
| 796 | +// test4(arr) | |
| 797 | +// console.timeEnd('test4') | |
| 798 | + | |
| 799 | + | |
| 800 | +test5 = (home) => { | |
| 801 | + console.log('input >>', home) | |
| 802 | + for(let ih in home) { | |
| 803 | + let thisHomeHasTank = false | |
| 804 | + let thisHomeHasLand = false | |
| 805 | + if(home.charAt(ih) == 'H') { | |
| 806 | + thisHomeHasTank = hasTank(home, ih) | |
| 807 | + | |
| 808 | + if(thisHomeHasTank) { | |
| 809 | + continue | |
| 810 | + } else { | |
| 811 | + thisHomeHasLand = hasLand(home, ih) | |
| 812 | + } | |
| 813 | + | |
| 814 | + if(thisHomeHasLand) { | |
| 815 | + home = addTank(home, ih) | |
| 816 | + } else { | |
| 817 | + return -1 | |
| 818 | + } | |
| 819 | + } | |
| 820 | + } | |
| 821 | + | |
| 822 | + console.log('result >>', home) | |
| 823 | + let tankCount = 0 | |
| 824 | + for(let t of home) { | |
| 825 | + if(t == 'T') { | |
| 826 | + tankCount += 1 | |
| 827 | + } | |
| 828 | + } | |
| 829 | + | |
| 830 | + return tankCount | |
| 831 | +} | |
| 832 | + | |
| 833 | +hasTank = (home, i) => { | |
| 834 | + if(home.charAt(+i-1)) { | |
| 835 | + return home.charAt(+i-1) == 'T' | |
| 836 | + } | |
| 837 | + | |
| 838 | + if(home.charAt(+i+1)) { | |
| 839 | + return home.charAt(+i+1) == 'T' | |
| 840 | + } | |
| 841 | +} | |
| 842 | + | |
| 843 | +hasLand = (home, i) => { | |
| 844 | + let hasLand = false | |
| 845 | + if(home.charAt(+i-1)) { | |
| 846 | + hasLand = home.charAt(+i-1) == '_' | |
| 847 | + } | |
| 848 | + | |
| 849 | + if(home.charAt(+i+1) && !hasLand) { | |
| 850 | + hasLand = home.charAt(+i+1) == '_' | |
| 851 | + } | |
| 852 | + | |
| 853 | + return hasLand | |
| 854 | +} | |
| 855 | + | |
| 856 | +addTank = (home, i) => { | |
| 857 | + if(home.charAt(+i+1)) { | |
| 858 | + if( home.charAt(+i+1) == '_' ){ | |
| 859 | + home = replaceChar(home, +i+1, 'T') | |
| 860 | + return home | |
| 861 | + } | |
| 862 | + } | |
| 863 | + | |
| 864 | + if(home.charAt(+i-1)) { | |
| 865 | + if( home.charAt(+i-1) == '_' ){ | |
| 866 | + home = replaceChar(home, +i-1, 'T') | |
| 867 | + return home | |
| 868 | + } | |
| 869 | + } | |
| 870 | +} | |
| 871 | + | |
| 872 | +replaceChar = (str, index, replacement) => { | |
| 873 | + return str.substring(0, index) + replacement + str.substring(index + 1); | |
| 874 | +} | |
| 875 | + | |
| 876 | +// console.time('test5') | |
| 877 | +// console.log('number of tanks:', test5('_H_H_H_H_'), '\n') | |
| 878 | +// console.timeEnd('test5') | |
| 879 | +// console.log('number of tanks:', test5('H_HHH_'), '\n') | |
| 880 | +// console.log('number of tanks:', test5('H_H_H_H_'), '\n') | |
| 881 | +// console.log('number of tanks:', test5('_HH___HH_'), '\n') | |
| 882 | +// console.log('number of tanks:', test5('_H_'), '\n') | |
| 883 | +// console.log('\n') | |
| 884 | + | |
| 885 | +let current = [150,160,170] | |
| 886 | +let future = [200,150,160] | |
| 887 | +test6 = (saving) => { | |
| 888 | + let profit = 0 | |
| 889 | + | |
| 890 | + for(let i in current) { | |
| 891 | + if(saving > current[i]) { | |
| 892 | + saving -= current[i] | |
| 893 | + } | |
| 894 | + } | |
| 895 | + | |
| 896 | + return profit | |
| 897 | +} | |
| 898 | + | |
| 899 | +// console.log(test6(310)) | |
| 900 | + | |
| 901 | +// console.log(new URLSearchParams({ | |
| 902 | +// client_id: '123clientId', | |
| 903 | +// client_secret: '123clientSecret', | |
| 904 | +// grant_type: '123authorization_code', | |
| 905 | +// code: 'body.code', | |
| 906 | +// redirect_uri: '123redirectUrl', | |
| 907 | +// }).toString()) | |
| 908 | + | |
| 909 | +test7 = (amount) => { | |
| 910 | + let tb = Math.floor(amount / 1000) | |
| 911 | + amount = amount % 1000 | |
| 912 | + let fhb = Math.floor(amount / 500) | |
| 913 | + amount = amount % 500 | |
| 914 | + let hb = Math.floor(amount / 100) | |
| 915 | + amount = amount % 100 | |
| 916 | + let twb = Math.floor(amount / 20) | |
| 917 | + amount = amount % 20 | |
| 918 | + let teb = Math.floor(amount / 10) | |
| 919 | + amount = amount % 10 | |
| 920 | + let fb = Math.floor(amount / 5) | |
| 921 | + amount = amount % 5 | |
| 922 | + let ob = Math.floor(amount) | |
| 923 | + | |
| 924 | + console.log(tb, fhb, hb, twb, teb, fb, ob) | |
| 925 | +} | |
| 926 | + | |
| 927 | +// test7(15776) | |
| 928 | + | |
| 929 | + | |
| 930 | +var jsonToGraphql = function (json) { | |
| 931 | + const serviceEnv = {} | |
| 932 | + const configField = serviceEnv['fieldGraphql'] || {} | |
| 933 | + let data = {}; | |
| 934 | + try { | |
| 935 | + data = JSON.parse(json) | |
| 936 | + } catch (e) { | |
| 937 | + console.log('condition is not json format ', e) | |
| 938 | + } | |
| 939 | + let args = {} | |
| 940 | + | |
| 941 | + for(key in data) { | |
| 942 | + if(typeof data[key] === 'object'){ | |
| 943 | + for(key2 in data[key]) { | |
| 944 | + args[key2] = data[key][key2] | |
| 945 | + } | |
| 946 | + } | |
| 947 | + } | |
| 948 | + | |
| 949 | + // console.log(args) | |
| 950 | + | |
| 951 | + let query = { | |
| 952 | + query: { apiList: Object.assign( { __args: data } , configField )} | |
| 953 | + } | |
| 954 | + | |
| 955 | + console.log(JSON.stringify(query)) | |
| 956 | + | |
| 957 | + // const graphql_query = jsonToGraphQLQuery(query); | |
| 958 | + // return graphql_query | |
| 959 | + } | |
| 960 | + | |
| 961 | +// jsonToGraphql(`{ | |
| 962 | +// "resourceName": "Resource Name", | |
| 963 | +// "systemName": "System Name", | |
| 964 | +// "status": "Approved", | |
| 965 | +// "category": "Category", | |
| 966 | +// "customParams": [ | |
| 967 | +// { | |
| 968 | +// "customKey": "Custom Parameter key", | |
| 969 | +// "customValue": "Custom Parameter value" | |
| 970 | +// }, | |
| 971 | +// { | |
| 972 | +// "customKey": "Custom Parameter key2", | |
| 973 | +// "customValue": "Custom Parameter value2" | |
| 974 | +// } | |
| 975 | +// ] | |
| 976 | +// }`) | |
| 977 | + | |
| 978 | + | |
| 979 | +// urlChecker = function (url, checkUrl) { | |
| 980 | +// // console.log(url, '--', checkUrl) | |
| 981 | +// // console.log(url.split('/').slice(3, 5)) | |
| 982 | +// let newUrl = url.split('/').slice(3, 5).map((value) => { | |
| 983 | +// return value.split('.')[0] | |
| 984 | +// }).join('/') | |
| 985 | + | |
| 986 | +// console.log(url, newUrl, checkUrl) | |
| 987 | + | |
| 988 | +// if(newUrl === checkUrl) { | |
| 989 | +// return true | |
| 990 | +// } | |
| 991 | + | |
| 992 | +// return false | |
| 993 | +// } | |
| 994 | + | |
| 995 | + | |
| 996 | +urlChecker = function (url, checkUrl) { | |
| 997 | + let newUrl = url.split('/').slice(3, 5).map((value) => { | |
| 998 | + return value.split('.')[0] | |
| 999 | + }).join('/') | |
| 1000 | + | |
| 1001 | + if(newUrl === checkUrl) { | |
| 1002 | + return true | |
| 1003 | + } | |
| 1004 | + | |
| 1005 | + return false | |
| 1006 | + } | |
| 1007 | + | |
| 1008 | + | |
| 1009 | +// console.log(urlChecker('/api/v1/tq/tqTest', 'tq/tq')) | |
| 1010 | +// console.log(urlChecker('/admd/v3/admd/test', 'admd/test')) | |
| 1011 | +// console.log(urlChecker('/admd/v3/admd/test.json', 'admd/test')) | |
| 1012 | +// console.log(urlChecker('/admd/v3/xx/admd/test', 'admd/test')) | |
| 1013 | +// console.log(urlChecker('/api/v3/admd/test2', 'admd/test2')) | |
| 1014 | +// console.log(urlChecker('/api/v3/admd/test2', 'admd/test')) | |
| 1015 | +// console.log(urlChecker('/api/v3/admd/test2.json', 'admd/test')) | |
| 1016 | +// console.log(urlChecker('/api/v3/admd/test/xxx.json', 'admd/test')) | |
| 1017 | + | |
| 1018 | +let errorMessage = { | |
| 1019 | + "success": { | |
| 1020 | + "resultCode": "20000", | |
| 1021 | + "developerMessage": "Success" | |
| 1022 | + }, | |
| 1023 | + "successWithCondition": { | |
| 1024 | + "resultCode": "20001", | |
| 1025 | + "developerMessage": "Some information is missing" | |
| 1026 | + }, | |
| 1027 | + "successWithCondition2": { | |
| 1028 | + "resultCode": "20002", | |
| 1029 | + "developerMessage": "Some information has not been updated" | |
| 1030 | + }, | |
| 1031 | + "urlNotFound": { | |
| 1032 | + "resultCode": "40400", | |
| 1033 | + "developerMessage": "Unknown URL" | |
| 1034 | + }, | |
| 1035 | + "accessDenied": { | |
| 1036 | + "resultCode": "40100", | |
| 1037 | + "developerMessage": "Access denied" | |
| 1038 | + }, | |
| 1039 | + "unauthorizedUser": { | |
| 1040 | + "resultCode": "40102", | |
| 1041 | + "developerMessage": "Unauthorized User" | |
| 1042 | + }, | |
| 1043 | + "jwtExpired": { | |
| 1044 | + "resultCode": "40103", | |
| 1045 | + "developerMessage": "Token Expired" | |
| 1046 | + }, | |
| 1047 | + "missing": { | |
| 1048 | + "resultCode": "40300", | |
| 1049 | + "developerMessage": "Missing or Invalid parameter {param}" | |
| 1050 | + }, | |
| 1051 | + "dataExisted": { | |
| 1052 | + "resultCode": "40301", | |
| 1053 | + "developerMessage": "Data existed" | |
| 1054 | + }, | |
| 1055 | + "dataNotFound": { | |
| 1056 | + "resultCode": "40401", | |
| 1057 | + "developerMessage": "Data not found" | |
| 1058 | + }, | |
| 1059 | + "systemHasAProblem": { | |
| 1060 | + "resultCode": "41700", | |
| 1061 | + "developerMessage": "The system has a problem" | |
| 1062 | + }, | |
| 1063 | + "systemError": { | |
| 1064 | + "resultCode": "50000", | |
| 1065 | + "developerMessage": "System Error" | |
| 1066 | + }, | |
| 1067 | + "dbUnknownError": { | |
| 1068 | + "resultCode": "50001", | |
| 1069 | + "developerMessage": "DB Error" | |
| 1070 | + }, | |
| 1071 | + "dbConnectionTimeout": { | |
| 1072 | + "resultCode": "50002", | |
| 1073 | + "developerMessage": "Connection timeout" | |
| 1074 | + }, | |
| 1075 | + "dbConnectionError": { | |
| 1076 | + "resultCode": "50003", | |
| 1077 | + "developerMessage": "Connection error" | |
| 1078 | + }, | |
| 1079 | + "timeout": { | |
| 1080 | + "resultCode": "50002", | |
| 1081 | + "developerMessage": "Connection timeout" | |
| 1082 | + }, | |
| 1083 | + "connectionError": { | |
| 1084 | + "resultCode": "50003", | |
| 1085 | + "developerMessage": "Connection error" | |
| 1086 | + }, | |
| 1087 | + "destNodeError": { | |
| 1088 | + "resultCode": "50010", | |
| 1089 | + "developerMessage": "{destnode} error: {code}:{message}" | |
| 1090 | + }, | |
| 1091 | + "connectionNodeTimeout": { | |
| 1092 | + "resultCode": "50011", | |
| 1093 | + "developerMessage": "{destnode} timeout" | |
| 1094 | + }, | |
| 1095 | + "connectionNodeError": { | |
| 1096 | + "resultCode": "50012", | |
| 1097 | + "developerMessage": "{destnode} connection error" | |
| 1098 | + }, | |
| 1099 | + "admdError": { | |
| 1100 | + "resultCode": "50004", | |
| 1101 | + "developerMessage": "ADMD Error" | |
| 1102 | + } | |
| 1103 | +} | |
| 1104 | + | |
| 1105 | +mappingDeveloperMessage = function (resultCode) { | |
| 1106 | + let e; | |
| 1107 | + for(key in errorMessage) { | |
| 1108 | + if(errorMessage[key].resultCode == resultCode) { | |
| 1109 | + e = errorMessage[key] | |
| 1110 | + } | |
| 1111 | + } | |
| 1112 | + | |
| 1113 | + return e | |
| 1114 | + } | |
| 1115 | + | |
| 1116 | +// console.log(mappingDeveloperMessage('40403')) | |
| 1117 | + | |
| 1118 | +let stateStatus = 'supplier-registration|waiting,supplier-registration|reject,supplier-registration|approve,business-agreement|waiting,business-agreement|reject' | |
| 1119 | + | |
| 1120 | +function createAQuery(query) { | |
| 1121 | + let q = {} | |
| 1122 | + let stateStatusList = query.stateStatus.split(',') | |
| 1123 | + let groupState = {} | |
| 1124 | + for (stateStatus of stateStatusList) { | |
| 1125 | + if(stateStatus.includes('|')) { | |
| 1126 | + // console.log(stateStatus) | |
| 1127 | + let ss = stateStatus.split('|') | |
| 1128 | + let state = ss[0] | |
| 1129 | + let status = ss[1] | |
| 1130 | + if(groupState[state]) { | |
| 1131 | + groupState[state].push(status) | |
| 1132 | + } else { | |
| 1133 | + groupState[state] = [status] | |
| 1134 | + } | |
| 1135 | + } | |
| 1136 | + } | |
| 1137 | + // console.log(groupState) | |
| 1138 | + q.$or = [] | |
| 1139 | + for(g in groupState) { | |
| 1140 | + q.$or.push({ | |
| 1141 | + state: g, | |
| 1142 | + status: { $in: groupState[g]} | |
| 1143 | + }) | |
| 636 | 1144 | } |
| 637 | - console.log(a) | |
| 638 | - console.log(z) | |
| 1145 | + return q; | |
| 639 | 1146 | } |
| 640 | 1147 | |
| 641 | -test() | |
| 642 | 1148 | \ No newline at end of file |
| 1149 | +console.log(JSON.stringify(createAQuery({stateStatus}))) | |
| 643 | 1150 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | +const { Configuration, OpenAIApi } = require("openai"); | |
| 2 | +const api_key = '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'; | |
| 3 | + | |
| 4 | +const configuration = new Configuration({ apiKey: api_key }); | |
| 5 | +const openai = new OpenAIApi(configuration); | |
| 6 | + | |
| 7 | +openai.createCompletion({ | |
| 8 | + model: "text-davinci-003", | |
| 9 | + prompt: "say hello in 3 random language", | |
| 10 | + temperature: 0.6, | |
| 11 | +}).then(response => { | |
| 12 | + console.log(response.data.choices[0].text) | |
| 13 | +}); | |
| 14 | + | |
| 15 | + | |
| 16 | +// const client = new openai(api_key); | |
| 17 | + | |
| 18 | +// const prompt = 'Once upon a time, in a far-off kingdom, there lived a beautiful princess named...'; | |
| 19 | +// const model = 'text-davinci-002'; | |
| 20 | + | |
| 21 | +// client.completions.create({ | |
| 22 | +// engine: model, | |
| 23 | +// prompt: prompt, | |
| 24 | +// max_tokens: 50, | |
| 25 | +// n: 1, | |
| 26 | +// stop: '\n' | |
| 27 | +// }).then(result => { | |
| 28 | +// console.log(result.choices[0].text); | |
| 29 | +// }).catch(err => { | |
| 30 | +// console.log(err); | |
| 31 | +// }); | |
| 0 | 32 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,245 @@ |
| 1 | +let retryCondition = false | |
| 2 | + | |
| 3 | +module.exports.graphql = async (req, res) => { | |
| 4 | + console.log('===== POST graphql =====') | |
| 5 | + console.log('url', req.originalUrl); | |
| 6 | + console.log('headers', req.headers); | |
| 7 | + console.log('query', req.query); | |
| 8 | + console.log('params', req.params); | |
| 9 | + console.log('body', req.body); | |
| 10 | + | |
| 11 | + let response | |
| 12 | + | |
| 13 | + if(req.body.query.includes('"pam"')) { | |
| 14 | + console.log('pam') | |
| 15 | + response = { | |
| 16 | + "data": { | |
| 17 | + "apiList": [ | |
| 18 | + { | |
| 19 | + "api": { | |
| 20 | + "_id": "636c9d7916831a1e82822cb7", | |
| 21 | + "method": "GET", | |
| 22 | + "uri": "/api/v1/pam1/test", | |
| 23 | + "description": "test" | |
| 24 | + }, | |
| 25 | + "resource": { | |
| 26 | + "resourceName": "QA_PAM1", | |
| 27 | + "description": "QA_PAM1" | |
| 28 | + } | |
| 29 | + }, | |
| 30 | + { | |
| 31 | + "api": { | |
| 32 | + "_id": "636c9d7916831a6efc822cc7", | |
| 33 | + "method": "POST", | |
| 34 | + "uri": "/api/v1/pam/test2", | |
| 35 | + "description": "test" | |
| 36 | + }, | |
| 37 | + "resource": { | |
| 38 | + "resourceName": "QA_PAM1", | |
| 39 | + "description": "QA_PAM1" | |
| 40 | + } | |
| 41 | + }, | |
| 42 | + { | |
| 43 | + "api": { | |
| 44 | + "_id": "640ec27fbc5c296d3cd5f385", | |
| 45 | + "method": "GET", | |
| 46 | + "uri": "/api/v1/pam1/test", | |
| 47 | + "description": "test" | |
| 48 | + }, | |
| 49 | + "resource": { | |
| 50 | + "resourceName": "QA_PAM1", | |
| 51 | + "description": "QA_PAM1 - UPDATE RESOURCE" | |
| 52 | + } | |
| 53 | + }, | |
| 54 | + { | |
| 55 | + "api": { | |
| 56 | + "_id": "640ec27fbc5c2996b3d5f395", | |
| 57 | + "method": "POST", | |
| 58 | + "uri": "/api/v1/pam/test2", | |
| 59 | + "description": "test" | |
| 60 | + }, | |
| 61 | + "resource": { | |
| 62 | + "resourceName": "QA_PAM1", | |
| 63 | + "description": "QA_PAM1 - UPDATE RESOURCE" | |
| 64 | + } | |
| 65 | + } | |
| 66 | + ] | |
| 67 | + }, | |
| 68 | + "resultCode": "20000", | |
| 69 | + "resultDescription": "Success" | |
| 70 | + } | |
| 71 | + } else if(req.body.query.includes('"pam1"')) { | |
| 72 | + console.log('pam1') | |
| 73 | + response = { | |
| 74 | + "data": { | |
| 75 | + "apiList": [ | |
| 76 | + { | |
| 77 | + "api": { | |
| 78 | + "_id": "636c9d7916831a1e82822cb7", | |
| 79 | + "method": "GET", | |
| 80 | + "uri": "/api/v1/pam1/test", | |
| 81 | + "description": "test" | |
| 82 | + }, | |
| 83 | + "resource": { | |
| 84 | + "resourceName": "QA_PAM1", | |
| 85 | + "description": "QA_PAM1" | |
| 86 | + } | |
| 87 | + }, | |
| 88 | + { | |
| 89 | + "api": { | |
| 90 | + "_id": "640ec27fbc5c296d3cd5f385", | |
| 91 | + "method": "GET", | |
| 92 | + "uri": "/api/v1/pam1/test", | |
| 93 | + "description": "test" | |
| 94 | + }, | |
| 95 | + "resource": { | |
| 96 | + "resourceName": "QA_PAM1", | |
| 97 | + "description": "QA_PAM1 - UPDATE RESOURCE" | |
| 98 | + } | |
| 99 | + } | |
| 100 | + ] | |
| 101 | + }, | |
| 102 | + "resultCode": "20000", | |
| 103 | + "resultDescription": "Success" | |
| 104 | + } | |
| 105 | + } else if(req.body.query.includes('"resource"')) { | |
| 106 | + console.log('resource') | |
| 107 | + response = { | |
| 108 | + "data": { | |
| 109 | + "apiList": [ | |
| 110 | + { | |
| 111 | + "api": { | |
| 112 | + "_id": "640ec968bc5c2918fed5f4b0", | |
| 113 | + "method": "DELETE", | |
| 114 | + "uri": "/api/v1/resource/test", | |
| 115 | + "description": "Description test api" | |
| 116 | + }, | |
| 117 | + "resource": { | |
| 118 | + "resourceName": "TQ_Resource_Test", | |
| 119 | + "description": "Resource Description" | |
| 120 | + } | |
| 121 | + } | |
| 122 | + ] | |
| 123 | + }, | |
| 124 | + "resultCode": "20000", | |
| 125 | + "resultDescription": "Success" | |
| 126 | + } | |
| 127 | + } else { | |
| 128 | + console.log('tq') | |
| 129 | + response = { | |
| 130 | + "data": { | |
| 131 | + "apiList": [ | |
| 132 | + { | |
| 133 | + "api": { | |
| 134 | + "_id": "640823c9151674235cf1b891", | |
| 135 | + "method": "PATCH", | |
| 136 | + "uri": "/api/v1/tq/tqTest", | |
| 137 | + "description": "test00001" | |
| 138 | + }, | |
| 139 | + "resource": { | |
| 140 | + "resourceName": "TQ_Test1", | |
| 141 | + "description": "TQ_ResourceDescription1" | |
| 142 | + } | |
| 143 | + }, | |
| 144 | + { | |
| 145 | + "api": { | |
| 146 | + "_id": "640e91b0bc5c2970afd5f067", | |
| 147 | + "method": "PATCH", | |
| 148 | + "uri": "/api/v1/tq/tqTest", | |
| 149 | + "description": "test00001" | |
| 150 | + }, | |
| 151 | + "resource": { | |
| 152 | + "resourceName": "TQ_Test1", | |
| 153 | + "description": "TQ_ResourceDescription1" | |
| 154 | + } | |
| 155 | + }, | |
| 156 | + { | |
| 157 | + "api": { | |
| 158 | + "_id": "640e91b0bc5c2921c3d5f075", | |
| 159 | + "method": "GET", | |
| 160 | + "uri": "/api/v1/tq2/tqTest", | |
| 161 | + "description": "test" | |
| 162 | + }, | |
| 163 | + "resource": { | |
| 164 | + "resourceName": "TQ_Test1", | |
| 165 | + "description": "TQ_ResourceDescription1" | |
| 166 | + } | |
| 167 | + } | |
| 168 | + ] | |
| 169 | + }, | |
| 170 | + "resultCode": "20000", | |
| 171 | + "resultDescription": "Success" | |
| 172 | + } | |
| 173 | + } | |
| 174 | + | |
| 175 | + // if(req.body.query.includes('admd3')) { | |
| 176 | + // response = { | |
| 177 | + // "data": { | |
| 178 | + // "apiList": "", | |
| 179 | + // "message": "Data Not Found" | |
| 180 | + // }, | |
| 181 | + // "resultCode": "20000", | |
| 182 | + // "resultDescription": "Success" | |
| 183 | + // } | |
| 184 | + // } | |
| 185 | + | |
| 186 | + // if(req.body.query.includes('admd2')) { | |
| 187 | + // if(retryCondition) { | |
| 188 | + // retryCondition = false | |
| 189 | + // response = { | |
| 190 | + // "resultCode": "40101", | |
| 191 | + // "resultDescription": "Unauthorized" | |
| 192 | + // } | |
| 193 | + // } else { | |
| 194 | + // response = { | |
| 195 | + // "data": { | |
| 196 | + // "apiList": [{ | |
| 197 | + // "api": { | |
| 198 | + // "_id": "635a05d5bc7f8b9de2595311", | |
| 199 | + // "method": "GET", | |
| 200 | + // "uri": "/api/v1/admd2/token2.json" | |
| 201 | + // }, | |
| 202 | + // "resource": { | |
| 203 | + // "resourceName": "Resource Name GET", | |
| 204 | + // "description": "Approved" | |
| 205 | + // } | |
| 206 | + // },{ | |
| 207 | + // "api": { | |
| 208 | + // "_id": "635a05d5bc7f8b9de2595311", | |
| 209 | + // "method": "POST", | |
| 210 | + // "uri": "/api/v1/admd2/token2/xxx.json" | |
| 211 | + // }, | |
| 212 | + // "resource": { | |
| 213 | + // "resourceName": "Resource Name POST", | |
| 214 | + // "description": "Approved" | |
| 215 | + // } | |
| 216 | + // },{ | |
| 217 | + // "api": { | |
| 218 | + // "_id": "635a05d5bc7f8b9de2595311", | |
| 219 | + // "method": "POST", | |
| 220 | + // "uri": "/api/v1/admd2/token5/xxx.json" | |
| 221 | + // }, | |
| 222 | + // "resource": { | |
| 223 | + // "resourceName": "Resource Name POST", | |
| 224 | + // "description": "Approved" | |
| 225 | + // } | |
| 226 | + // },{ | |
| 227 | + // "api": { | |
| 228 | + // "_id": "635a05d5bc7f8b9de2595311", | |
| 229 | + // "method": "DELETE", | |
| 230 | + // "uri": "/api/v1/admd2/token5/xxx.json" | |
| 231 | + // }, | |
| 232 | + // "resource": { | |
| 233 | + // "resourceName": "Resource Name DELETE", | |
| 234 | + // "description": "Approved" | |
| 235 | + // } | |
| 236 | + // }] | |
| 237 | + // }, | |
| 238 | + // "resultCode": "20000", | |
| 239 | + // "resultDescription": "Success" | |
| 240 | + // } | |
| 241 | + // } | |
| 242 | + // } | |
| 243 | + | |
| 244 | + res.status(200).send(response) | |
| 245 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,26 @@ |
| 1 | + | |
| 2 | +module.exports.authen = async (req, res) => { | |
| 3 | + console.log('===== POST authentication =====') | |
| 4 | + console.log('url', req.originalUrl); | |
| 5 | + console.log('headers', req.headers); | |
| 6 | + console.log('query', req.query); | |
| 7 | + console.log('params', req.params); | |
| 8 | + console.log('body', req.body); | |
| 9 | + | |
| 10 | + let response = { | |
| 11 | + "resultCode":"20000", | |
| 12 | + "resultDescription":"Success", | |
| 13 | + "data":{ | |
| 14 | + "token_type":"Bearer", | |
| 15 | + "expires_in":3600, | |
| 16 | + "application_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBsaWNhdGlvbiI6ImRldl9ndWlkZSIsImlhdCI6MTY2ODU3Njc1NCwiZXhwIjoxNjY4NjYzMTU0fQ.KTJY9xkTZx_fwSNNKMlzbcx23jF-r4efSbZOaoZLVUw" | |
| 17 | + } | |
| 18 | + } | |
| 19 | + | |
| 20 | + // let response = { | |
| 21 | + // "resultCode":"40109", | |
| 22 | + // "resultDescription":"Authentication failed. Invalid username or password" | |
| 23 | + // } | |
| 24 | + | |
| 25 | + res.send(response) | |
| 26 | +} | |
| 0 | 27 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,135 @@ |
| 1 | +const { v4: uuidv4 } = require('uuid'); | |
| 2 | +const crypto = require('crypto'); | |
| 3 | + | |
| 4 | + | |
| 5 | +const dayjs = require('dayjs'); | |
| 6 | + | |
| 7 | +function generateNumberUUID() { | |
| 8 | + let numberUUID = ''; | |
| 9 | + while (numberUUID.length < 19) { | |
| 10 | + const uuid = uuidv4(); | |
| 11 | + const hash = crypto.createHash('sha1').update(uuid).digest('hex'); | |
| 12 | + numberUUID += BigInt(`0x${hash}`).toString().padStart(19, '0'); | |
| 13 | + } | |
| 14 | + return numberUUID.slice(0, 19); | |
| 15 | +} | |
| 16 | + | |
| 17 | +function getRandomInteger(min, max) { | |
| 18 | + min = Math.ceil(min); | |
| 19 | + max = Math.floor(max); | |
| 20 | + return Math.floor(Math.random() * (max - min + 1)) + min; | |
| 21 | +} | |
| 22 | +function getRandomDate() { | |
| 23 | + const now = dayjs(); // Get current date and time | |
| 24 | + const randomYear = now.year(); | |
| 25 | + const randomMonth = now.month(); | |
| 26 | + const randomDay = now.date(); | |
| 27 | + const randomHour = Math.floor(Math.random() * 24); // Generate random hour (0-23) | |
| 28 | + | |
| 29 | + const randomDate = dayjs().year(randomYear).month(randomMonth).date(28).hour(randomHour).minute(0).second(0); | |
| 30 | + | |
| 31 | + return randomDate; | |
| 32 | +} | |
| 33 | + | |
| 34 | +function getTimeFromDate(date) { | |
| 35 | + const time = date.format('HH:mm'); | |
| 36 | + return time; | |
| 37 | +} | |
| 38 | + | |
| 39 | + | |
| 40 | +class SummaryDailyUsage { | |
| 41 | + constructor(ID, LogDate, LogTime, GroupName, Amount, CreatedAt) { | |
| 42 | + this.ID = ID; | |
| 43 | + this.log_date = LogDate; | |
| 44 | + this.log_time = LogTime; | |
| 45 | + this.group_name = GroupName; | |
| 46 | + this.amount = Amount; | |
| 47 | + this.created_at = CreatedAt; | |
| 48 | + } | |
| 49 | + } | |
| 50 | + | |
| 51 | + function generateInsertSQL(tableName, data) { | |
| 52 | + let insertSQL = ''; | |
| 53 | + | |
| 54 | + for (let i = 0; i < data.length; i++) { | |
| 55 | + const record = data[i]; | |
| 56 | + const columns = Object.keys(record); | |
| 57 | + const values = Object.values(record).map(formatValue); | |
| 58 | + | |
| 59 | + const columnsStr = columns.join(', '); | |
| 60 | + const valuesStr = values.join(', '); | |
| 61 | + | |
| 62 | + const sql = `INSERT INTO ${tableName} (${columnsStr}) VALUES (${valuesStr});\n`; | |
| 63 | + insertSQL += sql; | |
| 64 | + } | |
| 65 | + | |
| 66 | + return insertSQL; | |
| 67 | + } | |
| 68 | + | |
| 69 | + function formatValue(value) { | |
| 70 | + if (typeof value === 'string') { | |
| 71 | + if (value.startsWith('TO_TIMESTAMP')) { | |
| 72 | + return value | |
| 73 | + } | |
| 74 | + return `'${value}'`; | |
| 75 | + } else if (value instanceof Date) { | |
| 76 | + const formattedDate = value.toISOString().slice(0, 19).replace('T', ' '); | |
| 77 | + return `TO_TIMESTAMP('${formattedDate}', 'YYYY-MM-DD HH24:MI:SS')`; | |
| 78 | + } else { | |
| 79 | + return value; | |
| 80 | + } | |
| 81 | + } | |
| 82 | + | |
| 83 | +function generateTimeLocationData() { | |
| 84 | + const timeLocationData = {}; | |
| 85 | + const listGroup = ['ส่วนกลาง','คลินิกราชการ','สำนักงานสาธารณสุขจังหวัด','สำนักงานสาธารณสุขอำเภอ','สำนักงานป้องกันควบคุมโรค','ศูนย์บริการสาธารณสุข','โรงพยาบาล','คลินิกเอกชน','โรงพยาบาลส่งเสริมสุขภาพตำบล'] | |
| 86 | + | |
| 87 | + for (let hour = 0; hour < 24; hour++) { | |
| 88 | + const time = dayjs().hour(hour).minute(0).format('HH:mm'); | |
| 89 | + const locations = listGroup; | |
| 90 | + | |
| 91 | + timeLocationData[time] = locations; | |
| 92 | + } | |
| 93 | + | |
| 94 | + return timeLocationData; | |
| 95 | +} | |
| 96 | + | |
| 97 | +function getRandomValueFromArray(array) { | |
| 98 | + const randomIndex = Math.floor(Math.random() * array.length); | |
| 99 | + const randomValue = array[randomIndex]; | |
| 100 | + return randomValue; | |
| 101 | +} | |
| 102 | + | |
| 103 | +// Example usage: | |
| 104 | +const timeLocationData = generateTimeLocationData(); | |
| 105 | +let sdu = [] | |
| 106 | + | |
| 107 | +for (let i = 0; i <= 10; i++) { | |
| 108 | + | |
| 109 | + let checkUnique = {} | |
| 110 | + | |
| 111 | + let r = getRandomDate() | |
| 112 | + let t = getTimeFromDate(r) | |
| 113 | + | |
| 114 | + let value = getRandomValueFromArray(timeLocationData[t]) | |
| 115 | + | |
| 116 | + if(!checkUnique[t+'_'+value]) { | |
| 117 | + sdu.push(new SummaryDailyUsage( | |
| 118 | + generateNumberUUID(), | |
| 119 | + `TO_TIMESTAMP('${r.format('YYYY-MM-DD HH:mm:ss')}', 'YYYY-MM-DD HH24:MI:SS')`, // Replace with your LogDate value | |
| 120 | + t, | |
| 121 | + value, | |
| 122 | + getRandomInteger(1, 100), | |
| 123 | + new Date() // Replace with your CreatedAt value | |
| 124 | + )) | |
| 125 | + } else { | |
| 126 | + console.log('is unique') | |
| 127 | + } | |
| 128 | + | |
| 129 | + checkUnique[t+'_'+value] = true | |
| 130 | + | |
| 131 | +} | |
| 132 | + | |
| 133 | + | |
| 134 | +const insertSQL = generateInsertSQL('ddc.SUM_DAILY_USAGE_BY_GROUP', sdu); | |
| 135 | +console.log(insertSQL); | |
| 0 | 136 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,133 @@ |
| 1 | +const { v4: uuidv4 } = require('uuid'); | |
| 2 | +const crypto = require('crypto'); | |
| 3 | + | |
| 4 | + | |
| 5 | +const dayjs = require('dayjs'); | |
| 6 | + | |
| 7 | +function generateNumberUUID() { | |
| 8 | + let numberUUID = ''; | |
| 9 | + while (numberUUID.length < 19) { | |
| 10 | + const uuid = uuidv4(); | |
| 11 | + const hash = crypto.createHash('sha1').update(uuid).digest('hex'); | |
| 12 | + numberUUID += BigInt(`0x${hash}`).toString().padStart(19, '0'); | |
| 13 | + } | |
| 14 | + return numberUUID.slice(0, 19); | |
| 15 | +} | |
| 16 | + | |
| 17 | +function getRandomInteger(min, max) { | |
| 18 | + min = Math.ceil(min); | |
| 19 | + max = Math.floor(max); | |
| 20 | + return Math.floor(Math.random() * (max - min + 1)) + min; | |
| 21 | +} | |
| 22 | +function getRandomDate() { | |
| 23 | + const now = dayjs(); // Get current date and time | |
| 24 | + const randomYear = now.year(); | |
| 25 | + const randomMonth = now.month(); | |
| 26 | + const randomDay = now.date(); | |
| 27 | + // const randomHour = Math.floor(Math.random() * 24); // Generate random hour (0-23) | |
| 28 | + | |
| 29 | + const randomDate = dayjs().year(randomYear).month(randomMonth).date(28).hour(0).minute(0).second(0); | |
| 30 | + | |
| 31 | + return randomDate; | |
| 32 | +} | |
| 33 | + | |
| 34 | +function getTimeFromDate(date) { | |
| 35 | + const time = date.format('HH:mm'); | |
| 36 | + return time; | |
| 37 | +} | |
| 38 | + | |
| 39 | + | |
| 40 | +class SummaryDailyUsageMenu { | |
| 41 | + constructor(ID, LogDate, Menu, SubMenu, GroupName, Amount, CreatedAt) { | |
| 42 | + this.ID = ID; | |
| 43 | + this.log_date = LogDate; | |
| 44 | + this.menu = Menu; | |
| 45 | + this.sub_menu = SubMenu; | |
| 46 | + this.group_name = GroupName; | |
| 47 | + this.amount = Amount; | |
| 48 | + this.created_at = CreatedAt; | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + function generateInsertSQL(tableName, data) { | |
| 53 | + let insertSQL = ''; | |
| 54 | + | |
| 55 | + for (let i = 0; i < data.length; i++) { | |
| 56 | + const record = data[i]; | |
| 57 | + const columns = Object.keys(record); | |
| 58 | + const values = Object.values(record).map(formatValue); | |
| 59 | + | |
| 60 | + const columnsStr = columns.join(', '); | |
| 61 | + const valuesStr = values.join(', '); | |
| 62 | + | |
| 63 | + const sql = `INSERT INTO ${tableName} (${columnsStr}) VALUES (${valuesStr});\n`; | |
| 64 | + insertSQL += sql; | |
| 65 | + } | |
| 66 | + | |
| 67 | + return insertSQL; | |
| 68 | + } | |
| 69 | + | |
| 70 | + function formatValue(value) { | |
| 71 | + if (typeof value === 'string') { | |
| 72 | + if (value.startsWith('TO_TIMESTAMP')) { | |
| 73 | + return value | |
| 74 | + } | |
| 75 | + return `'${value}'`; | |
| 76 | + } else if (value instanceof Date) { | |
| 77 | + const formattedDate = value.toISOString().slice(0, 19).replace('T', ' '); | |
| 78 | + return `TO_TIMESTAMP('${formattedDate}', 'YYYY-MM-DD HH24:MI:SS')`; | |
| 79 | + } else { | |
| 80 | + return value; | |
| 81 | + } | |
| 82 | + } | |
| 83 | + | |
| 84 | +function getRandomValueFromArray(array) { | |
| 85 | + const randomIndex = Math.floor(Math.random() * array.length); | |
| 86 | + const randomValue = array[randomIndex]; | |
| 87 | + return randomValue; | |
| 88 | +} | |
| 89 | + | |
| 90 | +// Example usage: | |
| 91 | +const listGroup = ['ส่วนกลาง','คลินิกราชการ','สำนักงานสาธารณสุขจังหวัด','สำนักงานสาธารณสุขอำเภอ','สำนักงานป้องกันควบคุมโรค','ศูนย์บริการสาธารณสุข','โรงพยาบาล','คลินิกเอกชน','โรงพยาบาลส่งเสริมสุขภาพตำบล'] | |
| 92 | +const menuList = ['แดชบอร์ด', 'การร้องขอข้อมูล', 'ประกาศและการแจ้งเตือน', 'การจัดการบทความ', 'จัดการแชทบอท', 'รายงานการใช้งานระบบ', 'เครื่องมือการจัดการ'] | |
| 93 | +const menus = { | |
| 94 | + 'แดชบอร์ด': ['กลุ่มโรคติดต่อ'], | |
| 95 | + 'การร้องขอข้อมูล': ['รายงาน D506'], | |
| 96 | + 'ประกาศและการแจ้งเตือน': ['ประเภทประกาศ', 'จัดการประกาศ', 'จัดการการแจ้งเตือน'], | |
| 97 | + 'การจัดการบทความ': ['ประเภทบทความ', 'จัดการบทความสุขภาพ', 'ข้อมูลโรงพยาบาล', 'ข้อมูลผู้ใช้ (User profile)'], | |
| 98 | + 'จัดการแชทบอท': ['ประวัติสนทนา', 'หัวข้อการตอบกลับ', 'จัดการข้อความแชทบอท', 'แดชบอร์ดสถิติคำถาม', 'บันทึกการสนทนา (Chat logs)'], | |
| 99 | + 'รายงานการใช้งานระบบ': ['รายงานการใช้งานระบบ'], | |
| 100 | + 'เครื่องมือการจัดการ': ['จัดการองค์กร', 'จัดการสิทธิ์ผู้ใช้งาน', 'จัดการกลุ่มผู้ใช้งาน', 'จัดการกลุ่มผู้ใช้งาน', 'จัดการผู้ใช้งาน', 'บันทึกการใช้งาน (Logs)'] | |
| 101 | +} | |
| 102 | +let sdu = [] | |
| 103 | + | |
| 104 | +for (let i = 0; i <= 10; i++) { | |
| 105 | + | |
| 106 | + let checkUnique = {} | |
| 107 | + | |
| 108 | + let r = getRandomDate() | |
| 109 | + | |
| 110 | + let menu = getRandomValueFromArray(menuList) | |
| 111 | + let sub_menu = getRandomValueFromArray(menus[menu]) | |
| 112 | + let group = getRandomValueFromArray(listGroup) | |
| 113 | + | |
| 114 | + if(!checkUnique[menu+'_'+sub_menu+'_'+group]) { | |
| 115 | + sdu.push(new SummaryDailyUsageMenu( | |
| 116 | + generateNumberUUID(), | |
| 117 | + `TO_TIMESTAMP('${r.format('YYYY-MM-DD HH:mm:ss')}', 'YYYY-MM-DD HH24:MI:SS')`, // Replace with your LogDate value | |
| 118 | + menu, | |
| 119 | + sub_menu, | |
| 120 | + group, | |
| 121 | + getRandomInteger(1, 100), | |
| 122 | + new Date() // Replace with your CreatedAt value | |
| 123 | + )) | |
| 124 | + } else { | |
| 125 | + console.log('is unique') | |
| 126 | + } | |
| 127 | + | |
| 128 | + checkUnique[menu+'_'+sub_menu+'_'+group] = true | |
| 129 | + | |
| 130 | +} | |
| 131 | + | |
| 132 | +const insertSQL = generateInsertSQL('ddc.SUM_DAILY_USAGE_BY_GROUP', sdu); | |
| 133 | +console.log(insertSQL); | |
| 0 | 134 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,191 @@ |
| 1 | +var express = require('express'); | |
| 2 | +var { graphqlHTTP } = require('express-graphql'); | |
| 3 | +var { buildSchema } = require('graphql'); | |
| 4 | + | |
| 5 | +// Construct a schema, using GraphQL schema language | |
| 6 | +var schema = buildSchema(` | |
| 7 | + type apiList { | |
| 8 | + api: String | |
| 9 | + } | |
| 10 | + | |
| 11 | + type Query { | |
| 12 | + apiList: [apiList] | |
| 13 | + } | |
| 14 | +`); | |
| 15 | + | |
| 16 | +// The root provides a resolver function for each API endpoint | |
| 17 | +var data = { | |
| 18 | + "apiList": [{ | |
| 19 | + "api": "hello" | |
| 20 | + }], | |
| 21 | + "resultCode": "20000", | |
| 22 | + "resultDescription": "Success" | |
| 23 | +}; | |
| 24 | + | |
| 25 | +const extensions = ({ | |
| 26 | + document, | |
| 27 | + variables, | |
| 28 | + operationName, | |
| 29 | + result, | |
| 30 | + context, | |
| 31 | + }) => { | |
| 32 | + return { | |
| 33 | + resultCode: "20000", | |
| 34 | + resultDescription: "success" | |
| 35 | + }; | |
| 36 | + }; | |
| 37 | + | |
| 38 | +var app = express(); | |
| 39 | +// app.use('/graphql', graphqlHTTP({ | |
| 40 | +// schema: schema, | |
| 41 | +// // rootValue: data, | |
| 42 | +// graphiql: true, | |
| 43 | +// extensions | |
| 44 | +// })); | |
| 45 | + | |
| 46 | +app.use('/graphql', (req, res) => { | |
| 47 | + console.log(req.body) | |
| 48 | + res.status(200).send({ | |
| 49 | + "data": { | |
| 50 | + "apiList": [{ | |
| 51 | + "api": { | |
| 52 | + "_id": "635a05d5bc7f8b9de2595311", | |
| 53 | + "method": "GET", | |
| 54 | + "uri": "/api/v1/resource", | |
| 55 | + "description": "URI Description", | |
| 56 | + "exRequest": { | |
| 57 | + "header": [{ | |
| 58 | + "paramName": "test1", | |
| 59 | + "isRequire": "1", | |
| 60 | + "dataType": "String", | |
| 61 | + "description": "test1" | |
| 62 | + }, { | |
| 63 | + "paramName": "test2", | |
| 64 | + "isRequire": "0", | |
| 65 | + "dataType": "Object", | |
| 66 | + "description": "test2.1", | |
| 67 | + "paramObj": [{ | |
| 68 | + "paramName": "test2.1", | |
| 69 | + "isRequire": "0", | |
| 70 | + "dataType": "Object", | |
| 71 | + "description": "test2.1", | |
| 72 | + "paramObjParamObj": [{ | |
| 73 | + "paramName": "test2.1.1", | |
| 74 | + "isRequire": "0", | |
| 75 | + "dataType": "Number", | |
| 76 | + "description": "test2.1.1" | |
| 77 | + } | |
| 78 | + ] | |
| 79 | + } | |
| 80 | + ] | |
| 81 | + } | |
| 82 | + ], | |
| 83 | + "exHeader": [{ | |
| 84 | + "text": "Request Header Example" | |
| 85 | + } | |
| 86 | + ], | |
| 87 | + "body": [{ | |
| 88 | + "paramName": "test1", | |
| 89 | + "isRequire": "1", | |
| 90 | + "dataType": "String", | |
| 91 | + "description": "test1" | |
| 92 | + }, { | |
| 93 | + "paramName": "test2", | |
| 94 | + "isRequire": "0", | |
| 95 | + "dataType": "String", | |
| 96 | + "description": "test2" | |
| 97 | + } | |
| 98 | + ], | |
| 99 | + "exBody": [{ | |
| 100 | + "text": "Request Body Example" | |
| 101 | + } | |
| 102 | + ] | |
| 103 | + }, | |
| 104 | + "exResponse": { | |
| 105 | + "header": [{ | |
| 106 | + "paramName": "test1", | |
| 107 | + "isRequire": "1", | |
| 108 | + "dataType": "String", | |
| 109 | + "description": "test1" | |
| 110 | + } | |
| 111 | + ], | |
| 112 | + "exHeader": [{ | |
| 113 | + "text": "Response Header Example (Success)" | |
| 114 | + } | |
| 115 | + ], | |
| 116 | + "exHeaderErr": [{ | |
| 117 | + "text": "Response Header Example (Error)" | |
| 118 | + } | |
| 119 | + ], | |
| 120 | + "body": [{ | |
| 121 | + "paramName": "test1", | |
| 122 | + "isRequire": "0", | |
| 123 | + "dataType": "String", | |
| 124 | + "description": "test1" | |
| 125 | + }, { | |
| 126 | + "paramName": "test2", | |
| 127 | + "isRequire": "1", | |
| 128 | + "dataType": "String", | |
| 129 | + "description": "test2" | |
| 130 | + }, { | |
| 131 | + "paramName": "test3", | |
| 132 | + "isRequire": "1", | |
| 133 | + "dataType": "Object", | |
| 134 | + "description": "test3", | |
| 135 | + "paramObj": [{ | |
| 136 | + "paramName": "test3.1", | |
| 137 | + "isRequire": "1", | |
| 138 | + "dataType": "Number", | |
| 139 | + "description": "test3.1" | |
| 140 | + }, { | |
| 141 | + "paramName": "test3.2", | |
| 142 | + "isRequire": "0", | |
| 143 | + "dataType": "Integer", | |
| 144 | + "description": "test3.2" | |
| 145 | + } | |
| 146 | + ] | |
| 147 | + } | |
| 148 | + ], | |
| 149 | + "exBody": [{ | |
| 150 | + "text": "Response Body Example (Success)" | |
| 151 | + } | |
| 152 | + ], | |
| 153 | + "exBodyNoData": [{ | |
| 154 | + "text": "Response Body Example (Success no data)" | |
| 155 | + } | |
| 156 | + ], | |
| 157 | + "exBodyErr": [{ | |
| 158 | + "text": "Response Body Example (Error)" | |
| 159 | + } | |
| 160 | + ] | |
| 161 | + }, | |
| 162 | + "customParams": [{ | |
| 163 | + "customKey": "Custom Parameter key", | |
| 164 | + "customValue": "Custom Parameter value" | |
| 165 | + }, { | |
| 166 | + "customKey": "Custom Parameter key 2", | |
| 167 | + "customValue": "Custom Parameter value 2" | |
| 168 | + } | |
| 169 | + ] | |
| 170 | + }, | |
| 171 | + "resource": { | |
| 172 | + "_id": "635a05d5bc7f8b51b3595310", | |
| 173 | + "resourceName": "Resource Name", | |
| 174 | + "resourceOwner": "supps305", | |
| 175 | + "systemName": "System Name", | |
| 176 | + "status": "Approved" | |
| 177 | + }, | |
| 178 | + "microservicesDomain": { | |
| 179 | + "_id": "635a05d5bc7f8bf46b59530d", | |
| 180 | + "microservicesDomainName": "Microservices Domain", | |
| 181 | + "description": "Microservices Domain Description" | |
| 182 | + } | |
| 183 | + } | |
| 184 | + ] | |
| 185 | + }, | |
| 186 | + "resultCode": "40101", | |
| 187 | + "resultDescription": "Success" | |
| 188 | + }) | |
| 189 | +}) | |
| 190 | +app.listen(4000); | |
| 191 | +console.log('Running a GraphQL API server at http://localhost:4000/graphql'); | |
| 0 | 192 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | +-----BEGIN RSA PRIVATE KEY----- | |
| 2 | +MIIEpQIBAAKCAQEAnGeADtUHNs2Nm/OCKgOB3JI9vGeCnqQ0BwQtmlzA+OKqeUnH | |
| 3 | +I5AluPqUE2D1EVnVOKXsQb1QSHiL9bf19zJ++BR2l9gGgQWqKbd4sQkSrUHM6cri | |
| 4 | +YjtvwEpXs5g/iw9cA0Svir4IV0HpMw2L4wx8m+a8MNp24SLVVfyH+tvYEuTpzl87 | |
| 5 | +9PizlGFsLWeRvJMldSn3C65Sm0ihg1zl0DRxwduszMPgghdv1glqxQTcqdmIA5bF | |
| 6 | +4OSL0Bo4LaJ+EQ2W9lxNGE3GMoqxaJQ0EW470YL0sSAhVqJgMdABYruU8Gf3S3sb | |
| 7 | +Zua7bw9E8+cux2FXA8CArLshcmUSyPlZq7osJwIDAQABAoIBAQCVaNIOWTaxBZ/3 | |
| 8 | +kKGRnRQbL6DGMGO5RMdmxHkD8wNtPqr3fqE7ueIvWUDHWmICFzz3BpoxGrZs5Ktf | |
| 9 | +KkNPx+8+8d1wpK9h5ZVukJQ9Gpu64xbraCLnEDxrBxnMuO5K23tcq+q9sVeqc45g | |
| 10 | +dNpjJXSMQdkZGjliTLJbmAgWfpllQbvWGnPavrjMl18B7qqPFfpto6AoLbGNEJ7k | |
| 11 | +8NopU6mDeJGdv3nPJFmyzPQWHwddGTRR67QRy97CK/1lgV4/9Sx3F/H+3zp/JCJU | |
| 12 | +du8A9cxpvitKIfbLlsageqmiTWYbBfWLm3oZ3BHGeeVSd3mZmS13F321StQ2jQiL | |
| 13 | +wypH48bxAoGBAPyZBfYLke0FRst87hRwhbUgADKqr+I+oprNjP+z90osxfMK3f78 | |
| 14 | +ikZgMUG9oLI4q2JXY70i4yTGNQmsVbGf5bPeIWVWkXxdCcteN3TVYBxfa3Jy0uyM | |
| 15 | +fxsD++Q/kOwzN9X6JG42G2QeN2ceEp1I6LY3CDimPDnbtnlDkNVXdQSVAoGBAJ6C | |
| 16 | +y1/hbOk8sTrGvrUGHGYJuD04QEYil18E+jlvwTH9DZeUaCCtyYNbmRyHPlxDRBM5 | |
| 17 | +82Zw6y4kqtlMmNTovSDH/A9ieL1ZO/ehEmbcthRkBee7k8WA4T03cNbLF5YIrhh2 | |
| 18 | +bBaLQpRneTScp14XEFHlX3z1jn6CphC/MBy3VOLLAoGBAMYZKFCnEEFnQvcxOfHz | |
| 19 | +sRi0SRNzQ07WumVXUP30YLreVDvgSOvBmJvKsraRBebfhKEyUfkx1BuyCkRU0Dvm | |
| 20 | +X5npWh2Ef8KdoKHKeQl6kc6OktCF9p8nLEO+oxyFMZ3cKSz56Po6Gs8w11hagFSz | |
| 21 | +qjXFAQCUdmUVx4xgjcSSuyXlAoGBAJ5R4TQJAjELb7FXJM/GJMM93gk3j+r9TdeY | |
| 22 | +Lx0DJCH7sIG/tyk8q1NKP+mgo4afoPTbIuMk0aGq+gJEYTn2pECDvpzXK+VjpWO2 | |
| 23 | +O50Fwc8oAEXusq/IBDCSmV/QReSTEuBYF6mEuqFjoEoOVZTC0Igb4335/bMaZye+ | |
| 24 | +7h0gd+Z1AoGAAPiUICh6iirA+tdvctZL74AN4JbIHU4AJV/PNhne15Uqx173UUbx | |
| 25 | +yM2ccL5d1IWSAu6cKKyInsPGi8FKknAhbMGOgYnFCT9lT6acK20ccIq42aLRI7EA | |
| 26 | +KaNtWZXn4zaqfFFAOoKhFmG963rEwpHW/oTSkYiiWAqmeSOQ9ew1jKk= | |
| 27 | +-----END RSA PRIVATE KEY----- | |
| 0 | 28 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | +-----BEGIN PUBLIC KEY----- | |
| 2 | +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnGeADtUHNs2Nm/OCKgOB | |
| 3 | +3JI9vGeCnqQ0BwQtmlzA+OKqeUnHI5AluPqUE2D1EVnVOKXsQb1QSHiL9bf19zJ+ | |
| 4 | ++BR2l9gGgQWqKbd4sQkSrUHM6criYjtvwEpXs5g/iw9cA0Svir4IV0HpMw2L4wx8 | |
| 5 | +m+a8MNp24SLVVfyH+tvYEuTpzl879PizlGFsLWeRvJMldSn3C65Sm0ihg1zl0DRx | |
| 6 | +wduszMPgghdv1glqxQTcqdmIA5bF4OSL0Bo4LaJ+EQ2W9lxNGE3GMoqxaJQ0EW47 | |
| 7 | +0YL0sSAhVqJgMdABYruU8Gf3S3sbZua7bw9E8+cux2FXA8CArLshcmUSyPlZq7os | |
| 8 | +JwIDAQAB | |
| 9 | +-----END PUBLIC KEY----- | |
| 0 | 10 | \ No newline at end of file | ... | ... |
magellan.js
| ... | ... | @@ -96,7 +96,23 @@ module.exports.getAccountDestination = async (req, res) => { |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - res.status(200).send(response) | |
| 99 | + let response1 = { | |
| 100 | + "DestinationInfo": [], | |
| 101 | + "@Metadata": { | |
| 102 | + "CurrentPage": 1, | |
| 103 | + "TotalPages": 18, | |
| 104 | + "Top": 10, | |
| 105 | + "TotalCount": 172, | |
| 106 | + "HasPrevious": false, | |
| 107 | + "HasNext": true | |
| 108 | + }, | |
| 109 | + "OperationStatus": { | |
| 110 | + "Code": "20000", | |
| 111 | + "DeveloperMessage": "The requested operation was successfully." | |
| 112 | + } | |
| 113 | + } | |
| 114 | + | |
| 115 | + res.status(200).send(response1) | |
| 100 | 116 | } |
| 101 | 117 | |
| 102 | 118 | module.exports.getAccountThings = async (req, res) => { | ... | ... |
package-lock.json
| ... | ... | @@ -14,8 +14,12 @@ |
| 14 | 14 | "body-parser": "^1.19.0", |
| 15 | 15 | "connect-multiparty": "^2.2.0", |
| 16 | 16 | "cors": "^2.8.5", |
| 17 | + "dayjs": "^1.11.7", | |
| 17 | 18 | "express": "^4.17.1", |
| 19 | + "express-graphql": "^0.12.0", | |
| 20 | + "graphql": "^15.8.0", | |
| 18 | 21 | "http": "0.0.0", |
| 22 | + "jsonwebtoken": "^8.5.1", | |
| 19 | 23 | "jstoxml": "^1.6.5", |
| 20 | 24 | "loadtest": "^5.0.4", |
| 21 | 25 | "lodash": "^4.17.15", |
| ... | ... | @@ -24,6 +28,8 @@ |
| 24 | 28 | "multiparty": "^4.2.1", |
| 25 | 29 | "n_": "^2.0.2", |
| 26 | 30 | "node-json-config": "0.0.5", |
| 31 | + "node-rsa": "^1.1.1", | |
| 32 | + "openai": "^3.2.1", | |
| 27 | 33 | "queue": "^6.0.2", |
| 28 | 34 | "run-parallel-limit": "^1.0.6", |
| 29 | 35 | "unirest": "^0.6.0" |
| ... | ... | @@ -142,6 +148,14 @@ |
| 142 | 148 | "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", |
| 143 | 149 | "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" |
| 144 | 150 | }, |
| 151 | + "node_modules/axios": { | |
| 152 | + "version": "0.26.1", | |
| 153 | + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", | |
| 154 | + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", | |
| 155 | + "dependencies": { | |
| 156 | + "follow-redirects": "^1.14.8" | |
| 157 | + } | |
| 158 | + }, | |
| 145 | 159 | "node_modules/azure": { |
| 146 | 160 | "version": "2.3.1-preview", |
| 147 | 161 | "resolved": "https://registry.npmjs.org/azure/-/azure-2.3.1-preview.tgz", |
| ... | ... | @@ -1367,6 +1381,11 @@ |
| 1367 | 1381 | "node": "*" |
| 1368 | 1382 | } |
| 1369 | 1383 | }, |
| 1384 | + "node_modules/dayjs": { | |
| 1385 | + "version": "1.11.7", | |
| 1386 | + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz", | |
| 1387 | + "integrity": "sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==" | |
| 1388 | + }, | |
| 1370 | 1389 | "node_modules/debug": { |
| 1371 | 1390 | "version": "2.6.9", |
| 1372 | 1391 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", |
| ... | ... | @@ -1539,6 +1558,109 @@ |
| 1539 | 1558 | "node": ">= 0.10.0" |
| 1540 | 1559 | } |
| 1541 | 1560 | }, |
| 1561 | + "node_modules/express-graphql": { | |
| 1562 | + "version": "0.12.0", | |
| 1563 | + "resolved": "https://registry.npmjs.org/express-graphql/-/express-graphql-0.12.0.tgz", | |
| 1564 | + "integrity": "sha512-DwYaJQy0amdy3pgNtiTDuGGM2BLdj+YO2SgbKoLliCfuHv3VVTt7vNG/ZqK2hRYjtYHE2t2KB705EU94mE64zg==", | |
| 1565 | + "dependencies": { | |
| 1566 | + "accepts": "^1.3.7", | |
| 1567 | + "content-type": "^1.0.4", | |
| 1568 | + "http-errors": "1.8.0", | |
| 1569 | + "raw-body": "^2.4.1" | |
| 1570 | + }, | |
| 1571 | + "engines": { | |
| 1572 | + "node": ">= 10.x" | |
| 1573 | + }, | |
| 1574 | + "peerDependencies": { | |
| 1575 | + "graphql": "^14.7.0 || ^15.3.0" | |
| 1576 | + } | |
| 1577 | + }, | |
| 1578 | + "node_modules/express-graphql/node_modules/bytes": { | |
| 1579 | + "version": "3.1.2", | |
| 1580 | + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", | |
| 1581 | + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", | |
| 1582 | + "engines": { | |
| 1583 | + "node": ">= 0.8" | |
| 1584 | + } | |
| 1585 | + }, | |
| 1586 | + "node_modules/express-graphql/node_modules/http-errors": { | |
| 1587 | + "version": "1.8.0", | |
| 1588 | + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.0.tgz", | |
| 1589 | + "integrity": "sha512-4I8r0C5JDhT5VkvI47QktDW75rNlGVsUf/8hzjCC/wkWI/jdTRmBb9aI7erSG82r1bjKY3F6k28WnsVxB1C73A==", | |
| 1590 | + "dependencies": { | |
| 1591 | + "depd": "~1.1.2", | |
| 1592 | + "inherits": "2.0.4", | |
| 1593 | + "setprototypeof": "1.2.0", | |
| 1594 | + "statuses": ">= 1.5.0 < 2", | |
| 1595 | + "toidentifier": "1.0.0" | |
| 1596 | + }, | |
| 1597 | + "engines": { | |
| 1598 | + "node": ">= 0.6" | |
| 1599 | + } | |
| 1600 | + }, | |
| 1601 | + "node_modules/express-graphql/node_modules/inherits": { | |
| 1602 | + "version": "2.0.4", | |
| 1603 | + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", | |
| 1604 | + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" | |
| 1605 | + }, | |
| 1606 | + "node_modules/express-graphql/node_modules/raw-body": { | |
| 1607 | + "version": "2.5.1", | |
| 1608 | + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", | |
| 1609 | + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", | |
| 1610 | + "dependencies": { | |
| 1611 | + "bytes": "3.1.2", | |
| 1612 | + "http-errors": "2.0.0", | |
| 1613 | + "iconv-lite": "0.4.24", | |
| 1614 | + "unpipe": "1.0.0" | |
| 1615 | + }, | |
| 1616 | + "engines": { | |
| 1617 | + "node": ">= 0.8" | |
| 1618 | + } | |
| 1619 | + }, | |
| 1620 | + "node_modules/express-graphql/node_modules/raw-body/node_modules/depd": { | |
| 1621 | + "version": "2.0.0", | |
| 1622 | + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", | |
| 1623 | + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", | |
| 1624 | + "engines": { | |
| 1625 | + "node": ">= 0.8" | |
| 1626 | + } | |
| 1627 | + }, | |
| 1628 | + "node_modules/express-graphql/node_modules/raw-body/node_modules/http-errors": { | |
| 1629 | + "version": "2.0.0", | |
| 1630 | + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", | |
| 1631 | + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", | |
| 1632 | + "dependencies": { | |
| 1633 | + "depd": "2.0.0", | |
| 1634 | + "inherits": "2.0.4", | |
| 1635 | + "setprototypeof": "1.2.0", | |
| 1636 | + "statuses": "2.0.1", | |
| 1637 | + "toidentifier": "1.0.1" | |
| 1638 | + }, | |
| 1639 | + "engines": { | |
| 1640 | + "node": ">= 0.8" | |
| 1641 | + } | |
| 1642 | + }, | |
| 1643 | + "node_modules/express-graphql/node_modules/raw-body/node_modules/statuses": { | |
| 1644 | + "version": "2.0.1", | |
| 1645 | + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", | |
| 1646 | + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", | |
| 1647 | + "engines": { | |
| 1648 | + "node": ">= 0.8" | |
| 1649 | + } | |
| 1650 | + }, | |
| 1651 | + "node_modules/express-graphql/node_modules/raw-body/node_modules/toidentifier": { | |
| 1652 | + "version": "1.0.1", | |
| 1653 | + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", | |
| 1654 | + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", | |
| 1655 | + "engines": { | |
| 1656 | + "node": ">=0.6" | |
| 1657 | + } | |
| 1658 | + }, | |
| 1659 | + "node_modules/express-graphql/node_modules/setprototypeof": { | |
| 1660 | + "version": "1.2.0", | |
| 1661 | + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", | |
| 1662 | + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" | |
| 1663 | + }, | |
| 1542 | 1664 | "node_modules/ext": { |
| 1543 | 1665 | "version": "1.4.0", |
| 1544 | 1666 | "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", |
| ... | ... | @@ -1600,6 +1722,25 @@ |
| 1600 | 1722 | "node": ">= 0.8" |
| 1601 | 1723 | } |
| 1602 | 1724 | }, |
| 1725 | + "node_modules/follow-redirects": { | |
| 1726 | + "version": "1.15.2", | |
| 1727 | + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", | |
| 1728 | + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", | |
| 1729 | + "funding": [ | |
| 1730 | + { | |
| 1731 | + "type": "individual", | |
| 1732 | + "url": "https://github.com/sponsors/RubenVerborgh" | |
| 1733 | + } | |
| 1734 | + ], | |
| 1735 | + "engines": { | |
| 1736 | + "node": ">=4.0" | |
| 1737 | + }, | |
| 1738 | + "peerDependenciesMeta": { | |
| 1739 | + "debug": { | |
| 1740 | + "optional": true | |
| 1741 | + } | |
| 1742 | + } | |
| 1743 | + }, | |
| 1603 | 1744 | "node_modules/forever-agent": { |
| 1604 | 1745 | "version": "0.6.1", |
| 1605 | 1746 | "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", |
| ... | ... | @@ -1645,6 +1786,14 @@ |
| 1645 | 1786 | "assert-plus": "^1.0.0" |
| 1646 | 1787 | } |
| 1647 | 1788 | }, |
| 1789 | + "node_modules/graphql": { | |
| 1790 | + "version": "15.8.0", | |
| 1791 | + "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.8.0.tgz", | |
| 1792 | + "integrity": "sha512-5gghUc24tP9HRznNpV2+FIoq3xKkj5dTQqf4v0CpdPbFVwFkWoxOM+o+2OC9ZSvjEMTjfmG9QT+gcvggTwW1zw==", | |
| 1793 | + "engines": { | |
| 1794 | + "node": ">= 10.x" | |
| 1795 | + } | |
| 1796 | + }, | |
| 1648 | 1797 | "node_modules/har-schema": { |
| 1649 | 1798 | "version": "2.0.0", |
| 1650 | 1799 | "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", |
| ... | ... | @@ -1824,6 +1973,32 @@ |
| 1824 | 1973 | "node >= 0.2.0" |
| 1825 | 1974 | ] |
| 1826 | 1975 | }, |
| 1976 | + "node_modules/jsonwebtoken": { | |
| 1977 | + "version": "8.5.1", | |
| 1978 | + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", | |
| 1979 | + "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", | |
| 1980 | + "dependencies": { | |
| 1981 | + "jws": "^3.2.2", | |
| 1982 | + "lodash.includes": "^4.3.0", | |
| 1983 | + "lodash.isboolean": "^3.0.3", | |
| 1984 | + "lodash.isinteger": "^4.0.4", | |
| 1985 | + "lodash.isnumber": "^3.0.3", | |
| 1986 | + "lodash.isplainobject": "^4.0.6", | |
| 1987 | + "lodash.isstring": "^4.0.1", | |
| 1988 | + "lodash.once": "^4.0.0", | |
| 1989 | + "ms": "^2.1.1", | |
| 1990 | + "semver": "^5.6.0" | |
| 1991 | + }, | |
| 1992 | + "engines": { | |
| 1993 | + "node": ">=4", | |
| 1994 | + "npm": ">=1.4.28" | |
| 1995 | + } | |
| 1996 | + }, | |
| 1997 | + "node_modules/jsonwebtoken/node_modules/ms": { | |
| 1998 | + "version": "2.1.3", | |
| 1999 | + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", | |
| 2000 | + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" | |
| 2001 | + }, | |
| 1827 | 2002 | "node_modules/jsprim": { |
| 1828 | 2003 | "version": "1.4.1", |
| 1829 | 2004 | "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", |
| ... | ... | @@ -1893,6 +2068,41 @@ |
| 1893 | 2068 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", |
| 1894 | 2069 | "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" |
| 1895 | 2070 | }, |
| 2071 | + "node_modules/lodash.includes": { | |
| 2072 | + "version": "4.3.0", | |
| 2073 | + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", | |
| 2074 | + "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" | |
| 2075 | + }, | |
| 2076 | + "node_modules/lodash.isboolean": { | |
| 2077 | + "version": "3.0.3", | |
| 2078 | + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", | |
| 2079 | + "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=" | |
| 2080 | + }, | |
| 2081 | + "node_modules/lodash.isinteger": { | |
| 2082 | + "version": "4.0.4", | |
| 2083 | + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", | |
| 2084 | + "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=" | |
| 2085 | + }, | |
| 2086 | + "node_modules/lodash.isnumber": { | |
| 2087 | + "version": "3.0.3", | |
| 2088 | + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", | |
| 2089 | + "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=" | |
| 2090 | + }, | |
| 2091 | + "node_modules/lodash.isplainobject": { | |
| 2092 | + "version": "4.0.6", | |
| 2093 | + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", | |
| 2094 | + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" | |
| 2095 | + }, | |
| 2096 | + "node_modules/lodash.isstring": { | |
| 2097 | + "version": "4.0.1", | |
| 2098 | + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", | |
| 2099 | + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" | |
| 2100 | + }, | |
| 2101 | + "node_modules/lodash.once": { | |
| 2102 | + "version": "4.1.1", | |
| 2103 | + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", | |
| 2104 | + "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" | |
| 2105 | + }, | |
| 1896 | 2106 | "node_modules/log": { |
| 1897 | 2107 | "version": "1.4.0", |
| 1898 | 2108 | "resolved": "https://registry.npmjs.org/log/-/log-1.4.0.tgz", |
| ... | ... | @@ -2148,6 +2358,14 @@ |
| 2148 | 2358 | "resolved": "https://registry.npmjs.org/node-json-config/-/node-json-config-0.0.5.tgz", |
| 2149 | 2359 | "integrity": "sha1-Iaaqgx7lV5djQ8ydqNgKnlSo0Oc=" |
| 2150 | 2360 | }, |
| 2361 | + "node_modules/node-rsa": { | |
| 2362 | + "version": "1.1.1", | |
| 2363 | + "resolved": "https://registry.npmjs.org/node-rsa/-/node-rsa-1.1.1.tgz", | |
| 2364 | + "integrity": "sha512-Jd4cvbJMryN21r5HgxQOpMEqv+ooke/korixNNK3mGqfGJmy0M77WDDzo/05969+OkMy3XW1UuZsSmW9KQm7Fw==", | |
| 2365 | + "dependencies": { | |
| 2366 | + "asn1": "^0.2.4" | |
| 2367 | + } | |
| 2368 | + }, | |
| 2151 | 2369 | "node_modules/oauth-sign": { |
| 2152 | 2370 | "version": "0.9.0", |
| 2153 | 2371 | "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", |
| ... | ... | @@ -2175,6 +2393,28 @@ |
| 2175 | 2393 | "node": ">= 0.8" |
| 2176 | 2394 | } |
| 2177 | 2395 | }, |
| 2396 | + "node_modules/openai": { | |
| 2397 | + "version": "3.2.1", | |
| 2398 | + "resolved": "https://registry.npmjs.org/openai/-/openai-3.2.1.tgz", | |
| 2399 | + "integrity": "sha512-762C9BNlJPbjjlWZi4WYK9iM2tAVAv0uUp1UmI34vb0CN5T2mjB/qM6RYBmNKMh/dN9fC+bxqPwWJZUTWW052A==", | |
| 2400 | + "dependencies": { | |
| 2401 | + "axios": "^0.26.0", | |
| 2402 | + "form-data": "^4.0.0" | |
| 2403 | + } | |
| 2404 | + }, | |
| 2405 | + "node_modules/openai/node_modules/form-data": { | |
| 2406 | + "version": "4.0.0", | |
| 2407 | + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", | |
| 2408 | + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", | |
| 2409 | + "dependencies": { | |
| 2410 | + "asynckit": "^0.4.0", | |
| 2411 | + "combined-stream": "^1.0.8", | |
| 2412 | + "mime-types": "^2.1.12" | |
| 2413 | + }, | |
| 2414 | + "engines": { | |
| 2415 | + "node": ">= 6" | |
| 2416 | + } | |
| 2417 | + }, | |
| 2178 | 2418 | "node_modules/parseurl": { |
| 2179 | 2419 | "version": "1.3.3", |
| 2180 | 2420 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", |
| ... | ... | @@ -2938,6 +3178,14 @@ |
| 2938 | 3178 | "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", |
| 2939 | 3179 | "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" |
| 2940 | 3180 | }, |
| 3181 | + "axios": { | |
| 3182 | + "version": "0.26.1", | |
| 3183 | + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", | |
| 3184 | + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", | |
| 3185 | + "requires": { | |
| 3186 | + "follow-redirects": "^1.14.8" | |
| 3187 | + } | |
| 3188 | + }, | |
| 2941 | 3189 | "azure": { |
| 2942 | 3190 | "version": "2.3.1-preview", |
| 2943 | 3191 | "resolved": "https://registry.npmjs.org/azure/-/azure-2.3.1-preview.tgz", |
| ... | ... | @@ -4137,6 +4385,11 @@ |
| 4137 | 4385 | "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz", |
| 4138 | 4386 | "integrity": "sha1-sCIMAt6YYXQztyhRz0fePfLNvuk=" |
| 4139 | 4387 | }, |
| 4388 | + "dayjs": { | |
| 4389 | + "version": "1.11.7", | |
| 4390 | + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz", | |
| 4391 | + "integrity": "sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==" | |
| 4392 | + }, | |
| 4140 | 4393 | "debug": { |
| 4141 | 4394 | "version": "2.6.9", |
| 4142 | 4395 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", |
| ... | ... | @@ -4291,6 +4544,86 @@ |
| 4291 | 4544 | "vary": "~1.1.2" |
| 4292 | 4545 | } |
| 4293 | 4546 | }, |
| 4547 | + "express-graphql": { | |
| 4548 | + "version": "0.12.0", | |
| 4549 | + "resolved": "https://registry.npmjs.org/express-graphql/-/express-graphql-0.12.0.tgz", | |
| 4550 | + "integrity": "sha512-DwYaJQy0amdy3pgNtiTDuGGM2BLdj+YO2SgbKoLliCfuHv3VVTt7vNG/ZqK2hRYjtYHE2t2KB705EU94mE64zg==", | |
| 4551 | + "requires": { | |
| 4552 | + "accepts": "^1.3.7", | |
| 4553 | + "content-type": "^1.0.4", | |
| 4554 | + "http-errors": "1.8.0", | |
| 4555 | + "raw-body": "^2.4.1" | |
| 4556 | + }, | |
| 4557 | + "dependencies": { | |
| 4558 | + "bytes": { | |
| 4559 | + "version": "3.1.2", | |
| 4560 | + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", | |
| 4561 | + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" | |
| 4562 | + }, | |
| 4563 | + "http-errors": { | |
| 4564 | + "version": "1.8.0", | |
| 4565 | + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.0.tgz", | |
| 4566 | + "integrity": "sha512-4I8r0C5JDhT5VkvI47QktDW75rNlGVsUf/8hzjCC/wkWI/jdTRmBb9aI7erSG82r1bjKY3F6k28WnsVxB1C73A==", | |
| 4567 | + "requires": { | |
| 4568 | + "depd": "~1.1.2", | |
| 4569 | + "inherits": "2.0.4", | |
| 4570 | + "setprototypeof": "1.2.0", | |
| 4571 | + "statuses": ">= 1.5.0 < 2", | |
| 4572 | + "toidentifier": "1.0.0" | |
| 4573 | + } | |
| 4574 | + }, | |
| 4575 | + "inherits": { | |
| 4576 | + "version": "2.0.4", | |
| 4577 | + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", | |
| 4578 | + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" | |
| 4579 | + }, | |
| 4580 | + "raw-body": { | |
| 4581 | + "version": "2.5.1", | |
| 4582 | + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", | |
| 4583 | + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", | |
| 4584 | + "requires": { | |
| 4585 | + "bytes": "3.1.2", | |
| 4586 | + "http-errors": "2.0.0", | |
| 4587 | + "iconv-lite": "0.4.24", | |
| 4588 | + "unpipe": "1.0.0" | |
| 4589 | + }, | |
| 4590 | + "dependencies": { | |
| 4591 | + "depd": { | |
| 4592 | + "version": "2.0.0", | |
| 4593 | + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", | |
| 4594 | + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" | |
| 4595 | + }, | |
| 4596 | + "http-errors": { | |
| 4597 | + "version": "2.0.0", | |
| 4598 | + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", | |
| 4599 | + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", | |
| 4600 | + "requires": { | |
| 4601 | + "depd": "2.0.0", | |
| 4602 | + "inherits": "2.0.4", | |
| 4603 | + "setprototypeof": "1.2.0", | |
| 4604 | + "statuses": "2.0.1", | |
| 4605 | + "toidentifier": "1.0.1" | |
| 4606 | + } | |
| 4607 | + }, | |
| 4608 | + "statuses": { | |
| 4609 | + "version": "2.0.1", | |
| 4610 | + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", | |
| 4611 | + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" | |
| 4612 | + }, | |
| 4613 | + "toidentifier": { | |
| 4614 | + "version": "1.0.1", | |
| 4615 | + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", | |
| 4616 | + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" | |
| 4617 | + } | |
| 4618 | + } | |
| 4619 | + }, | |
| 4620 | + "setprototypeof": { | |
| 4621 | + "version": "1.2.0", | |
| 4622 | + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", | |
| 4623 | + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" | |
| 4624 | + } | |
| 4625 | + } | |
| 4626 | + }, | |
| 4294 | 4627 | "ext": { |
| 4295 | 4628 | "version": "1.4.0", |
| 4296 | 4629 | "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", |
| ... | ... | @@ -4348,6 +4681,11 @@ |
| 4348 | 4681 | "unpipe": "~1.0.0" |
| 4349 | 4682 | } |
| 4350 | 4683 | }, |
| 4684 | + "follow-redirects": { | |
| 4685 | + "version": "1.15.2", | |
| 4686 | + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", | |
| 4687 | + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" | |
| 4688 | + }, | |
| 4351 | 4689 | "forever-agent": { |
| 4352 | 4690 | "version": "0.6.1", |
| 4353 | 4691 | "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", |
| ... | ... | @@ -4381,6 +4719,11 @@ |
| 4381 | 4719 | "assert-plus": "^1.0.0" |
| 4382 | 4720 | } |
| 4383 | 4721 | }, |
| 4722 | + "graphql": { | |
| 4723 | + "version": "15.8.0", | |
| 4724 | + "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.8.0.tgz", | |
| 4725 | + "integrity": "sha512-5gghUc24tP9HRznNpV2+FIoq3xKkj5dTQqf4v0CpdPbFVwFkWoxOM+o+2OC9ZSvjEMTjfmG9QT+gcvggTwW1zw==" | |
| 4726 | + }, | |
| 4384 | 4727 | "har-schema": { |
| 4385 | 4728 | "version": "2.0.0", |
| 4386 | 4729 | "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", |
| ... | ... | @@ -4531,6 +4874,30 @@ |
| 4531 | 4874 | "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.2.0.tgz", |
| 4532 | 4875 | "integrity": "sha1-XAxWhRBxYOcv50ib3eoLRMK8Z70=" |
| 4533 | 4876 | }, |
| 4877 | + "jsonwebtoken": { | |
| 4878 | + "version": "8.5.1", | |
| 4879 | + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", | |
| 4880 | + "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", | |
| 4881 | + "requires": { | |
| 4882 | + "jws": "^3.2.2", | |
| 4883 | + "lodash.includes": "^4.3.0", | |
| 4884 | + "lodash.isboolean": "^3.0.3", | |
| 4885 | + "lodash.isinteger": "^4.0.4", | |
| 4886 | + "lodash.isnumber": "^3.0.3", | |
| 4887 | + "lodash.isplainobject": "^4.0.6", | |
| 4888 | + "lodash.isstring": "^4.0.1", | |
| 4889 | + "lodash.once": "^4.0.0", | |
| 4890 | + "ms": "^2.1.1", | |
| 4891 | + "semver": "^5.6.0" | |
| 4892 | + }, | |
| 4893 | + "dependencies": { | |
| 4894 | + "ms": { | |
| 4895 | + "version": "2.1.3", | |
| 4896 | + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", | |
| 4897 | + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" | |
| 4898 | + } | |
| 4899 | + } | |
| 4900 | + }, | |
| 4534 | 4901 | "jsprim": { |
| 4535 | 4902 | "version": "1.4.1", |
| 4536 | 4903 | "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", |
| ... | ... | @@ -4590,6 +4957,41 @@ |
| 4590 | 4957 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", |
| 4591 | 4958 | "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" |
| 4592 | 4959 | }, |
| 4960 | + "lodash.includes": { | |
| 4961 | + "version": "4.3.0", | |
| 4962 | + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", | |
| 4963 | + "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" | |
| 4964 | + }, | |
| 4965 | + "lodash.isboolean": { | |
| 4966 | + "version": "3.0.3", | |
| 4967 | + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", | |
| 4968 | + "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=" | |
| 4969 | + }, | |
| 4970 | + "lodash.isinteger": { | |
| 4971 | + "version": "4.0.4", | |
| 4972 | + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", | |
| 4973 | + "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=" | |
| 4974 | + }, | |
| 4975 | + "lodash.isnumber": { | |
| 4976 | + "version": "3.0.3", | |
| 4977 | + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", | |
| 4978 | + "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=" | |
| 4979 | + }, | |
| 4980 | + "lodash.isplainobject": { | |
| 4981 | + "version": "4.0.6", | |
| 4982 | + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", | |
| 4983 | + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" | |
| 4984 | + }, | |
| 4985 | + "lodash.isstring": { | |
| 4986 | + "version": "4.0.1", | |
| 4987 | + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", | |
| 4988 | + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" | |
| 4989 | + }, | |
| 4990 | + "lodash.once": { | |
| 4991 | + "version": "4.1.1", | |
| 4992 | + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", | |
| 4993 | + "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" | |
| 4994 | + }, | |
| 4593 | 4995 | "log": { |
| 4594 | 4996 | "version": "1.4.0", |
| 4595 | 4997 | "resolved": "https://registry.npmjs.org/log/-/log-1.4.0.tgz", |
| ... | ... | @@ -4796,6 +5198,14 @@ |
| 4796 | 5198 | "resolved": "https://registry.npmjs.org/node-json-config/-/node-json-config-0.0.5.tgz", |
| 4797 | 5199 | "integrity": "sha1-Iaaqgx7lV5djQ8ydqNgKnlSo0Oc=" |
| 4798 | 5200 | }, |
| 5201 | + "node-rsa": { | |
| 5202 | + "version": "1.1.1", | |
| 5203 | + "resolved": "https://registry.npmjs.org/node-rsa/-/node-rsa-1.1.1.tgz", | |
| 5204 | + "integrity": "sha512-Jd4cvbJMryN21r5HgxQOpMEqv+ooke/korixNNK3mGqfGJmy0M77WDDzo/05969+OkMy3XW1UuZsSmW9KQm7Fw==", | |
| 5205 | + "requires": { | |
| 5206 | + "asn1": "^0.2.4" | |
| 5207 | + } | |
| 5208 | + }, | |
| 4799 | 5209 | "oauth-sign": { |
| 4800 | 5210 | "version": "0.9.0", |
| 4801 | 5211 | "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", |
| ... | ... | @@ -4814,6 +5224,27 @@ |
| 4814 | 5224 | "ee-first": "1.1.1" |
| 4815 | 5225 | } |
| 4816 | 5226 | }, |
| 5227 | + "openai": { | |
| 5228 | + "version": "3.2.1", | |
| 5229 | + "resolved": "https://registry.npmjs.org/openai/-/openai-3.2.1.tgz", | |
| 5230 | + "integrity": "sha512-762C9BNlJPbjjlWZi4WYK9iM2tAVAv0uUp1UmI34vb0CN5T2mjB/qM6RYBmNKMh/dN9fC+bxqPwWJZUTWW052A==", | |
| 5231 | + "requires": { | |
| 5232 | + "axios": "^0.26.0", | |
| 5233 | + "form-data": "^4.0.0" | |
| 5234 | + }, | |
| 5235 | + "dependencies": { | |
| 5236 | + "form-data": { | |
| 5237 | + "version": "4.0.0", | |
| 5238 | + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", | |
| 5239 | + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", | |
| 5240 | + "requires": { | |
| 5241 | + "asynckit": "^0.4.0", | |
| 5242 | + "combined-stream": "^1.0.8", | |
| 5243 | + "mime-types": "^2.1.12" | |
| 5244 | + } | |
| 5245 | + } | |
| 5246 | + } | |
| 5247 | + }, | |
| 4817 | 5248 | "parseurl": { |
| 4818 | 5249 | "version": "1.3.3", |
| 4819 | 5250 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", | ... | ... |
package.json
| ... | ... | @@ -14,8 +14,12 @@ |
| 14 | 14 | "body-parser": "^1.19.0", |
| 15 | 15 | "connect-multiparty": "^2.2.0", |
| 16 | 16 | "cors": "^2.8.5", |
| 17 | + "dayjs": "^1.11.7", | |
| 17 | 18 | "express": "^4.17.1", |
| 19 | + "express-graphql": "^0.12.0", | |
| 20 | + "graphql": "^15.8.0", | |
| 18 | 21 | "http": "0.0.0", |
| 22 | + "jsonwebtoken": "^8.5.1", | |
| 19 | 23 | "jstoxml": "^1.6.5", |
| 20 | 24 | "loadtest": "^5.0.4", |
| 21 | 25 | "lodash": "^4.17.15", |
| ... | ... | @@ -24,6 +28,8 @@ |
| 24 | 28 | "multiparty": "^4.2.1", |
| 25 | 29 | "n_": "^2.0.2", |
| 26 | 30 | "node-json-config": "0.0.5", |
| 31 | + "node-rsa": "^1.1.1", | |
| 32 | + "openai": "^3.2.1", | |
| 27 | 33 | "queue": "^6.0.2", |
| 28 | 34 | "run-parallel-limit": "^1.0.6", |
| 29 | 35 | "unirest": "^0.6.0" | ... | ... |
| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | +module.exports.getApiForPartner = async (req, res) => { | |
| 2 | + console.log('===== GET inquiry Api for partner =====') | |
| 3 | + console.log('url', req.originalUrl); | |
| 4 | + console.log('headers', req.headers); | |
| 5 | + console.log('query', req.query); | |
| 6 | + console.log('params', req.params); | |
| 7 | + | |
| 8 | + let response = { | |
| 9 | + "resultCode": "20000", | |
| 10 | + "developerMessage": "Success", | |
| 11 | + "result": { | |
| 12 | + "listOfApi": [ | |
| 13 | + "tq/tqTest:00001", | |
| 14 | + "pam/test2:10000", | |
| 15 | + "pam1/test:01000", | |
| 16 | + "tq/tq:11111", | |
| 17 | + "resource/test:11111" | |
| 18 | + ] | |
| 19 | + } | |
| 20 | + } | |
| 21 | + | |
| 22 | + // let response = { | |
| 23 | + // "resultCode": "40401", | |
| 24 | + // "developerMessage": "Data Not Found", | |
| 25 | + // } | |
| 26 | + | |
| 27 | + res.set('content-type', 'application/json') | |
| 28 | + | |
| 29 | + res.send(response) | |
| 30 | +} | |
| 0 | 31 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,88 @@ |
| 1 | +conn = new Mongo('10.1.2.146:27017'); | |
| 2 | + | |
| 3 | +company = conn.getDB("iot_partner_company"); | |
| 4 | +workflow = conn.getDB("iot_partner_workflow"); | |
| 5 | + | |
| 6 | +companies = company.companies.find() | |
| 7 | +worksheets = workflow.worksheets.find().sort( { "createdDate": 1 } ) | |
| 8 | + | |
| 9 | +let movedFileList = [] | |
| 10 | +while ( worksheets.hasNext() ) { | |
| 11 | + worksheet = worksheets.next() | |
| 12 | + // print(worksheet.supplierRegistration.taxId) | |
| 13 | + | |
| 14 | + let fileList = [] | |
| 15 | + | |
| 16 | + // worksheet.files | |
| 17 | + for(file of worksheet.files) { | |
| 18 | + if(file.fileValue === 'companyFile') { | |
| 19 | + if(worksheet.businessAgreement && worksheet.businessAgreement.companyFiles | |
| 20 | + && worksheet.businessAgreement.companyFiles.companies | |
| 21 | + && !worksheet.businessAgreement.companyFiles.companies.includes(file.fileId)) { | |
| 22 | + worksheet.businessAgreement.companyFiles.companies.push(file.fileId) | |
| 23 | + } | |
| 24 | + fileList.push(file) | |
| 25 | + } | |
| 26 | + | |
| 27 | + if(file.fileValue === 'CompanyProfilePresentation0') { | |
| 28 | + if(worksheet.businessAgreement && worksheet.businessAgreement.companyFiles | |
| 29 | + && worksheet.businessAgreement.companyFiles.companies | |
| 30 | + && !worksheet.businessAgreement.companyFiles.companies.includes(file.fileId)) { | |
| 31 | + worksheet.businessAgreement.companyFiles.companies.push(file.fileId) | |
| 32 | + } | |
| 33 | + fileList.push(file) | |
| 34 | + } | |
| 35 | + | |
| 36 | + if(file.fileValue === 'vatFile') { | |
| 37 | + if(worksheet.businessAgreement && worksheet.businessAgreement.companyFiles | |
| 38 | + && worksheet.businessAgreement.companyFiles.companies | |
| 39 | + && !worksheet.businessAgreement.companyFiles.companies.includes(file.fileId)) { | |
| 40 | + worksheet.businessAgreement.companyFiles.companies.push(file.fileId) | |
| 41 | + } | |
| 42 | + fileList.push(file) | |
| 43 | + } | |
| 44 | + } | |
| 45 | + | |
| 46 | + if(worksheet.businessAgreement && worksheet.businessAgreement.companyFiles && worksheet.businessAgreement.companyFiles.companies) { | |
| 47 | + workflow.worksheets.update({_id: worksheet._id}, { | |
| 48 | + '$set': {'businessAgreement.companyFiles.companies' : worksheet.businessAgreement.companyFiles.companies} | |
| 49 | + }) | |
| 50 | + } | |
| 51 | + | |
| 52 | + | |
| 53 | + for(i = 0; i < companies.length(); i++) { | |
| 54 | + companie = companies[i] | |
| 55 | + // print(companie.taxId, worksheet.supplierRegistration.taxId, companie.taxId === worksheet.supplierRegistration.taxId) | |
| 56 | + if(companie.taxId === worksheet.supplierRegistration.taxId) { | |
| 57 | + if(companie.files && Array.isArray(companie.files) && companie.files.length > 0) { | |
| 58 | + for(j = 0; j < fileList.length; j++) { | |
| 59 | + let alreadyFileInList = false | |
| 60 | + for(k = 0; k < companie.files.length; k++) { | |
| 61 | + if(companie.files[k].fileValue === fileList[j].fileValue) { | |
| 62 | + alreadyFileInList = true | |
| 63 | + break; | |
| 64 | + } | |
| 65 | + } | |
| 66 | + if(!alreadyFileInList) { | |
| 67 | + companie.files.push(fileList[j]) | |
| 68 | + movedFileList.push(fileList[j]) | |
| 69 | + } | |
| 70 | + } | |
| 71 | + } else { | |
| 72 | + companie.files = fileList | |
| 73 | + movedFileList.concat(fileList) | |
| 74 | + } | |
| 75 | + break | |
| 76 | + } | |
| 77 | + } | |
| 78 | +} | |
| 79 | + | |
| 80 | +for(i = 0; i < companies.length(); i++) { | |
| 81 | + company.companies.update({_id: companies[i]._id}, { | |
| 82 | + '$set': {files : companies[i].files} | |
| 83 | + }) | |
| 84 | +} | |
| 85 | + | |
| 86 | +company.movedFiles.insert({ | |
| 87 | + files: movedFileList | |
| 88 | +}) | ... | ... |
| ... | ... | @@ -0,0 +1,164 @@ |
| 1 | +conn = new Mongo('mongodb://sandmongots:Aistsmongo@10.232.155.131:25000/admin'); | |
| 2 | +// conn_iot_partner_company = new Mongo('mongodb://serveradm:mypassword@10.138.42.23:8080/iot_partner_company'); | |
| 3 | +// conn_iot_partner_workflow = new Mongo('mongodb://serveradm:mypassword@10.138.42.23:8080/iot_partner_workflow'); | |
| 4 | + | |
| 5 | +company = conn.getDB("iot_partner_company"); | |
| 6 | +workflow = conn.getDB("iot_partner_workflow"); | |
| 7 | + | |
| 8 | +companies = company.companies.find() | |
| 9 | + | |
| 10 | +// let movedFileList = [] | |
| 11 | +issueCompanies = [] | |
| 12 | + | |
| 13 | +while ( companies.hasNext() ) { | |
| 14 | + companie = companies.next() | |
| 15 | + | |
| 16 | + // print(companie.files) | |
| 17 | + let hasVatFile, hasCompanyPresentation, hasCompanyFile | |
| 18 | + for (let file of companie.files ) { | |
| 19 | + // vatFile, companyPresentaion, companyFile | |
| 20 | + // print(file) | |
| 21 | + if(file.fileValue === 'vatFile') { | |
| 22 | + hasVatFile = true | |
| 23 | + } else if(file.fileValue === 'CompanyProfilePresentation0') { | |
| 24 | + hasCompanyPresentation = true | |
| 25 | + } else if(file.fileValue === 'companyFile') { | |
| 26 | + hasCompanyFile = true | |
| 27 | + } | |
| 28 | + } | |
| 29 | + | |
| 30 | + if(!hasVatFile || !hasCompanyPresentation || !hasCompanyFile) { | |
| 31 | + issueCompanies.push(companie) | |
| 32 | + } | |
| 33 | +} | |
| 34 | + | |
| 35 | +// searchWorksheetList = [] | |
| 36 | + | |
| 37 | +for(let issueComp of issueCompanies) { | |
| 38 | + for(let file of issueComp.files) { | |
| 39 | + let searchWorksheet = { | |
| 40 | + 'files.fileId' : file.fileId, | |
| 41 | + 'supplierRegistration.taxId': issueComp.taxId | |
| 42 | + } | |
| 43 | + | |
| 44 | + worksheets = workflow.worksheets.find(searchWorksheet).sort( { "updatedDate": -1 } ) | |
| 45 | + // print(worksheets.size() > 0) | |
| 46 | + if(worksheets.size() > 0) { | |
| 47 | + // print(worksheets) | |
| 48 | + let worksheet = worksheets[0] | |
| 49 | + | |
| 50 | + let expectWorksheet = [] | |
| 51 | + let alreadyVatFile, alreadyCompanyProfilePresentation, alreadycompanyFile | |
| 52 | + let vFile, presentFile, compFile | |
| 53 | + for(let worksheetFile of worksheet.files) { | |
| 54 | + if(worksheetFile.fileValue === 'vatFile') { | |
| 55 | + if(!vFile) { | |
| 56 | + vFile = worksheetFile | |
| 57 | + } | |
| 58 | + if(worksheetFile.isPass === true) { | |
| 59 | + if(!alreadyVatFile) { | |
| 60 | + expectWorksheet.push(worksheetFile) | |
| 61 | + } | |
| 62 | + alreadyVatFile = true | |
| 63 | + } | |
| 64 | + } else if(worksheetFile.fileValue === 'CompanyProfilePresentation0') { | |
| 65 | + if(!presentFile) { | |
| 66 | + presentFile = worksheetFile | |
| 67 | + } | |
| 68 | + if(worksheetFile.isPass === true) { | |
| 69 | + if(!alreadyCompanyProfilePresentation) { | |
| 70 | + expectWorksheet.push(worksheetFile) | |
| 71 | + } | |
| 72 | + alreadyCompanyProfilePresentation = true | |
| 73 | + } | |
| 74 | + } else if(worksheetFile.fileValue === 'companyFile') { | |
| 75 | + if(!compFile) { | |
| 76 | + compFile = worksheetFile | |
| 77 | + } | |
| 78 | + if(worksheetFile.isPass === true) { | |
| 79 | + if(!alreadycompanyFile) { | |
| 80 | + expectWorksheet.push(worksheetFile) | |
| 81 | + } | |
| 82 | + alreadycompanyFile = true | |
| 83 | + } | |
| 84 | + } | |
| 85 | + } | |
| 86 | + | |
| 87 | + if(!alreadyVatFile) { | |
| 88 | + if(vFile) { | |
| 89 | + expectWorksheet.push(vFile) | |
| 90 | + } | |
| 91 | + } | |
| 92 | + | |
| 93 | + if(!alreadyCompanyProfilePresentation) { | |
| 94 | + if(presentFile) { | |
| 95 | + expectWorksheet.push(presentFile) | |
| 96 | + } | |
| 97 | + } | |
| 98 | + | |
| 99 | + if(!alreadycompanyFile) { | |
| 100 | + if(compFile) { | |
| 101 | + expectWorksheet.push(compFile) | |
| 102 | + } | |
| 103 | + } | |
| 104 | + | |
| 105 | + newFileList = issueComp.files | |
| 106 | + fileNameForMoved = [] | |
| 107 | + | |
| 108 | + for(let ws of expectWorksheet) { | |
| 109 | + hasFile = false | |
| 110 | + for(let file2 of issueComp.files) { | |
| 111 | + if(ws.fileId === file2.fileId) { | |
| 112 | + hasFile = true | |
| 113 | + break | |
| 114 | + } | |
| 115 | + } | |
| 116 | + | |
| 117 | + if(!hasFile) { | |
| 118 | + fileNameForMoved.push(ws.fileName) | |
| 119 | + newFileList.push(ws) | |
| 120 | + } | |
| 121 | + | |
| 122 | + hasCompany = false | |
| 123 | + for(let wsComp of worksheet.businessAgreement.companyFiles.companies) { | |
| 124 | + if(wsComp === ws.fileId) { | |
| 125 | + hasCompany = true | |
| 126 | + break | |
| 127 | + } | |
| 128 | + // | |
| 129 | + } | |
| 130 | + | |
| 131 | + if(!hasCompany) { | |
| 132 | + worksheet.businessAgreement.companyFiles.companies.push(ws.fileId) | |
| 133 | + } | |
| 134 | + } | |
| 135 | + | |
| 136 | + // | |
| 137 | + // update company and worksheet // | |
| 138 | + print("update company where _id " + issueComp._id) | |
| 139 | + printjson({$set: { files: newFileList }}) | |
| 140 | + | |
| 141 | + company.companies.update({_id: issueComp._id}, { | |
| 142 | + '$set': { files: newFileList } | |
| 143 | + }) | |
| 144 | + | |
| 145 | + print("update worksheet where _id " + worksheet._id) | |
| 146 | + printjson({$set: { 'businessAgreement.companyFiles.companies': worksheet.businessAgreement.companyFiles.companies }}) | |
| 147 | + | |
| 148 | + workflow.worksheets.update({_id: worksheet._id}, { | |
| 149 | + '$set': {'businessAgreement.companyFiles.companies' : worksheet.businessAgreement.companyFiles.companies} | |
| 150 | + }) | |
| 151 | + | |
| 152 | + printjson(fileNameForMoved) | |
| 153 | + | |
| 154 | + for(let fileName of fileNameForMoved) { | |
| 155 | + company.movedFiles.insert({ | |
| 156 | + src: `/workflows/worksheets/${worksheet._id}/files/${fileName}`, | |
| 157 | + dest: `/companies/${worksheet.supplierRegistration.taxId}/${fileName}` | |
| 158 | + }) | |
| 159 | + } | |
| 160 | + | |
| 161 | + break; | |
| 162 | + } | |
| 163 | + } | |
| 164 | +} | ... | ... |