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.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/lib/app/assets/scripts/.gitkeep +0 -0
- package/lib/app/assets/stylesheets/alchemy-info.less +0 -0
- package/lib/app/behaviour/publishable_behaviour.js +0 -0
- package/lib/app/behaviour/revision_behaviour.js +0 -0
- package/lib/app/behaviour/sluggable_behaviour.js +0 -0
- package/lib/app/component/.gitkeep +0 -0
- package/lib/app/conduit/electron_conduit.js +0 -0
- package/lib/app/conduit/http_conduit.js +173 -173
- package/lib/app/conduit/loopback_conduit.js +2 -3
- package/lib/app/conduit/socket_conduit.js +620 -620
- package/lib/app/controller/alchemy_info_controller.js +0 -0
- package/lib/app/datasource/mongo_datasource.js +0 -0
- package/lib/app/element/time_ago.js +2 -4
- package/lib/app/helper/alchemy_helper.js +22 -11
- package/lib/app/helper/client_collection.js +0 -0
- package/lib/app/helper/pagination_helper.js +0 -0
- package/lib/app/helper/router_helper.js +20 -7
- package/lib/app/helper/socket_helper.js +613 -613
- package/lib/app/helper_component/paginate_component.js +0 -0
- package/lib/app/helper_controller/component.js +0 -0
- package/lib/app/helper_controller/conduit.js +0 -0
- package/lib/app/helper_controller/controller.js +0 -0
- package/lib/app/helper_datasource/00-nosql_datasource.js +0 -0
- package/lib/app/helper_datasource/05-fallback_datasource.js +0 -0
- package/lib/app/helper_datasource/idb_datasource.js +0 -0
- package/lib/app/helper_datasource/indexed_db.js +0 -0
- package/lib/app/helper_field/00-objectid_field.js +0 -0
- package/lib/app/helper_field/06-text_field.js +0 -0
- package/lib/app/helper_field/10-number_field.js +0 -0
- package/lib/app/helper_field/boolean_field.js +0 -0
- package/lib/app/helper_field/date_field.js +0 -0
- package/lib/app/helper_field/datetime_field.js +0 -0
- package/lib/app/helper_field/enum_field.js +0 -0
- package/lib/app/helper_field/geopoint_field.js +0 -0
- package/lib/app/helper_field/habtm_field.js +0 -0
- package/lib/app/helper_field/hasoneparent_field.js +0 -0
- package/lib/app/helper_field/html_field.js +0 -0
- package/lib/app/helper_field/integer_field.js +0 -0
- package/lib/app/helper_field/object_field.js +0 -0
- package/lib/app/helper_field/regexp_field.js +0 -0
- package/lib/app/helper_field/schema_field.js +23 -2
- package/lib/app/helper_field/time_field.js +0 -0
- package/lib/app/helper_field/url_field.js +0 -0
- package/lib/app/helper_model/criteria.js +21 -3
- package/lib/app/helper_model/db_query.js +0 -0
- package/lib/app/helper_model/document_list.js +0 -0
- package/lib/app/helper_model/field_config.js +2 -2
- package/lib/app/helper_model/model.js +72 -5
- package/lib/app/model/alchemy_task_model.js +0 -0
- package/lib/app/routes.js +0 -0
- package/lib/app/view/alchemy/info.ejs +0 -0
- package/lib/app/view/error/unknown.ejs +0 -0
- package/lib/app/view/paginate/navlist.ejs +0 -0
- package/lib/bootstrap.js +0 -0
- package/lib/class/behaviour.js +0 -0
- package/lib/class/component.js +0 -0
- package/lib/class/conduit.js +2572 -2552
- package/lib/class/controller.js +4 -1
- package/lib/class/document.js +18 -4
- package/lib/class/document_list.js +0 -0
- package/lib/class/helper.js +0 -0
- package/lib/class/inode.js +0 -0
- package/lib/class/inode_dir.js +0 -0
- package/lib/class/inode_file.js +136 -112
- package/lib/class/inode_list.js +0 -0
- package/lib/class/model.js +1740 -1769
- package/lib/class/path_definition.js +0 -0
- package/lib/class/route.js +0 -0
- package/lib/class/router.js +6 -3
- package/lib/class/session.js +0 -0
- package/lib/class/task.js +0 -0
- package/lib/core/base.js +41 -18
- package/lib/core/client_alchemy.js +48 -2
- package/lib/core/discovery.js +0 -0
- package/lib/core/middleware.js +6 -4
- package/lib/core/routing.js +0 -0
- package/lib/core/socket.js +159 -159
- package/lib/init/alchemy.js +1848 -1823
- package/lib/init/constants.js +0 -0
- package/lib/init/functions.js +8 -4
- package/lib/init/load_functions.js +0 -0
- package/lib/init/requirements.js +101 -101
- package/lib/stages.js +10 -2
- package/package.json +74 -74
|
File without changes
|
|
File without changes
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The custom time-ago element
|
|
2
|
+
* The custom al-time-ago element
|
|
3
3
|
*
|
|
4
4
|
* @author Jelle De Loecker <jelle@develry.be>
|
|
5
5
|
* @since 0.1.0
|
|
6
6
|
* @version 0.1.0
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
return TimeAgo.super.call(this);
|
|
10
|
-
});
|
|
8
|
+
const TimeAgo = Function.inherits('Alchemy.Element', 'TimeAgo');
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* Set the time
|
|
@@ -28,9 +28,9 @@ Alchemy.setStatic(function onScene(scene, options) {
|
|
|
28
28
|
/**
|
|
29
29
|
* Perform a resource request
|
|
30
30
|
*
|
|
31
|
-
* @author Jelle De Loecker <jelle@
|
|
31
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
32
32
|
* @since 0.0.1
|
|
33
|
-
* @version 1.
|
|
33
|
+
* @version 1.2.7
|
|
34
34
|
*
|
|
35
35
|
* @param {String|Object} options
|
|
36
36
|
* @param {Object} data
|
|
@@ -40,11 +40,7 @@ Alchemy.setStatic(function onScene(scene, options) {
|
|
|
40
40
|
*/
|
|
41
41
|
Alchemy.setMethod(function getResource(options, data, callback) {
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
conduit,
|
|
45
|
-
config,
|
|
46
|
-
pledge,
|
|
47
|
-
url;
|
|
43
|
+
const that = this;
|
|
48
44
|
|
|
49
45
|
if (typeof options == 'string') {
|
|
50
46
|
|
|
@@ -70,6 +66,8 @@ Alchemy.setMethod(function getResource(options, data, callback) {
|
|
|
70
66
|
options.params = data;
|
|
71
67
|
}
|
|
72
68
|
|
|
69
|
+
let pledge;
|
|
70
|
+
|
|
73
71
|
if (!options.name && !options.href) {
|
|
74
72
|
pledge = Classes.Pledge.reject(new Error('Unable to get alchemy resource, a `name` or `href` option is required'));
|
|
75
73
|
pledge.done(callback);
|
|
@@ -86,7 +84,7 @@ Alchemy.setMethod(function getResource(options, data, callback) {
|
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
if (Blast.isNode) {
|
|
89
|
-
conduit = this.view.server_var('conduit');
|
|
87
|
+
const conduit = this.view.server_var('conduit');
|
|
90
88
|
|
|
91
89
|
if (!conduit) {
|
|
92
90
|
pledge = Classes.Pledge.reject(new Error('Could not find conduit, alchemy resource will not be fetched'));
|
|
@@ -102,12 +100,15 @@ Alchemy.setMethod(function getResource(options, data, callback) {
|
|
|
102
100
|
return pledge;
|
|
103
101
|
}
|
|
104
102
|
|
|
103
|
+
let method = 'get',
|
|
104
|
+
url;
|
|
105
|
+
|
|
105
106
|
if (options.href) {
|
|
106
107
|
url = options.href;
|
|
107
108
|
} else {
|
|
108
109
|
|
|
109
110
|
// See if this is a socket route
|
|
110
|
-
config = this.view.helpers.Router.routeConfig(options.name, true);
|
|
111
|
+
let config = this.view.helpers.Router.routeConfig(options.name, true);
|
|
111
112
|
|
|
112
113
|
if (config && config.socket_route) {
|
|
113
114
|
pledge = new Classes.Pledge();
|
|
@@ -119,10 +120,18 @@ Alchemy.setMethod(function getResource(options, data, callback) {
|
|
|
119
120
|
return pledge;
|
|
120
121
|
}
|
|
121
122
|
|
|
123
|
+
config = this.view.helpers.Router.routeConfig(options.name);
|
|
124
|
+
|
|
125
|
+
if (config && config.methods) {
|
|
126
|
+
if (config.methods.indexOf('get') == -1) {
|
|
127
|
+
method = config.methods[0];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
122
131
|
// Get the url to the resource
|
|
123
132
|
url = hawkejs.scene.helpers.Router.routeUrl(options.name, options.params);
|
|
124
133
|
|
|
125
|
-
if (!url && typeof name == 'string') {
|
|
134
|
+
if (!url && typeof options.name == 'string') {
|
|
126
135
|
url = hawkejs.scene.helpers.Router.routeUrl('APIResource', {name: options.name});
|
|
127
136
|
}
|
|
128
137
|
|
|
@@ -136,7 +145,9 @@ Alchemy.setMethod(function getResource(options, data, callback) {
|
|
|
136
145
|
options.href = url;
|
|
137
146
|
|
|
138
147
|
if (data) {
|
|
139
|
-
options
|
|
148
|
+
options[method] = data;
|
|
149
|
+
} else if (method != 'get') {
|
|
150
|
+
options[method] = true;
|
|
140
151
|
}
|
|
141
152
|
|
|
142
153
|
pledge = hawkejs.scene.fetch(options);
|
|
File without changes
|
|
File without changes
|
|
@@ -51,7 +51,7 @@ Router.setProperty(function current_url() {
|
|
|
51
51
|
*
|
|
52
52
|
* @author Jelle De Loecker <jelle@develry.be>
|
|
53
53
|
* @since 1.1.0
|
|
54
|
-
* @version 1.
|
|
54
|
+
* @version 1.2.7
|
|
55
55
|
*
|
|
56
56
|
* @param {Element} element The element to apply to
|
|
57
57
|
* @param {String} name The route name
|
|
@@ -69,7 +69,6 @@ Router.setMethod(function applyDirective(element, name, options) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
let attribute_name,
|
|
72
|
-
param_source,
|
|
73
72
|
params = {},
|
|
74
73
|
url;
|
|
75
74
|
|
|
@@ -77,6 +76,10 @@ Router.setMethod(function applyDirective(element, name, options) {
|
|
|
77
76
|
Object.assign(params, element.parameters);
|
|
78
77
|
}
|
|
79
78
|
|
|
79
|
+
if (options.parameters) {
|
|
80
|
+
Object.assign(params, options.parameters);
|
|
81
|
+
}
|
|
82
|
+
|
|
80
83
|
if (config.keys && config.keys.length) {
|
|
81
84
|
|
|
82
85
|
let key,
|
|
@@ -99,12 +102,13 @@ Router.setMethod(function applyDirective(element, name, options) {
|
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
if (config.breadcrumb) {
|
|
102
|
-
|
|
105
|
+
let link_breadcrumb = this.getTrail(name, params);
|
|
106
|
+
element.setAttribute('data-breadcrumb', link_breadcrumb);
|
|
103
107
|
|
|
104
|
-
if (this.renderer) {
|
|
108
|
+
if (this.renderer && link_breadcrumb) {
|
|
105
109
|
let page_breadcrumb = this.renderer.internal('breadcrumb');
|
|
106
110
|
|
|
107
|
-
if (page_breadcrumb) {
|
|
111
|
+
if (page_breadcrumb && page_breadcrumb.startsWith(link_breadcrumb)) {
|
|
108
112
|
|
|
109
113
|
if (element.parentElement) {
|
|
110
114
|
// @TODO: We need to make sure the options (classnames & such)
|
|
@@ -112,7 +116,13 @@ Router.setMethod(function applyDirective(element, name, options) {
|
|
|
112
116
|
this.renderer.ensureElementOptions(element.parentElement);
|
|
113
117
|
}
|
|
114
118
|
|
|
115
|
-
|
|
119
|
+
let level = 2;
|
|
120
|
+
|
|
121
|
+
if (page_breadcrumb == link_breadcrumb) {
|
|
122
|
+
level = 1;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
alchemy.markLinkElement(element, level);
|
|
116
126
|
}
|
|
117
127
|
}
|
|
118
128
|
}
|
|
@@ -167,7 +177,7 @@ Router.setMethod(function applyDirective(element, name, options) {
|
|
|
167
177
|
*
|
|
168
178
|
* @author Jelle De Loecker <jelle@develry.be>
|
|
169
179
|
* @since 0.2.0
|
|
170
|
-
* @version 1.
|
|
180
|
+
* @version 1.2.7
|
|
171
181
|
*
|
|
172
182
|
* @param {String} name
|
|
173
183
|
* @param {Boolean} socket_route Look in the socket routes
|
|
@@ -244,6 +254,9 @@ Router.setMethod(function routeConfig(name, socket_route) {
|
|
|
244
254
|
result.breadcrumb = route.breadcrumb;
|
|
245
255
|
result.has_breadcrumb_assignments = route.has_breadcrumb_assignments;
|
|
246
256
|
result.keys = route.keys;
|
|
257
|
+
result.methods = route.methods;
|
|
258
|
+
result.permission = route.permission;
|
|
259
|
+
result.has_permission_assignments = route.has_permission_assignments;
|
|
247
260
|
}
|
|
248
261
|
|
|
249
262
|
let router_options;
|