UNPKG

fms-admin-client

Version:

A client designed to provide a framework for interactions with FileMaker Server Admin Tools.

138 lines (110 loc) 4.44 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>migration.model.js - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav> <li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="Admin.html">Admin</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Admin.html#preInit">preInit</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="CLI.html">CLI</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="Credentials.html">Credentials</a></span></li><li class="nav-heading">Modules</li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-Admin.html">Admin</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-CLI.html">CLI</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-Credentials.html">Credentials</a></span></li><li class="nav-heading"><a href="global.html">Globals</a></li><li class="nav-item"><span class="nav-item-type type-member">M</span><span class="nav-item-name"><a href="global.html#cli">cli</a></span></li> </nav> <div id="main"> <h1 class="page-title">migration.model.js</h1> <section> <article> <pre class="prettyprint source linenums"><code>'use strict'; const { Document } = require('marpat'); const { spawn, exec } = require('child_process'); const _ = require('lodash'); /** * @class Credentials * @classdesc The class used to authenticate with into the FileMaker API. */ class Migration extends Document { constructor() { super(); this.schema({ /** A string containing the time the token token was issued. * @member Credentials#password * @type String */ path: { type: String, required: true }, session: { type: Array, default: [] }, process: { type: Number } }); } execute(commands) { this.session = []; let commandArray = _.flatten( _.compact( _.values( _.mapValues(commands, (value, key, object) => { if (value === true) { return [`-${key}`]; } else if (value !== false) { return [`-${key}`, value]; } return; }) ) ) ); let thisProcess = spawn(this.path, commandArray); thisProcess.stdout.on('data', data => this.log(data)); thisProcess.stderr.on('error', error => this.log(error)); thisProcess.on('close', () => this.end()); this.process = thisProcess.pid; return this.save(); } log(data) { this.session.push(data.toString()); return this.save(); } end() { this.process = undefined; return this.save(); } stop() { process.kill(this.process); } } /** * @module Credentials */ module.exports = { Migration }; </code></pre> </article> </section> </div> <br class="clear"> <footer> Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Oct 29 2018 22:49:18 GMT-0700 (PDT) using the Minami theme. </footer> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> </body> </html>