Home Reference Source

Function

Static Public Summary
public

addClient(request: Object , reply: Function ): Promise

This function add a new client to the project

public

addKeys(request: Object , reply: Function ): Promise

This function add new keys to the project

public

addLocale(request: Object , reply: Function ): Promise

This function add a new locale to the project

public

addUser(request: Object , reply: Function ): Promise

This function add a new user to the project

public

android(keys: Array , pKeys: Array ): String

This function exports a locale's keys in android XML format

public

apple(keys: Array , pKeys: Array ): String

This function exports a locale's keys in apple format

public

authRoutes(server: Object , options: Object , next: Function ): Promise

This function registers the server's routes for user authentication

public

authenticate(request: Object , reply: Function ): Promise

This function is a wrapper, choosing the right function to authenticate to the API, depending on the grant type

public

clientQuery(_id: String , user: Object ): Object

This function is used to create a query for a given user to a given client

public

clientRoutes(server: Object , options: Object , next: Function ): Promise

This function registers the server's routes for client

public

clientsListQuery(user: Object , id: String ): Object

This function is used to create a query for a given user to retrieve clients

public

createClient(request: Object , reply: Function ): Promise

This function creates a new client

public

createProject(request: Object , reply: Function ): Promise

This function creates a new project, assigning the user creating it to ownership

public

createUser(request: Object , reply: Function ): Promise

This function creates a new user

public

csv(keys: Array , pKeys: Array ): String

This function exports a locale's keys in CSV format

public

deleteClient(request: Object , reply: Function ): Promise

This function deletes a given client

public

deleteClient(request: Object , reply: Function ): Promise

This function removes a client from a project

public

deleteKeys(request: Object , reply: Function ): Promise

This function deletes the given project's keys

public

deleteLocale(request: Object , reply: Function ): Promise

This function removes the given locale from the project

public

deleteProject(request: Object , reply: Function ): Promise

This function is used to delete a project

public

deleteUser(request: Object , reply: Function ): Promise

This function deletes a given user

public

deleteUser(request: Object , reply: Function ): Promise

This function removes a user from a project

public

detailClient(request: Object , reply: Function ): Promise

This function serves details about a client

public

detailMe(request: Object , reply: Function ): Promise

This function serves details about the logged user

public

detailProject(request: Object , reply: Function ): Promise

This function returns the project's details

public

detailUser(request: Object , reply: Function ): Promise

This function serves details about a user

public

exportRoutes(server: Object , options: Object , next: Function ): Promise

This function registers the server's routes for export operations

public

exporterClientProjects(request: Object , reply: Function ): Promise

This function exports some projects' locale, using the provided type and locale code

public

exporterProject(request: Object , reply: Function ): Promise

This function exports a project's locale, using the provided type and locale code

public

exporterProjects(request: Object , reply: Function ): Promise

This function exports some projects' locale, using the provided type and locale code

public

flatjson(keys: Array , pKeys: Array ): String

This function exports a locale's keys in flat json format, meaning that a key some.key will be some.key

public

getClients(request: Object , reply: Function ): Promise

This function lists the project's clients

public

getContentType(type: String ): String

Return the content type to use for the given export type

public

getKeys(request: Object , reply: Function ): Promise

This function retrieves the project's keys

public

getLocales(request: Object , reply: Function ): Promise

This function lists all the project's locales

public

getUsers(request: Object , reply: Function ): Promise

This function lists the project's user

public

healthCheck(request: Object , reply: Function ): Promise

This function is an health check, it simply responds OK when requested

public

index(): Promise

This functions loads the server's plugins and registers the strategy for authentication

public

index(): Promise

This function connects to the dabase

public

index(server: Object ): Promise

This function registers the server's routes

public

json(keys: Array , pKeys: Array ): String

This function exports a locale's keys in json format, meaning that a key some.key will be in an object some with a key key

public

listClients(request: Object , reply: Function ): Promise

This function lists the clients

public

listExporters(request: Object , reply: Function ): Promise

This function exports the accepted export type

public

listProjects(request: Object , reply: Function ): Promise

This function lists the projects :

  • If admin, it lists all the projects
  • If user, it lists the user's projects
public

listUsers(request: Object , reply: Function ): Promise

This function lists the users

public

miscRoutes(server: Object , options: Object , next: Function ): Promise

This function registers the server's routes for misc operations

public

projectRoutes(server: Object , options: Object , next: Function ): Promise

This function registers the server's routes for project

public

projectsListQuery(user: Object , isEditor: Boolean ): Object

