zklib-ts 1.0.0-development → 1.0.2-development
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/README.md +16 -8
- package/dist/helper/command.d.ts +101 -99
- package/dist/index.cjs.js +211 -167
- package/dist/index.d.ts +2 -1
- package/dist/index.es.js +211 -167
- package/dist/models/Attendance.d.ts +1 -2
- package/dist/ztcp.d.ts +17 -6
- package/package.json +1 -1
- package/dist/helper/models/Attendance.d.ts +0 -12
- package/dist/helper/models/Finger.d.ts +0 -35
- package/dist/helper/models/User.d.ts +0 -26
package/README.md
CHANGED
|
@@ -6,22 +6,28 @@
|
|
|
6
6
|
<img src="https://img.shields.io/badge/Jest-latest-red?style=flat-square"/>
|
|
7
7
|
<img src="https://img.shields.io/badge/npm-red?style=flat-square"/>
|
|
8
8
|
</p>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
This repository is currently in development and may contain bugs or incomplete features. Use at your own risk and do not deploy to a production environment
|
|
13
|
-
</p>
|
|
9
|
+
|
|
10
|
+
> [!WARNING]
|
|
11
|
+
> This repository is currently in development and may contain bugs or incomplete features. Use at your own risk and do not deploy to a production environment
|
|
14
12
|
|
|
15
13
|
## 📋 **Index**
|
|
14
|
+
1. [Installation](#-installation)
|
|
16
15
|
1. [⚙️ Usage](#-usage)
|
|
17
16
|
2. [🛠️ Testing](#-testing)
|
|
18
17
|
3. [🗄️Alternatives](#-alternatives)
|
|
19
18
|
4. [📄 Documentation](#-documentation)
|
|
20
19
|
|
|
20
|
+
|
|
21
|
+
## **Installation**
|
|
22
|
+
You must have Node.js ^18 before run the command down below:
|
|
23
|
+
```js
|
|
24
|
+
npm i zklib-ts
|
|
25
|
+
```
|
|
26
|
+
|
|
21
27
|
## 🛠️ **Usage**
|
|
22
28
|
create a connection. <b>constructor</b> receives `(ip, timeout, inport, port, comm_key) `
|
|
23
29
|
```js
|
|
24
|
-
import Zklib from 'zklib'
|
|
30
|
+
import Zklib from 'zklib-ts'
|
|
25
31
|
|
|
26
32
|
const zkInstance = new Zklib("10.0.0.10",10000,10000,4370,0)
|
|
27
33
|
|
|
@@ -63,8 +69,10 @@ await zkInstance.deleteTemplate(50,5)
|
|
|
63
69
|
|
|
64
70
|
## 🛠️ **Testing**
|
|
65
71
|
|
|
66
|
-
The repo uses Jest. There is a mock file for test without having a phisical device connected.
|
|
67
|
-
|
|
72
|
+
The repo uses Jest. There is a mock file for test without having a phisical device connected. Before start you will need to install dependencies.
|
|
73
|
+
```js
|
|
74
|
+
npm i
|
|
75
|
+
```
|
|
68
76
|
for testing your phisical device first create .env file in root directory with the values down below:
|
|
69
77
|
```
|
|
70
78
|
DEVICE_IP=10.10.10.1
|
package/dist/helper/command.d.ts
CHANGED
|
@@ -1,104 +1,106 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
1
|
+
export declare enum COMMANDS {
|
|
2
|
+
CMD_ACK_DATA = 2002,
|
|
3
|
+
CMD_ACK_ERROR = 2001,//There was an error when processing the request.
|
|
4
|
+
CMD_ACK_ERROR_CMD = 65533,
|
|
5
|
+
CMD_ACK_ERROR_DATA = 65531,
|
|
6
|
+
CMD_ACK_ERROR_INIT = 65532,
|
|
7
|
+
CMD_ACK_OK = 2000,//The request was processed sucessfully.
|
|
8
|
+
CMD_ACK_REPEAT = 2004,
|
|
9
|
+
CMD_ACK_RETRY = 2003,
|
|
10
|
+
CMD_ACK_UNAUTH = 2005,//Connection not authorized.
|
|
11
|
+
CMD_ACK_UNKNOWN = 65535,//Received unknown command.
|
|
12
|
+
CMD_ATTLOG_RRQ = 13,//Request attendance log.
|
|
13
|
+
CMD_AUTH = 1102,//Request to begin session using commkey.
|
|
14
|
+
CMD_CANCELCAPTURE = 62,//Disable normal authentication of users.
|
|
15
|
+
CMD_CAPTUREFINGER = 1009,//Capture fingerprint picture.
|
|
16
|
+
CMD_CAPTUREIMAGE = 1012,//Capture the entire image.
|
|
17
|
+
CMD_CHANGE_SPEED = 1101,//Change transmission speed.
|
|
18
|
+
CMD_CHECKSUM_BUFFER = 119,//Get checksum of machine's buffer.
|
|
19
|
+
CMD_CLEAR_ACC = 32,//Restore access control to default.
|
|
20
|
+
CMD_CLEAR_ADMIN = 20,//Clears admins privileges.
|
|
21
|
+
CMD_CLEAR_ATTLOG = 15,//Delete attendance record.
|
|
22
|
+
CMD_CLEAR_DATA = 14,//Delete data.
|
|
23
|
+
CMD_CLEAR_LCD = 67,//Clear screen captions.
|
|
24
|
+
CMD_CLEAR_OPLOG = 33,//Delete operations log.
|
|
25
|
+
CMD_CONNECT = 1000,//Begin connection.
|
|
26
|
+
CMD_DATA = 1501,//Data packet.
|
|
27
|
+
CMD_DATA_RDY = 1504,//Indicates that it is ready to receive data.
|
|
28
|
+
CMD_DATA_WRRQ = 1503,//Read/Write a large data set.
|
|
29
|
+
CMD_DB_RRQ = 7,//Read saved data.
|
|
30
|
+
CMD_DEL_FPTMP = 134,//Deletes fingerprint template.
|
|
31
|
+
CMD_DELETE_SMS = 72,//Delete short message.
|
|
32
|
+
CMD_DELETE_UDATA = 74,//Delete user short message.
|
|
33
|
+
CMD_DELETE_USER = 18,//Delete user.
|
|
34
|
+
CMD_DELETE_USERTEMP = 19,//Delete user fingerprint template.
|
|
35
|
+
CMD_DISABLEDEVICE = 1003,//Disables fingerprint, rfid reader and keyboard.
|
|
36
|
+
CMD_DOORSTATE_RRQ = 75,//Get door state.
|
|
37
|
+
CMD_EMPTY_MIFARE = 78,//Clear Mifare card.
|
|
38
|
+
CMD_ENABLE_CLOCK = 57,//Enables the ":" in screen clock.
|
|
39
|
+
CMD_ENABLEDEVICE = 1002,//Change machine state to "normal work".
|
|
40
|
+
CMD_EXIT = 1001,//Disconnect.
|
|
41
|
+
CMD_FREE_DATA = 1502,//Release buffer used for data transmission.
|
|
42
|
+
CMD_GET_FREE_SIZES = 50,//Request machine status (remaining space).
|
|
43
|
+
CMD_GET_PINWIDTH = 69,//Request max size for users id.
|
|
44
|
+
CMD_GET_TIME = 201,//Request machine time.
|
|
45
|
+
CMD_GET_USERTEMP = 88,
|
|
46
|
+
CMD_GET_VERSION = 1100,//Request the firmware edition.
|
|
47
|
+
CMD_GRPTZ_RRQ = 25,//Get group timezone.
|
|
48
|
+
CMD_GRPTZ_WRQ = 26,//Set group timezone.
|
|
49
|
+
CMD_OPLOG_RRQ = 34,//Read operations log.
|
|
50
|
+
CMD_OPTIONS_RRQ = 11,//Read configuration value of the machine.
|
|
51
|
+
CMD_OPTIONS_WRQ = 12,//Change configuration value of the machine.
|
|
52
|
+
CMD_POWEROFF = 1005,//Shut-down machine.
|
|
53
|
+
CMD_PREPARE_DATA = 1500,//Prepare for data transmission.
|
|
54
|
+
CMD_REFRESHDATA = 1013,//Refresh the machine stored data.
|
|
55
|
+
CMD_REFRESHOPTION = 1014,//Refresh the configuration parameters.
|
|
56
|
+
CMD_REG_EVENT = 500,//Realtime events.
|
|
57
|
+
CMD_RESTART = 1004,//Restart machine.
|
|
58
|
+
CMD_RESUME = 1007,//Change machine state to "awaken".
|
|
59
|
+
CMD_SET_TIME = 202,//Set machine time.
|
|
60
|
+
CMD_SLEEP = 1006,//Change machine state to "idle".
|
|
61
|
+
CMD_SMS_RRQ = 71,//Download short message.
|
|
62
|
+
CMD_SMS_WRQ = 70,//Upload short message.
|
|
63
|
+
CMD_STARTENROLL = 61,//Start enroll procedure.
|
|
64
|
+
CMD_STARTVERIFY = 60,//Set the machine to authentication state.
|
|
65
|
+
CMD_STATE_RRQ = 64,//Query state.
|
|
66
|
+
CMD_TEST_TEMP = 1011,//Test if fingerprint exists.
|
|
67
|
+
CMD_TESTVOICE = 1017,//Test voice.
|
|
68
|
+
CMD_TMP_WRITE = 87,//Transfer fp template from buffer.
|
|
69
|
+
CMD_TZ_RRQ = 27,//Get device timezones.
|
|
70
|
+
CMD_TZ_WRQ = 28,//Set device timezones.
|
|
71
|
+
CMD_UDATA_WRQ = 73,//Set user short message.
|
|
72
|
+
CMD_ULG_RRQ = 29,//Get group combination to unlock.
|
|
73
|
+
CMD_ULG_WRQ = 30,//Set group combination to unlock.
|
|
74
|
+
CMD_UNLOCK = 31,//Unlock door for a specified amount of time.
|
|
75
|
+
CMD_USER_WRQ = 8,//Upload user data.
|
|
76
|
+
CMD_USERGRP_RRQ = 21,//Read user group.
|
|
77
|
+
CMD_USERGRP_WRQ = 22,//Set user group.
|
|
78
|
+
CMD_USERTEMP_RRQ = 9,//Read user fingerprint template.
|
|
79
|
+
CMD_USERTEMP_WRQ = 10,//Upload user fingerprint template.
|
|
80
|
+
CMD_USERTZ_RRQ = 23,//Get user timezones.
|
|
81
|
+
CMD_USERTZ_WRQ = 24,//Set the user timezones.
|
|
82
|
+
CMD_VERIFY_RRQ = 80,//Read verification style of a given user.
|
|
83
|
+
CMD_VERIFY_WRQ = 79,//Change verification style of a given user.
|
|
84
|
+
CMD_WRITE_LCD = 66,//Prints chars to the device screen.
|
|
85
|
+
CMD_WRITE_MIFARE = 76,//Write data to Mifare card.
|
|
86
|
+
EF_ALARM = 512,//Triggered alarm.
|
|
87
|
+
EF_ATTLOG = 1,//Attendance entry.
|
|
88
|
+
EF_BUTTON = 16,//Pressed keyboard key.
|
|
89
|
+
EF_ENROLLFINGER = 8,//Upload user data.
|
|
90
|
+
EF_ENROLLUSER = 4,//Enrolled user.
|
|
91
|
+
EF_FINGER = 2,//Pressed finger.
|
|
92
|
+
EF_FPFTR = 256,//Fingerprint score in enroll procedure.
|
|
93
|
+
EF_UNLOCK = 32,//Restore access control to default.
|
|
94
|
+
EF_VERIFY = 128
|
|
95
|
+
}
|
|
96
96
|
export type CommandKeys = keyof typeof COMMANDS;
|
|
97
97
|
export type CommandValues = typeof COMMANDS[CommandKeys];
|
|
98
|
-
export declare
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
export declare enum Constants {
|
|
99
|
+
USHRT_MAX = 65535,
|
|
100
|
+
MAX_CHUNK = 65472,
|
|
101
|
+
MACHINE_PREPARE_DATA_1 = 20560,
|
|
102
|
+
MACHINE_PREPARE_DATA_2 = 32130
|
|
103
|
+
}
|
|
102
104
|
interface RequestData {
|
|
103
105
|
DISABLE_DEVICE: Buffer;
|
|
104
106
|
GET_REAL_TIME_EVENT: Buffer;
|