Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mesh-cli

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mesh-cli - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

8

build/commands/ls.js

@@ -13,5 +13,6 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
if (!state.project || !state.current.uuid)
return state;
let nodes = yield mesh.api.project(state.project).nodes.nodeUuid(state.current.uuid).children.get({ version: 'draft' });
let data = nodes.data.reduce((out, node) => {
let type = node.container ? 'DIR ' : 'NODE';
out.push([

@@ -21,6 +22,7 @@ node.uuid,

node.edited,
node.fields ? node.fields[Object.keys(node.fields)[0]] : '...'
node.fields ? node.fields[Object.keys(node.fields)[0]] : '...',
node.container ? 'true' : 'false'
]);
return out;
}, [['uuid', 'schema', 'edited', 'displayField']]);
}, [['uuid', 'schema', 'edited', 'displayField', 'container']]);
console.log(table(data), '\n');

@@ -27,0 +29,0 @@ return state;

@@ -10,8 +10,11 @@ "use strict";

};
let table = require('text-table');
function projects(mesh, line, cmd, state) {
return __awaiter(this, void 0, void 0, function* () {
let projects = yield mesh.api.projects.get();
projects.data.reduce((out, p) => {
return `${out} ${p.name}`;
}, '');
let data = projects.data.reduce((out, p) => {
out.push([p.uuid, p.name, p.created, p.rootNodeUuid]);
return out;
}, [['uuid', 'name', 'created', 'rootNodeUuid']]);
console.log(table(data));
return state;

@@ -18,0 +21,0 @@ });

@@ -23,9 +23,19 @@ #!/usr/bin/env node

const completers_1 = require("./completers");
const url = require("url");
class State {
}
exports.State = State;
let mesh = new mesh_api_1.MeshAPI({ debug: false });
let config = {};
let auth = ['admin', 'admin'];
if (process.argv[2]) {
let parts = url.parse(process.argv[2]);
config.url = `${parts.protocol}//${parts.host}${parts.path}`;
config.debug = false;
if (parts.auth !== null)
auth = parts.auth.split(':');
}
let mesh = new mesh_api_1.MeshAPI(config);
let state;
let rl;
mesh.api.auth.login.post({ username: 'admin', password: 'admin' })
mesh.api.auth.login.post({ username: auth[0], password: auth[1] })
.then(() => {

@@ -39,3 +49,5 @@ rl = readline.createInterface({

state = { project: '', current: null, buffer: [] };
onLine('project demo');
// onLine('project demo');
rl.setPrompt(prompt(state));
rl.prompt();
})

@@ -81,8 +93,3 @@ .catch((e) => {

state = newState;
if (state.buffer.length) {
rl.setPrompt('> ');
}
else {
rl.setPrompt(`${state.project}:${state.current.uuid}$ `);
}
rl.setPrompt(prompt(state));
if (state.buffer.length === 1) {

@@ -95,3 +102,3 @@ console.log('Multiline input: terminate with ";;⏎"');

state = __assign({}, state, { buffer: [] });
rl.setPrompt(`${state.project}:${state.current.uuid}$ `);
rl.setPrompt(prompt(state));
rl.prompt();

@@ -106,1 +113,12 @@ });

}
function prompt(state) {
if (state.buffer.length) {
return '> ';
}
else if (state.project && state.current) {
return `${state.project}:${state.current.uuid}$ `;
}
else {
return '$ ';
}
}
{
"name": "mesh-cli",
"version": "0.0.0",
"version": "0.0.1",
"description": "A command line interface for Gentics Mesh, an API-first CMS",

@@ -13,3 +13,3 @@ "main": "./build/mesh-cli.js",

"@types/node": "^7.0.5",
"mesh-api": "0.0.0",
"mesh-api": "^0.0.8",
"text-table": "^0.2.0"

@@ -16,0 +16,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc