alchemymvc 1.2.4 → 1.2.6

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/socket_conduit.js +620 -620
  12. package/lib/app/controller/alchemy_info_controller.js +0 -0
  13. package/lib/app/datasource/mongo_datasource.js +0 -0
  14. package/lib/app/helper/client_collection.js +0 -0
  15. package/lib/app/helper/pagination_helper.js +0 -0
  16. package/lib/app/helper/router_helper.js +135 -3
  17. package/lib/app/helper/socket_helper.js +613 -613
  18. package/lib/app/helper_component/paginate_component.js +3 -1
  19. package/lib/app/helper_controller/component.js +0 -0
  20. package/lib/app/helper_controller/conduit.js +20 -0
  21. package/lib/app/helper_controller/controller.js +0 -0
  22. package/lib/app/helper_datasource/00-nosql_datasource.js +0 -0
  23. package/lib/app/helper_datasource/05-fallback_datasource.js +0 -0
  24. package/lib/app/helper_datasource/idb_datasource.js +0 -0
  25. package/lib/app/helper_datasource/indexed_db.js +0 -0
  26. package/lib/app/helper_field/00-objectid_field.js +0 -0
  27. package/lib/app/helper_field/06-text_field.js +0 -0
  28. package/lib/app/helper_field/10-number_field.js +0 -0
  29. package/lib/app/helper_field/boolean_field.js +0 -0
  30. package/lib/app/helper_field/date_field.js +0 -0
  31. package/lib/app/helper_field/datetime_field.js +0 -0
  32. package/lib/app/helper_field/enum_field.js +0 -0
  33. package/lib/app/helper_field/geopoint_field.js +0 -0
  34. package/lib/app/helper_field/habtm_field.js +0 -0
  35. package/lib/app/helper_field/hasoneparent_field.js +0 -0
  36. package/lib/app/helper_field/html_field.js +0 -0
  37. package/lib/app/helper_field/integer_field.js +0 -0
  38. package/lib/app/helper_field/object_field.js +0 -0
  39. package/lib/app/helper_field/regexp_field.js +0 -0
  40. package/lib/app/helper_field/schema_field.js +23 -2
  41. package/lib/app/helper_field/time_field.js +0 -0
  42. package/lib/app/helper_field/url_field.js +0 -0
  43. package/lib/app/helper_model/criteria.js +26 -1
  44. package/lib/app/helper_model/db_query.js +0 -0
  45. package/lib/app/helper_model/document.js +20 -12
  46. package/lib/app/helper_model/document_list.js +0 -0
  47. package/lib/app/helper_model/field_config.js +25 -12
  48. package/lib/app/helper_model/field_set.js +22 -1
  49. package/lib/app/helper_model/model.js +22 -10
  50. package/lib/app/model/alchemy_task_model.js +0 -0
  51. package/lib/app/routes.js +0 -0
  52. package/lib/app/view/alchemy/info.ejs +0 -0
  53. package/lib/app/view/error/unknown.ejs +0 -0
  54. package/lib/app/view/paginate/navlist.ejs +0 -0
  55. package/lib/bootstrap.js +0 -0
  56. package/lib/class/behaviour.js +0 -0
  57. package/lib/class/component.js +0 -0
  58. package/lib/class/conduit.js +2555 -2474
  59. package/lib/class/controller.js +4 -1
  60. package/lib/class/document_list.js +0 -0
  61. package/lib/class/element.js +2 -11
  62. package/lib/class/field.js +7 -1
  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 +112 -112
  67. package/lib/class/inode_list.js +0 -0
  68. package/lib/class/model.js +1772 -1761
  69. package/lib/class/path_definition.js +0 -0
  70. package/lib/class/route.js +92 -61
  71. package/lib/class/router.js +80 -3
  72. package/lib/class/schema_client.js +7 -2
  73. package/lib/class/session.js +0 -0
  74. package/lib/class/task.js +0 -0
  75. package/lib/core/base.js +50 -9
  76. package/lib/core/client_alchemy.js +48 -43
  77. package/lib/core/discovery.js +0 -0
  78. package/lib/core/middleware.js +72 -7
  79. package/lib/core/routing.js +0 -0
  80. package/lib/core/socket.js +159 -159
  81. package/lib/init/alchemy.js +1823 -1823
  82. package/lib/init/constants.js +0 -0
  83. package/lib/init/functions.js +8 -4
  84. package/lib/init/load_functions.js +0 -0
  85. package/lib/init/requirements.js +101 -101
  86. package/package.json +74 -73
