@onehat/data 1.8.29 → 1.8.31

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.
@@ -25,9 +25,9 @@ describe('Schema', function() {
25
25
  expect(_.isEqual(clone._originalConfig, this.schema._originalConfig)).to.be.true;
26
26
  });
27
27
 
28
- it('getProperty', function() {
29
- const property = this.schema.getProperty('groups_users__id');
30
- expect(_.isEqual(property.name, 'groups_users__id')).to.be.true;
28
+ it('getPropertyDefinition', function() {
29
+ const propertyDefinition = this.schema.getPropertyDefinition('groups_users__id');
30
+ expect(_.isEqual(propertyDefinition.name, 'groups_users__id')).to.be.true;
31
31
  });
32
32
 
33
33
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/data",
3
- "version": "1.8.29",
3
+ "version": "1.8.31",
4
4
  "description": "JS data modeling package with adapters for many storage mediums.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -59,7 +59,7 @@ export default class Schema extends EventEmitter {
59
59
  displayProperty: null,
60
60
 
61
61
  /**
62
- * @member {array} propertyDefinitions - Array of Property definition objects
62
+ * @member {array} properties - Array of Property definition objects
63
63
  */
64
64
  properties: [],
65
65
 
@@ -183,20 +183,20 @@ export default class Schema extends EventEmitter {
183
183
 
184
184
  /**
185
185
  * Gets a single Property definition by name,
186
- * @param {string} propertyName - Name of the Property to retrieve
187
- * @return {object} property - The named Property
186
+ * @param {string} propertyName - Name of the property definition to retrieve
187
+ * @return {object} propertyDefinition - The property definition
188
188
  */
189
- getProperty = (propertyName) => {
189
+ getPropertyDefinition = (propertyName) => {
190
190
  if (this.isDestroyed) {
191
- throw Error('this.getProperty is no longer valid. Schema has been destroyed.');
191
+ throw Error('this.getPropertyDefinition is no longer valid. Schema has been destroyed.');
192
192
  }
193
- const property = _.find(this.properties, (propertyDefinition) => {
194
- propertyDefinition.name === propertyName;
193
+ const propertyDefinition = _.find(this.model.properties, (propertyDefinition) => {
194
+ return propertyDefinition.name === propertyName;
195
195
  });
196
- if (!property) {
197
- throw new Error('Property ' + propertyName + ' not found. Are you sure you initialized this Entity?');
196
+ if (!propertyDefinition) {
197
+ throw new Error('Property definition ' + propertyName + ' not found.');
198
198
  }
199
- return property;
199
+ return propertyDefinition;
200
200
  }
201
201
 
202
202
  /**