Comparing version 6.1.0 to 7.0.0
@@ -59,3 +59,3 @@ 'use strict'; | ||
return dt.toISO(); | ||
} catch (e) { | ||
} catch { | ||
// api.log.warn(`cannot parse date: "${value}": ${e.message}`); | ||
@@ -70,3 +70,3 @@ return null; | ||
return dt.toISODate(); | ||
} catch (e) { | ||
} catch { | ||
// api.log.warn(`cannot parse date: "${value}": ${e.message}`); | ||
@@ -102,3 +102,3 @@ return null; | ||
obj = JSON.parse(value); | ||
} catch (e) { | ||
} catch { | ||
api.log.warn(`cannot parse JSON: '${value}`); | ||
@@ -105,0 +105,0 @@ return null; |
@@ -107,3 +107,2 @@ 'use strict'; | ||
api.log.trace('Loading resource ' + resourceName); | ||
// eslint-disable-next-line global-require | ||
const resourceFunction = require(resources[resourceName].instanceFile); | ||
@@ -110,0 +109,0 @@ if (typeof resourceFunction !== 'function') { |
'use strict'; | ||
const cloneDeep = require('lodash.clonedeep'); | ||
const requestParser = require('@florajs/request-parser'); | ||
@@ -515,6 +514,6 @@ const { ImplementationError } = require('@florajs/errors'); | ||
if (attrNode.parentKey === null) { | ||
attrNode.parentKey = cloneDeep(parentResource.primaryKey); | ||
attrNode.parentKey = structuredClone(parentResource.primaryKey); | ||
} | ||
if (attrNode.childKey === null) { | ||
attrNode.childKey = cloneDeep(childResource.primaryKey); | ||
attrNode.childKey = structuredClone(childResource.primaryKey); | ||
} | ||
@@ -521,0 +520,0 @@ |
@@ -164,3 +164,2 @@ 'use strict'; | ||
delete require.cache[resolvedConfigPath]; | ||
// eslint-disable-next-line global-require | ||
this.config = require(resolvedConfigPath); | ||
@@ -167,0 +166,0 @@ } |
@@ -19,13 +19,2 @@ 'use strict'; | ||
/** | ||
* Deep-clone an object and try to be efficient. | ||
* | ||
* @param {Object} obj | ||
* @returns {Object} | ||
* @private | ||
*/ | ||
function cloneDeep(obj) { | ||
return JSON.parse(JSON.stringify(obj)); | ||
} | ||
/** | ||
* Merges additional options, attributes and DataSources from parent-resource | ||
@@ -73,3 +62,3 @@ * into sub-resource. | ||
} else if (typeof subResourceConfig[optionName] === 'object') { | ||
attrNode[optionName] = cloneDeep(subResourceConfig[optionName]); | ||
attrNode[optionName] = structuredClone(subResourceConfig[optionName]); | ||
} else if (!(optionName in attrNode)) { | ||
@@ -214,3 +203,3 @@ attrNode[optionName] = subResourceConfig[optionName]; | ||
} else if (typeof origSubAttrNode[optionName] === 'object') { | ||
subAttrNode[optionName] = cloneDeep(origSubAttrNode[optionName]); | ||
subAttrNode[optionName] = structuredClone(origSubAttrNode[optionName]); | ||
} else { | ||
@@ -589,3 +578,3 @@ subAttrNode[optionName] = origSubAttrNode[optionName]; | ||
context.resourceTree.filter.forEach((andFilter2) => { | ||
combinedFilter.push(cloneDeep(andFilter).concat(cloneDeep(andFilter2))); | ||
combinedFilter.push(structuredClone(andFilter).concat(structuredClone(andFilter2))); | ||
}); | ||
@@ -592,0 +581,0 @@ }); |
@@ -58,3 +58,2 @@ 'use strict'; | ||
async run() { | ||
// eslint-disable-next-line global-require | ||
const config = require(this._configPath); | ||
@@ -61,0 +60,0 @@ |
@@ -119,3 +119,3 @@ 'use strict'; | ||
opts.data = JSON.parse(payload); | ||
} catch (err) { | ||
} catch { | ||
if (httpRequest.flora) httpRequest.flora.state = 'processing'; | ||
@@ -122,0 +122,0 @@ if (timeout) { |
@@ -19,3 +19,3 @@ 'use strict'; | ||
const dom = new DOMParser({ | ||
errorHandler: (level, message) => { | ||
onError: (level, message) => { | ||
throw new Error(message); | ||
@@ -34,3 +34,3 @@ } | ||
function copyXmlAttributes(node) { | ||
if (!node.hasAttributes()) return {}; | ||
if (!node.attributes.length) return {}; | ||
@@ -37,0 +37,0 @@ return Array.from(node.attributes) |
{ | ||
"name": "flora", | ||
"version": "6.1.0", | ||
"version": "7.0.0", | ||
"description": "FLexible Open Rest API", | ||
"main": "index.js", | ||
"scripts": { | ||
"prepare": "git config --local core.hooksPath .githooks", | ||
"doc": "jsdoc -R README.md -d build/docs lib", | ||
"test": "mocha", | ||
"test": "node --test test/*.spec.js", | ||
"lint": "eslint .", | ||
"test-lint": "eslint . && mocha" | ||
"test-lint": "eslint . && npm run test" | ||
}, | ||
@@ -16,3 +17,2 @@ "files": [ | ||
], | ||
"pre-commit": "test-lint", | ||
"keywords": [ | ||
@@ -46,3 +46,3 @@ "api", | ||
"engines": { | ||
"node": ">=16" | ||
"node": ">=18" | ||
}, | ||
@@ -52,26 +52,21 @@ "dependencies": { | ||
"@florajs/errors": "^4.0.0", | ||
"@florajs/request-parser": "^4.0.0", | ||
"@xmldom/xmldom": "^0.8.10", | ||
"@florajs/request-parser": "^5.0.0", | ||
"@xmldom/xmldom": "^0.9.7", | ||
"bunyan": "^1.8.15", | ||
"chokidar": "^3.6.0", | ||
"chokidar": "^4.0.3", | ||
"content-type": "^1.0.5", | ||
"lodash.clonedeep": "^4.5.0", | ||
"luxon": "^3.5.0", | ||
"promise-events": "^0.2.4", | ||
"serve-static": "^1.15.0" | ||
"serve-static": "^1.16.2" | ||
}, | ||
"devDependencies": { | ||
"abstract-logging": "^2.0.1", | ||
"chai": "^4.3.7", | ||
"eslint": "^8.46.0", | ||
"eslint-config-prettier": "^8.10.0", | ||
"eslint-plugin-prettier": "^5.2.1", | ||
"jsdoc": "^4.0.3", | ||
"mocha": "^10.7.0", | ||
"mock-fs": "^5.2.0", | ||
"pre-commit": "^1.2.2", | ||
"prettier": "^3.3.3", | ||
"sinon": "^15.2.0", | ||
"sinon-chai": "^3.7.0" | ||
"eslint": "^9.19.0", | ||
"eslint-config-prettier": "^10.0.1", | ||
"eslint-plugin-prettier": "^5.2.3", | ||
"globals": "^15.14.0", | ||
"jsdoc": "^4.0.4", | ||
"mock-fs": "^5.4.1", | ||
"prettier": "^3.4.2" | ||
} | ||
} |
10
8
183757
4264
+ Added@florajs/ql@6.0.1(transitive)
+ Added@florajs/request-parser@5.0.0(transitive)
+ Added@peggyjs/from-mem@1.3.5(transitive)
+ Added@xmldom/xmldom@0.9.8(transitive)
+ Addedchokidar@4.0.3(transitive)
+ Addedcommander@12.1.0(transitive)
+ Addedpeggy@4.2.0(transitive)
+ Addedreaddirp@4.1.2(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedsource-map-generator@0.8.0(transitive)
- Removedlodash.clonedeep@^4.5.0
- Removed@florajs/ql@5.0.0(transitive)
- Removed@florajs/request-parser@4.0.0(transitive)
- Removed@xmldom/xmldom@0.8.10(transitive)
- Removedanymatch@3.1.3(transitive)
- Removedbinary-extensions@2.3.0(transitive)
- Removedbraces@3.0.3(transitive)
- Removedchokidar@3.6.0(transitive)
- Removedfill-range@7.1.1(transitive)
- Removedfsevents@2.3.3(transitive)
- Removedglob-parent@5.1.2(transitive)
- Removedis-binary-path@2.1.0(transitive)
- Removedis-extglob@2.1.1(transitive)
- Removedis-glob@4.0.3(transitive)
- Removedis-number@7.0.0(transitive)
- Removedlodash.clonedeep@4.5.0(transitive)
- Removednormalize-path@3.0.0(transitive)
- Removedpeggy@1.2.0(transitive)
- Removedpicomatch@2.3.1(transitive)
- Removedreaddirp@3.6.0(transitive)
- Removedto-regex-range@5.0.1(transitive)
Updated@xmldom/xmldom@^0.9.7
Updatedchokidar@^4.0.3
Updatedserve-static@^1.16.2