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

@live-change/framework

Package Overview
Dependencies
Maintainers
1
Versions
302
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@live-change/framework - npm Package Compare versions

Comparing version 0.2.8 to 0.2.9

3

lib/definition/ServiceDefinition.js
const ModelDefinition = require("./ModelDefinition.js")
const ForeignModelDefinition = require("./ForeignModelDefinition.js")
const ActionDefinition = require("./ActionDefinition.js")
const TriggerDefinition = require("./TriggerDefinition.js")
const ViewDefinition = require("./ViewDefinition.js")

@@ -77,3 +78,3 @@ const EventDefinition = require("./EventDefinition.js")

trigger(definition) {
const trigger = new ViewDefinition(definition)
const trigger = new TriggerDefinition(definition)
this.triggers[trigger.name] = trigger

@@ -80,0 +81,0 @@ return trigger

@@ -94,3 +94,3 @@ const utils = require("../utils.js")

async execute(props) {
await modelRuntime().create({...props.data, id: props.draft}, { conflict: 'replace' })
await modelRuntime().create({...props.data, id: props.draft})
}

@@ -217,3 +217,14 @@ })

async execute(props) {
await modelRuntime().create({...props.data, id: props.draft, draftStep: props.draftStep}, { conflict: 'update' })
await app.dao.request(['database', 'query', app.databaseName, `(${
async (input, output, { table, id, data, draftStep }) => {
const value = await input.table(table).object(id).get()
if(!value) {
return await output.table(table).put({ ...data, id, draftStep })
} else {
return await output.table(table).update(id, [
{ op:'merge', property: null, value: { ...data, draftStep} }
])
}
}
})`, { table: modelRuntime().tableName, id: props.draft, data: props.data, draftStep: props.draftStep }])
}

@@ -261,3 +272,15 @@ })

async execute(props) {
await modelRuntime().create({...props.data, id: props.draft, draftStep: props.draftStep}, { conflict: 'update' })
await app.dao.request(['database', 'query', app.databaseName,`(${
async (input, output, { table, id, data, draftStep }) => {
const value = await input.table(table).object(id).get()
if(!value) {
return await output.table(table).put({ ...data, id, draftStep })
} else {
return await output.table(table).update(id, [
{ op:'merge', property: null, value: { ...data, draftStep} }
])
}
}
})`, { table: modelRuntime().tableName, id: props.draft, data: props.data, draftStep: props.draftStep }])
//await modelRuntime().create({...props.data, id: props.draft, draftStep: props.draftStep}, { conflict: 'update' })
}

@@ -264,0 +287,0 @@ })

{
"name": "@live-change/framework",
"version": "0.2.8",
"version": "0.2.9",
"description": "Live Change Framework - ultimate solution for real time mobile/web apps",

@@ -5,0 +5,0 @@ "main": "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