amphora 8.2.2 → 8.3.0

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.
@@ -6,8 +6,9 @@ const _ = require('lodash'),
6
6
  uid = require('../uid'),
7
7
  files = require('../files'),
8
8
  models = require('./models'),
9
+ components = require('./components'),
9
10
  meta = require('./metadata'),
10
- { getLayoutName, replaceVersion } = require('clayutils'),
11
+ { getLayoutName, replaceVersion, isComponent } = require('clayutils'),
11
12
  bus = require('./bus');
12
13
 
13
14
  /**
@@ -39,9 +40,13 @@ function get(uri, locals) {
39
40
  * @returns {Promise}
40
41
  */
41
42
  function put(uri, data, locals) {
42
- var model = files.getLayoutModules(getLayoutName(uri)),
43
- callHooks = _.get(locals, 'hooks') !== 'false',
44
- result;
43
+ // layout-level components are published the same as page-level components
44
+ if (isComponent(uri)) return components.cmptPut(uri, data, locals);
45
+
46
+ // else try to apply a layout model to the layout instance
47
+ const model = files.getLayoutModules(getLayoutName(uri)),
48
+ callHooks = _.get(locals, 'hooks') !== 'false';
49
+ let result;
45
50
 
46
51
  if (model && _.isFunction(model.save) && callHooks) {
47
52
  result = models.put(model, uri, data, locals);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amphora",
3
- "version": "8.2.2",
3
+ "version": "8.3.0",
4
4
  "description": "An API mixin for Express that saves, publishes and composes data with the key-value store of your choice.",
5
5
  "main": "index.js",
6
6
  "scripts": {