@live-change/framework
Advanced tools
Comparing version 0.8.111 to 0.8.112
@@ -294,5 +294,7 @@ import {randomString, uidGenerator} from '@live-change/uid' | ||
) | ||
await this.dao.request(['database', 'update', this.databaseName, triggersTable, trigger.id, [ | ||
{ op: 'reverseMerge', value: trigger } | ||
]]) | ||
await this.dao.request(['database', 'update', this.databaseName, triggersTable, trigger.id, [{ | ||
op: 'conditional', | ||
conditions: [{ test: 'notExist', property: 'type' }], | ||
operations: [{ op: 'reverseMerge', value: trigger }], | ||
}]]) | ||
let observer | ||
@@ -400,5 +402,7 @@ const promise = new Promise((resolve, reject) => { | ||
) | ||
await this.dao.request(['database', 'update', this.databaseName, commandsTable, data.id, [ | ||
{op: 'reverseMerge', value: data} | ||
]]) | ||
await this.dao.request(['database', 'update', this.databaseName, commandsTable, data.id, [{ | ||
op: 'conditional', | ||
conditions: [{ test: 'notExist', property: 'type' }], | ||
operations: [{ op: 'reverseMerge', value: data }], | ||
}]]) | ||
let observer | ||
@@ -405,0 +409,0 @@ const promise = new Promise((resolve, reject) => { |
@@ -6,3 +6,3 @@ import { getValidators, validate } from '../utils/validation.js' | ||
const action = service.actions[actionName] | ||
if(action.skipValidation) continue | ||
if(action.skipValidation && !action.validation) continue | ||
const validators = getValidators(action, service, action) | ||
@@ -13,5 +13,19 @@ if(Object.keys(validators).length > 0) { | ||
const context = args[1] | ||
return validate(args[0], validators, { source: action, action, service, app, ...context }).then(() => | ||
oldExec.apply(action, args) | ||
) | ||
if(args[0]._validationOnly) { | ||
if(!action.skipValidation) { | ||
await validate(args[0], validators, { source: action, action, service, app, ...context }) | ||
} | ||
if(action.validation === true) { | ||
return await oldExec.apply(action, args) // validate inside execute | ||
} else if(typeof action.validation === 'function') { | ||
const result = await action.validation(args[0], { source: action, action, service, app, ...context }) | ||
if(result) throw result | ||
return 'ok' | ||
} | ||
} else { | ||
if(!action.skipValidation) { | ||
await validate(args[0], validators, { source: action, action, service, app, ...context }) | ||
} | ||
return oldExec.apply(action, args) | ||
} | ||
} | ||
@@ -18,0 +32,0 @@ } |
{ | ||
"name": "@live-change/framework", | ||
"version": "0.8.111", | ||
"version": "0.8.112", | ||
"description": "Live Change Framework - ultimate solution for real time mobile/web apps", | ||
@@ -25,6 +25,6 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@live-change/dao": "^0.8.111", | ||
"@live-change/uid": "^0.8.111" | ||
"@live-change/dao": "^0.8.112", | ||
"@live-change/uid": "^0.8.112" | ||
}, | ||
"gitHead": "9b96afb2fc61ab3d2a5d143924e2c56d411280b4" | ||
"gitHead": "e0d0db33777f8f9fc9f5ebe1a977cf574b837be6" | ||
} |
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
188292
5121