@mongoosejs/studio
Advanced tools
Comparing version 0.0.35 to 0.0.36
@@ -24,5 +24,5 @@ 'use strict'; | ||
result = await vm.runInContext(formatFunction(this.code), context); | ||
if (result.$document?.model) { | ||
if (result.$document?.constructor?.modelName) { | ||
let schemaPaths = {}; | ||
const Model = this.constructor.db.model(result.$document?.model); | ||
const Model = this.constructor.db.model(result.$document?.constructor?.modelName); | ||
for (const path of Object.keys(Model.schema.paths)) { | ||
@@ -29,0 +29,0 @@ schemaPaths[path] = { |
@@ -18,3 +18,3 @@ | ||
schemaPaths() { | ||
return Object.keys(this.value.$document.schemaPaths).sort((k1, k2) => { | ||
return Object.keys(this.value.$document?.schemaPaths || {}).sort((k1, k2) => { | ||
if (k1 === '_id' && k2 !== '_id') { | ||
@@ -21,0 +21,0 @@ return -1; |
@@ -12,40 +12,3 @@ 'use strict'; | ||
template, | ||
data: function() { | ||
return { | ||
dateType: 'picker' // picker, iso | ||
} | ||
}, | ||
props: ['document', 'schemaPaths', 'editting', 'changes', 'invalid'], | ||
methods: { | ||
getComponentForPath(schemaPath) { | ||
if (schemaPath.instance === 'Array') { | ||
return 'detail-array'; | ||
} | ||
return 'detail-default'; | ||
}, | ||
getEditComponentForPath(path) { | ||
if (path.instance == 'Date') { | ||
return 'edit-date'; | ||
} | ||
if (path.instance == 'Number') { | ||
return 'edit-number'; | ||
} | ||
if (path.instance === 'Array') { | ||
return 'edit-array'; | ||
} | ||
if (path.instance === 'Embedded') { | ||
return 'edit-subdocument'; | ||
} | ||
return 'edit-default'; | ||
}, | ||
getValueForPath(path) { | ||
return mpath.get(path, this.document); | ||
}, | ||
getEditValueForPath({ path }) { | ||
if (!this.changes) { | ||
return; | ||
} | ||
return path in this.changes ? this.changes[path] : mpath.get(path, this.document); | ||
} | ||
}, | ||
computed: { | ||
@@ -56,2 +19,5 @@ virtuals() { | ||
} | ||
if (this.document == null) { | ||
return []; | ||
} | ||
const exists = this.schemaPaths.map(x => x.path); | ||
@@ -58,0 +24,0 @@ const docKeys = Object.keys(this.document); |
@@ -29,2 +29,3 @@ 'use strict'; | ||
require('./document-details/document-details')(app); | ||
require('./document-details/document-property/document-property')(app); | ||
require('./edit-array/edit-array')(app); | ||
@@ -31,0 +32,0 @@ require('./edit-default/edit-default')(app); |
{ | ||
"name": "@mongoosejs/studio", | ||
"version": "0.0.35", | ||
"version": "0.0.36", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "archetype": "0.13.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
824410
131
14870