biz-a-cli 2.3.33 → 2.3.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/log/info.log CHANGED
@@ -162,3 +162,51 @@
162
162
  {"level":"info","message":"stringToSign","stringToSign":"POST:/api/v1.0/qr/qr-mpm-generate:9f37c6a6669e6ccb9bccd020c3892d053cdd569bc67f7a2163e439e797006fbc:2024-07-18T16:10:36+07:00","timestamp":"2024-07-18T09:10:36.151Z"}
163
163
  {"data":"{\"partnerReferenceNo\":\"01368\",\"merchantId\":\"SGWIMAMATEK\",\"amount\":{\"value\":47500,\"currency\":\"IDR\"},\"additionalInfo\":{\"productCode\":\"QRIS\"},\"validityPeriod\":\"2024-07-19T16:10:36+07:00\"}","headers":{"Accept":"application/json","CHANNEL-ID":"ESPAY","Content-Type":"application/json","X-EXTERNAL-ID":1368,"X-PARTNER-ID":"SGWIMAMATEK","X-SIGNATURE":"0eVlcjjq+YekvsmpkHaUev7H82WKoZOtOUC12x5HT5l4/fxPEjMY6k1dR0uVOScHt29bBoyrkcx53170TrFA3oqARpj0i28h4OvvtJSnJDra+VV8aHXHSRi1Tzhy3dla11qa74MfE8RYjJk/Np9/6M5I6BrWcirFFLCx1TMNIAX8I5ezZR2DxXvEBDX1B3eROpEKzkCvR/CZ2G7LvooQvb2imZKZxre/MvgBDZH+iqdo81USA3jUQuNxALjel5928KYxWkVgsJnzdc8HFeSxiCRFJpHmQc6GypAK72H3/wXkhV/OhQcAdB2BKDSYqmUC4ayzmVDJgEZpbE35LD9wfA==","X-TIMESTAMP":"2024-07-18T16:10:36+07:00"},"level":"info","maxBodyLength":null,"message":"reqPayment cfg","method":"POST","timestamp":"2024-07-18T09:10:36.155Z","url":"https://sandbox-api.espay.id/api/v1.0/qr/qr-mpm-generate"}
164
164
  {"data":{"responseCode":"4000000","responseMessage":"Bad Request"},"level":"info","message":"reqPayment res","timestamp":"2024-07-18T09:10:39.375Z"}
