Skip to content

Commit

Permalink
Merge pull request #215 from getbraincloud/release/5.3
Browse files Browse the repository at this point in the history
Release/5.3
  • Loading branch information
bitheadCody authored May 14, 2024
2 parents 0a1275b + e6b8087 commit f641387
Show file tree
Hide file tree
Showing 11 changed files with 225 additions and 22 deletions.
4 changes: 2 additions & 2 deletions deploy/node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion deploy/node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "braincloud",
"version": "5.2.3",
"version": "5.3.0",
"description": " brainCloud client for NodeJS",
"main": "index.js",
"react-native": "react-native.js",
Expand Down
42 changes: 42 additions & 0 deletions src/brainCloudClient-async-match.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function BCAsyncMatch() {
bc.asyncMatch.OPERATION_DELETE_MATCH = "DELETE_MATCH";
bc.asyncMatch.OPERATION_ABANDON_MATCH_WITH_SUMMARY_DATA = "ABANDON_MATCH_WITH_SUMMARY_DATA";
bc.asyncMatch.OPERATION_COMPLETE_MATCH_WITH_SUMMARY_DATA = "COMPLETE_MATCH_WITH_SUMMARY_DATA";
bc.asyncMatch.OPERATION_UPDATE_MATCH_STATE_CURRENT_TURN = "UPDATE_MATCH_STATE_CURRENT_TURN";

/**
* Creates an instance of an asynchronous match.
Expand Down Expand Up @@ -171,6 +172,7 @@ function BCAsyncMatch() {
if (matchState) {
data["matchState"] = matchState;
}
else data["matchState"] = {};
if (nextPlayer) {
data["status"] = { currentPlayer: nextPlayer };
}
Expand Down Expand Up @@ -393,6 +395,46 @@ function BCAsyncMatch() {
});
};

/**
* Allows the current player in the game to overwrite the matchState and
* statistics without completing their turn or adding to matchHistory.
*
* Service Name - AsyncMatch
* Service Operation - UpdateMatchStateCurrentTurn
*
* @param ownerId Match owner identifier
* @param matchId Match identifier
* @param version Game state version being updated, to ensure data integrity
* @param matchState JSON object provided by the caller. Overwrites the matchState. Required.
* @param statistics Optional JSON object provided by the caller. Overwrites the statistics.
* @param callback The method to be invoked when the server response is received
*/
bc.asyncMatch.updateMatchStateCurrentTurn = function (ownerId, matchId, version, matchState, statistics, callback) {
var data = {
ownerId: ownerId,
matchId: matchId,
version: version
}

if (matchState) {
data["matchState"] = matchState;
}
else data["matchState"] = {};

if (statistics) {
data["statistics"] = statistics;
}

bc.brainCloudManager.sendRequest(
{
service: bc.SERVICE_ASYNC_MATCH,
operation: bc.asyncMatch.OPERATION_UPDATE_MATCH_STATE_CURRENT_TURN,
data: data,
callback: callback
}
)
}

}

//> REMOVE IF K6
Expand Down
23 changes: 23 additions & 0 deletions src/brainCloudClient-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function BCGroup() {
bc.group.OPERATION_CREATE_GROUP_ENTITY = "CREATE_GROUP_ENTITY";
bc.group.OPERATION_DELETE_GROUP = "DELETE_GROUP";
bc.group.OPERATION_DELETE_GROUP_ENTITY = "DELETE_GROUP_ENTITY";
bc.group.OPERATION_DELETE_GROUP_JOIN_REQUEST = "DELETE_GROUP_JOIN_REQUEST";
bc.group.OPERATION_DELETE_MEMBER_FROM_GROUP = "DELETE_MEMBER_FROM_GROUP";
bc.group.OPERATION_GET_MY_GROUPS = "GET_MY_GROUPS";
bc.group.OPERATION_INCREMENT_GROUP_DATA = "INCREMENT_GROUP_DATA";
Expand Down Expand Up @@ -500,6 +501,28 @@ function BCGroup() {
});
};

/**
* Delete a request to join a group.
*
* Service Name - group
* Service Operation - DELETE_GROUP_JOIN_REQUEST
*
* @param {string} groupId ID of the group
* @param {function} callback the function to be invoked when the server response is received
*/
bc.group.deleteGroupJoinRequest = function(groupId, callback){
var message = {
groupId : groupId
};

bc.brainCloudManager.sendRequest({
service : bc.SERVICE_GROUP,
operation : bc.group.OPERATION_DELETE_GROUP_JOIN_REQUEST,
data : message,
callback : callback
});
}