This function is used to create a query for a given user to retrieve projects

public

projectsListQueryWithClient(user: Object , _id: String ): Object

This function is used to create a query for a given user to retrieve projects

public

roleProject(request: Object , reply: Function ): Promise

This function gets a user role for a project

public

seed(): Boolean | Promise

This function will seed an admin user if asked by setting the ADMIN_USER variable to true It will check if the user exists and create it if not

public

updateClient(request: Object , reply: Function ): Promise

This function update a given client

public

updateKeys(request: Object , reply: Function ): Promise

This function updates the given project's keys

public

updateLocale(request: Object , reply: Function ): Promise

This function add key's translation to the given locale

public

updateLocales(request: Object , reply: Function ): Promise

This function add key's translation to the given locale

public

updateProject(request: Object , reply: Function ): Promise

This function update the given project

public

updateUser(request: Object , reply: Function ): Promise

This function update a user role to a project

public

updateUser(request: Object , reply: Function ): Promise

This function update a given user

public

userRoutes(server: Object , options: Object , next: Function ): Promise

This function registers the server's routes for user

public

validateUser(decoded: Object , request: Object , callback: Function ): Void

This function will validate a decoded token by fetching the database for the user or the client

public

yaml(keys: Array , pKeys: Array ): String

This function exports a locale's keys in YAML format

Static Public

public addClient(request: Object , reply: Function ): Promise source

This function add a new client to the project

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public addKeys(request: Object , reply: Function ): Promise source

This function add new keys to the project

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public addLocale(request: Object , reply: Function ): Promise source

This function add a new locale to the project

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public addUser(request: Object , reply: Function ): Promise source

This function add a new user to the project

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public android(keys: Array , pKeys: Array ): String source

import android from 'ogma/src/exporter/android.js'

This function exports a locale's keys in android XML format

Params:

NameTypeAttributeDescription
keys Array

the locale's keys

pKeys Array

the project's keys

Return:

String

A XML string

public apple(keys: Array , pKeys: Array ): String source

import apple from 'ogma/src/exporter/apple.js'

This function exports a locale's keys in apple format

Params:

NameTypeAttributeDescription
keys Array

the locale's keys

pKeys Array

the project's keys

Return:

String

A XML string

public authRoutes(server: Object , options: Object , next: Function ): Promise source

import authRoutes from 'ogma/src/routes/auth.routes.js'

This function registers the server's routes for user authentication

Params:

NameTypeAttributeDescription
server Object

the Hapi server

options Object

the plugin options

next Function

the Hapi next function

Return:

Promise

a promise that resolves the server

public authenticate(request: Object , reply: Function ): Promise source

import {authenticate} from 'ogma/src/controllers/auth.controller.js'

This function is a wrapper, choosing the right function to authenticate to the API, depending on the grant type

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public clientQuery(_id: String , user: Object ): Object source

import {clientQuery} from 'ogma/src/helpers/index.js'

This function is used to create a query for a given user to a given client

Params:

NameTypeAttributeDescription
_id String

the client id

user Object

the user

Return:

Object

the query object

public clientRoutes(server: Object , options: Object , next: Function ): Promise source

import clientRoutes from 'ogma/src/routes/client.routes.js'

This function registers the server's routes for client

Params:

NameTypeAttributeDescription
server Object

the Hapi server

options Object

the plugin options

next Function

the Hapi next function

Return:

Promise

a promise that resolves the server

public clientsListQuery(user: Object , id: String ): Object source

import {clientsListQuery} from 'ogma/src/helpers/index.js'

This function is used to create a query for a given user to retrieve clients

Params:

NameTypeAttributeDescription
user Object

the user that want to retrieve clients

id String

the project id

Return:

Object

the query object

public createClient(request: Object , reply: Function ): Promise source

import {createClient} from 'ogma/src/controllers/client.controller.js'

This function creates a new client

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public createProject(request: Object , reply: Function ): Promise source

import {createProject} from 'ogma/src/controllers/project.controller.js'

This function creates a new project, assigning the user creating it to ownership

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public createUser(request: Object , reply: Function ): Promise source

import {createUser} from 'ogma/src/controllers/user.controller.js'

This function creates a new user

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public csv(keys: Array , pKeys: Array ): String source

import csv from 'ogma/src/exporter/csv.js'

This function exports a locale's keys in CSV format

Params:

NameTypeAttributeDescription
keys Array

the locale's keys

pKeys Array

the project's keys

Return:

String

A CSV string

public deleteClient(request: Object , reply: Function ): Promise source

