aba-pos-sdk-node 1.0.2 → 1.0.3

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.
@@ -9,4 +9,4 @@
9
9
  * Copyright (C) 2025 ABA Bank (Advanced Bank of Asia Ltd).
10
10
  * All copyrights of the code are owned or licensed by ABA Bank.
11
11
  */
12
- const r=require("path"),t=process.platform,a=process.arch;if("darwin"!==t&&"win32"!==t&&"linux"!==t)throw new AbaPosSdkError(e,`Unsupported platform: ${t}`);const s=r.resolve(__dirname,"addons",t,a,"aba_pos_sdk_node_addon"),o=require(s),e=-101;class AbaPosSdk{constructor(){throw new AbaPosSdkError(e,"AbaPosSdk is a static class and cannot be instantiated.")}static async initUsbConnection(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"initUsbConnection() error. 'key' must be a string.");0!==await o.initUsbConnection(r)&&await AbaPosSdk.t()}static async sendDataByUsb(r,t){if("string"!=typeof r)throw new AbaPosSdkError(e,"sendDataByUsb() error. 'data' must be a string.");if(!Number.isInteger(t))throw new AbaPosSdkError(e,"sendDataByUsb() error. 'timeout' must be an integer.");0!==await o.sendDataByUsb(r,t)&&await AbaPosSdk.t()}static async releaseUsbConnection(){await o.releaseUsbConnection()}static async initIpConnection(r,t){if("string"!=typeof r)throw new AbaPosSdkError(e,"initIpConnection() error. 'ipAddress' must be a string.");if("string"!=typeof t)throw new AbaPosSdkError(e,"initIpConnection() error. 'key' must be a string.");0!==await o.initIpConnection(r,t)&&await AbaPosSdk.t()}static async updateIpAddress(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"updateIpAddress() error. 'newIpAddress' must be a string.");0!==await o.updateIpAddress(r)&&await AbaPosSdk.t()}static async sendDataByIp(r,t){if("string"!=typeof r)throw new AbaPosSdkError(e,"sendDataByIp() error. 'data' must be a string.");if(!Number.isInteger(t))throw new AbaPosSdkError(e,"sendDataByIp() error. 'timeout' must be an integer.");0!==await o.sendDataByIp(r,t)&&await AbaPosSdk.t()}static async releaseIpConnection(){await o.releaseIpConnection()}static async cancelWaitingPosTerminal(){0!==await o.cancelWaitingPosTerminal()&&await AbaPosSdk.t()}static waitForResponse(){return new Promise(((r,t)=>{o.waitForResponseAsync((async(a,s)=>{a?t(a):0==await AbaPosSdk.getErrorCode()?r(s):t(await AbaPosSdk.o())}))}))}static async getErrorMessage(){return await o.getErrorMessage()}static async getErrorCode(){return await o.getErrorCode()}static async setLogDirectoryPath(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"setLogDirectoryPath() error. 'absolutePath' must be a string.");0!==await o.setLogDirectoryPath(r)&&await AbaPosSdk.t()}static async removeLogDirectoryPath(){0!==await o.removeLogDirectoryPath()&&await AbaPosSdk.t()}static async updateKey(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"updateKey() error. 'newKey' must be a string.");0!==await o.updateKey(r)&&await AbaPosSdk.t()}static generateTimestamp(){const r=new Date;return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")} ${String(r.getHours()).padStart(2,"0")}:${String(r.getMinutes()).padStart(2,"0")}:${String(r.getSeconds()).padStart(2,"0")}`}static async t(){throw new AbaPosSdkError(await AbaPosSdk.getErrorCode(),await AbaPosSdk.getErrorMessage())}static async o(){return new AbaPosSdkError(await AbaPosSdk.getErrorCode(),await AbaPosSdk.getErrorMessage())}}class AbaPosSdkError extends Error{constructor(r,t){if(super(t),!Number.isInteger(r))throw new AbaPosSdkError(e,"'errorCode' must be an integer.");if("string"!=typeof t)throw new AbaPosSdkError(e,"'errorMessage' must be a string.");this.name="AbaPosSdkError",this.errorCode=r,this.errorMessage=t,Error.captureStackTrace&&Error.captureStackTrace(this,AbaPosSdkError)}toString(){return`AbaPosSdkError: ${this.errorMessage} (Error Code: ${this.errorCode})`}}module.exports={AbaPosSdk:AbaPosSdk,AbaPosSdkError:AbaPosSdkError};
12
+ const r=require("path"),t=process.platform,a=process.arch;if("darwin"!==t&&"win32"!==t&&"linux"!==t)throw new AbaPosSdkError(e,`Unsupported platform: ${t}`);const s=r.resolve(__dirname,"addons",t,a,"aba_pos_sdk_node_addon"),o=require(s),e=-101;class AbaPosSdk{constructor(){throw new AbaPosSdkError(e,"AbaPosSdk is a static class and cannot be instantiated.")}static async initUsbConnection(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"initUsbConnection() error. 'key' must be a string.");0!==await o.initUsbConnection(r)&&await AbaPosSdk.t()}static async sendDataByUsb(r,t){if("string"!=typeof r)throw new AbaPosSdkError(e,"sendDataByUsb() error. 'data' must be a string.");if(!Number.isInteger(t))throw new AbaPosSdkError(e,"sendDataByUsb() error. 'timeout' must be an integer.");0!==await o.sendDataByUsb(r,t)&&await AbaPosSdk.t()}static async releaseUsbConnection(){await o.releaseUsbConnection()}static async initIpConnection(r,t){if("string"!=typeof r)throw new AbaPosSdkError(e,"initIpConnection() error. 'ipAddress' must be a string.");if("string"!=typeof t)throw new AbaPosSdkError(e,"initIpConnection() error. 'key' must be a string.");0!==await o.initIpConnection(r,t)&&await AbaPosSdk.t()}static async updateIpAddress(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"updateIpAddress() error. 'newIpAddress' must be a string.");0!==await o.updateIpAddress(r)&&await AbaPosSdk.t()}static async sendDataByIp(r,t){if("string"!=typeof r)throw new AbaPosSdkError(e,"sendDataByIp() error. 'data' must be a string.");if(!Number.isInteger(t))throw new AbaPosSdkError(e,"sendDataByIp() error. 'timeout' must be an integer.");0!==await o.sendDataByIp(r,t)&&await AbaPosSdk.t()}static async releaseIpConnection(){await o.releaseIpConnection()}static async cancelWaitingPosTerminal(){0!==await o.cancelWaitingPosTerminal()&&await AbaPosSdk.t()}static waitForResponse(){return new Promise((r,t)=>{o.waitForResponseAsync(async(a,s)=>{a?t(a):0==await AbaPosSdk.getErrorCode()?r(s):t(await AbaPosSdk.o())})})}static async getErrorMessage(){return await o.getErrorMessage()}static async getErrorCode(){return await o.getErrorCode()}static async setLogDirectoryPath(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"setLogDirectoryPath() error. 'absolutePath' must be a string.");0!==await o.setLogDirectoryPath(r)&&await AbaPosSdk.t()}static async removeLogDirectoryPath(){0!==await o.removeLogDirectoryPath()&&await AbaPosSdk.t()}static async updateKey(r){if("string"!=typeof r)throw new AbaPosSdkError(e,"updateKey() error. 'newKey' must be a string.");0!==await o.updateKey(r)&&await AbaPosSdk.t()}static generateTimestamp(){const r=new Date;return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")} ${String(r.getHours()).padStart(2,"0")}:${String(r.getMinutes()).padStart(2,"0")}:${String(r.getSeconds()).padStart(2,"0")}`}static async t(){throw new AbaPosSdkError(await AbaPosSdk.getErrorCode(),await AbaPosSdk.getErrorMessage())}static async o(){return new AbaPosSdkError(await AbaPosSdk.getErrorCode(),await AbaPosSdk.getErrorMessage())}}class AbaPosSdkError extends Error{constructor(r,t){if(super(t),!Number.isInteger(r))throw new AbaPosSdkError(e,"'errorCode' must be an integer.");if("string"!=typeof t)throw new AbaPosSdkError(e,"'errorMessage' must be a string.");this.name="AbaPosSdkError",this.errorCode=r,this.errorMessage=t,Error.captureStackTrace&&Error.captureStackTrace(this,AbaPosSdkError)}toString(){return`AbaPosSdkError: ${this.errorMessage} (Error Code: ${this.errorCode})`}}module.exports={AbaPosSdk:AbaPosSdk,AbaPosSdkError:AbaPosSdkError};
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aba-pos-sdk-node",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Node.js Addons for ABA POS SDK developed by ABA Bank. This package allows you to connect with the ABA POS terminal.",
5
5
  "main": "aba_pos_sdk.min.js",
6
6
  "type": "commonjs",