alchemymvc 1.3.22 → 1.3.23

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.
Files changed (91) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +0 -0
  3. package/index.js +0 -0
  4. package/lib/app/assets/scripts/.gitkeep +0 -0
  5. package/lib/app/assets/stylesheets/alchemy-info.less +0 -0
  6. package/lib/app/behaviour/publishable_behaviour.js +0 -0
  7. package/lib/app/behaviour/revision_behaviour.js +0 -0
  8. package/lib/app/bootstrap.js +0 -0
  9. package/lib/app/component/.gitkeep +0 -0
  10. package/lib/app/conduit/electron_conduit.js +0 -0
  11. package/lib/app/conduit/http_conduit.js +0 -0
  12. package/lib/app/helper/backed_map.js +0 -0
  13. package/lib/app/helper/breadcrumb.js +0 -0
  14. package/lib/app/helper/client_collection.js +0 -0
  15. package/lib/app/helper/enum_values.js +0 -0
  16. package/lib/app/helper/pagination_helper.js +0 -0
  17. package/lib/app/helper_component/paginate_component.js +0 -0
  18. package/lib/app/helper_controller/component.js +0 -0
  19. package/lib/app/helper_controller/conduit.js +0 -0
  20. package/lib/app/helper_controller/controller.js +0 -0
  21. package/lib/app/helper_datasource/05-fallback_datasource.js +0 -0
  22. package/lib/app/helper_datasource/idb_datasource.js +0 -0
  23. package/lib/app/helper_datasource/indexed_db.js +0 -0
  24. package/lib/app/helper_datasource/remote_datasource.js +0 -0
  25. package/lib/app/helper_error/http_error.js +0 -0
  26. package/lib/app/helper_error/model_error.js +0 -0
  27. package/lib/app/helper_error/validation_error.js +0 -0
  28. package/lib/app/helper_field/00-objectid_field.js +0 -0
  29. package/lib/app/helper_field/05-string_field.js +0 -0
  30. package/lib/app/helper_field/06-text_field.js +0 -0
  31. package/lib/app/helper_field/10-number_field.js +0 -0
  32. package/lib/app/helper_field/belongsto_field.js +0 -0
  33. package/lib/app/helper_field/boolean_field.js +0 -0
  34. package/lib/app/helper_field/datetime_field.js +0 -0
  35. package/lib/app/helper_field/enum_field.js +0 -0
  36. package/lib/app/helper_field/geopoint_field.js +0 -0
  37. package/lib/app/helper_field/habtm_field.js +0 -0
  38. package/lib/app/helper_field/hasoneparent_field.js +0 -0
  39. package/lib/app/helper_field/html_field.js +0 -0
  40. package/lib/app/helper_field/integer_field.js +0 -0
  41. package/lib/app/helper_field/object_field.js +0 -0
  42. package/lib/app/helper_field/password_field.js +0 -0
  43. package/lib/app/helper_field/regexp_field.js +0 -0
  44. package/lib/app/helper_field/time_field.js +0 -0
  45. package/lib/app/helper_field/url_field.js +0 -0
  46. package/lib/app/helper_model/criteria.js +0 -0
  47. package/lib/app/helper_model/db_query.js +0 -0
  48. package/lib/app/helper_model/document_list.js +0 -0
  49. package/lib/app/helper_model/field_config.js +0 -0
  50. package/lib/app/helper_validator/00_validator.js +0 -0
  51. package/lib/app/helper_validator/not_empty_validator.js +0 -0
  52. package/lib/app/model/alchemy_migration_model.js +0 -0
  53. package/lib/app/root/alchemy-logo.png +0 -0
  54. package/lib/app/root/favicon.ico +0 -0
  55. package/lib/app/view/alchemy/info.hwk +0 -0
  56. package/lib/app/view/error/403.ejs +0 -0
  57. package/lib/app/view/error/404.ejs +0 -0
  58. package/lib/app/view/error/unknown.ejs +0 -0
  59. package/lib/app/view/paginate/navlist.ejs +0 -0
  60. package/lib/class/accumulator.js +0 -0
  61. package/lib/class/behaviour.js +0 -0
  62. package/lib/class/component.js +0 -0
  63. package/lib/class/conduit.js +40 -7
  64. package/lib/class/controller.js +0 -0
  65. package/lib/class/document.js +0 -0
  66. package/lib/class/document_list.js +0 -0
  67. package/lib/class/element.js +0 -0
  68. package/lib/class/error.js +0 -0
  69. package/lib/class/field.js +0 -0
  70. package/lib/class/field_value.js +0 -0
  71. package/lib/class/helper.js +0 -0
  72. package/lib/class/inode.js +0 -0
  73. package/lib/class/inode_dir.js +0 -0
  74. package/lib/class/inode_list.js +0 -0
  75. package/lib/class/migration.js +0 -0
  76. package/lib/class/path_definition.js +0 -0
  77. package/lib/class/path_evaluator.js +0 -0
  78. package/lib/class/postponement.js +14 -4
  79. package/lib/class/reciprocal.js +0 -0
  80. package/lib/class/schema.js +0 -0
  81. package/lib/class/session_scene.js +0 -0
  82. package/lib/class/sitemap.js +0 -0
  83. package/lib/core/client_base.js +0 -0
  84. package/lib/core/discovery.js +0 -0
  85. package/lib/core/routing.js +0 -0
  86. package/lib/core/socket.js +0 -0
  87. package/lib/init/devwatch.js +0 -0
  88. package/lib/init/languages.js +0 -0
  89. package/lib/init/load_functions.js +0 -0
  90. package/lib/stages.js +0 -0
  91. package/package.json +3 -3
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
File without changes
package/index.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,6 @@
1
1
  const FILECACHE = alchemy.getCache('served_files'),
