alchemymvc 1.2.5 → 1.2.7

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 (86) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +0 -0
  3. package/lib/app/assets/scripts/.gitkeep +0 -0
  4. package/lib/app/assets/stylesheets/alchemy-info.less +0 -0
  5. package/lib/app/behaviour/publishable_behaviour.js +0 -0
  6. package/lib/app/behaviour/revision_behaviour.js +0 -0
  7. package/lib/app/behaviour/sluggable_behaviour.js +0 -0
  8. package/lib/app/component/.gitkeep +0 -0
  9. package/lib/app/conduit/electron_conduit.js +0 -0
  10. package/lib/app/conduit/http_conduit.js +173 -173
  11. package/lib/app/conduit/loopback_conduit.js +2 -3
  12. package/lib/app/conduit/socket_conduit.js +620 -620
  13. package/lib/app/controller/alchemy_info_controller.js +0 -0
  14. package/lib/app/datasource/mongo_datasource.js +0 -0
  15. package/lib/app/element/time_ago.js +2 -4
  16. package/lib/app/helper/alchemy_helper.js +22 -11
  17. package/lib/app/helper/client_collection.js +0 -0
  18. package/lib/app/helper/pagination_helper.js +0 -0
  19. package/lib/app/helper/router_helper.js +20 -7
  20. package/lib/app/helper/socket_helper.js +613 -613
  21. package/lib/app/helper_component/paginate_component.js +0 -0
  22. package/lib/app/helper_controller/component.js +0 -0
  23. package/lib/app/helper_controller/conduit.js +0 -0
  24. package/lib/app/helper_controller/controller.js +0 -0
  25. package/lib/app/helper_datasource/00-nosql_datasource.js +0 -0
  26. package/lib/app/helper_datasource/05-fallback_datasource.js +0 -0
  27. package/lib/app/helper_datasource/idb_datasource.js +0 -0
  28. package/lib/app/helper_datasource/indexed_db.js +0 -0
  29. package/lib/app/helper_field/00-objectid_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/boolean_field.js +0 -0
  33. package/lib/app/helper_field/date_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/regexp_field.js +0 -0
  43. package/lib/app/helper_field/schema_field.js +23 -2
  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 +21 -3
  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 +2 -2
  50. package/lib/app/helper_model/model.js +72 -5
  51. package/lib/app/model/alchemy_task_model.js +0 -0
  52. package/lib/app/routes.js +0 -0
  53. package/lib/app/view/alchemy/info.ejs +0 -0
  54. package/lib/app/view/error/unknown.ejs +0 -0
  55. package/lib/app/view/paginate/navlist.ejs +0 -0
  56. package/lib/bootstrap.js +0 -0
  57. package/lib/class/behaviour.js +0 -0
  58. package/lib/class/component.js +0 -0
  59. package/lib/class/conduit.js +2572 -2552
  60. package/lib/class/controller.js +4 -1
  61. package/lib/class/document.js +18 -4
  62. package/lib/class/document_list.js +0 -0
  63. package/lib/class/helper.js +0 -0
  64. package/lib/class/inode.js +0 -0
  65. package/lib/class/inode_dir.js +0 -0
  66. package/lib/class/inode_file.js +136 -112
  67. package/lib/class/inode_list.js +0 -0
  68. package/lib/class/model.js +1740 -1769
  69. package/lib/class/path_definition.js +0 -0
  70. package/lib/class/route.js +0 -0
  71. package/lib/class/router.js +6 -3
  72. package/lib/class/session.js +0 -0
  73. package/lib/class/task.js +0 -0
  74. package/lib/core/base.js +41 -18
  75. package/lib/core/client_alchemy.js +48 -2
  76. package/lib/core/discovery.js +0 -0
  77. package/lib/core/middleware.js +6 -4
  78. package/lib/core/routing.js +0 -0
  79. package/lib/core/socket.js +159 -159
  80. package/lib/init/alchemy.js +1848 -1823
  81. package/lib/init/constants.js +0 -0
  82. package/lib/init/functions.js +8 -4
  83. package/lib/init/load_functions.js +0 -0
  84. package/lib/init/requirements.js +101 -101
  85. package/lib/stages.js +10 -2
  86. package/package.json +74 -74
