ende 0.5.3 → 0.5.4
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.
- checksums.yaml +4 -4
- data/components/indefinido/indemma/master/component.json +1 -1
- data/components/indefinido/indemma/master/lib/record/associable.js +2 -1
- data/components/indefinido/indemma/master/lib/record/dirtyable.js +3 -1
- data/components/indefinido/indemma/master/lib/record/restfulable.js +7 -3
- data/components/indefinido/indemma/master/lib/record/validatable.js +1 -0
- data/components/indefinido/indemma/master/lib/record/validations/associated.js +5 -4
- data/components/indefinido/observable/es6-modules/component.json +1 -1
- data/components/indefinido/observable/es6-modules/lib/adapters/rivets.js +15 -3
- data/components/indefinido/observable/es6-modules/lib/legacy/schedulerable.js +34 -8
- data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +3 -2
- data/lib/ende/version.rb +1 -1
- data/vendor/assets/components/ende_build.js +2717 -2681
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0e48bf4ef7898c1ec8445c6cc33851d80d7faef
|
4
|
+
data.tar.gz: 3cea46379431f55fc0890ea0ed4ae1114e8c4074
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dd17eae28952f0f8bbd7a90ebb5100aeb4b406642709ff7a7c4cef1e5846da10804f864ba901058a3c9495d5cc530fbbfe45b28c59d2c0f140b32bd117c5fd4
|
7
|
+
data.tar.gz: a39c1a3f4d6cad47b5b88ded0fecd7a458b6ee33633532e5cc405dd7ff4758b16f1dc3c4a17d195a94bfd0ca102db617a1ffa9847253dfc2f2ea47bbbc05693f
|
@@ -332,7 +332,8 @@ associable = {
|
|
332
332
|
old_resource = this[resource];
|
333
333
|
Object.defineProperty(record, resource.toString(), {
|
334
334
|
get: $.proxy(descriptors.belongs_to.resource.getter, association_proxy),
|
335
|
-
set: $.proxy(descriptors.belongs_to.resource.setter, association_proxy)
|
335
|
+
set: $.proxy(descriptors.belongs_to.resource.setter, association_proxy),
|
336
|
+
configurable: true
|
336
337
|
});
|
337
338
|
_results.push(this[resource] = old_resource);
|
338
339
|
}
|
@@ -147,7 +147,7 @@ restful = {
|
|
147
147
|
return promise;
|
148
148
|
},
|
149
149
|
assign_attributes: function(attributes) {
|
150
|
-
var association, association_attributes, association_name, associations_attributes, attribute, message, name, singular_resource, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _results;
|
150
|
+
var associated, association, association_attributes, association_name, associations_attributes, attribute, message, name, singular_resource, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _results;
|
151
151
|
|
152
152
|
_ref = model[this.resource.toString()].has_many;
|
153
153
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
@@ -189,7 +189,9 @@ restful = {
|
|
189
189
|
delete attributes[association_name];
|
190
190
|
delete attributes[association_name + "_attributes"];
|
191
191
|
if (association_attributes) {
|
192
|
-
this[association_name]
|
192
|
+
associated = this[association_name] || this["build_" + association_name]();
|
193
|
+
associated.assign_attributes(association_attributes);
|
194
|
+
this[association_name] = associated;
|
193
195
|
}
|
194
196
|
}
|
195
197
|
_ref3 = model[this.resource.toString()].belongs_to;
|
@@ -199,7 +201,9 @@ restful = {
|
|
199
201
|
delete attributes[association_name];
|
200
202
|
delete attributes[association_name + "_attributes"];
|
201
203
|
if (association_attributes) {
|
202
|
-
this[association_name]
|
204
|
+
associated = this[association_name] || this["build_" + association_name]();
|
205
|
+
associated.assign_attributes(association_attributes);
|
206
|
+
this[association_name] = associated;
|
203
207
|
}
|
204
208
|
}
|
205
209
|
_results = [];
|
@@ -4,15 +4,16 @@ stampit = require('../../../vendor/stampit');
|
|
4
4
|
|
5
5
|
associationable = stampit({
|
6
6
|
validate_each: function(record, attribute, value) {
|
7
|
-
var associated_validation;
|
7
|
+
var associated, associated_validation;
|
8
8
|
|
9
|
-
|
9
|
+
associated = record[attribute];
|
10
|
+
if (associated) {
|
10
11
|
if (model[record.resource].has_one.indexOf(attribute) === -1) {
|
11
12
|
throw new Error('Only has_one associations are supported to validates_associated');
|
12
13
|
}
|
13
|
-
associated_validation =
|
14
|
+
associated_validation = associated.validate();
|
14
15
|
associated_validation.done(function() {
|
15
|
-
if (
|
16
|
+
if (associated.errors.length) {
|
16
17
|
return record.errors.add(attribute, 'associated', this.options);
|
17
18
|
}
|
18
19
|
});
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
var adapter;
|
2
|
+
|
3
|
+
adapter = {
|
2
4
|
subscribe: function(record, attribute_path, callback) {
|
3
5
|
if (record == null) {
|
4
6
|
throw new TypeError('observable.adapters.rivets.subscribe: No record provided for subscription');
|
@@ -17,12 +19,22 @@ exports.adapter = {
|
|
17
19
|
if (record == null) {
|
18
20
|
throw new TypeError('observable.adapters.rivets.read: No record provided for subscription');
|
19
21
|
}
|
20
|
-
|
22
|
+
if (attribute_path.indexOf('.') === -1) {
|
23
|
+
return record[attribute_path];
|
24
|
+
} else {
|
25
|
+
return record.observation.observers[attribute_path].value_;
|
26
|
+
}
|
21
27
|
},
|
22
28
|
publish: function(record, attribute_path, value) {
|
23
29
|
if (record == null) {
|
24
30
|
throw new TypeError('observable.adapters.rivets.publish: No record provided for subscription');
|
25
31
|
}
|
26
|
-
|
32
|
+
if (attribute_path.indexOf('.') === -1) {
|
33
|
+
return record[attribute_path] = value;
|
34
|
+
} else {
|
35
|
+
return record.observation.observers[attribute_path].setValue(value);
|
36
|
+
}
|
27
37
|
}
|
28
38
|
};
|
39
|
+
|
40
|
+
export default adapter;
|
@@ -16,7 +16,7 @@ scheduler = function(options) {
|
|
16
16
|
};
|
17
17
|
}
|
18
18
|
jQuery.extend(options, {
|
19
|
-
|
19
|
+
schedulable_keypaths: {
|
20
20
|
value: []
|
21
21
|
},
|
22
22
|
schedule: {
|
@@ -37,13 +37,13 @@ scheduler = function(options) {
|
|
37
37
|
|
38
38
|
jQuery.extend(scheduler, {
|
39
39
|
methods: {
|
40
|
-
|
40
|
+
schedulable: function(object, keypath) {
|
41
41
|
var observer, observers, value;
|
42
42
|
|
43
|
-
if (this.
|
43
|
+
if (this.schedulable_keypaths.indexOf(keypath) !== -1) {
|
44
44
|
return;
|
45
45
|
}
|
46
|
-
this.
|
46
|
+
this.schedulable_keypaths.push(keypath);
|
47
47
|
observers = object.observation.observers;
|
48
48
|
observer = observers[keypath];
|
49
49
|
value = observer.path_.getValueFrom(object);
|
@@ -54,7 +54,8 @@ jQuery.extend(scheduler, {
|
|
54
54
|
configurable: true
|
55
55
|
});
|
56
56
|
if (value !== observer.path_.getValueFrom(object)) {
|
57
|
-
|
57
|
+
observer.setValue(value);
|
58
|
+
return object.observation.deliver();
|
58
59
|
}
|
59
60
|
},
|
60
61
|
deliver: function() {
|
@@ -68,12 +69,14 @@ jQuery.extend(scheduler, {
|
|
68
69
|
return function(value) {
|
69
70
|
current_setter.call(this, value);
|
70
71
|
this.observed[keypath] = value;
|
71
|
-
|
72
|
+
this.observation.scheduler.schedule();
|
73
|
+
return value;
|
72
74
|
};
|
73
75
|
} else {
|
74
76
|
return function(value) {
|
75
77
|
this.observed[keypath] = value;
|
76
|
-
|
78
|
+
this.observation.scheduler.schedule();
|
79
|
+
return value;
|
77
80
|
};
|
78
81
|
}
|
79
82
|
},
|
@@ -91,13 +94,36 @@ jQuery.extend(scheduler, {
|
|
91
94
|
});
|
92
95
|
|
93
96
|
schedulerable = function(observable) {
|
97
|
+
schedulerable.storage_for(observable);
|
98
|
+
schedulerable.schedulable_observers();
|
99
|
+
return schedulerable.augment(observable);
|
100
|
+
};
|
101
|
+
|
102
|
+
schedulerable.storage_for = function(observable) {};
|
103
|
+
|
104
|
+
schedulerable.schedulable_observers = function() {
|
105
|
+
import {Path} from '../../vendor/observe-js/observe.js';
|
106
|
+
var original;
|
107
|
+
|
108
|
+
original = Path.prototype.setValueFrom;
|
109
|
+
return Path.prototype.setValueFrom = function(object) {
|
110
|
+
var changed;
|
111
|
+
|
112
|
+
changed = original.apply(this, arguments);
|
113
|
+
if (changed) {
|
114
|
+
return object.observation.scheduler.schedule();
|
115
|
+
}
|
116
|
+
};
|
117
|
+
};
|
118
|
+
|
119
|
+
schedulerable.augment = function(observable) {
|
94
120
|
var original;
|
95
121
|
|
96
122
|
original = observable.methods.subscribe;
|
97
123
|
observable.methods.subscribe = function(keypath, callback) {
|
98
124
|
original.apply(this, arguments);
|
99
125
|
if (typeof keypath !== 'function') {
|
100
|
-
return this.observation.scheduler.
|
126
|
+
return this.observation.scheduler.schedulable(this, keypath);
|
101
127
|
}
|
102
128
|
};
|
103
129
|
return jQuery.extend((function() {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
'use strict';
|
2
3
|
|
3
4
|
# TODO require formatters through aura instead of directly loding a module
|
@@ -10,15 +11,15 @@ define 'aura/extensions/rivets', ['aura/extensions/rivets/formatters'], (formatt
|
|
10
11
|
Rivets = rivets._
|
11
12
|
|
12
13
|
with_component = 'indefinido~observable@es6-modules/lib/adapters/rivets.js'
|
13
|
-
|
14
|
+
observable_adapter = require with_component
|
14
15
|
|
15
16
|
with_component = 'segmentio~extend@1.0.0'
|
16
17
|
extend = require with_component
|
17
18
|
|
18
19
|
extend rivets.formatters, formatters
|
19
20
|
|
20
|
-
rivets.configure observable_configuration
|
21
21
|
rivets.configure
|
22
|
+
adapter: observable_adapter
|
22
23
|
prefix: ''
|
23
24
|
templateDelimiters: ['{{', '}}']
|
24
25
|
|
data/lib/ende/version.rb
CHANGED