Skip to content

Commit

Permalink
Merge pull request #477 from fnbrjs/master
Browse files Browse the repository at this point in the history
3.1.0
  • Loading branch information
ThisNils authored Jun 25, 2022
2 parents 55cbff2 + 77d45ea commit 73ef286
Show file tree
Hide file tree
Showing 71 changed files with 2,164 additions and 3,150 deletions.
3 changes: 2 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ version: 2
updates:
- package-ecosystem: "npm"
allow:
- dependency-type: "all"
- dependency-type: "production"
- dependency-type: "development"
directory: "/"
commit-message:
prefix: "⬆️ "
Expand Down
2 changes: 1 addition & 1 deletion docs/api examples/fortniteapicom.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { Client } = require('fnbr');

const fetchCosmetic = async (name, type) => {
try {
const cosmetic = (await axios(`https://fortnite-api.com/v2/cosmetics/br/search?name=${encodeURI(name)}&type=${type}`)).data;
const { data: cosmetic } = (await axios(`https://fortnite-api.com/v2/cosmetics/br/search?name=${encodeURI(name)}&type=${type}`)).data;
return cosmetic;
} catch (err) {
return undefined;
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/refreshtoken.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable */
const { readFile, writeFile } = require('fs').promises;
const { Client } = require('../..');
const { Client } = require('fnbr');

(async () => {
let auth;
try {
auth = { launcherRefreshToken: await readFile('./refreshToken') };
auth = { launcherRefreshToken: await readFile('./refreshToken', 'utf8') };
} catch (e) {
auth = { authorizationCode: async () => Client.consoleQuestion('Please enter an authorization code: ') };
}
Expand Down
19 changes: 19 additions & 0 deletions docs/general/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 3.1.0

### Changes
* Server Status
* **(Breaking)** `Client#getFortniteServerStatus` now returns a `FortniteServerStatus` instance
* **(Breaking)** `Client#getEpicgamesServerStatus` now returns a `EpicgamesServerStatus` instance

### Fixes
* STW Profiles
* Fixed a few issues that made `Client#getSTWProfile` incorrectly throw an error in rare cases
* Tournament Session Downloading
* Improved error handling for downloading tournament replays and tournament session metadata
* Blurl Streams
* Improvements for downloading blurl streams (blurl streams would not get parsed correctly in rare cases)
* Docs Examples
* Fixed "refreshtoken" and "fortniteapicom" examples

<hr>

## 3.0.0

### Additions
Expand Down
10 changes: 5 additions & 5 deletions enums/Enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,39 +86,39 @@ export const PartyPrivacy: Readonly<IPartyPrivacyEnum> = Object.freeze({
presencePermission: 'Anyone',
invitePermission: 'Anyone',
acceptingMembers: true,
},
} as IPartyPrivacy,
FRIENDS_ALLOW_FRIENDS_OF_FRIENDS: {
partyType: 'FriendsOnly',
inviteRestriction: 'AnyMember',
onlyLeaderFriendsCanJoin: false,
presencePermission: 'Anyone',
invitePermission: 'AnyMember',
acceptingMembers: true,
},
} as IPartyPrivacy,
FRIENDS: {
partyType: 'FriendsOnly',
inviteRestriction: 'LeaderOnly',
onlyLeaderFriendsCanJoin: true,
presencePermission: 'Leader',
invitePermission: 'Leader',
acceptingMembers: false,
},
} as IPartyPrivacy,
PRIVATE_ALLOW_FRIENDS_OF_FRIENDS: {
partyType: 'Private',
inviteRestriction: 'AnyMember',
onlyLeaderFriendsCanJoin: false,
presencePermission: 'Noone',
invitePermission: 'AnyMember',
acceptingMembers: false,
},
} as IPartyPrivacy,
PRIVATE: {
partyType: 'Private',
inviteRestriction: 'LeaderOnly',
onlyLeaderFriendsCanJoin: true,
presencePermission: 'Noone',
invitePermission: 'Leader',
acceptingMembers: false,
},
} as IPartyPrivacy,
});

