@quatrain/core 1.1.15 → 1.1.17
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/lib/Core.js
CHANGED
|
@@ -85,7 +85,7 @@ Core.storage = require('node-persist');
|
|
|
85
85
|
Core.storagePrefix = 'core';
|
|
86
86
|
Core.userClass = User_1.User;
|
|
87
87
|
Core.classRegistry = {};
|
|
88
|
-
Core.logLevel = log_1.LogLevel.
|
|
88
|
+
Core.logLevel = log_1.LogLevel.INFO;
|
|
89
89
|
Core.logger = _a.addLogger();
|
|
90
90
|
// How timestamp are formatted
|
|
91
91
|
Core.timestamp = () => new Date().toISOString();
|
|
@@ -100,7 +100,7 @@ export declare class DataObject implements DataObjectType {
|
|
|
100
100
|
ref: string;
|
|
101
101
|
uri: string;
|
|
102
102
|
};
|
|
103
|
-
protected _dataToJSON(objectsAsReferences?: boolean, ignoreUnchanged?: boolean, converters?: {}): {};
|
|
103
|
+
protected _dataToJSON(objectsAsReferences?: boolean, ignoreUnchanged?: boolean, ignoreNulls?: boolean, converters?: {}): {};
|
|
104
104
|
/**
|
|
105
105
|
* Data object must be created from factory in order for async-loaded data to be available
|
|
106
106
|
* @param className
|
|
@@ -228,24 +228,27 @@ class DataObject {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
toJSON(params = false) {
|
|
231
|
-
let objectsAsReferences = false, withoutURIData = false, ignoreUnchanged = false, converters = {};
|
|
231
|
+
let objectsAsReferences = false, withoutURIData = false, ignoreUnchanged = false, ignoreNulls = false, converters = {};
|
|
232
232
|
if (typeof params === 'object') {
|
|
233
233
|
// Any missing parameter should resolve to false
|
|
234
234
|
objectsAsReferences = Boolean(params.objectsAsReferences);
|
|
235
235
|
withoutURIData = Boolean(params.withoutURIData);
|
|
236
236
|
ignoreUnchanged = Boolean(params.ignoreUnchanged);
|
|
237
|
+
ignoreNulls = Boolean(params.ignoreNulls);
|
|
237
238
|
converters = params.converters;
|
|
238
239
|
}
|
|
239
240
|
return Object.assign(Object.assign({}, (!withoutURIData &&
|
|
240
|
-
this.uri && { uid: this.uri.uid, path: this.uri.path })), this._dataToJSON(objectsAsReferences, ignoreUnchanged, converters));
|
|
241
|
+
this.uri && { uid: this.uri.uid, path: this.uri.path })), this._dataToJSON(objectsAsReferences, ignoreUnchanged, ignoreNulls, converters));
|
|
241
242
|
}
|
|
242
243
|
toReference() {
|
|
243
244
|
return Object.assign(Object.assign({}, this._objectUri.toReference()), { label: this.val('name') || '' });
|
|
244
245
|
}
|
|
245
|
-
_dataToJSON(objectsAsReferences = false, ignoreUnchanged = false, converters = {}) {
|
|
246
|
+
_dataToJSON(objectsAsReferences = false, ignoreUnchanged = false, ignoreNulls = false, converters = {}) {
|
|
246
247
|
const data = {};
|
|
247
248
|
Object.keys(this._properties).forEach((key) => {
|
|
248
249
|
const prop = Reflect.get(this._properties, key);
|
|
250
|
+
if (ignoreNulls && !prop.val())
|
|
251
|
+
return;
|
|
249
252
|
if (ignoreUnchanged && prop.hasChanged === false)
|
|
250
253
|
return;
|
|
251
254
|
// console.log(prop.constructor.name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.17",
|
|
4
4
|
"description": "Core objects for business apps",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@faker-js/faker": "^7.6.0",
|
|
27
|
-
"@quatrain/log": "^0.1.
|
|
27
|
+
"@quatrain/log": "^0.1.3",
|
|
28
28
|
"loglevel": "^1.9.2",
|
|
29
29
|
"node-persist": "^4.0.3"
|
|
30
30
|
},
|