whitelabel-db 1.0.51 → 1.0.53
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 +11 -0
- package/dist/libs/liteapiv3.d.ts +3 -1
- package/dist/libs/liteapiv3.js +13 -9
- package/dist/models/Hotel.d.ts +1 -0
- package/dist/models/Hotel.js +7 -0
- package/dist/models/Project.d.ts +1 -1
- package/dist/models/Project.js +2 -2
- package/dist/models/Search.d.ts +8 -0
- package/dist/models/{UserRole.js → Search.js} +34 -19
- package/package.json +1 -1
- package/dist/models/UserRole.d.ts +0 -6
package/README.md
CHANGED
package/dist/libs/liteapiv3.d.ts
CHANGED
|
@@ -195,7 +195,9 @@ export interface CancelBookingV3 {
|
|
|
195
195
|
}
|
|
196
196
|
export declare class LiteApiClientV3 {
|
|
197
197
|
private apiKey;
|
|
198
|
-
|
|
198
|
+
private baseUrl;
|
|
199
|
+
private bookingBaseUrl;
|
|
200
|
+
constructor(apiKey: string, useProduction?: boolean);
|
|
199
201
|
getHotels(options: HotelsRequestV3): Promise<AvailabilityResultV3[]>;
|
|
200
202
|
getHotelById(hotelId: string): Promise<AvailabilityResultV3>;
|
|
201
203
|
getHotelsFullRate(options: HotelsRequestV3): Promise<FullRateAvailabilityResultV3[]>;
|
package/dist/libs/liteapiv3.js
CHANGED
|
@@ -14,16 +14,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.LiteApiClientV3 = void 0;
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
|
17
|
-
const baseUrl = 'https://api.liteapi.travel';
|
|
18
|
-
const bookingBaseUrl = 'https://book.liteapi.travel';
|
|
19
17
|
class LiteApiClientV3 {
|
|
20
|
-
constructor(apiKey) {
|
|
18
|
+
constructor(apiKey, useProduction = true) {
|
|
21
19
|
this.apiKey = apiKey;
|
|
20
|
+
this.baseUrl = useProduction
|
|
21
|
+
? 'https://api.liteapi.travel'
|
|
22
|
+
: 'https://api.dev.liteapi.travel';
|
|
23
|
+
this.bookingBaseUrl = useProduction
|
|
24
|
+
? 'https://book.liteapi.travel'
|
|
25
|
+
: 'https://book.dev.liteapi.travel';
|
|
22
26
|
}
|
|
23
27
|
getHotels(options) {
|
|
24
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
29
|
return (yield (0, axios_1.default)({
|
|
26
|
-
url: `${baseUrl}/v3.0/hotels`,
|
|
30
|
+
url: `${this.baseUrl}/v3.0/hotels`,
|
|
27
31
|
params: options,
|
|
28
32
|
headers: {
|
|
29
33
|
'X-API-Key': this.apiKey,
|
|
@@ -34,7 +38,7 @@ class LiteApiClientV3 {
|
|
|
34
38
|
getHotelById(hotelId) {
|
|
35
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
40
|
return (yield (0, axios_1.default)({
|
|
37
|
-
url: `${baseUrl}/v3.0/hotels/${hotelId}`,
|
|
41
|
+
url: `${this.baseUrl}/v3.0/hotels/${hotelId}`,
|
|
38
42
|
headers: {
|
|
39
43
|
'X-API-Key': this.apiKey,
|
|
40
44
|
},
|
|
@@ -46,7 +50,7 @@ class LiteApiClientV3 {
|
|
|
46
50
|
const query = options.rm ? `rm=${options.rm}` : ``;
|
|
47
51
|
return (yield (0, axios_1.default)({
|
|
48
52
|
method: 'post',
|
|
49
|
-
url: `${baseUrl}/v3.0/hotels/rates?${query}`,
|
|
53
|
+
url: `${this.baseUrl}/v3.0/hotels/rates?${query}`,
|
|
50
54
|
data: options,
|
|
51
55
|
headers: {
|
|
52
56
|
'X-API-Key': this.apiKey,
|
|
@@ -58,7 +62,7 @@ class LiteApiClientV3 {
|
|
|
58
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
63
|
return (yield (0, axios_1.default)({
|
|
60
64
|
method: 'post',
|
|
61
|
-
url: `${bookingBaseUrl}/v3.0/rates/prebook`,
|
|
65
|
+
url: `${this.bookingBaseUrl}/v3.0/rates/prebook`,
|
|
62
66
|
data: options,
|
|
63
67
|
headers: {
|
|
64
68
|
'X-API-Key': this.apiKey,
|
|
@@ -71,7 +75,7 @@ class LiteApiClientV3 {
|
|
|
71
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
76
|
return (yield (0, axios_1.default)({
|
|
73
77
|
method: 'post',
|
|
74
|
-
url: `${bookingBaseUrl}/v3.0/rates/book`,
|
|
78
|
+
url: `${this.bookingBaseUrl}/v3.0/rates/book`,
|
|
75
79
|
data: options,
|
|
76
80
|
headers: {
|
|
77
81
|
'X-API-Key': this.apiKey,
|
|
@@ -84,7 +88,7 @@ class LiteApiClientV3 {
|
|
|
84
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
89
|
return (yield (0, axios_1.default)({
|
|
86
90
|
method: 'put',
|
|
87
|
-
url: `${bookingBaseUrl}/v3.0/bookings/${bookingId}`,
|
|
91
|
+
url: `${this.bookingBaseUrl}/v3.0/bookings/${bookingId}`,
|
|
88
92
|
headers: {
|
|
89
93
|
'X-API-Key': this.apiKey,
|
|
90
94
|
'content-type': 'application/json',
|
package/dist/models/Hotel.d.ts
CHANGED
package/dist/models/Hotel.js
CHANGED
|
@@ -98,6 +98,13 @@ __decorate([
|
|
|
98
98
|
}),
|
|
99
99
|
__metadata("design:type", String)
|
|
100
100
|
], Hotel.prototype, "main_photo", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, sequelize_typescript_1.Column)({
|
|
103
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
104
|
+
allowNull: false,
|
|
105
|
+
}),
|
|
106
|
+
__metadata("design:type", String)
|
|
107
|
+
], Hotel.prototype, "thumbnail", void 0);
|
|
101
108
|
__decorate([
|
|
102
109
|
sequelize_typescript_1.Index,
|
|
103
110
|
(0, sequelize_typescript_1.Column)({
|
package/dist/models/Project.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export declare class Project extends Model<Partial<Project>> {
|
|
|
16
16
|
appearance?: object;
|
|
17
17
|
generateSession(secret: string): string;
|
|
18
18
|
getLiteApiClient(): LiteApiClient;
|
|
19
|
-
getLiteApiClientV3(): LiteApiClientV3;
|
|
19
|
+
getLiteApiClientV3(useProduction?: boolean): LiteApiClientV3;
|
|
20
20
|
}
|
package/dist/models/Project.js
CHANGED
|
@@ -44,14 +44,14 @@ let Project = class Project extends sequelize_typescript_1.Model {
|
|
|
44
44
|
throw err;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
getLiteApiClientV3() {
|
|
47
|
+
getLiteApiClientV3(useProduction = true) {
|
|
48
48
|
try {
|
|
49
49
|
let key = this.settings.liteApiKey;
|
|
50
50
|
if (!key || !key.length) {
|
|
51
51
|
key = process.env.LITEAPI_KEY;
|
|
52
52
|
}
|
|
53
53
|
if (!clientV3[key]) {
|
|
54
|
-
clientV3[key] = new liteapiv3_1.LiteApiClientV3(key);
|
|
54
|
+
clientV3[key] = new liteapiv3_1.LiteApiClientV3(key, useProduction);
|
|
55
55
|
}
|
|
56
56
|
return clientV3[key];
|
|
57
57
|
}
|
|
@@ -9,38 +9,53 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const sequelize_1 = require("sequelize");
|
|
12
|
+
exports.Search = void 0;
|
|
14
13
|
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
15
|
-
let
|
|
14
|
+
let Search = class Search extends sequelize_typescript_1.Model {
|
|
16
15
|
};
|
|
17
|
-
exports.
|
|
16
|
+
exports.Search = Search;
|
|
18
17
|
__decorate([
|
|
19
18
|
sequelize_typescript_1.PrimaryKey,
|
|
19
|
+
sequelize_typescript_1.Index,
|
|
20
20
|
(0, sequelize_typescript_1.Column)({
|
|
21
|
-
type:
|
|
22
|
-
allowNull: false,
|
|
23
|
-
autoIncrement: true,
|
|
21
|
+
type: sequelize_typescript_1.DataType.STRING(32),
|
|
24
22
|
}),
|
|
25
23
|
__metadata("design:type", String)
|
|
26
|
-
],
|
|
24
|
+
], Search.prototype, "id", void 0);
|
|
27
25
|
__decorate([
|
|
28
|
-
sequelize_typescript_1.Unique,
|
|
29
26
|
(0, sequelize_typescript_1.Column)({
|
|
30
|
-
type: sequelize_typescript_1.DataType.
|
|
27
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
31
28
|
allowNull: false,
|
|
29
|
+
defaultValue: 0,
|
|
32
30
|
}),
|
|
33
|
-
__metadata("design:type",
|
|
34
|
-
],
|
|
31
|
+
__metadata("design:type", Number)
|
|
32
|
+
], Search.prototype, "hits", void 0);
|
|
35
33
|
__decorate([
|
|
34
|
+
sequelize_typescript_1.Unique,
|
|
35
|
+
sequelize_typescript_1.Index,
|
|
36
36
|
(0, sequelize_typescript_1.Column)({
|
|
37
|
-
type: sequelize_typescript_1.DataType.
|
|
38
|
-
allowNull: true,
|
|
37
|
+
type: sequelize_typescript_1.DataType.DATE,
|
|
39
38
|
}),
|
|
40
|
-
__metadata("design:type",
|
|
41
|
-
],
|
|
42
|
-
|
|
39
|
+
__metadata("design:type", Date)
|
|
40
|
+
], Search.prototype, "cacheUpdatedAt", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
sequelize_typescript_1.Unique,
|
|
43
|
+
sequelize_typescript_1.Index,
|
|
44
|
+
(0, sequelize_typescript_1.Column)({
|
|
45
|
+
type: sequelize_typescript_1.DataType.DATE,
|
|
46
|
+
}),
|
|
47
|
+
__metadata("design:type", Date)
|
|
48
|
+
], Search.prototype, "cacheQueuedAt", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, sequelize_typescript_1.Column)({
|
|
51
|
+
type: sequelize_typescript_1.DataType.JSONB,
|
|
52
|
+
allowNull: false,
|
|
53
|
+
defaultValue: {},
|
|
54
|
+
}),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], Search.prototype, "data", void 0);
|
|
57
|
+
exports.Search = Search = __decorate([
|
|
43
58
|
(0, sequelize_typescript_1.Table)({
|
|
44
|
-
tableName: '
|
|
59
|
+
tableName: 'searches',
|
|
45
60
|
})
|
|
46
|
-
],
|
|
61
|
+
], Search);
|
package/package.json
CHANGED