@onehat/data 1.8.19 → 1.8.21
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/package.json +11 -11
- package/src/OneHatData.js +7 -10
- package/src/Repository/OneBuild.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onehat/data",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.21",
|
|
4
4
|
"description": "JS data modeling package with adapters for many storage mediums.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -50,18 +50,18 @@
|
|
|
50
50
|
"uuid": "^9.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@babel/core": "^7.
|
|
54
|
-
"@babel/node": "^7.
|
|
55
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
56
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
57
|
-
"@babel/preset-env": "^7.
|
|
58
|
-
"@babel/register": "^7.
|
|
59
|
-
"@babel/runtime": "^7.
|
|
53
|
+
"@babel/core": "^7.20.2",
|
|
54
|
+
"@babel/node": "^7.20.2",
|
|
55
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
56
|
+
"@babel/plugin-transform-runtime": "^7.19.6",
|
|
57
|
+
"@babel/preset-env": "^7.20.2",
|
|
58
|
+
"@babel/register": "^7.18.9",
|
|
59
|
+
"@babel/runtime": "^7.20.0",
|
|
60
60
|
"@cypress/webpack-preprocessor": "^5.11.0",
|
|
61
|
-
"babel-loader": "^
|
|
61
|
+
"babel-loader": "^9.1.0",
|
|
62
62
|
"cypress": "5.2.0",
|
|
63
63
|
"ink-docstrap": "^1.3.2",
|
|
64
|
-
"jsdoc": "^
|
|
65
|
-
"webpack": "^
|
|
64
|
+
"jsdoc": "^4.0.0",
|
|
65
|
+
"webpack": "^5.75.0"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/OneHatData.js
CHANGED
|
@@ -13,8 +13,6 @@ import {
|
|
|
13
13
|
} from './Schema';
|
|
14
14
|
import _ from 'lodash';
|
|
15
15
|
|
|
16
|
-
export let concurrentAsyncRequests = 0; // global counter
|
|
17
|
-
|
|
18
16
|
/**
|
|
19
17
|
* OneHatData represents a collection of Repositories.
|
|
20
18
|
* It is the top-level object for this module.
|
|
@@ -58,12 +56,6 @@ export class OneHatData extends EventEmitter {
|
|
|
58
56
|
* @private
|
|
59
57
|
*/
|
|
60
58
|
this.uniqueRepositoriesMap = {};
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @member {Object} maxConcurrentAsyncRequests - Object map of all unique Repositories, with signature of { mapName: id }
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
|
-
this.maxConcurrentAsyncRequests = 500; // Total number of async requests allowed, before we start making them synchronous
|
|
67
59
|
|
|
68
60
|
/**
|
|
69
61
|
* @member {boolean} isDestroyed - Whether this object has been destroyed
|
|
@@ -85,13 +77,18 @@ export class OneHatData extends EventEmitter {
|
|
|
85
77
|
* Sets global config settings that will be passed into all Repositories.
|
|
86
78
|
* Chainable.
|
|
87
79
|
* @param {object} globals - Schema config object
|
|
80
|
+
* @param {boolean} merge - Whether to merge or replace the globals
|
|
88
81
|
* @return this
|
|
89
82
|
*/
|
|
90
|
-
setRepositoryGlobals = (globals) => {
|
|
83
|
+
setRepositoryGlobals = (globals, merge = true) => {
|
|
91
84
|
if (this.isDestroyed) {
|
|
92
85
|
throw new Error('this.setRepositoryGlobals is no longer valid. OneHatData has been destroyed.');
|
|
93
86
|
}
|
|
94
|
-
|
|
87
|
+
if (merge) {
|
|
88
|
+
_.merge(this._repositoryGlobals, globals);
|
|
89
|
+
} else {
|
|
90
|
+
_.assign(this._repositoryGlobals, globals);
|
|
91
|
+
}
|
|
95
92
|
return this;
|
|
96
93
|
}
|
|
97
94
|
|
|
@@ -117,6 +117,10 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
117
117
|
|
|
118
118
|
return this.axios(options)
|
|
119
119
|
.catch(error => {
|
|
120
|
+
if (this.debugMode) {
|
|
121
|
+
console.log(url + ' error', error);
|
|
122
|
+
console.log('response:', error.response);
|
|
123
|
+
}
|
|
120
124
|
// BEGIN MOD
|
|
121
125
|
if (error && error.response && error.response.status === 401) {
|
|
122
126
|
this.emit('logout');
|
|
@@ -124,10 +128,6 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
124
128
|
return false;
|
|
125
129
|
}
|
|
126
130
|
// END MOD
|
|
127
|
-
if (this.debugMode) {
|
|
128
|
-
console.log(url + ' error', error);
|
|
129
|
-
console.log('response:', error.response);
|
|
130
|
-
}
|
|
131
131
|
this.emit('error', error);
|
|
132
132
|
});
|
|
133
133
|
}
|