File without changes
@@ -1015,7 +1015,7 @@ Alchemy.setMethod(function request(url, options, callback) {
1015
1015
  *
1016
1016
  * @author Jelle De Loecker <jelle@develry.be>
1017
1017
  * @since 0.1.0
1018
- * @version 0.4.1
1018
+ * @version 1.2.6
1019
1019
  *
1020
1020
  * @param {String} url The url
1021
1021
  * @param {Object} options
@@ -1098,12 +1098,16 @@ Alchemy.setMethod(function downloadFile(url, options, callback) {
1098
1098
  }
1099
1099
  }
1100
1100
 
1101
+ if (output) {
1102
+ // Pipe the response stream into the file
1103
+ output.pipe(file);
1104
+ } else {
1105
+ file.end('');
1106
+ }
1107
+
1101
1108
  // @todo: maybe implement content-type for downloaded file, too?
1102
1109
  // Because webservers can lie about filetypes
1103
1110
 
1104
- // Pipe the response stream into the file
1105
- output.pipe(file);
1106
-
1107
1111
  // Close the file when finished and callback
1108
1112
  file.on('finish', function writeFinished() {
1109
1113
  callback(null, filepath, name);
File without changes
@@ -1,102 +1,102 @@
1
- 'use strict';
2
-
3
- /**
4
- * The basic http module, used to create the server.
5
- *
6
- * @link http://nodejs.org/api/http.html
7
- */
8
- alchemy.use('http', 'http');
9
-
10
- /**
11
- * This module contains utilities for handling and transforming file paths.
12
- * Almost all these methods perform only string transformations.
13
- * The file system is not consulted to check whether paths are valid.
14
- *
15
- * @link http://nodejs.org/api/path.html
16
- */
17
- alchemy.use('path', 'path');
18
-
19
- /**
20
- * File I/O is provided by simple wrappers around standard POSIX functions.
21
- *
22
- * @link http://nodejs.org/api/fs.html
23
- */
24
- alchemy.use('graceful-fs', 'fs');
25
-
26
- /**
27
- * Usefull utilities.
28
- *
29
- * @link http://nodejs.org/api/util.html
30
- */
31
- alchemy.use('util', 'util');
32
-
33
- /**
34
- * The native mongodb library
35
- *
36
- * @link https://npmjs.org/package/mongodb
37
- */
38
- alchemy.use('mongodb', 'mongodb');
39
-
40
- /**
41
- * The LESS interpreter.
42
- *
43
- * @link https://npmjs.org/package/less
44
- */
45
- alchemy.use('less', 'less');
46
-
47
- /**
48
- * Hawkejs view engine
49
- *
50
- * @link https://npmjs.org/package/hawkejs
51
- */
52
- alchemy.use('hawkejs', 'hawkejs');
53
- alchemy.hawkejs = Classes.Hawkejs.Hawkejs.getInstance();
54
-
55
- /**
56
- * The function to detect when everything is too busy
57
- */
58
- alchemy.toobusy = alchemy.use('toobusy-js', 'toobusy');
59
-
60
- // If the config is a number, use that as the lag threshold
61
- if (typeof alchemy.settings.toobusy === 'number') {
62
- alchemy.toobusy.maxLag(alchemy.settings.toobusy);
63
- }
64
-
65
- /**
66
- * Load Sputnik, the stage-based launcher
67
- */
68
- alchemy.sputnik = new (alchemy.use('sputnik', 'sputnik'))();
69
-
70
- /**
71
- * Real-time apps made cross-browser & easy with a WebSocket-like API.
72
- *
73
- * @link https://npmjs.org/package/socket.io
74
- */
75
- alchemy.use('socket.io', 'io');
76
-
77
- /**
78
- * Allow streams over a socket.io connection
79
- */
80
- alchemy.use('@11ways/socket.io-stream', 'socket.io-stream');
81
-
82
- /**
83
- * Recursively mkdir, like `mkdir -p`.
84
- * This is a requirement fetched from express
85
- *
86
- * @link https://npmjs.org/package/mkdirp
87
- */
88
- alchemy.use('mkdirp', 'mkdirp');
89
-
90
- /**
91
- * Base useragent library
92
- *
93
- * @link https://npmjs.org/package/useragent
94
- */
95
- alchemy.use('useragent');
96
-
97
- /**
98
- * Enable the `satisfies` method in the `useragent` library
99
- *
100
- * @link https://www.npmjs.com/package/useragent#adding-more-features-to-the-useragent
101
- */
1
+ 'use strict';
2
+
3
+ /**
4
+ * The basic http module, used to create the server.
5
+ *
6
+ * @link http://nodejs.org/api/http.html
7
+ */
8
+ alchemy.use('http', 'http');
9
+
10
+ /**
11
+ * This module contains utilities for handling and transforming file paths.
12
+ * Almost all these methods perform only string transformations.
13
+ * The file system is not consulted to check whether paths are valid.
14
+ *
15
+ * @link http://nodejs.org/api/path.html
16
+ */
17
+ alchemy.use('path', 'path');
18
+
19
+ /**
20
+ * File I/O is provided by simple wrappers around standard POSIX functions.
21
+ *
22
+ * @link http://nodejs.org/api/fs.html
23
+ */
24
+ alchemy.use('graceful-fs', 'fs');
25
+
26
+ /**
27
+ * Usefull utilities.
28
+ *
29
+ * @link http://nodejs.org/api/util.html
30
+ */
31
+ alchemy.use('util', 'util');
32
+
33
+ /**
34
+ * The native mongodb library
35
+ *
36
+ * @link https://npmjs.org/package/mongodb
37
+ */
38
+ alchemy.use('mongodb', 'mongodb');
39
+
40
+ /**
41
+ * The LESS interpreter.
42
+ *
43
+ * @link https://npmjs.org/package/less
44
+ */
45
+ alchemy.use('less', 'less');
46
+
47
+ /**
48
+ * Hawkejs view engine
49
+ *
50
+ * @link https://npmjs.org/package/hawkejs
51
+ */
52
+ alchemy.use('hawkejs', 'hawkejs');
53
+ alchemy.hawkejs = Classes.Hawkejs.Hawkejs.getInstance();
54
+
55
+ /**
56
+ * The function to detect when everything is too busy
57
+ */
58
+ alchemy.toobusy = alchemy.use('toobusy-js', 'toobusy');
59
+
60
+ // If the config is a number, use that as the lag threshold
61
+ if (typeof alchemy.settings.toobusy === 'number') {
62
+ alchemy.toobusy.maxLag(alchemy.settings.toobusy);
63
+ }
64
+
65
+ /**
66
+ * Load Sputnik, the stage-based launcher
67
+ */
68
+ alchemy.sputnik = new (alchemy.use('sputnik', 'sputnik'))();
69
+
70
+ /**
71
+ * Real-time apps made cross-browser & easy with a WebSocket-like API.
72
+ *
73
+ * @link https://npmjs.org/package/socket.io
74
+ */
75
+ alchemy.use('socket.io', 'io');
76
+
77
+ /**
78
+ * Allow streams over a socket.io connection
79
+ */
80
+ alchemy.use('@11ways/socket.io-stream', 'socket.io-stream');
81
+
82
+ /**
83
+ * Recursively mkdir, like `mkdir -p`.
84
+ * This is a requirement fetched from express
85
+ *
86
+ * @link https://npmjs.org/package/mkdirp
87
+ */
88
+ alchemy.use('mkdirp', 'mkdirp');
89
+
90
+ /**
91
+ * Base useragent library
92
+ *
93
+ * @link https://npmjs.org/package/useragent
94
+ */
95
+ alchemy.use('useragent');
96
+
97
+ /**
98
+ * Enable the `satisfies` method in the `useragent` library
99
+ *
100
+ * @link https://www.npmjs.com/package/useragent#adding-more-features-to-the-useragent
101
+ */
102
102
  require('useragent/features');
package/lib/stages.js CHANGED
@@ -120,11 +120,19 @@ alchemy.sputnik.add(function datasources() {
120
120
  *
121
121
  * @author Jelle De Loecker <jelle@develry.be>
122
122
  * @since 0.0.1
123
- * @version 1.1.0
123
+ * @version 1.2.7
124
124
  */
125
125
  alchemy.sputnik.add(function plugins() {
126
126
  // Load in the plugins
127
- alchemy.startPlugins();
127
+ try {
128
+ alchemy.startPlugins();
129
+ } catch (err) {
130
+ // Constitutors sometimes throw errors during this stage.
131
+ // Not sure yet why they don't get caught by sputnik
132
+ // @TODO: refactor!
133
+ log.error('Caught error during "plugins" stage:', err);
134
+ throw err;
135
+ }
128
136
  });
129
137
 
130
138
  /**
package/package.json CHANGED
@@ -1,75 +1,75 @@
1
- {
2
- "name": "alchemymvc",
3
- "description": "MVC framework for Node.js",
4
- "version": "1.2.5",
5
- "author": "Jelle De Loecker <jelle@elevenways.be>",
6
- "keywords": [
7
- "alchemy",
8
- "alchemymvc",
9
- "mvc"
10
- ],
11
- "repository": {
12
- "type" : "git",
13
- "url" : "git://github.com/11ways/alchemy.git"
14
- },
15
- "dependencies": {
16
- "ansi-256-colors" : "~1.1.0",
17
- "autoprefixer" : "~10.4.2",
18
- "bcrypt" : "~5.0.1",
19
- "body" : "~5.1.0",
20
- "body-parser" : "~1.19.2",
21
- "bson" : "~4.6.1",
22
- "chokidar" : "~3.5.3",
23
- "formidable" : "~1.2.2",
24
- "graceful-fs" : "~4.2.9",
25
- "hawkejs" : "~2.2.10",
26
- "jsondiffpatch" : "~0.4.1",
27
- "mime" : "~3.0.0",
28
- "minimist" : "~1.2.5",
29
- "mkdirp" : "~1.0.4",
30
- "mmmagic" : "~0.5.3",
31
- "mongodb" : "~3.6.6",
32
- "ncp" : "~2.0.0",
33
- "postcss" : "~8.4.6",
34
- "protoblast" : "~0.7.21",
35
- "semver" : "~7.3.5",
36
- "socket.io" : "~2.4.0",
37
- "@11ways/socket.io-stream" : "~0.9.2",
38
- "sputnik" : "~0.1.0",
39
- "terser" : "~5.10.0",
40
- "toobusy-js" : "~0.5.1",
41
- "useragent" : "~2.3.0"
42
- },
43
- "files": [
44
- "lib/",
45
- "index.js"
46
- ],
47
- "optionalDependencies": {
48
- "janeway" : "~0.3.5",
49
- "less" : "~4.1.1",
50
- "sass" : "~1.53.0",
51
- "sass-embedded" : "~1.53.0",
52
- "nodent-compiler" : "~3.2.13",
53
- "socket.io-client" : "~2.4.0"
54
- },
55
- "devDependencies": {
56
- "codecov" : "~3.8.1",
57
- "istanbul-lib-instrument" : "~4.0.3",
58
- "mocha" : "~8.3.2",
59
- "mongo-unit" : "~2.0.1",
60
- "nyc" : "^15.1.0",
61
- "puppeteer" : "~9.0.0",
62
- "source-map" : "~0.7.3"
63
- },
64
- "scripts": {
65
- "appveyor" : "mocha --exit --reporter spec --bail --timeout 20000 --file test/00-init.js",
66
- "coverage" : "nyc --reporter=text --reporter=lcov mocha --exit --timeout 200000 --bail --file test/00-init.js",
67
- "report-coverage" : "nyc report --reporter=lcov && cat ./coverage/lcov.info | codecov",
68
- "test" : "mocha --exit --reporter spec --bail --timeout 50000 --file test/00-init.js"
69
- },
70
- "main": "lib/bootstrap.js",
71
- "license": "MIT",
72
- "engines": {
73
- "node" : ">=14.0.0"
74
- }
1
+ {
2
+ "name": "alchemymvc",
3
+ "description": "MVC framework for Node.js",
4
+ "version": "1.2.7",
5
+ "author": "Jelle De Loecker <jelle@elevenways.be>",
6
+ "keywords": [
7
+ "alchemy",
8
+ "alchemymvc",
9
+ "mvc"
10
+ ],
11
+ "repository": {
12
+ "type" : "git",
13
+ "url" : "git://github.com/11ways/alchemy.git"
14
+ },
15
+ "dependencies": {
16
+ "ansi-256-colors" : "~1.1.0",
17
+ "autoprefixer" : "~10.4.2",
18
+ "bcrypt" : "~5.0.1",
19
+ "body" : "~5.1.0",
20
+ "body-parser" : "~1.19.2",
21
+ "bson" : "~4.6.1",
22
+ "chokidar" : "~3.5.3",
23
+ "formidable" : "~2.0.1",
24
+ "graceful-fs" : "~4.2.9",
25
+ "hawkejs" : "~2.2.18",
26
+ "jsondiffpatch" : "~0.4.1",
27
+ "mime" : "~3.0.0",
28
+ "minimist" : "~1.2.5",
29
+ "mkdirp" : "~1.0.4",
30
+ "mmmagic" : "~0.5.3",
31
+ "mongodb" : "~3.6.6",
32
+ "ncp" : "~2.0.0",
33
+ "postcss" : "~8.4.6",
34
+ "protoblast" : "~0.7.24",
35
+ "semver" : "~7.3.5",
36
+ "socket.io" : "~2.4.0",
37
+ "@11ways/socket.io-stream" : "~0.9.2",
38
+ "sputnik" : "~0.1.0",
39
+ "terser" : "~5.10.0",
40
+ "toobusy-js" : "~0.5.1",
41
+ "useragent" : "~2.3.0"
42
+ },
43
+ "files": [
44
+ "lib/",
45
+ "index.js"
46
+ ],
47
+ "optionalDependencies": {
48
+ "janeway" : "~0.3.6",
49
+ "less" : "~4.1.1",
50
+ "sass" : "~1.53.0",
51
+ "sass-embedded" : "~1.53.0",
52
+ "nodent-compiler" : "~3.2.13",
53
+ "socket.io-client" : "~2.4.0"
54
+ },
55
+ "devDependencies": {
56
+ "codecov" : "~3.8.1",
57
+ "istanbul-lib-instrument" : "~4.0.3",
58
+ "mocha" : "~8.3.2",
59
+ "mongo-unit" : "~2.0.1",
60
+ "nyc" : "^15.1.0",
61
+ "puppeteer" : "~9.0.0",
62
+ "source-map" : "~0.7.3"
63
+ },
64
+ "scripts": {
65
+ "appveyor" : "mocha --exit --reporter spec --bail --timeout 20000 --file test/00-init.js",
66
+ "coverage" : "nyc --reporter=text --reporter=lcov mocha --exit --timeout 200000 --bail --file test/00-init.js",
67
+ "report-coverage" : "nyc report --reporter=lcov && cat ./coverage/lcov.info | codecov",
68
+ "test" : "mocha --exit --reporter spec --bail --timeout 50000 --file test/00-init.js"
69
+ },
70
+ "main": "lib/bootstrap.js",
71
+ "license": "MIT",
72
+ "engines": {
73
+ "node" : ">=14.0.0"
74
+ }
75
75
  }