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

concise-firebase

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

concise-firebase - npm Package Compare versions

Comparing version 0.2.3 to 0.3.0

41

lib/index.js

@@ -8,10 +8,2 @@ 'use strict';

var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _keys = require('babel-runtime/core-js/object/keys');
var _keys2 = _interopRequireDefault(_keys);
var _regenerator = require('babel-runtime/regenerator');

@@ -21,16 +13,14 @@

var _stringify = require('babel-runtime/core-js/json/stringify');
var _fs = require('fs');
var _stringify2 = _interopRequireDefault(_stringify);
var _fs2 = _interopRequireDefault(_fs);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _fs = require('fs');
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
var _fs2 = _interopRequireDefault(_fs);
/* eslint-disable prefer-template, no-param-reassign, no-console */
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* --

@@ -43,5 +33,2 @@ Output-only.

var VALIDATE = '.validate';
/* eslint-disable prefer-template, no-param-reassign, no-console */
var ISO_8601 = '/^\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(\\.\\d+)?(([+-]\\d\\d:\\d\\d)|Z)?$/i';

@@ -53,3 +40,3 @@

var output = function () {
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(schema, options, utils) {
var _ref = _asyncToGenerator(_regenerator2.default.mark(function _callee(schema, options, utils) {
var rules;

@@ -63,3 +50,3 @@ return _regenerator2.default.wrap(function _callee$(_context) {

if (options.file) {
_fs2.default.writeFileSync(options.file, (0, _stringify2.default)(rules, null, 2), 'utf8');
_fs2.default.writeFileSync(options.file, JSON.stringify(rules, null, 2), 'utf8');
}

@@ -88,5 +75,5 @@ return _context.abrupt('return', rules);

var rules = {};
(0, _keys2.default)(models).forEach(function (modelName) {
Object.keys(models).forEach(function (modelName) {
if (!models[modelName].existsInServer) return;
rules[modelName] = (0, _defineProperty3.default)({}, '$' + modelName + 'Id', writeRulesForModel(models, modelName, options));
rules[modelName] = _defineProperty({}, '$' + modelName + 'Id', writeRulesForModel(models, modelName, options));
});

@@ -120,3 +107,3 @@ return { rules: rules };

var rules = {};
(0, _keys2.default)(fields).forEach(function (name) {
Object.keys(fields).forEach(function (name) {
var field = fields[name];

@@ -130,3 +117,3 @@ if (field.isPrimaryKey) return;

});
(0, _keys2.default)(relations).forEach(function (name) {
Object.keys(relations).forEach(function (name) {
var relation = relations[name];

@@ -238,3 +225,3 @@ var fkName = relation.fkName,

var required = [];
(0, _keys2.default)(fields).forEach(function (name) {
Object.keys(fields).forEach(function (name) {
var field = fields[name];

@@ -247,3 +234,3 @@ if (!field.existsInServer) return;

});
(0, _keys2.default)(relations).forEach(function (name) {
Object.keys(relations).forEach(function (name) {
var relation = relations[name];

@@ -250,0 +237,0 @@ if (relation.isRequired) required.push(relation.fkName);

{
"name": "concise-firebase",
"version": "0.2.3",
"version": "0.3.0",
"author": "Guillermo Grau Panea",

@@ -12,3 +12,3 @@ "license": "MIT",

"compile:run": "../../node_modules/.bin/babel src -d lib --ignore \"**/__mocks__/**\",\"**/__tests__/**\"",
"compile:runWatch": "yarn compile:run -- --watch"
"compile:runWatch": "yarn compile:run --watch"
},

@@ -20,2 +20,5 @@ "dependencies": {

},
"devDependencies": {
"prettier": "^1.12.1"
},
"description": "A tool belt for concise schemas",

@@ -22,0 +25,0 @@ "keywords": [

@@ -128,7 +128,6 @@ // @flow

if (isOneOf != null) {
const choiceConstraints = type === 'string' ||
type === 'uuid' ||
type === 'date'
? isOneOf.map(o => `newData.val() === '${o}'`)
: isOneOf.map(o => `newData.val() === ${o}`);
const choiceConstraints =
type === 'string' || type === 'uuid' || type === 'date'
? isOneOf.map(o => `newData.val() === '${o}'`)
: isOneOf.map(o => `newData.val() === ${o}`);
constraints.push(`(${choiceConstraints.join(' || ')})`);

@@ -135,0 +134,0 @@ }

Sorry, the diff of this file is not supported yet

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