@fnlb-project/shared 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/errors/index.js +1 -1
- package/dist/http/index.js +1 -1
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.js +1 -1
- package/dist/util/index.js +1 -1
- package/package.json +5 -5
package/dist/errors/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var h;((n)=>{n.GenericUnknown="net.fnlb.errors.generic.unknown";n.GenericInternalError="net.fnlb.errors.generic.internal_error";n.GenericValidationFailed="net.fnlb.errors.generic.validation_failed";n.GenericParseFailed="net.fnlb.errors.generic.parse_failed";n.GenericNotFound="net.fnlb.errors.generic.not_found";n.CommonInvalidRequest="net.fnlb.errors.common.invalid_request";n.CommonUnableToProcessRequest="net.fnlb.errors.common.unable_to_process_request";n.CommonInvalidFieldsLength="net.fnlb.errors.common.invalid_body_fields_length";n.CommonRateLimitExceeded="net.fnlb.errors.common.rate_limit_exceeded";n.CommonUnableToSaveToDatabase="net.fnlb.errors.common.unable_to_save_to_database";n.AuthInvalidToken="net.fnlb.errors.auth.invalid_token";n.AuthInvalidAPIToken="net.fnlb.errors.auth.invalid_api_token";n.AuthInvalidCaptchaToken="net.fnlb.errors.auth.invalid_captcha_token";n.AuthUnauthorized="net.fnlb.errors.auth.unauthorized";n.AuthUserBanned="net.fnlb.errors.auth.user_banned";n.Oauth2InvalidCode="net.fnlb.errors.oauth2.invalid_code";n.Oauth2InvalidScope="net.fnlb.errors.oauth2.invalid_scope";n.Oauth2TokenInvalid="net.fnlb.errors.oauth2.token_invalid";n.Oauth2UnableToFetchUser="net.fnlb.errors.oauth2.unable_to_fetch_user";n.Oauth2UnableToFetchConnections="net.fnlb.errors.oauth2.unable_to_fetch_connections";n.Oauth2UserWithoutConnection="net.fnlb.errors.oauth2.user_without_connection";n.Oauth2ConnectionNotVerified="net.fnlb.errors.oauth2.connection_not_verified";n.ReleaseNotFound="net.fnlb.errors.release.no_release_found";n.ReleaseVersionAlreadyExists="net.fnlb.errors.release.version_already_exists"})(h||={});var d;((i)=>{i.LoginInvalidCredentials="net.fnlb.errors.login.invalid_credentials";i.LoginInvalidEmail="net.fnlb.errors.login.invalid_email";i.LoginInvalidOrUsedEmail="net.fnlb.errors.login.invalid_or_used_email";i.AuthPasswordConfirmationInvalid="net.fnlb.errors.auth.invalid_password_confirmation"})(d||={});var e={...h,...d};var u={[e.GenericUnknown]:{type:"general",message:"An unknown error occurred. Please try again later."},[e.GenericInternalError]:{type:"general",message:"An internal error occurred. Please try again later."},[e.GenericValidationFailed]:{type:"general",message:"Validation of the request data failed."},[e.GenericParseFailed]:{type:"general",message:"The request could not be parsed. This may be due to a malformed input or an unsupported data format."},[e.GenericNotFound]:{type:"general",message:"The requested resource does not exist."},[e.CommonInvalidRequest]:{type:"general",message:"The request is not valid."},[e.CommonUnableToProcessRequest]:{type:"general",message:"Unable to process the request. Please try again later."},[e.CommonInvalidFieldsLength]:{type:"general",message:"The body fields have an invalid length."},[e.CommonRateLimitExceeded]:{type:"general",message:"You are being rate limited."},[e.CommonUnableToSaveToDatabase]:{type:"general",message:"Unable to save changes. Please check all fields."},[e.AuthInvalidToken]:{type:"general",message:"Invalid token provided."},[e.AuthInvalidAPIToken]:{type:"general",message:"Invalid API token provided."},[e.AuthInvalidCaptchaToken]:{type:"general",message:"Sorry, the captcha was not resolved correctly. Please try again."},[e.AuthUnauthorized]:{type:"general",message:"You are not authorized to perform this action."},[e.AuthUserBanned]:{type:"general",message:"Your account is banned from the service."},[e.AuthPasswordConfirmationInvalid]:{type:"input",message:"Sorry, the password is invalid or does not match."},[e.LoginInvalidCredentials]:{type:"input",message:"The email or password is incorrect."},[e.LoginInvalidEmail]:{type:"input",message:"The email is invalid."},[e.LoginInvalidOrUsedEmail]:{type:"input",message:"The email is invalid or is already used."},[e.Oauth2InvalidCode]:{type:"general",message:"Unable to verify your request at this moment. Please try again later."},[e.Oauth2InvalidScope]:{type:"general",message:"Invalid scope provided."},[e.Oauth2TokenInvalid]:{type:"general",message:"Unable to verify Oauth2 token. Please try again later."},[e.Oauth2UnableToFetchUser]:{type:"general",message:"Unable to obtain user information. Please try again later."},[e.Oauth2UnableToFetchConnections]:{type:"general",message:"Unable to obtain connections. Please try again later."},[e.Oauth2UserWithoutConnection]:{type:"general",message:"No connections found. Please add a connection and try again later."},[e.Oauth2ConnectionNotVerified]:{type:"general",message:"The connection is not verified. Please try again later."},[e.ReleaseNotFound]:{type:"general",message:"Sorry, no release found. Please try again later."},[e.ReleaseVersionAlreadyExists]:{type:"general",message:"Release version already exists."}};class s{static getError(a){return u[a]??u[e.GenericUnknown]}static getErrorResponse(a,t){if(Array.isArray(a))return{type:"error",errors:a.map((l)=>s.parseErrorCode(l,t))};else return{type:"error",errors:[s.parseErrorCode(a,t)]}}static parseErrorResponse(a){if(!s.isErrorResponse(a))return null;return a.errors}static isErrorResponse(a){return a?.type==="error"}static parseErrorCode(a,t){let{type:l,message:m}=s.getError(a);if(l==="input"){if(t===void 0)throw new Error("Input is required for Input errors");return{type:l,message:m,errorCode:a,input:t}}else return{type:l,message:m,errorCode:a}}static handleErrors(a,t){switch(a){case"VALIDATION":return[400,s.getErrorResponse(e.GenericValidationFailed)];case"NOT_FOUND":return[404,s.getErrorResponse(e.GenericNotFound)];case"PARSE":return[400,s.getErrorResponse(e.GenericParseFailed)];case"INTERNAL_SERVER_ERROR":return console.error(t),[500,s.getErrorResponse(e.GenericInternalError)];default:return console.error(t),[500,s.getErrorResponse(e.GenericUnknown)]}}}export{s as ErrorHandler};
|
package/dist/http/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var d;((s)=>{s.GenericUnknown="net.fnlb.errors.generic.unknown";s.GenericInternalError="net.fnlb.errors.generic.internal_error";s.GenericValidationFailed="net.fnlb.errors.generic.validation_failed";s.GenericParseFailed="net.fnlb.errors.generic.parse_failed";s.GenericNotFound="net.fnlb.errors.generic.not_found";s.CommonInvalidRequest="net.fnlb.errors.common.invalid_request";s.CommonUnableToProcessRequest="net.fnlb.errors.common.unable_to_process_request";s.CommonInvalidFieldsLength="net.fnlb.errors.common.invalid_body_fields_length";s.CommonRateLimitExceeded="net.fnlb.errors.common.rate_limit_exceeded";s.CommonUnableToSaveToDatabase="net.fnlb.errors.common.unable_to_save_to_database";s.AuthInvalidToken="net.fnlb.errors.auth.invalid_token";s.AuthInvalidAPIToken="net.fnlb.errors.auth.invalid_api_token";s.AuthInvalidCaptchaToken="net.fnlb.errors.auth.invalid_captcha_token";s.AuthUnauthorized="net.fnlb.errors.auth.unauthorized";s.AuthUserBanned="net.fnlb.errors.auth.user_banned";s.Oauth2InvalidCode="net.fnlb.errors.oauth2.invalid_code";s.Oauth2InvalidScope="net.fnlb.errors.oauth2.invalid_scope";s.Oauth2TokenInvalid="net.fnlb.errors.oauth2.token_invalid";s.Oauth2UnableToFetchUser="net.fnlb.errors.oauth2.unable_to_fetch_user";s.Oauth2UnableToFetchConnections="net.fnlb.errors.oauth2.unable_to_fetch_connections";s.Oauth2UserWithoutConnection="net.fnlb.errors.oauth2.user_without_connection";s.Oauth2ConnectionNotVerified="net.fnlb.errors.oauth2.connection_not_verified";s.ReleaseNotFound="net.fnlb.errors.release.no_release_found";s.ReleaseVersionAlreadyExists="net.fnlb.errors.release.version_already_exists"})(d||={});var
|
|
1
|
+
var d;((s)=>{s.GenericUnknown="net.fnlb.errors.generic.unknown";s.GenericInternalError="net.fnlb.errors.generic.internal_error";s.GenericValidationFailed="net.fnlb.errors.generic.validation_failed";s.GenericParseFailed="net.fnlb.errors.generic.parse_failed";s.GenericNotFound="net.fnlb.errors.generic.not_found";s.CommonInvalidRequest="net.fnlb.errors.common.invalid_request";s.CommonUnableToProcessRequest="net.fnlb.errors.common.unable_to_process_request";s.CommonInvalidFieldsLength="net.fnlb.errors.common.invalid_body_fields_length";s.CommonRateLimitExceeded="net.fnlb.errors.common.rate_limit_exceeded";s.CommonUnableToSaveToDatabase="net.fnlb.errors.common.unable_to_save_to_database";s.AuthInvalidToken="net.fnlb.errors.auth.invalid_token";s.AuthInvalidAPIToken="net.fnlb.errors.auth.invalid_api_token";s.AuthInvalidCaptchaToken="net.fnlb.errors.auth.invalid_captcha_token";s.AuthUnauthorized="net.fnlb.errors.auth.unauthorized";s.AuthUserBanned="net.fnlb.errors.auth.user_banned";s.Oauth2InvalidCode="net.fnlb.errors.oauth2.invalid_code";s.Oauth2InvalidScope="net.fnlb.errors.oauth2.invalid_scope";s.Oauth2TokenInvalid="net.fnlb.errors.oauth2.token_invalid";s.Oauth2UnableToFetchUser="net.fnlb.errors.oauth2.unable_to_fetch_user";s.Oauth2UnableToFetchConnections="net.fnlb.errors.oauth2.unable_to_fetch_connections";s.Oauth2UserWithoutConnection="net.fnlb.errors.oauth2.user_without_connection";s.Oauth2ConnectionNotVerified="net.fnlb.errors.oauth2.connection_not_verified";s.ReleaseNotFound="net.fnlb.errors.release.no_release_found";s.ReleaseVersionAlreadyExists="net.fnlb.errors.release.version_already_exists"})(d||={});var m;((o)=>{o.LoginInvalidCredentials="net.fnlb.errors.login.invalid_credentials";o.LoginInvalidEmail="net.fnlb.errors.login.invalid_email";o.LoginInvalidOrUsedEmail="net.fnlb.errors.login.invalid_or_used_email";o.AuthPasswordConfirmationInvalid="net.fnlb.errors.auth.invalid_password_confirmation"})(m||={});var e={...d,...m};var u={[e.GenericUnknown]:{type:"general",message:"An unknown error occurred. Please try again later."},[e.GenericInternalError]:{type:"general",message:"An internal error occurred. Please try again later."},[e.GenericValidationFailed]:{type:"general",message:"Validation of the request data failed."},[e.GenericParseFailed]:{type:"general",message:"The request could not be parsed. This may be due to a malformed input or an unsupported data format."},[e.GenericNotFound]:{type:"general",message:"The requested resource does not exist."},[e.CommonInvalidRequest]:{type:"general",message:"The request is not valid."},[e.CommonUnableToProcessRequest]:{type:"general",message:"Unable to process the request. Please try again later."},[e.CommonInvalidFieldsLength]:{type:"general",message:"The body fields have an invalid length."},[e.CommonRateLimitExceeded]:{type:"general",message:"You are being rate limited."},[e.CommonUnableToSaveToDatabase]:{type:"general",message:"Unable to save changes. Please check all fields."},[e.AuthInvalidToken]:{type:"general",message:"Invalid token provided."},[e.AuthInvalidAPIToken]:{type:"general",message:"Invalid API token provided."},[e.AuthInvalidCaptchaToken]:{type:"general",message:"Sorry, the captcha was not resolved correctly. Please try again."},[e.AuthUnauthorized]:{type:"general",message:"You are not authorized to perform this action."},[e.AuthUserBanned]:{type:"general",message:"Your account is banned from the service."},[e.AuthPasswordConfirmationInvalid]:{type:"input",message:"Sorry, the password is invalid or does not match."},[e.LoginInvalidCredentials]:{type:"input",message:"The email or password is incorrect."},[e.LoginInvalidEmail]:{type:"input",message:"The email is invalid."},[e.LoginInvalidOrUsedEmail]:{type:"input",message:"The email is invalid or is already used."},[e.Oauth2InvalidCode]:{type:"general",message:"Unable to verify your request at this moment. Please try again later."},[e.Oauth2InvalidScope]:{type:"general",message:"Invalid scope provided."},[e.Oauth2TokenInvalid]:{type:"general",message:"Unable to verify Oauth2 token. Please try again later."},[e.Oauth2UnableToFetchUser]:{type:"general",message:"Unable to obtain user information. Please try again later."},[e.Oauth2UnableToFetchConnections]:{type:"general",message:"Unable to obtain connections. Please try again later."},[e.Oauth2UserWithoutConnection]:{type:"general",message:"No connections found. Please add a connection and try again later."},[e.Oauth2ConnectionNotVerified]:{type:"general",message:"The connection is not verified. Please try again later."},[e.ReleaseNotFound]:{type:"general",message:"Sorry, no release found. Please try again later."},[e.ReleaseVersionAlreadyExists]:{type:"general",message:"Release version already exists."}};class l{static getError(n){return u[n]??u[e.GenericUnknown]}static getErrorResponse(n,t){if(Array.isArray(n))return{type:"error",errors:n.map((a)=>l.parseErrorCode(a,t))};else return{type:"error",errors:[l.parseErrorCode(n,t)]}}static parseErrorResponse(n){if(!l.isErrorResponse(n))return null;return n.errors}static isErrorResponse(n){return n?.type==="error"}static parseErrorCode(n,t){let{type:a,message:i}=l.getError(n);if(a==="input"){if(t===void 0)throw new Error("Input is required for Input errors");return{type:a,message:i,errorCode:n,input:t}}else return{type:a,message:i,errorCode:n}}static handleErrors(n,t){switch(n){case"VALIDATION":return[400,l.getErrorResponse(e.GenericValidationFailed)];case"NOT_FOUND":return[404,l.getErrorResponse(e.GenericNotFound)];case"PARSE":return[400,l.getErrorResponse(e.GenericParseFailed)];case"INTERNAL_SERVER_ERROR":return console.error(t),[500,l.getErrorResponse(e.GenericInternalError)];default:return console.error(t),[500,l.getErrorResponse(e.GenericUnknown)]}}}class p{static get(n,t,a,i){return this.request(n,t,a,{...i,method:"GET"})}static post(n,t,a,i){return this.request(n,t,a,{...i,method:"POST"})}static put(n,t,a,i){return this.request(n,t,a,{...i,method:"PUT"})}static patch(n,t,a,i){return this.request(n,t,a,{...i,method:"PATCH"})}static delete(n,t,a,i){return this.request(n,t,a,{...i,method:"DELETE"})}static async request(n,t,a,i){let o={...i,body:i.body?JSON.stringify(i.body):void 0,headers:i.headers??{}};if(a)o.headers.Authorization=a;let h=await fetch(n+t,o);return p.parseResponse(h)}static async parseResponse(n){let t=await n.json(),a=l.parseErrorResponse(t);if(a)return{data:void 0,errors:a};return{data:t,errors:void 0}}}export{p as HTTP};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ export declare enum BotStatus {
|
|
|
11
11
|
Busy = 3,
|
|
12
12
|
Disconnected = 4
|
|
13
13
|
}
|
|
14
|
+
export declare enum CommandReplyFormat {
|
|
15
|
+
Neutral = 0,
|
|
16
|
+
Success = 1,
|
|
17
|
+
Info = 2,
|
|
18
|
+
Warn = 3,
|
|
19
|
+
Error = 4
|
|
20
|
+
}
|
|
14
21
|
export declare enum CategoryConfigSupportedPlatforms {
|
|
15
22
|
Win = "WIN",
|
|
16
23
|
Mac = "MAC",
|
|
@@ -233,6 +240,7 @@ export interface ICategoryConfig {
|
|
|
233
240
|
bpLevel?: number[];
|
|
234
241
|
disableMatchmakingChecks?: boolean;
|
|
235
242
|
disableJoinMessages?: boolean;
|
|
243
|
+
disableAutomaticMessages?: boolean;
|
|
236
244
|
inviteTimeout?: number;
|
|
237
245
|
maxBotsPerLobby?: number;
|
|
238
246
|
maxBotsPerLobbyWithOwner?: number;
|
package/dist/types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a;((_)=>{_[_.Public=0]="Public";_[_.Private=1]="Private"})(a||={});var x;((e)=>{e[e.Offline=0]="Offline";e[e.Booting=1]="Booting";e[e.Available=2]="Available";e[e.Busy=3]="Busy";e[e.Disconnected=4]="Disconnected"})(x||={});var f;((e)=>{e[e.Neutral=0]="Neutral";e[e.Success=1]="Success";e[e.Info=2]="Info";e[e.Warn=3]="Warn";e[e.Error=4]="Error"})(f||={});var d;((b)=>{b.Win="WIN";b.Mac="MAC";b.Psn="PSN";b.Xbl="XBL";b.Swt="SWT";b.Ios="IOS";b.And="AND";b.Ps5="PS5";b.Xsx="XSX"})(d||={});var m;((_)=>{_[_.Public=0]="Public";_[_.Private=1]="Private"})(m||={});var U;((u)=>{u[u.Equals=0]="Equals";u[u.Includes=1]="Includes";u[u.StartsWith=2]="StartsWith";u[u.EndsWith=3]="EndsWith"})(U||={});var k;((n)=>{n[n.ChatBan=0]="ChatBan";n[n.Kick=1]="Kick";n[n.Block=2]="Block";n[n.RemoveFriend=3]="RemoveFriend";n[n.AddFriend=4]="AddFriend";n[n.Promote=5]="Promote";n[n.Copy=6]="Copy";n[n.Mimic=7]="Mimic";n[n.Hide=8]="Hide";n[n.Show=9]="Show";n[n.Blacklist=10]="Blacklist";n[n.Whitelist=11]="Whitelist"})(k||={});var h;((l)=>{l.GenericUnknown="net.fnlb.errors.generic.unknown";l.GenericInternalError="net.fnlb.errors.generic.internal_error";l.GenericValidationFailed="net.fnlb.errors.generic.validation_failed";l.GenericParseFailed="net.fnlb.errors.generic.parse_failed";l.GenericNotFound="net.fnlb.errors.generic.not_found";l.CommonInvalidRequest="net.fnlb.errors.common.invalid_request";l.CommonUnableToProcessRequest="net.fnlb.errors.common.unable_to_process_request";l.CommonInvalidFieldsLength="net.fnlb.errors.common.invalid_body_fields_length";l.CommonRateLimitExceeded="net.fnlb.errors.common.rate_limit_exceeded";l.CommonUnableToSaveToDatabase="net.fnlb.errors.common.unable_to_save_to_database";l.AuthInvalidToken="net.fnlb.errors.auth.invalid_token";l.AuthInvalidAPIToken="net.fnlb.errors.auth.invalid_api_token";l.AuthInvalidCaptchaToken="net.fnlb.errors.auth.invalid_captcha_token";l.AuthUnauthorized="net.fnlb.errors.auth.unauthorized";l.AuthUserBanned="net.fnlb.errors.auth.user_banned";l.Oauth2InvalidCode="net.fnlb.errors.oauth2.invalid_code";l.Oauth2InvalidScope="net.fnlb.errors.oauth2.invalid_scope";l.Oauth2TokenInvalid="net.fnlb.errors.oauth2.token_invalid";l.Oauth2UnableToFetchUser="net.fnlb.errors.oauth2.unable_to_fetch_user";l.Oauth2UnableToFetchConnections="net.fnlb.errors.oauth2.unable_to_fetch_connections";l.Oauth2UserWithoutConnection="net.fnlb.errors.oauth2.user_without_connection";l.Oauth2ConnectionNotVerified="net.fnlb.errors.oauth2.connection_not_verified";l.ReleaseNotFound="net.fnlb.errors.release.no_release_found";l.ReleaseVersionAlreadyExists="net.fnlb.errors.release.version_already_exists"})(h||={});var v;((u)=>{u.LoginInvalidCredentials="net.fnlb.errors.login.invalid_credentials";u.LoginInvalidEmail="net.fnlb.errors.login.invalid_email";u.LoginInvalidOrUsedEmail="net.fnlb.errors.login.invalid_or_used_email";u.AuthPasswordConfirmationInvalid="net.fnlb.errors.auth.invalid_password_confirmation"})(v||={});var q={...h,...v};var I;((u)=>{u.Username="username";u.Email="email";u.Password="password";u.Shared="shared"})(I||={});var O;((_)=>{_.General="general";_.Input="input"})(O||={});var P;((s)=>{s.Default="en";s.De="de";s.Es="es";s.Fr="fr";s.It="it";s.Pl="pl";s.Pt="pt";s.Tr="tr"})(P||={});export{P as Locales,v as InputErrorCodes,h as GeneralErrorCodes,O as ErrorTypes,I as ErrorInputTypes,q as ErrorCodes,f as CommandReplyFormat,U as CategoryConfigTriggerStringDetectionMethod,k as CategoryConfigTriggerAction,d as CategoryConfigSupportedPlatforms,m as CategoryConfigPartyPrivacy,a as BotTypes,x as BotStatus};
|
package/dist/util/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class i{static encodeToken(r,t){return Buffer.from(`${r}.${t}`).toString("base64").replaceAll("=","")}static decodeToken(r){
|
|
1
|
+
class i{static encodeToken(r,t){return Buffer.from(`${r}.${t}`).toString("base64").replaceAll("=","")}static decodeToken(r){let[t,e]=Buffer.from(r,"base64").toString("utf8").split(".");if(!t||!e)return null;return{id:t,auth:e}}}class s{static wait(r){return new Promise((t)=>setTimeout(t,r))}}class n{static cutText(r,t,e=!0){return r.length>t?`${r.slice(0,e?Math.max(t-3,0):t)}${e?"...":""}`:r}}export{n as TextUtil,s as PromiseUtil,i as AuthUtil};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fnlb-project/shared",
|
|
3
3
|
"description": "FNLB Shared Library",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@biomejs/biome": "^1.
|
|
39
|
-
"@types/bun": "^1.1.
|
|
40
|
-
"bun-plugin-dts": "^0.
|
|
41
|
-
"typescript": "^5.
|
|
38
|
+
"@biomejs/biome": "^1.9.4",
|
|
39
|
+
"@types/bun": "^1.1.11",
|
|
40
|
+
"bun-plugin-dts": "^0.3.0",
|
|
41
|
+
"typescript": "^5.6.3"
|
|
42
42
|
},
|
|
43
43
|
"packageManager": "bun@1.1.17"
|
|
44
44
|
}
|