@vendit-dev/thirdparty-adapters 0.4.0 → 0.4.1-beta.2

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.
@@ -1,148 +1,148 @@
1
- import { UserServiceGrpcCaller } from '@vendit-dev/utility-modules';
2
- import MutexLock from '../utils/mutex';
3
- declare type VenditThemrIoTAuthInfo = {
4
- scope: string;
5
- credential: {
6
- hotel_id: string;
7
- user_id: string;
8
- accessToken: string;
9
- refreshToken: string;
10
- expiresAt: number;
11
- };
12
- };
13
- declare type DoorlockListResponse = {
14
- code: number;
15
- message: string;
16
- count?: number;
17
- list?: {
18
- roomNm: string;
19
- roomAlias: string;
20
- lockMac: string;
21
- buildingNo: number;
22
- floorNo: number;
23
- lockId: number;
24
- batteryState: number;
25
- gatewayState: number;
26
- }[];
27
- };
28
- declare type DoorlockDetailResponse = [{
29
- code: number;
30
- message: string;
31
- }, {
32
- date: number;
33
- lockAlias: string;
34
- lockSound: number;
35
- modelNum: string;
36
- lockMac: string;
37
- privacyLock: number;
38
- deletePwd: string;
39
- featureValue: string;
40
- adminPwd: string;
41
- soundVolume: number;
42
- hasGateway: number;
43
- autoLockTime: number;
44
- wirelessKeypadFeatureValue: string;
45
- floorNumber: number;
46
- buildingNumber: number;
47
- lockKey: string;
48
- isFrozen: number;
49
- lockName: string;
50
- sector: string;
51
- resetButton: number;
52
- firmwareRevision: string;
53
- tamperAlert: number;
54
- specialValue: number;
55
- displayPasscode: number;
56
- noKeyPwd: string;
57
- passageMode: number;
58
- passageModeAutoUnlock: number;
59
- timezoneRawOffset: number;
60
- lockId: number;
61
- electricQuantity: number;
62
- lockFlagPos: number;
63
- lockUpdateDate: number;
64
- keyboardPwdVersion: number;
65
- aesKeyStr: string;
66
- hardwareRevision: string;
67
- openDirection: number;
68
- lockVersion: {
69
- groupId: number;
70
- protocolVersion: number;
71
- protocolType: number;
72
- orgId: number;
73
- scene: number;
74
- };
75
- sensitivity: number;
76
- }];
77
- declare type GetOTPPassCodeResponse = {
78
- code: number;
79
- message: string;
80
- passcode: string;
81
- passcodeId: number;
82
- };
83
- declare type writeAsyncRFCardRes = {
84
- code: string;
85
- issue_cd: string;
86
- message: string;
87
- data: string;
88
- cardnum: string;
89
- client_id: string;
90
- call_api: string;
91
- call_id: string;
92
- method: string | 'rfcardwrite';
93
- hotel_id: string;
94
- };
95
- export default class ThemrIoTAdapter {
96
- API_HOST: string;
97
- mutexLock: MutexLock;
98
- authenticator: UserServiceGrpcCaller;
99
- redis: any;
100
- timeFormat: string;
101
- PROVIDER_KEY: string;
102
- constructor({ authenticator, redis, apiHost, }: {
103
- authenticator: UserServiceGrpcCaller;
104
- redis: any;
105
- apiHost: string;
106
- });
107
- callTheMRApi: ({ route, params, }: {
108
- route: string;
109
- params: Record<string, any>;
110
- }) => Promise<any>;
111
- static indexAccommodation: ({ accommodationId, }: {
112
- accommodationId: string;
113
- }) => string;
114
- parseJSONSafe: (str: string) => any | boolean;
115
- checkTheMRIoTIntegration: ({ accommodationId, }: {
116
- accommodationId: string;
117
- }) => Promise<boolean>;
118
- getAccommodationAuthInfo: ({ accommodationId, }: {
119
- accommodationId: string;
120
- }) => Promise<VenditThemrIoTAuthInfo | boolean>;
121
- getDefaultCheckInDate: () => string;
122
- getDefaultCheckOutDate: () => string;
123
- getAccommodationAccessToken: (accommodationId: string) => Promise<string>;
124
- doorlockList: ({ accommodationId, roomAlias, }: {
125
- accommodationId: string;
126
- roomAlias?: string | undefined;
127
- }) => Promise<DoorlockListResponse>;
128
- doorlockDetail: ({ accommodationId, lockId, }: {
129
- accommodationId: string;
130
- lockId: string;
131
- }) => Promise<DoorlockDetailResponse>;
132
- getOTPPassCode: ({ accommodationId, lockId, checkinDate, checkoutDate, }: {
133
- accommodationId: string;
134
- lockId: string;
135
- checkinDate?: string | undefined;
136
- checkoutDate?: string | undefined;
137
- }) => Promise<GetOTPPassCodeResponse>;
138
- writeAsyncRFCard: ({ accommodationId, checkinDate, checkoutDate, build_no, floor_no, lock_mac, agent_id, }: {
139
- accommodationId: string;
140
- checkinDate?: string | undefined;
141
- checkoutDate?: string | undefined;
142
- build_no?: string | undefined;
143
- floor_no?: string | undefined;
144
- lock_mac: string;
145
- agent_id: string;
146
- }) => Promise<writeAsyncRFCardRes>;
147
- }
148
- export {};
1
+ import { UserServiceGrpcCaller } from '@vendit-dev/utility-modules';
2
+ import MutexLock from '../utils/mutex';
3
+ declare type VenditThemrIoTAuthInfo = {
4
+ scope: string;
5
+ credential: {
6
+ hotel_id: string;
7
+ user_id: string;
8
+ accessToken: string;
9
+ refreshToken: string;
10
+ expiresAt: number;
11
+ };
12
+ };
13
+ declare type DoorlockListResponse = {
14
+ code: number;
15
+ message: string;
16
+ count?: number;
17
+ list?: {
18
+ roomNm: string;
19
+ roomAlias: string;
20
+ lockMac: string;
21
+ buildingNo: number;
22
+ floorNo: number;
23
+ lockId: number;
24
+ batteryState: number;
25
+ gatewayState: number;
26
+ }[];
27
+ };
28
+ declare type DoorlockDetailResponse = [{
29
+ code: number;
30
+ message: string;
31
+ }, {
32
+ date: number;
33
+ lockAlias: string;
34
+ lockSound: number;
35
+ modelNum: string;
36
+ lockMac: string;
37
+ privacyLock: number;
38
+ deletePwd: string;
39
+ featureValue: string;
40
+ adminPwd: string;
41
+ soundVolume: number;
42
+ hasGateway: number;
43
+ autoLockTime: number;
44
+ wirelessKeypadFeatureValue: string;
45
+ floorNumber: number;
46
+ buildingNumber: number;
47
+ lockKey: string;
48
+ isFrozen: number;
49
+ lockName: string;
50
+ sector: string;
51
+ resetButton: number;
52
+ firmwareRevision: string;
53
+ tamperAlert: number;
54
+ specialValue: number;
55
+ displayPasscode: number;
56
+ noKeyPwd: string;
57
+ passageMode: number;
58
+ passageModeAutoUnlock: number;
59
+ timezoneRawOffset: number;
60
+ lockId: number;
61
+ electricQuantity: number;
62
+ lockFlagPos: number;
63
+ lockUpdateDate: number;
64
+ keyboardPwdVersion: number;
65
+ aesKeyStr: string;
66
+ hardwareRevision: string;
67
+ openDirection: number;
68
+ lockVersion: {
69
+ groupId: number;
70
+ protocolVersion: number;
71
+ protocolType: number;
72
+ orgId: number;
73
+ scene: number;
74
+ };
75
+ sensitivity: number;
76
+ }];
77
+ declare type GetOTPPassCodeResponse = {
78
+ code: number;
79
+ message: string;
80
+ passcode: string;
81
+ passcodeId: number;
82
+ };
83
+ declare type writeAsyncRFCardRes = {
84
+ code: string;
85
+ issue_cd: string;
86
+ message: string;
87
+ data: string;
88
+ cardnum: string;
89
+ client_id: string;
90
+ call_api: string;
91
+ call_id: string;
92
+ method: string | 'rfcardwrite';
93
+ hotel_id: string;
94
+ };
95
+ export default class ThemrIoTAdapter {
96
+ API_HOST: string;
97
+ mutexLock: MutexLock;
98
+ authenticator: UserServiceGrpcCaller;
99
+ redis: any;
100
+ timeFormat: string;
101
+ PROVIDER_KEY: string;
102
+ constructor({ authenticator, redis, apiHost, }: {
103
+ authenticator: UserServiceGrpcCaller;
104
+ redis: any;
105
+ apiHost: string;
106
+ });
107
+ callTheMRApi: ({ route, params, }: {
108
+ route: string;
109
+ params: Record<string, any>;
110
+ }) => Promise<any>;
111
+ static indexAccommodation: ({ accommodationId, }: {
112
+ accommodationId: string;
113
+ }) => string;
114
+ parseJSONSafe: (str: string) => any | boolean;
115
+ checkTheMRIoTIntegration: ({ accommodationId, }: {
116
+ accommodationId: string;
117
+ }) => Promise<boolean>;
118
+ getAccommodationAuthInfo: ({ accommodationId, }: {
119
+ accommodationId: string;
120
+ }) => Promise<VenditThemrIoTAuthInfo | boolean>;
121
+ getDefaultCheckInDate: () => string;
122
+ getDefaultCheckOutDate: () => string;
123
+ getAccommodationAccessToken: (accommodationId: string) => Promise<string>;
124
+ doorlockList: ({ accommodationId, roomAlias, }: {
125
+ accommodationId: string;
126
+ roomAlias?: string | undefined;
127
+ }) => Promise<DoorlockListResponse>;
128
+ doorlockDetail: ({ accommodationId, lockId, }: {
129
+ accommodationId: string;
130
+ lockId: string;
131
+ }) => Promise<DoorlockDetailResponse>;
132
+ getOTPPassCode: ({ accommodationId, lockId, checkinDate, checkoutDate, }: {
133
+ accommodationId: string;
134
+ lockId: string;
135
+ checkinDate?: string | undefined;
136
+ checkoutDate?: string | undefined;
137
+ }) => Promise<GetOTPPassCodeResponse>;
138
+ writeAsyncRFCard: ({ accommodationId, checkinDate, checkoutDate, build_no, floor_no, lock_mac, agent_id, }: {
139
+ accommodationId: string;
140
+ checkinDate?: string | undefined;
141
+ checkoutDate?: string | undefined;
142
+ build_no?: string | undefined;
143
+ floor_no?: string | undefined;
144
+ lock_mac: string;
145
+ agent_id: string;
146
+ }) => Promise<writeAsyncRFCardRes>;
147
+ }
148
+ export {};