whitelabel-db 1.0.24 → 1.0.26
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/dist/index.d.ts +1 -1
- package/dist/libs/liteapi.d.ts +8 -0
- package/dist/libs/liteapi.js +12 -0
- package/dist/models/Project.d.ts +2 -0
- package/dist/models/Project.js +18 -0
- package/package.json +1 -1
- package/dist/models/Search.d.ts +0 -8
- package/dist/models/Search.js +0 -61
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export { Hotel } from './models/Hotel';
|
|
|
6
6
|
export { User } from './models/User';
|
|
7
7
|
export { Project } from './models/Project';
|
|
8
8
|
export { Booking } from './models/Booking';
|
|
9
|
-
export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, BookingInfo, } from './libs/liteapi';
|
|
9
|
+
export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, BookingInfo, CancelBooking, } from './libs/liteapi';
|
package/dist/libs/liteapi.d.ts
CHANGED
|
@@ -142,6 +142,13 @@ export interface BookingConfirmation {
|
|
|
142
142
|
prebookId: string;
|
|
143
143
|
transactionId: string;
|
|
144
144
|
}
|
|
145
|
+
export interface CancelBooking {
|
|
146
|
+
bookingId: string;
|
|
147
|
+
status: string;
|
|
148
|
+
cancellation_fee: number;
|
|
149
|
+
refund_amount: number;
|
|
150
|
+
currency: string;
|
|
151
|
+
}
|
|
145
152
|
export declare class LiteApiClient {
|
|
146
153
|
private apiKey;
|
|
147
154
|
constructor(apiKey: string);
|
|
@@ -150,4 +157,5 @@ export declare class LiteApiClient {
|
|
|
150
157
|
getHotelsFullRate(options: HotelsRequest): Promise<FullRateAvailabilityResult[]>;
|
|
151
158
|
preBookedHotelRate(options: PrebookRateRequest): Promise<PrebookRate>;
|
|
152
159
|
bookHotelRate(options: CheckoutRequest): Promise<BookingInfo>;
|
|
160
|
+
cancelBooking(bookingId: string): Promise<CancelBooking>;
|
|
153
161
|
}
|
package/dist/libs/liteapi.js
CHANGED
|
@@ -77,5 +77,17 @@ class LiteApiClient {
|
|
|
77
77
|
})).data.data;
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
+
cancelBooking(bookingId) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
return (yield (0, axios_1.default)({
|
|
83
|
+
method: 'put',
|
|
84
|
+
url: `${baseUrl}/v2.0/bookings/${bookingId}`,
|
|
85
|
+
headers: {
|
|
86
|
+
'X-API-Key': this.apiKey,
|
|
87
|
+
'content-type': 'application/json',
|
|
88
|
+
},
|
|
89
|
+
})).data.data;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
80
92
|
}
|
|
81
93
|
exports.LiteApiClient = LiteApiClient;
|
package/dist/models/Project.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Model } from 'sequelize-typescript';
|
|
2
2
|
import { Agency } from './Agency';
|
|
3
|
+
import { LiteApiClient } from '../libs/liteapi';
|
|
3
4
|
export declare class Project extends Model<Partial<Project>> {
|
|
4
5
|
id: string;
|
|
5
6
|
name: string;
|
|
@@ -9,4 +10,5 @@ export declare class Project extends Model<Partial<Project>> {
|
|
|
9
10
|
agencyId?: string;
|
|
10
11
|
agency?: Agency;
|
|
11
12
|
generateSession(secret: string): string;
|
|
13
|
+
getLiteApiClient(): LiteApiClient;
|
|
12
14
|
}
|
package/dist/models/Project.js
CHANGED
|
@@ -16,6 +16,8 @@ exports.Project = void 0;
|
|
|
16
16
|
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
17
17
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
18
18
|
const Agency_1 = require("./Agency");
|
|
19
|
+
const liteapi_1 = require("../libs/liteapi");
|
|
20
|
+
const clients = {};
|
|
19
21
|
let Project = class Project extends sequelize_typescript_1.Model {
|
|
20
22
|
generateSession(secret) {
|
|
21
23
|
return jsonwebtoken_1.default.sign({ id: this.id }, secret, {
|
|
@@ -23,6 +25,22 @@ let Project = class Project extends sequelize_typescript_1.Model {
|
|
|
23
25
|
expiresIn: 86400, // 24 hours
|
|
24
26
|
});
|
|
25
27
|
}
|
|
28
|
+
getLiteApiClient() {
|
|
29
|
+
try {
|
|
30
|
+
let key = this.settings.liteApiKey;
|
|
31
|
+
if (!key || !key.length) {
|
|
32
|
+
key = process.env.LITEAPI_KEY;
|
|
33
|
+
}
|
|
34
|
+
if (!clients[key]) {
|
|
35
|
+
clients[key] = new liteapi_1.LiteApiClient(key);
|
|
36
|
+
}
|
|
37
|
+
return clients[key];
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
console.log(err);
|
|
41
|
+
throw err;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
26
44
|
};
|
|
27
45
|
exports.Project = Project;
|
|
28
46
|
__decorate([
|
package/package.json
CHANGED
package/dist/models/Search.d.ts
DELETED
package/dist/models/Search.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Search = void 0;
|
|
13
|
-
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
-
let Search = class Search extends sequelize_typescript_1.Model {
|
|
15
|
-
};
|
|
16
|
-
exports.Search = Search;
|
|
17
|
-
__decorate([
|
|
18
|
-
sequelize_typescript_1.PrimaryKey,
|
|
19
|
-
sequelize_typescript_1.Index,
|
|
20
|
-
(0, sequelize_typescript_1.Column)({
|
|
21
|
-
type: sequelize_typescript_1.DataType.STRING(32),
|
|
22
|
-
}),
|
|
23
|
-
__metadata("design:type", String)
|
|
24
|
-
], Search.prototype, "id", void 0);
|
|
25
|
-
__decorate([
|
|
26
|
-
(0, sequelize_typescript_1.Column)({
|
|
27
|
-
type: sequelize_typescript_1.DataType.INTEGER,
|
|
28
|
-
allowNull: false,
|
|
29
|
-
defaultValue: 0,
|
|
30
|
-
}),
|
|
31
|
-
__metadata("design:type", Number)
|
|
32
|
-
], Search.prototype, "hits", void 0);
|
|
33
|
-
__decorate([
|
|
34
|
-
sequelize_typescript_1.Unique,
|
|
35
|
-
sequelize_typescript_1.Index,
|
|
36
|
-
(0, sequelize_typescript_1.Column)({
|
|
37
|
-
type: sequelize_typescript_1.DataType.DATE,
|
|
38
|
-
}),
|
|
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([
|
|
58
|
-
(0, sequelize_typescript_1.Table)({
|
|
59
|
-
tableName: 'searches',
|
|
60
|
-
})
|
|
61
|
-
], Search);
|