turf-common 1.0.0 → 1.0.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.
Files changed (38) hide show
  1. package/README.md +11 -0
  2. package/build/enums/modification-discount-policy.enum.d.ts +5 -0
  3. package/build/enums/modification-discount-policy.enum.js +9 -0
  4. package/build/exceptions/app-badrequest.exception.d.ts +5 -0
  5. package/build/exceptions/app-badrequest.exception.js +28 -0
  6. package/build/index.d.ts +8 -0
  7. package/build/index.js +24 -0
  8. package/build/interface/get-booking-codes-per-thirty-min.interface.d.ts +4 -0
  9. package/build/interface/get-booking-codes-per-thirty-min.interface.js +2 -0
  10. package/build/models/booking-code-model.d.ts +72 -0
  11. package/build/models/booking-code-model.js +414 -0
  12. package/build/models/charge-model.d.ts +44 -0
  13. package/build/models/charge-model.js +227 -0
  14. package/build/models/time-slot-model.d.ts +18 -0
  15. package/build/models/time-slot-model.js +95 -0
  16. package/build/modules/app-badrequest-exception-module/app-badrequest-exception-model.d.ts +5 -0
  17. package/build/modules/app-badrequest-exception-module/app-badrequest-exception-model.js +28 -0
  18. package/build/modules/app-badrequest-exception-module/types/app-badrequest-exception.type.d.ts +4 -0
  19. package/build/modules/app-badrequest-exception-module/types/app-badrequest-exception.type.js +2 -0
  20. package/build/modules/booking-module/booking-code-model.d.ts +71 -0
  21. package/build/modules/booking-module/booking-code-model.js +407 -0
  22. package/build/modules/booking-module/interfaces/get-booking-codes-per-thirty-min.interface.d.ts +4 -0
  23. package/build/modules/booking-module/interfaces/get-booking-codes-per-thirty-min.interface.js +2 -0
  24. package/build/modules/charge-module/charge-model.d.ts +44 -0
  25. package/build/modules/charge-module/charge-model.js +227 -0
  26. package/build/modules/charge-module/enums/modification-discount-policy.enum.d.ts +5 -0
  27. package/build/modules/charge-module/enums/modification-discount-policy.enum.js +9 -0
  28. package/build/modules/charge-module/types/booking-modification.type.d.ts +6 -0
  29. package/build/modules/charge-module/types/booking-modification.type.js +2 -0
  30. package/build/modules/date-module/date-code-model.d.ts +8 -0
  31. package/build/modules/date-module/date-code-model.js +38 -0
  32. package/build/modules/time-slot-module/time-slot-model.d.ts +18 -0
  33. package/build/modules/time-slot-module/time-slot-model.js +95 -0
  34. package/build/types/app-badrequest-exception.type.d.ts +4 -0
  35. package/build/types/app-badrequest-exception.type.js +2 -0
  36. package/build/types/booking-modification.type.d.ts +6 -0
  37. package/build/types/booking-modification.type.js +2 -0
  38. package/package.json +13 -3
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChargesModel = void 0;
4
+ var app_badrequest_exception_model_1 = require("../app-badrequest-exception-module/app-badrequest-exception-model");
5
+ var modification_discount_policy_enum_1 = require("./enums/modification-discount-policy.enum");
6
+ var ChargesModel = /** @class */ (function () {
7
+ function ChargesModel(initialGrossAmount, paidAmount, couponCode, discountPolicy) {
8
+ this.initialBookingGrossAmount = initialGrossAmount;
9
+ this.amountPaid = paidAmount;
10
+ this.couponCode = couponCode;
11
+ this.additionalBookingGrossAmount = 0;
12
+ this.cancelledBookingGrossAmount = 0;
13
+ this.totalCancellationCharges = 0;
14
+ this.refundPayable = 0;
15
+ this.totalRefundedAmount = 0;
16
+ this.netTotal = this.getNetAmount();
17
+ this.amountPayable = this.getPayableRefundAmount();
18
+ this.discountPolicy = discountPolicy;
19
+ }
20
+ ChargesModel.prototype.getGrossAmount = function () {
21
+ return (this.initialBookingGrossAmount +
22
+ this.additionalBookingGrossAmount -
23
+ this.cancelledBookingGrossAmount);
24
+ };
25
+ ChargesModel.prototype.getNetAmount = function () {
26
+ return this.getGrossAmount() - this.getDiscountAmount();
27
+ };
28
+ ChargesModel.prototype.getDiscountAmount = function () {
29
+ if ([
30
+ modification_discount_policy_enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL,
31
+ modification_discount_policy_enum_1.ModificationDiscountPolicy.DISCOUNT_RECALL,
32
+ ].includes(this.discountPolicy) &&
33
+ this.cancelledBookingGrossAmount > 0) {
34
+ this.couponCode = "";
35
+ }
36
+ return ChargesModel.getDiscountAmount(this.couponCode, this.getGrossAmount());
37
+ };
38
+ ChargesModel.prototype.getPayableRefundAmount = function () {
39
+ return (this.getNetAmount() +
40
+ this.totalCancellationCharges -
41
+ this.amountPaid +
42
+ this.totalRefundedAmount);
43
+ };
44
+ // setRefundedAmount(refundAmount: number) {
45
+ // this.paidAmount = this.paidAmount - refundAmount;
46
+ // this.totalRefundAmount = this.totalRefundAmount - refundAmount;
47
+ // this.refundedAmount += refundAmount;
48
+ // }
49
+ ChargesModel.getDiscountAmount = function (couponCode, totalCost, validationApply) {
50
+ if (validationApply === void 0) { validationApply = false; }
51
+ var discountAmount = 0;
52
+ if (couponCode) {
53
+ if (couponCode.slice(-1) === "P") {
54
+ var percentDiscount = parseFloat(couponCode);
55
+ if (validationApply && percentDiscount > 90) {
56
+ throw new app_badrequest_exception_model_1.AppBadRequestException({
57
+ key: "couponCode",
58
+ message: ["Discount should not be more than 90P"],
59
+ });
60
+ }
61
+ discountAmount = totalCost * (percentDiscount / 100);
62
+ }
63
+ else if (couponCode.slice(-1) === "U") {
64
+ discountAmount = parseFloat(couponCode);
65
+ }
66
+ }
67
+ return Math.round(discountAmount);
68
+ };
69
+ ChargesModel.prototype.setValues = function (values) {
70
+ if (values === void 0) { values = {}; }
71
+ var that = this.clone();
72
+ if (values.totalRefundedAmount) {
73
+ that.totalRefundedAmount += values.totalRefundedAmount;
74
+ that.refundPayable -= values.totalRefundedAmount;
75
+ }
76
+ if (values.amountPaid) {
77
+ that.amountPaid = that.amountPaid + values.amountPaid;
78
+ that.amountPayable = that.amountPayable - values.amountPaid;
79
+ }
80
+ return that;
81
+ };
82
+ ChargesModel.prototype.modify = function (bookingModification) {
83
+ var oldBookingCode = bookingModification.oldBookingCode, newBookingCode = bookingModification.newBookingCode, cancellationUnit = bookingModification.cancellationUnit;
84
+ if (!newBookingCode) {
85
+ return this.modifyDelete(oldBookingCode, cancellationUnit !== null && cancellationUnit !== void 0 ? cancellationUnit : "");
86
+ }
87
+ if (!newBookingCode)
88
+ return null;
89
+ var oldTimeSlotMinutes = oldBookingCode.getTimeslot().getTotalMinutes();
90
+ var newTimeSlotMinutes = newBookingCode.getTimeslot().getTotalMinutes();
91
+ if (oldTimeSlotMinutes === newTimeSlotMinutes) {
92
+ return this.modifyMove(oldBookingCode, newBookingCode, cancellationUnit !== null && cancellationUnit !== void 0 ? cancellationUnit : "");
93
+ }
94
+ if (oldTimeSlotMinutes > newTimeSlotMinutes) {
95
+ return this.modifyReduce(oldBookingCode, newBookingCode, cancellationUnit !== null && cancellationUnit !== void 0 ? cancellationUnit : "");
96
+ }
97
+ if (oldTimeSlotMinutes < newTimeSlotMinutes) {
98
+ return this.modifyExtend(oldBookingCode, newBookingCode);
99
+ }
100
+ return null;
101
+ };
102
+ ChargesModel.prototype.modifyExtend = function (oldBookingCode, newBookingCode) {
103
+ var newChargeModel = this.clone();
104
+ newChargeModel.additionalBookingGrossAmount +=
105
+ newBookingCode.getCost() - oldBookingCode.getCost();
106
+ newChargeModel.netTotal = newChargeModel.getNetAmount();
107
+ newChargeModel.amountPayable = newChargeModel.getPayableRefundAmount();
108
+ // console.log(newChargeModel.payableAmount);
109
+ if (newChargeModel.amountPayable > 0) {
110
+ newChargeModel.refundPayable = 0;
111
+ }
112
+ else {
113
+ newChargeModel.refundPayable = Math.abs(newChargeModel.amountPayable);
114
+ newChargeModel.amountPayable = 0;
115
+ }
116
+ return newChargeModel;
117
+ };
118
+ ChargesModel.prototype.modifyReduce = function (oldBookingCode, newBookingCode, cancellationUnit) {
119
+ var newChargeModel = this.clone();
120
+ newChargeModel.couponCode = "";
121
+ var costDifference = oldBookingCode.getCost() - newBookingCode.getCost();
122
+ // console.log(`costDifference ${costDifference}`);
123
+ newChargeModel.cancelledBookingGrossAmount += costDifference;
124
+ var cancellationCharges = ChargesModel.getDiscountAmount(cancellationUnit, costDifference);
125
+ // console.log(`cancellationCharges ${cancellationCharges}`);
126
+ newChargeModel.totalCancellationCharges += cancellationCharges;
127
+ newChargeModel.netTotal = newChargeModel.getNetAmount();
128
+ // console.log(`newChargeModel.netAmount ${newChargeModel.netAmount}`);
129
+ newChargeModel.amountPayable = newChargeModel.getPayableRefundAmount();
130
+ // console.log(`newChargeModel.payableAmount ${newChargeModel.payableAmount}`);
131
+ if (newChargeModel.amountPayable > 0) {
132
+ newChargeModel.refundPayable = 0;
133
+ }
134
+ else {
135
+ newChargeModel.refundPayable = Math.abs(newChargeModel.amountPayable);
136
+ newChargeModel.amountPayable = 0;
137
+ }
138
+ return newChargeModel;
139
+ };
140
+ ChargesModel.prototype.modifyMove = function (oldBookingCode, newBookingCode, cancellationUnit) {
141
+ var newChargeModel = this.clone();
142
+ var costDifference = newBookingCode.getCost() - oldBookingCode.getCost();
143
+ if (costDifference === 0) {
144
+ return newChargeModel;
145
+ }
146
+ if (costDifference > 0) {
147
+ newChargeModel.additionalBookingGrossAmount += costDifference;
148
+ }
149
+ else {
150
+ newChargeModel.cancelledBookingGrossAmount += Math.abs(costDifference);
151
+ var cancellationCharges = ChargesModel.getDiscountAmount(cancellationUnit, Math.abs(costDifference));
152
+ newChargeModel.totalCancellationCharges += cancellationCharges;
153
+ }
154
+ newChargeModel.netTotal = newChargeModel.getNetAmount();
155
+ newChargeModel.amountPayable = newChargeModel.getPayableRefundAmount();
156
+ if (newChargeModel.amountPayable > 0) {
157
+ newChargeModel.refundPayable = 0;
158
+ }
159
+ else {
160
+ newChargeModel.refundPayable = Math.abs(newChargeModel.amountPayable);
161
+ newChargeModel.amountPayable = 0;
162
+ }
163
+ return newChargeModel;
164
+ };
165
+ ChargesModel.prototype.clone = function () {
166
+ var that = new ChargesModel(this.initialBookingGrossAmount, this.amountPaid, this.couponCode, this.discountPolicy);
167
+ Object.assign(that, this);
168
+ return that;
169
+ };
170
+ ChargesModel.prototype.modifyDelete = function (bookingCode, cancellationUnit) {
171
+ var newChargeModel = this.clone();
172
+ newChargeModel.couponCode = "";
173
+ var costDifference = bookingCode.getCost();
174
+ newChargeModel.cancelledBookingGrossAmount += costDifference;
175
+ var cancellationCharges = ChargesModel.getDiscountAmount(cancellationUnit, costDifference);
176
+ newChargeModel.totalCancellationCharges += cancellationCharges;
177
+ newChargeModel.netTotal = newChargeModel.getNetAmount();
178
+ newChargeModel.amountPayable = newChargeModel.getPayableRefundAmount();
179
+ if (newChargeModel.amountPayable > 0) {
180
+ newChargeModel.refundPayable = 0;
181
+ }
182
+ else {
183
+ newChargeModel.refundPayable = Math.abs(newChargeModel.amountPayable);
184
+ newChargeModel.amountPayable = 0;
185
+ }
186
+ return newChargeModel;
187
+ };
188
+ ChargesModel.getInstanceByInterface = function (bookingDetailsEntity, discountPolicy) {
189
+ if (discountPolicy === void 0) { discountPolicy = modification_discount_policy_enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL; }
190
+ var chargesModel = new ChargesModel(bookingDetailsEntity.initialBookingGrossAmount, bookingDetailsEntity.amountPaid, bookingDetailsEntity.couponCode, discountPolicy);
191
+ Object.assign(chargesModel, bookingDetailsEntity);
192
+ return chargesModel;
193
+ };
194
+ ChargesModel.assignByInterface = function (bookingDetailsEntity, discountPolicy) {
195
+ if (discountPolicy === void 0) { discountPolicy = modification_discount_policy_enum_1.ModificationDiscountPolicy.DISCOUNT_CONDITIONAL; }
196
+ var newChargeModel = new ChargesModel(bookingDetailsEntity.initialBookingGrossAmount, bookingDetailsEntity.amountPaid, bookingDetailsEntity.couponCode, discountPolicy);
197
+ newChargeModel.additionalBookingGrossAmount =
198
+ bookingDetailsEntity.additionalBookingGrossAmount;
199
+ newChargeModel.initialBookingGrossAmount =
200
+ bookingDetailsEntity.initialBookingGrossAmount;
201
+ newChargeModel.cancelledBookingGrossAmount =
202
+ bookingDetailsEntity.cancelledBookingGrossAmount;
203
+ newChargeModel.refundPayable = bookingDetailsEntity.refundPayable;
204
+ newChargeModel.totalRefundedAmount =
205
+ bookingDetailsEntity.totalRefundedAmount;
206
+ newChargeModel.amountPaid = bookingDetailsEntity.amountPaid;
207
+ newChargeModel.totalCancellationCharges =
208
+ bookingDetailsEntity.totalCancellationCharges;
209
+ newChargeModel.netTotal = bookingDetailsEntity.netTotal;
210
+ newChargeModel.couponCode = bookingDetailsEntity.couponCode;
211
+ newChargeModel.amountPayable = bookingDetailsEntity.amountPayable;
212
+ return newChargeModel;
213
+ };
214
+ ChargesModel.prototype.getTotalAmount = function () {
215
+ return this.getNetAmount() + this.totalCancellationCharges;
216
+ };
217
+ ChargesModel.prototype.getPaymentStatus = function () {
218
+ var payableRefundAmount = this.getPayableRefundAmount();
219
+ return payableRefundAmount < 0
220
+ ? "Refund"
221
+ : payableRefundAmount === 0
222
+ ? "Paid"
223
+ : "Pending";
224
+ };
225
+ return ChargesModel;
226
+ }());
227
+ exports.ChargesModel = ChargesModel;
@@ -0,0 +1,5 @@
1
+ export declare enum ModificationDiscountPolicy {
2
+ DISCOUNT_RECALL = "discount_recall",
3
+ DISCOUNT_RELATIVE = "discount_relative",
4
+ DISCOUNT_CONDITIONAL = "discount_conditional"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModificationDiscountPolicy = void 0;
4
+ var ModificationDiscountPolicy;
5
+ (function (ModificationDiscountPolicy) {
6
+ ModificationDiscountPolicy["DISCOUNT_RECALL"] = "discount_recall";
7
+ ModificationDiscountPolicy["DISCOUNT_RELATIVE"] = "discount_relative";
8
+ ModificationDiscountPolicy["DISCOUNT_CONDITIONAL"] = "discount_conditional";
9
+ })(ModificationDiscountPolicy || (exports.ModificationDiscountPolicy = ModificationDiscountPolicy = {}));
@@ -0,0 +1,6 @@
1
+ import { BookingCode } from "../../booking-module/booking-code-model";
2
+ export type BookingModification = {
3
+ oldBookingCode: BookingCode;
4
+ newBookingCode?: BookingCode;
5
+ cancellationUnit?: string;
6
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ export declare class DateCode {
2
+ date: Date;
3
+ constructor(date: Date);
4
+ setTimeToDate(hour: number, minute: number): Date;
5
+ static getUtcDate(): Date;
6
+ static getIndianTimeZoneDate(bookingBufferOffsetHour?: number): Date;
7
+ static dateFormat(dateCode: string): string;
8
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DateCode = void 0;
4
+ var DateCode = /** @class */ (function () {
5
+ function DateCode(date) {
6
+ this.date = date;
7
+ }
8
+ DateCode.prototype.setTimeToDate = function (hour, minute) {
9
+ var newDate = new Date(Date.UTC(this.date.getFullYear(), this.date.getMonth(), this.date.getDate(), hour, minute));
10
+ return newDate;
11
+ };
12
+ DateCode.getUtcDate = function () {
13
+ var currentDate = new Date();
14
+ var year = currentDate.getUTCFullYear();
15
+ var month = currentDate.getUTCMonth();
16
+ var day = currentDate.getUTCDate();
17
+ var utcDate = new Date(Date.UTC(year, month, day));
18
+ return utcDate;
19
+ };
20
+ DateCode.getIndianTimeZoneDate = function (bookingBufferOffsetHour) {
21
+ var now = new Date();
22
+ var utcOffsetMinutes = 330; // Indian Standard Time (IST) offset is UTC+05:30
23
+ var indianTimeMillis = now.getTime() +
24
+ utcOffsetMinutes * 60 * 1000 +
25
+ (bookingBufferOffsetHour || 0) * 60 * 60 * 1000;
26
+ return new Date(indianTimeMillis);
27
+ };
28
+ DateCode.dateFormat = function (dateCode) {
29
+ dateCode = "20".concat(dateCode.slice(0, 2), "-").concat(dateCode.slice(2, 4), "-").concat(dateCode.slice(4, 6));
30
+ var date = new Date(dateCode);
31
+ var day = date.getDate();
32
+ var month = date.toLocaleString("default", { month: "long" });
33
+ var year = date.getFullYear();
34
+ return "".concat(day, " ").concat(month, " ").concat(year);
35
+ };
36
+ return DateCode;
37
+ }());
38
+ exports.DateCode = DateCode;
@@ -0,0 +1,18 @@
1
+ export declare class TimeSlot {
2
+ fromTime: string;
3
+ toTime: string;
4
+ constructor(fromTime: string, toTime: string);
5
+ isOverLap(timeSlot: TimeSlot): boolean;
6
+ getOverlapTime(timeSlot: TimeSlot): TimeSlot | null;
7
+ getNonOverlapTimeSlots(existingPriceSlot: TimeSlot): string[];
8
+ getStartMinutes(): number;
9
+ getEndMinutes(): number;
10
+ getHalfHourMinutes(): number[];
11
+ getHalfHourTimeCodes(): string[];
12
+ getHalfHourTimeRangeCodes(): string[];
13
+ getTotalMinutes(): number;
14
+ static convertToCode(minute: number): string;
15
+ static _getMinutes(timeCode: string): number;
16
+ static getHalfHourTimeCodes(): string[];
17
+ static getHalfHourTimeRangeCodes(): string[];
18
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimeSlot = void 0;
4
+ var TimeSlot = /** @class */ (function () {
5
+ function TimeSlot(fromTime, toTime) {
6
+ this.fromTime = fromTime;
7
+ this.toTime = toTime;
8
+ }
9
+ TimeSlot.prototype.isOverLap = function (timeSlot) {
10
+ return this.fromTime < timeSlot.toTime && this.toTime > timeSlot.fromTime;
11
+ };
12
+ TimeSlot.prototype.getOverlapTime = function (timeSlot) {
13
+ if (!this.isOverLap(timeSlot)) {
14
+ return null;
15
+ }
16
+ return new TimeSlot(this.fromTime > timeSlot.fromTime ? this.fromTime : timeSlot.fromTime, this.toTime < timeSlot.toTime ? this.toTime : timeSlot.toTime);
17
+ };
18
+ TimeSlot.prototype.getNonOverlapTimeSlots = function (existingPriceSlot) {
19
+ var overLapFromTime = this.fromTime > existingPriceSlot.fromTime
20
+ ? this.fromTime
21
+ : existingPriceSlot.fromTime;
22
+ var overLapToTime = this.toTime < existingPriceSlot.toTime
23
+ ? this.toTime
24
+ : existingPriceSlot.toTime;
25
+ var nonOverlapTimeSlots = [];
26
+ if (existingPriceSlot.fromTime < overLapFromTime) {
27
+ nonOverlapTimeSlots.push("".concat(existingPriceSlot.fromTime).concat(overLapFromTime));
28
+ }
29
+ if (existingPriceSlot.toTime > overLapToTime) {
30
+ nonOverlapTimeSlots.push("".concat(overLapToTime).concat(existingPriceSlot.toTime));
31
+ }
32
+ return nonOverlapTimeSlots;
33
+ };
34
+ TimeSlot.prototype.getStartMinutes = function () {
35
+ return TimeSlot._getMinutes(this.fromTime);
36
+ };
37
+ TimeSlot.prototype.getEndMinutes = function () {
38
+ return TimeSlot._getMinutes(this.toTime);
39
+ };
40
+ TimeSlot.prototype.getHalfHourMinutes = function () {
41
+ var minutes = [this.getStartMinutes()];
42
+ var endMinutes = this.getEndMinutes();
43
+ while (minutes[minutes.length - 1] < endMinutes) {
44
+ minutes.push(minutes[minutes.length - 1] + 30);
45
+ }
46
+ return minutes;
47
+ };
48
+ TimeSlot.prototype.getHalfHourTimeCodes = function () {
49
+ return this.getHalfHourMinutes().map(function (minute) {
50
+ return TimeSlot.convertToCode(minute);
51
+ });
52
+ };
53
+ TimeSlot.prototype.getHalfHourTimeRangeCodes = function () {
54
+ var halfHourCodes = this.getHalfHourTimeCodes();
55
+ var halfHourRangeCodes = [];
56
+ for (var index = 0; index < halfHourCodes.length - 1; index++) {
57
+ halfHourRangeCodes.push(halfHourCodes[index] + halfHourCodes[index + 1]);
58
+ }
59
+ return halfHourRangeCodes;
60
+ };
61
+ TimeSlot.prototype.getTotalMinutes = function () {
62
+ return this.getEndMinutes() - this.getStartMinutes();
63
+ };
64
+ // static padStart(timeCode: string, length: number, padString: string): string {
65
+ // return timeCode.padStart(length, padString);
66
+ // }
67
+ TimeSlot.convertToCode = function (minute) {
68
+ return "".concat(Math.floor(minute / 60)
69
+ .toString()
70
+ .padStart(2, "0")).concat(Math.floor(minute % 60)
71
+ .toString()
72
+ .padStart(2, "0"));
73
+ };
74
+ TimeSlot._getMinutes = function (timeCode) {
75
+ return parseInt(timeCode.slice(0, 2)) * 60 + parseInt(timeCode.slice(2, 4));
76
+ };
77
+ TimeSlot.getHalfHourTimeCodes = function () {
78
+ var minutes = [0];
79
+ var endMinutes = 24 * 60;
80
+ while (minutes[minutes.length - 1] < endMinutes) {
81
+ minutes.push(minutes[minutes.length - 1] + 30);
82
+ }
83
+ return minutes.map(function (minute) { return TimeSlot.convertToCode(minute); });
84
+ };
85
+ TimeSlot.getHalfHourTimeRangeCodes = function () {
86
+ var halfHourCodes = TimeSlot.getHalfHourTimeCodes();
87
+ var halfHourRangeCodes = [];
88
+ for (var index = 0; index < halfHourCodes.length - 1; index++) {
89
+ halfHourRangeCodes.push(halfHourCodes[index] + halfHourCodes[index + 1]);
90
+ }
91
+ return halfHourRangeCodes;
92
+ };
93
+ return TimeSlot;
94
+ }());
95
+ exports.TimeSlot = TimeSlot;
@@ -0,0 +1,4 @@
1
+ export type IAppBadRequestException = {
2
+ key: string;
3
+ message: string[];
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { BookingCode } from "../models/booking-code-model";
2
+ export type IBookingModification = {
3
+ oldBookingCode: BookingCode;
4
+ newBookingCode?: BookingCode;
5
+ cancellationUnit?: string;
6
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
- "main": "index.js",
5
+ "main": "./build/index.js",
6
+ "types": "./build/index.d.ts",
7
+ "files": [
8
+ "build/**/*"
9
+ ],
6
10
  "scripts": {
11
+ "clean": "del build",
12
+ "build": "npm run clean && tsc",
7
13
  "test": "echo \"Error: no test specified\" && exit 1"
8
14
  },
9
15
  "repository": {
@@ -12,5 +18,9 @@
12
18
  },
13
19
  "keywords": [],
14
20
  "author": "",
15
- "license": "ISC"
21
+ "license": "ISC",
22
+ "devDependencies": {
23
+ "del-cli": "^5.1.0",
24
+ "typescript": "^5.2.2"
25
+ }
16
26
  }