alchemymvc 1.3.20 → 1.3.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/lib/app/helper/alchemy_helper.js +8 -4
- package/lib/app/helper_controller/controller.js +1 -0
- package/lib/app/helper_field/big_int_field.js +2 -2
- package/lib/app/helper_field/mixed_field.js +73 -0
- package/lib/app/helper_field/schema_field.js +110 -35
- package/lib/app/helper_model/criteria.js +13 -0
- package/lib/app/helper_model/document.js +229 -0
- package/lib/app/helper_model/model.js +67 -8
- package/lib/class/conduit.js +2 -2
- package/lib/class/document.js +27 -0
- package/lib/class/field.js +110 -0
- package/lib/class/model.js +47 -12
- package/lib/class/route.js +4 -1
- package/lib/class/router.js +4 -2
- package/lib/class/schema_client.js +163 -20
- package/lib/class/task.js +48 -2
- package/lib/class/task_service.js +5 -1
- package/lib/core/client_alchemy.js +77 -1
- package/lib/core/middleware.js +27 -7
- package/lib/init/alchemy.js +4 -1
- package/package.json +3 -3
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @author Jelle De Loecker <jelle@develry.be>
|
|
7
7
|
* @since 0.1.0
|
|
8
|
-
* @version 1.3.
|
|
8
|
+
* @version 1.3.21
|
|
9
9
|
*/
|
|
10
10
|
var Alchemy = Function.inherits('Alchemy.Client.Base', function Alchemy() {
|
|
11
11
|
|
|
@@ -24,6 +24,9 @@ var Alchemy = Function.inherits('Alchemy.Client.Base', function Alchemy() {
|
|
|
24
24
|
this.sent_subscriptions = [];
|
|
25
25
|
|
|
26
26
|
this.distinct_problems = new Map();
|
|
27
|
+
|
|
28
|
+
// Custom handlers
|
|
29
|
+
this.custom_handlers = new Map();
|
|
27
30
|
});
|
|
28
31
|
|
|
29
32
|
/**
|
|
@@ -196,6 +199,79 @@ Alchemy.setMethod(function distinctProblem(id, message, options = {}) {
|
|
|
196
199
|
return entry;
|
|
197
200
|
});
|
|
198
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Register a custom handler
|
|
204
|
+
*
|
|
205
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
206
|
+
* @since 1.3.21
|
|
207
|
+
* @version 1.3.21
|
|
208
|
+
*
|
|
209
|
+
* @param {string|symbol} type
|
|
210
|
+
* @param {Function} callback
|
|
211
|
+
* @param {Number} weight
|
|
212
|
+
*/
|
|
213
|
+
Alchemy.setMethod(function registerCustomHandler(type, callback, weight) {
|
|
214
|
+
|
|
215
|
+
if (typeof callback != 'function') {
|
|
216
|
+
throw new Error('Custom handler needs to be a function');
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
let handlers = this.custom_handlers.get(type);
|
|
220
|
+
|
|
221
|
+
if (!handlers) {
|
|
222
|
+
handlers = new Deck();
|
|
223
|
+
this.custom_handlers.set(type, handlers);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (weight == null) {
|
|
227
|
+
weight = 10;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
handlers.push(callback, weight);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Get the highest priority custom handler of the given type
|
|
235
|
+
*
|
|
236
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
237
|
+
* @since 1.3.21
|
|
238
|
+
* @version 1.3.21
|
|
239
|
+
*
|
|
240
|
+
* @param {string|symbol} type
|
|
241
|
+
*
|
|
242
|
+
* @return {Function}
|
|
243
|
+
*/
|
|
244
|
+
Alchemy.setMethod(function getCustomHandler(type) {
|
|
245
|
+
|
|
246
|
+
let handlers = this.custom_handlers.get(type);
|
|
247
|
+
|
|
248
|
+
if (handlers) {
|
|
249
|
+
return handlers.first();
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Get all the custom handlers of the given type
|
|
255
|
+
*
|
|
256
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
257
|
+
* @since 1.3.21
|
|
258
|
+
* @version 1.3.21
|
|
259
|
+
*
|
|
260
|
+
* @param {string|symbol} type
|
|
261
|
+
*
|
|
262
|
+
* @return {Function[]}
|
|
263
|
+
*/
|
|
264
|
+
Alchemy.setMethod(function getAllCustomHandlers(type) {
|
|
265
|
+
|
|
266
|
+
let handlers = this.custom_handlers.get(type);
|
|
267
|
+
|
|
268
|
+
if (handlers) {
|
|
269
|
+
return [...handlers];
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return [];
|
|
273
|
+
});
|
|
274
|
+
|
|
199
275
|
/**
|
|
200
276
|
* Actually print a log message
|
|
201
277
|
*
|
package/lib/core/middleware.js
CHANGED
|
@@ -426,13 +426,29 @@ Alchemy.setMethod(function minifyScript(path, options, callback) {
|
|
|
426
426
|
|
|
427
427
|
let minify_options = {
|
|
428
428
|
compress: {
|
|
429
|
-
|
|
430
|
-
|
|
429
|
+
// Keep all function arguments
|
|
430
|
+
keep_fargs : true,
|
|
431
|
+
|
|
432
|
+
// Keep function names
|
|
433
|
+
keep_fnames : true,
|
|
434
|
+
|
|
435
|
+
// Keep classnames
|
|
431
436
|
keep_classnames : true,
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
437
|
+
|
|
438
|
+
// Do not hoist function declarations
|
|
439
|
+
hoist_funs : false,
|
|
440
|
+
|
|
441
|
+
// Only drop console calls when not debugging
|
|
442
|
+
drop_console : !alchemy.settings.debug,
|
|
443
|
+
|
|
444
|
+
// Remove dead code
|
|
445
|
+
dead_code : true,
|
|
446
|
+
|
|
447
|
+
// Remove symbol names
|
|
448
|
+
unsafe_symbols : true,
|
|
449
|
+
|
|
450
|
+
// Provide it some info on global definitions
|
|
451
|
+
global_defs : {
|
|
436
452
|
'__BLAST_IS_NODE' : false,
|
|
437
453
|
'__BLAST_IS_BROWSER' : true
|
|
438
454
|
}
|
|
@@ -440,7 +456,11 @@ Alchemy.setMethod(function minifyScript(path, options, callback) {
|
|
|
440
456
|
mangle: {
|
|
441
457
|
keep_fnames : true,
|
|
442
458
|
keep_classnames : true,
|
|
443
|
-
}
|
|
459
|
+
},
|
|
460
|
+
output: {
|
|
461
|
+
// Do not wrap functions that are arguments in parenthesis
|
|
462
|
+
wrap_func_args : false,
|
|
463
|
+
},
|
|
444
464
|
};
|
|
445
465
|
|
|
446
466
|
if (alchemy.settings.debug && alchemy.settings.source_map) {
|
package/lib/init/alchemy.js
CHANGED
|
@@ -19,7 +19,7 @@ var shared_objects = {},
|
|
|
19
19
|
*
|
|
20
20
|
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
21
21
|
* @since 0.0.1
|
|
22
|
-
* @version 1.3.
|
|
22
|
+
* @version 1.3.21
|
|
23
23
|
*/
|
|
24
24
|
global.Alchemy = Function.inherits('Informer', 'Alchemy', function Alchemy() {
|
|
25
25
|
|
|
@@ -105,6 +105,9 @@ global.Alchemy = Function.inherits('Informer', 'Alchemy', function Alchemy() {
|
|
|
105
105
|
// Distinct problems
|
|
106
106
|
this.distinct_problems = new Map();
|
|
107
107
|
|
|
108
|
+
// Custom handlers
|
|
109
|
+
this.custom_handlers = new Map();
|
|
110
|
+
|
|
108
111
|
// Load the settings
|
|
109
112
|
this.loadSettings();
|
|
110
113
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alchemymvc",
|
|
3
3
|
"description": "MVC framework for Node.js",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.21",
|
|
5
5
|
"author": "Jelle De Loecker <jelle@elevenways.be>",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"alchemy",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"chokidar" : "~3.5.3",
|
|
23
23
|
"formidable" : "~3.5.1",
|
|
24
24
|
"graceful-fs" : "~4.2.11",
|
|
25
|
-
"hawkejs" : "~2.3.
|
|
25
|
+
"hawkejs" : "~2.3.15",
|
|
26
26
|
"jsondiffpatch" : "~0.5.0",
|
|
27
27
|
"mime" : "~3.0.0",
|
|
28
28
|
"minimist" : "~1.2.5",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"mongodb" : "~6.1.0",
|
|
32
32
|
"ncp" : "~2.0.0",
|
|
33
33
|
"postcss" : "~8.4.31",
|
|
34
|
-
"protoblast" : "~0.8.
|
|
34
|
+
"protoblast" : "~0.8.15",
|
|
35
35
|
"semver" : "~7.5.4",
|
|
36
36
|
"socket.io" : "~4.7.2",
|
|
37
37
|
"@11ways/socket.io-stream" : "~0.9.2",
|