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

@contember/schema-utils

Package Overview
Dependencies
Maintainers
5
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contember/schema-utils - npm Package Compare versions

Comparing version 0.7.4 to 0.8.0-alpha.0

4

dist/src/acl/PredicateDefinitionProcessor.d.ts

@@ -15,3 +15,3 @@ import { Acl, Input, Model } from '@contember/schema';

path: string[];
}): R | Input.Where;
}): R | Input.Where | undefined | [string, R | Input.Where];
handleRelation(ctx: {

@@ -23,3 +23,3 @@ value: T | Acl.PredicateVariable;

path: string[];
}): R | Input.Where;
}): R | Input.Where | undefined | [string, R | Input.Where];
handleUndefinedField?(ctx: {

@@ -26,0 +26,0 @@ entity: Model.Entity;

@@ -42,9 +42,3 @@ "use strict";

visitRelation: (entity, relation, targetEntity) => {
if (typeof value === 'object' && 'constructor' in value && value.constructor.name === 'Object') {
return this.processInternal(targetEntity, value, handler, [
...path,
key,
]);
}
return handler.handleRelation({
const processedValue = handler.handleRelation({
relation,

@@ -56,4 +50,16 @@ entity,

});
if (typeof processedValue === 'object' &&
'constructor' in processedValue &&
processedValue.constructor.name === 'Object') {
return this.processInternal(targetEntity, processedValue, handler, [...path, key]);
}
return processedValue;
},
});
if (fieldWhere === undefined) {
return result;
}
if (Array.isArray(fieldWhere) && fieldWhere.length === 2) {
return { ...result, [fieldWhere[0]]: fieldWhere[1] };
}
return { ...result, [key]: fieldWhere };

@@ -60,0 +66,0 @@ }, {});

{
"name": "@contember/schema-utils",
"version": "0.7.4",
"version": "0.8.0-alpha.0",
"license": "Apache-2.0",

@@ -9,9 +9,9 @@ "main": "dist/src/index.js",

"dependencies": {
"@contember/schema": "^0.7.4"
"@contember/schema": "^0.8.0-alpha.0"
},
"devDependencies": {
"@types/node": "^12.11.7",
"@types/node": "^13.11.1",
"typescript": "^3.7.4"
},
"gitHead": "87ffb9a60e9398bd081b322256bac05f77914c1f"
"gitHead": "e8480ed2e4f612537e229c6017565ec43917618e"
}

@@ -48,22 +48,40 @@ import { acceptFieldVisitor } from '../model'

const fieldWhere = acceptFieldVisitor<WhereValue | Input.Where>(this.schema, entity, key, {
visitColumn: (entity, column) => {
return handler.handleColumn({ entity, column, value: value as Input.Condition | PredicateExtension, path })
const fieldWhere = acceptFieldVisitor<WhereValue | Input.Where | [string, WhereValue | Input.Where] | undefined>(
this.schema,
entity,
key,
{
visitColumn: (entity, column) => {
return handler.handleColumn({ entity, column, value: value as Input.Condition | PredicateExtension, path })
},
visitRelation: (entity, relation, targetEntity) => {
const processedValue = handler.handleRelation({
relation,
entity,
targetEntity,
value: value as Acl.PredicateVariable | PredicateExtension,
path,
})
if (
typeof processedValue === 'object' &&
'constructor' in processedValue &&
processedValue.constructor.name === 'Object'
) {
return this.processInternal(
targetEntity,
processedValue as Acl.PredicateDefinition<PredicateExtension>,
handler,
[...path, key],
)
}
return processedValue
},
},
visitRelation: (entity, relation, targetEntity) => {
if (typeof value === 'object' && 'constructor' in value && value.constructor.name === 'Object') {
return this.processInternal(targetEntity, value as Acl.PredicateDefinition<PredicateExtension>, handler, [
...path,
key,
])
}
return handler.handleRelation({
relation,
entity,
targetEntity,
value: value as Acl.PredicateVariable | PredicateExtension,
path,
})
},
})
)
if (fieldWhere === undefined) {
return result
}
if (Array.isArray(fieldWhere) && fieldWhere.length === 2) {
return { ...result, [fieldWhere[0]]: fieldWhere[1] }
}
return { ...result, [key]: fieldWhere }

@@ -81,3 +99,3 @@ }, {})

path: string[]
}): R | Input.Where
}): R | Input.Where | undefined | [string, R | Input.Where]

@@ -90,3 +108,3 @@ handleRelation(ctx: {

path: string[]
}): R | Input.Where
}): R | Input.Where | undefined | [string, R | Input.Where]

@@ -93,0 +111,0 @@ handleUndefinedField?(ctx: {

Sorry, the diff of this file is not supported yet

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