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

@live-change/relations-plugin

Package Overview
Dependencies
Maintainers
0
Versions
240
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@live-change/relations-plugin - npm Package Compare versions

Comparing version 0.9.7 to 0.9.8

32

entity.js
import {
defineProperties, defineIndex,
processModelsAnnotation, extractIdParts, extractIdentifiers, extractObjectData
processModelsAnnotation, extractIdParts, extractIdentifiers, extractObjectData, prepareAccessControl
} from './utils.js'

@@ -10,2 +10,3 @@ import { fireChangeTriggers } from "./changeTriggers.js"

} from "@live-change/framework"
import pluralize from 'pluralize'

@@ -48,2 +49,28 @@ const annotation = 'entity'

function defineRangeView(config, context, external = true) {
const { service, modelRuntime, modelPropertyName, modelName, model } = context
const viewName = (config.prefix || '' ) + pluralize(config.prefix ? modelName : modelPropertyName) + (config.suffix || '')
if(external) model.crud.range = viewName
service.views[viewName] = new ViewDefinition({
name: viewName,
properties: {
...App.utils.rangeProperties
},
returns: {
type: Array,
of: {
type: model
}
},
internal: !external,
global: config.globalView,
access: external && config.readAllAccess,
daoPath(properties, { client, context }) {
const range = App.extractRange(properties)
const path = modelRuntime().rangePath(range)
return path
}
})
}
function defineCreatedEvent(config, context) {

@@ -343,3 +370,3 @@ const {

model.identifiers = [{ [modelPropertyName]: 'id' }]
model.identifiers = [{ name: modelPropertyName, field: 'id' }]
model.crud = {}

@@ -365,2 +392,3 @@

defineView(config, context, config.readAccess || config.readAccessControl || config.writeAccessControl)
defineRangeView(config, context, config.readAllAccess)
/// TODO: multiple views with limited fields

@@ -367,0 +395,0 @@

2

itemOf.js

@@ -27,3 +27,3 @@ import {

context.identifiers = defineProperties(context.model, context.others, context.otherPropertyNames)
context.model.identifiers = [...Object.keys(context.identifiers), { [context.modelPropertyName]: 'id' }]
context.model.identifiers = [...Object.keys(context.identifiers), { name: context.modelPropertyName, field: 'id' }]

@@ -30,0 +30,0 @@ addAccessControlParents(context)

@@ -25,3 +25,3 @@ import {

context.identifiers = defineAnyProperties(context.model, context.otherPropertyNames)
context.model.identifiers = [...Object.keys(context.identifiers), { [context.modelPropertyName]: 'id' }]
context.model.identifiers = [...Object.keys(context.identifiers), { name: context.modelPropertyName, field: 'id' }]

@@ -28,0 +28,0 @@ addAccessControlAnyParents(context)

{
"name": "@live-change/relations-plugin",
"version": "0.9.7",
"version": "0.9.8",
"description": "",

@@ -25,6 +25,6 @@ "main": "index.js",

"dependencies": {
"@live-change/framework": "^0.9.7",
"@live-change/framework": "^0.9.8",
"pluralize": "^8.0.0"
},
"gitHead": "f936468bf39ea3c5b07ce14666f4b3a4a4a9287d"
"gitHead": "bb09550504f28df5f4fdd73273de45dc91a857b5"
}
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