total5 0.0.10 → 0.0.11
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/api.js +1 -1
- package/builders.js +13 -3
- package/changelog.txt +14 -0
- package/index.js +7 -3
- package/package.json +1 -1
- package/querybuilder.js +7 -5
- package/templates.js +8 -5
package/api.js
CHANGED
|
@@ -140,7 +140,7 @@ APICallProto.error = APICallProto.err = function(err, reverse) {
|
|
|
140
140
|
return this;
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
-
APICallProto.callback = function($) {
|
|
143
|
+
APICallProto.callback = APICallProto.pipe = function($) {
|
|
144
144
|
var t = this;
|
|
145
145
|
t.$callback = typeof($) === 'function' ? $ : $.callback();
|
|
146
146
|
return t;
|
package/builders.js
CHANGED
|
@@ -117,7 +117,17 @@ Options.prototype.transform = function(name, value, callback) {
|
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
Options.prototype.action = function(schema, payload) {
|
|
120
|
-
|
|
120
|
+
let t = this;
|
|
121
|
+
let action = F.action(schema, payload, this.controller);
|
|
122
|
+
if (!t.controller) {
|
|
123
|
+
if (t.user)
|
|
124
|
+
action.options.user = t.user;
|
|
125
|
+
if (t.query)
|
|
126
|
+
action.options.query = t.query;
|
|
127
|
+
if (t.params)
|
|
128
|
+
action.options.params = t.params;
|
|
129
|
+
}
|
|
130
|
+
return action;
|
|
121
131
|
};
|
|
122
132
|
|
|
123
133
|
Options.prototype.promisify = function(fn, a, b, c) {
|
|
@@ -231,7 +241,7 @@ Options.prototype.successful = function(callback) {
|
|
|
231
241
|
};
|
|
232
242
|
};
|
|
233
243
|
|
|
234
|
-
Options.prototype.callback = function(value) {
|
|
244
|
+
Options.prototype.callback = Options.prototype.pipe = function(value) {
|
|
235
245
|
|
|
236
246
|
var self = this;
|
|
237
247
|
|
|
@@ -1489,7 +1499,7 @@ ActionCaller.prototype.done = function($, fn) {
|
|
|
1489
1499
|
return this;
|
|
1490
1500
|
};
|
|
1491
1501
|
|
|
1492
|
-
ActionCaller.prototype.callback = function(value) {
|
|
1502
|
+
ActionCaller.prototype.callback = ActionCaller.prototype.pipe = function(value) {
|
|
1493
1503
|
this.options.callback = value;
|
|
1494
1504
|
return this;
|
|
1495
1505
|
};
|
package/changelog.txt
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
========================
|
|
2
|
+
0.0.11
|
|
3
|
+
========================
|
|
4
|
+
|
|
5
|
+
- fixed `controller` and `user` argument in the `TRANSFORM()` method
|
|
6
|
+
- fixed assigning `user`, `query` and `params` properties in the `$.action()` method
|
|
7
|
+
- fixed nullable `value` argument in the `querybuilder.permit()`
|
|
8
|
+
- fixed parsing `CONF.version`
|
|
9
|
+
- added `QueryBuilder.pipe()` method as alias to `QueryBuilder.callback()`
|
|
10
|
+
- added `API.pipe()` method as alias to `API.callback()`
|
|
11
|
+
- added `Action.pipe()` method as alias to `Action.callback()`
|
|
12
|
+
- added `RESTBuilder.pipe()` method as alias to `RESTBuilder.callback()`
|
|
13
|
+
- added support for localization in the `TEMPLATE()` method
|
|
14
|
+
|
|
1
15
|
========================
|
|
2
16
|
0.0.10
|
|
3
17
|
========================
|
package/index.js
CHANGED
|
@@ -36,7 +36,7 @@ global.DEF = {};
|
|
|
36
36
|
|
|
37
37
|
F.id = '';
|
|
38
38
|
F.clusterid = '';
|
|
39
|
-
F.is5 = F.version =
|
|
39
|
+
F.is5 = F.version = 5011;
|
|
40
40
|
F.isBundle = false;
|
|
41
41
|
F.isLoaded = false;
|
|
42
42
|
F.version_header = '5';
|
|
@@ -608,7 +608,7 @@ F.loadconfig = function(value) {
|
|
|
608
608
|
F.Http.globalAgent.maxSockets = 9999;
|
|
609
609
|
|
|
610
610
|
if (!F.config.$httpetag)
|
|
611
|
-
F.config.$httpetag = F.config.version.replace(/\.|\s/g, '');
|
|
611
|
+
F.config.$httpetag = (F.config.version || '').toString().replace(/\.|\s/g, '');
|
|
612
612
|
|
|
613
613
|
if (smtp)
|
|
614
614
|
F.config.smtp = smtp;
|
|
@@ -1976,11 +1976,15 @@ function transform(items, opt, index) {
|
|
|
1976
1976
|
F.transform = function(name, value, callback, controller) {
|
|
1977
1977
|
|
|
1978
1978
|
if (typeof(callback) !== 'function')
|
|
1979
|
-
return new Promise((resolve, reject) => F.transform(name, value, (err, response) => err ? reject(err) : resolve(response), controller));
|
|
1979
|
+
return new Promise((resolve, reject) => F.transform(name, value, (err, response) => err ? reject(err) : resolve(response), callback || controller));
|
|
1980
1980
|
|
|
1981
1981
|
var items = F.transformations[name];
|
|
1982
1982
|
if (items) {
|
|
1983
1983
|
let opt = new F.TBuilders.Options(controller, new F.TBuilders.ErrorBuilder());
|
|
1984
|
+
|
|
1985
|
+
if (controller)
|
|
1986
|
+
opt.user = controller.user;
|
|
1987
|
+
|
|
1984
1988
|
opt.value = value;
|
|
1985
1989
|
opt.$callback = callback;
|
|
1986
1990
|
transform(items, opt, 0);
|
package/package.json
CHANGED
package/querybuilder.js
CHANGED
|
@@ -153,7 +153,7 @@ CTP.next = function(t) {
|
|
|
153
153
|
|
|
154
154
|
};
|
|
155
155
|
|
|
156
|
-
CTP.callback = function($) {
|
|
156
|
+
CTP.callback = CTP.pipe = function($) {
|
|
157
157
|
var t = this;
|
|
158
158
|
t.$callback = typeof($) === 'function' ? $ : $.callback();
|
|
159
159
|
return t;
|
|
@@ -499,7 +499,7 @@ QBP.set = function(name) {
|
|
|
499
499
|
return this;
|
|
500
500
|
};
|
|
501
501
|
|
|
502
|
-
QBP.callback = function($) {
|
|
502
|
+
QBP.callback = QBP.pipe = function($) {
|
|
503
503
|
var t = this;
|
|
504
504
|
t.main.callback = typeof($) === 'function' ? $ : $.callback();
|
|
505
505
|
return t;
|
|
@@ -1192,9 +1192,11 @@ QBP.permit = function(name, type, value, userid, required) {
|
|
|
1192
1192
|
var types = type.split('');
|
|
1193
1193
|
var arr = [];
|
|
1194
1194
|
|
|
1195
|
-
|
|
1196
|
-
for (let
|
|
1197
|
-
|
|
1195
|
+
if (value && value.length) {
|
|
1196
|
+
for (let m of value) {
|
|
1197
|
+
for (let n of types)
|
|
1198
|
+
arr.push(n + m);
|
|
1199
|
+
}
|
|
1198
1200
|
}
|
|
1199
1201
|
|
|
1200
1202
|
t.options.checksum += (t.options.checksum ? ' ' : '') + 'permit' + type + arr.join('');
|
package/templates.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.render = function(body, model, $) {
|
|
|
6
6
|
return new Promise(function(resolve, reject) {
|
|
7
7
|
|
|
8
8
|
var cache = F.temporary.templates;
|
|
9
|
-
var id = 'Ttemplate' + HASH(body);
|
|
9
|
+
var id = 'Ttemplate' + HASH(body) + ($ ? $.language : '');
|
|
10
10
|
var data = cache[id];
|
|
11
11
|
|
|
12
12
|
if (data) {
|
|
@@ -45,7 +45,7 @@ exports.render = function(body, model, $) {
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
data = parse(response.body);
|
|
48
|
+
data = parse(response.body, $);
|
|
49
49
|
cache[id] = data;
|
|
50
50
|
|
|
51
51
|
try {
|
|
@@ -83,7 +83,7 @@ exports.render = function(body, model, $) {
|
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
data = parse(response.toString('utf8'));
|
|
86
|
+
data = parse(response.toString('utf8'), $);
|
|
87
87
|
|
|
88
88
|
if (!DEBUG)
|
|
89
89
|
cache[id] = data;
|
|
@@ -102,7 +102,7 @@ exports.render = function(body, model, $) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
data = cache[id] = parse(body);
|
|
105
|
+
data = cache[id] = parse(body, $);
|
|
106
106
|
|
|
107
107
|
try {
|
|
108
108
|
resolve(data.template({ value: model || data.model }, null, data.helpers));
|
|
@@ -115,7 +115,10 @@ exports.render = function(body, model, $) {
|
|
|
115
115
|
});
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
function parse(body) {
|
|
118
|
+
function parse(body, $) {
|
|
119
|
+
|
|
120
|
+
if ($ && $.language)
|
|
121
|
+
body = F.translate($.language, body);
|
|
119
122
|
|
|
120
123
|
var helpers = {};
|
|
121
124
|
var model = EMPTYOBJECT;
|