turf-common 1.2.1-beta.8 → 1.3.0
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/build/@enum.d.ts +2 -0
- package/build/@enum.js +2 -0
- package/build/@model.d.ts +1 -0
- package/build/@model.js +1 -0
- package/build/@type.d.ts +2 -0
- package/build/@type.js +2 -0
- package/build/@utils.d.ts +1 -0
- package/build/@utils.js +1 -0
- package/build/enums/availability-view.enum.d.ts +4 -0
- package/build/enums/availability-view.enum.js +8 -0
- package/build/enums/booking-history-operation-type.enum.d.ts +4 -2
- package/build/enums/booking-history-operation-type.enum.js +4 -2
- package/build/enums/environment.enum.d.ts +5 -0
- package/build/enums/environment.enum.js +9 -0
- package/build/enums/valid-coupon-type.enum.d.ts +3 -1
- package/build/enums/valid-coupon-type.enum.js +2 -0
- package/build/interface/api/create-recurring-slot-booking.interface.d.ts +4 -1
- package/build/interface/api/get-availability-by-turf.interface.d.ts +29 -0
- package/build/interface/api/get-availability-by-turf.interface.js +2 -0
- package/build/interface/api/get-tournament.interface.d.ts +4 -0
- package/build/interface/api/get-tournament.interface.js +2 -0
- package/build/interface/api/index.d.ts +2 -0
- package/build/interface/api/index.js +2 -0
- package/build/interface/api/list-of-coupons.interface.d.ts +6 -0
- package/build/interface/convert-to-midnight-time.interface.d.ts +5 -0
- package/build/interface/convert-to-midnight-time.interface.js +2 -0
- package/build/interface/entity/booking-details-entity.interface.d.ts +2 -0
- package/build/interface/entity/booking-history-entity.interface.d.ts +4 -0
- package/build/interface/get-booking-by-id.interface.d.ts +2 -3
- package/build/interface/model/charge-model.interface.d.ts +1 -0
- package/build/interface/ng-date-structure.interface.d.ts +5 -0
- package/build/interface/ng-date-structure.interface.js +2 -0
- package/build/models/booking-code-model.d.ts +35 -1
- package/build/models/booking-code-model.js +91 -6
- package/build/models/charge-model.d.ts +3 -2
- package/build/models/charge-model.js +48 -9
- package/build/models/entity/booking-details-model.d.ts +2 -0
- package/build/models/entity/subscription-model.js +3 -3
- package/build/models/turf-availability-model.d.ts +57 -0
- package/build/models/turf-availability-model.js +239 -0
- package/build/utils/constant.d.ts +2 -0
- package/build/utils/constant.js +3 -1
- package/build/utils/date-util.d.ts +40 -0
- package/build/utils/date-util.js +89 -1
- package/build/utils/string-utils.d.ts +12 -0
- package/build/utils/string-utils.js +53 -0
- package/package.json +1 -1
- package/build/utils/format-string-with-hyphens.d.ts +0 -1
- package/build/utils/format-string-with-hyphens.js +0 -7
|
@@ -14,6 +14,18 @@ declare class StringUtil {
|
|
|
14
14
|
* @returns {string} - The formatted string with hyphens.
|
|
15
15
|
*/
|
|
16
16
|
formatStringWithHyphens(inputString: string): string;
|
|
17
|
+
generateRandomPassword(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Extracts details from a coupon code.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} couponCode - The coupon code to analyze.
|
|
22
|
+
* @returns {Object} - Object with 'code' (alphabetic part) and 'value' (numeric part) properties.
|
|
23
|
+
* @throws {TypeError} - If the provided 'couponCode' is not a string.
|
|
24
|
+
*/
|
|
25
|
+
getCouponDetails(couponCode: string): {
|
|
26
|
+
code: string;
|
|
27
|
+
value: string;
|
|
28
|
+
};
|
|
17
29
|
}
|
|
18
30
|
export declare const stringUtil: StringUtil;
|
|
19
31
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stringUtil = void 0;
|
|
4
|
+
var app_badrequest_exception_1 = require("../exceptions/app-badrequest.exception");
|
|
4
5
|
var StringUtil = /** @class */ (function () {
|
|
5
6
|
function StringUtil() {
|
|
6
7
|
}
|
|
@@ -24,6 +25,58 @@ var StringUtil = /** @class */ (function () {
|
|
|
24
25
|
// Convert the input string to lowercase and replace spaces with hyphens
|
|
25
26
|
return inputString.toLowerCase().replace(/\s+/g, "-");
|
|
26
27
|
};
|
|
28
|
+
StringUtil.prototype.generateRandomPassword = function () {
|
|
29
|
+
var _a;
|
|
30
|
+
var alphabets = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
31
|
+
var numbers = "0123456789";
|
|
32
|
+
var specialChars = "!@#$%^&*?+";
|
|
33
|
+
function getRandomCharacter(characters) {
|
|
34
|
+
return characters[Math.floor(Math.random() * characters.length)];
|
|
35
|
+
}
|
|
36
|
+
var randomAlphabet = getRandomCharacter(alphabets);
|
|
37
|
+
var randomNumber = getRandomCharacter(numbers);
|
|
38
|
+
var randomSpecialChar = getRandomCharacter(specialChars);
|
|
39
|
+
var remainingCharacters = alphabets + alphabets.toLowerCase();
|
|
40
|
+
var randomRemainingChars = Array.from({ length: 3 }, function () {
|
|
41
|
+
return getRandomCharacter(remainingCharacters);
|
|
42
|
+
}).join("");
|
|
43
|
+
var passwordArray = [
|
|
44
|
+
randomAlphabet,
|
|
45
|
+
randomNumber,
|
|
46
|
+
randomSpecialChar,
|
|
47
|
+
randomRemainingChars,
|
|
48
|
+
];
|
|
49
|
+
// Shuffle the password array
|
|
50
|
+
for (var i = passwordArray.length - 1; i > 0; i--) {
|
|
51
|
+
var j = Math.floor(Math.random() * (i + 1));
|
|
52
|
+
_a = [
|
|
53
|
+
passwordArray[j],
|
|
54
|
+
passwordArray[i],
|
|
55
|
+
], passwordArray[i] = _a[0], passwordArray[j] = _a[1];
|
|
56
|
+
}
|
|
57
|
+
return passwordArray.join("");
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Extracts details from a coupon code.
|
|
61
|
+
*
|
|
62
|
+
* @param {string} couponCode - The coupon code to analyze.
|
|
63
|
+
* @returns {Object} - Object with 'code' (alphabetic part) and 'value' (numeric part) properties.
|
|
64
|
+
* @throws {TypeError} - If the provided 'couponCode' is not a string.
|
|
65
|
+
*/
|
|
66
|
+
StringUtil.prototype.getCouponDetails = function (couponCode) {
|
|
67
|
+
var code = couponCode.match(/[a-zA-Z]+/g);
|
|
68
|
+
var value = couponCode.match(/\d+/g);
|
|
69
|
+
if (!code || !value) {
|
|
70
|
+
throw new app_badrequest_exception_1.AppBadRequestException({
|
|
71
|
+
key: "couponCode",
|
|
72
|
+
message: ["coupon with code ".concat(couponCode, " is wrong ")],
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
code: code[0],
|
|
77
|
+
value: value[0],
|
|
78
|
+
};
|
|
79
|
+
};
|
|
27
80
|
return StringUtil;
|
|
28
81
|
}());
|
|
29
82
|
exports.stringUtil = new StringUtil();
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function FormatStringWithHyphens(inputString: string): string;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormatStringWithHyphens = void 0;
|
|
4
|
-
function FormatStringWithHyphens(inputString) {
|
|
5
|
-
return inputString.toLowerCase().replace(/\s+/g, "-");
|
|
6
|
-
}
|
|
7
|
-
exports.FormatStringWithHyphens = FormatStringWithHyphens;
|