@live-change/relations-plugin 0.6.12 → 0.6.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/entity.js +6 -6
- package/package.json +3 -3
package/entity.js
CHANGED
|
@@ -3,16 +3,17 @@ const {
|
|
|
3
3
|
processModelsAnnotation, extractIdParts, extractIdentifiers, extractObjectData
|
|
4
4
|
} = require('./utils.js')
|
|
5
5
|
const App = require("@live-change/framework")
|
|
6
|
+
const { PropertyDefinition, ViewDefinition, IndexDefinition, ActionDefinition, EventDefinition } = App
|
|
6
7
|
|
|
7
8
|
const annotation = 'entity'
|
|
8
9
|
|
|
9
10
|
function defineView(config, context) {
|
|
10
|
-
const { service, modelRuntime, modelName, others, model } = context
|
|
11
|
-
const viewName = (config.prefix || '' ) + modelName + (config.suffix || '')
|
|
11
|
+
const { service, modelRuntime, modelPropertyName, modelName, others, model } = context
|
|
12
|
+
const viewName = (config.prefix || '' ) + (config.prefix ? modelName : modelPropertyName) + (config.suffix || '')
|
|
12
13
|
service.views[viewName] = new ViewDefinition({
|
|
13
14
|
name: viewName,
|
|
14
15
|
properties: {
|
|
15
|
-
[
|
|
16
|
+
[modelPropertyName]: {
|
|
16
17
|
type: model,
|
|
17
18
|
validation: ['nonEmpty']
|
|
18
19
|
}
|
|
@@ -23,7 +24,7 @@ function defineView(config, context) {
|
|
|
23
24
|
access: config.access,
|
|
24
25
|
accessControl: config.readAccessControl || config.writeAccessControl,
|
|
25
26
|
daoPath(properties, { client, context }) {
|
|
26
|
-
const id = properties[
|
|
27
|
+
const id = properties[modelPropertyName]
|
|
27
28
|
const path = config.fields ? modelRuntime().limitedPath(id, config.fields) : modelRuntime().path(id)
|
|
28
29
|
return path
|
|
29
30
|
}
|
|
@@ -204,11 +205,10 @@ module.exports = function(service, app) {
|
|
|
204
205
|
|
|
205
206
|
const writeableProperties = modelProperties || config.writeableProperties
|
|
206
207
|
//console.log("PPP", others)
|
|
207
|
-
const otherPropertyNames = others.map(other => other.slice(0, 1).toLowerCase() + other.slice(1))
|
|
208
208
|
|
|
209
209
|
const context = {
|
|
210
210
|
service, app, model, originalModelProperties, modelProperties, modelPropertyName, defaults, modelRuntime,
|
|
211
|
-
|
|
211
|
+
modelName, writeableProperties, annotation
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
if (config.readAccess || config.readAccessControl || config.writeAccessControl) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/relations-plugin",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.15",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"url": "https://www.viamage.com/"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/framework": "^0.6.
|
|
24
|
+
"@live-change/framework": "^0.6.15",
|
|
25
25
|
"pluralize": "8.0.0"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "9b5c0ac7db8788a5647685dde41577b38c994263"
|
|
28
28
|
}
|