@allbin/entity-logic
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -5,3 +5,3 @@ import { Entity, EntitySchema } from './types/schema'; | ||
interface EntityLogic { | ||
execute: (entities: Entity[], filter: Filter) => Entity[]; | ||
execute: <T>(entities: Entity<T>[], filter: Filter) => Entity<T>[]; | ||
validateCondition: (condtion: FilterCondition) => Operator; | ||
@@ -8,0 +8,0 @@ validateFilter: (filter: Filter) => Operator[]; |
@@ -11,3 +11,3 @@ "use strict"; | ||
type: 'boolean', | ||
name: 'Boolean', | ||
name: 'boolean', | ||
}, | ||
@@ -17,3 +17,3 @@ { | ||
type: 'number', | ||
name: 'Number', | ||
name: 'number', | ||
}, | ||
@@ -23,3 +23,3 @@ { | ||
type: 'string', | ||
name: 'String', | ||
name: 'string', | ||
}, | ||
@@ -29,3 +29,3 @@ { | ||
type: 'date', | ||
name: 'Date', | ||
name: 'date', | ||
}, | ||
@@ -35,3 +35,3 @@ { | ||
type: 'date', | ||
name: 'DateString', | ||
name: 'datestring', | ||
}, | ||
@@ -41,3 +41,3 @@ { | ||
type: 'enum', | ||
name: 'Enum', | ||
name: 'enum', | ||
alternatives: ['alternative1', 'alternative2'], | ||
@@ -48,3 +48,3 @@ }, | ||
type: 'photo', | ||
name: 'Photo', | ||
name: 'photo', | ||
}, | ||
@@ -54,3 +54,3 @@ { | ||
type: 'array:number', | ||
name: 'ArrayNumber', | ||
name: 'arraynumber', | ||
}, | ||
@@ -60,3 +60,3 @@ { | ||
type: 'array:string', | ||
name: 'ArrayString', | ||
name: 'arraystring', | ||
}, | ||
@@ -862,2 +862,18 @@ ], | ||
}); | ||
it('correctly validates a valid schema', function () { | ||
expect(function () { return (0, index_1.validateSchema)(schema); }).not.toThrow(); | ||
}); | ||
it('correctly validates an invalid schema', function () { | ||
var invalid_schema = { | ||
groups: [], | ||
properties: [ | ||
{ | ||
key: 'user.1', | ||
type: 'string', | ||
name: 'Test', | ||
}, | ||
], | ||
}; | ||
expect(function () { return (0, index_1.validateSchema)(invalid_schema); }).toThrow(); | ||
}); | ||
}); |
@@ -62,5 +62,5 @@ import { DateTime } from 'luxon'; | ||
}; | ||
export declare type Entity = { | ||
export declare type Entity<T = unknown> = T & { | ||
properties: Record<string, EntitySchemaPropValue>; | ||
}; | ||
export {}; |
{ | ||
"name": "@allbin/entity-logic", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Logic solver for mobilix filters", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62736
1682