import {deleteClient} from 'ogma/src/controllers/client.controller.js'

This function deletes a given client

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public deleteClient(request: Object , reply: Function ): Promise source

This function removes a client from a project

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public deleteKeys(request: Object , reply: Function ): Promise source

import {deleteKeys} from 'ogma/src/controllers/key.controller.js'

This function deletes the given project's keys

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public deleteLocale(request: Object , reply: Function ): Promise source

import {deleteLocale} from 'ogma/src/controllers/locale.controller.js'

This function removes the given locale from the project

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public deleteProject(request: Object , reply: Function ): Promise source

import {deleteProject} from 'ogma/src/controllers/project.controller.js'

This function is used to delete a project

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public deleteUser(request: Object , reply: Function ): Promise source

import {deleteUser} from 'ogma/src/controllers/user.controller.js'

This function deletes a given user

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public deleteUser(request: Object , reply: Function ): Promise source

This function removes a user from a project

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public detailClient(request: Object , reply: Function ): Promise source

import {detailClient} from 'ogma/src/controllers/client.controller.js'

This function serves details about a client

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public detailMe(request: Object , reply: Function ): Promise source

This function serves details about the logged user

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public detailProject(request: Object , reply: Function ): Promise source

import {detailProject} from 'ogma/src/controllers/project.controller.js'

This function returns the project's details

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public detailUser(request: Object , reply: Function ): Promise source

import {detailUser} from 'ogma/src/controllers/user.controller.js'

This function serves details about a user

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public exportRoutes(server: Object , options: Object , next: Function ): Promise source

import exportRoutes from 'ogma/src/routes/export.routes.js'

This function registers the server's routes for export operations

Params:

NameTypeAttributeDescription
server Object

the Hapi server

options Object

the plugin options

next Function

the Hapi next function

Return:

Promise

a promise that resolves the server

public exporterClientProjects(request: Object , reply: Function ): Promise source

import {exporterClientProjects} from 'ogma/src/controllers/export.controller.js'

This function exports some projects' locale, using the provided type and locale code

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public exporterProject(request: Object , reply: Function ): Promise source

import {exporterProject} from 'ogma/src/controllers/export.controller.js'

This function exports a project's locale, using the provided type and locale code

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public exporterProjects(request: Object , reply: Function ): Promise source

import {exporterProjects} from 'ogma/src/controllers/export.controller.js'

This function exports some projects' locale, using the provided type and locale code

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public flatjson(keys: Array , pKeys: Array ): String source

import flatjson from 'ogma/src/exporter/flatjson.js'

This function exports a locale's keys in flat json format, meaning that a key some.key will be some.key

Params:

NameTypeAttributeDescription
keys Array

the locale's keys

pKeys Array

the project's keys

Return:

String

A XML string

public getClients(request: Object , reply: Function ): Promise source

This function lists the project's clients

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public getContentType(type: String ): String source

import {getContentType} from 'ogma/src/exporter/index.js'

Return the content type to use for the given export type

Params:

NameTypeAttributeDescription
type String

the export type

Return:

String

the content type

public getKeys(request: Object , reply: Function ): Promise source

This function retrieves the project's keys

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public getLocales(request: Object , reply: Function ): Promise source

This function lists all the project's locales

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public getUsers(request: Object , reply: Function ): Promise source

This function lists the project's user

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public healthCheck(request: Object , reply: Function ): Promise source

import {healthCheck} from 'ogma/src/controllers/misc.controller.js'

This function is an health check, it simply responds OK when requested

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public index(): Promise source

import index from 'ogma/src/server/index.js'

This functions loads the server's plugins and registers the strategy for authentication

Return:

Promise

A promise that resolves

public index(): Promise source

import index from 'ogma/src/database/index.js'

This function connects to the dabase

Return:

Promise

a promise that resolves

public index(server: Object ): Promise source

import index from 'ogma/src/routes/index.js'

This function registers the server's routes

Params:

NameTypeAttributeDescription
server Object

the Hapi server

Return:

Promise

a prmise that resolves the server

public json(keys: Array , pKeys: Array ): String source

import json from 'ogma/src/exporter/json.js'

This function exports a locale's keys in json format, meaning that a key some.key will be in an object some with a key key

Params:

NameTypeAttributeDescription
keys Array

the locale's keys

pKeys Array

the project's keys

Return:

String

A XML string

public listClients(request: Object , reply: Function ): Promise source

import {listClients} from 'ogma/src/controllers/client.controller.js'

