alchemymvc 1.3.21 → 1.4.0-alpha.1
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/LICENSE +1 -1
- package/README.md +3 -3
- package/lib/app/behaviour/publishable_behaviour.js +5 -5
- package/lib/app/behaviour/revision_behaviour.js +10 -10
- package/lib/app/behaviour/sluggable_behaviour.js +14 -14
- package/lib/app/conduit/electron_conduit.js +9 -9
- package/lib/app/conduit/http_conduit.js +13 -13
- package/lib/app/conduit/loopback_conduit.js +15 -15
- package/lib/app/conduit/socket_conduit.js +43 -43
- package/lib/app/config/routes.js +26 -0
- package/lib/app/controller/00-default_app_controller.js +21 -0
- package/lib/app/controller/alchemy_info_controller.js +12 -12
- package/lib/app/datasource/mongo_datasource.js +16 -16
- package/lib/app/element/00-default_app_element.js +19 -0
- package/lib/app/element/time_ago.js +5 -5
- package/lib/app/helper/00-default_app_helper.js +11 -0
- package/lib/app/helper/alchemy_helper.js +22 -22
- package/lib/app/helper/backed_map.js +1 -1
- package/lib/app/helper/breadcrumb.js +10 -10
- package/lib/app/helper/client_collection.js +3 -3
- package/lib/app/helper/cron.js +29 -29
- package/lib/app/helper/enum_values.js +6 -6
- package/lib/app/helper/pagination_helper.js +36 -36
- package/lib/app/helper/router_helper.js +35 -35
- package/lib/app/helper/socket_helper.js +57 -57
- package/lib/app/helper/syncable.js +84 -59
- package/lib/app/helper_component/paginate_component.js +9 -9
- package/lib/app/helper_controller/component.js +1 -1
- package/lib/app/helper_controller/conduit.js +31 -31
- package/lib/app/helper_controller/controller.js +54 -39
- package/lib/app/helper_datasource/00-nosql_datasource.js +624 -70
- package/lib/app/helper_datasource/05-fallback_datasource.js +10 -10
- package/lib/app/helper_datasource/idb_datasource.js +6 -6
- package/lib/app/helper_datasource/indexed_db.js +22 -22
- package/lib/app/helper_datasource/remote_datasource.js +5 -5
- package/lib/app/helper_error/http_error.js +4 -4
- package/lib/app/helper_error/model_error.js +2 -2
- package/lib/app/helper_error/validation_error.js +12 -12
- package/lib/app/helper_field/00-objectid_field.js +7 -7
- package/lib/app/helper_field/05-string_field.js +16 -12
- package/lib/app/helper_field/06-text_field.js +2 -4
- package/lib/app/helper_field/10-number_field.js +9 -12
- package/lib/app/helper_field/11-date_field.js +15 -15
- package/lib/app/helper_field/15-local_temporal_field.js +10 -10
- package/lib/app/helper_field/20-decimal_field.js +8 -9
- package/lib/app/helper_field/belongsto_field.js +1 -1
- package/lib/app/helper_field/big_int_field.js +8 -8
- package/lib/app/helper_field/boolean_field.js +9 -11
- package/lib/app/helper_field/datetime_field.js +3 -3
- package/lib/app/helper_field/enum_field.js +13 -8
- package/lib/app/helper_field/fixed_decimal_field.js +6 -7
- package/lib/app/helper_field/geopoint_field.js +9 -10
- package/lib/app/helper_field/habtm_field.js +3 -3
- package/lib/app/helper_field/hasoneparent_field.js +1 -1
- package/lib/app/helper_field/html_field.js +2 -4
- package/lib/app/helper_field/integer_field.js +8 -11
- package/lib/app/helper_field/local_date_field.js +5 -5
- package/lib/app/helper_field/local_date_time_field.js +5 -5
- package/lib/app/helper_field/local_time_field.js +5 -5
- package/lib/app/helper_field/mixed_field.js +5 -5
- package/lib/app/helper_field/object_field.js +8 -8
- package/lib/app/helper_field/password_field.js +3 -3
- package/lib/app/helper_field/regexp_field.js +7 -9
- package/lib/app/helper_field/schema_field.js +91 -88
- package/lib/app/helper_field/settings_field.js +92 -0
- package/lib/app/helper_field/time_field.js +6 -6
- package/lib/app/helper_field/url_field.js +2 -4
- package/lib/app/helper_model/00-base_criteria.js +662 -0
- package/lib/app/helper_model/05-criteria_expressions.js +605 -0
- package/lib/app/helper_model/10-model_criteria.js +1182 -0
- package/lib/app/helper_model/data_provider.js +2 -2
- package/lib/app/helper_model/document.js +103 -92
- package/lib/app/helper_model/document_list.js +14 -14
- package/lib/app/helper_model/field_config.js +11 -11
- package/lib/app/helper_model/field_set.js +17 -17
- package/lib/app/helper_model/model.js +203 -124
- package/lib/app/helper_model/remote_data_provider.js +2 -2
- package/lib/app/helper_validator/00_validator.js +16 -16
- package/lib/app/helper_validator/not_empty_validator.js +9 -9
- package/lib/app/model/00-default_app_model.js +18 -0
- package/lib/app/model/05-system_model.js +27 -0
- package/lib/app/model/{alchemy_migration_model.js → system_migration_model.js} +4 -4
- package/lib/app/model/system_setting_model.js +154 -0
- package/lib/app/model/{alchemy_task_history_model.js → system_task_history_model.js} +7 -7
- package/lib/app/model/{alchemy_task_model.js → system_task_model.js} +11 -11
- package/lib/bootstrap.js +22 -312
- package/lib/class/accumulator.js +5 -5
- package/lib/class/behaviour.js +5 -5
- package/lib/class/component.js +3 -3
- package/lib/class/conduit.js +203 -163
- package/lib/class/controller.js +42 -42
- package/lib/class/datasource.js +74 -79
- package/lib/class/document.js +74 -95
- package/lib/class/document_list.js +5 -5
- package/lib/class/element.js +17 -17
- package/lib/class/error.js +3 -3
- package/lib/class/field.js +169 -91
- package/lib/class/field_value.js +6 -6
- package/lib/class/helper.js +3 -3
- package/lib/class/inode.js +17 -17
- package/lib/class/inode_dir.js +12 -12
- package/lib/class/inode_file.js +50 -25
- package/lib/class/inode_list.js +4 -4
- package/lib/class/migration.js +4 -4
- package/lib/class/model.js +182 -168
- package/lib/class/path_definition.js +22 -22
- package/lib/class/path_evaluator.js +5 -5
- package/lib/class/path_param_definition.js +7 -7
- package/lib/class/plugin.js +312 -0
- package/lib/class/postponement.js +29 -29
- package/lib/class/reciprocal.js +8 -8
- package/lib/class/route.js +33 -33
- package/lib/class/router.js +73 -73
- package/lib/class/schema.js +21 -21
- package/lib/class/schema_client.js +73 -67
- package/lib/class/session.js +63 -29
- package/lib/class/session_scene.js +4 -4
- package/lib/class/sitemap.js +16 -16
- package/lib/class/task.js +39 -39
- package/lib/class/task_service.js +43 -47
- package/lib/{init → core}/alchemy.js +413 -374
- package/lib/{init/functions.js → core/alchemy_functions.js} +171 -108
- package/lib/core/alchemy_load_functions.js +715 -0
- package/lib/core/base.js +50 -62
- package/lib/core/client_alchemy.js +144 -152
- package/lib/core/client_base.js +39 -52
- package/lib/core/discovery.js +16 -18
- package/lib/core/middleware.js +54 -43
- package/lib/core/{routing.js → prefix.js} +14 -16
- package/lib/core/setting.js +1684 -0
- package/lib/core/stage.js +758 -0
- package/lib/scripts/create_constants.js +119 -0
- package/lib/{init/languages.js → scripts/create_languages.js} +5 -5
- package/lib/scripts/create_settings.js +449 -0
- package/lib/scripts/create_shared_constants.js +95 -0
- package/lib/scripts/create_stages.js +55 -0
- package/lib/scripts/init_alchemy.js +51 -0
- package/lib/{init/requirements.js → scripts/preload_modules.js} +15 -2
- package/lib/scripts/setup_devwatch.js +238 -0
- package/lib/stages/00-load_core.js +342 -0
- package/lib/stages/05-load_app.js +57 -0
- package/lib/stages/10-datasource.js +61 -0
- package/lib/stages/15-tasks.js +27 -0
- package/lib/stages/20-settings.js +68 -0
- package/lib/stages/50-routes.js +218 -0
- package/lib/stages/90-server.js +347 -0
- package/package.json +5 -7
- package/lib/app/helper_model/criteria.js +0 -2294
- package/lib/app/helper_model/db_query.js +0 -1488
- package/lib/app/routes.js +0 -11
- package/lib/core/socket.js +0 -171
- package/lib/init/constants.js +0 -158
- package/lib/init/devwatch.js +0 -238
- package/lib/init/load_functions.js +0 -973
- package/lib/stages.js +0 -513
package/lib/class/controller.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @constructor
|
|
5
5
|
*
|
|
6
|
-
* @author Jelle De Loecker
|
|
6
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
7
7
|
* @since 0.0.1
|
|
8
8
|
* @version 1.0.6
|
|
9
9
|
*/
|
|
@@ -21,14 +21,14 @@ global.Controller = Function.inherits('Alchemy.Base', 'Alchemy.Controller', func
|
|
|
21
21
|
/**
|
|
22
22
|
* Object where components are stored
|
|
23
23
|
*
|
|
24
|
-
* @type
|
|
24
|
+
* @type {Object}
|
|
25
25
|
*/
|
|
26
26
|
Controller.prepareProperty('components', Object);
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Alias to the Renderer instance
|
|
30
30
|
*
|
|
31
|
-
* @type
|
|
31
|
+
* @type {Hawkejs.Renderer}
|
|
32
32
|
*/
|
|
33
33
|
Controller.setProperty(function renderer() {
|
|
34
34
|
return this.conduit.renderer;
|
|
@@ -37,7 +37,7 @@ Controller.setProperty(function renderer() {
|
|
|
37
37
|
/**
|
|
38
38
|
* Alias to the Renderer instance
|
|
39
39
|
*
|
|
40
|
-
* @type
|
|
40
|
+
* @type {Hawkejs.Renderer}
|
|
41
41
|
*/
|
|
42
42
|
Controller.setProperty(function view_render() {
|
|
43
43
|
return this.conduit.renderer;
|
|
@@ -46,7 +46,7 @@ Controller.setProperty(function view_render() {
|
|
|
46
46
|
/**
|
|
47
47
|
* Add actions from the parent on every constitution
|
|
48
48
|
*
|
|
49
|
-
* @author Jelle De Loecker
|
|
49
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
50
50
|
* @since 1.0.0
|
|
51
51
|
* @version 1.0.0
|
|
52
52
|
*/
|
|
@@ -64,7 +64,7 @@ Controller.constitute(function addActions() {
|
|
|
64
64
|
/**
|
|
65
65
|
* Add an action
|
|
66
66
|
*
|
|
67
|
-
* @author Jelle De Loecker
|
|
67
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
68
68
|
* @since 1.0.0
|
|
69
69
|
* @version 1.0.0
|
|
70
70
|
*/
|
|
@@ -93,7 +93,7 @@ Controller.setStatic(function setAction(name, fnc) {
|
|
|
93
93
|
* End the current request with a 202 status
|
|
94
94
|
* and tell the client to look at another url later
|
|
95
95
|
*
|
|
96
|
-
* @author Jelle De Loecker
|
|
96
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
97
97
|
* @since 1.1.0
|
|
98
98
|
* @version 1.1.0
|
|
99
99
|
*/
|
|
@@ -104,7 +104,7 @@ Controller.setMethod(function postpone() {
|
|
|
104
104
|
/**
|
|
105
105
|
* Enable a component
|
|
106
106
|
*
|
|
107
|
-
* @author Jelle De Loecker
|
|
107
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
108
108
|
* @since 0.2.0
|
|
109
109
|
* @version 1.0.0
|
|
110
110
|
*/
|
|
@@ -122,11 +122,11 @@ Controller.setMethod(function addComponent(name, options) {
|
|
|
122
122
|
/**
|
|
123
123
|
* Render the given template as a segment
|
|
124
124
|
*
|
|
125
|
-
* @author Jelle De Loecker
|
|
125
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
126
126
|
* @since 0.5.0
|
|
127
127
|
* @version 1.1.5
|
|
128
128
|
*
|
|
129
|
-
* @param
|
|
129
|
+
* @param {Array} template
|
|
130
130
|
*/
|
|
131
131
|
Controller.setMethod(function renderSegment(template) {
|
|
132
132
|
|
|
@@ -168,12 +168,12 @@ Controller.setMethod(function renderSegment(template) {
|
|
|
168
168
|
/**
|
|
169
169
|
* Render the given template as a dialog with the given action
|
|
170
170
|
*
|
|
171
|
-
* @author Jelle De Loecker
|
|
171
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
172
172
|
* @since 0.4.1
|
|
173
173
|
* @version 0.4.1
|
|
174
174
|
*
|
|
175
|
-
* @param
|
|
176
|
-
* @param
|
|
175
|
+
* @param {Mixed} config
|
|
176
|
+
* @param {Array} template
|
|
177
177
|
*/
|
|
178
178
|
Controller.setMethod(function renderDialogIn(config, template) {
|
|
179
179
|
|
|
@@ -225,14 +225,14 @@ Controller.setMethod(function renderDialogIn(config, template) {
|
|
|
225
225
|
/**
|
|
226
226
|
* Render the given template and send it to the client
|
|
227
227
|
*
|
|
228
|
-
* @author Jelle De Loecker
|
|
228
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
229
229
|
* @since 0.2.0
|
|
230
230
|
* @version 1.3.1
|
|
231
231
|
*
|
|
232
|
-
* @param
|
|
233
|
-
* @param
|
|
232
|
+
* @param {number} status
|
|
233
|
+
* @param {Array} template
|
|
234
234
|
*
|
|
235
|
-
* @return
|
|
235
|
+
* @return {Pledge}
|
|
236
236
|
*/
|
|
237
237
|
Controller.setMethod(function render(status, template) {
|
|
238
238
|
|
|
@@ -263,14 +263,14 @@ Controller.setMethod(function render(status, template) {
|
|
|
263
263
|
/**
|
|
264
264
|
* Render the given template
|
|
265
265
|
*
|
|
266
|
-
* @author Jelle De Loecker
|
|
266
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
267
267
|
* @since 0.2.0
|
|
268
268
|
* @version 0.2.0
|
|
269
269
|
*
|
|
270
|
-
* @param
|
|
271
|
-
* @param
|
|
270
|
+
* @param {number} status
|
|
271
|
+
* @param {Array} template
|
|
272
272
|
*
|
|
273
|
-
* @return
|
|
273
|
+
* @return {Pledge}
|
|
274
274
|
*/
|
|
275
275
|
Controller.setMethod(function renderHTML(status, template) {
|
|
276
276
|
|
|
@@ -311,11 +311,11 @@ Controller.setMethod(function renderHTML(status, template) {
|
|
|
311
311
|
/**
|
|
312
312
|
* Deny access
|
|
313
313
|
*
|
|
314
|
-
* @author Jelle De Loecker
|
|
314
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
315
315
|
* @since 0.2.0
|
|
316
316
|
* @version 0.2.0
|
|
317
317
|
*
|
|
318
|
-
* @param {
|
|
318
|
+
* @param {number} status
|
|
319
319
|
* @param {Error} message optional error to send
|
|
320
320
|
*/
|
|
321
321
|
Controller.setMethod(function deny(status, message) {
|
|
@@ -325,11 +325,11 @@ Controller.setMethod(function deny(status, message) {
|
|
|
325
325
|
/**
|
|
326
326
|
* Set/get a cookie
|
|
327
327
|
*
|
|
328
|
-
* @author Jelle De Loecker
|
|
328
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
329
329
|
* @since 0.2.0
|
|
330
330
|
* @version 0.2.0
|
|
331
331
|
*
|
|
332
|
-
* @param {
|
|
332
|
+
* @param {string} name
|
|
333
333
|
* @param {Mixed} value
|
|
334
334
|
* @param {Object} options
|
|
335
335
|
*
|
|
@@ -347,11 +347,11 @@ Controller.setMethod(function cookie(name, value, options) {
|
|
|
347
347
|
/**
|
|
348
348
|
* Set/get a session value
|
|
349
349
|
*
|
|
350
|
-
* @author Jelle De Loecker
|
|
350
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
351
351
|
* @since 0.2.0
|
|
352
352
|
* @version 0.2.0
|
|
353
353
|
*
|
|
354
|
-
* @param {
|
|
354
|
+
* @param {string} name
|
|
355
355
|
* @param {Mixed} value
|
|
356
356
|
*
|
|
357
357
|
* @return {Mixed}
|
|
@@ -372,11 +372,11 @@ Controller.setMethod(function session(name, value) {
|
|
|
372
372
|
/**
|
|
373
373
|
* Get a parameter from the route, post or get query
|
|
374
374
|
*
|
|
375
|
-
* @author Jelle De Loecker
|
|
375
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
376
376
|
* @since 0.2.0
|
|
377
377
|
* @version 0.2.0
|
|
378
378
|
*
|
|
379
|
-
* @param {
|
|
379
|
+
* @param {string} name
|
|
380
380
|
*/
|
|
381
381
|
Controller.setMethod(function param(name) {
|
|
382
382
|
return this.conduit.param(name);
|
|
@@ -385,11 +385,11 @@ Controller.setMethod(function param(name) {
|
|
|
385
385
|
/**
|
|
386
386
|
* Get a parameter from the route
|
|
387
387
|
*
|
|
388
|
-
* @author Jelle De Loecker
|
|
388
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
389
389
|
* @since 0.2.0
|
|
390
390
|
* @version 0.2.0
|
|
391
391
|
*
|
|
392
|
-
* @param {
|
|
392
|
+
* @param {string} name
|
|
393
393
|
*/
|
|
394
394
|
Controller.setMethod(function routeParam(name) {
|
|
395
395
|
return this.conduit.params[name];
|
|
@@ -398,11 +398,11 @@ Controller.setMethod(function routeParam(name) {
|
|
|
398
398
|
/**
|
|
399
399
|
* Update data
|
|
400
400
|
*
|
|
401
|
-
* @author Jelle De Loecker
|
|
401
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
402
402
|
* @since 0.2.0
|
|
403
403
|
* @version 0.2.0
|
|
404
404
|
*
|
|
405
|
-
* @param {
|
|
405
|
+
* @param {string} name
|
|
406
406
|
* @param {Mixed} value
|
|
407
407
|
*/
|
|
408
408
|
Controller.setMethod(function update(name, value) {
|
|
@@ -412,7 +412,7 @@ Controller.setMethod(function update(name, value) {
|
|
|
412
412
|
/**
|
|
413
413
|
* Add the readDatasource action
|
|
414
414
|
*
|
|
415
|
-
* @author Jelle De Loecker
|
|
415
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
416
416
|
* @since 1.0.0
|
|
417
417
|
* @version 1.2.6
|
|
418
418
|
*/
|
|
@@ -443,7 +443,7 @@ Controller.setAction(async function readDatasource(conduit) {
|
|
|
443
443
|
return conduit.error(new Error('Controller#readDatasource() requires a valid Criteria instance but none was found'));
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
if (!Criteria.isCriteria(criteria)) {
|
|
446
|
+
if (!Classes.Alchemy.Criteria.Criteria.isCriteria(criteria)) {
|
|
447
447
|
return conduit.error(new Error('Controller#readDatasource requires a valid Criteria instance, but an invalid one was given'));
|
|
448
448
|
}
|
|
449
449
|
|
|
@@ -471,7 +471,7 @@ Controller.setAction(async function readDatasource(conduit) {
|
|
|
471
471
|
/**
|
|
472
472
|
* Add the saveRecord action
|
|
473
473
|
*
|
|
474
|
-
* @author Jelle De Loecker
|
|
474
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
475
475
|
* @since 1.0.4
|
|
476
476
|
* @version 1.3.1
|
|
477
477
|
*/
|
|
@@ -527,13 +527,13 @@ Controller.setAction(async function saveRecord(conduit) {
|
|
|
527
527
|
/**
|
|
528
528
|
* Return a controller instance
|
|
529
529
|
*
|
|
530
|
-
* @author Jelle De Loecker
|
|
530
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
531
531
|
* @since 0.0.1
|
|
532
532
|
* @version 1.1.0
|
|
533
533
|
*
|
|
534
|
-
* @param
|
|
534
|
+
* @param {string} controller_name The plural name of the controller
|
|
535
535
|
*
|
|
536
|
-
* @return
|
|
536
|
+
* @return {Controller}
|
|
537
537
|
*/
|
|
538
538
|
Controller.get = function get(controller_name, conduit) {
|
|
539
539
|
|
|
@@ -585,9 +585,9 @@ Controller.get = function get(controller_name, conduit) {
|
|
|
585
585
|
* @constructor
|
|
586
586
|
* @extends Alchemy.Controller
|
|
587
587
|
*
|
|
588
|
-
* @author
|
|
589
|
-
* @since
|
|
590
|
-
* @version
|
|
588
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
589
|
+
* @since 0.0.1
|
|
590
|
+
* @version 1.0.0
|
|
591
591
|
*/
|
|
592
592
|
var Api = Function.inherits('Alchemy.Controller', function Api(conduit, options) {
|
|
593
593
|
Api.super.call(this, conduit, options);
|