JSDoc | Library

Worldwide news multiplexer and translator


JSDoc documentation for library functions

Classes

AuthStar

Own-rolled authorization framework for the EcheloNews API

Members

login

JWT-based authorization middleware

register

Login middleware

Functions

setIDAfterSaving(Schema, idColName)undefined

On save, make the database return the id of the saved entry and set it as the JS instance id

tm2DateAfterFetch(Schema, Schema, tmColName)undefined

After having fetched a user, convert a postgres timestamp in a JS Date

validateBeforeQuery(Schema, idColName)undefined

Run validators before performing any default query

translateArticle(article, lang)Promise.<Article>

Translate an article

stringArray(value, options)string | null

Check if something is an array of non-blank strings

languageCode(value, options)string | null

Check if something is a valid ISO language code

countryCode(value, options)string | null

Check if something is a valid ISO country code

countryCodeArray(value, options)string | null

Check if something is an array of valid ISO country codes

AuthStar

Own-rolled authorization framework for the EcheloNews API

Kind: global class

authStar.loginStrategy

Passport strategy for local users login

Kind: instance property of AuthStar

authStar.loginMidware

Express/Connect middleware for local users login

Kind: instance property of AuthStar

authStar.middlewares

AuthStar middlewares

Kind: instance property of AuthStar

AuthStar.setup(opt) ⇒ Class

Setup Authorization framework

Kind: static method of AuthStar
Returns: Class - The AuthStar class

Param Type Description
opt object Function parameters
opt.log object Pino logger used by the application
opt.userHandlerUrl string URL to the User Handler API

AuthStar.jwtMidware()

Express/Connect middleware for user authorization via Json Web Tokens

Kind: static method of AuthStar

AuthStar.registerMidware()

Express/Connect middleware for local users registration

Kind: static method of AuthStar

login

JWT-based authorization middleware

Kind: global variable

register

Login middleware

Kind: global variable

setIDAfterSaving(Schema, idColName) ⇒ undefined

On save, make the database return the id of the saved entry and set it as the JS instance id

Kind: global function

Param Type Description
Schema Class The schema extending Perseest.Class
idColName string The name of the ID column

tm2DateAfterFetch(Schema, Schema, tmColName) ⇒ undefined

After having fetched a user, convert a postgres timestamp in a JS Date

Kind: global function

Param Type Description
Schema Class  
Schema Class The schema extending Perseest.Class
tmColName string The name of the timestamp column

validateBeforeQuery(Schema, idColName) ⇒ undefined

Run validators before performing any default query

Kind: global function

Param Type Description
Schema Class The schema extending Perseest.Class
idColName string The name of the ID column

translateArticle(article, lang) ⇒ Promise.<Article>

Translate an article

Kind: global function
Returns: Promise.<Article> - The article with the requested translation (also does side-effect, reading the return value is not strictly needed)
Throws:

  • The target language must be valid
  • Calling the Google API must succeed
Param Type Description
article Article The article to translate
lang string The target transation language

stringArray(value, options) ⇒ string | null

Check if something is an array of non-blank strings

Kind: global function
Returns: string | null - a string on validation error, null otherwise

Param Type Description
value \* The value to validate
options boolean Validation options

languageCode(value, options) ⇒ string | null

Check if something is a valid ISO language code

Kind: global function
Returns: string | null - a string on validation error, null otherwise

Param Type Description
value \* The value to validate
options boolean Validation options

countryCode(value, options) ⇒ string | null

Check if something is a valid ISO country code

Kind: global function
Returns: string | null - a string on validation error, null otherwise

Param Type Description
value \* The value to validate
options boolean Validation options

countryCodeArray(value, options) ⇒ string | null

Check if something is an array of valid ISO country codes

Kind: global function
Returns: string | null - a string on validation error, null otherwise

Param Type Description
value \* The value to validate
options boolean Validation options