alchemymvc 1.3.22 → 1.4.0-alpha.2
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 +96 -59
- 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 +27 -18
- 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 +62 -62
- 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 +6 -6
- 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 +201 -123
- 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 +152 -150
- 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 +26 -26
- package/lib/class/inode_list.js +4 -4
- package/lib/class/migration.js +4 -4
- package/lib/class/model.js +146 -165
- 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 +105 -82
- 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 +411 -373
- package/lib/{init/functions.js → core/alchemy_functions.js} +113 -91
- 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 +27 -50
- 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 -979
- package/lib/stages.js +0 -515
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const CriteriaNS = Function.getNamespace('Alchemy.Criteria');
|
|
2
|
+
|
|
1
3
|
let class_cache = new Map(),
|
|
2
4
|
fallback_datasource,
|
|
3
5
|
TABLE = Symbol('table');
|
|
@@ -10,7 +12,7 @@ if (Blast.isBrowser) {
|
|
|
10
12
|
for (config of hawkejs.scene.exposed.model_info) {
|
|
11
13
|
// First get or create the client-side Model class,
|
|
12
14
|
// then set some extra configuration coming from the server-side
|
|
13
|
-
Model.getClass(config.
|
|
15
|
+
Model.getClass(config.model_name).setModelConfig(config);
|
|
14
16
|
}
|
|
15
17
|
});
|
|
16
18
|
}
|
|
@@ -21,7 +23,7 @@ if (Blast.isBrowser) {
|
|
|
21
23
|
*
|
|
22
24
|
* @constructor
|
|
23
25
|
*
|
|
24
|
-
* @author Jelle De Loecker
|
|
26
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
25
27
|
* @since 1.0.0
|
|
26
28
|
* @version 1.1.0
|
|
27
29
|
*
|
|
@@ -34,20 +36,52 @@ const Model = Function.inherits('Alchemy.Client.Base', 'Alchemy.Client.Model', f
|
|
|
34
36
|
/**
|
|
35
37
|
* Set the modelName property after class creation
|
|
36
38
|
*
|
|
37
|
-
* @author Jelle De Loecker
|
|
39
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
38
40
|
* @since 1.1.0
|
|
39
|
-
* @version 1.
|
|
41
|
+
* @version 1.4.0
|
|
40
42
|
*/
|
|
41
|
-
Model.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
Model.postInherit(function setModelName() {
|
|
44
|
+
|
|
45
|
+
let base_name = this.name;
|
|
46
|
+
let model_name = base_name;
|
|
47
|
+
let table_prefix = this.table_prefix;
|
|
48
|
+
let namespace = this.namespace;
|
|
49
|
+
|
|
50
|
+
if (namespace.startsWith('Alchemy.Model.') || namespace == 'Alchemy.Model') {
|
|
51
|
+
namespace = namespace.slice(14);
|
|
52
|
+
} else if (namespace.startsWith('Alchemy.Client.Model.') || namespace == 'Alchemy.Client.Model') {
|
|
53
|
+
namespace = namespace.slice(21);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
this.setStatic('model_namespace', namespace, false);
|
|
57
|
+
|
|
58
|
+
let ns = namespace.replaceAll('.', '_');
|
|
59
|
+
|
|
60
|
+
if (!table_prefix && ns) {
|
|
61
|
+
table_prefix = ns.tableize();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (ns) {
|
|
65
|
+
model_name = ns + '_' + model_name;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// The simple name of the model
|
|
69
|
+
this.model_name = model_name;
|
|
70
|
+
this.setProperty('model_name', model_name);
|
|
71
|
+
|
|
72
|
+
let table_name = base_name.tableize();
|
|
73
|
+
|
|
74
|
+
if (table_prefix) {
|
|
75
|
+
table_name = table_prefix + '_' + table_name;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
this.table = table_name;
|
|
45
79
|
});
|
|
46
80
|
|
|
47
81
|
/**
|
|
48
82
|
* Map these events to methods
|
|
49
83
|
*
|
|
50
|
-
* @author Jelle De Loecker
|
|
84
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
51
85
|
* @since 1.2.5
|
|
52
86
|
* @version 1.3.22
|
|
53
87
|
*/
|
|
@@ -64,13 +98,13 @@ Model.mapEventToMethod({
|
|
|
64
98
|
/**
|
|
65
99
|
* Is the given action enabled on the server?
|
|
66
100
|
*
|
|
67
|
-
* @author Jelle De Loecker
|
|
101
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
68
102
|
* @since 1.0.6
|
|
69
103
|
* @version 1.0.6
|
|
70
104
|
*
|
|
71
|
-
* @param {
|
|
105
|
+
* @param {string} action
|
|
72
106
|
*
|
|
73
|
-
* @return {
|
|
107
|
+
* @return {boolean}
|
|
74
108
|
*/
|
|
75
109
|
Model.setStatic(function hasServerAction(action) {
|
|
76
110
|
|
|
@@ -89,7 +123,7 @@ Model.setStatic(function hasServerAction(action) {
|
|
|
89
123
|
/**
|
|
90
124
|
* Set the Model configuration
|
|
91
125
|
*
|
|
92
|
-
* @author Jelle De Loecker
|
|
126
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
93
127
|
* @since 1.3.1
|
|
94
128
|
* @version 1.3.1
|
|
95
129
|
*
|
|
@@ -114,7 +148,7 @@ Model.setStatic(function setModelConfig(config) {
|
|
|
114
148
|
* Table name to use in the database.
|
|
115
149
|
* False if no table should be used.
|
|
116
150
|
*
|
|
117
|
-
* @type
|
|
151
|
+
* @type {string}
|
|
118
152
|
*/
|
|
119
153
|
Model.setProperty(function table() {
|
|
120
154
|
|
|
@@ -130,7 +164,7 @@ Model.setProperty(function table() {
|
|
|
130
164
|
/**
|
|
131
165
|
* The datasource
|
|
132
166
|
*
|
|
133
|
-
* @author Jelle De Loecker <jelle@
|
|
167
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
134
168
|
* @since 1.0.0
|
|
135
169
|
* @version 1.1.7
|
|
136
170
|
*
|
|
@@ -169,7 +203,7 @@ Model.setProperty(function datasource() {
|
|
|
169
203
|
* @since 1.3.0
|
|
170
204
|
* @version 1.3.0
|
|
171
205
|
*
|
|
172
|
-
* @type {
|
|
206
|
+
* @type {boolean}
|
|
173
207
|
*/
|
|
174
208
|
Model.setProperty(function has_translatable_fields() {
|
|
175
209
|
return this.schema.has_translatable_fields;
|
|
@@ -178,7 +212,7 @@ Model.setProperty(function has_translatable_fields() {
|
|
|
178
212
|
/**
|
|
179
213
|
* The conduit
|
|
180
214
|
*
|
|
181
|
-
* @author Jelle De Loecker <jelle@
|
|
215
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
182
216
|
* @since 1.0.4
|
|
183
217
|
* @version 1.0.4
|
|
184
218
|
*/
|
|
@@ -210,7 +244,7 @@ Model.setProperty(function conduit() {
|
|
|
210
244
|
/**
|
|
211
245
|
* Get the document class constructor
|
|
212
246
|
*
|
|
213
|
-
* @type
|
|
247
|
+
* @type {Hawkejs.Document}
|
|
214
248
|
*/
|
|
215
249
|
Model.prepareStaticProperty('Document', function getDocumentClass() {
|
|
216
250
|
return Blast.Classes.Alchemy.Client.Document.Document.getDocumentClass(this);
|
|
@@ -219,25 +253,36 @@ Model.prepareStaticProperty('Document', function getDocumentClass() {
|
|
|
219
253
|
/**
|
|
220
254
|
* Create client model class for specific model name
|
|
221
255
|
*
|
|
222
|
-
* @author Jelle De Loecker <jelle@
|
|
256
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
223
257
|
* @since 1.0.0
|
|
224
|
-
* @version 1.
|
|
258
|
+
* @version 1.4.0
|
|
225
259
|
*
|
|
226
|
-
* @param {
|
|
227
|
-
* @param {
|
|
228
|
-
* @param {
|
|
260
|
+
* @param {string} model_name
|
|
261
|
+
* @param {boolean} allow_create
|
|
262
|
+
* @param {string} parent
|
|
229
263
|
*/
|
|
230
264
|
Model.setStatic(function getClass(model_name, allow_create, parent) {
|
|
231
265
|
|
|
232
|
-
|
|
233
|
-
|
|
266
|
+
let cache_key = model_name;
|
|
267
|
+
|
|
268
|
+
if (class_cache.has(cache_key)) {
|
|
269
|
+
return class_cache.get(cache_key);
|
|
234
270
|
}
|
|
235
271
|
|
|
272
|
+
// Get the model path as an array
|
|
273
|
+
let model_path = Blast.parseClassPath(model_name);
|
|
274
|
+
|
|
275
|
+
// Ensure it is the correct model_name
|
|
276
|
+
model_name = model_path.join('_');
|
|
277
|
+
|
|
236
278
|
// Construct the name of the class
|
|
237
|
-
let class_name =
|
|
279
|
+
let class_name = model_path.last();
|
|
280
|
+
|
|
281
|
+
// The root path
|
|
282
|
+
const root_path = 'Alchemy.Client.Model';
|
|
238
283
|
|
|
239
|
-
// Construct the path to this class
|
|
240
|
-
let class_path = '
|
|
284
|
+
// Construct the expected path to this class
|
|
285
|
+
let class_path = root_path + '.' + model_path.join('.');
|
|
241
286
|
|
|
242
287
|
// Get the class
|
|
243
288
|
let ModelClass = Object.path(Blast.Classes, class_path);
|
|
@@ -247,39 +292,39 @@ Model.setStatic(function getClass(model_name, allow_create, parent) {
|
|
|
247
292
|
}
|
|
248
293
|
|
|
249
294
|
if (ModelClass == null && allow_create) {
|
|
250
|
-
|
|
295
|
+
|
|
296
|
+
let namespace = root_path,
|
|
297
|
+
config;
|
|
298
|
+
|
|
299
|
+
if (model_path.length > 1) {
|
|
300
|
+
namespace += '.' + model_path.slice(0, -1).join('.');
|
|
301
|
+
}
|
|
251
302
|
|
|
252
303
|
let model_constructor = Function.create(class_name, function ModelConstructor(record, options) {
|
|
253
|
-
ModelConstructor.
|
|
304
|
+
ModelConstructor.super.call(this, record, options);
|
|
254
305
|
});
|
|
255
306
|
|
|
256
|
-
// @TODO: inherit from parents
|
|
257
|
-
let parent_path = 'Alchemy.Client.Model';
|
|
258
|
-
|
|
259
307
|
if (Blast.isBrowser) {
|
|
260
|
-
// No longer needed
|
|
261
|
-
} else if (Blast.isNode) {
|
|
262
|
-
config = alchemy.getModel(model_name, false);
|
|
263
308
|
|
|
264
|
-
if (
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
};
|
|
309
|
+
if (parent) {
|
|
310
|
+
let parent_model_path = Blast.parseClassPath(parent);
|
|
311
|
+
parent = root_path + '.' + parent_model_path.join('.');
|
|
312
|
+
} else {
|
|
313
|
+
parent = root_path;
|
|
270
314
|
}
|
|
271
|
-
}
|
|
272
315
|
|
|
273
|
-
if (
|
|
274
|
-
|
|
275
|
-
|
|
316
|
+
} else if (Blast.isNode) {
|
|
317
|
+
let server_class = alchemy.getModel(model_name, false);
|
|
318
|
+
|
|
319
|
+
parent = getClass(server_class.super.model_name);
|
|
276
320
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
321
|
+
config = {
|
|
322
|
+
primary_key : server_class.prototype.primary_key,
|
|
323
|
+
display_field : server_class.prototype.display_field,
|
|
324
|
+
};
|
|
280
325
|
}
|
|
281
326
|
|
|
282
|
-
ModelClass = Function.inherits(
|
|
327
|
+
ModelClass = Function.inherits(parent, namespace, model_constructor);
|
|
283
328
|
|
|
284
329
|
ModelClass.setProperty('$model_name', model_name);
|
|
285
330
|
|
|
@@ -298,7 +343,7 @@ Model.setStatic(function getClass(model_name, allow_create, parent) {
|
|
|
298
343
|
}
|
|
299
344
|
}
|
|
300
345
|
|
|
301
|
-
class_cache.set(
|
|
346
|
+
class_cache.set(cache_key, ModelClass);
|
|
302
347
|
|
|
303
348
|
return ModelClass;
|
|
304
349
|
});
|
|
@@ -306,9 +351,9 @@ Model.setStatic(function getClass(model_name, allow_create, parent) {
|
|
|
306
351
|
/**
|
|
307
352
|
* Set a method on the hawkejs document class
|
|
308
353
|
*
|
|
309
|
-
* @author Jelle De Loecker
|
|
354
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
310
355
|
* @since 1.0.0
|
|
311
|
-
* @version 1.
|
|
356
|
+
* @version 1.4.0
|
|
312
357
|
*/
|
|
313
358
|
Model.setStatic(function setDocumentMethod(name, fnc, on_server) {
|
|
314
359
|
|
|
@@ -321,7 +366,7 @@ Model.setStatic(function setDocumentMethod(name, fnc, on_server) {
|
|
|
321
366
|
}
|
|
322
367
|
|
|
323
368
|
if (Blast.isNode) {
|
|
324
|
-
|
|
369
|
+
STAGES.afterStages('load_app.plugins', whenLoaded);
|
|
325
370
|
} else {
|
|
326
371
|
Blast.loaded(whenLoaded);
|
|
327
372
|
}
|
|
@@ -334,9 +379,9 @@ Model.setStatic(function setDocumentMethod(name, fnc, on_server) {
|
|
|
334
379
|
/**
|
|
335
380
|
* Set a property on the hawkejs document class
|
|
336
381
|
*
|
|
337
|
-
* @author Jelle De Loecker
|
|
382
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
338
383
|
* @since 1.0.0
|
|
339
|
-
* @version 1.
|
|
384
|
+
* @version 1.4.0
|
|
340
385
|
*/
|
|
341
386
|
Model.setStatic(function setDocumentProperty(key, getter, setter, on_server) {
|
|
342
387
|
|
|
@@ -344,7 +389,7 @@ Model.setStatic(function setDocumentProperty(key, getter, setter, on_server) {
|
|
|
344
389
|
args = arguments;
|
|
345
390
|
|
|
346
391
|
if (Blast.isNode) {
|
|
347
|
-
|
|
392
|
+
STAGES.afterStages('load_app.plugins', whenLoaded);
|
|
348
393
|
} else {
|
|
349
394
|
Blast.loaded(whenLoaded);
|
|
350
395
|
}
|
|
@@ -357,7 +402,7 @@ Model.setStatic(function setDocumentProperty(key, getter, setter, on_server) {
|
|
|
357
402
|
/**
|
|
358
403
|
* The schema
|
|
359
404
|
*
|
|
360
|
-
* @type
|
|
405
|
+
* @type {Schema}
|
|
361
406
|
*/
|
|
362
407
|
Model.setStaticProperty(function schema() {
|
|
363
408
|
if (this.prototype.model_info) {
|
|
@@ -368,7 +413,7 @@ Model.setStaticProperty(function schema() {
|
|
|
368
413
|
/**
|
|
369
414
|
* The model name
|
|
370
415
|
*
|
|
371
|
-
* @type
|
|
416
|
+
* @type {string}
|
|
372
417
|
*/
|
|
373
418
|
Model.setProperty(function name() {
|
|
374
419
|
return this._name || this.constructor.model_name;
|
|
@@ -379,7 +424,7 @@ Model.setProperty(function name() {
|
|
|
379
424
|
/**
|
|
380
425
|
* Initialize the model
|
|
381
426
|
*
|
|
382
|
-
* @author Jelle De Loecker
|
|
427
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
383
428
|
* @since 1.1.0
|
|
384
429
|
* @version 1.3.0
|
|
385
430
|
*
|
|
@@ -413,7 +458,7 @@ Model.setMethod(function init(options) {
|
|
|
413
458
|
*
|
|
414
459
|
* @deprecated
|
|
415
460
|
*
|
|
416
|
-
* @author Jelle De Loecker
|
|
461
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
417
462
|
* @since 0.2.0
|
|
418
463
|
* @version 1.0.0
|
|
419
464
|
*
|
|
@@ -456,14 +501,14 @@ Model.setMethod(function getFindOptions(options) {
|
|
|
456
501
|
/**
|
|
457
502
|
* Get the title to display for this record
|
|
458
503
|
*
|
|
459
|
-
* @author Jelle De Loecker
|
|
504
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
460
505
|
* @since 0.0.1
|
|
461
506
|
* @version 1.3.14
|
|
462
507
|
*
|
|
463
508
|
* @param {Object} item The record item of this model
|
|
464
|
-
* @param {
|
|
509
|
+
* @param {string|Array} fallbacks Extra fallbacks to use
|
|
465
510
|
*
|
|
466
|
-
* @return {
|
|
511
|
+
* @return {string} The display title to use
|
|
467
512
|
*/
|
|
468
513
|
Model.setMethod(function getDisplayTitleOrNull(item, fallbacks) {
|
|
469
514
|
|
|
@@ -515,14 +560,14 @@ Model.setMethod(function getDisplayTitleOrNull(item, fallbacks) {
|
|
|
515
560
|
/**
|
|
516
561
|
* Get the title to display for this record
|
|
517
562
|
*
|
|
518
|
-
* @author Jelle De Loecker
|
|
563
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
519
564
|
* @since 0.0.1
|
|
520
565
|
* @version 1.3.16
|
|
521
566
|
*
|
|
522
567
|
* @param {Object} item The record item of this model
|
|
523
|
-
* @param {
|
|
568
|
+
* @param {string|Array} fallbacks Extra fallbacks to use
|
|
524
569
|
*
|
|
525
|
-
* @return {
|
|
570
|
+
* @return {string} The display title to use
|
|
526
571
|
*/
|
|
527
572
|
Model.setMethod(function getDisplayTitle(item, fallbacks) {
|
|
528
573
|
|
|
@@ -546,11 +591,11 @@ Model.setMethod(function getDisplayTitle(item, fallbacks) {
|
|
|
546
591
|
/**
|
|
547
592
|
* Return association configuration
|
|
548
593
|
*
|
|
549
|
-
* @author Jelle De Loecker
|
|
594
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
550
595
|
* @since 1.1.0
|
|
551
596
|
* @version 1.2.0
|
|
552
597
|
*
|
|
553
|
-
* @param {
|
|
598
|
+
* @param {string} alias
|
|
554
599
|
*
|
|
555
600
|
* @return {Object}
|
|
556
601
|
*/
|
|
@@ -595,11 +640,11 @@ Model.setMethod(function getAssociation(alias) {
|
|
|
595
640
|
/**
|
|
596
641
|
* Return a model instance for the given alias
|
|
597
642
|
*
|
|
598
|
-
* @author Jelle De Loecker
|
|
643
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
599
644
|
* @since 0.2.0
|
|
600
645
|
* @version 1.0.0
|
|
601
646
|
*
|
|
602
|
-
* @param {
|
|
647
|
+
* @param {string} alias
|
|
603
648
|
*
|
|
604
649
|
* @return {Model}
|
|
605
650
|
*/
|
|
@@ -625,23 +670,55 @@ Model.setMethod(function getAliasModel(alias) {
|
|
|
625
670
|
return result;
|
|
626
671
|
});
|
|
627
672
|
|
|
673
|
+
/**
|
|
674
|
+
* Find one record
|
|
675
|
+
*
|
|
676
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
677
|
+
* @since 1.4.0
|
|
678
|
+
* @version 1.4.0
|
|
679
|
+
*
|
|
680
|
+
* @param {string|Object|Criteria} conditions
|
|
681
|
+
*
|
|
682
|
+
* @return {Pledge|Criteria}
|
|
683
|
+
*/
|
|
684
|
+
Model.setMethod(function findOne(conditions, options) {
|
|
685
|
+
conditions = CriteriaNS.Model.cast(conditions, options, this);
|
|
686
|
+
return this.find('first', conditions);
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Find all records
|
|
691
|
+
*
|
|
692
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
693
|
+
* @since 1.4.0
|
|
694
|
+
* @version 1.4.0
|
|
695
|
+
*
|
|
696
|
+
* @param {string|Object|Criteria} conditions
|
|
697
|
+
*
|
|
698
|
+
* @return {Pledge|Criteria}
|
|
699
|
+
*/
|
|
700
|
+
Model.setMethod(function findAll(conditions, options) {
|
|
701
|
+
conditions = CriteriaNS.Model.cast(conditions, options, this);
|
|
702
|
+
return this.find('all', conditions);
|
|
703
|
+
});
|
|
704
|
+
|
|
628
705
|
/**
|
|
629
706
|
* Query the database
|
|
630
707
|
*
|
|
631
|
-
* @author Jelle De Loecker
|
|
708
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
632
709
|
* @since 0.0.1
|
|
633
|
-
* @version 1.
|
|
710
|
+
* @version 1.4.0
|
|
634
711
|
*
|
|
635
|
-
* @param {
|
|
712
|
+
* @param {string} type The type of find (first, all)
|
|
636
713
|
* @param {Criteria} criteria The criteria object
|
|
637
714
|
* @param {Function} callback
|
|
638
715
|
*
|
|
639
|
-
* @
|
|
716
|
+
* @return {Pledge|Criteria}
|
|
640
717
|
*/
|
|
641
718
|
Model.setMethod(function find(type, criteria, callback) {
|
|
642
719
|
|
|
643
720
|
if (arguments.length == 0) {
|
|
644
|
-
return new
|
|
721
|
+
return new Classes.Alchemy.Criteria.Model(this);
|
|
645
722
|
}
|
|
646
723
|
|
|
647
724
|
let skip_type,
|
|
@@ -649,13 +726,13 @@ Model.setMethod(function find(type, criteria, callback) {
|
|
|
649
726
|
error;
|
|
650
727
|
|
|
651
728
|
if (!this.datasource) {
|
|
652
|
-
pledge = new
|
|
729
|
+
pledge = new Pledge();
|
|
653
730
|
pledge.done(callback);
|
|
654
731
|
pledge.reject(new Classes.Alchemy.Error.Model('Unable to perform ' + this.constructor.name + '#find(), no datasource is available'));
|
|
655
732
|
return pledge;
|
|
656
733
|
}
|
|
657
734
|
|
|
658
|
-
if (
|
|
735
|
+
if (Classes.Alchemy.Criteria.Criteria.isCriteria(type)) {
|
|
659
736
|
callback = criteria;
|
|
660
737
|
criteria = type;
|
|
661
738
|
type = null;
|
|
@@ -674,13 +751,13 @@ Model.setMethod(function find(type, criteria, callback) {
|
|
|
674
751
|
}
|
|
675
752
|
|
|
676
753
|
try {
|
|
677
|
-
criteria =
|
|
754
|
+
criteria = Classes.Alchemy.Criteria.Model.cast(criteria, this);
|
|
678
755
|
} catch (err) {
|
|
679
756
|
error = err;
|
|
680
757
|
}
|
|
681
758
|
|
|
682
759
|
if (error != null) {
|
|
683
|
-
pledge = new
|
|
760
|
+
pledge = new Pledge();
|
|
684
761
|
pledge.done(callback);
|
|
685
762
|
pledge.reject(error);
|
|
686
763
|
return pledge;
|
|
@@ -857,11 +934,11 @@ Model.setMethod(function find(type, criteria, callback) {
|
|
|
857
934
|
/**
|
|
858
935
|
* Query the database by a single id
|
|
859
936
|
*
|
|
860
|
-
* @author Jelle De Loecker
|
|
937
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
861
938
|
* @since 0.0.1
|
|
862
939
|
* @version 1.1.0
|
|
863
940
|
*
|
|
864
|
-
* @param {
|
|
941
|
+
* @param {string|ObjectId} id The object id as string or object
|
|
865
942
|
* @param {Object} options Optional options object
|
|
866
943
|
* @param {Function} callback
|
|
867
944
|
*
|
|
@@ -874,11 +951,11 @@ Model.setMethod(function findById(id, options, callback) {
|
|
|
874
951
|
/**
|
|
875
952
|
* Query the database by a single id
|
|
876
953
|
*
|
|
877
|
-
* @author Jelle De Loecker
|
|
954
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
878
955
|
* @since 0.0.1
|
|
879
|
-
* @version 1.
|
|
956
|
+
* @version 1.4.0
|
|
880
957
|
*
|
|
881
|
-
* @param {
|
|
958
|
+
* @param {string|ObjectId} pk The primary key value
|
|
882
959
|
* @param {Object} options Optional options object
|
|
883
960
|
* @param {Function} callback
|
|
884
961
|
*
|
|
@@ -892,7 +969,7 @@ Model.setMethod(function findByPk(pk, options, callback) {
|
|
|
892
969
|
return pledge;
|
|
893
970
|
}
|
|
894
971
|
|
|
895
|
-
let criteria = new
|
|
972
|
+
let criteria = new Classes.Alchemy.Criteria.Model(this);
|
|
896
973
|
|
|
897
974
|
criteria.where(this.primary_key).equals(pk);
|
|
898
975
|
|
|
@@ -908,9 +985,9 @@ Model.setMethod(function findByPk(pk, options, callback) {
|
|
|
908
985
|
/**
|
|
909
986
|
* Query the database by key-val attributes, return the first result
|
|
910
987
|
*
|
|
911
|
-
* @author Jelle De Loecker
|
|
988
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
912
989
|
* @since 1.1.0
|
|
913
|
-
* @version 1.
|
|
990
|
+
* @version 1.4.0
|
|
914
991
|
*
|
|
915
992
|
* @param {Object} values The values to look for
|
|
916
993
|
* @param {Object} options Optional options object
|
|
@@ -919,7 +996,7 @@ Model.setMethod(function findByPk(pk, options, callback) {
|
|
|
919
996
|
*/
|
|
920
997
|
Model.setMethod(function findByValues(values, options) {
|
|
921
998
|
|
|
922
|
-
var criteria = new
|
|
999
|
+
var criteria = new Classes.Alchemy.Criteria.Model(this),
|
|
923
1000
|
key;
|
|
924
1001
|
|
|
925
1002
|
if (options) {
|
|
@@ -936,9 +1013,9 @@ Model.setMethod(function findByValues(values, options) {
|
|
|
936
1013
|
/**
|
|
937
1014
|
* Query the database by key-val attributes, return all results
|
|
938
1015
|
*
|
|
939
|
-
* @author Jelle De Loecker
|
|
1016
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
940
1017
|
* @since 1.1.0
|
|
941
|
-
* @version 1.
|
|
1018
|
+
* @version 1.4.0
|
|
942
1019
|
*
|
|
943
1020
|
* @param {Object} values The values to look for
|
|
944
1021
|
* @param {Object} options Optional options object
|
|
@@ -947,7 +1024,7 @@ Model.setMethod(function findByValues(values, options) {
|
|
|
947
1024
|
*/
|
|
948
1025
|
Model.setMethod(function findAllByValues(values, options) {
|
|
949
1026
|
|
|
950
|
-
var criteria = new
|
|
1027
|
+
var criteria = new Classes.Alchemy.Criteria.Model(this),
|
|
951
1028
|
key;
|
|
952
1029
|
|
|
953
1030
|
if (options) {
|
|
@@ -964,7 +1041,7 @@ Model.setMethod(function findAllByValues(values, options) {
|
|
|
964
1041
|
/**
|
|
965
1042
|
* The 'first' find method
|
|
966
1043
|
*
|
|
967
|
-
* @author Jelle De Loecker
|
|
1044
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
968
1045
|
* @since 0.0.1
|
|
969
1046
|
* @version 1.1.0
|
|
970
1047
|
*
|
|
@@ -985,7 +1062,7 @@ Model.setMethod(function beforeFindFirst(criteria, callback) {
|
|
|
985
1062
|
/**
|
|
986
1063
|
* The 'list' find method
|
|
987
1064
|
*
|
|
988
|
-
* @author Jelle De Loecker
|
|
1065
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
989
1066
|
* @since 0.0.1
|
|
990
1067
|
* @version 1.1.0
|
|
991
1068
|
*
|
|
@@ -1009,7 +1086,7 @@ Model.setMethod(function beforeFindList(criteria, callback) {
|
|
|
1009
1086
|
/**
|
|
1010
1087
|
* The 'dict' find method
|
|
1011
1088
|
*
|
|
1012
|
-
* @author Jelle De Loecker
|
|
1089
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1013
1090
|
* @since 0.0.1
|
|
1014
1091
|
* @version 1.1.0
|
|
1015
1092
|
*
|
|
@@ -1023,7 +1100,7 @@ Model.setMethod(function beforeFindDict(criteria, callback) {
|
|
|
1023
1100
|
/**
|
|
1024
1101
|
* The 'count' find method
|
|
1025
1102
|
*
|
|
1026
|
-
* @author Jelle De Loecker
|
|
1103
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1027
1104
|
* @since 0.0.1
|
|
1028
1105
|
* @version 1.1.0
|
|
1029
1106
|
*
|
|
@@ -1044,7 +1121,7 @@ Model.setMethod(function beforeFindCount(criteria, callback) {
|
|
|
1044
1121
|
/**
|
|
1045
1122
|
* The 'list' find method
|
|
1046
1123
|
*
|
|
1047
|
-
* @author Jelle De Loecker
|
|
1124
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1048
1125
|
* @since 0.2.0
|
|
1049
1126
|
* @version 1.1.0
|
|
1050
1127
|
*
|
|
@@ -1097,7 +1174,7 @@ Model.setMethod(function afterFindList(criteria, records, callback) {
|
|
|
1097
1174
|
/**
|
|
1098
1175
|
* The 'dict' find method
|
|
1099
1176
|
*
|
|
1100
|
-
* @author Jelle De Loecker
|
|
1177
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1101
1178
|
* @since 0.2.0
|
|
1102
1179
|
* @version 0.2.0
|
|
1103
1180
|
*/
|
|
@@ -1140,7 +1217,7 @@ Model.setMethod(function afterFindDict(options, records, callback) {
|
|
|
1140
1217
|
/**
|
|
1141
1218
|
* The 'count' find method
|
|
1142
1219
|
*
|
|
1143
|
-
* @author Jelle De Loecker
|
|
1220
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1144
1221
|
* @since 0.2.0
|
|
1145
1222
|
* @version 0.4.0
|
|
1146
1223
|
*/
|
|
@@ -1151,7 +1228,7 @@ Model.setMethod(function afterFindCount(options, records, callback) {
|
|
|
1151
1228
|
/**
|
|
1152
1229
|
* Add associated data to a single record
|
|
1153
1230
|
*
|
|
1154
|
-
* @author Jelle De Loecker
|
|
1231
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1155
1232
|
* @since 0.1.0
|
|
1156
1233
|
* @version 1.1.5
|
|
1157
1234
|
*
|
|
@@ -1330,7 +1407,7 @@ Model.setMethod(function addAssociatedDataToRecord(criteria, item, callback) {
|
|
|
1330
1407
|
};
|
|
1331
1408
|
});
|
|
1332
1409
|
|
|
1333
|
-
pledge = Function.parallel(alchemy.settings.model_assoc_parallel_limit || 4, aliases, function gotAssociatedList(err, list) {
|
|
1410
|
+
pledge = Function.parallel(alchemy.settings.data_management.model_assoc_parallel_limit || 4, aliases, function gotAssociatedList(err, list) {
|
|
1334
1411
|
|
|
1335
1412
|
if (err != null) {
|
|
1336
1413
|
console.log('ERROR: ' + err, err);
|
|
@@ -1351,11 +1428,11 @@ Model.setMethod(function addAssociatedDataToRecord(criteria, item, callback) {
|
|
|
1351
1428
|
/**
|
|
1352
1429
|
* Save (mixed) data to the database
|
|
1353
1430
|
*
|
|
1354
|
-
* @author Jelle De Loecker
|
|
1431
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1355
1432
|
* @since 0.0.1
|
|
1356
1433
|
* @version 1.0.7
|
|
1357
1434
|
*
|
|
1358
|
-
* @return
|
|
1435
|
+
* @return {Pledge}
|
|
1359
1436
|
*/
|
|
1360
1437
|
Model.setMethod(function save(data, _options, _callback) {
|
|
1361
1438
|
|
|
@@ -1447,7 +1524,7 @@ Model.setMethod(function save(data, _options, _callback) {
|
|
|
1447
1524
|
* Create a new document.
|
|
1448
1525
|
* If data is given, the document is populated
|
|
1449
1526
|
*
|
|
1450
|
-
* @author Jelle De Loecker
|
|
1527
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1451
1528
|
* @since 0.2.0
|
|
1452
1529
|
* @version 1.3.0
|
|
1453
1530
|
*
|
|
@@ -1486,7 +1563,7 @@ Model.setMethod(function createDocument(data, options) {
|
|
|
1486
1563
|
/**
|
|
1487
1564
|
* Create a document list
|
|
1488
1565
|
*
|
|
1489
|
-
* @author Jelle De Loecker
|
|
1566
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1490
1567
|
* @since 1.0.0
|
|
1491
1568
|
* @version 1.0.5
|
|
1492
1569
|
*
|
|
@@ -1524,7 +1601,7 @@ Model.setMethod(function createDocumentList(records, options) {
|
|
|
1524
1601
|
/**
|
|
1525
1602
|
* Insert record on the client side
|
|
1526
1603
|
*
|
|
1527
|
-
* @author Jelle De Loecker
|
|
1604
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1528
1605
|
* @since 1.0.0
|
|
1529
1606
|
* @version 1.0.0
|
|
1530
1607
|
*/
|
|
@@ -1541,13 +1618,13 @@ Model.setAfterMethod('ready', function _create(object, callback) {
|
|
|
1541
1618
|
/**
|
|
1542
1619
|
* Is the given action enabled on the server?
|
|
1543
1620
|
*
|
|
1544
|
-
* @author Jelle De Loecker
|
|
1621
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1545
1622
|
* @since 1.0.6
|
|
1546
1623
|
* @version 1.0.6
|
|
1547
1624
|
*
|
|
1548
|
-
* @param {
|
|
1625
|
+
* @param {string} action
|
|
1549
1626
|
*
|
|
1550
|
-
* @return {
|
|
1627
|
+
* @return {boolean}
|
|
1551
1628
|
*/
|
|
1552
1629
|
Model.setMethod(function hasServerAction(action) {
|
|
1553
1630
|
return this.constructor.hasServerAction(action);
|
|
@@ -1556,11 +1633,12 @@ Model.setMethod(function hasServerAction(action) {
|
|
|
1556
1633
|
/**
|
|
1557
1634
|
* Client-side model info
|
|
1558
1635
|
*
|
|
1559
|
-
* @type
|
|
1636
|
+
* @type {Object}
|
|
1560
1637
|
*/
|
|
1561
1638
|
Model.setProperty(function model_info() {
|
|
1562
1639
|
|
|
1563
|
-
let
|
|
1640
|
+
let class_name = this.constructor.name,
|
|
1641
|
+
model_name = this.constructor.model_name,
|
|
1564
1642
|
data;
|
|
1565
1643
|
|
|
1566
1644
|
if (Blast.isBrowser) {
|
|
@@ -1573,17 +1651,17 @@ Model.setProperty(function model_info() {
|
|
|
1573
1651
|
let config;
|
|
1574
1652
|
|
|
1575
1653
|
for (config of hawkejs.scene.exposed.model_info) {
|
|
1576
|
-
if (config.
|
|
1654
|
+
if (config.model_name === model_name) {
|
|
1577
1655
|
data = config;
|
|
1578
1656
|
break;
|
|
1579
1657
|
}
|
|
1580
1658
|
}
|
|
1581
1659
|
} else {
|
|
1582
1660
|
|
|
1583
|
-
let MainClass = Blast.Classes.Alchemy.Model
|
|
1661
|
+
let MainClass = Blast.Classes.Alchemy.Model.Model.get(model_name, false);
|
|
1584
1662
|
|
|
1585
1663
|
if (!MainClass) {
|
|
1586
|
-
throw new Error('Unable to find main class for "' +
|
|
1664
|
+
throw new Error('Unable to find main class for "' + model_name + '", unable to get client config!');
|
|
1587
1665
|
}
|
|
1588
1666
|
|
|
1589
1667
|
data = MainClass.getClientConfig();
|
|
@@ -1595,7 +1673,7 @@ Model.setProperty(function model_info() {
|
|
|
1595
1673
|
/**
|
|
1596
1674
|
* Schema
|
|
1597
1675
|
*
|
|
1598
|
-
* @type
|
|
1676
|
+
* @type {Object}
|
|
1599
1677
|
*/
|
|
1600
1678
|
Model.setProperty(function schema() {
|
|
1601
1679
|
return this.model_info.schema;
|
|
@@ -1604,7 +1682,7 @@ Model.setProperty(function schema() {
|
|
|
1604
1682
|
/**
|
|
1605
1683
|
* Associations
|
|
1606
1684
|
*
|
|
1607
|
-
* @type
|
|
1685
|
+
* @type {Object}
|
|
1608
1686
|
*/
|
|
1609
1687
|
Model.setProperty(function associations() {
|
|
1610
1688
|
return this.schema.associations;
|
|
@@ -1613,7 +1691,7 @@ Model.setProperty(function associations() {
|
|
|
1613
1691
|
/**
|
|
1614
1692
|
* Get a field instance from the schema
|
|
1615
1693
|
*
|
|
1616
|
-
* @author Jelle De Loecker
|
|
1694
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1617
1695
|
* @since 1.0.0
|
|
1618
1696
|
* @version 1.2.0
|
|
1619
1697
|
*
|
|
@@ -1646,7 +1724,7 @@ Hawkejs.Model = Model;
|
|
|
1646
1724
|
/**
|
|
1647
1725
|
* Save one record
|
|
1648
1726
|
*
|
|
1649
|
-
* @author Jelle De Loecker
|
|
1727
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1650
1728
|
* @since 0.0.1
|
|
1651
1729
|
* @version 1.3.20
|
|
1652
1730
|
*
|
|
@@ -1773,7 +1851,7 @@ Model.setMethod(function saveRecord(document, options, callback) {
|
|
|
1773
1851
|
/**
|
|
1774
1852
|
* Prepare some data by passing it through the schema
|
|
1775
1853
|
*
|
|
1776
|
-
* @author Jelle De Loecker
|
|
1854
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1777
1855
|
* @since 0.1.0
|
|
1778
1856
|
* @version 1.1.0
|
|
1779
1857
|
*
|
|
@@ -1793,7 +1871,7 @@ Model.setMethod(function compose(data, options) {
|
|
|
1793
1871
|
/**
|
|
1794
1872
|
* Create a record in the database
|
|
1795
1873
|
*
|
|
1796
|
-
* @author Jelle De Loecker
|
|
1874
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1797
1875
|
* @since 0.2.0
|
|
1798
1876
|
* @version 1.3.21
|
|
1799
1877
|
*
|
|
@@ -1855,7 +1933,7 @@ Model.setMethod(function createRecord(document, options, callback) {
|
|
|
1855
1933
|
/**
|
|
1856
1934
|
* Create a document used for saving
|
|
1857
1935
|
*
|
|
1858
|
-
* @author Jelle De Loecker
|
|
1936
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1859
1937
|
* @since 1.3.21
|
|
1860
1938
|
* @version 1.3.21
|
|
1861
1939
|
*
|
|
@@ -1878,7 +1956,7 @@ function createDocumentForSaving(model, original_input, data) {
|
|
|
1878
1956
|
/**
|
|
1879
1957
|
* Update a record in the database
|
|
1880
1958
|
*
|
|
1881
|
-
* @author Jelle De Loecker
|
|
1959
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1882
1960
|
* @since 0.2.0
|
|
1883
1961
|
* @version 1.3.21
|
|
1884
1962
|
*
|
|
@@ -1942,7 +2020,7 @@ Model.setMethod(function updateRecord(document, options, callback) {
|
|
|
1942
2020
|
/**
|
|
1943
2021
|
* Get records that need to be saved to the server
|
|
1944
2022
|
*
|
|
1945
|
-
* @author Jelle De Loecker
|
|
2023
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1946
2024
|
* @since 1.0.6
|
|
1947
2025
|
* @version 1.1.0
|
|
1948
2026
|
*/
|