@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.
@@ -1,103 +1,90 @@
1
- import { UserServiceGrpcCaller } from '@vendit-dev/utility-modules';
2
- export declare class MutexLock {
3
- redis: any;
4
- hashPrefix: string;
5
- mutexLockInterval: number;
6
- constructor({ redis, hashPrefix, mutexLockInterval }: {
7
- redis: any;
8
- hashPrefix: string;
9
- mutexLockInterval?: number;
10
- });
11
- getMutexLockKey: (id: string) => string;
12
- tryMutexLock: (streamId: string, lockHash: string) => any;
13
- getMutexLock: (streamId: string) => Promise<string>;
14
- unlockMutexLock: (streamId: string, lockHash: string) => Promise<any>;
15
- }
16
- declare type OAuthTokenResponse = {
17
- accessToken: string;
18
- refreshToken: string;
19
- tokenType: string;
20
- expiresIn: number;
21
- };
22
- declare type OAuthRawTokenSet = {
23
- refresh_token: string;
24
- access_token: string;
25
- expires_in: number;
26
- token_type: string;
27
- };
28
- declare type SmartAccessRoom = {
29
- roomId: string;
30
- roomNumber: string;
31
- path: string;
32
- };
33
- export default class SmartAccessAdapter {
34
- static indexAccommodation: ({ accommodationId }: {
35
- accommodationId: string;
36
- }) => string;
37
- static refineRawTokenSet: (rawTokenSet: OAuthRawTokenSet) => OAuthTokenResponse;
38
- mutexLock: MutexLock;
39
- authenticator: UserServiceGrpcCaller;
40
- redis: any;
41
- PROVIDER_KEY: string;
42
- API_HOST: string;
43
- constructor({ authenticator, redis, apiHost }: {
44
- authenticator: UserServiceGrpcCaller;
45
- redis: any;
46
- apiHost: string;
47
- });
48
- parseJSONSafe: (str: string) => any | boolean;
49
- checkSmartAccessIntegration: ({ accommodationId }: {
50
- accommodationId: string;
51
- }) => Promise<boolean>;
52
- getAccommodationAuthInfo: ({ accommodationId }: {
53
- accommodationId: string;
54
- }) => Promise<OAuthTokenResponse | boolean>;
55
- getAccommodationAccessToken: (accommodationId: string) => Promise<string>;
56
- callSmartAccessApi: ({ route, accommodationId, params, method, headers, }: {
57
- route: string;
58
- accommodationId: string;
59
- params?: any;
60
- method?: string | undefined;
61
- headers?: any;
62
- }) => Promise<any>;
63
- getRoomInfo: ({ accommodationId, roomId }: {
64
- accommodationId: string;
65
- roomId: string;
66
- }) => Promise<SmartAccessRoom>;
67
- getRooms: (accommodationId: string) => Promise<SmartAccessRoom[]>;
68
- getDevices: (accommodationId: string) => Promise<any>;
69
- getRoomsWithDevices: (accommodationId: string) => Promise<SmartAccessRoom[]>;
70
- createPinCodeForRoom: ({ roomId, accommodationId, userType, keyType, startDate, endDate, }: {
71
- roomId: string;
72
- accommodationId: string;
73
- userType: 'GUEST' | 'EMPLOYEE';
74
- keyType: 'SCHEDULE' | 'ONETIME';
75
- startDate: Date;
76
- endDate: Date;
77
- }) => Promise<any>;
78
- modifyPinCodeByKeyId: ({ keyId, accommodationId, userType, keyType, startDate, endDate, }: {
79
- keyId: string;
80
- accommodationId: string;
81
- userType: 'GUEST' | 'EMPLOYEE';
82
- keyType: 'SCHEDULE' | 'ONETIME';
83
- startDate: Date;
84
- endDate: Date;
85
- }) => Promise<any>;
86
- deletePinCodeByKeyId: ({ keyId, accommodationId }: {
87
- keyId: string;
88
- accommodationId: string;
89
- }) => Promise<any>;
90
- openLockByRoomId: ({ accommodationId, roomId, keyId }: {
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 {};