Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@heroiclabs/nakama-js

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@heroiclabs/nakama-js - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

4

CHANGELOG.md

@@ -6,2 +6,6 @@ # Change Log

## [0.3.0] - 2017-11-27
### Added
- Add support for Leaderboards.
## [0.2.0] - 2017-11-24

@@ -8,0 +12,0 @@ ### Added

@@ -330,3 +330,2 @@ 'use strict';

message.liveNotifications.notifications.forEach(function (notification) {
// translate base64 into json object
notification.content = JSON.parse(notification.content);

@@ -363,3 +362,2 @@ this.onnotification(notification);

message.users.users.forEach(function (user) {
// translate base64 into json object
user.metadata = JSON.parse(user.metadata);

@@ -374,3 +372,2 @@ });

message.friends.friends.forEach(function (friend) {
// translate base64 into json object
friend.user.metadata = JSON.parse(friend.user.metadata);

@@ -385,3 +382,2 @@ });

message.topicMessages.messages.forEach(function (message) {
// translate base64 into json object
message.data = JSON.parse(message.data);

@@ -392,3 +388,2 @@ });

message.groups.groups.forEach(function (group) {
// translate base64 into json object
group.metadata = JSON.parse(group.metadata);

@@ -399,3 +394,2 @@ });

message.groupsSelf.groupsSelf.forEach(function (groupSelf) {
// translate base64 into json object
groupSelf.group.metadata = JSON.parse(groupSelf.group.metadata);

@@ -406,3 +400,2 @@ });

message.groupUsers.users.forEach(function (groupUser) {
// translate base64 into json object
groupUser.user.metadata = JSON.parse(groupUser.user.metadata);

@@ -416,3 +409,2 @@ });

message.notifications.notifications.forEach(function (notification) {
// translate base64 into json object
notification.content = JSON.parse(notification.content);

@@ -427,2 +419,12 @@ });

p.resolve(message.matches);
} else if (message.leaderboards) {
message.leaderboards.leaderboards.forEach(function (leaderboard) {
leaderboard.metadata = JSON.parse(leaderboard.metadata);
});
p.resolve(message.leaderboards);
} else if (message.leaderboardRecords) {
message.leaderboardRecords.records.forEach(function (record) {
record.metadata = JSON.parse(record.metadata);
});
p.resolve(message.leaderboardRecords);
} else {

@@ -1418,2 +1420,139 @@ // if the object has properties, other than the collationId, log a warning

class LeaderboardsListRequest {
constructor() {
this.filterLeaderboardIds = [];
this.limit = null;
this.cursor = null;
}
build_() {
var msg = { leaderboardsList: {
filterLeaderboardId: [],
limit: this.limit,
cursor: this.cursor
} };
this.filterLeaderboardIds.forEach(function (id) {
msg.leaderboardsList.filterLeaderboardId.push(id);
});
return msg;
}
}
class LeaderboardRecordsFetchRequest {
constructor() {
this.leaderboardIds = [];
this.limit = null;
this.cursor = null;
}
build_() {
var msg = { leaderboardRecordsFetch: {
leaderboardIds: [],
limit: this.limit,
cursor: this.cursor
} };
this.leaderboardIds.forEach(function (id) {
msg.leaderboardRecordsFetch.leaderboardIds.push(id);
});
return msg;
}
}
class LeaderboardRecordsListRequest {
constructor() {
this.leaderboardId = null;
this.limit = null;
this.cursor = null;
// only set one of the followings
this.lang = null;
this.location = null;
this.timezone = null;
this.ownerId = null;
this.ownerIds = [];
}
build_() {
var msg = { leaderboardRecordsList: {
leaderboardId: this.leaderboardId,
limit: this.limit,
cursor: this.cursor
} };
if (this.lang) {
msg.leaderboardRecordsList.lang = this.lang;
} else if (this.location) {
msg.leaderboardRecordsList.location = this.createdAt;
} else if (this.timezone) {
msg.leaderboardRecordsList.count = this.count;
} else if (this.ownerId) {
msg.leaderboardRecordsList.ownerId = this.ownerId;
} else if (this.ownerIds.length > 0) {
msg.leaderboardRecordsList.ownerIds = { ownerIds: this.ownerIds };
}
return msg;
}
}
class LeaderboardRecordWriteRequest {
constructor() {
this.records = [];
}
set(leaderboardId, value, metadata, location, timezone) {
var record = {
leaderboardId: leaderboardId,
"set": value,
metadata: JSON.stringify(metadata),
location: location,
timezone: timezone
};
this.records.push(record);
}
best(leaderboardId, value, metadata, location, timezone) {
var record = {
leaderboardId: leaderboardId,
best: value,
metadata: JSON.stringify(metadata),
location: location,
timezone: timezone
};
this.records.push(record);
}
decrement(leaderboardId, value, metadata, location, timezone) {
var record = {
leaderboardId: leaderboardId,
decr: value,
metadata: JSON.stringify(metadata),
location: location,
timezone: timezone
};
this.records.push(record);
}
increment(leaderboardId, value, metadata, location, timezone) {
var record = {
leaderboardId: leaderboardId,
incr: value,
metadata: JSON.stringify(metadata),
location: location,
timezone: timezone
};
this.records.push(record);
}
build_() {
return { leaderboardRecordsWrite: { records: this.records } };
}
}
/*

@@ -1481,1 +1620,5 @@ * Copyright 2017 The Nakama Authors

exports.MatchDataSendRequest = MatchDataSendRequest;
exports.LeaderboardsListRequest = LeaderboardsListRequest;
exports.LeaderboardRecordsFetchRequest = LeaderboardRecordsFetchRequest;
exports.LeaderboardRecordsListRequest = LeaderboardRecordsListRequest;
exports.LeaderboardRecordWriteRequest = LeaderboardRecordWriteRequest;

@@ -326,3 +326,2 @@ var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

message.liveNotifications.notifications.forEach(function (notification) {
// translate base64 into json object
notification.content = JSON.parse(notification.content);

@@ -359,3 +358,2 @@ this.onnotification(notification);

message.users.users.forEach(function (user) {
// translate base64 into json object
user.metadata = JSON.parse(user.metadata);

@@ -370,3 +368,2 @@ });

message.friends.friends.forEach(function (friend) {
// translate base64 into json object
friend.user.metadata = JSON.parse(friend.user.metadata);

@@ -381,3 +378,2 @@ });

message.topicMessages.messages.forEach(function (message) {
// translate base64 into json object
message.data = JSON.parse(message.data);

@@ -388,3 +384,2 @@ });

message.groups.groups.forEach(function (group) {
// translate base64 into json object
group.metadata = JSON.parse(group.metadata);

@@ -395,3 +390,2 @@ });

message.groupsSelf.groupsSelf.forEach(function (groupSelf) {
// translate base64 into json object
groupSelf.group.metadata = JSON.parse(groupSelf.group.metadata);

@@ -402,3 +396,2 @@ });

message.groupUsers.users.forEach(function (groupUser) {
// translate base64 into json object
groupUser.user.metadata = JSON.parse(groupUser.user.metadata);

@@ -412,3 +405,2 @@ });

message.notifications.notifications.forEach(function (notification) {
// translate base64 into json object
notification.content = JSON.parse(notification.content);

@@ -423,2 +415,12 @@ });

p.resolve(message.matches);
} else if (message.leaderboards) {
message.leaderboards.leaderboards.forEach(function (leaderboard) {
leaderboard.metadata = JSON.parse(leaderboard.metadata);
});
p.resolve(message.leaderboards);
} else if (message.leaderboardRecords) {
message.leaderboardRecords.records.forEach(function (record) {
record.metadata = JSON.parse(record.metadata);
});
p.resolve(message.leaderboardRecords);
} else {

@@ -1414,2 +1416,139 @@ // if the object has properties, other than the collationId, log a warning

class LeaderboardsListRequest {
constructor() {
this.filterLeaderboardIds = [];
this.limit = null;
this.cursor = null;
}
build_() {
var msg = { leaderboardsList: {
filterLeaderboardId: [],
limit: this.limit,
cursor: this.cursor
} };
this.filterLeaderboardIds.forEach(function (id) {
msg.leaderboardsList.filterLeaderboardId.push(id);
});
return msg;
}
}
class LeaderboardRecordsFetchRequest {
constructor() {
this.leaderboardIds = [];
this.limit = null;
this.cursor = null;
}
build_() {
var msg = { leaderboardRecordsFetch: {
leaderboardIds: [],
limit: this.limit,
cursor: this.cursor
} };
this.leaderboardIds.forEach(function (id) {
msg.leaderboardRecordsFetch.leaderboardIds.push(id);
});
return msg;
}
}
class LeaderboardRecordsListRequest {
constructor() {
this.leaderboardId = null;
this.limit = null;
this.cursor = null;
// only set one of the followings
this.lang = null;
this.location = null;
this.timezone = null;
this.ownerId = null;
this.ownerIds = [];
}
build_() {
var msg = { leaderboardRecordsList: {
leaderboardId: this.leaderboardId,
limit: this.limit,
cursor: this.cursor
} };
if (this.lang) {
msg.leaderboardRecordsList.lang = this.lang;
} else if (this.location) {
msg.leaderboardRecordsList.location = this.createdAt;
} else if (this.timezone) {
msg.leaderboardRecordsList.count = this.count;
} else if (this.ownerId) {
msg.leaderboardRecordsList.ownerId = this.ownerId;
} else if (this.ownerIds.length > 0) {
msg.leaderboardRecordsList.ownerIds = { ownerIds: this.ownerIds };
}
return msg;
}
}
class LeaderboardRecordWriteRequest {
constructor() {
this.records = [];
}
set(leaderboardId, value, metadata, location, timezone) {
var record = {
leaderboardId: leaderboardId,
"set": value,
metadata: JSON.stringify(metadata),
location: location,
timezone: timezone
};
this.records.push(record);
}
best(leaderboardId, value, metadata, location, timezone) {
var record = {
leaderboardId: leaderboardId,
best: value,
metadata: JSON.stringify(metadata),
location: location,
timezone: timezone
};
this.records.push(record);
}
decrement(leaderboardId, value, metadata, location, timezone) {
var record = {
leaderboardId: leaderboardId,
decr: value,
metadata: JSON.stringify(metadata),
location: location,
timezone: timezone
};
this.records.push(record);
}
increment(leaderboardId, value, metadata, location, timezone) {
var record = {
leaderboardId: leaderboardId,
incr: value,
metadata: JSON.stringify(metadata),
location: location,
timezone: timezone
};
this.records.push(record);
}
build_() {
return { leaderboardRecordsWrite: { records: this.records } };
}
}
/*

@@ -1435,2 +1574,2 @@ * Copyright 2017 The Nakama Authors

export { AuthenticateRequest, Client, Session, LinkRequest, UnlinkRequest, SelfFetchRequest, SelfUpdateRequest, UsersFetchRequest, StorageListRequest, StorageFetchRequest, StorageWriteRequest, StorageRemoveRequest, StorageUpdateRequest, FriendsAddRequest, FriendsRemoveRequest, FriendsBlockRequest, FriendsListRequest, TopicsJoinRequest, TopicsLeaveRequest, TopicMessageSendRequest, TopicMessagesListRequest, GroupsCreateRequest, GroupsUpdateRequest, GroupsRemoveRequest, GroupsFetchRequest, GroupsListRequest, GroupsSelfListRequest, GroupUsersListRequest, GroupsJoinRequest, GroupsLeaveRequest, GroupUsersAddRequest, GroupUsersKickRequest, GroupUsersPromoteRequest, NotificationsListRequest, NotificationsRemoveRequest, RpcRequest, MatchmakeAddRequest, MatchmakeRemoveRequest, MatchCreateRequest, MatchesJoinRequest, MatchesLeaveRequest, MatchDataSendRequest };
export { AuthenticateRequest, Client, Session, LinkRequest, UnlinkRequest, SelfFetchRequest, SelfUpdateRequest, UsersFetchRequest, StorageListRequest, StorageFetchRequest, StorageWriteRequest, StorageRemoveRequest, StorageUpdateRequest, FriendsAddRequest, FriendsRemoveRequest, FriendsBlockRequest, FriendsListRequest, TopicsJoinRequest, TopicsLeaveRequest, TopicMessageSendRequest, TopicMessagesListRequest, GroupsCreateRequest, GroupsUpdateRequest, GroupsRemoveRequest, GroupsFetchRequest, GroupsListRequest, GroupsSelfListRequest, GroupUsersListRequest, GroupsJoinRequest, GroupsLeaveRequest, GroupUsersAddRequest, GroupUsersKickRequest, GroupUsersPromoteRequest, NotificationsListRequest, NotificationsRemoveRequest, RpcRequest, MatchmakeAddRequest, MatchmakeRemoveRequest, MatchCreateRequest, MatchesJoinRequest, MatchesLeaveRequest, MatchDataSendRequest, LeaderboardsListRequest, LeaderboardRecordsFetchRequest, LeaderboardRecordsListRequest, LeaderboardRecordWriteRequest };

@@ -332,3 +332,2 @@ (function (global, factory) {

message.liveNotifications.notifications.forEach(function (notification) {
// translate base64 into json object
notification.content = JSON.parse(notification.content);

@@ -365,3 +364,2 @@ this.onnotification(notification);

message.users.users.forEach(function (user) {
// translate base64 into json object
user.metadata = JSON.parse(user.metadata);

@@ -376,3 +374,2 @@ });

message.friends.friends.forEach(function (friend) {
// translate base64 into json object
friend.user.metadata = JSON.parse(friend.user.metadata);

@@ -387,3 +384,2 @@ });

message.topicMessages.messages.forEach(function (message) {
// translate base64 into json object
message.data = JSON.parse(message.data);

@@ -394,3 +390,2 @@ });

message.groups.groups.forEach(function (group) {
// translate base64 into json object
group.metadata = JSON.parse(group.metadata);

@@ -401,3 +396,2 @@ });

message.groupsSelf.groupsSelf.forEach(function (groupSelf) {
// translate base64 into json object
groupSelf.group.metadata = JSON.parse(groupSelf.group.metadata);

@@ -408,3 +402,2 @@ });

message.groupUsers.users.forEach(function (groupUser) {
// translate base64 into json object
groupUser.user.metadata = JSON.parse(groupUser.user.metadata);

@@ -418,3 +411,2 @@ });

message.notifications.notifications.forEach(function (notification) {
// translate base64 into json object
notification.content = JSON.parse(notification.content);

@@ -429,2 +421,12 @@ });

p.resolve(message.matches);
} else if (message.leaderboards) {
message.leaderboards.leaderboards.forEach(function (leaderboard) {
leaderboard.metadata = JSON.parse(leaderboard.metadata);
});
p.resolve(message.leaderboards);
} else if (message.leaderboardRecords) {
message.leaderboardRecords.records.forEach(function (record) {
record.metadata = JSON.parse(record.metadata);
});
p.resolve(message.leaderboardRecords);
} else {

@@ -1420,2 +1422,139 @@ // if the object has properties, other than the collationId, log a warning

class LeaderboardsListRequest {
constructor() {
this.filterLeaderboardIds = [];
this.limit = null;
this.cursor = null;
}
build_() {
var msg = { leaderboardsList: {
filterLeaderboardId: [],
limit: this.limit,
cursor: this.cursor
} };
this.filterLeaderboardIds.forEach(function (id) {
msg.leaderboardsList.filterLeaderboardId.push(id);
});
return msg;
}
}
class LeaderboardRecordsFetchRequest {
constructor() {
this.leaderboardIds = [];
this.limit = null;
this.cursor = null;
}
build_() {
var msg = { leaderboardRecordsFetch: {
leaderboardIds: [],
limit: this.limit,
cursor: this.cursor
} };
this.leaderboardIds.forEach(function (id) {
msg.leaderboardRecordsFetch.leaderboardIds.push(id);
});
return msg;
}
}
class LeaderboardRecordsListRequest {
constructor() {
this.leaderboardId = null;
this.limit = null;
this.cursor = null;
// only set one of the followings
this.lang = null;
this.location = null;
this.timezone = null;
this.ownerId = null;
this.ownerIds = [];
}
build_() {
var msg = { leaderboardRecordsList: {
leaderboardId: this.leaderboardId,
limit: this.limit,
cursor: this.cursor
} };
if (this.lang) {
msg.leaderboardRecordsList.lang = this.lang;
} else if (this.location) {
msg.leaderboardRecordsList.location = this.createdAt;
} else if (this.timezone) {
msg.leaderboardRecordsList.count = this.count;
} else if (this.ownerId) {
msg.leaderboardRecordsList.ownerId = this.ownerId;
} else if (this.ownerIds.length > 0) {
msg.leaderboardRecordsList.ownerIds = { ownerIds: this.ownerIds };
}
return msg;
}
}
class LeaderboardRecordWriteRequest {
constructor() {
this.records = [];
}
set(leaderboardId, value, metadata, location, timezone) {
var record = {
leaderboardId: leaderboardId,
"set": value,
metadata: JSON.stringify(metadata),
location: location,
timezone: timezone
};
this.records.push(record);
}
best(leaderboardId, value, metadata, location, timezone) {
var record = {
leaderboardId: leaderboardId,
best: value,
metadata: JSON.stringify(metadata),
location: location,
timezone: timezone
};
this.records.push(record);
}
decrement(leaderboardId, value, metadata, location, timezone) {
var record = {
leaderboardId: leaderboardId,
decr: value,
metadata: JSON.stringify(metadata),
location: location,
timezone: timezone
};
this.records.push(record);
}
increment(leaderboardId, value, metadata, location, timezone) {
var record = {
leaderboardId: leaderboardId,
incr: value,
metadata: JSON.stringify(metadata),
location: location,
timezone: timezone
};
this.records.push(record);
}
build_() {
return { leaderboardRecordsWrite: { records: this.records } };
}
}
/*

@@ -1483,2 +1622,6 @@ * Copyright 2017 The Nakama Authors

exports.MatchDataSendRequest = MatchDataSendRequest;
exports.LeaderboardsListRequest = LeaderboardsListRequest;
exports.LeaderboardRecordsFetchRequest = LeaderboardRecordsFetchRequest;
exports.LeaderboardRecordsListRequest = LeaderboardRecordsListRequest;
exports.LeaderboardRecordWriteRequest = LeaderboardRecordWriteRequest;

@@ -1485,0 +1628,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

2

package.json
{
"name": "@heroiclabs/nakama-js",
"version": "0.2.0",
"version": "0.3.0",
"description": "JavaScript client for Nakama server.",

@@ -5,0 +5,0 @@ "keywords": ["realtime", "realtime chat", "nakama", "game server"],

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc