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

@allbin/entity-logic

Package Overview
Dependencies
Maintainers
3
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@allbin/entity-logic - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

5

lib/index.d.ts

@@ -9,2 +9,5 @@ import { Entity, EntitySchema } from './types/schema';

declare const validateSchema: (schema: EntitySchema) => void;
interface ValidatePropertiesModifiableOptions {
strict?: boolean;
}
interface EntityLogic {

@@ -16,3 +19,3 @@ execute: <T>(entities: Entity<T>[], filter: Filter) => Entity<T>[];

validateProperties: (properties: Record<string, unknown>) => void;
validatePropertiesModifiable: (prev_properties: Record<string, unknown>, properties: Record<string, unknown>) => void;
validatePropertiesModifiable: (prev_properties: Record<string, unknown>, properties: Record<string, unknown>, options?: ValidatePropertiesModifiableOptions) => void;
serializeFilterCondition: (condition: FilterCondition) => SerializedFilterCondition;

@@ -19,0 +22,0 @@ unserializeFilterCondition: (condition: SerializedFilterCondition) => FilterCondition;

@@ -326,3 +326,3 @@ "use strict";

};
var validatePropertiesModifiable = function (schemaPropsByKey, prev_properties, properties) {
var validatePropertiesModifiable = function (schemaPropsByKey, prev_properties, properties, options) {
Object.keys(schemaPropsByKey)

@@ -335,2 +335,6 @@ .filter(function (p) { return !schemaPropsByKey[p].modifiable; })

}
if ((options === null || options === void 0 ? void 0 : options.strict) &&
Object.prototype.hasOwnProperty.call(properties, p)) {
throw new Error("Property '" + p + "' is not modifiable and must not be included in updates");
}
var invalid = false;

@@ -423,3 +427,5 @@ var prev_val = prev_properties[p];

},
validatePropertiesModifiable: function (prev_properties, properties) { return validatePropertiesModifiable(propsByKey, prev_properties, properties); },
validatePropertiesModifiable: function (prev_properties, properties, options) {
return validatePropertiesModifiable(propsByKey, prev_properties, properties, options);
},
serializeFilterCondition: function (condition) {

@@ -426,0 +432,0 @@ return serializeFilterCondition(condition);

@@ -1216,2 +1216,14 @@ "use strict";

});
it('rejects unmodifiable properties altogether, in strict mode', function () {
var prev_props = {
'meta.id': 'something',
};
var props = {
'meta.id': 'something',
};
var logic = (0, index_1.EntityLogic)(schema);
expect(function () {
return logic.validatePropertiesModifiable(prev_props, props, { strict: true });
}).toThrow();
});
it('correctly validates modifiable single properties (pos)', function () {

@@ -1218,0 +1230,0 @@ var prev_props = {

2

package.json
{
"name": "@allbin/entity-logic",
"version": "0.8.0",
"version": "0.8.1",
"description": "Logic solver for mobilix filters",

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

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