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

arrow-objectmodel

Package Overview
Dependencies
Maintainers
4
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arrow-objectmodel - npm Package Compare versions

Comparing version 0.2.17 to 0.2.18

1

lib/api.js

@@ -34,2 +34,3 @@ var _ = require('lodash'),

kind: 'api',
documented: this.api.documented,
uiSort: this.api.uiSort || Number.MAX_VALUE,

@@ -36,0 +37,0 @@ filename: this.api.filename,

@@ -11,2 +11,3 @@ const SPEC = '1';

kind: 'block',
documented: this.block.documented,
name: this.block.name,

@@ -13,0 +14,0 @@ filename: this.block.filename,

@@ -11,2 +11,3 @@ const SPEC = '1';

kind: 'connector',
documented: this.connector.documented,
name: this.connector.name,

@@ -13,0 +14,0 @@ filename: this.connector.filename,

@@ -58,2 +58,3 @@ var _ = require('lodash');

kind: 'model',
documented: this.model.documented,
name: this.model.name,

@@ -60,0 +61,0 @@ filename: this.model.filename,

2

package.json
{
"name": "arrow-objectmodel",
"version": "0.2.17",
"version": "0.2.18",
"description": "The object model for Arrow",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -12,12 +12,12 @@ var should = require('should'),

describe("ObjectModel", function(){
describe("ObjectModel", function () {
beforeEach(function(){
tmpdir = path.join(require('os').tmpdir(), 'omtest-'+Date.now());
beforeEach(function () {
tmpdir = path.join(require('os').tmpdir(), 'omtest-' + Date.now());
wrench.mkdirSyncRecursive(tmpdir);
});
afterEach(function(done){
afterEach(function (done) {
if (server) {
server.stop(function(){
server.stop(function () {
wrench.rmdirSyncRecursive(tmpdir);

@@ -33,5 +33,5 @@ done();

it ("should be able to serialize from running server", function(callback){
server = new Arrow({dir:tmpdir, logLevel:'warn', port:8082});
server.start(function(err){
it("should be able to serialize from running server", function (callback) {
server = new Arrow({dir: tmpdir, logLevel: 'warn', port: 8082});
server.start(function (err) {
should(err).not.be.ok;

@@ -41,3 +41,3 @@ var objectModel = new lib.ObjectModel(server);

should(model).be.an.object;
should(model).have.property('spec','1');
should(model).have.property('spec', '1');
should(model).have.property('server');

@@ -50,6 +50,6 @@ should(model).have.property('config');

should(model).have.property('metadata');
should(model.server).have.property('port',8082);
should(model.config).have.property('dir',tmpdir);
should(model.config).have.property('env','development');
should(model.metadata).have.property('type','unknown');
should(model.server).have.property('port', 8082);
should(model.config).have.property('dir', tmpdir);
should(model.config).have.property('env', 'development');
should(model.metadata).have.property('type', 'unknown');
server.stop(callback);

@@ -59,8 +59,8 @@ });

it ("should be able to serialize from not running server (loadOnly)", function(){
server = new Arrow({dir:tmpdir, logLevel:'warn', port:8082},true);
it("should be able to serialize from not running server (loadOnly)", function () {
server = new Arrow({dir: tmpdir, logLevel: 'warn', port: 8082}, true);
var objectModel = new lib.ObjectModel(server);
var model = objectModel.toJSON();
should(model).be.an.object;
should(model).have.property('spec','1');
should(model).have.property('spec', '1');
should(model).have.property('server');

@@ -72,16 +72,16 @@ should(model).have.property('config');

should(model).have.property('blocks');
should(model.server).have.property('port',8082);
should(model.config).have.property('dir',tmpdir);
should(model.config).have.property('env','development');
should(model.server).have.property('port', 8082);
should(model.config).have.property('dir', tmpdir);
should(model.config).have.property('env', 'development');
});
it ("should be able to serialize model", function(){
server = new Arrow({dir:tmpdir, logLevel:'warn', port:8082},true);
var MyModel = Arrow.Model.extend('foo',{
fields : {
readonly: {description:'readonly',readonly:true},
writeonly: {description:'writeonly',writeonly:true},
defaultfield: {description:'default'},
defaultvalue: {description: 'default value', default:1, type:'number'},
name: {description:'name',name:'foo', type:String}
it("should be able to serialize model", function () {
server = new Arrow({dir: tmpdir, logLevel: 'warn', port: 8082}, true);
var MyModel = Arrow.Model.extend('foo', {
fields: {
readonly: {description: 'readonly', readonly: true},
writeonly: {description: 'writeonly', writeonly: true},
defaultfield: {description: 'default'},
defaultvalue: {description: 'default value', default: 1, type: 'number'},
name: {description: 'name', name: 'foo', type: String}
}

@@ -93,3 +93,3 @@ });

should(model).be.an.object;
should(model).have.property('spec','1');
should(model).have.property('spec', '1');
should(model).have.property('server');

@@ -101,10 +101,10 @@ should(model).have.property('config');

should(model).have.property('blocks');
should(model.server).have.property('port',8082);
should(model.config).have.property('dir',tmpdir);
should(model.config).have.property('env','development');
should(model.server).have.property('port', 8082);
should(model.config).have.property('dir', tmpdir);
should(model.config).have.property('env', 'development');
should(model.models).have.property('foo');
should(model.models.foo).have.property('spec','1');
should(model.models.foo).have.property('kind','model');
should(model.models.foo).have.property('name','foo');
should(model.models.foo).have.property('autogen',true);
should(model.models.foo).have.property('spec', '1');
should(model.models.foo).have.property('kind', 'model');
should(model.models.foo).have.property('name', 'foo');
should(model.models.foo).have.property('autogen', true);
should(model.models.foo).have.property('metadata');

@@ -116,39 +116,39 @@ should(model.models.foo).have.property('fields');

should(model.models.foo.fields).have.property('readonly');
should(model.models.foo.fields.readonly).have.property('description','readonly');
should(model.models.foo.fields.readonly).have.property('required',false);
should(model.models.foo.fields.readonly).have.property('readonly',true);
should(model.models.foo.fields.readonly).have.property('writeonly',false);
should(model.models.foo.fields.readonly).have.property('optional',true);
should(model.models.foo.fields.readonly).have.property('description', 'readonly');
should(model.models.foo.fields.readonly).have.property('required', false);
should(model.models.foo.fields.readonly).have.property('readonly', true);
should(model.models.foo.fields.readonly).have.property('writeonly', false);
should(model.models.foo.fields.readonly).have.property('optional', true);
should(model.models.foo.fields).have.property('writeonly');
should(model.models.foo.fields.writeonly).have.property('description','writeonly');
should(model.models.foo.fields.writeonly).have.property('required',false);
should(model.models.foo.fields.writeonly).have.property('writeonly',true);
should(model.models.foo.fields.writeonly).have.property('readonly',false);
should(model.models.foo.fields.writeonly).have.property('optional',true);
should(model.models.foo.fields.writeonly).have.property('description', 'writeonly');
should(model.models.foo.fields.writeonly).have.property('required', false);
should(model.models.foo.fields.writeonly).have.property('writeonly', true);
should(model.models.foo.fields.writeonly).have.property('readonly', false);
should(model.models.foo.fields.writeonly).have.property('optional', true);
should(model.models.foo.fields).have.property('defaultfield');
should(model.models.foo.fields.defaultfield).have.property('description','default');
should(model.models.foo.fields.defaultfield).have.property('required',false);
should(model.models.foo.fields.defaultfield).have.property('writeonly',false);
should(model.models.foo.fields.defaultfield).have.property('readonly',false);
should(model.models.foo.fields.defaultfield).have.property('optional',true);
should(model.models.foo.fields.defaultfield).have.property('description', 'default');
should(model.models.foo.fields.defaultfield).have.property('required', false);
should(model.models.foo.fields.defaultfield).have.property('writeonly', false);
should(model.models.foo.fields.defaultfield).have.property('readonly', false);
should(model.models.foo.fields.defaultfield).have.property('optional', true);
should(model.models.foo.fields).have.property('defaultvalue');
should(model.models.foo.fields.defaultvalue).have.property('description','default value');
should(model.models.foo.fields.defaultvalue).have.property('required',false);
should(model.models.foo.fields.defaultvalue).have.property('writeonly',false);
should(model.models.foo.fields.defaultvalue).have.property('readonly',false);
should(model.models.foo.fields.defaultvalue).have.property('optional',true);
should(model.models.foo.fields.defaultvalue).have.property('default',1);
should(model.models.foo.fields.defaultvalue).have.property('description', 'default value');
should(model.models.foo.fields.defaultvalue).have.property('required', false);
should(model.models.foo.fields.defaultvalue).have.property('writeonly', false);
should(model.models.foo.fields.defaultvalue).have.property('readonly', false);
should(model.models.foo.fields.defaultvalue).have.property('optional', true);
should(model.models.foo.fields.defaultvalue).have.property('default', 1);
should(model.models.foo.fields).have.property('name');
should(model.models.foo.fields.name).have.property('description','name');
should(model.models.foo.fields.name).have.property('required',false);
should(model.models.foo.fields.name).have.property('writeonly',false);
should(model.models.foo.fields.name).have.property('readonly',false);
should(model.models.foo.fields.name).have.property('optional',true);
should(model.models.foo.fields.name).have.property('name','foo');
should(model.models.foo.fields.name).have.property('type','string');
should(model.models.foo.fields.defaultvalue).have.property('type','number');
should(model.models.foo.fields.name).have.property('description', 'name');
should(model.models.foo.fields.name).have.property('required', false);
should(model.models.foo.fields.name).have.property('writeonly', false);
should(model.models.foo.fields.name).have.property('readonly', false);
should(model.models.foo.fields.name).have.property('optional', true);
should(model.models.foo.fields.name).have.property('name', 'foo');
should(model.models.foo.fields.name).have.property('type', 'string');
should(model.models.foo.fields.defaultvalue).have.property('type', 'number');
});
it("should be able to set nickname on api", function(done){
server = new Arrow({dir:tmpdir, logLevel:'warn', port:8082});
it("should be able to set nickname on api", function (done) {
server = new Arrow({dir: tmpdir, logLevel: 'warn', port: 8082});
var MyAPIGet = Arrow.API.extend({

@@ -160,3 +160,3 @@ group: 'foo',

description: 'foo',
action: function(req,resp,next) {}
action: function (req, resp, next) {}
});

@@ -169,43 +169,43 @@ var MyAPIPut = Arrow.API.extend({

description: 'foo',
action: function(req, resp, next) {}
action: function (req, resp, next) {}
});
server.addAPI(MyAPIGet);
server.addAPI(MyAPIPut);
server.start(function(err){
server.start(function (err) {
should(err).not.be.ok;
var api1 = server.getAPI('/foo','GET');
var api1 = server.getAPI('/foo', 'GET');
should(api1.nickname).be.eql('fooget');
var api2 = server.getAPI('/foo','PUT');
var api2 = server.getAPI('/foo', 'PUT');
should(api2.nickname).be.eql('fooput');
var API = require('../lib/api');
var api = new API(server,api1);
var api = new API(server, api1);
api = api.toJSON();
should(api).have.property('spec','1');
should(api).have.property('kind','api');
should(api).have.property('name','GET /foo');
should(api).have.property('description','foo');
should(api).have.property('path','/foo');
should(api).have.property('method','GET');
should(api).have.property('generated',false);
should(api).have.property('nickname','fooget');
should(api).have.property('spec', '1');
should(api).have.property('kind', 'api');
should(api).have.property('name', 'GET /foo');
should(api).have.property('description', 'foo');
should(api).have.property('path', '/foo');
should(api).have.property('method', 'GET');
should(api).have.property('generated', false);
should(api).have.property('nickname', 'fooget');
should(api).have.property('action');
should(api.action).have.property('name','action');
should(api.action).have.property('args',[ 'req', 'resp', 'next' ]);
should(api.action).have.property('body','');
should(api.action).have.property('name', 'action');
should(api.action).have.property('args', ['req', 'resp', 'next']);
should(api.action).have.property('body', '');
api = new API(server,api2);
api = new API(server, api2);
api = api.toJSON();
should(api).have.property('spec','1');
should(api).have.property('kind','api');
should(api).have.property('name','PUT /foo');
should(api).have.property('description','foo');
should(api).have.property('path','/foo');
should(api).have.property('method','PUT');
should(api).have.property('generated',false);
should(api).have.property('nickname','fooput');
should(api).have.property('spec', '1');
should(api).have.property('kind', 'api');
should(api).have.property('name', 'PUT /foo');
should(api).have.property('description', 'foo');
should(api).have.property('path', '/foo');
should(api).have.property('method', 'PUT');
should(api).have.property('generated', false);
should(api).have.property('nickname', 'fooput');
should(api).have.property('action');
should(api.action).have.property('name','action');
should(api.action).have.property('args',[ 'req', 'resp', 'next' ]);
should(api.action).have.property('body','');
should(api.action).have.property('name', 'action');
should(api.action).have.property('args', ['req', 'resp', 'next']);
should(api.action).have.property('body', '');

@@ -216,2 +216,40 @@ server.stop(done);

it("should be able to hide apis", function (done) {
server = new Arrow({dir: tmpdir, logLevel: 'warn', port: 8082});
var MyAPIGet = Arrow.API.extend({
group: 'foo',
method: 'GET',
path: '/foo',
documented: false,
nickname: 'fooget',
description: 'foo',
action: function (req, resp, next) {}
});
server.addAPI(MyAPIGet);
server.start(function (err) {
should(err).not.be.ok;
var api1 = server.getAPI('/foo', 'GET');
should(api1.nickname).be.eql('fooget');
var API = require('../lib/api');
var api = new API(server, api1);
api = api.toJSON();
should(api).have.property('spec', '1');
should(api).have.property('kind', 'api');
should(api).have.property('name', 'GET /foo');
should(api).have.property('description', 'foo');
should(api).have.property('path', '/foo');
should(api).have.property('method', 'GET');
should(api).have.property('generated', false);
should(api).have.property('documented', false);
should(api).have.property('nickname', 'fooget');
should(api).have.property('action');
should(api.action).have.property('name', 'action');
should(api.action).have.property('args', ['req', 'resp', 'next']);
should(api.action).have.property('body', '');
server.stop(done);
});
});
});

Sorry, the diff of this file is not supported yet

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