@@ -407,7 +407,7 @@ Controller.setMethod(function update(name, value) {
407
407
  *
408
408
  * @author Jelle De Loecker <jelle@develry.be>
409
409
  * @since 1.0.0
410
- * @version 1.1.0
410
+ * @version 1.2.6
411
411
  */
412
412
  Controller.setAction(async function readDatasource(conduit) {
413
413
 
@@ -449,6 +449,9 @@ Controller.setAction(async function readDatasource(conduit) {
449
449
  }
450
450
 
451
451
  model.removePrivateFields(items);
452
+
453
+ // @TODO: Is this still necesary?
454
+ // When would the records need translation so late?
452
455
  model.translateItems(items, criteria, Function.thrower);
453
456
 
454
457
  conduit.end({
File without changes
@@ -21,21 +21,12 @@ Function.getNamespace('Alchemy.Element').setStatic('default_element_prefix', 'al
21
21
  *
22
22
  * @author Jelle De Loecker <jelle@elevenways.be>
23
23
  * @since 1.1.3
24
- * @version 1.2.1
24
+ * @version 1.2.5
25
25
  *
26
26
  * @return {RURL}
27
27
  */
28
28
  Element.setMethod(function getCurrentUrl() {
29
- if (Blast.isBrowser) {
30
-
31
- if (hawkejs.scene.opening_url && hawkejs.scene.opening_url.url) {
32
- return Blast.Classes.RURL.parse(hawkejs.scene.opening_url.url);
33
- }
34
-
35
- return Blast.Classes.RURL.parse(window.location);
36
- } else if (this.hawkejs_renderer && this.hawkejs_renderer.variables && this.hawkejs_renderer.variables.__url) {
37
- return this.hawkejs_renderer.variables.__url.clone();
38
- }
29
+ return this.hawkejs_renderer?.helpers?.Router?.current_url;
39
30
  });
40
31
 
41
32
  /**
@@ -1049,7 +1049,7 @@ Field.setMethod(function getRules() {
1049
1049
  *
1050
1050
  * @author Jelle De Loecker <jelle@develry.be>
1051
1051
  * @since 1.1.4
1052
- * @version 1.1.4
1052
+ * @version 1.2.5
1053
1053
  */
1054
1054
  Field.setMethod(function translateRecord(prefixes, record, allow_empty) {
1055
1055
 
@@ -1058,4 +1058,10 @@ Field.setMethod(function translateRecord(prefixes, record, allow_empty) {
1058
1058
  // Use the final result, if we found something or not
1059
1059
  record[this.name] = found.result;
1060
1060
  record['_prefix_' + this.name] = found.prefix;
1061
+
1062
+ if (!record.$translated_fields) {
1063
+ record.$translated_fields = {};
1064
+ }
1065
+
1066
+ record.$translated_fields[this.name] = found.prefix;
1061
1067
  });
File without changes
File without changes
File without changes
@@ -1,113 +1,113 @@
1
- const fs = alchemy.use('fs');
2
-
3
- /**
4
- * The File class
5
- *
6
- * @constructor
7
- *
8
- * @author Jelle De Loecker <jelle@elevenways.be>
9
- * @since 1.1.0
10
- * @version 1.1.0
11
- *
12
- * @param {String} path Path to the file
13
- */
14
- var File = Function.inherits('Alchemy.Inode', function File(path) {
15
-
16
- if (typeof path == 'object') {
17
- return File.from(path);
18
- }
19
-
20
- this.type = null;
21
- this.hash = null;
22
-
23
- File.super.call(this, path);
24
- });
25
-
26
- /**
27
- * Files are obviously files
28
- *
29
- * @author Jelle De Loecker <jelle@develry.be>
30
- * @since 1.1.0
31
- * @version 1.1.0
32
- *
33
- * @type {Boolean}
34
- */
35
- File.setProperty('is_file', true);
36
-
37
- /**
38
- * Create a File instance from the given variable
39
- *
40
- * @author Jelle De Loecker <jelle@develry.be>
41
- * @since 1.1.0
42
- * @version 1.2.0
43
- */
44
- File.setStatic(function from(obj) {
45
-
46
- let path;
47
-
48
- if (typeof obj == 'string') {
49
- path = obj;
50
- obj = null;
51
- } else {
52
- path = obj.path;
53
- }
54
-
55
- let file = new File(path);
56
-
57
- if (obj) {
58
- file.stat = {
59
- size : obj.size
60
- };
61
-
62
- file.name = obj.name;
63
- file.type = obj.type;
64
- file.hash = obj.hash;
65
- }
66
-
67
- return file;
68
- });
69
-
70
- /**
71
- * Read and return the contents
72
- *
73
- * @author Jelle De Loecker <jelle@develry.be>
74
- * @since 1.1.0
75
- * @version 1.1.8
76
- */
77
- File.setMethod(function read(options) {
78
-
79
- let pledge = new Pledge();
80
-
81
- if (!options) {
82
- options = {flag: 'r'};
83
- } else if (!options.flag) {
84
- options.flag = 'r';
85
- }
86
-
87
- fs.readFile(this.path, options, function done(err, data) {
88
-
89
- if (err) {
90
- return pledge.reject(err);
91
- }
92
-
93
- pledge.resolve(data);
94
- });
95
-
96
- return pledge;
97
- });
98
-
99
- /**
100
- * Read and return the contents as a string
101
- *
102
- * @author Jelle De Loecker <jelle@develry.be>
103
- * @since 1.1.0
104
- * @version 1.1.0
105
- */
106
- File.setMethod(function readString(encoding) {
107
-
108
- if (!encoding) {
109
- encoding = 'utf8';
110
- }
111
-
112
- return this.read({encoding: encoding});
1
+ const fs = alchemy.use('fs');
2
+
3
+ /**
4
+ * The File class
5
+ *
6
+ * @constructor
7
+ *
8
+ * @author Jelle De Loecker <jelle@elevenways.be>
9
+ * @since 1.1.0
10
+ * @version 1.1.0
11
+ *
12
+ * @param {String} path Path to the file
13
+ */
14
+ var File = Function.inherits('Alchemy.Inode', function File(path) {
15
+
16
+ if (typeof path == 'object') {
17
+ return File.from(path);
18
+ }
19
+
20
+ this.type = null;
21
+ this.hash = null;
22
+
23
+ File.super.call(this, path);
24
+ });
25
+
26
+ /**
27
+ * Files are obviously files
28
+ *
29
+ * @author Jelle De Loecker <jelle@develry.be>
30
+ * @since 1.1.0
31
+ * @version 1.1.0
32
+ *
33
+ * @type {Boolean}
34
+ */
35
+ File.setProperty('is_file', true);
36
+
37
+ /**
38
+ * Create a File instance from the given variable
39
+ *
40
+ * @author Jelle De Loecker <jelle@develry.be>
41
+ * @since 1.1.0
42
+ * @version 1.2.0
43
+ */
44
+ File.setStatic(function from(obj) {
45
+
46
+ let path;
47
+
48
+ if (typeof obj == 'string') {
49
+ path = obj;
50
+ obj = null;
51
+ } else {
52
+ path = obj.path;
53
+ }
54
+
55
+ let file = new File(path);
56
+
57
+ if (obj) {
58
+ file.stat = {
59
+ size : obj.size
60
+ };
61
+
62
+ file.name = obj.name;
63
+ file.type = obj.type;
64
+ file.hash = obj.hash;
65
+ }
66
+
67
+ return file;
68
+ });
69
+
70
+ /**
71
+ * Read and return the contents
72
+ *
73
+ * @author Jelle De Loecker <jelle@develry.be>
74
+ * @since 1.1.0
75
+ * @version 1.1.8
76
+ */
77
+ File.setMethod(function read(options) {
78
+
79
+ let pledge = new Pledge();
80
+
81
+ if (!options) {
82
+ options = {flag: 'r'};
83
+ } else if (!options.flag) {
84
+ options.flag = 'r';
85
+ }
86
+
87
+ fs.readFile(this.path, options, function done(err, data) {
88
+
89
+ if (err) {
90
+ return pledge.reject(err);
91
+ }
92
+
93
+ pledge.resolve(data);
94
+ });
95
+
96
+ return pledge;
97
+ });
98
+
99
+ /**
100
+ * Read and return the contents as a string
101
+ *
102
+ * @author Jelle De Loecker <jelle@develry.be>
103
+ * @since 1.1.0
104
+ * @version 1.1.0
105
+ */
106
+ File.setMethod(function readString(encoding) {
107
+
108
+ if (!encoding) {
109
+ encoding = 'utf8';
110
+ }
111
+
112
+ return this.read({encoding: encoding});
113
113
  });
File without changes