Home Reference Source Repository
import ProjectFileClient from 'schema-mapper-store/lib/project/file.js'
public class | source

ProjectFileClient

Project client that stores data in a file

Constructor Summary

Public Constructor
public

constructor(Options: Object)

Create a new ProjectFileClient instance

Member Summary

Public Members
public

Cached (in memory) version for all projects

public

Folder to store the project in

Method Summary

Public Methods
public

Retrieve all projects

public

putAllProjects(allProjects: Object): Promise

Store all projects

public

putJsonFile(path: String, json: Object, pretty: Boolean): Promise

Store json in a file

Protected Methods
protected

Retrieve the contents of a JSON file

Public Constructors

public constructor(Options: Object) source

Create a new ProjectFileClient instance

Params:

NameTypeAttributeDescription
Options Object

object

Public Members

public allProjects: Object source

Cached (in memory) version for all projects

public path: String source

Folder to store the project in

Public Methods

public getAllProjects(): Promise source

Retrieve all projects

Return:

Promise

Promise that resolves an object containing all projects or an empty object in case of a problem

public putAllProjects(allProjects: Object): Promise source

Store all projects

Params:

NameTypeAttributeDescription
allProjects Object

All projects

Return:

Promise

public putJsonFile(path: String, json: Object, pretty: Boolean): Promise source

Store json in a file

Params:

NameTypeAttributeDescription
path String

Path to file

json Object

JSON to store

pretty Boolean

Wether to prettify the JSON or not

Return:

Promise

Protected Methods

protected getJsonFile(path: String): Promise source

Retrieve the contents of a JSON file

Params:

NameTypeAttributeDescription
path String

Path to file

Return:

Promise

Promise resolving the parsed contents of a JSON file