@vendit-dev/thirdparty-adapters 0.3.31 → 0.4.0-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.
- package/lib/adapters/amanoKorea.d.ts +75 -0
- package/lib/adapters/amanoKorea.js +292 -0
- package/lib/adapters/sanhaWings.d.ts +179 -179
- package/lib/adapters/sanhaWings.js +841 -841
- package/lib/adapters/smartAccess.d.ts +90 -103
- package/lib/adapters/smartAccess.js +465 -494
- package/lib/adapters/themrIoT.d.ts +148 -148
- package/lib/adapters/themrIoT.js +301 -305
- package/lib/index.d.ts +5 -4
- package/lib/index.js +14 -12
- package/lib/types/amanoKorea.d.ts +124 -0
- package/lib/types/amanoKorea.js +2 -0
- package/lib/utils/mutex.d.ts +14 -14
- package/lib/utils/mutex.js +93 -89
- package/package.json +43 -42
- package/readme.md +4 -4
|
@@ -1,103 +1,90 @@
|
|
|
1
|
-
import { UserServiceGrpcCaller } from '@vendit-dev/utility-modules';
|
|
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
|
-
accommodationId: string;
|
|
92
|
-
roomId: string;
|
|
93
|
-
keyId: string;
|
|
94
|
-
}) => Promise<any>;
|
|
95
|
-
getAccommodationCallbacks: ({ accommodationId }: {
|
|
96
|
-
accommodationId: string;
|
|
97
|
-
}) => Promise<boolean>;
|
|
98
|
-
getRoomByThirdPartyId: ({ accommodationId, thirdPartyId }: {
|
|
99
|
-
accommodationId: string;
|
|
100
|
-
thirdPartyId: string;
|
|
101
|
-
}) => Promise<any>;
|
|
102
|
-
}
|
|
103
|
-
export {};
|
|
1
|
+
import { UserServiceGrpcCaller } from '@vendit-dev/utility-modules';
|
|
2
|
+
import MutexLock from '../utils/mutex';
|
|
3
|
+
declare type OAuthTokenResponse = {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
refreshToken: string;
|
|
6
|
+
tokenType: string;
|
|
7
|
+
expiresIn: number;
|
|
8
|
+
};
|
|
9
|
+
declare type OAuthRawTokenSet = {
|
|
10
|
+
refresh_token: string;
|
|
11
|
+
access_token: string;
|
|
12
|
+
expires_in: number;
|
|
13
|
+
token_type: string;
|
|
14
|
+
};
|
|
15
|
+
declare type SmartAccessRoom = {
|
|
16
|
+
roomId: string;
|
|
17
|
+
roomNumber: string;
|
|
18
|
+
path: string;
|
|
19
|
+
};
|
|
20
|
+
export default class SmartAccessAdapter {
|
|
21
|
+
static indexAccommodation: ({ accommodationId, }: {
|
|
22
|
+
accommodationId: string;
|
|
23
|
+
}) => string;
|
|
24
|
+
static refineRawTokenSet: (rawTokenSet: OAuthRawTokenSet) => OAuthTokenResponse;
|
|
25
|
+
mutexLock: MutexLock;
|
|
26
|
+
authenticator: UserServiceGrpcCaller;
|
|
27
|
+
redis: any;
|
|
28
|
+
PROVIDER_KEY: string;
|
|
29
|
+
API_HOST: string;
|
|
30
|
+
constructor({ authenticator, redis, apiHost, }: {
|
|
31
|
+
authenticator: UserServiceGrpcCaller;
|
|
32
|
+
redis: any;
|
|
33
|
+
apiHost: string;
|
|
34
|
+
});
|
|
35
|
+
parseJSONSafe: (str: string) => any | boolean;
|
|
36
|
+
checkSmartAccessIntegration: ({ accommodationId, }: {
|
|
37
|
+
accommodationId: string;
|
|
38
|
+
}) => Promise<boolean>;
|
|
39
|
+
getAccommodationAuthInfo: ({ accommodationId, }: {
|
|
40
|
+
accommodationId: string;
|
|
41
|
+
}) => Promise<OAuthTokenResponse | boolean>;
|
|
42
|
+
getAccommodationAccessToken: (accommodationId: string) => Promise<string>;
|
|
43
|
+
callSmartAccessApi: ({ route, accommodationId, params, method, headers, }: {
|
|
44
|
+
route: string;
|
|
45
|
+
accommodationId: string;
|
|
46
|
+
params?: any;
|
|
47
|
+
method?: string | undefined;
|
|
48
|
+
headers?: any;
|
|
49
|
+
}) => Promise<any>;
|
|
50
|
+
getRoomInfo: ({ accommodationId, roomId, }: {
|
|
51
|
+
accommodationId: string;
|
|
52
|
+
roomId: string;
|
|
53
|
+
}) => Promise<SmartAccessRoom>;
|
|
54
|
+
getRooms: (accommodationId: string) => Promise<SmartAccessRoom[]>;
|
|
55
|
+
getDevices: (accommodationId: string) => Promise<any>;
|
|
56
|
+
getRoomsWithDevices: (accommodationId: string) => Promise<SmartAccessRoom[]>;
|
|
57
|
+
createPinCodeForRoom: ({ roomId, accommodationId, userType, keyType, startDate, endDate, }: {
|
|
58
|
+
roomId: string;
|
|
59
|
+
accommodationId: string;
|
|
60
|
+
userType: 'GUEST' | 'EMPLOYEE';
|
|
61
|
+
keyType: 'SCHEDULE' | 'ONETIME';
|
|
62
|
+
startDate: Date;
|
|
63
|
+
endDate: Date;
|
|
64
|
+
}) => Promise<any>;
|
|
65
|
+
modifyPinCodeByKeyId: ({ keyId, accommodationId, userType, keyType, startDate, endDate, }: {
|
|
66
|
+
keyId: string;
|
|
67
|
+
accommodationId: string;
|
|
68
|
+
userType: 'GUEST' | 'EMPLOYEE';
|
|
69
|
+
keyType: 'SCHEDULE' | 'ONETIME';
|
|
70
|
+
startDate: Date;
|
|
71
|
+
endDate: Date;
|
|
72
|
+
}) => Promise<any>;
|
|
73
|
+
deletePinCodeByKeyId: ({ keyId, accommodationId, }: {
|
|
74
|
+
keyId: string;
|
|
75
|
+
accommodationId: string;
|
|
76
|
+
}) => Promise<any>;
|
|
77
|
+
openLockByRoomId: ({ accommodationId, roomId, keyId, }: {
|
|
78
|
+
accommodationId: string;
|
|
79
|
+
roomId: string;
|
|
80
|
+
keyId: string;
|
|
81
|
+
}) => Promise<any>;
|
|
82
|
+
getAccommodationCallbacks: ({ accommodationId, }: {
|
|
83
|
+
accommodationId: string;
|
|
84
|
+
}) => Promise<boolean>;
|
|
85
|
+
getRoomByThirdPartyId: ({ accommodationId, thirdPartyId, }: {
|
|
86
|
+
accommodationId: string;
|
|
87
|
+
thirdPartyId: string;
|
|
88
|
+
}) => Promise<any>;
|
|
89
|
+
}
|
|
90
|
+
export {};
|