total5 0.0.1-2 → 0.0.1-21
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 +323 -22
- package/bundles.js +2 -12
- package/cms.js +61 -11
- package/controller.js +141 -32
- package/filestorage.js +39 -19
- package/flow-flowstream.js +412 -246
- package/flow.js +62 -36
- package/flowstream.js +84 -15
- package/global.js +144 -3
- package/http.js +1 -1
- package/image.js +4 -0
- package/images.js +1 -1
- package/index.js +142 -48
- package/jsonschema.js +35 -27
- package/mail.js +9 -7
- package/markdown.js +756 -0
- package/minificators.js +1 -1
- package/nosql-builder.js +1 -1
- package/nosql.js +11 -0
- package/openclient.js +1 -1
- package/package.json +1 -1
- package/querybuilder.js +2 -3
- package/routing.js +113 -31
- package/sourcemap.js +1 -1
- package/test.js +48 -0
- package/tms.js +13 -18
- package/tmsclient.js +4 -0
- package/uibuilder.js +54 -19
- package/utils.js +72 -43
- package/viewengine.js +10 -11
- package/websocket.js +4 -3
- package/workers.js +2 -2
- package/CONTRIBUTING.md +0 -55
- package/helpers/index.js +0 -32
- package/templates.json +0 -74
- package/todo.txt +0 -11
- package/tools/beta.sh +0 -6
- package/tools/release.sh +0 -6
package/utils.js
CHANGED
|
@@ -51,6 +51,7 @@ const REG_KEYWORD2 = /\n/g;
|
|
|
51
51
|
const REG_KEYWORD3 = /\W|_/g;
|
|
52
52
|
const REG_BASE = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$/;
|
|
53
53
|
const REG_BASE2 = /^|,([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$/;
|
|
54
|
+
const REG_NUMBER = /^[0-9,.]$/;
|
|
54
55
|
|
|
55
56
|
const NEWLINE = '\r\n';
|
|
56
57
|
const DIACRITICSMAP = {};
|
|
@@ -71,6 +72,7 @@ const REG_TIME = /am|pm/i;
|
|
|
71
72
|
const REG_XMLKEY = /\[|\]|:|\.|_/g;
|
|
72
73
|
const REG_HEADERPARSER = /(name|filename)=".*?"|content-type:\s[a-z0-9-./+]+/ig;
|
|
73
74
|
const HEADEREND = Buffer.from('\r\n\r\n', 'ascii');
|
|
75
|
+
const JSCHEMAS_NULLABLE = { json: 1, base64: 1, guid: 1, datauri: 1, uid: 1, string2: 1 };
|
|
74
76
|
|
|
75
77
|
exports.MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
76
78
|
exports.DAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
@@ -194,6 +196,12 @@ exports.parseConfig = function(value) {
|
|
|
194
196
|
generated.push(key);
|
|
195
197
|
break;
|
|
196
198
|
default:
|
|
199
|
+
|
|
200
|
+
if (val === 'true' || val === 'false')
|
|
201
|
+
val = val === 'true';
|
|
202
|
+
else if (REG_NUMBER.test(val))
|
|
203
|
+
val = val.parseFloat();
|
|
204
|
+
|
|
197
205
|
cfg[key] = val;
|
|
198
206
|
break;
|
|
199
207
|
}
|
|
@@ -349,6 +357,7 @@ var CONTENTTYPES = {
|
|
|
349
357
|
xml: 'application/xml',
|
|
350
358
|
xpm: 'image/x-xpixmap',
|
|
351
359
|
xsl: 'application/xml',
|
|
360
|
+
xsd: 'application/xml',
|
|
352
361
|
xslt: 'application/xslt+xml',
|
|
353
362
|
zip: 'application/zip',
|
|
354
363
|
'7zip': 'application/x-7z-compressed'
|
|
@@ -2199,7 +2208,16 @@ SP.hash = function(type, salt) {
|
|
|
2199
2208
|
}
|
|
2200
2209
|
};
|
|
2201
2210
|
|
|
2202
|
-
SP.sign = function(key) {
|
|
2211
|
+
SP.sign = function(key, check) {
|
|
2212
|
+
|
|
2213
|
+
if (check) {
|
|
2214
|
+
let index = this.lastIndexOf('-');
|
|
2215
|
+
if (index === -1)
|
|
2216
|
+
return null;
|
|
2217
|
+
var id = this.substring(0, index);
|
|
2218
|
+
return id.sign(key) === this ? id : null;
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2203
2221
|
return this + '-' + (string_hash(this + (key || '')) >>> 0).toString(36);
|
|
2204
2222
|
};
|
|
2205
2223
|
|
|
@@ -2226,17 +2244,6 @@ function string_hash(s, convert) {
|
|
|
2226
2244
|
return hash;
|
|
2227
2245
|
}
|
|
2228
2246
|
|
|
2229
|
-
SP.count = function(text) {
|
|
2230
|
-
var index = 0;
|
|
2231
|
-
var count = 0;
|
|
2232
|
-
do {
|
|
2233
|
-
index = this.indexOf(text, index + text.length);
|
|
2234
|
-
if (index > 0)
|
|
2235
|
-
count++;
|
|
2236
|
-
} while (index > 0);
|
|
2237
|
-
return count;
|
|
2238
|
-
};
|
|
2239
|
-
|
|
2240
2247
|
SP.parseComponent = function(tags) {
|
|
2241
2248
|
|
|
2242
2249
|
var html = this;
|
|
@@ -3174,6 +3181,11 @@ SP.parseConfig = function(def, onerr) {
|
|
|
3174
3181
|
} else
|
|
3175
3182
|
subtype = '';
|
|
3176
3183
|
|
|
3184
|
+
if (value.substring(0, 7) === 'base64 ' && value.length > 8)
|
|
3185
|
+
value = Buffer.from(value.substring(7).trim(), 'base64').toString('utf8');
|
|
3186
|
+
else if (value.substring(0, 4) === 'hex ' && value.length > 6)
|
|
3187
|
+
value = Buffer.from(value.substring(4).trim(), 'hex').toString('utf8');
|
|
3188
|
+
|
|
3177
3189
|
switch (subtype) {
|
|
3178
3190
|
case 'string':
|
|
3179
3191
|
obj[name] = value;
|
|
@@ -3243,7 +3255,7 @@ SP.decrypt_uid = function(key) {
|
|
|
3243
3255
|
return exports.decrypt_uid(this, key);
|
|
3244
3256
|
};
|
|
3245
3257
|
|
|
3246
|
-
SP.safehtml = function() {
|
|
3258
|
+
SP.encode = SP.safehtml = function() {
|
|
3247
3259
|
var output = '';
|
|
3248
3260
|
for (var i = 0, length = this.length; i < length; i++) {
|
|
3249
3261
|
var c = this[i];
|
|
@@ -3285,6 +3297,7 @@ SP.arg = SP.args = function(obj, encode, def) {
|
|
|
3285
3297
|
def = encode;
|
|
3286
3298
|
var isfn = typeof(encode) === 'function';
|
|
3287
3299
|
return this.replace(REG_ARGS, function(text) {
|
|
3300
|
+
|
|
3288
3301
|
// Is double bracket?
|
|
3289
3302
|
var l = text[1] === '{' ? 2 : 1;
|
|
3290
3303
|
var key = text.substring(l, text.length - l).trim();
|
|
@@ -3963,6 +3976,12 @@ SP.base64ToBuffer = function() {
|
|
|
3963
3976
|
return Buffer.from(self.substring(index), 'base64');
|
|
3964
3977
|
};
|
|
3965
3978
|
|
|
3979
|
+
SP.parseDataURI = function() {
|
|
3980
|
+
var self = this;
|
|
3981
|
+
var index = self.indexOf(';');
|
|
3982
|
+
return index == -1 ? null : { type: self.substring(5, index), buffer: Buffer.from(self.substring(self.indexOf(',', index) + 1), 'base64') };
|
|
3983
|
+
};
|
|
3984
|
+
|
|
3966
3985
|
SP.base64ContentType = function() {
|
|
3967
3986
|
var self = this;
|
|
3968
3987
|
var index = self.indexOf(';');
|
|
@@ -4513,7 +4532,7 @@ AP.findAll = function(cb, value) {
|
|
|
4513
4532
|
};
|
|
4514
4533
|
|
|
4515
4534
|
AP.findValue = function(cb, value, path, def) {
|
|
4516
|
-
var index = this.
|
|
4535
|
+
var index = this.TfindIndex(cb, value);
|
|
4517
4536
|
if (index !== -1) {
|
|
4518
4537
|
var item = this[index][path];
|
|
4519
4538
|
return item == null ? def : item;
|
|
@@ -4523,13 +4542,14 @@ AP.findValue = function(cb, value, path, def) {
|
|
|
4523
4542
|
|
|
4524
4543
|
AP.findItem = function(cb, value) {
|
|
4525
4544
|
var self = this;
|
|
4526
|
-
var index = self.
|
|
4545
|
+
var index = self.TfindIndex(cb, value);
|
|
4527
4546
|
if (index === -1)
|
|
4528
4547
|
return null;
|
|
4529
4548
|
return self[index];
|
|
4530
4549
|
};
|
|
4531
4550
|
|
|
4532
|
-
|
|
4551
|
+
// TfindIndex due to other NPM dependencies
|
|
4552
|
+
AP.TfindIndex = AP.findIndex = function(cb, value) {
|
|
4533
4553
|
|
|
4534
4554
|
var self = this;
|
|
4535
4555
|
var isFN = typeof(cb) === 'function';
|
|
@@ -4646,6 +4666,8 @@ AP.async = function(thread, callback, tmp) {
|
|
|
4646
4666
|
thread = 1;
|
|
4647
4667
|
} else if (thread === undefined)
|
|
4648
4668
|
thread = 1;
|
|
4669
|
+
else if (thread > self.length)
|
|
4670
|
+
thread = self.length;
|
|
4649
4671
|
|
|
4650
4672
|
if (!tmp) {
|
|
4651
4673
|
tmp = {};
|
|
@@ -5768,13 +5790,17 @@ exports.querify = function(url, obj) {
|
|
|
5768
5790
|
}
|
|
5769
5791
|
|
|
5770
5792
|
if (url) {
|
|
5793
|
+
|
|
5794
|
+
if (!arg.length)
|
|
5795
|
+
return url;
|
|
5796
|
+
|
|
5771
5797
|
let arr = url.split(' ');
|
|
5772
5798
|
let index = QUERIFYMETHODS[arr[0]] ? 1 : 0;
|
|
5773
5799
|
arr[index] += (arr[index].indexOf('?') === -1 ? '?' : '&') + arg.join('&');
|
|
5774
5800
|
return arr.join(' ');
|
|
5775
5801
|
}
|
|
5776
5802
|
|
|
5777
|
-
return '?' + arg.join('&');
|
|
5803
|
+
return arg.length ? ('?' + arg.join('&')) : '';
|
|
5778
5804
|
};
|
|
5779
5805
|
|
|
5780
5806
|
exports.connect = function(opt, callback) {
|
|
@@ -5865,7 +5891,7 @@ exports.connect = function(opt, callback) {
|
|
|
5865
5891
|
meta.socket1.on('clientError', error);
|
|
5866
5892
|
};
|
|
5867
5893
|
|
|
5868
|
-
String.prototype.toJSONSchema = function(name, url) {
|
|
5894
|
+
String.prototype.toJSONSchema = String.prototype.parseSchema = function(name, url) {
|
|
5869
5895
|
|
|
5870
5896
|
var obj = {};
|
|
5871
5897
|
var p = (url || CONF.url || 'https://schemas.totaljs.com/');
|
|
@@ -5882,10 +5908,14 @@ String.prototype.toJSONSchema = function(name, url) {
|
|
|
5882
5908
|
var nestedtypes = [];
|
|
5883
5909
|
|
|
5884
5910
|
str = str.replace(/\[.*?\]/g, function(text) {
|
|
5911
|
+
if (text.substring(1, 2) === '@')
|
|
5912
|
+
return text;
|
|
5885
5913
|
return '[#' + (nestedtypes.push(text.substring(1, text.length - 1)) - 1) + ']';
|
|
5886
5914
|
});
|
|
5887
5915
|
|
|
5888
5916
|
str = str.replace(/\{.*?\}/g, function(text) {
|
|
5917
|
+
if (text.substring(1, 2) === '@')
|
|
5918
|
+
return text;
|
|
5889
5919
|
return '{#' + (nestedtypes.push(text.substring(1, text.length - 1)) - 1) + '}';
|
|
5890
5920
|
});
|
|
5891
5921
|
|
|
@@ -5903,7 +5933,8 @@ String.prototype.toJSONSchema = function(name, url) {
|
|
|
5903
5933
|
required.push(arr[0]);
|
|
5904
5934
|
}
|
|
5905
5935
|
|
|
5906
|
-
var type = (arr[1] || 'string').
|
|
5936
|
+
var type = (arr[1] || 'string').trim();
|
|
5937
|
+
// var type = typename.toLowerCase().trim();
|
|
5907
5938
|
var size = 0;
|
|
5908
5939
|
var isarr = type[0] === '[';
|
|
5909
5940
|
if (isarr)
|
|
@@ -5957,22 +5988,14 @@ String.prototype.toJSONSchema = function(name, url) {
|
|
|
5957
5988
|
type = type.toLowerCase();
|
|
5958
5989
|
|
|
5959
5990
|
} else if (type[0] === '@') {
|
|
5960
|
-
|
|
5961
|
-
// other schema
|
|
5962
|
-
var subname = type.substring(1);
|
|
5963
|
-
var schema = GETSCHEMA(subname);
|
|
5964
|
-
|
|
5965
|
-
schema = schema ? schema.toJSONSchema() : F.jsonschemas[subname];
|
|
5966
|
-
|
|
5967
|
-
if (schema)
|
|
5968
|
-
nestedschema = schema;
|
|
5969
|
-
else
|
|
5970
|
-
throw new Error('Schema "' + subname + '" not found');
|
|
5971
|
-
|
|
5991
|
+
nestedschema = type.substring(1);
|
|
5972
5992
|
type = 'object';
|
|
5973
5993
|
}
|
|
5974
5994
|
|
|
5975
|
-
|
|
5995
|
+
var ltype = type.toLowerCase();
|
|
5996
|
+
|
|
5997
|
+
switch (ltype) {
|
|
5998
|
+
case 'string2':
|
|
5976
5999
|
case 'string':
|
|
5977
6000
|
case 'uid':
|
|
5978
6001
|
case 'guid':
|
|
@@ -5990,19 +6013,21 @@ String.prototype.toJSONSchema = function(name, url) {
|
|
|
5990
6013
|
case 'color':
|
|
5991
6014
|
case 'icon':
|
|
5992
6015
|
case 'base64':
|
|
6016
|
+
case 'datauri':
|
|
5993
6017
|
case 'safestring':
|
|
5994
6018
|
case 'search':
|
|
5995
6019
|
case 'text':
|
|
5996
6020
|
tmp = {};
|
|
5997
6021
|
if (isarr) {
|
|
5998
6022
|
tmp.type = 'array';
|
|
5999
|
-
tmp.items = { type: 'string', subtype:
|
|
6023
|
+
tmp.items = { type: 'string', subtype: ltype === 'text' ? undefined : ltype, nullable: JSCHEMAS_NULLABLE[ltype] };
|
|
6000
6024
|
if (size)
|
|
6001
6025
|
tmp.items.maxLength = size;
|
|
6002
6026
|
} else {
|
|
6003
6027
|
tmp.type = 'string';
|
|
6004
|
-
|
|
6005
|
-
|
|
6028
|
+
tmp.nullable = JSCHEMAS_NULLABLE[ltype];
|
|
6029
|
+
if (ltype !== tmp.type)
|
|
6030
|
+
tmp.subtype = ltype;
|
|
6006
6031
|
if (size)
|
|
6007
6032
|
tmp.maxLength = size;
|
|
6008
6033
|
}
|
|
@@ -6022,11 +6047,11 @@ String.prototype.toJSONSchema = function(name, url) {
|
|
|
6022
6047
|
tmp = {};
|
|
6023
6048
|
if (isarr) {
|
|
6024
6049
|
tmp.type = 'array';
|
|
6025
|
-
tmp.items = { type: 'number', subtype: type === 'number' ? undefined :
|
|
6050
|
+
tmp.items = { type: 'number', subtype: type === 'number' ? undefined : ltype };
|
|
6026
6051
|
} else {
|
|
6027
6052
|
tmp.type = 'number';
|
|
6028
|
-
if (
|
|
6029
|
-
tmp.subtype =
|
|
6053
|
+
if (ltype !== 'number')
|
|
6054
|
+
tmp.subtype = ltype;
|
|
6030
6055
|
}
|
|
6031
6056
|
|
|
6032
6057
|
break;
|
|
@@ -6052,11 +6077,11 @@ String.prototype.toJSONSchema = function(name, url) {
|
|
|
6052
6077
|
|
|
6053
6078
|
if (isarr) {
|
|
6054
6079
|
tmp.type = 'array';
|
|
6055
|
-
tmp.items =
|
|
6056
|
-
} else
|
|
6057
|
-
tmp = nestedschema;
|
|
6058
|
-
else
|
|
6080
|
+
tmp.items = { type: 'object', $ref: nestedschema };
|
|
6081
|
+
} else {
|
|
6059
6082
|
tmp.type = 'object';
|
|
6083
|
+
tmp.$ref = nestedschema;
|
|
6084
|
+
}
|
|
6060
6085
|
|
|
6061
6086
|
break;
|
|
6062
6087
|
case 'enum':
|
|
@@ -6079,6 +6104,10 @@ String.prototype.toJSONSchema = function(name, url) {
|
|
|
6079
6104
|
obj.required = required;
|
|
6080
6105
|
|
|
6081
6106
|
obj.transform = exports.jsonschematransform;
|
|
6107
|
+
|
|
6108
|
+
if (name)
|
|
6109
|
+
F.jsonschemas[name] = obj;
|
|
6110
|
+
|
|
6082
6111
|
return obj;
|
|
6083
6112
|
};
|
|
6084
6113
|
|
|
@@ -6348,7 +6377,7 @@ exports.uidr = function() {
|
|
|
6348
6377
|
var c;
|
|
6349
6378
|
|
|
6350
6379
|
if (i === 9) {
|
|
6351
|
-
c = F.uidc;
|
|
6380
|
+
c = F.internal.uidc;
|
|
6352
6381
|
} else {
|
|
6353
6382
|
let index = Math.floor(Math.random() * RANDOM_TEXT.length);
|
|
6354
6383
|
c = RANDOM_TEXT[index];
|
package/viewengine.js
CHANGED
|
@@ -277,7 +277,7 @@ function parseplus(builder) {
|
|
|
277
277
|
return c !== '!' && c !== '?' && c !== '+' && c !== '.' && c !== ':';
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
function prepare(command,
|
|
280
|
+
function prepare(command, dcommand, functions) {
|
|
281
281
|
|
|
282
282
|
var a = command.indexOf('.');
|
|
283
283
|
var b = command.indexOf('(');
|
|
@@ -301,10 +301,10 @@ function prepare(command, dynamicCommand, functions) {
|
|
|
301
301
|
index = command.length;
|
|
302
302
|
|
|
303
303
|
var name = command.substring(0, index);
|
|
304
|
-
if (name ===
|
|
304
|
+
if (name === dcommand)
|
|
305
305
|
return 'self.safehtml(' + command + ', 1)';
|
|
306
306
|
|
|
307
|
-
if (name[0] === '!' && name.substring(1) ===
|
|
307
|
+
if (name[0] === '!' && name.substring(1) === dcommand)
|
|
308
308
|
return 'self.safehtml(' + command.substring(1) + ')';
|
|
309
309
|
|
|
310
310
|
switch (name) {
|
|
@@ -741,7 +741,7 @@ function makehtmlmeta(self) {
|
|
|
741
741
|
title = repo.title.safehtml();
|
|
742
742
|
|
|
743
743
|
if (title) {
|
|
744
|
-
if (!F.config.$
|
|
744
|
+
if (!F.config.$customtitles && self?.controller?.url !== '/')
|
|
745
745
|
title += ' - ' + F.config.name;
|
|
746
746
|
} else if (!title)
|
|
747
747
|
title = F.config.name;
|
|
@@ -796,12 +796,12 @@ View.prototype.import = function() {
|
|
|
796
796
|
}
|
|
797
797
|
|
|
798
798
|
if (m.indexOf('+') === -1) {
|
|
799
|
-
let
|
|
799
|
+
let absolute = m[0] === '/';
|
|
800
|
+
let key = absolute ? m : ('/' + m);
|
|
800
801
|
if (REG_CHECKCSS.test(m)) {
|
|
801
|
-
tmp = '<link rel="stylesheet" href="/' + (F.routes.virtual[key] ? '' : 'css/') + m + '" />';
|
|
802
|
+
tmp = '<link rel="stylesheet" href="' + (absolute ? m : ('/' + (F.routes.virtual[key] ? '' : 'css/') + m)) + '" />';
|
|
802
803
|
} else {
|
|
803
|
-
|
|
804
|
-
tmp = '<scri' + 'pt src="/' + (F.routes.virtual[key] ? '' : 'js/') + m + '"></scr' + 'ipt>';
|
|
804
|
+
tmp = '<scri' + 'pt src="' + (absolute ? m : ('/' + (F.routes.virtual[key] ? '' : 'js/') + m)) + '"></scr' + 'ipt>';
|
|
805
805
|
}
|
|
806
806
|
} else {
|
|
807
807
|
let iscss = REG_CHECKCSS.test(m);
|
|
@@ -858,10 +858,9 @@ View.prototype.render = function(name, model, ispartial = false) {
|
|
|
858
858
|
self.model = model;
|
|
859
859
|
|
|
860
860
|
if (!fn) {
|
|
861
|
-
|
|
862
|
-
content = F.translate(self.language, F.Fs.readFileSync(
|
|
861
|
+
let path = name[0] === '#' ? F.path.plugins(name.substring(1) + '.html') : F.path.directory('views', name + '.html');
|
|
862
|
+
content = F.translate(self.language, F.Fs.readFileSync(path, 'utf8'));
|
|
863
863
|
fn = exports.compile(name, content, DEBUG);
|
|
864
|
-
|
|
865
864
|
if (!DEBUG)
|
|
866
865
|
F.temporary.views[key] = fn;
|
|
867
866
|
}
|
package/websocket.js
CHANGED
|
@@ -836,6 +836,7 @@ function authorize(ctrl) {
|
|
|
836
836
|
if (F.def.onAuthorize) {
|
|
837
837
|
var opt = new F.TBuilders.Options(ctrl);
|
|
838
838
|
opt.TYPE = 'auth'; // important
|
|
839
|
+
opt.query = ctrl.query;
|
|
839
840
|
opt.iswebsocket = true;
|
|
840
841
|
opt.next = opt.callback;
|
|
841
842
|
opt.$callback = function(err, user) {
|
|
@@ -874,7 +875,7 @@ function middleware(ctrl) {
|
|
|
874
875
|
|
|
875
876
|
function prepare(ctrl) {
|
|
876
877
|
|
|
877
|
-
ctrl.ondata2 = () =>
|
|
878
|
+
ctrl.ondata2 = () => ctrl.ondata();
|
|
878
879
|
|
|
879
880
|
var compress = (F.config.$wscompress && ctrl.headers['sec-websocket-extensions'] || '').indexOf('permessage-deflate') !== -1;
|
|
880
881
|
var header = ctrl.route.protocols && ctrl.route.protocols.length ? (compress ? SOCKET_RESPONSE_PROTOCOL_COMPRESS : SOCKET_RESPONSE_PROTOCOL).format(ctrl.sign(ctrl), ctrl.route.protocols.join(', ')) : (compress ? SOCKET_RESPONSE_COMPRESS : SOCKET_RESPONSE).format(ctrl.sign(ctrl));
|
|
@@ -960,8 +961,8 @@ function execute(ctrl) {
|
|
|
960
961
|
ctrl.params[param.name] = value;
|
|
961
962
|
}
|
|
962
963
|
|
|
963
|
-
if (F.def.
|
|
964
|
-
ctrl.language = F.def.
|
|
964
|
+
if (F.def.onLocalize)
|
|
965
|
+
ctrl.language = F.def.onLocalize(ctrl);
|
|
965
966
|
|
|
966
967
|
if (ctrl.route.flags.binary)
|
|
967
968
|
ctrl.datatype = 'binary';
|
package/workers.js
CHANGED
|
@@ -49,7 +49,7 @@ function process_thread() {
|
|
|
49
49
|
exports.createthread = function(name, data) {
|
|
50
50
|
if (!name)
|
|
51
51
|
return process_thread();
|
|
52
|
-
var filename = name === '~' ? name.substring(1) : F.path.root('workers/' + name + '.js');
|
|
52
|
+
var filename = name[0] === '~' ? name.substring(1) : F.path.root('workers/' + name + '.js');
|
|
53
53
|
var worker = new F.Worker.Worker(filename, { workerData: data, cwd: HEADER, argv: ['--worker'] });
|
|
54
54
|
worker.kill = worker.exit = () => worker.terminate();
|
|
55
55
|
return worker;
|
|
@@ -60,7 +60,7 @@ exports.createfork = function(name) {
|
|
|
60
60
|
if (!name)
|
|
61
61
|
return process_thread();
|
|
62
62
|
|
|
63
|
-
var filename = name === '~' ? name.substring(1) : F.path.root('workers/' + name + '.js');
|
|
63
|
+
var filename = name[0] === '~' ? name.substring(1) : F.path.root('workers/' + name + '.js');
|
|
64
64
|
var fork = new F.Child.fork(filename, { cwd: HEADER, argv: ['--worker'] });
|
|
65
65
|
fork.postMessage = fork.send;
|
|
66
66
|
fork.terminate = () => fork.kill('SIGTERM');
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# Contributing to total.js framework
|
|
2
|
-
|
|
3
|
-
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
|
|
4
|
-
|
|
5
|
-
- Reporting a bug
|
|
6
|
-
- Discussing the current state of the code
|
|
7
|
-
- Submitting a fix
|
|
8
|
-
- Proposing new features
|
|
9
|
-
|
|
10
|
-
## We Develop with Github
|
|
11
|
-
|
|
12
|
-
We use github to host code, to track issues and feature requests, as well as accept pull requests.
|
|
13
|
-
|
|
14
|
-
## We Use [Github Flow](https://docs.github.com/en/get-started/quickstart/github-flow), So All Code Changes Happen Through Pull Requests
|
|
15
|
-
|
|
16
|
-
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://docs.github.com/en/get-started/quickstart/github-flow)). We actively welcome your pull requests:
|
|
17
|
-
|
|
18
|
-
1. Fork the repo and create your branch from `master`.
|
|
19
|
-
2. If you've added code that should be tested, add tests.
|
|
20
|
-
3. If you've changed APIs, update the documentation.
|
|
21
|
-
4. Ensure the test suite passes.
|
|
22
|
-
5. Make sure your code lints.
|
|
23
|
-
6. Issue that pull request!
|
|
24
|
-
|
|
25
|
-
## Any contributions you make will be under the MIT Software License
|
|
26
|
-
|
|
27
|
-
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
|
|
28
|
-
|
|
29
|
-
## Report bugs using Github's [issues](https://github.com/totaljs/framework5/issues)
|
|
30
|
-
|
|
31
|
-
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/totaljs/framework4/issues); it's that easy!
|
|
32
|
-
|
|
33
|
-
## Write bug reports with detail, background, and sample code
|
|
34
|
-
|
|
35
|
-
**Great Bug Reports** tend to have:
|
|
36
|
-
|
|
37
|
-
- A quick summary and/or background
|
|
38
|
-
- Steps to reproduce - be specific!
|
|
39
|
-
- What you expected would happen
|
|
40
|
-
- What actually happens
|
|
41
|
-
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
|
|
42
|
-
|
|
43
|
-
People *love* thorough bug reports. I'm not even kidding.
|
|
44
|
-
|
|
45
|
-
## Use a Consistent Coding Style
|
|
46
|
-
|
|
47
|
-
We use coding styel as described here (https://docs.totaljs.com/welcome/67b47001ty51c/)
|
|
48
|
-
|
|
49
|
-
## License
|
|
50
|
-
|
|
51
|
-
By contributing, you agree that your contributions will be licensed under its MIT License.
|
|
52
|
-
|
|
53
|
-
## References
|
|
54
|
-
|
|
55
|
-
This document was adapted from (https://gist.github.com/briandk/3d2e8b3ec8daf5a27a62)
|
package/helpers/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// ===================================================
|
|
2
|
-
// Total.js v5 start script
|
|
3
|
-
// https://www.totaljs.com
|
|
4
|
-
// ===================================================
|
|
5
|
-
|
|
6
|
-
require('total5');
|
|
7
|
-
|
|
8
|
-
const options = {};
|
|
9
|
-
|
|
10
|
-
// options.ip = '127.0.0.1';
|
|
11
|
-
// options.port = parseInt(process.argv[2]);
|
|
12
|
-
// options.unixsocket = PATH.join(F.tmpdir, 'app_name.socket');
|
|
13
|
-
// options.unixsocket777 = true;
|
|
14
|
-
// options.config = { name: 'Total.js' };
|
|
15
|
-
// options.sleep = 3000;
|
|
16
|
-
// options.inspector = 9229;
|
|
17
|
-
// options.watch = ['private'];
|
|
18
|
-
// options.livereload = 'https://yourhostname';
|
|
19
|
-
// options.watcher = true; // enables watcher for the release mode only controlled by the app `F.restart()`
|
|
20
|
-
// options.edit = 'wss://www.yourcodeinstance.com/?id=projectname'
|
|
21
|
-
options.release = process.argv.includes('--release');
|
|
22
|
-
|
|
23
|
-
// Service mode:
|
|
24
|
-
options.servicemode = process.argv.includes('--service') || process.argv.includes('--servicemode');
|
|
25
|
-
// options.servicemode = 'definitions,modules,config';
|
|
26
|
-
|
|
27
|
-
// Cluster:
|
|
28
|
-
// options.tz = 'utc';
|
|
29
|
-
// options.cluster = 'auto';
|
|
30
|
-
// options.limit = 10; // max 10. threads (works only with "auto" scaling)
|
|
31
|
-
|
|
32
|
-
F.run(options);
|
package/templates.json
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"empty": {
|
|
3
|
-
"id": "emptyproject",
|
|
4
|
-
"name": "Empty",
|
|
5
|
-
"total": 4,
|
|
6
|
-
"description": "Empty project without any special setup"
|
|
7
|
-
},
|
|
8
|
-
"typescript": {
|
|
9
|
-
"id": "emptyproject-typescript",
|
|
10
|
-
"name": "Typescript",
|
|
11
|
-
"total": 4,
|
|
12
|
-
"description": "Total.js with typescript"
|
|
13
|
-
},
|
|
14
|
-
"website": {
|
|
15
|
-
"id": "emptyproject-website",
|
|
16
|
-
"name": "Website",
|
|
17
|
-
"total": 4,
|
|
18
|
-
"description": "Website example"
|
|
19
|
-
},
|
|
20
|
-
"postgres": {
|
|
21
|
-
"id": "emptyproject-postgresql",
|
|
22
|
-
"name": "Postgres template",
|
|
23
|
-
"total": 4,
|
|
24
|
-
"description": "Empty project ready to be used with PostgreSQL"
|
|
25
|
-
},
|
|
26
|
-
"app-builder": {
|
|
27
|
-
"id": "emptyproject-builder",
|
|
28
|
-
"name": "App Builder",
|
|
29
|
-
"total": 4,
|
|
30
|
-
"description": "Tool for creating Total.js server-side applications"
|
|
31
|
-
},
|
|
32
|
-
"empty-spa": {
|
|
33
|
-
"id": "emptyproject-emptyspa",
|
|
34
|
-
"name": "Empty SPA",
|
|
35
|
-
"total": 4,
|
|
36
|
-
"description": "Empty single page application project"
|
|
37
|
-
},
|
|
38
|
-
"spa": {
|
|
39
|
-
"id": "emptyproject-spa",
|
|
40
|
-
"name": "SPA",
|
|
41
|
-
"total": 4,
|
|
42
|
-
"description": "Single page application template"
|
|
43
|
-
},
|
|
44
|
-
"pwa": {
|
|
45
|
-
"id": "emptyproject-emptyspa",
|
|
46
|
-
"name": "PWA",
|
|
47
|
-
"total": 4,
|
|
48
|
-
"description": "Progressive web application template"
|
|
49
|
-
},
|
|
50
|
-
"flow": {
|
|
51
|
-
"id": "emptyproject-flow",
|
|
52
|
-
"name": "Flow",
|
|
53
|
-
"total": 4,
|
|
54
|
-
"description": "Visual programming interface for IoT"
|
|
55
|
-
},
|
|
56
|
-
"flowstream": {
|
|
57
|
-
"id": "flowstream",
|
|
58
|
-
"name": "FlowStream",
|
|
59
|
-
"total": 4,
|
|
60
|
-
"description": "Total.js FlowStream"
|
|
61
|
-
},
|
|
62
|
-
"tms": {
|
|
63
|
-
"id": "tms",
|
|
64
|
-
"name": "TMS",
|
|
65
|
-
"total": 4,
|
|
66
|
-
"description": "Total.js Message Service integrator"
|
|
67
|
-
},
|
|
68
|
-
"cms": {
|
|
69
|
-
"id": "cmsbundle",
|
|
70
|
-
"name": "CMS",
|
|
71
|
-
"total": 4,
|
|
72
|
-
"description": "Total.js CMS"
|
|
73
|
-
}
|
|
74
|
-
}
|
package/todo.txt
DELETED
package/tools/beta.sh
DELETED