UNPKG

zaions-tool-kit

Version:

Zaions Tool Kit, this is generic tool kit package created by Zaions Dev Team (https://zaions.com), there are two other packages named "@zaionsofficial/server-tool-kit" and "@zaionsofficial/client-tool-kit" while this package is generic and contains code w

2 lines 17.5 kB
'use strict';var N=require('dayjs');require('crypto-js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var N__default=/*#__PURE__*/_interopDefault(N);var R=(c,r,a=true)=>{try{let p={err:c,message:`[reportCustomError] - ${r!=null?r:""}`};a&&console.error(p);}catch(p){console.error({err:p});}};var i=(c,r="Duplicate enumObject value found:")=>{let a=Object.values(c),p=new Set;for(let n of a){if(p.has(n))throw new Error(`${r} ${n}, for enumObject: ${c}`);p.add(n);}};var T=(d=>(d[d.superAdmin=1]="superAdmin",d[d.admin=2]="admin",d[d.manager=3]="manager",d[d.editor=4]="editor",d[d.creator=5]="creator",d[d.reviewer=6]="reviewer",d[d.player=7]="player",d[d.engager=8]="engager",d))(T||{}),b=(e=>(e[e.viewDashboard=1]="viewDashboard",e[e.hideEarnings=2]="hideEarnings",e[e.hideProfile=3]="hideProfile",e[e.listUsers=4]="listUsers",e[e.viewUser=5]="viewUser",e[e.createUser=6]="createUser",e[e.updateUser=7]="updateUser",e[e.deleteUser=8]="deleteUser",e[e.forceDeleteUser=9]="forceDeleteUser",e[e.blockUser=10]="blockUser",e[e.unBlockUser=11]="unBlockUser",e[e.updateUserBalance=12]="updateUserBalance",e[e.viewTrashedUsers=13]="viewTrashedUsers",e[e.viewTrashedUser=14]="viewTrashedUser",e[e.listGames=15]="listGames",e[e.viewGame=16]="viewGame",e[e.createGame=17]="createGame",e[e.updateGame=18]="updateGame",e[e.deleteGame=19]="deleteGame",e[e.forceDeleteGame=20]="forceDeleteGame",e[e.blockGame=21]="blockGame",e[e.unBlockGame=22]="unBlockGame",e[e.viewTrashedGames=23]="viewTrashedGames",e[e.viewTrashedGame=24]="viewTrashedGame",e[e.listGameRooms=25]="listGameRooms",e[e.viewGameRoom=26]="viewGameRoom",e[e.createGameRoom=27]="createGameRoom",e[e.updateGameRoom=28]="updateGameRoom",e[e.deleteGameRoom=29]="deleteGameRoom",e[e.forceDeleteGameRoom=30]="forceDeleteGameRoom",e[e.blockGameRoom=31]="blockGameRoom",e[e.unBlockGameRoom=32]="unBlockGameRoom",e[e.createPrivateGameRoom=33]="createPrivateGameRoom",e[e.viewTrashedGameRooms=34]="viewTrashedGameRooms",e[e.viewTrashedGameRoom=35]="viewTrashedGameRoom",e[e.listTopupRequests=36]="listTopupRequests",e[e.viewTopupRequest=37]="viewTopupRequest",e[e.createTopupRequest=38]="createTopupRequest",e[e.updateTopupRequest=39]="updateTopupRequest",e[e.deleteTopupRequest=40]="deleteTopupRequest",e[e.forceDeleteTopupRequest=41]="forceDeleteTopupRequest",e[e.reviewTopupRequest=42]="reviewTopupRequest",e[e.viewTrashedTopupRequests=43]="viewTrashedTopupRequests",e[e.viewTrashedTopupRequest=44]="viewTrashedTopupRequest",e[e.listWithdrawRequests=45]="listWithdrawRequests",e[e.viewWithdrawRequest=46]="viewWithdrawRequest",e[e.createWithdrawRequest=47]="createWithdrawRequest",e[e.updateWithdrawRequest=48]="updateWithdrawRequest",e[e.deleteWithdrawRequest=49]="deleteWithdrawRequest",e[e.forceDeleteWithdrawRequest=50]="forceDeleteWithdrawRequest",e[e.reviewWithdrawRequest=51]="reviewWithdrawRequest",e[e.viewTrashedWithdrawRequests=52]="viewTrashedWithdrawRequests",e[e.viewTrashedWithdrawRequest=53]="viewTrashedWithdrawRequest",e[e.listRoles=54]="listRoles",e[e.viewRole=55]="viewRole",e[e.createRole=56]="createRole",e[e.updateRole=57]="updateRole",e[e.deleteRole=58]="deleteRole",e[e.forceDeleteRole=59]="forceDeleteRole",e[e.reviewRole=60]="reviewRole",e[e.viewTrashedRoles=61]="viewTrashedRoles",e[e.viewTrashedRole=62]="viewTrashedRole",e[e.attachRole=63]="attachRole",e[e.removeRole=64]="removeRole",e[e.addListPermissionsToRole=65]="addListPermissionsToRole",e[e.addViewPermissionsToRole=66]="addViewPermissionsToRole",e[e.addCreatePermissionsToRole=67]="addCreatePermissionsToRole",e[e.addUpdatePermissionsToRole=68]="addUpdatePermissionsToRole",e[e.addForceDeletePermissionsToRole=69]="addForceDeletePermissionsToRole",e[e.addListTrashedPermissionsToRole=70]="addListTrashedPermissionsToRole",e[e.addViewTrashedPermissionsToRole=71]="addViewTrashedPermissionsToRole",e[e.addReviewPermissionsToRole=72]="addReviewPermissionsToRole",e[e.addOtherPermissionsToRole=73]="addOtherPermissionsToRole",e[e.listTransferCoinsRequests=74]="listTransferCoinsRequests",e[e.viewTransferCoinsRequest=75]="viewTransferCoinsRequest",e[e.listInAppNotifications=76]="listInAppNotifications",e[e.viewInAppNotification=77]="viewInAppNotification",e[e.createInAppNotification=78]="createInAppNotification",e[e.updateInAppNotification=79]="updateInAppNotification",e[e.deleteInAppNotification=80]="deleteInAppNotification",e[e.forceDeleteInAppNotification=81]="forceDeleteInAppNotification",e[e.viewTrashedInAppNotifications=82]="viewTrashedInAppNotifications",e[e.viewTrashedInAppNotification=83]="viewTrashedInAppNotification",e[e.sendInAppNotificationToAllPlayers=84]="sendInAppNotificationToAllPlayers",e[e.sendInAppNotificationToAllAdminLevelUsers=85]="sendInAppNotificationToAllAdminLevelUsers",e[e.sendInAppNotificationToSpecificPlayers=86]="sendInAppNotificationToSpecificPlayers",e[e.sendInAppNotificationToSpecificAdminLevelUsers=87]="sendInAppNotificationToSpecificAdminLevelUsers",e[e.scheduleInAppNotifications=88]="scheduleInAppNotifications",e[e.listAttachments=89]="listAttachments",e[e.viewAttachment=90]="viewAttachment",e[e.createAttachment=91]="createAttachment",e[e.updateAttachment=92]="updateAttachment",e[e.deleteAttachment=93]="deleteAttachment",e[e.forceDeleteAttachment=94]="forceDeleteAttachment",e[e.viewTrashedAttachments=95]="viewTrashedAttachments",e[e.viewTrashedAttachment=96]="viewTrashedAttachment",e[e.listAppSettings=97]="listAppSettings",e[e.viewAppSetting=98]="viewAppSetting",e[e.createAppSetting=99]="createAppSetting",e[e.updateAppSetting=100]="updateAppSetting",e[e.deleteAppSetting=101]="deleteAppSetting",e[e.forceDeleteAppSetting=102]="forceDeleteAppSetting",e[e.viewTrashedAppSettings=103]="viewTrashedAppSettings",e[e.viewTrashedAppSetting=104]="viewTrashedAppSetting",e[e.listTransactions=105]="listTransactions",e[e.viewTransaction=106]="viewTransaction",e[e.createTransaction=107]="createTransaction",e[e.updateTransaction=108]="updateTransaction",e[e.deleteTransaction=109]="deleteTransaction",e[e.forceDeleteTransaction=110]="forceDeleteTransaction",e[e.viewTrashedTransactions=111]="viewTrashedTransactions",e[e.viewTrashedTransaction=112]="viewTrashedTransaction",e[e.listPlaces=113]="listPlaces",e[e.viewPlace=114]="viewPlace",e[e.createPlace=115]="createPlace",e[e.updatePlace=116]="updatePlace",e[e.deletePlace=117]="deletePlace",e[e.forceDeletePlace=118]="forceDeletePlace",e[e.viewTrashedPlaces=119]="viewTrashedPlaces",e[e.viewTrashedPlace=120]="viewTrashedPlace",e[e.restoreTrashedPlace=121]="restoreTrashedPlace",e[e.blockPlace=122]="blockPlace",e[e.unBlockPlace=123]="unBlockPlace",e[e.restoreTrashedUser=124]="restoreTrashedUser",e[e.restoreTrashedGame=125]="restoreTrashedGame",e[e.restoreTrashedGameRoom=126]="restoreTrashedGameRoom",e[e.restoreTrashedTopupRequest=127]="restoreTrashedTopupRequest",e[e.restoreTrashedWithdrawRequest=128]="restoreTrashedWithdrawRequest",e[e.restoreTrashedRole=129]="restoreTrashedRole",e[e.restoreTrashedInAppNotification=130]="restoreTrashedInAppNotification",e[e.restoreTrashedAttachment=131]="restoreTrashedAttachment",e[e.restoreTrashedAppSetting=132]="restoreTrashedAppSetting",e[e.restoreTrashedTransaction=133]="restoreTrashedTransaction",e[e.addCoinsToUserAccount=134]="addCoinsToUserAccount",e[e.removeCoinsFromUserAccount=135]="removeCoinsFromUserAccount",e[e.listAdminCoinsUpdateLogs=136]="listAdminCoinsUpdateLogs",e[e.viewAdminCoinsUpdateLog=137]="viewAdminCoinsUpdateLog",e[e.listUserDetails=138]="listUserDetails",e[e.viewUserDetail=139]="viewUserDetail",e[e.createUserDetail=140]="createUserDetail",e[e.updateUserDetail=141]="updateUserDetail",e[e.deleteUserDetail=142]="deleteUserDetail",e[e.forceDeleteUserDetail=143]="forceDeleteUserDetail",e[e.viewTrashedUserDetails=144]="viewTrashedUserDetails",e[e.viewTrashedUserDetail=145]="viewTrashedUserDetail",e))(b||{}),I=(d=>(d.superAdmin="197g24g-28h3v2g9g972g3f",d.admin="28h3v2g9g9--72g3f",d.manager="38h3vrv3-ion2g9g97-2g3f",d.editor="48h3v2g9g97-2g3f",d.creator="58h3v2g9g8h-972g3f",d.reviewer="68h-3v2g9g972g3f",d.player="78h3v2g9-g972g3f",d.engager="8hfrfr----8h3v2g9-g972g3f",d))(I||{}),G=(p=>(p[p.viewTrashedItem=1]="viewTrashedItem",p[p.viewTrashedItems=2]="viewTrashedItems",p[p.viewBlockedItem=3]="viewBlockedItem",p))(G||{}),U=(a=>(a[a.every=1]="every",a[a.any=2]="any",a))(U||{});i(T,"Duplicate RoleEnum value found:");i(U,"Duplicate PermissionCheckModeEnum value found:");i(b,"Duplicate PermissionEnum value found:");i(I,"Duplicate _UserRoleEnum value found:");i(G,"Duplicate PermissionTypeEnum value found:");var L;(L=Object.keys(b))==null?void 0:L.filter(c=>isNaN(Number(c)));var O=["role","permission","forcedelete","trashed","transaction","appsetting","inappnotification","restore","addcoin","removecoin","admincoin"],x=[...O,"user","delete","topuprequest","withdrawrequest","transfercoinsrequest"],A=[...x,"edit","update","review"];[...A==null?void 0:A.filter(c=>c!=="review"),"create","add","hide"];var w=(t=>(t.id="id",t.userId="uid",t.sortOrderNo="so",t.createdAt="cat",t.updatedAt="uat",t.deletedAt="dat",t.blockedAt="bat",t.amount="am",t.userData="ud",t.playerId="pid",t.otherPlayerId="opid",t.extraData="ed",t.playerData="pdt",t.name="n",t.email="e",t.phoneNumber="pn",t.password="pw",t.withdrawOptions="wos",t.cnic="cn",t.city="ci",t.country="cu",t.address="ad",t.referredBy="rfb",t.referralCode="rfc",t.permissions="pms",t.emailVerifiedAt="eva",t.balance="blc",t.role="r",t.firstName="fn",t.lastName="lne",t.age="a",t.gender="g",t.constellation="const",t.hometown="ht",t.language="lang",t.profileCompletePercentageNumber="pcpn",t.birthdayDate="bdt",t.aboutMe="abm",t.hobbies="hs",t.lifeStyle="ls",t.music="mc",t.movies="mos",t.travel="tl",t.books="bks",t.gym="gm",t.food="f",t.cleanliness="cln",t.smoke="sk",t.pets="ps",t.guests="gts",t.occupation="o",t.foodPreference="fp",t.workSchedule="ws",t.overnightGuests="ogs",t.getUpTime="gut",t.goToBedTime="gtt",t.roomPreference="rp",t.roommatePreference="rmp",t.whereWantToLive="wwtl",t.moveInDate="mid",t.budget="b",t.placePreference="pp",t.buildingType="bt",t.other="ot",t.min="mi",t.max="ma",t.verificationCode="vc",t.title="t",t.description="d",t.maxPlayersAllowed="mxpa",t.feePerPlayer="fpp",t.serviceCharges="scs",t.image="i",t.minPlayersToStartGame="mipa",t.isPrivate="ipt",t.roomCode="rcd",t.status="st",t.gameId="gid",t.gameRoomPlayerIds="grpsd",t.gameRoomWillStartAt="grwsat",t.firstPlayerGameRoomJoinedAt="fpgrja",t.engagerStartedTheActualGameAt="estaga",t.gameRoomWinnerPlayerId="grwpid",t.gameRoomResultScreenShot="grrss",t.timerForEngagerToStartActualGameInMinutes="tfetsag",t.timerForPlayersToJoinActualGameInMinutes="tfptjag",t.actualGameInfo="agi",t.gameData="gd",t.engagerReleasedGameRoomAt="ergrat",t.engagerDeclaredGameRoomWinnerAt="edgrat",t.agentRemarks="ars",t.transferMethod="tm",t.receptScreenshot="rs",t.transactionId="tid",t.itemId="itid",t.balanceBefore="bb",t.balanceAfter="ba",t.type="ty",t.adminUserId="auid",t.logType="lt",t.userRemarks="urs",t.otherPlayerPhoneNumber="oppn",t.otherPlayerName="opn",t.totalTopupCoins="ttcs",t.totalWithdrawCoins="twcs",t.totalWonCoins="twncs",t.totalTransferredCoins="ttdcs",t.totalReceivedCoins="trcs",t.totalLostCoins="tlcs",t.totalGamesPlayed="tgp",t.totalGamesLeft="tglt",t.totalGamesWon="tgw",t.totalGamesLost="tgl",t.gameWinStreak="gwst",t.gameLostStreak="glst",t.lastGamePlayedAt="lgpat",t.lastGameLeftAt="lglfat",t.lastGameWonAt="lgqat",t.lastGameLostAt="lglat",t.totalGameRoomReleasedForThisPlayer="tgrrftp",t.lastGameRoomReleasedForThisPlayerAt="tgrrftpat",t.totalGameRoomReleasedByThisAdminUser="tgrrbtau",t.lastGameRoomReleasedByThisAdminUserAt="tgrrbtauat",t.totalCoinsEarnedAsGameRoomEngager="tcseagre",t.totalGameRoomsCompletedAsEngager="tgrcae",t.lastGameRoomsCompletedAsEngagerAt="lgrcaeat",t.icon="ic",t.sendAt="sat",t.sendTo="sto",t.specificUsersPhoneNumbers="supns",t.roleIdentifier="ri",t.isDefault="idf",t.totalCount="tc",t.totalSoftDeletedCount="tsdc",t.totalPlayersCount="tpsc",t.totalEngagersCount="tesc",t.totalAdminsCount="tasc",t.totalActiveCount="tac",t.totalBlockedCount="tbc",t.totalCompletedCount="tcc",t.totalReleasedCount="trc",t.totalServiceCharges="tsc",t.period="ped",t.currency="cuy",t.place="pl",t.rent="re",t.generalInfo="gi",t.location="loc",t.images="ims",t.details="dts",t.latitude="lat",t.longitude="lng",t.placeId="pi",t.streetAddress="sa",t.apartmentSuit="as",t.province="pvn",t.postCode="psc",t.bedroomImages="bris",t.washroomImages="wris",t.kitchenImages="kis",t.otherImages="ois",t.availabilityTerm="abt",t.moveOutDate="mud",t.minimumLease="mil",t.houseInfo="hif",t.otherRequirements="ors",t.placeSharingDetail="psd",t.placeBenefits="pbs",t.leaseTime="lti",t.leaseTimeUnit="ltu",t.bedrooms="bds",t.washrooms="wrs",t.parking="pr",t.units="us",t.detail="dl",t.bedroom="br",t.livingRoom="lr",t.kitchen="kc",t.washroom="wr",t.livingWithLandlord="lwld",t.livingWithPersonDetails="lwpd",t.furnished="fh",t.benefits="bs",t.otherBenefits="obs",t.body="bd",t.content="ct",t.fcmDeviceToken="fcmt",t.fcmDeviceTokens="fcmts",t.apnsDeviceToken="apnt",t.apnsDeviceTokens="apnts",t.subtitle="ste",t.tag="tg",t.tags="tgs",t.badge="bge",t.notification="ncn",t.notifications="ncns",t.data="dt",t.clickAction="ca",t.link="ln",t.group="gp",t.groupSummary="gs",t.sound="sd",t.importance="ipe",t.visibility="vsb",t.light="lh",t.lights="lhs",t.lightColor="lcr",t.vibration="vbr",t.channel="cl",t.channels="cls",t.receive="rce",t.value="vle",t.actionId="aid",t.inputValue="ipv",t.gameType="gt",t.thirdPartyAppsData="tpasd",t.thirdPartyAppData="tpad",t.pubgAppId="pgai",t.uniqueId="uqid",t.userUniqueId="uuqid",t.photoURL="pul",t.displayName="dn",t.ludoStarAppId="lsaid",t.freeFireAppId="ffaid",t.callOfDutyAppId="codaid",t.robloxAppId="rxaid",t.eightBallPoolAppId="ebpaid",t.amongUsAppId="auaid",t.unoAppId="uoaid",t.miniMilitiaAppId="mmaid",t.carromAppId="cmaid",t.tennisClashAppId="tcaid",t.chessAppId="chaid",t.asphalt9AppId="a9aid",t.golfBattleAppId="gbaid",t.arenaBreakoutAppId="abaid",t))(w||{}),h=(a=>(a.asc="asc",a.desc="desc",a))(h||{}),$=(l=>(l.lessThan="<",l.lessThanOrEqualTo="<=",l.equalTo="==",l.notEqual="!=",l.greaterThanOrEqualTo=">=",l.greaterThan=">",l.arrayContains="array-contains",l.inArray="in",l.notInArray="not-in",l.arrayContainsAny="array-contains-any",l))($||{});i(w,"Duplicate DBColumnKeysShortFormEnum value found:");i(h,"Duplicate FrbOrderbyDirectionEnum value found:");i($,"Duplicate FrbWhereConditionEnum value found:");var u=(g=>(g.success="success",g.failed="failed",g.notFound="notFound",g.badRequest="badRequest",g.serverError="serverError",g.created="created",g.deleted="deleted",g.updated="updated",g.tooManyRequests="tooManyRequests",g.invalidRequest="invalidRequest",g.unAuthenticated="unAuthenticated",g.unAuthorized="unAuthorized",g.itemExists="itemExists",g))(u||{}),j=(l=>(l[l.success=200]="success",l[l.failed=500]="failed",l[l.notFound=404]="notFound",l[l.badRequest=400]="badRequest",l[l.created=201]="created",l[l.unAuthenticated=401]="unAuthenticated",l[l.unAuthorized=403]="unAuthorized",l[l.tooManyRequests=429]="tooManyRequests",l[l.invalidRequest=410]="invalidRequest",l[l.itemExists=10001]="itemExists",l))(j||{}),W=(n=>(n.get="get",n.post="post",n.put="put",n.delete="delete",n))(W||{}),H=(r=>(r.blank="_blank",r))(H||{}),Y=(r=>(r.encryptedDataSearchParam="s",r))(Y||{}),q=(a=>(a.Json="application/json",a.FormData="multipart/form-data",a))(q||{}),Z=(a=>(a[a.approved=1]="approved",a[a.rejected=2]="rejected",a))(Z||{}),J=(a=>(a[a.easypaisa=1]="easypaisa",a[a.jazzcash=2]="jazzcash",a))(J||{}),_=(o=>(o[o.id=1]="id",o[o.roomCode=2]="roomCode",o[o.email=3]="email",o[o.phoneNumber=4]="phoneNumber",o[o.uniqueId=5]="uniqueId",o[o.pubgAppId=6]="pubgAppId",o))(_||{}),X=(a=>(a[a.completed=1]="completed",a[a.rejected=2]="rejected",a))(X||{}),Q=(a=>(a[a.true=1]="true",a[a.false=0]="false",a))(Q||{}),y=(o=>(o.STRING="string",o.OBJECT="object",o.ARRAY="array",o.boolean="boolean",o.NUMBER="number",o.FUNCTION="function",o))(y||{}),D=(p=>(p.web="web",p.android="android",p.ios="ios",p))(D||{}),M=(f=>(f.Years="years",f.Months="months",f.Days="days",f.Hours="hours",f.Minutes="minutes",f.Seconds="seconds",f.Milliseconds="milliseconds",f))(M||{});i(D,"duplicate values in PlatformTypeEnum");i(u,"duplicate values in ResponseCodeEnum");i(j,"duplicate values in ResponseStatusEnum");i(W,"duplicate values in RequestTypeEnum");i(H,"duplicate values in LinkTargetEnum");i(Y,"duplicate values in SearchParamKeysEnum");i(q,"duplicate values in RequestContentTypeEnum");i(Z,"duplicate values in RequestStatusEnum");i(J,"duplicate values in TransferMethodEnum");i(_,"duplicate values in QueryKeyTypeEnum");i(X,"duplicate values in ProcessStatusEnum");i(Q,"duplicate values in BooleanEnum");i(y,"duplicate values in varTypesEnum");i(M,"duplicate values in TimeUnitEnum");var k=c=>{var r;return c!=null&&((r=c==null?void 0:c.trim())==null?void 0:r.length)>0};var z=c=>{var r;return (r=new Date(c))==null?void 0:r.toISOString()},ae=({val:c})=>{var a;let r=N__default.default(c);return c&&(r!=null&&r.isValid())?(a=r==null?void 0:r.toDate())==null?void 0:a.getTime():null},re=c=>{try{if(k(c)){let r=N__default.default(c);if(r!=null&&r.isValid()){let a=r==null?void 0:r.diff(N__default.default(new Date),"milliseconds");return Date.now()+a}else return 0}else return 0}catch(r){return R(r),0}};exports.convertToDateTimestampToStoreInDB=ae;exports.getDateFromFrbTimestamp=z;exports.getRemainingTimeForCountDown=re;//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map