165
+ {"arguments":{"$0":"hub","_":[],"d":2,"dbindex":2,"h":"localhost","hostname":"localhost","p":212,"port":212,"s":"http://localhost:3000","server":"http://localhost:3000","serverport":3002,"sp":3002,"sub":"scy","subdomain":"scy"},"body":{"additionalInfo":{"approvalCode":"","creditTo":"1150000059313","creditToBank":"008","creditToName":"SIRYU","debitFrom":"","debitFromBank":"008","debitFromName":"","feeType":"S","memberCode":"SGWIMAMATEK","message":{"CHANNEL_FLAG":null},"paymentRef":"ESP17235249821560","paymentRemark":"Anejan Invoice No 01712","productCode":"SALDOMUQR","productValue":"936009213895612935","rrn":"47b12e1673e38","token":"","transactionStatus":"S","txFee":"0.00","userId":"01712"},"customerNo":"SGWIMAMATEK","paidAmount":{"currency":"IDR","value":"42000.00"},"partnerServiceId":" Espay","paymentRequestId":"68e3d9bb-8489-42f3-bec1-1ede8f1b6905","totalAmount":{"currency":"IDR","value":"42000.00"},"trxDateTime":"2024-08-13T11:56:38+07:00","trxId":"ESP17235249821560","virtualAccountNo":"01712"},"headers":{"accept":"*/*","accept-encoding":"gzip, deflate, br","cache-control":"no-cache","channel-id":"ESPAY","connection":"keep-alive","content-length":"1138","content-type":"application/json","host":"localhost:3000","postman-token":"a9bf27cf-001a-436d-818d-a744dee5c737","user-agent":"PostmanRuntime/7.41.1","x-external-id":"68e3d9bb-8489-42f3-bec1-1ede8f1b6905","x-partner-id":"SGWIMAMATEK","x-signature":"if+bTXmC7WsxOLe8lwIVms+wOreNmBc1MG2GkntbplQ8Ck95q0DEmVHOgsTVKA6zkXaijw0aRvYDXntLFoAo0i7SPGT/WEGbb4mXslJEKfK83p/0NiRXxKF4D14YbQqnmvTxTHJ+f2/hrsDRoxTTDnQcDI/tO3BuBeijTFj3okPWjN5fhAHT0SEqn7FTXBHeh09pIvueDt/LGzem7Q55GaTQRikDQe212e/d1+8/9ApHi/RSWB8SfBkPdBfCj2wrki8enpbKpc0WCwccxjMINdM9/kCxjw6CwrzIqbRcrTjyZVRTvHrSCFEHZZZZHBOAuUJyGsDJoqqvEDweTXuGeQ==","x-timestamp":"2024-08-13T11:56:38+0700"},"level":"info","message":"data","path":"/","query":{"companyid":"SCY","scriptid":"4","subdomain":"scy"},"socket":{"_callbacks":{"$cli-req":[null],"$connect":[null],"$incomingClient":[null]},"_opts":{"hostname":"localhost","path":"/socket.io","port":"3000","secure":false},"_queue":[],"_queueSeq":0,"acks":{},"connected":true,"flags":{},"id":"J7KojhMPMs8ljlPcAAAB","ids":3,"io":{"_autoConnect":true,"_callbacks":{"$close":[null],"$error":[null],"$open":[null],"$packet":[null]},"_randomizationFactor":0.5,"_readyState":"open","_reconnecting":false,"_reconnection":true,"_reconnectionAttempts":null,"_reconnectionDelay":1000,"_reconnectionDelayMax":5000,"_timeout":20000,"backoff":{"attempts":0,"factor":2,"jitter":0.5,"max":5000,"ms":1000},"decoder":{"_callbacks":{"$decoded":[null]}},"encoder":{},"engine":{"_callbacks":{"$close":[null],"$data":[null],"$error":[null],"$ping":[null]},"binaryType":"nodebuffer","hostname":"localhost","id":"IlUumGgq978yB_C8AAAA","maxPayload":1000000,"opts":{"addTrailingSlash":true,"agent":false,"closeOnBeforeunload":false,"hostname":"localhost","path":"/socket.io/","perMessageDeflate":{"threshold":1024},"port":"3000","rejectUnauthorized":true,"rememberUpgrade":false,"secure":false,"timestampParam":"t","transportOptions":{},"upgrade":true,"withCredentials":false},"pingInterval":25000,"pingTimeout":20000,"pingTimeoutTimer":{"_destroyed":false,"_idleNext":{"_idleNext":"[Circular]","_idlePrev":"[Circular]","expiry":741301,"id":-9007199254740888,"msecs":45000,"priorityQueuePosition":2},"_idlePrev":{"_idleNext":"[Circular]","_idlePrev":"[Circular]","expiry":741301,"id":-9007199254740888,"msecs":45000,"priorityQueuePosition":2},"_idleStart":696301,"_idleTimeout":45000,"_repeat":null},"port":"3000","prevBufferLen":0,"readyState":"open","secure":false,"transport":{"_callbacks":{"$close":[null],"$drain":[null],"$error":[null],"$packet":[null]},"opts":{"addTrailingSlash":true,"agent":false,"closeOnBeforeunload":false,"hostname":"localhost","path":"/socket.io/","perMessageDeflate":{"threshold":1024},"port":"3000","query":{"EIO":4,"sid":"IlUumGgq978yB_C8AAAA","transport":"websocket"},"rejectUnauthorized":true,"rememberUpgrade":false,"secure":false,"socket":"[Circular]","timestampParam":"t","transportOptions":{},"upgrade":true,"withCredentials":false},"query":{"EIO":4,"sid":"IlUumGgq978yB_C8AAAA","transport":"websocket"},"readyState":"open","socket":"[Circular]","supportsBinary":true,"writable":true,"ws":{"_autoPong":true,"_binaryType":"nodebuffer","_bufferedAmount":0,"_closeCode":1006,"_closeFrameReceived":false,"_closeFrameSent":false,"_closeMessage":{"data":[],"type":"Buffer"},"_closeTimer":null,"_events":{},"_eventsCount":4,"_extensions":{},"_isServer":false,"_paused":false,"_protocol":"","_readyState":1,"_receiver":{"_allowSynchronousEvents":true,"_binaryType":"nodebuffer","_bufferedBytes":0,"_buffers":[],"_compressed":false,"_errored":false,"_events":{},"_eventsCount":6,"_extensions":{},"_fin":true,"_fragmented":0,"_fragments":[],"_isServer":false,"_loop":false,"_masked":false,"_maxPayload":104857600,"_messageLength":0,"_opcode":1,"_payloadLength":1688,"_skipUTF8Validation":false,"_state":0,"_totalPayloadLength":0,"_writableState":{"bufferedIndex":0,"corked":0,"highWaterMark":16384,"length":0,"pendingcb":0,"writelen":0}},"_redirects":0,"_req":null,"_sender":{"_bufferedBytes":0,"_compress":false,"_deflating":false,"_extensions":{},"_firstFragment":true,"_queue":[],"_socket":{"_closeAfterHandlingError":false,"_events":{"end":[null,null]},"_eventsCount":4,"_hadError":false,"_host":"localhost","_httpMessage":null,"_parent":null,"_pendingData":null,"_pendingEncoding":"","_readableState":{"awaitDrainWriters":null,"buffer":[],"bufferIndex":0,"highWaterMark":16384,"length":0,"pipes":[]},"_server":null,"_sockname":null,"_writableState":{"bufferedIndex":0,"corked":0,"highWaterMark":16384,"length":0,"pendingcb":0,"writelen":0},"allowHalfOpen":false,"autoSelectFamilyAttemptedAddresses":["::1:3000"],"connecting":false,"parser":null,"server":null,"timeout":0}},"_socket":{"_closeAfterHandlingError":false,"_events":{"end":[null,null]},"_eventsCount":4,"_hadError":false,"_host":"localhost","_httpMessage":null,"_parent":null,"_pendingData":null,"_pendingEncoding":"","_readableState":{"awaitDrainWriters":null,"buffer":[],"bufferIndex":0,"highWaterMark":16384,"length":0,"pipes":[]},"_server":null,"_sockname":null,"_writableState":{"bufferedIndex":0,"corked":0,"highWaterMark":16384,"length":0,"pendingcb":0,"writelen":0},"allowHalfOpen":false,"autoSelectFamilyAttemptedAddresses":["::1:3000"],"connecting":false,"parser":null,"server":null,"timeout":0},"_url":"ws://localhost:3000/socket.io/?EIO=4&transport=websocket&sid=IlUumGgq978yB_C8AAAA"}},"transports":["polling","websocket","webtransport"],"upgrades":["websocket"],"upgrading":false,"writeBuffer":[]},"nsps":{"/":"[Circular]"},"opts":{"hostname":"localhost","path":"/socket.io","port":"3000","secure":false},"skipReconnect":false,"subs":[null,null,null,null,null],"uri":"http://localhost:3000"},"nsp":"/","receiveBuffer":[],"sendBuffer":[],"subs":[null,null,null,null]},"timestamp":"2024-08-15T15:08:12.151Z"}
166
+ {"arguments":{"$0":"hub","_":[],"d":2,"dbindex":2,"h":"localhost","hostname":"localhost","p":212,"port":212,"s":"http://localhost:3000","server":"http://localhost:3000","serverport":3002,"sp":3002,"sub":"scy","subdomain":"scy"},"body":{"additionalInfo":{"approvalCode":"","creditTo":"1150000059313","creditToBank":"008","creditToName":"SIRYU","debitFrom":"","debitFromBank":"008","debitFromName":"","feeType":"S","memberCode":"SGWIMAMATEK","message":{"CHANNEL_FLAG":null},"paymentRef":"ESP17235249821560","paymentRemark":"Anejan Invoice No 01712","productCode":"SALDOMUQR","productValue":"936009213895612935","rrn":"47b12e1673e38","token":"","transactionStatus":"S","txFee":"0.00","userId":"01712"},"customerNo":"SGWIMAMATEK","paidAmount":{"currency":"IDR","value":"42000.00"},"partnerServiceId":" Espay","paymentRequestId":"68e3d9bb-8489-42f3-bec1-1ede8f1b6905","totalAmount":{"currency":"IDR","value":"42000.00"},"trxDateTime":"2024-08-13T11:56:38+07:00","trxId":"ESP17235249821560","virtualAccountNo":"01712"},"headers":{"accept":"*/*","accept-encoding":"gzip, deflate, br","cache-control":"no-cache","channel-id":"ESPAY","connection":"keep-alive","content-length":"1138","content-type":"application/json","host":"localhost:3000","postman-token":"71f1890b-502a-4162-bb42-51ecf124c1d7","user-agent":"PostmanRuntime/7.41.1","x-external-id":"68e3d9bb-8489-42f3-bec1-1ede8f1b6905","x-partner-id":"SGWIMAMATEK","x-signature":"if+bTXmC7WsxOLe8lwIVms+wOreNmBc1MG2GkntbplQ8Ck95q0DEmVHOgsTVKA6zkXaijw0aRvYDXntLFoAo0i7SPGT/WEGbb4mXslJEKfK83p/0NiRXxKF4D14YbQqnmvTxTHJ+f2/hrsDRoxTTDnQcDI/tO3BuBeijTFj3okPWjN5fhAHT0SEqn7FTXBHeh09pIvueDt/LGzem7Q55GaTQRikDQe212e/d1+8/9ApHi/RSWB8SfBkPdBfCj2wrki8enpbKpc0WCwccxjMINdM9/kCxjw6CwrzIqbRcrTjyZVRTvHrSCFEHZZZZHBOAuUJyGsDJoqqvEDweTXuGeQ==","x-timestamp":"2024-08-13T11:56:38+0700"},"level":"info","message":"data","path":"/","query":{"companyid":"SCY","scriptid":"4","subdomain":"scy"},"socket":{"_callbacks":{"$cli-req":[null],"$connect":[null],"$incomingClient":[null]},"_opts":{"hostname":"localhost","path":"/socket.io","port":"3000","secure":false},"_queue":[],"_queueSeq":0,"acks":{},"connected":true,"flags":{},"id":"J7KojhMPMs8ljlPcAAAB","ids":3,"io":{"_autoConnect":true,"_callbacks":{"$close":[null],"$error":[null],"$open":[null],"$packet":[null]},"_randomizationFactor":0.5,"_readyState":"open","_reconnecting":false,"_reconnection":true,"_reconnectionAttempts":null,"_reconnectionDelay":1000,"_reconnectionDelayMax":5000,"_timeout":20000,"backoff":{"attempts":0,"factor":2,"jitter":0.5,"max":5000,"ms":1000},"decoder":{"_callbacks":{"$decoded":[null]}},"encoder":{},"engine":{"_callbacks":{"$close":[null],"$data":[null],"$error":[null],"$ping":[null]},"binaryType":"nodebuffer","hostname":"localhost","id":"IlUumGgq978yB_C8AAAA","maxPayload":1000000,"opts":{"addTrailingSlash":true,"agent":false,"closeOnBeforeunload":false,"hostname":"localhost","path":"/socket.io/","perMessageDeflate":{"threshold":1024},"port":"3000","rejectUnauthorized":true,"rememberUpgrade":false,"secure":false,"timestampParam":"t","transportOptions":{},"upgrade":true,"withCredentials":false},"pingInterval":25000,"pingTimeout":20000,"pingTimeoutTimer":{"_destroyed":false,"_idleNext":{"_idleNext":"[Circular]","_idlePrev":"[Circular]","expiry":1029590,"id":-9007199254740857,"msecs":45000,"priorityQueuePosition":2},"_idlePrev":{"_idleNext":"[Circular]","_idlePrev":"[Circular]","expiry":1029590,"id":-9007199254740857,"msecs":45000,"priorityQueuePosition":2},"_idleStart":984590,"_idleTimeout":45000,"_repeat":null},"port":"3000","prevBufferLen":0,"readyState":"open","secure":false,"transport":{"_callbacks":{"$close":[null],"$drain":[null],"$error":[null],"$packet":[null]},"opts":{"addTrailingSlash":true,"agent":false,"closeOnBeforeunload":false,"hostname":"localhost","path":"/socket.io/","perMessageDeflate":{"threshold":1024},"port":"3000","query":{"EIO":4,"sid":"IlUumGgq978yB_C8AAAA","transport":"websocket"},"rejectUnauthorized":true,"rememberUpgrade":false,"secure":false,"socket":"[Circular]","timestampParam":"t","transportOptions":{},"upgrade":true,"withCredentials":false},"query":{"EIO":4,"sid":"IlUumGgq978yB_C8AAAA","transport":"websocket"},"readyState":"open","socket":"[Circular]","supportsBinary":true,"writable":true,"ws":{"_autoPong":true,"_binaryType":"nodebuffer","_bufferedAmount":0,"_closeCode":1006,"_closeFrameReceived":false,"_closeFrameSent":false,"_closeMessage":{"data":[],"type":"Buffer"},"_closeTimer":null,"_events":{},"_eventsCount":4,"_extensions":{},"_isServer":false,"_paused":false,"_protocol":"","_readyState":1,"_receiver":{"_allowSynchronousEvents":true,"_binaryType":"nodebuffer","_bufferedBytes":0,"_buffers":[],"_compressed":false,"_errored":false,"_events":{},"_eventsCount":6,"_extensions":{},"_fin":true,"_fragmented":0,"_fragments":[],"_isServer":false,"_loop":false,"_masked":false,"_maxPayload":104857600,"_messageLength":0,"_opcode":1,"_payloadLength":1688,"_skipUTF8Validation":false,"_state":0,"_totalPayloadLength":0,"_writableState":{"bufferedIndex":0,"corked":0,"highWaterMark":16384,"length":0,"pendingcb":0,"writelen":0}},"_redirects":0,"_req":null,"_sender":{"_bufferedBytes":0,"_compress":false,"_deflating":false,"_extensions":{},"_firstFragment":true,"_queue":[],"_socket":{"_closeAfterHandlingError":false,"_events":{"end":[null,null]},"_eventsCount":4,"_hadError":false,"_host":"localhost","_httpMessage":null,"_parent":null,"_pendingData":null,"_pendingEncoding":"","_readableState":{"awaitDrainWriters":null,"buffer":[],"bufferIndex":0,"highWaterMark":16384,"length":0,"pipes":[]},"_server":null,"_sockname":null,"_writableState":{"bufferedIndex":0,"corked":0,"highWaterMark":16384,"length":0,"pendingcb":0,"writelen":0},"allowHalfOpen":false,"autoSelectFamilyAttemptedAddresses":["::1:3000"],"connecting":false,"parser":null,"server":null,"timeout":0}},"_socket":{"_closeAfterHandlingError":false,"_events":{"end":[null,null]},"_eventsCount":4,"_hadError":false,"_host":"localhost","_httpMessage":null,"_parent":null,"_pendingData":null,"_pendingEncoding":"","_readableState":{"awaitDrainWriters":null,"buffer":[],"bufferIndex":0,"highWaterMark":16384,"length":0,"pipes":[]},"_server":null,"_sockname":null,"_writableState":{"bufferedIndex":0,"corked":0,"highWaterMark":16384,"length":0,"pendingcb":0,"writelen":0},"allowHalfOpen":false,"autoSelectFamilyAttemptedAddresses":["::1:3000"],"connecting":false,"parser":null,"server":null,"timeout":0},"_url":"ws://localhost:3000/socket.io/?EIO=4&transport=websocket&sid=IlUumGgq978yB_C8AAAA"}},"transports":["polling","websocket","webtransport"],"upgrades":["websocket"],"upgrading":false,"writeBuffer":[]},"nsps":{"/":"[Circular]"},"opts":{"hostname":"localhost","path":"/socket.io","port":"3000","secure":false},"skipReconnect":false,"subs":[null,null,null,null,null],"uri":"http://localhost:3000"},"nsp":"/","receiveBuffer":[],"sendBuffer":[],"subs":[null,null,null,null]},"timestamp":"2024-08-15T15:13:00.467Z"}
167
+ {"arguments":{"$0":"hub","_":[],"d":2,"dbindex":2,"h":"localhost","hostname":"localhost","p":212,"port":212,"s":"http://localhost:3000","server":"http://localhost:3000","serverport":3002,"sp":3002,"sub":"scy","subdomain":"scy"},"body":{"additionalInfo":{"approvalCode":"","creditTo":"1150000059313","creditToBank":"008","creditToName":"SIRYU","debitFrom":"","debitFromBank":"008","debitFromName":"","feeType":"S","memberCode":"SGWIMAMATEK","message":{"CHANNEL_FLAG":null},"paymentRef":"ESP17235249821560","paymentRemark":"Anejan Invoice No 01712","productCode":"SALDOMUQR","productValue":"936009213895612935","rrn":"47b12e1673e38","token":"","transactionStatus":"S","txFee":"0.00","userId":"01712"},"customerNo":"SGWIMAMATEK","paidAmount":{"currency":"IDR","value":"42000.00"},"partnerServiceId":" Espay","paymentRequestId":"68e3d9bb-8489-42f3-bec1-1ede8f1b6905","totalAmount":{"currency":"IDR","value":"42000.00"},"trxDateTime":"2024-08-13T11:56:38+07:00","trxId":"ESP17235249821560","virtualAccountNo":"01712"},"headers":{"accept":"*/*","accept-encoding":"gzip, deflate, br","cache-control":"no-cache","channel-id":"ESPAY","connection":"keep-alive","content-length":"1138","content-type":"application/json","host":"localhost:3000","postman-token":"8bd52ecf-43a3-488e-84a6-4358c6069dc4","user-agent":"PostmanRuntime/7.41.1","x-external-id":"68e3d9bb-8489-42f3-bec1-1ede8f1b6905","x-partner-id":"SGWIMAMATEK","x-signature":"if+bTXmC7WsxOLe8lwIVms+wOreNmBc1MG2GkntbplQ8Ck95q0DEmVHOgsTVKA6zkXaijw0aRvYDXntLFoAo0i7SPGT/WEGbb4mXslJEKfK83p/0NiRXxKF4D14YbQqnmvTxTHJ+f2/hrsDRoxTTDnQcDI/tO3BuBeijTFj3okPWjN5fhAHT0SEqn7FTXBHeh09pIvueDt/LGzem7Q55GaTQRikDQe212e/d1+8/9ApHi/RSWB8SfBkPdBfCj2wrki8enpbKpc0WCwccxjMINdM9/kCxjw6CwrzIqbRcrTjyZVRTvHrSCFEHZZZZHBOAuUJyGsDJoqqvEDweTXuGeQ==","x-timestamp":"2024-08-13T11:56:38+0700"},"level":"info","message":"data","path":"/","query":{"companyid":"SCY","scriptid":"4","subdomain":"scy"},"socket":{"_callbacks":{"$cli-req":[null],"$connect":[null],"$incomingClient":[null]},"_opts":{"hostname":"localhost","path":"/socket.io","port":"3000","secure":false},"_queue":[],"_queueSeq":0,"acks":{},"connected":true,"flags":{},"id":"J7KojhMPMs8ljlPcAAAB","ids":3,"io":{"_autoConnect":true,"_callbacks":{"$close":[null],"$error":[null],"$open":[null],"$packet":[null]},"_randomizationFactor":0.5,"_readyState":"open","_reconnecting":false,"_reconnection":true,"_reconnectionAttempts":null,"_reconnectionDelay":1000,"_reconnectionDelayMax":5000,"_timeout":20000,"backoff":{"attempts":0,"factor":2,"jitter":0.5,"max":5000,"ms":1000},"decoder":{"_callbacks":{"$decoded":[null]}},"encoder":{},"engine":{"_callbacks":{"$close":[null],"$data":[null],"$error":[null],"$ping":[null]},"binaryType":"nodebuffer","hostname":"localhost","id":"IlUumGgq978yB_C8AAAA","maxPayload":1000000,"opts":{"addTrailingSlash":true,"agent":false,"closeOnBeforeunload":false,"hostname":"localhost","path":"/socket.io/","perMessageDeflate":{"threshold":1024},"port":"3000","rejectUnauthorized":true,"rememberUpgrade":false,"secure":false,"timestampParam":"t","transportOptions":{},"upgrade":true,"withCredentials":false},"pingInterval":25000,"pingTimeout":20000,"pingTimeoutTimer":{"_destroyed":false,"_idleNext":{"_idleNext":"[Circular]","_idlePrev":"[Circular]","expiry":1362286,"id":-9007199254740827,"msecs":45000,"priorityQueuePosition":2},"_idlePrev":{"_idleNext":"[Circular]","_idlePrev":"[Circular]","expiry":1362286,"id":-9007199254740827,"msecs":45000,"priorityQueuePosition":2},"_idleStart":1317286,"_idleTimeout":45000,"_repeat":null},"port":"3000","prevBufferLen":0,"readyState":"open","secure":false,"transport":{"_callbacks":{"$close":[null],"$drain":[null],"$error":[null],"$packet":[null]},"opts":{"addTrailingSlash":true,"agent":false,"closeOnBeforeunload":false,"hostname":"localhost","path":"/socket.io/","perMessageDeflate":{"threshold":1024},"port":"3000","query":{"EIO":4,"sid":"IlUumGgq978yB_C8AAAA","transport":"websocket"},"rejectUnauthorized":true,"rememberUpgrade":false,"secure":false,"socket":"[Circular]","timestampParam":"t","transportOptions":{},"upgrade":true,"withCredentials":false},"query":{"EIO":4,"sid":"IlUumGgq978yB_C8AAAA","transport":"websocket"},"readyState":"open","socket":"[Circular]","supportsBinary":true,"writable":true,"ws":{"_autoPong":true,"_binaryType":"nodebuffer","_bufferedAmount":0,"_closeCode":1006,"_closeFrameReceived":false,"_closeFrameSent":false,"_closeMessage":{"data":[],"type":"Buffer"},"_closeTimer":null,"_events":{},"_eventsCount":4,"_extensions":{},"_isServer":false,"_paused":false,"_protocol":"","_readyState":1,"_receiver":{"_allowSynchronousEvents":true,"_binaryType":"nodebuffer","_bufferedBytes":0,"_buffers":[],"_compressed":false,"_errored":false,"_events":{},"_eventsCount":6,"_extensions":{},"_fin":true,"_fragmented":0,"_fragments":[],"_isServer":false,"_loop":false,"_masked":false,"_maxPayload":104857600,"_messageLength":0,"_opcode":1,"_payloadLength":1688,"_skipUTF8Validation":false,"_state":0,"_totalPayloadLength":0,"_writableState":{"bufferedIndex":0,"corked":0,"highWaterMark":16384,"length":0,"pendingcb":0,"writelen":0}},"_redirects":0,"_req":null,"_sender":{"_bufferedBytes":0,"_compress":false,"_deflating":false,"_extensions":{},"_firstFragment":true,"_queue":[],"_socket":{"_closeAfterHandlingError":false,"_events":{"end":[null,null]},"_eventsCount":4,"_hadError":false,"_host":"localhost","_httpMessage":null,"_parent":null,"_pendingData":null,"_pendingEncoding":"","_readableState":{"awaitDrainWriters":null,"buffer":[],"bufferIndex":0,"highWaterMark":16384,"length":0,"pipes":[]},"_server":null,"_sockname":null,"_writableState":{"bufferedIndex":0,"corked":0,"highWaterMark":16384,"length":0,"pendingcb":0,"writelen":0},"allowHalfOpen":false,"autoSelectFamilyAttemptedAddresses":["::1:3000"],"connecting":false,"parser":null,"server":null,"timeout":0}},"_socket":{"_closeAfterHandlingError":false,"_events":{"end":[null,null]},"_eventsCount":4,"_hadError":false,"_host":"localhost","_httpMessage":null,"_parent":null,"_pendingData":null,"_pendingEncoding":"","_readableState":{"awaitDrainWriters":null,"buffer":[],"bufferIndex":0,"highWaterMark":16384,"length":0,"pipes":[]},"_server":null,"_sockname":null,"_writableState":{"bufferedIndex":0,"corked":0,"highWaterMark":16384,"length":0,"pendingcb":0,"writelen":0},"allowHalfOpen":false,"autoSelectFamilyAttemptedAddresses":["::1:3000"],"connecting":false,"parser":null,"server":null,"timeout":0},"_url":"ws://localhost:3000/socket.io/?EIO=4&transport=websocket&sid=IlUumGgq978yB_C8AAAA"}},"transports":["polling","websocket","webtransport"],"upgrades":["websocket"],"upgrading":false,"writeBuffer":[]},"nsps":{"/":"[Circular]"},"opts":{"hostname":"localhost","path":"/socket.io","port":"3000","secure":false},"skipReconnect":false,"subs":[null,null,null,null,null],"uri":"http://localhost:3000"},"nsp":"/","receiveBuffer":[],"sendBuffer":[],"subs":[null,null,null,null]},"timestamp":"2024-08-15T15:18:33.136Z"}
168
+ {"accept":"*/*","accept-encoding":"gzip, deflate, br","cache-control":"no-cache","channel-id":"ESPAY","connection":"keep-alive","content-length":"1138","content-type":"application/json","host":"localhost:3000","level":"info","message":"headers","postman-token":"8bd52ecf-43a3-488e-84a6-4358c6069dc4","timestamp":"2024-08-15T15:18:33.158Z","user-agent":"PostmanRuntime/7.41.1","x-external-id":"68e3d9bb-8489-42f3-bec1-1ede8f1b6905","x-partner-id":"SGWIMAMATEK","x-signature":"if+bTXmC7WsxOLe8lwIVms+wOreNmBc1MG2GkntbplQ8Ck95q0DEmVHOgsTVKA6zkXaijw0aRvYDXntLFoAo0i7SPGT/WEGbb4mXslJEKfK83p/0NiRXxKF4D14YbQqnmvTxTHJ+f2/hrsDRoxTTDnQcDI/tO3BuBeijTFj3okPWjN5fhAHT0SEqn7FTXBHeh09pIvueDt/LGzem7Q55GaTQRikDQe212e/d1+8/9ApHi/RSWB8SfBkPdBfCj2wrki8enpbKpc0WCwccxjMINdM9/kCxjw6CwrzIqbRcrTjyZVRTvHrSCFEHZZZZHBOAuUJyGsDJoqqvEDweTXuGeQ==","x-timestamp":"2024-08-13T11:56:38+0700"}
169
+ {"additionalInfo":{"approvalCode":"","creditTo":"1150000059313","creditToBank":"008","creditToName":"SIRYU","debitFrom":"","debitFromBank":"008","debitFromName":"","feeType":"S","memberCode":"SGWIMAMATEK","message":{"CHANNEL_FLAG":null},"paymentRef":"ESP17235249821560","paymentRemark":"Anejan Invoice No 01712","productCode":"SALDOMUQR","productValue":"936009213895612935","rrn":"47b12e1673e38","token":"","transactionStatus":"S","txFee":"0.00","userId":"01712"},"customerNo":"SGWIMAMATEK","level":"info","message":"body","paidAmount":{"currency":"IDR","value":"42000.00"},"partnerServiceId":" Espay","paymentRequestId":"68e3d9bb-8489-42f3-bec1-1ede8f1b6905","timestamp":"2024-08-15T15:18:33.161Z","totalAmount":{"currency":"IDR","value":"42000.00"},"trxDateTime":"2024-08-13T11:56:38+07:00","trxId":"ESP17235249821560","virtualAccountNo":"01712"}
170
+ {"arguments":{"$0":"hub","_":[],"d":2,"dbindex":2,"h":"localhost","hostname":"localhost","p":212,"port":212,"s":"http://localhost:3000","server":"http://localhost:3000","serverport":3002,"sp":3002,"sub":"scy","subdomain":"scy"},"body":{"additionalInfo":{"approvalCode":"","creditTo":"1150000059313","creditToBank":"008","creditToName":"SIRYU","debitFrom":"","debitFromBank":"008","debitFromName":"","feeType":"S","memberCode":"SGWIMAMATEK","message":{"CHANNEL_FLAG":null},"paymentRef":"ESP17235249821560","paymentRemark":"Anejan Invoice No 01712","productCode":"SALDOMUQR","productValue":"936009213895612935","rrn":"47b12e1673e38","token":"","transactionStatus":"S","txFee":"0.00","userId":"01712"},"customerNo":"SGWIMAMATEK","paidAmount":{"currency":"IDR","value":"42000.00"},"partnerServiceId":" Espay","paymentRequestId":"68e3d9bb-8489-42f3-bec1-1ede8f1b6905","totalAmount":{"currency":"IDR","value":"42000.00"},"trxDateTime":"2024-08-13T11:56:38+07:00","trxId":"ESP17235249821560","virtualAccountNo":"01712"},"headers":{"accept":"*/*","accept-encoding":"gzip, deflate, br","cache-control":"no-cache","channel-id":"ESPAY","connection":"keep-alive","content-length":"1138","content-type":"application/json","host":"localhost:3000","postman-token":"8bd52ecf-43a3-488e-84a6-4358c6069dc4","user-agent":"PostmanRuntime/7.41.1","x-external-id":"68e3d9bb-8489-42f3-bec1-1ede8f1b6905","x-partner-id":"SGWIMAMATEK","x-signature":"if+bTXmC7WsxOLe8lwIVms+wOreNmBc1MG2GkntbplQ8Ck95q0DEmVHOgsTVKA6zkXaijw0aRvYDXntLFoAo0i7SPGT/WEGbb4mXslJEKfK83p/0NiRXxKF4D14YbQqnmvTxTHJ+f2/hrsDRoxTTDnQcDI/tO3BuBeijTFj3okPWjN5fhAHT0SEqn7FTXBHeh09pIvueDt/LGzem7Q55GaTQRikDQe212e/d1+8/9ApHi/RSWB8SfBkPdBfCj2wrki8enpbKpc0WCwccxjMINdM9/kCxjw6CwrzIqbRcrTjyZVRTvHrSCFEHZZZZHBOAuUJyGsDJoqqvEDweTXuGeQ==","x-timestamp":"2024-08-13T11:56:38+0700"},"level":"info","message":"data","path":"/","query":{"companyid":"SCY","scriptid":"4","subdomain":"scy"},"socket":{"_callbacks":{"$cli-req":[null],"$connect":[null],"$incomingClient":[null]},"_opts":{"hostname":"localhost","path":"/socket.io","port":"3000","secure":false},"_queue":[],"_queueSeq":0,"acks":{},"connected":true,"flags":{},"id":"J7KojhMPMs8ljlPcAAAB","ids":3,"io":{"_autoConnect":true,"_callbacks":{"$close":[null],"$error":[null],"$open":[null],"$packet":[null]},"_randomizationFactor":0.5,"_readyState":"open","_reconnecting":false,"_reconnection":true,"_reconnectionAttempts":null,"_reconnectionDelay":1000,"_reconnectionDelayMax":5000,"_timeout":20000,"backoff":{"attempts":0,"factor":2,"jitter":0.5,"max":5000,"ms":1000},"decoder":{"_callbacks":{"$decoded":[null]}},"encoder":{},"engine":{"_callbacks":{"$close":[null],"$data":[null],"$error":[null],"$ping":[null]},"binaryType":"nodebuffer","hostname":"localhost","id":"IlUumGgq978yB_C8AAAA","maxPayload":1000000,"opts":{"addTrailingSlash":true,"agent":false,"closeOnBeforeunload":false,"hostname":"localhost","path":"/socket.io/","perMessageDeflate":{"threshold":1024},"port":"3000","rejectUnauthorized":true,"rememberUpgrade":false,"secure":false,"timestampParam":"t","transportOptions":{},"upgrade":true,"withCredentials":false},"pingInterval":25000,"pingTimeout":20000,"pingTimeoutTimer":{"_destroyed":false,"_idleNext":{"_idleNext":"[Circular]","_idlePrev":"[Circular]","expiry":1362286,"id":-9007199254740827,"msecs":45000,"priorityQueuePosition":2},"_idlePrev":{"_idleNext":"[Circular]","_idlePrev":"[Circular]","expiry":1362286,"id":-9007199254740827,"msecs":45000,"priorityQueuePosition":2},"_idleStart":1317286,"_idleTimeout":45000,"_repeat":null},"port":"3000","prevBufferLen":0,"readyState":"open","secure":false,"transport":{"_callbacks":{"$close":[null],"$drain":[null],"$error":[null],"$packet":[null]},"opts":{"addTrailingSlash":true,"agent":false,"closeOnBeforeunload":false,"hostname":"localhost","path":"/socket.io/","perMessageDeflate":{"threshold":1024},"port":"3000","query":{"EIO":4,"sid":"IlUumGgq978yB_C8AAAA","transport":"websocket"},"rejectUnauthorized":true,"rememberUpgrade":false,"secure":false,"socket":"[Circular]","timestampParam":"t","transportOptions":{},"upgrade":true,"withCredentials":false},"query":{"EIO":4,"sid":"IlUumGgq978yB_C8AAAA","transport":"websocket"},"readyState":"open","socket":"[Circular]","supportsBinary":true,"writable":true,"ws":{"_autoPong":true,"_binaryType":"nodebuffer","_bufferedAmount":0,"_closeCode":1006,"_closeFrameReceived":false,"_closeFrameSent":false,"_closeMessage":{"data":[],"type":"Buffer"},"_closeTimer":null,"_events":{},"_eventsCount":4,"_extensions":{},"_isServer":false,"_paused":false,"_protocol":"","_readyState":1,"_receiver":{"_allowSynchronousEvents":true,"_binaryType":"nodebuffer","_bufferedBytes":0,"_buffers":[],"_compressed":false,"_errored":false,"_events":{},"_eventsCount":6,"_extensions":{},"_fin":true,"_fragmented":0,"_fragments":[],"_isServer":false,"_loop":false,"_masked":false,"_maxPayload":104857600,"_messageLength":0,"_opcode":1,"_payloadLength":1688,"_skipUTF8Validation":false,"_state":0,"_totalPayloadLength":0,"_writableState":{"bufferedIndex":0,"corked":0,"highWaterMark":16384,"length":0,"pendingcb":0,"writelen":0}},"_redirects":0,"_req":null,"_sender":{"_bufferedBytes":0,"_compress":false,"_deflating":false,"_extensions":{},"_firstFragment":true,"_queue":[],"_socket":{"_closeAfterHandlingError":false,"_events":{"end":[null,null]},"_eventsCount":4,"_hadError":false,"_host":"localhost","_httpMessage":null,"_parent":null,"_pendingData":null,"_pendingEncoding":"","_readableState":{"awaitDrainWriters":null,"buffer":[],"bufferIndex":0,"highWaterMark":16384,"length":0,"pipes":[]},"_server":null,"_sockname":null,"_writableState":{"bufferedIndex":0,"corked":0,"highWaterMark":16384,"length":0,"pendingcb":0,"writelen":0},"allowHalfOpen":false,"autoSelectFamilyAttemptedAddresses":["::1:3000"],"connecting":false,"parser":null,"server":null,"timeout":0}},"_socket":{"_closeAfterHandlingError":false,"_events":{"end":[null,null]},"_eventsCount":4,"_hadError":false,"_host":"localhost","_httpMessage":null,"_parent":null,"_pendingData":null,"_pendingEncoding":"","_readableState":{"awaitDrainWriters":null,"buffer":[],"bufferIndex":0,"highWaterMark":16384,"length":0,"pipes":[]},"_server":null,"_sockname":null,"_writableState":{"bufferedIndex":0,"corked":0,"highWaterMark":16384,"length":0,"pendingcb":0,"writelen":0},"allowHalfOpen":false,"autoSelectFamilyAttemptedAddresses":["::1:3000"],"connecting":false,"parser":null,"server":null,"timeout":0},"_url":"ws://localhost:3000/socket.io/?EIO=4&transport=websocket&sid=IlUumGgq978yB_C8AAAA"}},"transports":["polling","websocket","webtransport"],"upgrades":["websocket"],"upgrading":false,"writeBuffer":[]},"nsps":{"/":"[Circular]"},"opts":{"hostname":"localhost","path":"/socket.io","port":"3000","secure":false},"skipReconnect":false,"subs":[null,null,null,null,null],"uri":"http://localhost:3000"},"nsp":"/","receiveBuffer":[],"sendBuffer":[],"subs":[null,null,null,null]},"timestamp":"2024-08-15T15:18:33.167Z"}
171
+ {"error":"Unable to complete network request to host \"192.168.1.8\".\nFailed to establish a connection.","level":"info","message":"query Data"}
172
+ {"error":"Unable to complete network request to host \"192.168.1.8\".\nFailed to establish a connection.","level":"info","message":"query Data"}
173
+ {"error":"Database IMAMATEK muncul error: Table unknown\nREFERENCENUMBER\nAt line 1, column 38","level":"info","message":"query Data"}
174
+ {"level":"info","message":"query Data"}
175
+ {"level":"info","message":"query Data","res":[]}
176
+ {"level":"info","message":"query Data","res":[]}
177
+ {"level":"info","message":"query Data","res":[]}
178
+ {"level":"info","message":"query Data","res":[]}
179
+ {"level":"info","message":"query Data","res":[]}
180
+ {"level":"info","message":"query Data","res":[]}
181
+ {"level":"info","message":"query Data","res":[]}
182
+ {"level":"info","message":"query Data","res":[]}
183
+ {"level":"info","message":"query Data","res":[]}
184
+ {"level":"info","message":"query Data","res":[]}
185
+ {"level":"info","message":"query Data","res":[]}
186
+ {"level":"info","message":"query Data","res":[]}
187
+ {"level":"info","message":"query Data","res":[]}
188
+ {"level":"info","message":"query Data","res":[]}
189
+ {"level":"info","message":"query Data","res":[]}
190
+ {"level":"info","message":"query Data","res":[]}
191
+ {"level":"info","message":"query Data","res":[]}
192
+ {"level":"info","message":"query Data","res":[]}
193
+ {"level":"info","message":"query Data","res":[]}
194
+ {"level":"info","message":"query Data","res":[]}
195
+ {"level":"info","message":"query Data","res":[]}
196
+ {"level":"info","message":"query Data","res":[]}
197
+ {"level":"info","message":"query Data","res":[]}
198
+ {"level":"info","message":"query Data","res":[]}
199
+ {"level":"info","message":"query Data","res":[]}
200
+ {"level":"info","message":"query Data","res":[]}
201
+ {"level":"info","message":"query Data","res":[]}
202
+ {"level":"info","message":"query Data","res":[]}
203
+ {"level":"info","message":"query Data","res":[]}
204
+ {"level":"info","message":"test error","timestamp":"2024-08-23T03:36:06.217Z"}
205
+ {"date":"Fri Aug 23 2024 10:41:45 GMT+0700 (Indochina Time)","error":{},"level":"error","message":"unhandledRejection: SCY custom error\nError: SCY custom error\n at runCliScript (file:///C:/SourceCode/biz-a/cli/callbackController.js:38:15)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","os":{"loadavg":[0,0,0],"uptime":8231.265},"process":{"argv":["C:\\Program Files\\nodejs\\node.exe","C:\\SourceCode\\biz-a\\cli\\bin\\hub","--server","http://localhost:3000","--sub","scy","--hostname","localhost","--port","212","-d","2"],"cwd":"C:\\SourceCode\\biz-a\\cli\\bin","execPath":"C:\\Program Files\\nodejs\\node.exe","gid":null,"memoryUsage":{"arrayBuffers":79344,"external":3839269,"heapTotal":31830016,"heapUsed":15919056,"rss":56299520},"pid":12532,"uid":null,"version":"v20.16.0"},"rejection":true,"stack":"Error: SCY custom error\n at runCliScript (file:///C:/SourceCode/biz-a/cli/callbackController.js:38:15)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","trace":[{"column":15,"file":"file:///C:/SourceCode/biz-a/cli/callbackController.js","function":"runCliScript","line":38,"method":null,"native":false},{"column":5,"file":"node:internal/process/task_queues","function":"process.processTicksAndRejections","line":95,"method":"processTicksAndRejections","native":false}]}
206
+ {"date":"Fri Aug 23 2024 10:42:38 GMT+0700 (Indochina Time)","error":{},"level":"error","message":"unhandledRejection: SCY custom error\nError: SCY custom error\n at runCliScript (file:///C:/SourceCode/biz-a/cli/callbackController.js:38:15)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","os":{"loadavg":[0,0,0],"uptime":8284.171},"process":{"argv":["C:\\Program Files\\nodejs\\node.exe","C:\\SourceCode\\biz-a\\cli\\bin\\hub","--server","http://localhost:3000","--sub","scy","--hostname","localhost","--port","212","-d","2"],"cwd":"C:\\SourceCode\\biz-a\\cli\\bin","execPath":"C:\\Program Files\\nodejs\\node.exe","gid":null,"memoryUsage":{"arrayBuffers":79344,"external":3839269,"heapTotal":32092160,"heapUsed":15741656,"rss":62074880},"pid":2684,"uid":null,"version":"v20.16.0"},"rejection":true,"stack":"Error: SCY custom error\n at runCliScript (file:///C:/SourceCode/biz-a/cli/callbackController.js:38:15)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","trace":[{"column":15,"file":"file:///C:/SourceCode/biz-a/cli/callbackController.js","function":"runCliScript","line":38,"method":null,"native":false},{"column":5,"file":"node:internal/process/task_queues","function":"process.processTicksAndRejections","line":95,"method":"processTicksAndRejections","native":false}]}
207
+ {"err":{},"level":"error","message":"Unhandled Rejection:"}
208
+ {"err":"SCY custom error","level":"error","message":"Unhandled Rejection:"}
209
+ {"err":"SCY custom error","level":"error","message":"Unhandled Rejection:"}
210
+ {"level":"error","message":"Unhandled Rejection: SCY custom error","stack":"Error: SCY custom error\n at runCliScript (file:///C:/SourceCode/biz-a/cli/callbackController.js:38:15)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
211
+ {"level":"error","message":"Unhandled Rejection: AggregateError","stack":"Error: AggregateError\n at runCliScript (file:///C:/SourceCode/biz-a/cli/callbackController.js:38:15)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
212
+ {"level":"error","message":"Unhandled Rejection: SCY custom error","stack":"Error: SCY custom error\n at runCliScript (file:///C:/SourceCode/biz-a/cli/callbackController.js:38:15)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
package/bin/watcher.js CHANGED
@@ -4,15 +4,29 @@ import express from 'express';
4
4
  import cors from 'cors';
5
5
  const app = express();
6
6
  import yargs from 'yargs';
7
-
8
7
  import * as timer from '../scheduler/timer.js'
8
+ import { createLogger, transports, format } from "winston";
9
+
10
+ const logger = createLogger({
11
+ level: 'info',
12
+ transports: [
13
+ new transports.File({ filename: 'log/error.log', level: 'error' }),
14
+ new transports.File({ filename: 'log/debug.log', level: 'debug' }),
15
+ new transports.File({ filename: 'log/info.log', level: 'info' }),
16
+ ],
17
+ })
18
+ if (process.env.NODE_ENV !== 'production') {
19
+ logger.add(new transports.Console({ format: format.simple(), level: 'info' }))
20
+ }
9
21
 
10
22
  process.on('uncaughtException', (err) => { //debug
11
23
  console.log('Unhandled Exception:', err);
24
+ logger.error('Unhandled Exception:', err)
12
25
  });
13
26
 
14
27
  process.on('unhandledRejection', (err) => { //debug
15
28
  console.log('Unhandled Rejection:', err);
29
+ logger.error('Unhandled Rejection:', err)
16
30
  });
17
31
 
18
32
  const port = 3001;
@@ -23,11 +23,12 @@ export function getInputScript(req) {
23
23
  export async function runCliScript(req, res) {
24
24
  try {
25
25
  const { data, selectedConfig } = getInputScript(req);
26
- let script = await loadCliScript(selectedConfig, req.body.query);
27
- let functions = extractFunctionScript(script);
26
+ let script = await loadCliScript(selectedConfig, 'ID', req.body.query.scriptid);
27
+ let functions = await extractFunctionScript(selectedConfig, script);
28
28
  if (functions) {
29
29
  let respon = await functions.onInit(data);
30
30
  res.send(respon);
31
+
31
32
  console.log(`Run Callback Successfully!`);
32
33
  } else {
33
34
  res.send('CLI Script does not exist.');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "biz-a-cli",
3
3
  "nameDev": "biz-a-cli-dev",
4
- "version": "2.3.33",
4
+ "version": "2.3.34",
5
5
  "versionDev": "0.0.30",
6
6
  "description": "",
7
7
  "main": "bin/index.js",
@@ -147,46 +147,69 @@ export async function genId(apiConfig, genName) {
147
147
  return res.data?.data ? JSON.parse(res.data.data) : res.data;
148
148
  }
149
149
 
150
- export function extractFunctionScript(data) {
150
+ function runScriptInThisContext(script) {
151
+ return runInThisContext(script, { importModuleDynamically: constants.USE_MAIN_CONTEXT_DEFAULT_LOADER });
152
+ }
153
+
154
+ export async function setLibrary(config, libraries) {
155
+ let libs = {};
156
+ for (const lib of libraries) {
157
+ const data = await loadCliScript(config, 'SCRIPT_NAME', lib);
158
+ const libFn = runScriptInThisContext(data[0].script);
159
+ Object.assign(libs, { lib: libFn().functions });
160
+ }
161
+
162
+ return libs;
163
+ }
164
+
165
+ export async function extractFunctionScript(selectedConfig, data) {
166
+ const config = getConfig(selectedConfig);
167
+
151
168
  if (data.error) {
152
169
  console.log(data.error, 'error')
153
170
  return
154
171
  }
155
172
  if (data.length == 0) return
156
173
 
157
- const scriptFn = runInThisContext(data[0].script, { importModuleDynamically: constants.USE_MAIN_CONTEXT_DEFAULT_LOADER });
174
+ const scriptFn = runScriptInThisContext(data[0].script);
158
175
  if (!scriptFn().functions) return
176
+
159
177
  let lib = {
160
178
  axios: axios.default,
161
179
  dayjs: dayjs.default,
162
180
  crypto: crypto,
163
- log: logger,
181
+ log: logger
182
+ }
183
+
184
+ if (scriptFn().functions.useLibrary) {
185
+ Object.assign(lib, await setLibrary(config, scriptFn().functions.useLibrary()));
164
186
  }
165
187
  return scriptFn(lib).functions;
166
188
  }
167
189
 
168
- export function getQueryDataObsParameters(trigger) {
190
+ export function getQueryDataPrmsParameters(column, value) {
169
191
  return {
170
192
  length: 1,
171
- filter: [{ junction: '', column: 'ID', operator: '=', value1: `${trigger.scriptid}` }],
193
+ filter: [{ junction: '', column: column, operator: '=', value1: `'${value}'` }],
172
194
  columns: [{ data: "SYS$CLI_SCRIPT.SCRIPT", key: 'script' }]
173
195
  }
174
196
  }
175
197
 
176
- export function queryDataPromise(config, trigger) {
177
- let param = getQueryDataObsParameters(trigger);
198
+ export async function queryDataPromise(config, column, value) {
199
+ let param = getQueryDataPrmsParameters(column, value);
200
+ // let param = getQueryDataPrmsParameters(d);
178
201
 
179
- return queryData(param, config, true);
202
+ return await queryData(param, config, true);
180
203
  }
181
204
 
182
205
  export function getConfig(config) {
183
206
  return (Array.isArray(config)) ? config[0] : config;
184
207
  }
185
208
 
186
- export function loadCliScript(selectedConfig, trigger) {
209
+ export async function loadCliScript(selectedConfig, column, value) {
187
210
  const config = getConfig(selectedConfig);
188
211
 
189
- return queryDataPromise(config, trigger);
212
+ return await queryDataPromise(config, column, value);
190
213
  }
191
214
 
192
215
  export function getInputData(config, trigger) {
@@ -212,7 +235,8 @@ export function getInputData(config, trigger) {
212
235
 
213
236
  export async function scheduleSubscription(config, data, trigger, needSetHistory, isTest = false) {
214
237
  try {
215
- let functions = extractFunctionScript(data);
238
+ let functions = extractFunctionScript(config, data);
239
+
216
240
  if (functions) {
217
241
  if (!isTest) { // next, change isTest to test better
218
242
  functions.onInit(getInputData(config, trigger));
@@ -235,7 +259,7 @@ export async function scheduleSubscription(config, data, trigger, needSetHistory
235
259
 
236
260
  export async function checkSchedule(selectedConfig, trigger, needSetHistory) {
237
261
  try {
238
- const data = await loadCliScript(selectedConfig, trigger);
262
+ const data = await loadCliScript(selectedConfig, 'ID', trigger.scriptid);
239
263
  await scheduleSubscription(selectedConfig, data, trigger, needSetHistory);
240
264
  } catch (error) {
241
265
  console.error(error);
package/tests/app.test.js CHANGED
@@ -294,7 +294,7 @@ describe('Biz-A Apps CLI', ()=>{
294
294
  expect(logSpy.mock.calls[0][0]).toBe('===================\nA.JS\n===================')
295
295
 
296
296
  expect(errorSpy.mock.calls.length).toBe(1)
297
- expect(errorSpy.mock.calls[0][0]).toBe('a.js : SyntaxError: Unexpected token: eof, expected: punc «}»')
297
+ expect(errorSpy.mock.calls[0][0]).toStrictEqual({e: 'a.js:1:38: SyntaxError: Unexpected token: eof, expected: punc «}»'})
298
298
  }
299
299
  ],
300
300
  [
@@ -305,11 +305,11 @@ describe('Biz-A Apps CLI', ()=>{
305
305
  expect(logSpy.mock.calls[0][0]).toBe('===================\nA.JS\n===================')
306
306
  expect(logSpy.mock.calls[1][0]).toBe('Minify : \nget=function(){return{modelA:{}}};modul.expor=get;')
307
307
  expect(logSpy.mock.calls[2][0]).toBe('Running script with VM') // node sandbox (VN) error as console.log
308
- expect(logSpy.mock.calls[3][0]).toBe('a.js : ReferenceError: modul is not defined')
308
+ expect(logSpy.mock.calls[3][0]).toBe("a.js : ReferenceError: modul is not defined")
309
309
  expect(logSpy.mock.calls[4][0]).toBe('Running script with Import function')
310
310
 
311
311
  expect(errorSpy.mock.calls.length).toBe(1)
312
- expect(errorSpy.mock.calls[0][0]).toBe("a.js : ReferenceError: modul is not defined") // ES6 import error
312
+ expect(errorSpy.mock.calls[0][0]).toStrictEqual({e: 'a.js : ReferenceError: modul is not defined'}) // ES6 import error
313
313
  }
314
314
  ],
315
315
  [
@@ -323,7 +323,7 @@ describe('Biz-A Apps CLI', ()=>{
323
323
  expect(logSpy.mock.calls[3][0]).toBe('Running script with Import function')
324
324
 
325
325
  expect(errorSpy.mock.calls.length).toBe(1)
326
- expect(errorSpy.mock.calls[0][0]).toBe('a.js : Failed to compile template script.\nPlease make sure the script is correct and not returning empty result')
326
+ expect(errorSpy.mock.calls[0][0]).toStrictEqual({e: 'a.js : Failed to compile template script.\nPlease make sure the script is correct and not returning empty result'})
327
327
  }
328
328
  ],
329
329
  ]
@@ -2,20 +2,27 @@ import { jest } from '@jest/globals'
2
2
 
3
3
  const mockInsertHistory = jest.fn();
4
4
  jest.unstable_mockModule("../scheduler/watcherController.js", () => ({
5
- insertHistory: mockInsertHistory.mockResolvedValue('OK')
5
+ insertHistory: mockInsertHistory.mockResolvedValue('OK'),
6
6
  }))
7
7
 
8
+ jest.unstable_mockModule('axios', () => { return { default: jest.fn() } })
9
+ let axios = (await import('axios')).default
10
+
11
+ axios.get = jest.fn()
12
+ axios.post = jest.fn()
13
+
8
14
  const {
9
15
  scheduleSubscription,
10
16
  getConfig,
11
17
  getInputData,
12
- getQueryDataObsParameters,
18
+ getQueryDataPrmsParameters,
13
19
  mapData2Key,
14
20
  getUrlApi,
15
21
  json2Parameters,
16
22
  getUrlAndParam,
17
23
  getTableObj,
18
- options
24
+ options,
25
+ setLibrary
19
26
  } = await import('../scheduler/datalib.js');
20
27
 
21
28
  describe('data test', () => {
@@ -141,13 +148,9 @@ describe('data test', () => {
141
148
  });
142
149
 
143
150
  test('get query data parameter', () => {
144
- const trigger = {
145
- scriptid: 12
146
- }
147
-
148
- expect(getQueryDataObsParameters(trigger)).toStrictEqual({
151
+ expect(getQueryDataPrmsParameters('ID', 12)).toStrictEqual({
149
152
  length: 1,
150
- filter: [{ junction: '', column: 'ID', operator: '=', value1: '12' }],
153
+ filter: [{ junction: '', column: 'ID', operator: '=', value1: "'12'" }],
151
154
  columns: [{ data: "SYS$CLI_SCRIPT.SCRIPT", key: 'script' }]
152
155
  });
153
156
  });
@@ -306,5 +309,40 @@ describe('data test', () => {
306
309
  expect(result).toEqual(expectedResult);
307
310
  });
308
311
 
312
+ test('should set library if any', async () => {
313
+ axios.post.mockResolvedValueOnce(axios.post.mockResolvedValueOnce({
314
+ data: [
315
+ {
316
+ 'SYS$CLI_SCRIPT.SCRIPT': 'get = function () {\n' +
317
+ ' return {\n' +
318
+ ' functions: {\n' +
319
+ ' yyy: function (data) {\n' +
320
+ ' function doit() {\n' +
321
+ ' return {\n' +
322
+ " abc: function () { return 'abc'; console.log('abc') },\n" +
323
+ ' }\n' +
324
+ ' }\n' +
325
+ ' return doit()\n' +
326
+ ' },\n' +
327
+ ' zzz: function () {\n' +
328
+ " return 'aaabbbccc';\n" +
329
+ ' }\n' +
330
+ ' }\n' +
331
+ ' }\n' +
332
+ '}'
333
+ }
334
+ ]
335
+ }))
336
+
337
+ const config = {};
338
+ const libraries = ['lib'];
339
+
340
+ const result = await setLibrary(config, libraries);
341
+
342
+ expect(result.lib.yyy().abc()).toStrictEqual('abc');
343
+ expect(result.lib.zzz()).toStrictEqual('aaabbbccc');
344
+ });
345
+
346
+
309
347
  })
310
348
 
@@ -0,0 +1 @@
1
+ get = function () {return {modelA: {}}}
@@ -0,0 +1,2 @@
1
+ const get = function () {
2
+ return {"modelB": {id: null}}};
@@ -0,0 +1,4 @@
1
+ let get = function () {return {modelC: {}, function: {func: () => {
2
+ return ["lib"];
3
+ }
4
+ }}};
@@ -0,0 +1,2 @@
1
+ var get = function () {return {model: {}, tableName: "", fields: [], function: {}}};
2
+ module.exports = get;
@@ -0,0 +1,49 @@
1
+ [
2
+ {"menuName": "", "caption": "Home", "link": ["./main"],"subMenu": []},
3
+ {"menuName": "", "caption": "Personalia","link": [], "subMenu": [
4
+ {"menuName": "","caption": "Data Master","link": [], "subMenu": []},
5
+ {
6
+ "menuName": "",
7
+ "caption": "Gaji",
8
+ "link": [],
9
+ "subMenu": [
10
+ {
11
+ "menuName": "",
12
+ "caption": "Parameter",
13
+ "link": [
14
+ "./form",
15
+ "gajiparam",
16
+ null
17
+ ],
18
+ "subMenu": []
19
+ },
20
+ {
21
+ "menuName": "",
22
+ "caption": "Perubahan",
23
+ "link": [],
24
+ "subMenu": [
25
+ {
26
+ "menuName": "",
27
+ "caption": "Form Perubahan Gaji",
28
+ "link": [
29
+ "./form",
30
+ "gajiubah",
31
+ null
32
+ ],
33
+ "subMenu": []
34
+ },
35
+ {
36
+ "menuName": "",
37
+ "caption": "Daftar Perubahan Gaji",
38
+ "link": [
39
+ "./list",
40
+ "gajiubahdaftar"
41
+ ],
42
+ "subMenu": []
43
+ }
44
+ ]
45
+ }
46
+ ]
47
+ }
48
+ ]}
49
+ ]