@contember/schema-utils
Advanced tools
Comparing version 1.0.0-alpha.1 to 1.0.0-alpha.2
export * from './AllowAllPermissionFactory'; | ||
export * from './PredicateDefinitionProcessor'; | ||
export * from './schemaUtils'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -15,2 +15,3 @@ "use strict"; | ||
__exportStar(require("./PredicateDefinitionProcessor"), exports); | ||
__exportStar(require("./schemaUtils"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -130,2 +130,16 @@ "use strict"; | ||
return { type: schema_1.Acl.VariableType.entity, entityName: variable.entityName }; | ||
case schema_1.Acl.VariableType.predefined: | ||
if (!(0, utils_1.hasStringProperty)(variable, 'value')) { | ||
errorBuilder.add('Variable value type must be specified for this type of variable'); | ||
return; | ||
} | ||
if (variable.value !== 'identityID' && variable.value !== 'personID') { | ||
errorBuilder.add('Unknown predefined variable'); | ||
return; | ||
} | ||
const extra2 = (0, utils_1.checkExtraProperties)(variable, ['type', 'value']); | ||
if (extra2.length) { | ||
errorBuilder.add('Unsupported properties found: ' + extra2.join(', ')); | ||
} | ||
return { type: variable.type, value: variable.value }; | ||
default: | ||
@@ -132,0 +146,0 @@ errorBuilder.add(`Variable type "${variable.type}" is not supported.`); |
{ | ||
"name": "@contember/schema-utils", | ||
"version": "1.0.0-alpha.1", | ||
"version": "1.0.0-alpha.2", | ||
"license": "Apache-2.0", | ||
@@ -11,3 +11,3 @@ "main": "dist/src/index.js", | ||
"dependencies": { | ||
"@contember/schema": "^1.0.0-alpha.1" | ||
"@contember/schema": "^1.0.0-alpha.2" | ||
}, | ||
@@ -14,0 +14,0 @@ "devDependencies": { |
export * from './AllowAllPermissionFactory' | ||
export * from './PredicateDefinitionProcessor' | ||
export * from './schemaUtils' |
@@ -146,2 +146,17 @@ import { Acl, Model } from '@contember/schema' | ||
return { type: Acl.VariableType.entity, entityName: variable.entityName } | ||
case Acl.VariableType.predefined: | ||
if (!hasStringProperty(variable, 'value')) { | ||
errorBuilder.add('Variable value type must be specified for this type of variable') | ||
return | ||
} | ||
if (variable.value !== 'identityID' && variable.value !== 'personID') { | ||
errorBuilder.add('Unknown predefined variable') | ||
return | ||
} | ||
const extra2 = checkExtraProperties(variable, ['type', 'value']) | ||
if (extra2.length) { | ||
errorBuilder.add('Unsupported properties found: ' + extra2.join(', ')) | ||
} | ||
return { type: variable.type, value: variable.value } | ||
default: | ||
@@ -148,0 +163,0 @@ errorBuilder.add(`Variable type "${variable.type}" is not supported.`) |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
252683
116
3840