This function lists the clients

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public listExporters(request: Object , reply: Function ): Promise source

import {listExporters} from 'ogma/src/controllers/export.controller.js'

This function exports the accepted export type

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public listProjects(request: Object , reply: Function ): Promise source

import {listProjects} from 'ogma/src/controllers/project.controller.js'

This function lists the projects :

  • If admin, it lists all the projects
  • If user, it lists the user's projects

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public listUsers(request: Object , reply: Function ): Promise source

import {listUsers} from 'ogma/src/controllers/user.controller.js'

This function lists the users

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public miscRoutes(server: Object , options: Object , next: Function ): Promise source

import miscRoutes from 'ogma/src/routes/misc.routes.js'

This function registers the server's routes for misc operations

Params:

NameTypeAttributeDescription
server Object

the Hapi server

options Object

the plugin options

next Function

the Hapi next function

Return:

Promise

a promise that resolves the server

public projectRoutes(server: Object , options: Object , next: Function ): Promise source

import projectRoutes from 'ogma/src/routes/project.routes.js'

This function registers the server's routes for project

Params:

NameTypeAttributeDescription
server Object

the Hapi server

options Object

the plugin options

next Function

the Hapi next function

Return:

Promise

a promise that resolves the server

public projectsListQuery(user: Object , isEditor: Boolean ): Object source

import {projectsListQuery} from 'ogma/src/helpers/index.js'

This function is used to create a query for a given user to retrieve projects

Params:

NameTypeAttributeDescription
user Object

the user that want to retrieve projects

user._id String

the user's id in database

user.role String

the user's role in database

isEditor Boolean

if the user is a project owner or editor

Return:

Object

the query object

public projectsListQueryWithClient(user: Object , _id: String ): Object source

import {projectsListQueryWithClient} from 'ogma/src/helpers/index.js'

This function is used to create a query for a given user to retrieve projects

Params:

NameTypeAttributeDescription
user Object

the user that want to retrieve projects

_id String

the project id

Return:

Object

the query object

public roleProject(request: Object , reply: Function ): Promise source

This function gets a user role for a project

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public seed(): Boolean | Promise source

import seed from 'ogma/src/config/seed.js'

This function will seed an admin user if asked by setting the ADMIN_USER variable to true It will check if the user exists and create it if not

Return:

Boolean | Promise

a boolean if no user is needed, a promise otherwise

public updateClient(request: Object , reply: Function ): Promise source

import {updateClient} from 'ogma/src/controllers/client.controller.js'

This function update a given client

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public updateKeys(request: Object , reply: Function ): Promise source

import {updateKeys} from 'ogma/src/controllers/key.controller.js'

This function updates the given project's keys

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public updateLocale(request: Object , reply: Function ): Promise source

import {updateLocale} from 'ogma/src/controllers/locale.controller.js'

This function add key's translation to the given locale

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public updateLocales(request: Object , reply: Function ): Promise source

import {updateLocales} from 'ogma/src/controllers/locale.controller.js'

This function add key's translation to the given locale

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public updateProject(request: Object , reply: Function ): Promise source

import {updateProject} from 'ogma/src/controllers/project.controller.js'

This function update the given project

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public updateUser(request: Object , reply: Function ): Promise source

This function update a user role to a project

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public updateUser(request: Object , reply: Function ): Promise source

import {updateUser} from 'ogma/src/controllers/user.controller.js'

This function update a given user

Params:

NameTypeAttributeDescription
request Object

the Hapi request object

reply Function

the Hapi reply object

Return:

Promise

a promise that resolves

public userRoutes(server: Object , options: Object , next: Function ): Promise source

import userRoutes from 'ogma/src/routes/user.routes.js'

This function registers the server's routes for user

Params:

NameTypeAttributeDescription
server Object

the Hapi server

options Object

the plugin options

next Function

the Hapi next function

Return:

Promise

a promise that resolves the server

public validateUser(decoded: Object , request: Object , callback: Function ): Void source

import {validateUser} from 'ogma/src/helpers/index.js'

This function will validate a decoded token by fetching the database for the user or the client

Params:

NameTypeAttributeDescription
decoded Object

the decoded token

request Object

the Hapi request object

callback Function

the callback function to call when the verification is done

Return:

Void

Nothing

public yaml(keys: Array , pKeys: Array ): String source

import yaml from 'ogma/src/exporter/yaml.js'

This function exports a locale's keys in YAML format

Params:

NameTypeAttributeDescription
keys Array

the locale's keys

pKeys Array

the project's keys

Return:

String

A YAML string