/**
* Leave a group in which the user is a member.
*
Expand Down
20 changes: 10 additions & 10 deletions src/brainCloudClient-player-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ function BCPlayerState() {
bc.playerState.OPERATION_READ_FRIENDS = "READ_FRIENDS";
bc.playerState.OPERATION_READ_FRIEND_PLAYER_STATE = "READ_FRIEND_PLAYER_STATE";

bc.playerState.UPDATE_ATTRIBUTES = "UPDATE_ATTRIBUTES";
bc.playerState.REMOVE_ATTRIBUTES = "REMOVE_ATTRIBUTES";
bc.playerState.GET_ATTRIBUTES = "GET_ATTRIBUTES";
bc.playerState.OPERATION_UPDATE_ATTRIBUTES = "UPDATE_ATTRIBUTES";
bc.playerState.OPERATION_REMOVE_ATTRIBUTES = "REMOVE_ATTRIBUTES";
bc.playerState.OPERATION_GET_ATTRIBUTES = "GET_ATTRIBUTES";

bc.playerState.UPDATE_PICTURE_URL = "UPDATE_PICTURE_URL";
bc.playerState.UPDATE_CONTACT_EMAIL = "UPDATE_CONTACT_EMAIL";
bc.playerState.OPERATION_UPDATE_PICTURE_URL = "UPDATE_PICTURE_URL";
bc.playerState.OPERATION_UPDATE_CONTACT_EMAIL = "UPDATE_CONTACT_EMAIL";

bc.playerState.OPERATION_READ = "READ";

Expand Down Expand Up @@ -77,7 +77,7 @@ function BCPlayerState() {
bc.playerState.getAttributes = function(callback) {
bc.brainCloudManager.sendRequest({
service : bc.SERVICE_PLAYERSTATE,
operation : bc.playerState.GET_ATTRIBUTES,
operation : bc.playerState.OPERATION_GET_ATTRIBUTES,
callback : callback
});
};
Expand Down Expand Up @@ -131,7 +131,7 @@ function BCPlayerState() {
bc.playerState.removeAttributes = function(attributes, callback) {
bc.brainCloudManager.sendRequest({
service : bc.SERVICE_PLAYERSTATE,
operation : bc.playerState.REMOVE_ATTRIBUTES,
operation : bc.playerState.OPERATION_REMOVE_ATTRIBUTES,
data : {
attributes : attributes
},
Expand Down Expand Up @@ -213,7 +213,7 @@ function BCPlayerState() {
wipeExisting, callback) {
bc.brainCloudManager.sendRequest({
service : bc.SERVICE_PLAYERSTATE,
operation : bc.playerState.UPDATE_ATTRIBUTES,
operation : bc.playerState.OPERATION_UPDATE_ATTRIBUTES,
data : {
attributes : attributes,
wipeExisting : wipeExisting
Expand Down Expand Up @@ -294,7 +294,7 @@ function BCPlayerState() {
bc.playerState.updateUserPictureUrl = function(pictureUrl, callback) {
bc.brainCloudManager.sendRequest({
service: bc.SERVICE_PLAYERSTATE,
operation: bc.playerState.UPDATE_PICTURE_URL,
operation: bc.playerState.OPERATION_UPDATE_PICTURE_URL,
data: {
playerPictureUrl: pictureUrl
},
Expand All @@ -315,7 +315,7 @@ function BCPlayerState() {
bc.playerState.updateContactEmail = function(contactEmail, callback) {
bc.brainCloudManager.sendRequest({
service: bc.SERVICE_PLAYERSTATE,
operation: bc.playerState.UPDATE_CONTACT_EMAIL,
operation: bc.playerState.OPERATION_UPDATE_CONTACT_EMAIL,
data: {
contactEmail: contactEmail
},
Expand Down
17 changes: 15 additions & 2 deletions src/brainCloudClient-reason-codes.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ function BCReasonCodes() {
bc.reasonCodes.INVALID_TOURNAMENT_JOB_ID = 40641;
bc.reasonCodes.LEADERBOARD_ROTATION_ERROR = 40642;
bc.reasonCodes.CLOUD_COMPUTING_ERROR = 40643;
bc.reasonCodes.DOCKER_ERROR = 40644;
bc.reasonCodes.ROOM_SERVER_HOST_NOT_FOUND = 40645;
bc.reasonCodes.INVALID_ATTACHMENT_DATA = 40646;
bc.reasonCodes.SCRIPT_PARSING_ERROR = 40647;
Expand Down Expand Up @@ -455,7 +454,6 @@ function BCReasonCodes() {
bc.reasonCodes.UPLOLAD_IN_PROGRESS = 40724;
bc.reasonCodes.REFRESH_IN_PROGRESS = 40725;
bc.reasonCodes.REFRESH_INTERRUPTED = 40726;
bc.reasonCodes.GAMELIFT_ERROR = 40727;
bc.reasonCodes.GAMELIFT_LAUNCH_ERROR = 40728;
bc.reasonCodes.MAX_HOSTED_SERVERS_REACHED = 40729;
bc.reasonCodes.DUPLICATE_PACKET_ID = 40730;
Expand Down Expand Up @@ -612,16 +610,31 @@ function BCReasonCodes() {
bc.reasonCodes.EMAIL_CC_MAX_SIZE_EXCEEDED = 60201;
bc.reasonCodes.EMAIL_BCC_MAX_SIZE_EXCEEDED = 60202;
bc.reasonCodes.RTT_LEFT_BY_CHOICE = 80000;
bc.reasonCodes.LEFT_BY_CHOICE = 80000;
bc.reasonCodes.RTT_EVICTED = 80001;
bc.reasonCodes.EVICTED = 80001;
bc.reasonCodes.RTT_LOST_CONNECTION = 80002;
bc.reasonCodes.LOST_CONNECTION = 80002;
bc.reasonCodes.RTT_TIMEOUT = 80100;
bc.reasonCodes.TIMEOUT = 80100;
bc.reasonCodes.RTT_ROOM_READY = 80101;
bc.reasonCodes.ROOM_READY = 80101;
bc.reasonCodes.RTT_ROOM_CANCELLED = 80102;
bc.reasonCodes.ROOM_CANCELLED = 80102;
bc.reasonCodes.RTT_ERROR_ASSIGNING_ROOM = 80103;
bc.reasonCodes.ERROR_ASSIGNING_ROOM = 80103;
bc.reasonCodes.RTT_ERROR_LAUNCHING_ROOM = 80104;
bc.reasonCodes.ERROR_LAUNCHING_ROOM = 80104;
bc.reasonCodes.RTT_BY_REQUEST = 80105;
bc.reasonCodes.BY_REQUEST = 80105;
bc.reasonCodes.ROOM_READY_TIMEOUT = 80106;
bc.reasonCodes.DOCKER_ERROR = 80107;
bc.reasonCodes.GAMELIFT_ERROR = 80108;
bc.reasonCodes.NO_ROOM_SERVER_CONFIGURED = 80109;
bc.reasonCodes.RTT_NO_LOBBIES_FOUND = 80200;
bc.reasonCodes.NO_LOBBIES_FOUND = 80200;
bc.reasonCodes.RTT_FIND_REQUEST_CANCELLED = 80201;
bc.reasonCodes.FIND_REQUEST_CANCELLED = 80201;
bc.reasonCodes.CLIENT_NETWORK_ERROR_TIMEOUT = 90001;
bc.reasonCodes.CLIENT_UPLOAD_FILE_CANCELLED = 90100;
bc.reasonCodes.CLIENT_UPLOAD_FILE_TIMED_OUT = 90101;
Expand Down
2 changes: 1 addition & 1 deletion src/brainCloudClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function BrainCloudClient() {
}


bcc.version = "5.2.3";
bcc.version = "5.3.0";
bcc.countryCode;
bcc.languageCode;

Expand Down
3 changes: 2 additions & 1 deletion src/brainCloudRelayComms.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
function BrainCloudRelayComms(_client) {
var bcr = this;

//> REMOVE IF K6
var Buffer = require('buffer/').Buffer // note: the trailing slash is important!
//> END

bcr.CONTROL_BYTES_SIZE = 1;

Expand Down
4 changes: 4 additions & 0 deletions src/brainCloudWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,10 @@ function BrainCloudWrapper(wrapperName) {
bcw.brainCloudClient.authentication.resetEmailPasswordAdvancedWithExpiry(emailAddress, serviceParams, tokenTtlInMinutes, responseHandler);
}

/**
* Check if a user can reconnect via saved profile and anonymous IDs from a previously authenticated session.
* @returns True if a saved profile and anonymous ID exist in localStorage
*/
bcw.canReconnect = function () {
return bcw.getStoredProfileId() !== "" && bcw.getStoredAnonymousId() !== ""
}
Expand Down
3 changes: 2 additions & 1 deletion test/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f641387

Please sign in to comment.