2
- RX_TEXT = /svg|xml|javascript|text/i;
2
+ RX_TEXT = /svg|xml|javascript|text/i,
3
+ ENDING = Symbol('ending');
3
4
 
4
5
  var libstream = alchemy.use('stream'),
5
6
  libpath = alchemy.use('path'),
@@ -16,7 +17,7 @@ var libstream = alchemy.use('stream'),
16
17
  *
17
18
  * @author Jelle De Loecker <jelle@develry.be>
18
19
  * @since 0.2.0
19
- * @version 1.2.0
20
+ * @version 1.3.23
20
21
  *
21
22
  * @param {IncomingMessage} req
22
23
  * @param {ServerResponse} res
@@ -54,6 +55,9 @@ var Conduit = Function.inherits('Alchemy.Base', 'Alchemy.Conduit', function Cond
54
55
  // Where the files will go
55
56
  this.files = {};
56
57
 
58
+ // Are we in the process of ending?
59
+ this[ENDING] = false;
60
+
57
61
  this.initValues();
58
62
  this.setReqRes(req, res);
59
63
  });
@@ -1456,13 +1460,18 @@ Conduit.setMethod(function setResponseUrl(new_url) {
1456
1460
  *
1457
1461
  * @author Jelle De Loecker <jelle@elevenways.be>
1458
1462
  * @since 0.2.0
1459
- * @version 1.3.17
1463
+ * @version 1.3.23
1460
1464
  *
1461
1465
  * @param {Number} status 3xx redirection codes. 302 (temporary redirect) by default
1462
1466
  * @param {String|Object} options Options or url
1463
1467
  */
1464
1468
  Conduit.setMethod(function redirect(status, options) {
1465
1469
 
1470
+ if (this.ended) {
1471
+ console.warn('Conduit#redirect() called after response has already ended', this);
1472
+ return;
1473
+ }
1474
+
1466
1475
  let hard_refresh = false,
1467
1476
  url;
1468
1477
 
@@ -1578,7 +1587,7 @@ Conduit.setMethod(function redirect(status, options) {
1578
1587
  *
1579
1588
  * @author Jelle De Loecker <jelle@elevenways.be>
1580
1589
  * @since 0.2.0
1581
- * @version 1.3.21
1590
+ * @version 1.3.23
1582
1591
  *
1583
1592
  * @param {Nulber} status Response statuscode
1584
1593
  * @param {Error} message Optional error to send
@@ -1586,6 +1595,11 @@ Conduit.setMethod(function redirect(status, options) {
1586
1595
  */
1587
1596
  Conduit.setMethod(function error(status, message, print_error) {
1588
1597
 
1598
+ if (this.ended) {
1599
+ console.warn('Conduit#error() called after response has already ended', this);
1600
+ return;
1601
+ }
1602
+
1589
1603
  let print_dev = false;
1590
1604
 
1591
1605
  if (status instanceof Classes.Alchemy.Error.HTTP) {
@@ -1783,7 +1797,7 @@ Conduit.setMethod(function notModified() {
1783
1797
  *
1784
1798
  * @author Jelle De Loecker <jelle@elevenways.be>
1785
1799
  * @since 0.2.0
1786
- * @version 1.3.0
1800
+ * @version 1.3.23
1787
1801
  *
1788
1802
  * @param {String|Object} message
1789
1803
  */
@@ -1796,6 +1810,13 @@ Conduit.setMethod(function end(message) {
1796
1810
  etag,
1797
1811
  temp;
1798
1812
 
1813
+ if (this[ENDING]) {
1814
+ console.warn('Conduit#end() called after conduit has already ended', this);
1815
+ return false;
1816
+ }
1817
+
1818
+ this[ENDING] = true;
1819
+
1799
1820
  if (this.websocket) {
1800
1821
  throw new Error('You can not end a websocket, use the callback instead');
1801
1822
  }
@@ -1887,10 +1908,16 @@ Conduit.setMethod(function end(message) {
1887
1908
  *
1888
1909
  * @author Jelle De Loecker <jelle@elevenways.be>
1889
1910
  * @since 1.3.22
1890
- * @version 1.3.22
1911
+ * @version 1.3.23
1891
1912
  */
1892
1913
  Conduit.setMethod(function _endWithStream(stream) {
1893
1914
 
1915
+ if (this.ended) {
1916
+ console.warn('Conduit#_endWithStream() called after conduit has already ended', this);
1917
+ return false;
1918
+ }
1919
+
1920
+ this[ENDING] = true;
1894
1921
  this.ended = new Date();
1895
1922
  this.emit('ending');
1896
1923
 
@@ -1904,10 +1931,16 @@ Conduit.setMethod(function _endWithStream(stream) {
1904
1931
  *
1905
1932
  * @author Jelle De Loecker <jelle@elevenways.be>
1906
1933
  * @since 0.2.0
1907
- * @version 1.3.22
1934
+ * @version 1.3.23
1908
1935
  */
1909
1936
  Conduit.setMethod(function _end(message, encoding = 'utf-8') {
1910
1937
 
1938
+ if (this.ended) {
1939
+ console.warn('Conduit#_end() called after conduit has already ended', this);
1940
+ return false;
1941
+ }
1942
+
1943
+ this[ENDING] = true;
1911
1944
  this.ended = new Date();
1912
1945
 
1913
1946
  this.emit('ending');
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -293,9 +293,9 @@ Postponement.setMethod(function handleRequest(conduit) {
293
293
  *
294
294
  * @author Jelle De Loecker <jelle@elevenways.be>
295
295
  * @since 1.3.1
296
- * @version 1.3.2
296
+ * @version 1.3.23
297
297
  *
298
- * @return {Boolean} True if the request is being resumed
298
+ * @return {Boolean} True if the request can be resumed
299
299
  */
300
300
  Postponement.setMethod(function attemptUnlock() {
301
301
 
@@ -307,11 +307,21 @@ Postponement.setMethod(function attemptUnlock() {
307
307
 
308
308
  Postponement.scheduleQueueCheck();
309
309
 
310
- if (this.position_in_queue > 5) {
310
+ let max_position = alchemy.settings.postpone_max_unlock_position ?? 5;
311
+
312
+ if (this.position_in_queue > max_position) {
313
+ return false;
314
+ }
315
+
316
+ let max_event_loop_lag = alchemy.settings.postpone_max_unlock_event_loop_lag ?? 100;
317
+
318
+ if (alchemy.lagInMs() > max_event_loop_lag) {
311
319
  return false;
312
320
  }
313
321
 
314
- if (alchemy.lagInMs() > 100) {
322
+ let max_system_load = alchemy.settings.postpone_max_unlock_system_load ?? 110;
323
+
324
+ if (alchemy.systemLoad() > max_system_load) {
315
325
  return false;
316
326
  }
317
327
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/lib/stages.js CHANGED
File without changes
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.22",
4
+ "version": "1.3.23",
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.15",
25
+ "hawkejs" : "~2.3.19",
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.15",
34
+ "protoblast" : "~0.8.19",
35
35
  "semver" : "~7.5.4",
36
36
  "socket.io" : "~4.7.2",
37
37
  "@11ways/socket.io-stream" : "~0.9.2",