@fnlb-project/shared 1.5.78 → 1.5.79
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 +2 -1
- package/dist/types/index.js +1 -1
- package/dist/updater/index.js +1 -1
- package/package.json +1 -1
package/dist/errors/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var m;((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.GenericAlreadyExists="net.fnlb.errors.generic.already_exists";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.CommonLimitExceeded="net.fnlb.errors.common.limit_exceeded";n.CommonUnableToSaveToDatabase="net.fnlb.errors.common.unable_to_save_to_database";n.CommonUpdateRequired="net.fnlb.errors.common.update_required";n.CommonMaintenanceMode="net.fnlb.errors.common.maintenance_mode";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.AuthForbidden="net.fnlb.errors.auth.forbidden";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"})(m||={});var d;((s)=>{s.LoginInvalidCredentials="net.fnlb.errors.login.invalid_credentials";s.LoginInvalidEmail="net.fnlb.errors.login.invalid_email";s.LoginInvalidOrUsedEmail="net.fnlb.errors.login.invalid_or_used_email";s.AuthPasswordConfirmationInvalid="net.fnlb.errors.auth.invalid_password_confirmation"})(d||={});var e={...m,...d};var l={[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.GenericAlreadyExists]:{type:"general",message:"This resource already exists."},[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.CommonLimitExceeded]:{type:"general",message:"Sorry, you reached the limit for this resource."},[e.CommonUnableToSaveToDatabase]:{type:"general",message:"Unable to save changes. Please check all fields."},[e.CommonUpdateRequired]:{type:"general",message:"Your version is out of date and no longer supported. Please update and try again."},[e.CommonMaintenanceMode]:{type:"general",message:"The system is currently in maintenance mode. Please try again later."},[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 lack the necessary authorization to perform this action."},[e.AuthForbidden]:{type:"general",message:"You do not have permission 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 a{static getError(t){return l[t]??l[e.GenericUnknown]}static getErrorResponse(t,i){if(Array.isArray(t))return{type:"error",errors:t.map((o)=>a.parseErrorCode(o,i))};else return{type:"error",errors:[a.parseErrorCode(t,i)]}}static parseErrorResponse(t){if(!a.isErrorResponse(t))return null;return t.errors}static isErrorResponse(t){return t?.type==="error"}static parseErrorCode(t,i){let{type:o,message:r}=a.getError(t);if(o==="input"){if(i===void 0)throw
|
|
1
|
+
var m;((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.GenericAlreadyExists="net.fnlb.errors.generic.already_exists";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.CommonLimitExceeded="net.fnlb.errors.common.limit_exceeded";n.CommonUnableToSaveToDatabase="net.fnlb.errors.common.unable_to_save_to_database";n.CommonUpdateRequired="net.fnlb.errors.common.update_required";n.CommonMaintenanceMode="net.fnlb.errors.common.maintenance_mode";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.AuthForbidden="net.fnlb.errors.auth.forbidden";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"})(m||={});var d;((s)=>{s.LoginInvalidCredentials="net.fnlb.errors.login.invalid_credentials";s.LoginInvalidEmail="net.fnlb.errors.login.invalid_email";s.LoginInvalidOrUsedEmail="net.fnlb.errors.login.invalid_or_used_email";s.AuthPasswordConfirmationInvalid="net.fnlb.errors.auth.invalid_password_confirmation"})(d||={});var e={...m,...d};var l={[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.GenericAlreadyExists]:{type:"general",message:"This resource already exists."},[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.CommonLimitExceeded]:{type:"general",message:"Sorry, you reached the limit for this resource."},[e.CommonUnableToSaveToDatabase]:{type:"general",message:"Unable to save changes. Please check all fields."},[e.CommonUpdateRequired]:{type:"general",message:"Your version is out of date and no longer supported. Please update and try again."},[e.CommonMaintenanceMode]:{type:"general",message:"The system is currently in maintenance mode. Please try again later."},[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 lack the necessary authorization to perform this action."},[e.AuthForbidden]:{type:"general",message:"You do not have permission 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 a{static getError(t){return l[t]??l[e.GenericUnknown]}static getErrorResponse(t,i){if(Array.isArray(t))return{type:"error",errors:t.map((o)=>a.parseErrorCode(o,i))};else return{type:"error",errors:[a.parseErrorCode(t,i)]}}static parseErrorResponse(t){if(!a.isErrorResponse(t))return null;return t.errors}static isErrorResponse(t){return t?.type==="error"}static parseErrorCode(t,i){let{type:o,message:r}=a.getError(t);if(o==="input"){if(i===void 0)throw Error("Input is required for Input errors");return{type:o,message:r,errorCode:t,input:i}}else return{type:o,message:r,errorCode:t}}static handleErrors(t,i){switch(t){case"VALIDATION":return[400,a.getErrorResponse(e.GenericValidationFailed)];case"NOT_FOUND":return[404,a.getErrorResponse(e.GenericNotFound)];case"PARSE":return[400,a.getErrorResponse(e.GenericParseFailed)];case"INTERNAL_SERVER_ERROR":return console.error(i),[500,a.getErrorResponse(e.GenericInternalError)];default:return console.error(i),[500,a.getErrorResponse(e.GenericUnknown)]}}}class u{}export{u as GenericErrorSender,a as ErrorHandler};
|
package/dist/http/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var d;((t)=>{t.GenericUnknown="net.fnlb.errors.generic.unknown";t.GenericInternalError="net.fnlb.errors.generic.internal_error";t.GenericValidationFailed="net.fnlb.errors.generic.validation_failed";t.GenericParseFailed="net.fnlb.errors.generic.parse_failed";t.GenericNotFound="net.fnlb.errors.generic.not_found";t.GenericAlreadyExists="net.fnlb.errors.generic.already_exists";t.CommonInvalidRequest="net.fnlb.errors.common.invalid_request";t.CommonUnableToProcessRequest="net.fnlb.errors.common.unable_to_process_request";t.CommonInvalidFieldsLength="net.fnlb.errors.common.invalid_body_fields_length";t.CommonRateLimitExceeded="net.fnlb.errors.common.rate_limit_exceeded";t.CommonLimitExceeded="net.fnlb.errors.common.limit_exceeded";t.CommonUnableToSaveToDatabase="net.fnlb.errors.common.unable_to_save_to_database";t.CommonUpdateRequired="net.fnlb.errors.common.update_required";t.CommonMaintenanceMode="net.fnlb.errors.common.maintenance_mode";t.AuthInvalidToken="net.fnlb.errors.auth.invalid_token";t.AuthInvalidAPIToken="net.fnlb.errors.auth.invalid_api_token";t.AuthInvalidCaptchaToken="net.fnlb.errors.auth.invalid_captcha_token";t.AuthUnauthorized="net.fnlb.errors.auth.unauthorized";t.AuthForbidden="net.fnlb.errors.auth.forbidden";t.AuthUserBanned="net.fnlb.errors.auth.user_banned";t.Oauth2InvalidCode="net.fnlb.errors.oauth2.invalid_code";t.Oauth2InvalidScope="net.fnlb.errors.oauth2.invalid_scope";t.Oauth2TokenInvalid="net.fnlb.errors.oauth2.token_invalid";t.Oauth2UnableToFetchUser="net.fnlb.errors.oauth2.unable_to_fetch_user";t.Oauth2UnableToFetchConnections="net.fnlb.errors.oauth2.unable_to_fetch_connections";t.Oauth2UserWithoutConnection="net.fnlb.errors.oauth2.user_without_connection";t.Oauth2ConnectionNotVerified="net.fnlb.errors.oauth2.connection_not_verified";t.ReleaseNotFound="net.fnlb.errors.release.no_release_found";t.ReleaseVersionAlreadyExists="net.fnlb.errors.release.version_already_exists"})(d||={});var u;((r)=>{r.LoginInvalidCredentials="net.fnlb.errors.login.invalid_credentials";r.LoginInvalidEmail="net.fnlb.errors.login.invalid_email";r.LoginInvalidOrUsedEmail="net.fnlb.errors.login.invalid_or_used_email";r.AuthPasswordConfirmationInvalid="net.fnlb.errors.auth.invalid_password_confirmation"})(u||={});var e={...d,...u};var l={[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.GenericAlreadyExists]:{type:"general",message:"This resource already exists."},[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.CommonLimitExceeded]:{type:"general",message:"Sorry, you reached the limit for this resource."},[e.CommonUnableToSaveToDatabase]:{type:"general",message:"Unable to save changes. Please check all fields."},[e.CommonUpdateRequired]:{type:"general",message:"Your version is out of date and no longer supported. Please update and try again."},[e.CommonMaintenanceMode]:{type:"general",message:"The system is currently in maintenance mode. Please try again later."},[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 lack the necessary authorization to perform this action."},[e.AuthForbidden]:{type:"general",message:"You do not have permission 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 o{static getError(n){return l[n]??l[e.GenericUnknown]}static getErrorResponse(n,i){if(Array.isArray(n))return{type:"error",errors:n.map((s)=>o.parseErrorCode(s,i))};else return{type:"error",errors:[o.parseErrorCode(n,i)]}}static parseErrorResponse(n){if(!o.isErrorResponse(n))return null;return n.errors}static isErrorResponse(n){return n?.type==="error"}static parseErrorCode(n,i){let{type:s,message:a}=o.getError(n);if(s==="input"){if(i===void 0)throw
|
|
1
|
+
var d;((t)=>{t.GenericUnknown="net.fnlb.errors.generic.unknown";t.GenericInternalError="net.fnlb.errors.generic.internal_error";t.GenericValidationFailed="net.fnlb.errors.generic.validation_failed";t.GenericParseFailed="net.fnlb.errors.generic.parse_failed";t.GenericNotFound="net.fnlb.errors.generic.not_found";t.GenericAlreadyExists="net.fnlb.errors.generic.already_exists";t.CommonInvalidRequest="net.fnlb.errors.common.invalid_request";t.CommonUnableToProcessRequest="net.fnlb.errors.common.unable_to_process_request";t.CommonInvalidFieldsLength="net.fnlb.errors.common.invalid_body_fields_length";t.CommonRateLimitExceeded="net.fnlb.errors.common.rate_limit_exceeded";t.CommonLimitExceeded="net.fnlb.errors.common.limit_exceeded";t.CommonUnableToSaveToDatabase="net.fnlb.errors.common.unable_to_save_to_database";t.CommonUpdateRequired="net.fnlb.errors.common.update_required";t.CommonMaintenanceMode="net.fnlb.errors.common.maintenance_mode";t.AuthInvalidToken="net.fnlb.errors.auth.invalid_token";t.AuthInvalidAPIToken="net.fnlb.errors.auth.invalid_api_token";t.AuthInvalidCaptchaToken="net.fnlb.errors.auth.invalid_captcha_token";t.AuthUnauthorized="net.fnlb.errors.auth.unauthorized";t.AuthForbidden="net.fnlb.errors.auth.forbidden";t.AuthUserBanned="net.fnlb.errors.auth.user_banned";t.Oauth2InvalidCode="net.fnlb.errors.oauth2.invalid_code";t.Oauth2InvalidScope="net.fnlb.errors.oauth2.invalid_scope";t.Oauth2TokenInvalid="net.fnlb.errors.oauth2.token_invalid";t.Oauth2UnableToFetchUser="net.fnlb.errors.oauth2.unable_to_fetch_user";t.Oauth2UnableToFetchConnections="net.fnlb.errors.oauth2.unable_to_fetch_connections";t.Oauth2UserWithoutConnection="net.fnlb.errors.oauth2.user_without_connection";t.Oauth2ConnectionNotVerified="net.fnlb.errors.oauth2.connection_not_verified";t.ReleaseNotFound="net.fnlb.errors.release.no_release_found";t.ReleaseVersionAlreadyExists="net.fnlb.errors.release.version_already_exists"})(d||={});var u;((r)=>{r.LoginInvalidCredentials="net.fnlb.errors.login.invalid_credentials";r.LoginInvalidEmail="net.fnlb.errors.login.invalid_email";r.LoginInvalidOrUsedEmail="net.fnlb.errors.login.invalid_or_used_email";r.AuthPasswordConfirmationInvalid="net.fnlb.errors.auth.invalid_password_confirmation"})(u||={});var e={...d,...u};var l={[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.GenericAlreadyExists]:{type:"general",message:"This resource already exists."},[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.CommonLimitExceeded]:{type:"general",message:"Sorry, you reached the limit for this resource."},[e.CommonUnableToSaveToDatabase]:{type:"general",message:"Unable to save changes. Please check all fields."},[e.CommonUpdateRequired]:{type:"general",message:"Your version is out of date and no longer supported. Please update and try again."},[e.CommonMaintenanceMode]:{type:"general",message:"The system is currently in maintenance mode. Please try again later."},[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 lack the necessary authorization to perform this action."},[e.AuthForbidden]:{type:"general",message:"You do not have permission 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 o{static getError(n){return l[n]??l[e.GenericUnknown]}static getErrorResponse(n,i){if(Array.isArray(n))return{type:"error",errors:n.map((s)=>o.parseErrorCode(s,i))};else return{type:"error",errors:[o.parseErrorCode(n,i)]}}static parseErrorResponse(n){if(!o.isErrorResponse(n))return null;return n.errors}static isErrorResponse(n){return n?.type==="error"}static parseErrorCode(n,i){let{type:s,message:a}=o.getError(n);if(s==="input"){if(i===void 0)throw Error("Input is required for Input errors");return{type:s,message:a,errorCode:n,input:i}}else return{type:s,message:a,errorCode:n}}static handleErrors(n,i){switch(n){case"VALIDATION":return[400,o.getErrorResponse(e.GenericValidationFailed)];case"NOT_FOUND":return[404,o.getErrorResponse(e.GenericNotFound)];case"PARSE":return[400,o.getErrorResponse(e.GenericParseFailed)];case"INTERNAL_SERVER_ERROR":return console.error(i),[500,o.getErrorResponse(e.GenericInternalError)];default:return console.error(i),[500,o.getErrorResponse(e.GenericUnknown)]}}}class m{static get(n,i,s,a){return this.request(n,i,s,{...a,method:"GET"})}static post(n,i,s,a){return this.request(n,i,s,{...a,method:"POST"})}static put(n,i,s,a){return this.request(n,i,s,{...a,method:"PUT"})}static patch(n,i,s,a){return this.request(n,i,s,{...a,method:"PATCH"})}static delete(n,i,s,a){return this.request(n,i,s,{...a,method:"DELETE"})}static async request(n,i,s,a){let r={...a,body:a.body?JSON.stringify(a.body):void 0,headers:a.headers??{}};if(s)r.headers.Authorization=s;if(!r.headers["Content-Type"]&&r.body)r.headers["Content-Type"]="application/json";let c=await fetch(n+i,r);return m.parseResponse(c)}static async parseResponse(n){if(n.headers.get("Content-Type")?.includes("text/plain")){let s=await n.text(),a=o.parseErrorResponse(s);if(a)return{data:void 0,errors:a};if(!n.ok)throw Error(`Request failed with status code ${n.status}: ${s}`);return{data:s,errors:void 0}}else{let s=await n.json(),a=o.parseErrorResponse(s);if(a)return{data:void 0,errors:a};if(!n.ok)throw Error(`Request failed with status code ${n.status}: ${JSON.stringify(s,null,2)}`);return{data:s,errors:void 0}}}}export{m as HTTP};
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var h;((i)=>{i[i.Offline=0]="Offline";i[i.Booting=1]="Booting";i[i.Available=2]="Available";i[i.Busy=3]="Busy";i[i.Disconnected=4]="Disconnected"})(h||={});var r;((i)=>{i[i.Neutral=0]="Neutral";i[i.Success=1]="Success";i[i.Info=2]="Info";i[i.Warn=3]="Warn";i[i.Error=4]="Error"})(r||={});var f;((l)=>{l.Win="WIN";l.Mac="MAC";l.Psn="PSN";l.Xbl="XBL";l.Swt="SWT";l.Swt2="SWT2";l.Ios="IOS";l.And="AND";l.Ps5="PS5";l.Xsx="XSX"})(f||={});var v;((d)=>{d[d.Public=0]="Public";d[d.Private=1]="Private"})(v||={});var o;((u)=>{u[u.Auto=0]="Auto";u[u.Online=1]="Online";u[u.Away=2]="Away"})(o||={});var c;((a)=>{a[a.Equals=0]="Equals";a[a.Includes=1]="Includes";a[a.StartsWith=2]="StartsWith";a[a.EndsWith=3]="EndsWith"})(c||={});var x;((t)=>{t[t.Blacklist=0]="Blacklist";t[t.Whitelist=1]="Whitelist";t[t.Kick=2]="Kick";t[t.Block=3]="Block";t[t.RemoveFriend=4]="RemoveFriend";t[t.AddFriend=5]="AddFriend";t[t.Promote=6]="Promote";t[t.Copy=7]="Copy";t[t.Mimic=8]="Mimic";t[t.Hide=9]="Hide";t[t.Show=10]="Show"})(x||={});var k;((s)=>{s.Default="en";s.EnUS="en-US";s.Es="es";s.Es419="es-419";s.Ar="ar";s.De="de";s.Fr="fr";s.He="he";s.Id="id";s.It="it";s.Ja="ja";s.Ko="ko";s.Pl="pl";s.Pt="pt";s.PtBR="pt-BR";s.Ru="ru";s.Th="th";s.Tr="tr";s.Vi="vi";s.Zh="zh";s.ZhHant="zh-Hant"})(k||={});var p;((_)=>{_.Default="en";_.Ar="ar";_.De="de";_.Es="es";_.Es419="es-419";_.Fr="fr";_.Id="id";_.It="it";_.Ja="ja";_.Ko="ko";_.Pl="pl";_.PtBR="pt-BR";_.Ru="ru";_.Th="th";_.Tr="tr";_.Vi="vi";_.ZhHans="zh-Hans";_.ZhHant="zh-Hant"})(p||={});var R={searchLangs:["en"],platform:["AND"],privacy:0,prefixes:["!",".","/"],statusType:0,statusText:[],statusInterval:2,level:[-999999999],bpLevel:[999999999],extraOwners:[],admins:[],whitelistUsers:[],blacklistUsers:[],excludedAutoAddFriends:[],otherBots:[],inviteTimeout:60,maxBotsPerLobby:8,maxBotsPerLobbyWithOwner:16,maxBotsPerLobbyWithAdmin:16,maxBotsPerLobbyWithWhitelistUser:16,allowMatchmaking:!0,leaveAfterMatchmaking:!1,disableMatchmakingChecks:!0,disablePlaylistChecks:!1,disableJoinMessages:!1,disableAutomaticMessages:!1,acceptFriendRequests:!0,sendFriendRequestOnJoinParty:!1,sendFriendRequestOnMemberJoinParty:!1,runCommandsWithoutPrefix:!0,setCosmeticsWithoutCommands:!0,setCosmeticsWithPrefix:!0,acceptInvites:!0,startBannedBots:!0,usernameTriggers:[],messageContentTriggers:[],addFriendTriggers:[],memberJoinTriggers:[],changeCosmeticTriggers:[],onlyOwnerCommands:["send_number","send_all","send_category","remove_all_friends","decline_all_friends","accept_all_friends","unblock_all_users","restart_bot","restart_category","restart_shard"],onlyAdminCommands:["add_friend","remove_friend","block_user","unblock_user"],onlyWhitelistUsersCommands:["send_party","send_shard","kick","kick_all","hide_all","message","whisper","accept_friend","decline_friend","set_status","say"],onlyFriendsCommands:[],onlyPartyMembersCommands:[],onlyWhisperCommands:[],startOutfit:[{id:"CID_030_Athena_Commando_M_Halloween",variants:[1,0]},{id:"CID_029_Athena_Commando_F_Halloween",variants:[2]},{id:"CID_434_Athena_Commando_F_StealthHonor",variants:[]},{id:"CID_175_Athena_Commando_M_Celestial",variants:[]}],startBackpack:[{id:"BID_138_Celestial",variants:[]},{id:"BID_004_BlackKnight",variants:[]}],startPickaxe:[{id:"Pickaxe_ID_116_Celestial",variants:[]},{id:"Pickaxe_ID_013_Teslacoil",variants:[]}],startShoes:[],startBanner:[{id:"BRSeason01"}],startBannerColor:[{id:"DefaultColor17"},{id:"DefaultColor14"}],joinOutfit:[],joinBackpack:[],joinPickaxe:[],joinEmote:[{id:"EID_KPopDance03"}],joinShoes:[],joinBanner:[],joinBannerColor:[],memberJoinOutfit:[],memberJoinBackpack:[],memberJoinPickaxe:[],memberJoinEmote:[{id:"EID_KPopDance03"}],memberJoinShoes:[],memberJoinBanner:[],memberJoinBannerColor:[]};var D;((n)=>{n[n.RequiredParam=0]="RequiredParam";n[n.OptionalParam=1]="OptionalParam";n[n.RequiredSelect=2]="RequiredSelect";n[n.OptionalSelect=3]="OptionalSelect";n[n.RequiredNumericParam=4]="RequiredNumericParam";n[n.OptionalNumericParam=5]="OptionalNumericParam"})(D||={});var b;((e)=>{e.GenericUnknown="net.fnlb.errors.generic.unknown";e.GenericInternalError="net.fnlb.errors.generic.internal_error";e.GenericValidationFailed="net.fnlb.errors.generic.validation_failed";e.GenericParseFailed="net.fnlb.errors.generic.parse_failed";e.GenericNotFound="net.fnlb.errors.generic.not_found";e.GenericAlreadyExists="net.fnlb.errors.generic.already_exists";e.CommonInvalidRequest="net.fnlb.errors.common.invalid_request";e.CommonUnableToProcessRequest="net.fnlb.errors.common.unable_to_process_request";e.CommonInvalidFieldsLength="net.fnlb.errors.common.invalid_body_fields_length";e.CommonRateLimitExceeded="net.fnlb.errors.common.rate_limit_exceeded";e.CommonLimitExceeded="net.fnlb.errors.common.limit_exceeded";e.CommonUnableToSaveToDatabase="net.fnlb.errors.common.unable_to_save_to_database";e.CommonUpdateRequired="net.fnlb.errors.common.update_required";e.CommonMaintenanceMode="net.fnlb.errors.common.maintenance_mode";e.AuthInvalidToken="net.fnlb.errors.auth.invalid_token";e.AuthInvalidAPIToken="net.fnlb.errors.auth.invalid_api_token";e.AuthInvalidCaptchaToken="net.fnlb.errors.auth.invalid_captcha_token";e.AuthUnauthorized="net.fnlb.errors.auth.unauthorized";e.AuthForbidden="net.fnlb.errors.auth.forbidden";e.AuthUserBanned="net.fnlb.errors.auth.user_banned";e.Oauth2InvalidCode="net.fnlb.errors.oauth2.invalid_code";e.Oauth2InvalidScope="net.fnlb.errors.oauth2.invalid_scope";e.Oauth2TokenInvalid="net.fnlb.errors.oauth2.token_invalid";e.Oauth2UnableToFetchUser="net.fnlb.errors.oauth2.unable_to_fetch_user";e.Oauth2UnableToFetchConnections="net.fnlb.errors.oauth2.unable_to_fetch_connections";e.Oauth2UserWithoutConnection="net.fnlb.errors.oauth2.user_without_connection";e.Oauth2ConnectionNotVerified="net.fnlb.errors.oauth2.connection_not_verified";e.ReleaseNotFound="net.fnlb.errors.release.no_release_found";e.ReleaseVersionAlreadyExists="net.fnlb.errors.release.version_already_exists"})(b||={});var m;((a)=>{a.LoginInvalidCredentials="net.fnlb.errors.login.invalid_credentials";a.LoginInvalidEmail="net.fnlb.errors.login.invalid_email";a.LoginInvalidOrUsedEmail="net.fnlb.errors.login.invalid_or_used_email";a.AuthPasswordConfirmationInvalid="net.fnlb.errors.auth.invalid_password_confirmation"})(m||={});var z={...b,...m};var O;((a)=>{a.Username="username";a.Email="email";a.Password="password";a.Shared="shared"})(O||={});var w;((d)=>{d.General="general";d.Input="input"})(w||={});var J;((u)=>{u[u.Disabled=1]="Disabled";u[u.Public=2]="Public";u[u.InvalidAuth=4]="InvalidAuth"})(J||={});var q;((d)=>{d[d.Disabled=1]="Disabled";d[d.Managed=2]="Managed"})(q||={});var B;((n)=>{n[n.Staff=1]="Staff";n[n.Admin=2]="Admin";n[n.Vip=4]="Vip";n[n.Verified=8]="Verified";n[n.Banned=16]="Banned";n[n.Tester=32]="Tester"})(B||={});export{R as defaultCategoryConfig,B as UserFlags,k as Locales,m as InputErrorCodes,b as GeneralErrorCodes,w as ErrorTypes,O as ErrorInputTypes,z as ErrorCodes,r as CommandReplyFormat,D as CommandParamType,q as CategoryFlags,c as CategoryConfigTriggerStringMatchingMethod,x as CategoryConfigTriggerAction,f as CategoryConfigSupportedPlatforms,o as CategoryConfigStatusType,v as CategoryConfigPartyPrivacy,h as BotStatus,J as BotFlags,p as APILocales};
|
package/dist/updater/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash as m}from"node:crypto";import{mkdir as u,readFile as f,writeFile as p}from"node:fs/promises";import{resolve as w}from"node:path";class d{lockPromise;constructor(){this.lockPromise=void 0}get isLocked(){return!!this.lockPromise}wait(){return this.lockPromise?.promise||Promise.resolve()}lock(){let e,s=new Promise((n)=>{e=n});this.lockPromise={promise:s,resolve:e}}unlock(){this.lockPromise?.resolve(),this.lockPromise=void 0}}class h{static wait(e){return new Promise((s)=>setTimeout(s,e))}}class y{storageDir;targetFileName;displayName;releaseUrl;releaseProvider;maxDownloadRetries;maxBackoffMs;initialDelayMs;staleMs;log;success;warn;error;isLoaded=!1;lastLoadedTime=0;lock=new d;constructor(e){this.storageDir=e.storageDir,this.targetFileName=e.targetFileName,this.displayName=e.displayName??e.targetFileName,this.releaseUrl=e.releaseUrl,this.releaseProvider=e.releaseProvider,this.maxDownloadRetries=e.maxDownloadRetries??1/0,this.maxBackoffMs=e.maxBackoffMs??60000,this.initialDelayMs=e.initialDelayMs??1000,this.staleMs=e.staleMs??0,this.log=e.log,this.success=e.success,this.warn=e.warn,this.error=e.error}async ensureUpToDate(e){await this.lock.wait(),this.lock.lock();try{let s=this.getFilePath(),n=e||!this.isLoaded;if(this.isLoaded&&!e&&this.staleMs>0){let t=Date.now()-this.lastLoadedTime;if(t>=this.staleMs)n=!0,this.log?.(`${this.displayName} is stale (${Math.round(t/1000)}s old), checking for updates...`)}if(!n)return s;let l=await f(s).catch(()=>null),i,r=0,o=this.initialDelayMs;this.log?.(l?"Checking for updates...":`Downloading ${this.displayName}...`);while(r<this.maxDownloadRetries)try{i=await this.fetchReleaseInfo();break}catch(t){let a=Math.min(o*2,this.maxBackoffMs);if(r++,this.error?.("Update error:",t),this.warn?.(`Check for updates attempt ${r} failed: ${t.message}. Retrying in ${a>=60000?`${~~(a/60000)}m`:`${~~(a/1000)}s`}...`),r>=this.maxDownloadRetries)break;await new Promise((c)=>setTimeout(c,o)),o=a}if(!i){if(l)return this.warn?.("Failed to check for updates. Using existing local version."),this.isLoaded=!0,this.lastLoadedTime=Date.now(),this.success?.(`Loaded existing ${this.displayName} version`),s;throw
|
|
1
|
+
import{createHash as m}from"node:crypto";import{mkdir as u,readFile as f,writeFile as p}from"node:fs/promises";import{resolve as w}from"node:path";class d{lockPromise;constructor(){this.lockPromise=void 0}get isLocked(){return!!this.lockPromise}wait(){return this.lockPromise?.promise||Promise.resolve()}lock(){let e,s=new Promise((n)=>{e=n});this.lockPromise={promise:s,resolve:e}}unlock(){this.lockPromise?.resolve(),this.lockPromise=void 0}}class h{static wait(e){return new Promise((s)=>setTimeout(s,e))}}class y{storageDir;targetFileName;displayName;releaseUrl;releaseProvider;maxDownloadRetries;maxBackoffMs;initialDelayMs;staleMs;log;success;warn;error;isLoaded=!1;lastLoadedTime=0;lock=new d;constructor(e){this.storageDir=e.storageDir,this.targetFileName=e.targetFileName,this.displayName=e.displayName??e.targetFileName,this.releaseUrl=e.releaseUrl,this.releaseProvider=e.releaseProvider,this.maxDownloadRetries=e.maxDownloadRetries??1/0,this.maxBackoffMs=e.maxBackoffMs??60000,this.initialDelayMs=e.initialDelayMs??1000,this.staleMs=e.staleMs??0,this.log=e.log,this.success=e.success,this.warn=e.warn,this.error=e.error}async ensureUpToDate(e){await this.lock.wait(),this.lock.lock();try{let s=this.getFilePath(),n=e||!this.isLoaded;if(this.isLoaded&&!e&&this.staleMs>0){let t=Date.now()-this.lastLoadedTime;if(t>=this.staleMs)n=!0,this.log?.(`${this.displayName} is stale (${Math.round(t/1000)}s old), checking for updates...`)}if(!n)return s;let l=await f(s).catch(()=>null),i,r=0,o=this.initialDelayMs;this.log?.(l?"Checking for updates...":`Downloading ${this.displayName}...`);while(r<this.maxDownloadRetries)try{i=await this.fetchReleaseInfo();break}catch(t){let a=Math.min(o*2,this.maxBackoffMs);if(r++,this.error?.("Update error:",t),this.warn?.(`Check for updates attempt ${r} failed: ${t.message}. Retrying in ${a>=60000?`${~~(a/60000)}m`:`${~~(a/1000)}s`}...`),r>=this.maxDownloadRetries)break;await new Promise((c)=>setTimeout(c,o)),o=a}if(!i){if(l)return this.warn?.("Failed to check for updates. Using existing local version."),this.isLoaded=!0,this.lastLoadedTime=Date.now(),this.success?.(`Loaded existing ${this.displayName} version`),s;throw Error("[AutoUpdater] Failed to check for updates and no local file found.")}if(l){if(m("sha256").update(l).digest("hex")===i.hash)return this.success?.(`${this.displayName} v${i.version} is up to date`),this.isLoaded=!0,this.lastLoadedTime=Date.now(),this.success?.(`Finished loading ${this.displayName} v${i.version}`),s;this.log?.(`Downloading update for ${this.displayName} v${i.version}`)}r=0,o=this.initialDelayMs;while(r<this.maxDownloadRetries)try{let t=await fetch(i.url);if(!t.ok)throw Error(`Download failed with status ${t.status}`);let a=Buffer.from(await t.arrayBuffer());if(m("sha256").update(a).digest("hex")!==i.hash)throw Error("Downloaded file hash mismatch...");return await u(this.storageDir,{recursive:!0}).catch(()=>{throw Error(`Failed to create the target directory on ${this.storageDir}`)}),await p(s,a),this.isLoaded=!0,this.lastLoadedTime=Date.now(),this.success?.(`Finished loading ${this.displayName} v${i.version}`),s}catch(t){let a=Math.min(o*2,this.maxBackoffMs);r++,this.error?.("Download error:",t),this.warn?.(`Download attempt ${r} failed: ${t.message}. Retrying in ${a>=60000?`${~~(a/60000)}m`:`${~~(a/1000)}s`}...`),await h.wait(o),o=a}if(l)return this.warn?.("Max retries reached. Using existing local version."),this.isLoaded=!0,this.lastLoadedTime=Date.now(),this.success?.(`Loaded existing ${this.displayName} version`),s;throw Error(`[AutoUpdater] Failed to download and verify update after ${r} attempts`)}finally{this.lock.unlock()}}getFilePath(){return w(this.storageDir,this.targetFileName)}async fetchReleaseInfo(){if(this.releaseProvider)return this.releaseProvider();if(!this.releaseUrl)throw Error("No release provider configured");let e=await fetch(this.releaseUrl);if(!e.ok)throw Error(`Status code: ${e.status}`);return await e.json()}}export{y as AutoUpdater};
|