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.2 to 0.2.3

14

lib/index.js

@@ -56,3 +56,3 @@ 'use strict';

case 0:
rules = writeRulesForAllModels(utils.preprocessedSchema);
rules = writeRulesForAllModels(utils.preprocessedSchema, options);

@@ -80,3 +80,3 @@ if (options.file) {

// ====================================
var writeRulesForAllModels = function writeRulesForAllModels(_ref2) {
var writeRulesForAllModels = function writeRulesForAllModels(_ref2, options) {
var models = _ref2.models;

@@ -87,3 +87,3 @@

if (!models[modelName].existsInServer) return;
rules[modelName] = (0, _defineProperty3.default)({}, '$' + modelName + 'Id', writeRulesForModel(models, modelName));
rules[modelName] = (0, _defineProperty3.default)({}, '$' + modelName + 'Id', writeRulesForModel(models, modelName, options));
});

@@ -93,3 +93,3 @@ return { rules: rules };

var writeRulesForModel = function writeRulesForModel(models, modelName) {
var writeRulesForModel = function writeRulesForModel(models, modelName, options) {
var model = models[modelName];

@@ -99,3 +99,3 @@ var modelRules = {};

// Required fields
var requiredFields = getRequiredFields(model);
var requiredFields = getRequiredFields(model, options);
if (requiredFields.length) {

@@ -229,5 +229,6 @@ var list = requiredFields.map(function (o) {

// ====================================
var getRequiredFields = function getRequiredFields(_ref4) {
var getRequiredFields = function getRequiredFields(_ref4, _ref5) {
var fields = _ref4.fields,
relations = _ref4.relations;
var ignorePrimaryKey = _ref5.ignorePrimaryKey;

@@ -238,2 +239,3 @@ var required = [];

if (!field.existsInServer) return;
if (ignorePrimaryKey && field.isPrimaryKey) return;
if (field.isRequired || field.isPrimaryKey) {

@@ -240,0 +242,0 @@ required.push(name);

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

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -16,2 +16,3 @@ // @flow

file?: string,
ignorePrimaryKey?: boolean,
};

@@ -31,3 +32,3 @@

) => {
const rules = writeRulesForAllModels(utils.preprocessedSchema);
const rules = writeRulesForAllModels(utils.preprocessedSchema, options);
if (options.file) {

@@ -42,3 +43,3 @@ fs.writeFileSync(options.file, JSON.stringify(rules, null, 2), 'utf8');

// ====================================
const writeRulesForAllModels = ({ models }) => {
const writeRulesForAllModels = ({ models }, options) => {
const rules = {};

@@ -48,3 +49,3 @@ Object.keys(models).forEach(modelName => {

rules[modelName] = {
[`$${modelName}Id`]: writeRulesForModel(models, modelName),
[`$${modelName}Id`]: writeRulesForModel(models, modelName, options),
};

@@ -55,3 +56,3 @@ });

const writeRulesForModel = (models, modelName) => {
const writeRulesForModel = (models, modelName, options) => {
const model = models[modelName];

@@ -61,3 +62,3 @@ const modelRules = {};

// Required fields
const requiredFields = getRequiredFields(model);
const requiredFields = getRequiredFields(model, options);
if (requiredFields.length) {

@@ -188,3 +189,3 @@ const list = requiredFields.map(o => `'${o}'`).join(', ');

// ====================================
const getRequiredFields = ({ fields, relations }) => {
const getRequiredFields = ({ fields, relations }, { ignorePrimaryKey }) => {
const required = [];

@@ -194,2 +195,3 @@ Object.keys(fields).forEach(name => {

if (!field.existsInServer) return;
if (ignorePrimaryKey && field.isPrimaryKey) return;
if (field.isRequired || field.isPrimaryKey) {

@@ -196,0 +198,0 @@ required.push(name);

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