@boozybats/shared
Advanced tools
Comparing version 1.1.28 to 1.1.29
@@ -20,2 +20,3 @@ "use strict"; | ||
__exportStar(require("./user"), exports); | ||
__exportStar(require("./promoCode"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -112,6 +112,48 @@ "use strict"; | ||
}, | ||
promoCodeTemplate: { | ||
required: false, | ||
default: null, | ||
type: { | ||
name: { | ||
required: false, | ||
default: null, | ||
type: String, | ||
}, | ||
expiresAt: { | ||
required: false, | ||
default: null, | ||
type: Number, | ||
}, | ||
duration: { | ||
required: false, | ||
default: null, | ||
type: Number, | ||
}, | ||
gamesAccess: { | ||
required: false, | ||
default: null, | ||
type: Object.keys(index_1.availableGames).reduce(function (acc, game) { | ||
acc[game] = { | ||
required: false, | ||
type: Boolean, | ||
}; | ||
return acc; | ||
}, {}), | ||
}, | ||
tokens: { | ||
required: false, | ||
default: null, | ||
type: Number, | ||
}, | ||
}, | ||
}, | ||
usedPromoCodes: { | ||
required: false, | ||
default: [], | ||
type: [String], | ||
type: [ | ||
{ | ||
type: mongoose_1.Types.ObjectId, | ||
ref: 'promoCode', | ||
}, | ||
], | ||
}, | ||
@@ -118,0 +160,0 @@ tokens: { |
@@ -6,2 +6,3 @@ import { Document } from 'mongoose'; | ||
import { MenuContext, Rarity, Stack } from '../../types'; | ||
import { PromoCode, PromoCodeTemplate } from '../promoCode'; | ||
export interface ForgeStack { | ||
@@ -30,3 +31,4 @@ model: string; | ||
waitingInput: string | null; | ||
usedPromoCodes: string[]; | ||
promoCodeTemplate: PromoCodeTemplate | null; | ||
usedPromoCodes: PromoCode[]; | ||
tokens: number; | ||
@@ -33,0 +35,0 @@ gamesData: { |
@@ -39,3 +39,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.paginationTransaction = exports.formatFloat = exports.escapeMarkdown2Characters = void 0; | ||
exports.paginationTransaction = exports.formatDateToTimePeriod = exports.formatFloat = exports.escapeMarkdown2Characters = void 0; | ||
var escapeMarkdown2Characters = function (text) { | ||
@@ -57,2 +57,32 @@ return text.replace(/([_\-*[\]()~`>#+=|{}.!])/g, '\\$1'); | ||
exports.formatFloat = formatFloat; | ||
var formatDateToTimePeriod = function (date) { | ||
var periods = ['ms', 'sec', 'min', 'hour', 'day', 'week', 'month', 'year']; | ||
var values = [ | ||
1, | ||
1000, | ||
1000 * 60, | ||
1000 * 60 * 60, | ||
1000 * 60 * 60 * 24, | ||
1000 * 60 * 60 * 24 * 7, | ||
1000 * 60 * 60 * 24 * 30, | ||
1000 * 60 * 60 * 24 * 365, | ||
]; | ||
var value = 0; | ||
var period = 'ms'; | ||
for (var i = 0; i < values.length; i++) { | ||
if (date < values[i]) { | ||
break; | ||
} | ||
if (date % values[i] !== 0) { | ||
continue; | ||
} | ||
value = date / values[i]; | ||
period = periods[i]; | ||
} | ||
return { | ||
value: value, | ||
period: period, | ||
}; | ||
}; | ||
exports.formatDateToTimePeriod = formatDateToTimePeriod; | ||
var paginationTransaction = function (model, callback, options, sort) { | ||
@@ -59,0 +89,0 @@ if (options === void 0) { options = { |
@@ -157,2 +157,4 @@ import { Document as Document_2 } from 'mongoose'; | ||
export declare const createPromoCodeSchema: GetSchema; | ||
export declare const createRecipeSchema: GetSchema; | ||
@@ -190,2 +192,7 @@ | ||
export declare const formatDateToTimePeriod: (date: number) => { | ||
value: number; | ||
period: TimePeriod; | ||
}; | ||
export declare const formatFloat: (value: number, options?: { | ||
@@ -299,2 +306,25 @@ precision?: number | undefined; | ||
export declare interface PromoCode extends Document_2 { | ||
name: string; | ||
expiresAt: number | null; | ||
duration: number | null; | ||
gamesAccess: { | ||
[key in GameKey]: boolean | null; | ||
} | null; | ||
tokens: number | null; | ||
activatesCount: number; | ||
isDeleted: boolean; | ||
createdAt: number; | ||
} | ||
export declare interface PromoCodeTemplate { | ||
name: string | null; | ||
expiresAt: number | null; | ||
duration: number | null; | ||
gamesAccess: { | ||
[key in GameKey]: boolean | null; | ||
} | null; | ||
tokens: number | null; | ||
} | ||
export declare const rarities: readonly ["common", "uncommon", "rare", "epic", "legendary"]; | ||
@@ -367,2 +397,4 @@ | ||
export declare type TimePeriod = 'ms' | 'sec' | 'min' | 'hour' | 'day' | 'week' | 'month' | 'year'; | ||
export declare interface User extends Document_2 { | ||
@@ -386,3 +418,4 @@ userId: number; | ||
waitingInput: string | null; | ||
usedPromoCodes: string[]; | ||
promoCodeTemplate: PromoCodeTemplate | null; | ||
usedPromoCodes: PromoCode[]; | ||
tokens: number; | ||
@@ -389,0 +422,0 @@ gamesData: { |
@@ -125,3 +125,2 @@ "use strict"; | ||
exports.rarities = ['common', 'uncommon', 'rare', 'epic', 'legendary']; | ||
__exportStar(require("./types/schema.type"), exports); | ||
__exportStar(require("./helpers"), exports); | ||
@@ -128,0 +127,0 @@ __exportStar(require("./types"), exports); |
@@ -23,2 +23,3 @@ "use strict"; | ||
__exportStar(require("./helper.type"), exports); | ||
__exportStar(require("./date.type"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@boozybats/shared", | ||
"version": "1.1.28", | ||
"version": "1.1.29", | ||
"description": "private shared package", | ||
@@ -11,3 +11,4 @@ "main": "lib/index.js", | ||
"clear:declarations": "rimraf ./lib/*.d.ts && rimraf ./lib/**/*.d.ts", | ||
"tsc:start": "tsc -p ./tsconfig.json", | ||
"tsc:start": "tsc -p ./tsconfig.build.json", | ||
"test": "jest", | ||
"lint:fix": "eslint --fix ./src", | ||
@@ -22,2 +23,3 @@ "prettier:fix": "prettier --write .", | ||
"@microsoft/api-extractor": "^7.36.4", | ||
"@types/jest": "^29.5.4", | ||
"@typescript-eslint/eslint-plugin": "5.59.6", | ||
@@ -28,6 +30,7 @@ "@typescript-eslint/parser": "5.62.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"jest": "29.6.2", | ||
"jest": "^29.6.2", | ||
"prettier": "2.8.8", | ||
"rimraf": "^5.0.1", | ||
"standard-version": "9.5.0", | ||
"ts-jest": "^29.1.1", | ||
"typescript": "4.5.5" | ||
@@ -34,0 +37,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
116873
107
2549
13