export const Platform: Readonly<IPlatformEnum> = Object.freeze({
Expand Down
36 changes: 30 additions & 6 deletions generateExports.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
/* eslint-disable no-await-in-loop */
/* eslint-disable no-restricted-syntax */
const fs = require('fs').promises;
const path = require('path');

const recursiveReaddir = async (folder) => {
const resolvedFiles = [];

const files = await fs.readdir(folder);

for (const file of files) {
const filePath = path.join(folder, file);
const stat = await fs.stat(filePath);

if (stat.isDirectory()) {
resolvedFiles.push(...await recursiveReaddir(`${folder}/${file}`));
} else {
resolvedFiles.push(`${folder}/${file}`);
}
}

return resolvedFiles;
};

(async () => {
let output = '';
Expand All @@ -8,19 +30,21 @@ const fs = require('fs').promises;
+ '\n// endpoints\nexport { default as Endpoints } from \'./resources/Endpoints\';\n';

output += '\n// exceptions\n';
const exceptions = await fs.readdir('./src/exceptions');
const exceptions = await recursiveReaddir('./src/exceptions');
exceptions.sort();
exceptions.forEach((file) => {
const fileWithoutExtension = file.split('.')[0];
output += `export { default as ${fileWithoutExtension} } from './src/exceptions/${fileWithoutExtension}';\n`;
const fileWithoutExtension = file.split('/').at(-1).split('.')[0];
const filePathWithoutExtension = file.split('.').slice(0, -1).join('.');
output += `export { default as ${fileWithoutExtension} } from '${filePathWithoutExtension}';\n`;
});

output += '\n// structures\n';
const structures = await fs.readdir('./src/structures');
const structures = await recursiveReaddir('./src/structures');
structures.sort();
structures.forEach((file) => {
const fileWithoutExtension = file.split('.')[0];
output += `export { default as ${fileWithoutExtension} } from './src/structures/${fileWithoutExtension}';\n`;
const fileWithoutExtension = file.split('/').at(-1).split('.')[0];
const filePathWithoutExtension = file.split('.').slice(0, -1).join('.');
output += `export { default as ${fileWithoutExtension} } from '${filePathWithoutExtension}';\n`;
});

await fs.writeFile('./index.ts', output);
Expand Down
95 changes: 50 additions & 45 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,59 +35,64 @@ export { default as UserNotFoundError } from './src/exceptions/UserNotFoundError

// structures
export { default as Avatar } from './src/structures/Avatar';
export { default as BaseFriendMessage } from './src/structures/BaseFriendMessage';
export { default as BaseMessage } from './src/structures/BaseMessage';
export { default as BasePartyInvitation } from './src/structures/BasePartyInvitation';
export { default as BasePartyJoinRequest } from './src/structures/BasePartyJoinRequest';
export { default as BasePendingFriend } from './src/structures/BasePendingFriend';
export { default as BlockedUser } from './src/structures/BlockedUser';
export { default as ClientParty } from './src/structures/ClientParty';
export { default as ClientPartyMember } from './src/structures/ClientPartyMember';
export { default as ClientPartyMemberMeta } from './src/structures/ClientPartyMemberMeta';
export { default as ClientPartyMeta } from './src/structures/ClientPartyMeta';
export { default as ClientUser } from './src/structures/ClientUser';
export { default as CreatorCode } from './src/structures/CreatorCode';
export { default as EpicgamesServerStatus } from './src/structures/EpicgamesServerStatus';
export { default as EpicgamesServerStatusComponent } from './src/structures/EpicgamesServerStatusComponent';
export { default as EpicgamesServerStatusIncident } from './src/structures/EpicgamesServerStatusIncident';
export { default as EpicgamesServerStatusScheduledMainteance } from './src/structures/EpicgamesServerStatusScheduledMainteance';
export { default as EventTokens } from './src/structures/EventTokens';
export { default as Friend } from './src/structures/Friend';
export { default as FriendPresence } from './src/structures/FriendPresence';
export { default as FortniteServerStatus } from './src/structures/FortniteServerStatus';
export { default as GlobalProfile } from './src/structures/GlobalProfile';
export { default as Image } from './src/structures/Image';
export { default as IncomingPendingFriend } from './src/structures/IncomingPendingFriend';
export { default as NewsMessage } from './src/structures/NewsMessage';
export { default as NewsMessageVideo } from './src/structures/NewsMessageVideo';
export { default as OutgoingPendingFriend } from './src/structures/OutgoingPendingFriend';
export { default as Party } from './src/structures/Party';
export { default as PartyChat } from './src/structures/PartyChat';
export { default as PartyMember } from './src/structures/PartyMember';
export { default as PartyMemberConfirmation } from './src/structures/PartyMemberConfirmation';
export { default as PartyMemberMeta } from './src/structures/PartyMemberMeta';
export { default as PartyMessage } from './src/structures/PartyMessage';
export { default as PartyMeta } from './src/structures/PartyMeta';
export { default as PresenceParty } from './src/structures/PresenceParty';
export { default as RadioStation } from './src/structures/RadioStation';
export { default as ReceivedFriendMessage } from './src/structures/ReceivedFriendMessage';
export { default as ReceivedPartyInvitation } from './src/structures/ReceivedPartyInvitation';
export { default as ReceivedPartyJoinRequest } from './src/structures/ReceivedPartyJoinRequest';
export { default as STWHero } from './src/structures/STWHero';
export { default as STWHeroLoadout } from './src/structures/STWHeroLoadout';
export { default as STWItem } from './src/structures/STWItem';
export { default as STWLocker } from './src/structures/STWLocker';
export { default as STWMeleeWeaponSchematic } from './src/structures/STWMeleeWeaponSchematic';
export { default as STWNewsMessage } from './src/structures/STWNewsMessage';
export { default as STWProfile } from './src/structures/STWProfile';
export { default as STWRangedWeaponSchematic } from './src/structures/STWRangedWeaponSchematic';
export { default as STWResource } from './src/structures/STWResource';
export { default as STWSchematic } from './src/structures/STWSchematic';
export { default as STWStats } from './src/structures/STWStats';
export { default as STWSurvivor } from './src/structures/STWSurvivor';
export { default as STWTeamPerk } from './src/structures/STWTeamPerk';
export { default as STWTrapSchematic } from './src/structures/STWTrapSchematic';
export { default as STWWeaponSchematic } from './src/structures/STWWeaponSchematic';
export { default as SentFriendMessage } from './src/structures/SentFriendMessage';
export { default as SentPartyInvitation } from './src/structures/SentPartyInvitation';
export { default as SentPartyJoinRequest } from './src/structures/SentPartyJoinRequest';
export { default as Stats } from './src/structures/Stats';
export { default as Tournament } from './src/structures/Tournament';
export { default as TournamentWindow } from './src/structures/TournamentWindow';
export { default as User } from './src/structures/User';
export { default as UserSearchResult } from './src/structures/UserSearchResult';
export { default as BaseFriendMessage } from './src/structures/friend/BaseFriendMessage';
export { default as BasePendingFriend } from './src/structures/friend/BasePendingFriend';
export { default as Friend } from './src/structures/friend/Friend';
export { default as FriendPresence } from './src/structures/friend/FriendPresence';
export { default as IncomingPendingFriend } from './src/structures/friend/IncomingPendingFriend';
export { default as OutgoingPendingFriend } from './src/structures/friend/OutgoingPendingFriend';
export { default as ReceivedFriendMessage } from './src/structures/friend/ReceivedFriendMessage';
export { default as SentFriendMessage } from './src/structures/friend/SentFriendMessage';
export { default as BasePartyInvitation } from './src/structures/party/BasePartyInvitation';
export { default as BasePartyJoinRequest } from './src/structures/party/BasePartyJoinRequest';
export { default as ClientParty } from './src/structures/party/ClientParty';
export { default as ClientPartyMember } from './src/structures/party/ClientPartyMember';
export { default as ClientPartyMemberMeta } from './src/structures/party/ClientPartyMemberMeta';
export { default as ClientPartyMeta } from './src/structures/party/ClientPartyMeta';
export { default as Party } from './src/structures/party/Party';
export { default as PartyChat } from './src/structures/party/PartyChat';
export { default as PartyMember } from './src/structures/party/PartyMember';
export { default as PartyMemberConfirmation } from './src/structures/party/PartyMemberConfirmation';
export { default as PartyMemberMeta } from './src/structures/party/PartyMemberMeta';
export { default as PartyMessage } from './src/structures/party/PartyMessage';
export { default as PartyMeta } from './src/structures/party/PartyMeta';
export { default as PresenceParty } from './src/structures/party/PresenceParty';
export { default as ReceivedPartyInvitation } from './src/structures/party/ReceivedPartyInvitation';
export { default as ReceivedPartyJoinRequest } from './src/structures/party/ReceivedPartyJoinRequest';
export { default as SentPartyInvitation } from './src/structures/party/SentPartyInvitation';
export { default as SentPartyJoinRequest } from './src/structures/party/SentPartyJoinRequest';
export { default as STWHero } from './src/structures/stw/STWHero';
export { default as STWHeroLoadout } from './src/structures/stw/STWHeroLoadout';
export { default as STWItem } from './src/structures/stw/STWItem';
export { default as STWLocker } from './src/structures/stw/STWLocker';
export { default as STWMeleeWeaponSchematic } from './src/structures/stw/STWMeleeWeaponSchematic';
export { default as STWNewsMessage } from './src/structures/stw/STWNewsMessage';
export { default as STWProfile } from './src/structures/stw/STWProfile';
export { default as STWRangedWeaponSchematic } from './src/structures/stw/STWRangedWeaponSchematic';
export { default as STWResource } from './src/structures/stw/STWResource';
export { default as STWSchematic } from './src/structures/stw/STWSchematic';
export { default as STWStats } from './src/structures/stw/STWStats';
export { default as STWSurvivor } from './src/structures/stw/STWSurvivor';
export { default as STWTeamPerk } from './src/structures/stw/STWTeamPerk';
export { default as STWTrapSchematic } from './src/structures/stw/STWTrapSchematic';
export { default as STWWeaponSchematic } from './src/structures/stw/STWWeaponSchematic';
export { default as BlockedUser } from './src/structures/user/BlockedUser';
export { default as ClientUser } from './src/structures/user/ClientUser';
export { default as User } from './src/structures/user/User';
export { default as UserSearchResult } from './src/structures/user/UserSearchResult';
Loading

0 comments on commit 73ef286

Please sign in to comment.