Mysql connection strings, unit tests, prettier on server

This adds support for the other type of Mysql connection string
specified by mysql async. Support for both strings and their respective
options are necessary to support backwards compatibility of existing
server configurations.

This also adds support for jest & unit testing on the server/client and
some unit tests for some of the connection string parsing.

It runs these test and prettier in a pre-commit hook.
This commit is contained in:
erik-sn committed 2020-10-17 18:14:08 -04:00
1 parent 8d2e0d9edb
commit a5d1e54b56
21 files changed
+4136 -505

No files matched your search

+2 -2
View File
@@ -1,3 +1,3 @@
export default {
TWITTER: 'TWITTER',
}
TWITTER: "TWITTER",
};
+20 -20
View File
@@ -1,23 +1,23 @@
export default {
Locale: 'en',
KeyTogglePhone: 288,
KeyTakeCall: 38,
PhoneAsItem: false,
Locale: "en",
KeyTogglePhone: 288,
KeyTakeCall: 38,
PhoneAsItem: false,
// destroy phone
SwimDestroy: false,
RunRate: 10,
DestoryChance: 100,
DestroyPhoneReCheck: 3,
// destroy phone
SwimDestroy: false,
RunRate: 10,
DestoryChance: 100,
DestroyPhoneReCheck: 3,
// twitter app
twitter: {
generateProfileNameFromUsers: true,
characterLimit: 240,
allowEdtiableProfileName: true,
enableAvatars: true,
enableEmojis: true,
enableImages: true,
maxImages: 3,
}
};
// twitter app
twitter: {
generateProfileNameFromUsers: true,
characterLimit: 240,
allowEdtiableProfileName: true,
enableAvatars: true,
enableEmojis: true,
enableImages: true,
maxImages: 3,
},
};
+26 -26
View File
@@ -1,29 +1,29 @@
export default {
// Twitter
TWITTER_FETCH_TWEETS: 'phone:fetchTweets',
TWITTER_FETCH_TWEETS_SUCCESS: 'fetchTweets',
TWITTER_FETCH_TWEETS_FAILURE: 'fetchTweetsFailed',
TWITTER_FETCH_TWEETS_FILTERED: 'phone:fetchTweetsFiltered',
TWITTER_FETCH_TWEETS_FILTERED_SUCCESS: 'fetchTweetsFiltered',
TWITTER_FETCH_TWEETS_FILTERED_FAILURE: 'fetchTweetsFilteredFailed',
TWITTER_GET_OR_CREATE_PROFILE: 'phone:getOrCreateTwitterProfile',
TWITTER_GET_OR_CREATE_PROFILE_SUCCESS: 'getOrCreateTwitterProfile',
TWITTER_GET_OR_CREATE_PROFILE_FAILURE: 'getOrCreateTwitterProfileFailed',
TWITTER_UPDATE_PROFILE: 'phone:updateTwitterProfile',
TWITTER_UPDATE_PROFILE_LOADING: 'updateProfileLoading',
TWITTER_UPDATE_PROFILE_RESULT: 'updateProfileResult',
TWITTER_CREATE_TWEET: 'phone:createTweet',
TWITTER_CREATE_TWEET_LOADING: 'createTweetLoading',
TWITTER_CREATE_TWEET_RESULT: 'createTweetResult',
TWITTER_CREATE_TWEET_FAILURE: 'createTweetResultFailed',
TWITTER_TOGGLE_LIKE: 'phone:toggleLike',
TWITTER_TOGGLE_LIKE_SUCCESS: 'toggleLikeSuccess',
TWITTER_TOGGLE_LIKE_FAILURE: 'toggleLikeFailed',
// Twitter
TWITTER_FETCH_TWEETS: "phone:fetchTweets",
TWITTER_FETCH_TWEETS_SUCCESS: "fetchTweets",
TWITTER_FETCH_TWEETS_FAILURE: "fetchTweetsFailed",
TWITTER_FETCH_TWEETS_FILTERED: "phone:fetchTweetsFiltered",
TWITTER_FETCH_TWEETS_FILTERED_SUCCESS: "fetchTweetsFiltered",
TWITTER_FETCH_TWEETS_FILTERED_FAILURE: "fetchTweetsFilteredFailed",
TWITTER_GET_OR_CREATE_PROFILE: "phone:getOrCreateTwitterProfile",
TWITTER_GET_OR_CREATE_PROFILE_SUCCESS: "getOrCreateTwitterProfile",
TWITTER_GET_OR_CREATE_PROFILE_FAILURE: "getOrCreateTwitterProfileFailed",
TWITTER_UPDATE_PROFILE: "phone:updateTwitterProfile",
TWITTER_UPDATE_PROFILE_LOADING: "updateProfileLoading",
TWITTER_UPDATE_PROFILE_RESULT: "updateProfileResult",
TWITTER_CREATE_TWEET: "phone:createTweet",
TWITTER_CREATE_TWEET_LOADING: "createTweetLoading",
TWITTER_CREATE_TWEET_RESULT: "createTweetResult",
TWITTER_CREATE_TWEET_FAILURE: "createTweetResultFailed",
TWITTER_TOGGLE_LIKE: "phone:toggleLike",
TWITTER_TOGGLE_LIKE_SUCCESS: "toggleLikeSuccess",
TWITTER_TOGGLE_LIKE_FAILURE: "toggleLikeFailed",
// Contacts
CONTACTS_SEND_CONTACTS: 'phone:sendContacts',
CONTACTS_GET_CONTACTS: 'phone:getContacts',
CONTACTS_ADD_CONTACT_NUI: 'contacts:add',
CONTACTS_ADD_CONTACT: 'contacts:add',
CONTACTS_UPDATE_CONTACTS: 'phone:updateContacts'
}
CONTACTS_SEND_CONTACTS: "phone:sendContacts",
CONTACTS_GET_CONTACTS: "phone:getContacts",
CONTACTS_ADD_CONTACT_NUI: "contacts:add",
CONTACTS_ADD_CONTACT: "contacts:add",
CONTACTS_UPDATE_CONTACTS: "phone:updateContacts",
};
+1 -1
View File
@@ -1,2 +1,2 @@
// https://forum.cfx.re/t/typescript-vs-lua-questions/612483/11
export const Delay = (ms: number) => new Promise(res => setTimeout(res, ms));
export const Delay = (ms: number) => new Promise((res) => setTimeout(res, ms));
+9 -7
View File
@@ -1,13 +1,15 @@
import apps from './apps';
import apps from "./apps";
function sendMessage(app: string, method: string, data: any) {
return SendNuiMessage(JSON.stringify({
app,
method,
data,
}))
return SendNuiMessage(
JSON.stringify({
app,
method,
data,
})
);
}
export function sendTwitterMessage(method: string, data: any = {}) {
return sendMessage(apps.TWITTER, method, data);
return sendMessage(apps.TWITTER, method, data);
}