mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-02-26 19:02:17 +00:00
refactor: build system
This commit is contained in:
@@ -2,35 +2,29 @@
|
||||
|
||||
(Summarize the bug encountered concisely)
|
||||
|
||||
|
||||
## Steps to reproduce
|
||||
|
||||
(How one can reproduce the issue - this is very important)
|
||||
|
||||
|
||||
## Example Project
|
||||
|
||||
(If possible, please create an example project here on GitLab.com that exhibits the problematic behaviour, and link to it here in the bug report)
|
||||
|
||||
(If you are using an older version of GitLab, this will also determine whether the bug has been fixed in a more recent version)
|
||||
|
||||
|
||||
## What is the current bug behavior?
|
||||
|
||||
(What actually happens)
|
||||
|
||||
|
||||
## What is the expected correct behavior?
|
||||
|
||||
(What you should see instead)
|
||||
|
||||
|
||||
## Relevant logs and/or screenshots
|
||||
|
||||
(Paste any relevant logs - please use code blocks (```) to format console output,
|
||||
logs, and code as it's very hard to read otherwise.)
|
||||
|
||||
|
||||
## Possible fixes
|
||||
|
||||
(If you can, link to the line of code that might be responsible for the problem)
|
||||
|
||||
@@ -2,15 +2,12 @@
|
||||
|
||||
(Describe the feature that you're requesting concisely)
|
||||
|
||||
|
||||
## Explanation
|
||||
|
||||
(Explain why the feature is necessary)
|
||||
|
||||
|
||||
## Dependencies, issues to be resolved beforehand
|
||||
|
||||
(List issues or dependencies that need to be resolved before this feature can be implemented)
|
||||
|
||||
|
||||
/label ~meeting
|
||||
|
||||
@@ -22,287 +22,169 @@
|
||||
|
||||
# [0.45.0](https://gitlab.com/openstapps/api/compare/v0.44.0...v0.45.0) (2022-12-06)
|
||||
|
||||
|
||||
|
||||
# [0.44.0](https://gitlab.com/openstapps/api/compare/v0.43.0...v0.44.0) (2022-10-18)
|
||||
|
||||
|
||||
|
||||
# [0.43.0](https://gitlab.com/openstapps/api/compare/v0.42.0...v0.43.0) (2022-08-23)
|
||||
|
||||
|
||||
|
||||
# [0.42.0](https://gitlab.com/openstapps/api/compare/v0.41.1...v0.42.0) (2022-07-04)
|
||||
|
||||
|
||||
|
||||
## [0.41.1](https://gitlab.com/openstapps/api/compare/v0.41.0...v0.41.1) (2022-05-27)
|
||||
|
||||
|
||||
|
||||
# [0.41.0](https://gitlab.com/openstapps/api/compare/v0.40.0...v0.41.0) (2022-05-17)
|
||||
|
||||
|
||||
|
||||
# [0.40.0](https://gitlab.com/openstapps/api/compare/v0.39.0...v0.40.0) (2022-04-04)
|
||||
|
||||
|
||||
|
||||
# [0.39.0](https://gitlab.com/openstapps/api/compare/v0.38.0...v0.39.0) (2022-03-17)
|
||||
|
||||
|
||||
|
||||
# [0.38.0](https://gitlab.com/openstapps/api/compare/v0.37.0...v0.38.0) (2022-01-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add client method for invoking plugin routes ([83120a6](https://gitlab.com/openstapps/api/commit/83120a67345d2fee672f6a44ab91708ecce65e58))
|
||||
|
||||
|
||||
- add client method for invoking plugin routes ([83120a6](https://gitlab.com/openstapps/api/commit/83120a67345d2fee672f6a44ab91708ecce65e58))
|
||||
|
||||
# [0.37.0](https://gitlab.com/openstapps/api/compare/v0.36.0...v0.37.0) (2021-12-17)
|
||||
|
||||
|
||||
|
||||
# [0.36.0](https://gitlab.com/openstapps/api/compare/v0.35.0...v0.36.0) (2021-12-15)
|
||||
|
||||
|
||||
|
||||
# [0.35.0](https://gitlab.com/openstapps/api/compare/v0.34.0...v0.35.0) (2021-10-20)
|
||||
|
||||
|
||||
|
||||
# [0.34.0](https://gitlab.com/openstapps/api/compare/v0.33.0...v0.34.0) (2021-10-04)
|
||||
|
||||
|
||||
|
||||
# [0.33.0](https://gitlab.com/openstapps/api/compare/v0.32.0...v0.33.0) (2021-09-16)
|
||||
|
||||
|
||||
|
||||
# [0.32.0](https://gitlab.com/openstapps/api/compare/v0.31.1...v0.32.0) (2021-09-01)
|
||||
|
||||
|
||||
|
||||
## [0.31.1](https://gitlab.com/openstapps/api/compare/v0.31.0...v0.31.1) (2021-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* plugin related tests ([51c157d](https://gitlab.com/openstapps/api/commit/51c157d577b9ae70e8c4683e653cd65aacb4f248))
|
||||
|
||||
|
||||
- plugin related tests ([51c157d](https://gitlab.com/openstapps/api/commit/51c157d577b9ae70e8c4683e653cd65aacb4f248))
|
||||
|
||||
# [0.31.0](https://gitlab.com/openstapps/api/compare/v0.30.0...v0.31.0) (2021-08-17)
|
||||
|
||||
|
||||
|
||||
# [0.30.0](https://gitlab.com/openstapps/api/compare/v0.29.0...v0.30.0) (2021-08-04)
|
||||
|
||||
|
||||
|
||||
# [0.29.0](https://gitlab.com/openstapps/api/compare/v0.28.0...v0.29.0) (2021-06-08)
|
||||
|
||||
|
||||
|
||||
# [0.28.0](https://gitlab.com/openstapps/api/compare/v0.27.0...v0.28.0) (2021-04-27)
|
||||
|
||||
|
||||
|
||||
# [0.27.0](https://gitlab.com/openstapps/api/compare/v0.26.0...v0.27.0) (2021-03-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* send valid JSON on bulk/done ([29cd22f](https://gitlab.com/openstapps/api/commit/29cd22f2d11cebbe2de63cc2e614734e286821f2)), closes [#38](https://gitlab.com/openstapps/api/issues/38)
|
||||
|
||||
|
||||
- send valid JSON on bulk/done ([29cd22f](https://gitlab.com/openstapps/api/commit/29cd22f2d11cebbe2de63cc2e614734e286821f2)), closes [#38](https://gitlab.com/openstapps/api/issues/38)
|
||||
|
||||
# [0.26.0](https://gitlab.com/openstapps/api/compare/v0.25.0...v0.26.0) (2021-02-23)
|
||||
|
||||
|
||||
|
||||
# [0.25.0](https://gitlab.com/openstapps/api/compare/v0.23.0...v0.25.0) (2020-11-09)
|
||||
|
||||
|
||||
|
||||
# [0.23.0](https://gitlab.com/openstapps/api/compare/v0.22.0...v0.23.0) (2020-10-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* make express parse body ([b3e1075](https://gitlab.com/openstapps/api/commit/b3e107528b5d6ac5ec86786a9f9bf8fb1645e874))
|
||||
|
||||
|
||||
- make express parse body ([b3e1075](https://gitlab.com/openstapps/api/commit/b3e107528b5d6ac5ec86786a9f9bf8fb1645e874))
|
||||
|
||||
# [0.22.0](https://gitlab.com/openstapps/api/compare/v0.21.0...v0.22.0) (2020-05-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add content-type header ([d30de89](https://gitlab.com/openstapps/api/commit/d30de896f0d1a21c039e1905c0766cc37df06b23))
|
||||
|
||||
|
||||
- add content-type header ([d30de89](https://gitlab.com/openstapps/api/commit/d30de896f0d1a21c039e1905c0766cc37df06b23))
|
||||
|
||||
# [0.21.0](https://gitlab.com/openstapps/api/compare/v0.19.0...v0.21.0) (2020-05-06)
|
||||
|
||||
|
||||
|
||||
# [0.19.0](https://gitlab.com/openstapps/api/compare/v0.18.0...v0.19.0) (2020-03-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* repair and unify subcommand help outputs ([4ae968f](https://gitlab.com/openstapps/api/commit/4ae968ff0f52c940cb11a97876f72d57feb61597))
|
||||
|
||||
- repair and unify subcommand help outputs ([4ae968f](https://gitlab.com/openstapps/api/commit/4ae968ff0f52c940cb11a97876f72d57feb61597))
|
||||
|
||||
### Features
|
||||
|
||||
* add option to wait on resource to e2e script ([e18858f](https://gitlab.com/openstapps/api/commit/e18858fc58ccfb8b3bdec92260eba12cd1a25214))
|
||||
|
||||
|
||||
- add option to wait on resource to e2e script ([e18858f](https://gitlab.com/openstapps/api/commit/e18858fc58ccfb8b3bdec92260eba12cd1a25214))
|
||||
|
||||
# [0.18.0](https://gitlab.com/openstapps/api/compare/v0.17.0...v0.18.0) (2020-02-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* extend e2e procedure ([dc79dc8](https://gitlab.com/openstapps/api/commit/dc79dc8feb10a29cff0f6d1c320658ad13cf7e4e))
|
||||
|
||||
|
||||
- extend e2e procedure ([dc79dc8](https://gitlab.com/openstapps/api/commit/dc79dc8feb10a29cff0f6d1c320658ad13cf7e4e))
|
||||
|
||||
# [0.17.0](https://gitlab.com/openstapps/api/compare/v0.16.0...v0.17.0) (2019-11-15)
|
||||
|
||||
|
||||
|
||||
# [0.16.0](https://gitlab.com/openstapps/api/compare/v0.15.0...v0.16.0) (2019-09-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add plugin class ([c2848fc](https://gitlab.com/openstapps/api/commit/c2848fc7a528288ef4c3ab96728d4e16add6fe75)), closes [#12](https://gitlab.com/openstapps/api/issues/12)
|
||||
|
||||
|
||||
- add plugin class ([c2848fc](https://gitlab.com/openstapps/api/commit/c2848fc7a528288ef4c3ab96728d4e16add6fe75)), closes [#12](https://gitlab.com/openstapps/api/issues/12)
|
||||
|
||||
# [0.15.0](https://gitlab.com/openstapps/api/compare/v0.14.0...v0.15.0) (2019-08-19)
|
||||
|
||||
|
||||
|
||||
# [0.14.0](https://gitlab.com/openstapps/api/compare/v0.13.0...v0.14.0) (2019-07-23)
|
||||
|
||||
|
||||
|
||||
# [0.13.0](https://gitlab.com/openstapps/api/compare/v0.12.0...v0.13.0) (2019-07-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* change removeReferences() to also remove origin ([ded221c](https://gitlab.com/openstapps/api/commit/ded221c175368d315fdbb79d561c86c3ee8bf158))
|
||||
|
||||
|
||||
- change removeReferences() to also remove origin ([ded221c](https://gitlab.com/openstapps/api/commit/ded221c175368d315fdbb79d561c86c3ee8bf158))
|
||||
|
||||
# [0.12.0](https://gitlab.com/openstapps/api/compare/v0.11.0...v0.12.0) (2019-07-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add function to remove undefined properties ([f95fd09](https://gitlab.com/openstapps/api/commit/f95fd09112e81eab42591a5aaff3568ab06e9441))
|
||||
|
||||
|
||||
- add function to remove undefined properties ([f95fd09](https://gitlab.com/openstapps/api/commit/f95fd09112e81eab42591a5aaff3568ab06e9441))
|
||||
|
||||
# [0.11.0](https://gitlab.com/openstapps/api/compare/v0.10.0...v0.11.0) (2019-07-12)
|
||||
|
||||
|
||||
|
||||
# [0.10.0](https://gitlab.com/openstapps/api/compare/v0.9.0...v0.10.0) (2019-07-03)
|
||||
|
||||
|
||||
|
||||
# [0.9.0](https://gitlab.com/openstapps/api/compare/v0.8.0...v0.9.0) (2019-06-20)
|
||||
|
||||
|
||||
|
||||
# [0.8.0](https://gitlab.com/openstapps/api/compare/v0.7.0...v0.8.0) (2019-05-14)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add e2e command. Indexes core test files. ([e1313b5](https://gitlab.com/openstapps/api/commit/e1313b55ff3bc17e96b09639f4949b2179991679))
|
||||
|
||||
|
||||
- add e2e command. Indexes core test files. ([e1313b5](https://gitlab.com/openstapps/api/commit/e1313b55ff3bc17e96b09639f4949b2179991679))
|
||||
|
||||
# [0.7.0](https://gitlab.com/openstapps/api/compare/v0.6.0...v0.7.0) (2019-04-16)
|
||||
|
||||
|
||||
|
||||
# [0.6.0](https://gitlab.com/openstapps/api/compare/v0.5.0...v0.6.0) (2019-04-09)
|
||||
|
||||
|
||||
|
||||
# [0.5.0](https://gitlab.com/openstapps/api/compare/v0.4.1...v0.5.0) (2019-04-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add method to remove references from a thing ([9cf6fde](https://gitlab.com/openstapps/api/commit/9cf6fde050c665b63026b8c08502c7836e23c2d5)), closes [#6](https://gitlab.com/openstapps/api/issues/6)
|
||||
|
||||
|
||||
- add method to remove references from a thing ([9cf6fde](https://gitlab.com/openstapps/api/commit/9cf6fde050c665b63026b8c08502c7836e23c2d5)), closes [#6](https://gitlab.com/openstapps/api/issues/6)
|
||||
|
||||
## [0.4.1](https://gitlab.com/openstapps/api/compare/v0.4.0...v0.4.1) (2019-03-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* adjust compile npm script to exact configuration guideline ([7f8c9ed](https://gitlab.com/openstapps/api/commit/7f8c9eda2fdcef0831af23806b846baa0d236a1c))
|
||||
|
||||
|
||||
- adjust compile npm script to exact configuration guideline ([7f8c9ed](https://gitlab.com/openstapps/api/commit/7f8c9eda2fdcef0831af23806b846baa0d236a1c))
|
||||
|
||||
# [0.4.0](https://gitlab.com/openstapps/api/compare/v0.3.0...v0.4.0) (2019-03-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* apply changes suggested by @openstapps/configuration ([782fdbe](https://gitlab.com/openstapps/api/commit/782fdbebba3599323a98244fcc28e7605ed95cc2))
|
||||
|
||||
|
||||
- apply changes suggested by @openstapps/configuration ([782fdbe](https://gitlab.com/openstapps/api/commit/782fdbebba3599323a98244fcc28e7605ed95cc2))
|
||||
|
||||
# [0.3.0](https://gitlab.com/openstapps/api/compare/v0.2.0...v0.3.0) (2019-02-21)
|
||||
|
||||
|
||||
|
||||
# [0.2.0](https://gitlab.com/openstapps/api/compare/v0.1.1...v0.2.0) (2019-02-18)
|
||||
|
||||
|
||||
|
||||
## [0.1.1](https://gitlab.com/openstapps/api/compare/v0.1.0...v0.1.1) (2019-02-07)
|
||||
|
||||
|
||||
|
||||
# [0.1.0](https://gitlab.com/openstapps/api/compare/v0.0.3...v0.1.0) (2019-01-28)
|
||||
|
||||
|
||||
|
||||
## [0.0.3](https://gitlab.com/openstapps/api/compare/v0.0.2...v0.0.3) (2019-01-21)
|
||||
|
||||
|
||||
|
||||
## [0.0.2](https://gitlab.com/openstapps/api/compare/v0.0.1...v0.0.2) (2018-12-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add type and batchSize to required parameters ([8541b00](https://gitlab.com/openstapps/api/commit/8541b00dbbf4c683fddaf3d003cf13fabfbc979b)), closes [#1](https://gitlab.com/openstapps/api/issues/1)
|
||||
* remove trailing slash from url if needed ([eb7c334](https://gitlab.com/openstapps/api/commit/eb7c334bb8878cffd96cd9d52b5b99e2338e3a65))
|
||||
|
||||
|
||||
- add type and batchSize to required parameters ([8541b00](https://gitlab.com/openstapps/api/commit/8541b00dbbf4c683fddaf3d003cf13fabfbc979b)), closes [#1](https://gitlab.com/openstapps/api/issues/1)
|
||||
- remove trailing slash from url if needed ([eb7c334](https://gitlab.com/openstapps/api/commit/eb7c334bb8878cffd96cd9d52b5b99e2338e3a65))
|
||||
|
||||
## [0.0.1](https://gitlab.com/openstapps/api/compare/4839f941c617681c78ef9959f3df86013459c332...v0.0.1) (2018-11-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add api ([4839f94](https://gitlab.com/openstapps/api/commit/4839f941c617681c78ef9959f3df86013459c332))
|
||||
|
||||
|
||||
|
||||
- add api ([4839f94](https://gitlab.com/openstapps/api/commit/4839f941c617681c78ef9959f3df86013459c332))
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
import './lib/cli.js'
|
||||
import './lib/app.js';
|
||||
|
||||
@@ -15,21 +15,18 @@
|
||||
"Roman Klopsch",
|
||||
"Thea Schöbl <dev@theaninova.de>"
|
||||
],
|
||||
"main": "lib/client.js",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"bin": {
|
||||
"openstapps-api": "app.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rimraf lib && tsc",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md && git commit -m 'docs: update changelog'",
|
||||
"check-configuration": "openstapps-configuration",
|
||||
"documentation": "typedoc --includeVersion --out docs --readme README.md --listInvalidSymbolLinks --entryPointStrategy expand src",
|
||||
"build": "tsup --dts",
|
||||
"format": "prettier .",
|
||||
"format:fix": "prettier --write .",
|
||||
"lint": "eslint --ext .ts src/",
|
||||
"postversion": "npm run changelog",
|
||||
"prepublishOnly": "npm ci && npm run build",
|
||||
"preversion": "npm run prepublishOnly",
|
||||
"push": "git push && git push origin \"v$npm_package_version\"",
|
||||
"test": "nyc mocha --recursive 'test/*.spec.ts'"
|
||||
"lint:fix": "eslint --fix --ext .ts src/",
|
||||
"test": "nyc mocha 'test/**/*.spec.ts'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@krlwlfrt/async-pool": "0.7.0",
|
||||
@@ -57,8 +54,10 @@
|
||||
"wait-on": "6.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openstapps/configuration": "workspace:*",
|
||||
"@openstapps/eslint-config": "workspace:*",
|
||||
"@openstapps/nyc-config": "workspace:*",
|
||||
"@openstapps/prettier-config": "workspace:*",
|
||||
"@openstapps/tsconfig": "workspace:*",
|
||||
"@testdeck/mocha": "0.3.3",
|
||||
"@types/body-parser": "1.19.2",
|
||||
"@types/chai": "4.3.5",
|
||||
@@ -69,55 +68,39 @@
|
||||
"@types/fs-extra": "9.0.13",
|
||||
"@types/json-schema": "7.0.11",
|
||||
"@types/mocha": "10.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "5.40.1",
|
||||
"@typescript-eslint/parser": "5.40.1",
|
||||
"chai": "4.3.7",
|
||||
"chai-as-promised": "7.1.1",
|
||||
"chai-spies": "1.0.0",
|
||||
"conventional-changelog-cli": "2.2.2",
|
||||
"eslint": "8.33.0",
|
||||
"eslint-config-prettier": "8.6.0",
|
||||
"eslint-plugin-jsdoc": "39.7.4",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"eslint-plugin-unicorn": "45.0.2",
|
||||
"fs-extra": "10.1.0",
|
||||
"mocha": "10.2.0",
|
||||
"nock": "13.3.1",
|
||||
"nyc": "15.1.0",
|
||||
"prettier": "2.8.8",
|
||||
"rimraf": "4.4.0",
|
||||
"ts-node": "10.9.1",
|
||||
"typedoc": "0.23.26",
|
||||
"tsup": "6.7.0",
|
||||
"typedoc": "0.23.28",
|
||||
"typescript": "4.8.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@openstapps/core": "~2.1.0"
|
||||
"@openstapps/core": "workspace:*"
|
||||
},
|
||||
"tsup": {
|
||||
"entry": [
|
||||
"src/app.ts",
|
||||
"src/index.ts"
|
||||
],
|
||||
"sourcemap": true,
|
||||
"clean": true,
|
||||
"format": "esm",
|
||||
"outDir": "lib"
|
||||
},
|
||||
"prettier": "@openstapps/prettier-config",
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"@openstapps"
|
||||
]
|
||||
},
|
||||
"nyc": {
|
||||
"all": true,
|
||||
"branches": 95,
|
||||
"check-coverage": true,
|
||||
"exclude": [
|
||||
"src/cli.ts"
|
||||
],
|
||||
"extension": [
|
||||
".ts"
|
||||
],
|
||||
"functions": 95,
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
"lines": 95,
|
||||
"per-file": true,
|
||||
"reporter": [
|
||||
"cobertura",
|
||||
"html",
|
||||
"text-summary"
|
||||
],
|
||||
"require": [
|
||||
"ts-node/register"
|
||||
],
|
||||
"statements": 95
|
||||
},
|
||||
"typings": "lib/index.d.ts"
|
||||
"extends": "@openstapps/nyc-config"
|
||||
}
|
||||
}
|
||||
|
||||
10
packages/api/src/index.ts
Normal file
10
packages/api/src/index.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export * from './bulk.js'
|
||||
export * from './client.js'
|
||||
export * from './connector-client.js'
|
||||
export * from './copy.js'
|
||||
export * from './e2e.js'
|
||||
export * from './errors.js'
|
||||
export * from './http-client.js'
|
||||
export * from './http-client-interface.js'
|
||||
export * from './plugin.js'
|
||||
export * from './plugin-client.js'
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Converter} from '@openstapps/core-tools/lib/schema.js';
|
||||
import {Converter} from '@openstapps/core-tools';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import bodyParser from 'body-parser';
|
||||
import express from 'express';
|
||||
|
||||
@@ -12,7 +12,14 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCBulkAddRoute, SCBulkDoneRoute, SCDish, SCMessage, SCThingOriginType, SCThingType} from '@openstapps/core';
|
||||
import {
|
||||
SCBulkAddRoute,
|
||||
SCBulkDoneRoute,
|
||||
SCDish,
|
||||
SCMessage,
|
||||
SCThingOriginType,
|
||||
SCThingType,
|
||||
} from '@openstapps/core';
|
||||
import {expect} from 'chai';
|
||||
import chai from 'chai';
|
||||
import chaiAsPromised from 'chai-as-promised';
|
||||
@@ -55,9 +62,7 @@ export class BulkSpec {
|
||||
});
|
||||
|
||||
const dish: SCDish = {
|
||||
categories: [
|
||||
'main dish',
|
||||
],
|
||||
categories: ['main dish'],
|
||||
name: 'foobar',
|
||||
origin: {
|
||||
indexed: moment().format(),
|
||||
@@ -70,9 +75,13 @@ export class BulkSpec {
|
||||
|
||||
await bulk.add(dish);
|
||||
|
||||
expect(client.invokeRoute).to.have.been.first.called.with(bulkAddRoute, {
|
||||
UID: 'bar',
|
||||
}, dish);
|
||||
expect(client.invokeRoute).to.have.been.first.called.with(
|
||||
bulkAddRoute,
|
||||
{
|
||||
UID: 'bar',
|
||||
},
|
||||
dish,
|
||||
);
|
||||
}
|
||||
|
||||
@test
|
||||
@@ -86,12 +95,8 @@ export class BulkSpec {
|
||||
});
|
||||
|
||||
const message: SCMessage = {
|
||||
audiences: [
|
||||
'students',
|
||||
],
|
||||
categories: [
|
||||
'news'
|
||||
],
|
||||
audiences: ['students'],
|
||||
categories: ['news'],
|
||||
messageBody: 'Lorem ipsum.',
|
||||
name: 'foobar',
|
||||
origin: {
|
||||
|
||||
@@ -52,10 +52,11 @@ const httpClient = new HttpClient();
|
||||
* @see https://stackoverflow.com/a/51365037
|
||||
*/
|
||||
export type RecursivePartial<T> = {
|
||||
[P in keyof T]?:
|
||||
T[P] extends Array<(infer U)> ? Array<RecursivePartial<U>> :
|
||||
T[P] extends object ? RecursivePartial<T[P]> :
|
||||
T[P];
|
||||
[P in keyof T]?: T[P] extends Array<infer U>
|
||||
? Array<RecursivePartial<U>>
|
||||
: T[P] extends object
|
||||
? RecursivePartial<T[P]>
|
||||
: T[P];
|
||||
};
|
||||
|
||||
async function invokeIndexRoute(): Promise<RecursivePartial<HttpClientResponse<SCIndexResponse>>> {
|
||||
@@ -119,12 +120,8 @@ export class ClientSpec {
|
||||
@test
|
||||
async getThing() {
|
||||
const message: SCMessage = {
|
||||
audiences: [
|
||||
'employees',
|
||||
],
|
||||
categories: [
|
||||
'news'
|
||||
],
|
||||
audiences: ['employees'],
|
||||
categories: ['news'],
|
||||
messageBody: 'Lorem ipsum.',
|
||||
name: 'foo',
|
||||
origin: {
|
||||
@@ -172,7 +169,7 @@ export class ClientSpec {
|
||||
size: 1,
|
||||
},
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: searchRoute.method,
|
||||
url: new URL('http://localhost' + searchRoute.getUrlPath()),
|
||||
@@ -210,12 +207,8 @@ export class ClientSpec {
|
||||
@test
|
||||
async getThingFailsByUid() {
|
||||
const message: SCMessage = {
|
||||
audiences: [
|
||||
'employees',
|
||||
],
|
||||
categories: [
|
||||
'news'
|
||||
],
|
||||
audiences: ['employees'],
|
||||
categories: ['news'],
|
||||
messageBody: 'Lorem ipsum.',
|
||||
name: 'foo',
|
||||
origin: {
|
||||
@@ -265,7 +258,7 @@ export class ClientSpec {
|
||||
expect(httpClient.request).to.have.been.first.called.with({
|
||||
body: {},
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: indexRoute.method,
|
||||
url: new URL('http://localhost' + indexRoute.getUrlPath()),
|
||||
@@ -285,66 +278,78 @@ export class ClientSpec {
|
||||
|
||||
@test
|
||||
async invokePlugin() {
|
||||
sandbox.on(httpClient, 'request', async(): Promise<RecursivePartial<HttpClientResponse<SCIndexResponse>>> => {
|
||||
return {
|
||||
body: {
|
||||
app: {
|
||||
features: {
|
||||
plugins: {
|
||||
"supportedPlugin": { urlPath: "/" }
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
statusCode: indexRoute.statusCodeSuccess,
|
||||
};
|
||||
});
|
||||
|
||||
expect(httpClient.request).not.to.have.been.first.called();
|
||||
const client = new Client(httpClient, 'http://localhost');
|
||||
|
||||
await client.invokePlugin('unsupportedPlugin').should.be.rejectedWith(ApiError,/.*supportedPlugin.*/gmi);
|
||||
|
||||
// again with cached feature definitions
|
||||
return client.invokePlugin('supportedPlugin')
|
||||
.should.not.be.rejectedWith(ApiError,/.*supportedPlugin.*/gmi);
|
||||
}
|
||||
|
||||
@test
|
||||
async invokePluginUnavailable() {
|
||||
sandbox.on(httpClient, 'request', async(): Promise<RecursivePartial<HttpClientResponse<SCIndexResponse>>> => {
|
||||
return {
|
||||
body: {},
|
||||
statusCode: indexRoute.statusCodeSuccess,
|
||||
};
|
||||
});
|
||||
|
||||
expect(httpClient.request).not.to.have.been.first.called();
|
||||
|
||||
const client = new Client(httpClient, 'http://localhost');
|
||||
|
||||
await client.invokePlugin('supportedPlugin').should.be.rejectedWith(ApiError,/.*supportedPlugin.*/gmi);
|
||||
|
||||
sandbox.restore();
|
||||
sandbox.on(httpClient, 'request', async(): Promise<RecursivePartial<HttpClientResponse<SCIndexResponse>>> => {
|
||||
return {
|
||||
body: {
|
||||
app: {
|
||||
features: {
|
||||
plugins: {
|
||||
'unsupportedPlugin': {
|
||||
urlPath: '/unsupported-plugin'
|
||||
sandbox.on(
|
||||
httpClient,
|
||||
'request',
|
||||
async (): Promise<RecursivePartial<HttpClientResponse<SCIndexResponse>>> => {
|
||||
return {
|
||||
body: {
|
||||
app: {
|
||||
features: {
|
||||
plugins: {
|
||||
supportedPlugin: {urlPath: '/'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
statusCode: indexRoute.statusCodeSuccess,
|
||||
};
|
||||
});
|
||||
statusCode: indexRoute.statusCodeSuccess,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
expect(httpClient.request).not.to.have.been.first.called();
|
||||
const client = new Client(httpClient, 'http://localhost');
|
||||
|
||||
await client.invokePlugin('unsupportedPlugin').should.be.rejectedWith(ApiError, /.*supportedPlugin.*/gim);
|
||||
|
||||
// again with cached feature definitions
|
||||
return client.invokePlugin('supportedPlugin')
|
||||
.should.be.rejectedWith(ApiError,/.*supportedPlugin.*/gmi);
|
||||
return client
|
||||
.invokePlugin('supportedPlugin')
|
||||
.should.not.be.rejectedWith(ApiError, /.*supportedPlugin.*/gim);
|
||||
}
|
||||
|
||||
@test
|
||||
async invokePluginUnavailable() {
|
||||
sandbox.on(
|
||||
httpClient,
|
||||
'request',
|
||||
async (): Promise<RecursivePartial<HttpClientResponse<SCIndexResponse>>> => {
|
||||
return {
|
||||
body: {},
|
||||
statusCode: indexRoute.statusCodeSuccess,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
expect(httpClient.request).not.to.have.been.first.called();
|
||||
|
||||
const client = new Client(httpClient, 'http://localhost');
|
||||
|
||||
await client.invokePlugin('supportedPlugin').should.be.rejectedWith(ApiError, /.*supportedPlugin.*/gim);
|
||||
|
||||
sandbox.restore();
|
||||
sandbox.on(
|
||||
httpClient,
|
||||
'request',
|
||||
async (): Promise<RecursivePartial<HttpClientResponse<SCIndexResponse>>> => {
|
||||
return {
|
||||
body: {
|
||||
app: {
|
||||
features: {
|
||||
plugins: {
|
||||
unsupportedPlugin: {
|
||||
urlPath: '/unsupported-plugin',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
statusCode: indexRoute.statusCodeSuccess,
|
||||
};
|
||||
},
|
||||
);
|
||||
// again with cached feature definitions
|
||||
return client.invokePlugin('supportedPlugin').should.be.rejectedWith(ApiError, /.*supportedPlugin.*/gim);
|
||||
}
|
||||
|
||||
@test
|
||||
@@ -359,7 +364,7 @@ export class ClientSpec {
|
||||
expect(httpClient.request).to.have.been.first.called.with({
|
||||
body: undefined,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: indexRoute.method,
|
||||
url: new URL('http://localhost' + indexRoute.getUrlPath()),
|
||||
@@ -420,7 +425,7 @@ export class ClientSpec {
|
||||
expect(httpClient.request).to.have.been.first.called.with({
|
||||
body: {a: {size: 1}, b: {size: 1}},
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: multiSearchRoute.method,
|
||||
url: new URL('http://localhost' + multiSearchRoute.getUrlPath()),
|
||||
@@ -470,7 +475,7 @@ export class ClientSpec {
|
||||
expect(httpClient.request).to.have.been.first.called.with({
|
||||
body: {foo: {size: 0}, bar: {size: 0}},
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: multiSearchRoute.method,
|
||||
url: new URL('http://localhost' + multiSearchRoute.getUrlPath()),
|
||||
@@ -478,7 +483,7 @@ export class ClientSpec {
|
||||
expect(httpClient.request).to.have.been.second.called.with({
|
||||
body: {foo: {size: 1000}, bar: {size: 500}, foobar: {size: 30}},
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: multiSearchRoute.method,
|
||||
url: new URL('http://localhost' + multiSearchRoute.getUrlPath()),
|
||||
@@ -541,7 +546,7 @@ export class ClientSpec {
|
||||
expect(httpClient.request).to.have.been.first.called.with({
|
||||
body: {size: 1},
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: searchRoute.method,
|
||||
url: new URL('http://localhost' + searchRoute.getUrlPath()),
|
||||
@@ -579,7 +584,7 @@ export class ClientSpec {
|
||||
expect(httpClient.request).to.have.been.first.called.with({
|
||||
body: {from: 30, size: 30},
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: searchRoute.method,
|
||||
url: new URL('http://localhost' + searchRoute.getUrlPath()),
|
||||
@@ -615,7 +620,7 @@ export class ClientSpec {
|
||||
expect(httpClient.request).to.have.been.first.called.with({
|
||||
body: {size: 0},
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: searchRoute.method,
|
||||
url: new URL('http://localhost' + searchRoute.getUrlPath()),
|
||||
@@ -623,7 +628,7 @@ export class ClientSpec {
|
||||
expect(httpClient.request).to.have.been.second.called.with({
|
||||
body: {size: 1000},
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: searchRoute.method,
|
||||
url: new URL('http://localhost' + searchRoute.getUrlPath()),
|
||||
|
||||
@@ -72,7 +72,7 @@ function doesContainThings<T extends SCThingWithoutReferences>(thing: T): boolea
|
||||
return false;
|
||||
}
|
||||
|
||||
return sum || (item === null) ? false : isThing(item);
|
||||
return sum || item === null ? false : isThing(item);
|
||||
}, false);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ export class ConnectorClientSpec {
|
||||
type: SCThingType.Message,
|
||||
},
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: bulkRoute.method,
|
||||
url: new URL('http://localhost' + bulkRoute.getUrlPath()),
|
||||
@@ -145,7 +145,7 @@ export class ConnectorClientSpec {
|
||||
type: SCThingType.Message,
|
||||
},
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: bulkRoute.method,
|
||||
url: new URL('http://localhost' + bulkRoute.getUrlPath()),
|
||||
@@ -156,12 +156,8 @@ export class ConnectorClientSpec {
|
||||
async index() {
|
||||
const messages: SCMessage[] = [
|
||||
{
|
||||
audiences: [
|
||||
'employees',
|
||||
],
|
||||
categories: [
|
||||
'news'
|
||||
],
|
||||
audiences: ['employees'],
|
||||
categories: ['news'],
|
||||
messageBody: 'Lorem ipsum.',
|
||||
name: 'foo',
|
||||
origin: {
|
||||
@@ -173,12 +169,8 @@ export class ConnectorClientSpec {
|
||||
uid: 'foo',
|
||||
},
|
||||
{
|
||||
audiences: [
|
||||
'employees',
|
||||
],
|
||||
categories: [
|
||||
'news'
|
||||
],
|
||||
audiences: ['employees'],
|
||||
categories: ['news'],
|
||||
messageBody: 'Lorem ipsum.',
|
||||
name: 'foo',
|
||||
origin: {
|
||||
@@ -193,36 +185,45 @@ export class ConnectorClientSpec {
|
||||
|
||||
type responses = SCBulkResponse | SCBulkAddResponse | SCBulkDoneResponse;
|
||||
|
||||
sandbox.on(httpClient, 'request', async (request: HttpClientRequest)
|
||||
: Promise<HttpClientResponse<responses>> => {
|
||||
if (request.url.toString() === new URL('http://localhost' + bulkRoute.getUrlPath()).toString()) {
|
||||
return {
|
||||
body: {
|
||||
expiration: moment().add(3600, 'seconds').format(),
|
||||
source: 'copy',
|
||||
state: 'in progress',
|
||||
type: SCThingType.Message,
|
||||
uid: 'foo',
|
||||
},
|
||||
headers: {},
|
||||
statusCode: bulkRoute.statusCodeSuccess,
|
||||
};
|
||||
} else if (request.url.toString() === new URL('http://localhost' + bulkAddRoute.getUrlPath({
|
||||
UID: 'foo',
|
||||
})).toString()) {
|
||||
sandbox.on(
|
||||
httpClient,
|
||||
'request',
|
||||
async (request: HttpClientRequest): Promise<HttpClientResponse<responses>> => {
|
||||
if (request.url.toString() === new URL('http://localhost' + bulkRoute.getUrlPath()).toString()) {
|
||||
return {
|
||||
body: {
|
||||
expiration: moment().add(3600, 'seconds').format(),
|
||||
source: 'copy',
|
||||
state: 'in progress',
|
||||
type: SCThingType.Message,
|
||||
uid: 'foo',
|
||||
},
|
||||
headers: {},
|
||||
statusCode: bulkRoute.statusCodeSuccess,
|
||||
};
|
||||
} else if (
|
||||
request.url.toString() ===
|
||||
new URL(
|
||||
'http://localhost' +
|
||||
bulkAddRoute.getUrlPath({
|
||||
UID: 'foo',
|
||||
}),
|
||||
).toString()
|
||||
) {
|
||||
return {
|
||||
body: {},
|
||||
headers: {},
|
||||
statusCode: bulkAddRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
body: {},
|
||||
headers: {},
|
||||
statusCode: bulkAddRoute.statusCodeSuccess,
|
||||
statusCode: bulkDoneRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
body: {},
|
||||
headers: {},
|
||||
statusCode: bulkDoneRoute.statusCodeSuccess,
|
||||
};
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
const connectorClient = new ConnectorClient(httpClient, 'http://localhost');
|
||||
await connectorClient.index(messages, 'copy');
|
||||
@@ -234,7 +235,7 @@ export class ConnectorClientSpec {
|
||||
type: SCThingType.Message,
|
||||
},
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: bulkRoute.method,
|
||||
url: new URL('http://localhost' + bulkRoute.getUrlPath()),
|
||||
@@ -251,12 +252,8 @@ export class ConnectorClientSpec {
|
||||
async indexWithoutSource() {
|
||||
const messages: SCMessage[] = [
|
||||
{
|
||||
audiences: [
|
||||
'employees',
|
||||
],
|
||||
categories: [
|
||||
'news'
|
||||
],
|
||||
audiences: ['employees'],
|
||||
categories: ['news'],
|
||||
messageBody: 'Lorem ipsum.',
|
||||
name: 'foo',
|
||||
origin: {
|
||||
@@ -268,12 +265,8 @@ export class ConnectorClientSpec {
|
||||
uid: 'foo',
|
||||
},
|
||||
{
|
||||
audiences: [
|
||||
'employees',
|
||||
],
|
||||
categories: [
|
||||
'news'
|
||||
],
|
||||
audiences: ['employees'],
|
||||
categories: ['news'],
|
||||
messageBody: 'Lorem ipsum.',
|
||||
name: 'foo',
|
||||
origin: {
|
||||
@@ -288,36 +281,45 @@ export class ConnectorClientSpec {
|
||||
|
||||
type responses = SCBulkResponse | SCBulkAddResponse | SCBulkDoneResponse;
|
||||
|
||||
sandbox.on(httpClient, 'request', async (request: HttpClientRequest)
|
||||
: Promise<HttpClientResponse<responses>> => {
|
||||
if (request.url.toString() === new URL('http://localhost' + bulkRoute.getUrlPath()).toString()) {
|
||||
return {
|
||||
body: {
|
||||
expiration: moment().add(3600, 'seconds').format(),
|
||||
source: 'stapps-api',
|
||||
state: 'in progress',
|
||||
type: SCThingType.Message,
|
||||
uid: 'foo',
|
||||
},
|
||||
headers: {},
|
||||
statusCode: bulkRoute.statusCodeSuccess,
|
||||
};
|
||||
} else if (request.url.toString() === new URL('http://localhost' + bulkAddRoute.getUrlPath({
|
||||
UID: 'foo',
|
||||
})).toString()) {
|
||||
sandbox.on(
|
||||
httpClient,
|
||||
'request',
|
||||
async (request: HttpClientRequest): Promise<HttpClientResponse<responses>> => {
|
||||
if (request.url.toString() === new URL('http://localhost' + bulkRoute.getUrlPath()).toString()) {
|
||||
return {
|
||||
body: {
|
||||
expiration: moment().add(3600, 'seconds').format(),
|
||||
source: 'stapps-api',
|
||||
state: 'in progress',
|
||||
type: SCThingType.Message,
|
||||
uid: 'foo',
|
||||
},
|
||||
headers: {},
|
||||
statusCode: bulkRoute.statusCodeSuccess,
|
||||
};
|
||||
} else if (
|
||||
request.url.toString() ===
|
||||
new URL(
|
||||
'http://localhost' +
|
||||
bulkAddRoute.getUrlPath({
|
||||
UID: 'foo',
|
||||
}),
|
||||
).toString()
|
||||
) {
|
||||
return {
|
||||
body: {},
|
||||
headers: {},
|
||||
statusCode: bulkAddRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
body: {},
|
||||
headers: {},
|
||||
statusCode: bulkAddRoute.statusCodeSuccess,
|
||||
statusCode: bulkDoneRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
body: {},
|
||||
headers: {},
|
||||
statusCode: bulkDoneRoute.statusCodeSuccess,
|
||||
};
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
const connectorClient = new ConnectorClient(httpClient, 'http://localhost');
|
||||
await connectorClient.index(messages);
|
||||
@@ -329,7 +331,7 @@ export class ConnectorClientSpec {
|
||||
type: SCThingType.Message,
|
||||
},
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: bulkRoute.method,
|
||||
url: new URL('http://localhost' + bulkRoute.getUrlPath()),
|
||||
@@ -362,12 +364,12 @@ export class ConnectorClientSpec {
|
||||
'core',
|
||||
'test',
|
||||
'resources',
|
||||
'indexable'
|
||||
'indexable',
|
||||
);
|
||||
|
||||
const testFiles = await readdirPromisified(pathToTestFiles);
|
||||
|
||||
const testInstances = await asyncPool(5, testFiles, async (testFile) => {
|
||||
const testInstances = await asyncPool(5, testFiles, async testFile => {
|
||||
const buffer = await readFilePromisified(join(pathToTestFiles, testFile));
|
||||
const content = JSON.parse(buffer.toString());
|
||||
|
||||
@@ -375,58 +377,53 @@ export class ConnectorClientSpec {
|
||||
});
|
||||
|
||||
for (const testInstance of testInstances) {
|
||||
|
||||
const checkInstance = clone()(testInstance);
|
||||
const testInstanceWithoutReferences = ConnectorClient.removeReferences(testInstance);
|
||||
|
||||
expect(doesContainThings(testInstanceWithoutReferences)).to.be
|
||||
.equal(false, JSON.stringify(
|
||||
[testInstance, testInstanceWithoutReferences],
|
||||
null,
|
||||
2,
|
||||
));
|
||||
expect((testInstanceWithoutReferences as any).origin).to.be
|
||||
.equal(undefined, JSON.stringify(
|
||||
[testInstance, testInstanceWithoutReferences],
|
||||
null,
|
||||
2,
|
||||
));
|
||||
expect(testInstance).to.be.deep
|
||||
.equal(checkInstance,
|
||||
'Removing the references of a thing could have side effects because no deep copy is used');
|
||||
expect(doesContainThings(testInstanceWithoutReferences)).to.be.equal(
|
||||
false,
|
||||
JSON.stringify([testInstance, testInstanceWithoutReferences], null, 2),
|
||||
);
|
||||
expect((testInstanceWithoutReferences as any).origin).to.be.equal(
|
||||
undefined,
|
||||
JSON.stringify([testInstance, testInstanceWithoutReferences], null, 2),
|
||||
);
|
||||
expect(testInstance).to.be.deep.equal(
|
||||
checkInstance,
|
||||
'Removing the references of a thing could have side effects because no deep copy is used',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@test
|
||||
async removeUndefinedProperties() {
|
||||
const objectWithUndefinedProperties = {value: 'foo',
|
||||
novalue: undefined,
|
||||
nested: {
|
||||
value: 'foo',
|
||||
novalue: undefined},
|
||||
};
|
||||
const objectWithoutUndefinedProperties = {value: 'foo',
|
||||
nested: {
|
||||
value: 'foo'},
|
||||
};
|
||||
const objectWithUndefinedProperties = {
|
||||
value: 'foo',
|
||||
novalue: undefined,
|
||||
nested: {
|
||||
value: 'foo',
|
||||
novalue: undefined,
|
||||
},
|
||||
};
|
||||
const objectWithoutUndefinedProperties = {
|
||||
value: 'foo',
|
||||
nested: {
|
||||
value: 'foo',
|
||||
},
|
||||
};
|
||||
ConnectorClient.removeUndefinedProperties(objectWithUndefinedProperties);
|
||||
|
||||
expect(objectWithUndefinedProperties).to.deep.equal(objectWithoutUndefinedProperties, JSON.stringify(
|
||||
[objectWithUndefinedProperties, objectWithoutUndefinedProperties],
|
||||
null,
|
||||
2,
|
||||
));
|
||||
expect(objectWithUndefinedProperties).to.deep.equal(
|
||||
objectWithoutUndefinedProperties,
|
||||
JSON.stringify([objectWithUndefinedProperties, objectWithoutUndefinedProperties], null, 2),
|
||||
);
|
||||
}
|
||||
|
||||
@test
|
||||
async update() {
|
||||
const message: SCMessage = {
|
||||
audiences: [
|
||||
'employees',
|
||||
],
|
||||
categories: [
|
||||
'news'
|
||||
],
|
||||
audiences: ['employees'],
|
||||
categories: ['news'],
|
||||
messageBody: 'Lorem ipsum.',
|
||||
name: 'foo',
|
||||
origin: {
|
||||
@@ -454,13 +451,16 @@ export class ConnectorClientSpec {
|
||||
expect(httpClient.request).to.have.been.called.with({
|
||||
body: message,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: thingUpdateRoute.method,
|
||||
url: new URL('http://localhost' + thingUpdateRoute.getUrlPath({
|
||||
TYPE: SCThingType.Message,
|
||||
UID: 'foo',
|
||||
})),
|
||||
url: new URL(
|
||||
'http://localhost' +
|
||||
thingUpdateRoute.getUrlPath({
|
||||
TYPE: SCThingType.Message,
|
||||
UID: 'foo',
|
||||
}),
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,63 +57,73 @@ export class CopySpec {
|
||||
async copy() {
|
||||
type responses = Response<SCBulkAddResponse | SCBulkDoneResponse | SCBulkResponse | SCSearchResponse>;
|
||||
|
||||
sandbox.on(httpClient, 'request', async (request: RequestOptions): Promise<RecursivePartial<responses>> => {
|
||||
if (request.url.toString() === 'http://foo.bar' + searchRoute.getUrlPath().toString()) {
|
||||
const body = request.body as SCSearchRequest;
|
||||
sandbox.on(
|
||||
httpClient,
|
||||
'request',
|
||||
async (request: RequestOptions): Promise<RecursivePartial<responses>> => {
|
||||
if (request.url.toString() === 'http://foo.bar' + searchRoute.getUrlPath().toString()) {
|
||||
const body = request.body as SCSearchRequest;
|
||||
|
||||
let count = 0;
|
||||
if (typeof body.size === 'number' && body.size > 0) {
|
||||
count = 1;
|
||||
let count = 0;
|
||||
if (typeof body.size === 'number' && body.size > 0) {
|
||||
count = 1;
|
||||
}
|
||||
|
||||
return {
|
||||
body: {
|
||||
data: [
|
||||
{
|
||||
categories: ['main dish'],
|
||||
name: 'foobar',
|
||||
origin: {
|
||||
indexed: moment().format(),
|
||||
name: 'bar',
|
||||
},
|
||||
type: SCThingType.Dish,
|
||||
uid: 'foo',
|
||||
},
|
||||
],
|
||||
facets: [],
|
||||
pagination: {
|
||||
count: count,
|
||||
offset: 0,
|
||||
total: 1,
|
||||
},
|
||||
stats: {
|
||||
time: 1,
|
||||
},
|
||||
},
|
||||
statusCode: searchRoute.statusCodeSuccess,
|
||||
};
|
||||
} else if (request.url.toString() === 'http://localhost' + bulkRoute.getUrlPath().toString()) {
|
||||
return {
|
||||
body: {
|
||||
state: 'in progress',
|
||||
uid: 'foo',
|
||||
},
|
||||
statusCode: bulkRoute.statusCodeSuccess,
|
||||
};
|
||||
} else if (
|
||||
request.url.toString() ===
|
||||
'http://localhost' +
|
||||
bulkAddRoute
|
||||
.getUrlPath({
|
||||
UID: 'foo',
|
||||
})
|
||||
.toString()
|
||||
) {
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkAddRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
body: {
|
||||
data: [{
|
||||
categories: [
|
||||
'main dish',
|
||||
],
|
||||
name: 'foobar',
|
||||
origin: {
|
||||
indexed: moment().format(),
|
||||
name: 'bar',
|
||||
},
|
||||
type: SCThingType.Dish,
|
||||
uid: 'foo',
|
||||
}],
|
||||
facets: [],
|
||||
pagination: {
|
||||
count: count,
|
||||
offset: 0,
|
||||
total: 1,
|
||||
},
|
||||
stats: {
|
||||
time: 1,
|
||||
},
|
||||
},
|
||||
statusCode: searchRoute.statusCodeSuccess,
|
||||
};
|
||||
} else if (request.url.toString() === 'http://localhost' + bulkRoute.getUrlPath().toString()) {
|
||||
return {
|
||||
body: {
|
||||
state: 'in progress',
|
||||
uid: 'foo',
|
||||
},
|
||||
statusCode: bulkRoute.statusCodeSuccess,
|
||||
};
|
||||
} else if (request.url.toString() === 'http://localhost' + bulkAddRoute.getUrlPath({
|
||||
UID: 'foo',
|
||||
}).toString()) {
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkAddRoute.statusCodeSuccess,
|
||||
statusCode: bulkDoneRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkDoneRoute.statusCodeSuccess,
|
||||
};
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
await copy(httpClient, {
|
||||
batchSize: 5,
|
||||
@@ -129,62 +139,72 @@ export class CopySpec {
|
||||
async copyShouldFail() {
|
||||
type responses = Response<SCBulkAddResponse | SCBulkDoneResponse | SCBulkResponse | SCSearchResponse>;
|
||||
|
||||
sandbox.on(httpClient, 'request', async (request: RequestOptions): Promise<RecursivePartial<responses>> => {
|
||||
if (request.url.toString() === 'http://foo.bar' + searchRoute.getUrlPath().toString()) {
|
||||
const body = request.body as SCSearchRequest;
|
||||
sandbox.on(
|
||||
httpClient,
|
||||
'request',
|
||||
async (request: RequestOptions): Promise<RecursivePartial<responses>> => {
|
||||
if (request.url.toString() === 'http://foo.bar' + searchRoute.getUrlPath().toString()) {
|
||||
const body = request.body as SCSearchRequest;
|
||||
|
||||
if (typeof body.size === 'number' && body.size > 0) {
|
||||
throw new ApiError({});
|
||||
if (typeof body.size === 'number' && body.size > 0) {
|
||||
throw new ApiError({});
|
||||
}
|
||||
|
||||
return {
|
||||
body: {
|
||||
data: [
|
||||
{
|
||||
categories: ['main dish'],
|
||||
name: 'foobar',
|
||||
origin: {
|
||||
indexed: moment().format(),
|
||||
name: 'bar',
|
||||
},
|
||||
type: SCThingType.Dish,
|
||||
uid: 'foo',
|
||||
},
|
||||
],
|
||||
facets: [],
|
||||
pagination: {
|
||||
count: 0,
|
||||
offset: 0,
|
||||
total: 1,
|
||||
},
|
||||
stats: {
|
||||
time: 1,
|
||||
},
|
||||
},
|
||||
statusCode: searchRoute.statusCodeSuccess,
|
||||
};
|
||||
} else if (request.url.toString() === 'http://localhost' + bulkRoute.getUrlPath().toString()) {
|
||||
return {
|
||||
body: {
|
||||
state: 'in progress',
|
||||
uid: 'foo',
|
||||
},
|
||||
statusCode: bulkRoute.statusCodeSuccess,
|
||||
};
|
||||
} else if (
|
||||
request.url.toString() ===
|
||||
'http://localhost' +
|
||||
bulkAddRoute
|
||||
.getUrlPath({
|
||||
UID: 'foo',
|
||||
})
|
||||
.toString()
|
||||
) {
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkAddRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
body: {
|
||||
data: [{
|
||||
categories: [
|
||||
'main dish',
|
||||
],
|
||||
name: 'foobar',
|
||||
origin: {
|
||||
indexed: moment().format(),
|
||||
name: 'bar',
|
||||
},
|
||||
type: SCThingType.Dish,
|
||||
uid: 'foo',
|
||||
}],
|
||||
facets: [],
|
||||
pagination: {
|
||||
count: 0,
|
||||
offset: 0,
|
||||
total: 1,
|
||||
},
|
||||
stats: {
|
||||
time: 1,
|
||||
},
|
||||
},
|
||||
statusCode: searchRoute.statusCodeSuccess,
|
||||
};
|
||||
} else if (request.url.toString() === 'http://localhost' + bulkRoute.getUrlPath().toString()) {
|
||||
return {
|
||||
body: {
|
||||
state: 'in progress',
|
||||
uid: 'foo',
|
||||
},
|
||||
statusCode: bulkRoute.statusCodeSuccess,
|
||||
};
|
||||
} else if (request.url.toString() === 'http://localhost' + bulkAddRoute.getUrlPath({
|
||||
UID: 'foo',
|
||||
}).toString()) {
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkAddRoute.statusCodeSuccess,
|
||||
statusCode: bulkDoneRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkDoneRoute.statusCodeSuccess,
|
||||
};
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
return copy(httpClient, {
|
||||
batchSize: 5,
|
||||
|
||||
@@ -80,80 +80,93 @@ export class E2EConnectorSpec {
|
||||
let failOnCompare = false;
|
||||
let failOnLookup = false;
|
||||
|
||||
sandbox.on(httpClient, 'request', async (request: RequestOptions): Promise<RecursivePartial<responses>> => {
|
||||
if (request.url.toString() === `http://localhost${bulkRoute.getUrlPath().toString()}`) {
|
||||
|
||||
return {
|
||||
body: {
|
||||
state: 'in progress',
|
||||
uid: 'foo',
|
||||
},
|
||||
statusCode: bulkRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
if (request.url.toString() === `http://localhost${bulkAddRoute.getUrlPath({UID: 'foo'}).toString()}`) {
|
||||
storedThings.set(request.body.uid, clone()(request.body));
|
||||
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkAddRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
if (request.url.toString() === `http://localhost${bulkDoneRoute.getUrlPath({UID: 'foo'}).toString()}`) {
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkDoneRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
if (request.url.toString() === `http://localhost${searchRoute.getUrlPath().toString()}`) {
|
||||
const thing = storedThings.get(request.body.filter.arguments.value);
|
||||
if (failOnCompare) {
|
||||
thing!.origin!.modified = 'altered';
|
||||
sandbox.on(
|
||||
httpClient,
|
||||
'request',
|
||||
async (request: RequestOptions): Promise<RecursivePartial<responses>> => {
|
||||
if (request.url.toString() === `http://localhost${bulkRoute.getUrlPath().toString()}`) {
|
||||
return {
|
||||
body: {
|
||||
state: 'in progress',
|
||||
uid: 'foo',
|
||||
},
|
||||
statusCode: bulkRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
if (
|
||||
request.url.toString() === `http://localhost${bulkAddRoute.getUrlPath({UID: 'foo'}).toString()}`
|
||||
) {
|
||||
storedThings.set(request.body.uid, clone()(request.body));
|
||||
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkAddRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
if (
|
||||
request.url.toString() === `http://localhost${bulkDoneRoute.getUrlPath({UID: 'foo'}).toString()}`
|
||||
) {
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkDoneRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
if (request.url.toString() === `http://localhost${searchRoute.getUrlPath().toString()}`) {
|
||||
const thing = storedThings.get(request.body.filter.arguments.value);
|
||||
if (failOnCompare) {
|
||||
thing!.origin!.modified = 'altered';
|
||||
}
|
||||
const returnThing = failOnLookup ? [] : [thing];
|
||||
const returnBody = {
|
||||
data: returnThing,
|
||||
facets: [],
|
||||
pagination: {
|
||||
count: returnThing.length,
|
||||
offset: 0,
|
||||
total: returnThing.length,
|
||||
},
|
||||
stats: {
|
||||
time: 42,
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
body: returnBody,
|
||||
statusCode: searchRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
const returnThing = failOnLookup ? [] : [thing];
|
||||
const returnBody = {
|
||||
data: returnThing,
|
||||
facets: [],
|
||||
pagination: {
|
||||
count: returnThing.length,
|
||||
offset: 0,
|
||||
total: returnThing.length,
|
||||
},
|
||||
stats: {
|
||||
time: 42,
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
body: returnBody,
|
||||
body: {},
|
||||
statusCode: searchRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
body: {},
|
||||
statusCode: searchRoute.statusCodeSuccess,
|
||||
};
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
// tslint:disable-next-line: max-line-length
|
||||
await e2eRun(httpClient, {to: 'http://localhost', samplesLocation: './node_modules/@openstapps/core/test/resources'});
|
||||
await e2eRun(httpClient, {
|
||||
to: 'http://localhost',
|
||||
samplesLocation: './node_modules/@openstapps/core/test/resources',
|
||||
});
|
||||
|
||||
failOnLookup = true;
|
||||
failOnCompare = false;
|
||||
// tslint:disable-next-line: max-line-length
|
||||
await e2eRun(httpClient, {to: 'http://localhost', samplesLocation: './node_modules/@openstapps/core/test/resources'})
|
||||
.should.be.rejectedWith('Search for single SCThing with uid');
|
||||
await e2eRun(httpClient, {
|
||||
to: 'http://localhost',
|
||||
samplesLocation: './node_modules/@openstapps/core/test/resources',
|
||||
}).should.be.rejectedWith('Search for single SCThing with uid');
|
||||
|
||||
failOnLookup = false;
|
||||
failOnCompare = true;
|
||||
// tslint:disable-next-line: max-line-length
|
||||
await e2eRun(httpClient, {to: 'http://localhost', samplesLocation: './node_modules/@openstapps/core/test/resources'})
|
||||
.should.be.rejectedWith('Unexpected difference');
|
||||
|
||||
await e2eRun(httpClient, {
|
||||
to: 'http://localhost',
|
||||
samplesLocation: './node_modules/@openstapps/core/test/resources',
|
||||
}).should.be.rejectedWith('Unexpected difference');
|
||||
}
|
||||
|
||||
@test
|
||||
@@ -161,7 +174,6 @@ export class E2EConnectorSpec {
|
||||
type responses = Response<SCBulkAddResponse | SCBulkDoneResponse | SCBulkResponse>;
|
||||
|
||||
sandbox.on(httpClient, 'request', async (): Promise<RecursivePartial<responses>> => {
|
||||
|
||||
return {
|
||||
body: {},
|
||||
statusCode: Number.MAX_SAFE_INTEGER,
|
||||
@@ -169,8 +181,10 @@ export class E2EConnectorSpec {
|
||||
});
|
||||
|
||||
// tslint:disable-next-line: max-line-length
|
||||
return e2eRun(httpClient, {to: 'http://localhost', samplesLocation: './node_modules/@openstapps/core/test/resources'})
|
||||
.should.be.rejectedWith(ApiError);
|
||||
return e2eRun(httpClient, {
|
||||
to: 'http://localhost',
|
||||
samplesLocation: './node_modules/@openstapps/core/test/resources',
|
||||
}).should.be.rejectedWith(ApiError);
|
||||
}
|
||||
|
||||
@test
|
||||
@@ -179,8 +193,9 @@ export class E2EConnectorSpec {
|
||||
if (!existsSync(emptyDirPath)) {
|
||||
mkdirSync(emptyDirPath);
|
||||
}
|
||||
await e2eRun(httpClient, {to: 'http://localhost', samplesLocation: emptyDirPath})
|
||||
.should.be.rejectedWith('Could not index samples. None were retrieved from the file system.');
|
||||
await e2eRun(httpClient, {to: 'http://localhost', samplesLocation: emptyDirPath}).should.be.rejectedWith(
|
||||
'Could not index samples. None were retrieved from the file system.',
|
||||
);
|
||||
rmdirSync(emptyDirPath);
|
||||
}
|
||||
|
||||
@@ -190,10 +205,12 @@ export class E2EConnectorSpec {
|
||||
if (!existsSync(somewhatFilledDirPath)) {
|
||||
mkdirSync(somewhatFilledDirPath);
|
||||
}
|
||||
const nonJsonFile = join (somewhatFilledDirPath, 'nonjson.txt');
|
||||
const nonJsonFile = join(somewhatFilledDirPath, 'nonjson.txt');
|
||||
createFileSync(nonJsonFile);
|
||||
await e2eRun(httpClient, {to: 'http://localhost', samplesLocation: somewhatFilledDirPath})
|
||||
.should.be.rejectedWith('Could not index samples. None were retrieved from the file system.');
|
||||
await e2eRun(httpClient, {
|
||||
to: 'http://localhost',
|
||||
samplesLocation: somewhatFilledDirPath,
|
||||
}).should.be.rejectedWith('Could not index samples. None were retrieved from the file system.');
|
||||
unlinkSync(nonJsonFile);
|
||||
rmdirSync(somewhatFilledDirPath);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import {HttpClient} from '../src/http-client.js';
|
||||
|
||||
@suite()
|
||||
export class HttpClientSpec {
|
||||
|
||||
@test
|
||||
async construct() {
|
||||
expect(() => {
|
||||
@@ -37,9 +36,7 @@ export class HttpClientSpec {
|
||||
async request() {
|
||||
const client = new HttpClient();
|
||||
|
||||
nock('http://www.example.com')
|
||||
.get('/resource')
|
||||
.reply(200, 'foo');
|
||||
nock('http://www.example.com').get('/resource').reply(200, 'foo');
|
||||
|
||||
const response = await client.request({
|
||||
url: new URL('http://www.example.com/resource'),
|
||||
@@ -52,12 +49,10 @@ export class HttpClientSpec {
|
||||
async requestWithBody() {
|
||||
const client = new HttpClient();
|
||||
|
||||
nock('http://www.example.com')
|
||||
.get('/resource')
|
||||
.reply(200, 'foo');
|
||||
nock('http://www.example.com').get('/resource').reply(200, 'foo');
|
||||
|
||||
const response = await client.request({
|
||||
url: new URL('http://www.example.com/resource')
|
||||
url: new URL('http://www.example.com/resource'),
|
||||
});
|
||||
|
||||
expect(response.body).to.be.equal('foo');
|
||||
@@ -68,9 +63,7 @@ export class HttpClientSpec {
|
||||
const client = new HttpClient();
|
||||
let caughtErr;
|
||||
|
||||
nock('http://www.example.com')
|
||||
.get('/resource')
|
||||
.replyWithError('foo');
|
||||
nock('http://www.example.com').get('/resource').replyWithError('foo');
|
||||
|
||||
try {
|
||||
await client.request({
|
||||
@@ -90,9 +83,7 @@ export class HttpClientSpec {
|
||||
async requestWithHeaders() {
|
||||
const client = new HttpClient();
|
||||
|
||||
nock('http://www.example.com')
|
||||
.get('/resource')
|
||||
.reply(200, 'foo');
|
||||
nock('http://www.example.com').get('/resource').reply(200, 'foo');
|
||||
|
||||
const response = await client.request({
|
||||
headers: {
|
||||
@@ -108,9 +99,7 @@ export class HttpClientSpec {
|
||||
async requestWithMethodGet() {
|
||||
const client = new HttpClient();
|
||||
|
||||
nock('http://www.example.com')
|
||||
.get('/resource')
|
||||
.reply(200, 'foo');
|
||||
nock('http://www.example.com').get('/resource').reply(200, 'foo');
|
||||
|
||||
const response = await client.request({
|
||||
method: 'GET',
|
||||
@@ -124,9 +113,7 @@ export class HttpClientSpec {
|
||||
async requestWithMethodPost() {
|
||||
const client = new HttpClient();
|
||||
|
||||
nock('http://www.example.com')
|
||||
.post('/resource')
|
||||
.reply(200, 'foo');
|
||||
nock('http://www.example.com').post('/resource').reply(200, 'foo');
|
||||
|
||||
const response = await client.request({
|
||||
method: 'POST',
|
||||
|
||||
@@ -41,7 +41,21 @@ export class PluginClientSpec {
|
||||
}
|
||||
|
||||
static async before() {
|
||||
this.plugin = new TestPlugin(4000, '', '', '', '', {getSchema: () => {/***/}} as any, '', '', '');
|
||||
this.plugin = new TestPlugin(
|
||||
4000,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
{
|
||||
getSchema: () => {
|
||||
/***/
|
||||
},
|
||||
} as any,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
);
|
||||
}
|
||||
|
||||
async after() {
|
||||
@@ -78,7 +92,7 @@ export class PluginClientSpec {
|
||||
expect(httpClient.request).to.have.been.first.called.with({
|
||||
body: request,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: pluginRegisterRoute.method,
|
||||
url: new URL(`http://localhost${pluginRegisterRoute.getUrlPath()}`),
|
||||
@@ -102,14 +116,14 @@ export class PluginClientSpec {
|
||||
await pluginClient.unregisterPlugin(PluginClientSpec.plugin);
|
||||
|
||||
const request: SCPluginRegisterRequest = {
|
||||
action: 'remove',
|
||||
route: PluginClientSpec.plugin.route,
|
||||
action: 'remove',
|
||||
route: PluginClientSpec.plugin.route,
|
||||
};
|
||||
|
||||
expect(httpClient.request).to.have.been.first.called.with({
|
||||
body: request,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: pluginRegisterRoute.method,
|
||||
url: new URL(`http://localhost${pluginRegisterRoute.getUrlPath()}`),
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface TestPluginResponse {
|
||||
export interface TestPluginResponse {
|
||||
/**
|
||||
* Query dummy
|
||||
*/
|
||||
query: string;
|
||||
query: string;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import {TestPlugin} from './plugin-resources/test-plugin.js';
|
||||
|
||||
chai.use(chaiSpies);
|
||||
|
||||
process.on('unhandledRejection', (err) => {
|
||||
process.on('unhandledRejection', err => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
@@ -42,10 +42,21 @@ export class PluginSpec {
|
||||
}
|
||||
|
||||
static async before() {
|
||||
PluginSpec.testPlugin = new TestPlugin(4000, '', '', '', '', {
|
||||
getSchema: () => {/***/
|
||||
},
|
||||
} as any, '', '', '');
|
||||
PluginSpec.testPlugin = new TestPlugin(
|
||||
4000,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
{
|
||||
getSchema: () => {
|
||||
/***/
|
||||
},
|
||||
} as any,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
);
|
||||
}
|
||||
|
||||
async after() {
|
||||
@@ -54,9 +65,12 @@ export class PluginSpec {
|
||||
|
||||
@test
|
||||
async construct() {
|
||||
const converter = new Converter(__dirname, resolve(__dirname,'plugin-resources','test-plugin-response.ts'));
|
||||
const converter = new Converter(
|
||||
__dirname,
|
||||
resolve(__dirname, 'plugin-resources', 'test-plugin-response.ts'),
|
||||
);
|
||||
|
||||
sandbox.on(converter, 'getSchema', (schemaName) => {
|
||||
sandbox.on(converter, 'getSchema', schemaName => {
|
||||
return {$id: schemaName};
|
||||
});
|
||||
|
||||
@@ -98,10 +112,21 @@ export class PluginSpec {
|
||||
|
||||
@test
|
||||
async fullUrl() {
|
||||
const constructTestPlugin = new TestPlugin(4001, '', 'http://B', '', '', {
|
||||
getSchema: () => {/***/
|
||||
},
|
||||
} as any, '', '', '');
|
||||
const constructTestPlugin = new TestPlugin(
|
||||
4001,
|
||||
'',
|
||||
'http://B',
|
||||
'',
|
||||
'',
|
||||
{
|
||||
getSchema: () => {
|
||||
/***/
|
||||
},
|
||||
} as any,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
);
|
||||
expect(constructTestPlugin.fullUrl).to.be.equal('http://B:4001');
|
||||
await constructTestPlugin.close();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"extends": "./node_modules/@openstapps/configuration/tsconfig.json"
|
||||
"extends": "@openstapps/tsconfig"
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
@@ -1,2 +0,0 @@
|
||||
resources
|
||||
openapi
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "@openstapps"
|
||||
}
|
||||
95
packages/collection-utils/.gitignore
vendored
95
packages/collection-utils/.gitignore
vendored
@@ -1,95 +0,0 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
.DS_Store
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# nuxt.js build output
|
||||
.nuxt
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
#DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
########## end of https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||
|
||||
# ignore ide files
|
||||
.idea
|
||||
.vscode
|
||||
|
||||
# ignore lib
|
||||
lib
|
||||
|
||||
# ignore docs
|
||||
docs
|
||||
|
||||
# report directory
|
||||
report
|
||||
@@ -1,200 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
|
||||
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
13. Use with the GNU Affero General Public License.
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||
14. Revised Versions of this License.
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
16. Limitation of Liability.
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/ licenses/why-not-lgpl.html>.
|
||||
@@ -2,25 +2,47 @@
|
||||
"name": "@openstapps/collection-utils",
|
||||
"version": "2.1.0",
|
||||
"type": "module",
|
||||
"license": "GPL-3.0-only",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"build": "rimraf lib && tsc",
|
||||
"build": "tsup --dts",
|
||||
"format": "prettier .",
|
||||
"format:fix": "prettier --write .",
|
||||
"test": "mocha --require ts-node/register test/*.spec.ts"
|
||||
"lint": "eslint --ext .ts src/",
|
||||
"lint:fix": "eslint --fix --ext .ts src/",
|
||||
"test": "nyc mocha 'test/**/*.spec.ts'"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openstapps/configuration": "workspace:*",
|
||||
"@openstapps/eslint-config": "workspace:*",
|
||||
"@openstapps/nyc-config": "workspace:*",
|
||||
"@openstapps/prettier-config": "workspace:*",
|
||||
"@openstapps/tsconfig": "workspace:*",
|
||||
"@types/chai": "4.3.4",
|
||||
"@types/mocha": "10.0.1",
|
||||
"@types/node": "18.15.3",
|
||||
"chai": "4.3.7",
|
||||
"eslint": "8.33.0",
|
||||
"mocha": "10.2.0",
|
||||
"prettier": "2.8.3",
|
||||
"rimraf": "4.4.0",
|
||||
"ts-node": "10.9.1",
|
||||
"tsup": "6.7.0",
|
||||
"typescript": "4.8.4"
|
||||
}
|
||||
},
|
||||
"tsup": {
|
||||
"entry": [
|
||||
"src/index.ts"
|
||||
],
|
||||
"sourcemap": true,
|
||||
"clean": true,
|
||||
"format": "esm",
|
||||
"outDir": "lib"
|
||||
},
|
||||
"prettier": "@openstapps/prettier-config",
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"@openstapps"
|
||||
]
|
||||
},
|
||||
"nyc": {
|
||||
"extends": "@openstapps/nyc-config"
|
||||
},
|
||||
"exports": "./lib/index.js"
|
||||
}
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
/**
|
||||
* Returns the difference between two arrays.
|
||||
*/
|
||||
export function differenceBy<T>(
|
||||
a: T[],
|
||||
b: T[],
|
||||
transform: (item: T) => unknown
|
||||
) {
|
||||
export function differenceBy<T>(a: T[], b: T[], transform: (item: T) => unknown) {
|
||||
const disallowed = new Set(b.map(transform));
|
||||
|
||||
return a.filter((item) => !disallowed.has(transform(item)));
|
||||
return a.filter(item => !disallowed.has(transform(item)));
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
* If the path doesn't exist, undefined is returned.
|
||||
*/
|
||||
export function get<U = unknown>(object: object, path: string): U {
|
||||
return path.split(".").reduce(
|
||||
return path.split('.').reduce(
|
||||
(accumulator, current) =>
|
||||
accumulator?.hasOwnProperty(current)
|
||||
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(accumulator as any)[current]
|
||||
: undefined,
|
||||
object
|
||||
object,
|
||||
) as unknown as U;
|
||||
}
|
||||
|
||||
@@ -16,12 +16,9 @@
|
||||
/**
|
||||
* Group an array by a function
|
||||
*/
|
||||
export function groupBy<T>(
|
||||
collection: T[],
|
||||
group: (item: T) => string | undefined
|
||||
): Record<string, T[]> {
|
||||
export function groupBy<T>(collection: T[], group: (item: T) => string | undefined): Record<string, T[]> {
|
||||
return collection.reduce((accumulator: Record<string, T[]>, item) => {
|
||||
const key = group(item) ?? "";
|
||||
const key = group(item) ?? '';
|
||||
accumulator[key] = accumulator[key] ?? [];
|
||||
accumulator[key].push(item);
|
||||
return accumulator;
|
||||
@@ -31,12 +28,9 @@ export function groupBy<T>(
|
||||
/**
|
||||
* Group an array by a function (returns a Map, whose keys keep order info of items entry)
|
||||
*/
|
||||
export function groupByStable<T>(
|
||||
collection: T[],
|
||||
group: (item: T) => string | undefined
|
||||
): Map<string, T[]> {
|
||||
export function groupByStable<T>(collection: T[], group: (item: T) => string | undefined): Map<string, T[]> {
|
||||
return collection.reduce((accumulator: Map<string, T[]>, item) => {
|
||||
const key = group(item) ?? "";
|
||||
const key = group(item) ?? '';
|
||||
accumulator.set(key, accumulator.get(key) ?? []);
|
||||
accumulator.get(key)?.push(item);
|
||||
return accumulator;
|
||||
@@ -46,9 +40,6 @@ export function groupByStable<T>(
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export function groupByProperty<T extends object>(
|
||||
collection: T[],
|
||||
property: keyof T
|
||||
): Record<string, T[]> {
|
||||
return groupBy(collection, (item) => item[property] as unknown as string);
|
||||
export function groupByProperty<T extends object>(collection: T[], property: keyof T): Record<string, T[]> {
|
||||
return groupBy(collection, item => item[property] as unknown as string);
|
||||
}
|
||||
|
||||
16
packages/collection-utils/src/index.ts
Normal file
16
packages/collection-utils/src/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export * from './chunk.js';
|
||||
export * from './difference.js';
|
||||
export * from './get.js';
|
||||
export * from './group-by.js';
|
||||
export * from './key-by.js';
|
||||
export * from './map-values.js';
|
||||
export * from './min.js';
|
||||
export * from './omit.js';
|
||||
export * from './partition.js';
|
||||
export * from './pick.js';
|
||||
export * from './shuffle.js';
|
||||
export * from './string-sort.js';
|
||||
export * from './sum.js';
|
||||
export * from './tree-group.js';
|
||||
export * from './uniq.js';
|
||||
export * from './zip.js';
|
||||
@@ -19,10 +19,7 @@
|
||||
* each key is the last element responsible for generating the key. The
|
||||
* iteratee is invoked with one argument: (value).
|
||||
*/
|
||||
export function keyBy<T>(
|
||||
collection: T[],
|
||||
key: (item: T) => string | number
|
||||
): Record<string, T> {
|
||||
export function keyBy<T>(collection: T[], key: (item: T) => string | number): Record<string, T> {
|
||||
return collection.reduce((accumulator, item) => {
|
||||
accumulator[key(item)] = item;
|
||||
return accumulator;
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
export function mapValues<T extends object, U>(
|
||||
object: T,
|
||||
transform: (value: T[keyof T], key: keyof T) => U
|
||||
): { [key in keyof T]: U } {
|
||||
const result = {} as { [key in keyof T]: U };
|
||||
transform: (value: T[keyof T], key: keyof T) => U,
|
||||
): {[key in keyof T]: U} {
|
||||
const result = {} as {[key in keyof T]: U};
|
||||
|
||||
for (const key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
|
||||
@@ -16,11 +16,8 @@
|
||||
/**
|
||||
* Returns the minimum value of a collection.
|
||||
*/
|
||||
export function minBy<T>(
|
||||
array: T[],
|
||||
transform: (item: T) => number | undefined
|
||||
): T {
|
||||
export function minBy<T>(array: T[], transform: (item: T) => number | undefined): T {
|
||||
const transforms = array.map(transform);
|
||||
const min = Math.min(...(transforms.filter((it) => !!it) as number[]));
|
||||
const min = Math.min(...(transforms.filter(it => !!it) as number[]));
|
||||
return array.find((_, i) => transforms[i] === min) as T;
|
||||
}
|
||||
|
||||
@@ -16,11 +16,8 @@
|
||||
/**
|
||||
* Returns a new object without the specified keys.
|
||||
*/
|
||||
export function omit<T extends object, U extends keyof T>(
|
||||
object: T,
|
||||
...keys: U[]
|
||||
): Omit<T, U> {
|
||||
const out = { ...object };
|
||||
export function omit<T extends object, U extends keyof T>(object: T, ...keys: U[]): Omit<T, U> {
|
||||
const out = {...object};
|
||||
for (const key of keys) delete out[key];
|
||||
return out as Exclude<T, U>;
|
||||
}
|
||||
|
||||
@@ -17,15 +17,12 @@
|
||||
* Partitions a list into two lists. One with the elements that satisfy a predicate,
|
||||
* and one with the elements that don't satisfy the predicate.
|
||||
*/
|
||||
export function partition<T>(
|
||||
array: T[],
|
||||
transform: (item: T) => boolean
|
||||
): [T[], T[]] {
|
||||
export function partition<T>(array: T[], transform: (item: T) => boolean): [T[], T[]] {
|
||||
return array.reduce<[T[], T[]]>(
|
||||
(accumulator, item) => {
|
||||
accumulator[transform(item) ? 0 : 1].push(item);
|
||||
return accumulator;
|
||||
},
|
||||
[[], []]
|
||||
[[], []],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,10 +16,7 @@
|
||||
/**
|
||||
* Pick a set of properties from an object
|
||||
*/
|
||||
export function pick<T extends object, U extends keyof T>(
|
||||
object: T,
|
||||
keys: U[]
|
||||
): Pick<T, U> {
|
||||
export function pick<T extends object, U extends keyof T>(object: T, keys: U[]): Pick<T, U> {
|
||||
return keys.reduce((accumulator, key) => {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
accumulator[key] = object[key];
|
||||
@@ -33,7 +30,7 @@ export function pick<T extends object, U extends keyof T>(
|
||||
*/
|
||||
export function pickBy<T extends object, U extends keyof T>(
|
||||
object: T,
|
||||
predicate: (value: T[U], key: U) => boolean
|
||||
predicate: (value: T[U], key: U) => boolean,
|
||||
): Pick<T, U> {
|
||||
return (Object.keys(object) as U[]).reduce((accumulator, key) => {
|
||||
if (predicate(object[key], key)) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
/**
|
||||
* sort function for two strings
|
||||
*/
|
||||
export function stringSort(a = "", b = ""): number {
|
||||
export function stringSort(a = '', b = ''): number {
|
||||
if (a < b) return -1;
|
||||
if (a > b) return 1;
|
||||
return 0;
|
||||
@@ -25,12 +25,10 @@ export function stringSort(a = "", b = ""): number {
|
||||
/**
|
||||
* sort function for two strings that allows for a custom transform
|
||||
*/
|
||||
export function stringSortBy<T>(
|
||||
map: (item: T) => string | undefined
|
||||
): (a: T, b: T) => number {
|
||||
export function stringSortBy<T>(map: (item: T) => string | undefined): (a: T, b: T) => number {
|
||||
return (a: T, b: T): number => {
|
||||
const aValue = map(a) || "";
|
||||
const bValue = map(b) || "";
|
||||
const aValue = map(a) || '';
|
||||
const bValue = map(b) || '';
|
||||
if (aValue < bValue) return -1;
|
||||
if (aValue > bValue) return 1;
|
||||
return 0;
|
||||
|
||||
@@ -18,20 +18,14 @@
|
||||
*/
|
||||
export function sumBy<T extends object>(
|
||||
collection: T[],
|
||||
transform: (value: T) => number | undefined
|
||||
transform: (value: T) => number | undefined,
|
||||
): number {
|
||||
return collection.reduce(
|
||||
(accumulator, item) => accumulator + (transform(item) || 0),
|
||||
0
|
||||
);
|
||||
return collection.reduce((accumulator, item) => accumulator + (transform(item) || 0), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sum an array of numbers
|
||||
*/
|
||||
export function sum(collection: Array<number | undefined>): number {
|
||||
return collection.reduce<number>(
|
||||
(accumulator, item) => accumulator + (item || 0),
|
||||
0
|
||||
);
|
||||
return collection.reduce<number>((accumulator, item) => accumulator + (item || 0), 0);
|
||||
}
|
||||
|
||||
@@ -22,10 +22,7 @@ export type Tree<T> = {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export function treeGroupBy<T>(
|
||||
items: T[],
|
||||
transform: (item: T) => string[]
|
||||
): Tree<T> {
|
||||
export function treeGroupBy<T>(items: T[], transform: (item: T) => string[]): Tree<T> {
|
||||
const tree: Tree<T> = {};
|
||||
|
||||
for (const item of items) {
|
||||
|
||||
@@ -16,14 +16,11 @@
|
||||
/**
|
||||
* Filter out duplicates from an array.
|
||||
*/
|
||||
export function uniqBy<T>(
|
||||
array: T[],
|
||||
transform: (item: T) => string | number
|
||||
): T[] {
|
||||
export function uniqBy<T>(array: T[], transform: (item: T) => string | number): T[] {
|
||||
return Object.values(
|
||||
array.reduce((accumulator, current) => {
|
||||
accumulator[transform(current)] = current;
|
||||
return accumulator;
|
||||
}, {} as Record<string | number, T>)
|
||||
}, {} as Record<string | number, T>),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,16 +13,11 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { chunk } from "../src/chunk.js";
|
||||
import { expect } from "chai";
|
||||
import {chunk} from '../src/chunk.js';
|
||||
import {expect} from 'chai';
|
||||
|
||||
describe("chunk", function () {
|
||||
it("should chunk items in the correct sizes", function () {
|
||||
expect(chunk([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3)).to.deep.equal([
|
||||
[1, 2, 3],
|
||||
[4, 5, 6],
|
||||
[7, 8, 9],
|
||||
[10],
|
||||
]);
|
||||
describe('chunk', function () {
|
||||
it('should chunk items in the correct sizes', function () {
|
||||
expect(chunk([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3)).to.deep.equal([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { differenceBy } from "../src/difference.js";
|
||||
import { expect } from "chai";
|
||||
import {differenceBy} from '../src/difference.js';
|
||||
import {expect} from 'chai';
|
||||
|
||||
describe("differenceBy", function () {
|
||||
it("should return the difference of two arrays", function () {
|
||||
describe('differenceBy', function () {
|
||||
it('should return the difference of two arrays', function () {
|
||||
const a = [1, 2, 3, 4, 5];
|
||||
const b = [1, 2, 3];
|
||||
|
||||
expect(differenceBy(a, b, (it) => it)).to.deep.equal([4, 5]);
|
||||
expect(differenceBy(a, b, it => it)).to.deep.equal([4, 5]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,29 +12,29 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { get } from "../src/get.js";
|
||||
import { expect } from "chai";
|
||||
import {get} from '../src/get.js';
|
||||
import {expect} from 'chai';
|
||||
|
||||
describe("get", function () {
|
||||
it("should get a simple path", function () {
|
||||
describe('get', function () {
|
||||
it('should get a simple path', function () {
|
||||
const object = {
|
||||
a: {
|
||||
b: {
|
||||
c: "d",
|
||||
c: 'd',
|
||||
},
|
||||
},
|
||||
};
|
||||
expect(get(object, "a.b.c")).to.equal("d");
|
||||
expect(get(object, 'a.b.c')).to.equal('d');
|
||||
});
|
||||
|
||||
it("should return undefined for a non-existent path", function () {
|
||||
it('should return undefined for a non-existent path', function () {
|
||||
const object = {
|
||||
a: {
|
||||
b: {
|
||||
c: "d",
|
||||
c: 'd',
|
||||
},
|
||||
},
|
||||
};
|
||||
expect(get(object, "a.b.c.d")).to.be.undefined;
|
||||
expect(get(object, 'a.b.c.d')).to.be.undefined;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,113 +12,113 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { groupBy, groupByStable, groupByProperty } from "../src/group-by.js";
|
||||
import { expect } from "chai";
|
||||
import {groupBy, groupByStable, groupByProperty} from '../src/group-by.js';
|
||||
import {expect} from 'chai';
|
||||
|
||||
describe("groupBy", () => {
|
||||
it("should group an array by a key", () => {
|
||||
describe('groupBy', () => {
|
||||
it('should group an array by a key', () => {
|
||||
const array = [
|
||||
{ id: 1, name: "one" },
|
||||
{ id: 2, name: "two" },
|
||||
{ id: 3, name: "three" },
|
||||
{ id: 4, name: "four" },
|
||||
{ id: 5, name: "five" },
|
||||
{id: 1, name: 'one'},
|
||||
{id: 2, name: 'two'},
|
||||
{id: 3, name: 'three'},
|
||||
{id: 4, name: 'four'},
|
||||
{id: 5, name: 'five'},
|
||||
];
|
||||
|
||||
const result = groupBy(array, (it) => it.name);
|
||||
const result = groupBy(array, it => it.name);
|
||||
|
||||
expect(result).to.deep.equal({
|
||||
one: [{ id: 1, name: "one" }],
|
||||
two: [{ id: 2, name: "two" }],
|
||||
three: [{ id: 3, name: "three" }],
|
||||
four: [{ id: 4, name: "four" }],
|
||||
five: [{ id: 5, name: "five" }],
|
||||
one: [{id: 1, name: 'one'}],
|
||||
two: [{id: 2, name: 'two'}],
|
||||
three: [{id: 3, name: 'three'}],
|
||||
four: [{id: 4, name: 'four'}],
|
||||
five: [{id: 5, name: 'five'}],
|
||||
});
|
||||
});
|
||||
|
||||
it("should handle multiple elements per group", () => {
|
||||
it('should handle multiple elements per group', () => {
|
||||
const array = [
|
||||
{ id: 1, name: "one" },
|
||||
{ id: 2, name: "two" },
|
||||
{ id: 3, name: "three" },
|
||||
{ id: 4, name: "four" },
|
||||
{ id: 5, name: "five" },
|
||||
{ id: 6, name: "one" },
|
||||
{ id: 7, name: "two" },
|
||||
{ id: 8, name: "three" },
|
||||
{ id: 9, name: "four" },
|
||||
{ id: 10, name: "five" },
|
||||
{id: 1, name: 'one'},
|
||||
{id: 2, name: 'two'},
|
||||
{id: 3, name: 'three'},
|
||||
{id: 4, name: 'four'},
|
||||
{id: 5, name: 'five'},
|
||||
{id: 6, name: 'one'},
|
||||
{id: 7, name: 'two'},
|
||||
{id: 8, name: 'three'},
|
||||
{id: 9, name: 'four'},
|
||||
{id: 10, name: 'five'},
|
||||
];
|
||||
|
||||
const result = groupBy(array, (it) => it.name);
|
||||
const result = groupBy(array, it => it.name);
|
||||
|
||||
expect(result).to.deep.equal({
|
||||
one: [
|
||||
{ id: 1, name: "one" },
|
||||
{ id: 6, name: "one" },
|
||||
{id: 1, name: 'one'},
|
||||
{id: 6, name: 'one'},
|
||||
],
|
||||
two: [
|
||||
{ id: 2, name: "two" },
|
||||
{ id: 7, name: "two" },
|
||||
{id: 2, name: 'two'},
|
||||
{id: 7, name: 'two'},
|
||||
],
|
||||
three: [
|
||||
{ id: 3, name: "three" },
|
||||
{ id: 8, name: "three" },
|
||||
{id: 3, name: 'three'},
|
||||
{id: 8, name: 'three'},
|
||||
],
|
||||
four: [
|
||||
{ id: 4, name: "four" },
|
||||
{ id: 9, name: "four" },
|
||||
{id: 4, name: 'four'},
|
||||
{id: 9, name: 'four'},
|
||||
],
|
||||
five: [
|
||||
{ id: 5, name: "five" },
|
||||
{ id: 10, name: "five" },
|
||||
{id: 5, name: 'five'},
|
||||
{id: 10, name: 'five'},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("groupByStable", () => {
|
||||
describe('groupByStable', () => {
|
||||
const array = [
|
||||
{ id: 2, name: "two" },
|
||||
{ id: 4, name: "three" },
|
||||
{ id: 3, name: "three" },
|
||||
{ id: 1, name: "one" },
|
||||
{id: 2, name: 'two'},
|
||||
{id: 4, name: 'three'},
|
||||
{id: 3, name: 'three'},
|
||||
{id: 1, name: 'one'},
|
||||
];
|
||||
const result = groupByStable(array, (it) => it.name);
|
||||
const result = groupByStable(array, it => it.name);
|
||||
|
||||
it("should group an array by keys", () => {
|
||||
expect(result.get("one")).to.deep.equal([{ id: 1, name: "one" }]);
|
||||
expect(result.get("two")).to.deep.equal([{ id: 2, name: "two" }]);
|
||||
expect(result.get("three")).to.deep.equal([
|
||||
{ id: 4, name: "three" },
|
||||
{ id: 3, name: "three" },
|
||||
it('should group an array by keys', () => {
|
||||
expect(result.get('one')).to.deep.equal([{id: 1, name: 'one'}]);
|
||||
expect(result.get('two')).to.deep.equal([{id: 2, name: 'two'}]);
|
||||
expect(result.get('three')).to.deep.equal([
|
||||
{id: 4, name: 'three'},
|
||||
{id: 3, name: 'three'},
|
||||
]);
|
||||
});
|
||||
|
||||
it("should provide ordered keys", () => {
|
||||
it('should provide ordered keys', () => {
|
||||
// eslint-disable-next-line unicorn/prefer-spread
|
||||
expect(Array.from(result.keys())).to.deep.equal(["two", "three", "one"]);
|
||||
expect(Array.from(result.keys())).to.deep.equal(['two', 'three', 'one']);
|
||||
});
|
||||
});
|
||||
|
||||
describe("groupByProperty", function () {
|
||||
it("should group by property", () => {
|
||||
describe('groupByProperty', function () {
|
||||
it('should group by property', () => {
|
||||
const array = [
|
||||
{ id: 1, name: "one" },
|
||||
{ id: 2, name: "two" },
|
||||
{ id: 3, name: "three" },
|
||||
{ id: 4, name: "four" },
|
||||
{ id: 5, name: "five" },
|
||||
{id: 1, name: 'one'},
|
||||
{id: 2, name: 'two'},
|
||||
{id: 3, name: 'three'},
|
||||
{id: 4, name: 'four'},
|
||||
{id: 5, name: 'five'},
|
||||
];
|
||||
|
||||
const result = groupByProperty(array, "name");
|
||||
const result = groupByProperty(array, 'name');
|
||||
|
||||
expect(result).to.deep.equal({
|
||||
one: [{ id: 1, name: "one" }],
|
||||
two: [{ id: 2, name: "two" }],
|
||||
three: [{ id: 3, name: "three" }],
|
||||
four: [{ id: 4, name: "four" }],
|
||||
five: [{ id: 5, name: "five" }],
|
||||
one: [{id: 1, name: 'one'}],
|
||||
two: [{id: 2, name: 'two'}],
|
||||
three: [{id: 3, name: 'three'}],
|
||||
four: [{id: 4, name: 'four'}],
|
||||
five: [{id: 5, name: 'five'}],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,30 +12,30 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { keyBy } from "../src/key-by.js";
|
||||
import { expect } from "chai";
|
||||
import {keyBy} from '../src/key-by.js';
|
||||
import {expect} from 'chai';
|
||||
|
||||
describe("keyBy", function () {
|
||||
it("should key objects", function () {
|
||||
describe('keyBy', function () {
|
||||
it('should key objects', function () {
|
||||
const objects = [
|
||||
{
|
||||
id: 1,
|
||||
name: "foo",
|
||||
name: 'foo',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "bar",
|
||||
name: 'bar',
|
||||
},
|
||||
];
|
||||
const result = keyBy(objects, (it) => it.id);
|
||||
const result = keyBy(objects, it => it.id);
|
||||
expect(result).to.deep.equal({
|
||||
1: {
|
||||
id: 1,
|
||||
name: "foo",
|
||||
name: 'foo',
|
||||
},
|
||||
2: {
|
||||
id: 2,
|
||||
name: "bar",
|
||||
name: 'bar',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { mapValues } from "../src/map-values.js";
|
||||
import { expect } from "chai";
|
||||
import {mapValues} from '../src/map-values.js';
|
||||
import {expect} from 'chai';
|
||||
|
||||
describe("map-values", () => {
|
||||
it("should map values", () => {
|
||||
describe('map-values', () => {
|
||||
it('should map values', () => {
|
||||
const object = {
|
||||
a: 1,
|
||||
b: 2,
|
||||
c: 3,
|
||||
};
|
||||
|
||||
const result = mapValues(object, (value) => value * 2);
|
||||
const result = mapValues(object, value => value * 2);
|
||||
|
||||
expect(result).to.deep.equal({
|
||||
a: 2,
|
||||
@@ -32,14 +32,14 @@ describe("map-values", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should not modify the original object", () => {
|
||||
it('should not modify the original object', () => {
|
||||
const object = {
|
||||
a: 1,
|
||||
b: 2,
|
||||
c: 3,
|
||||
};
|
||||
|
||||
mapValues(object, (value) => value * 2);
|
||||
mapValues(object, value => value * 2);
|
||||
|
||||
expect(object).to.deep.equal({
|
||||
a: 1,
|
||||
|
||||
@@ -12,33 +12,33 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { minBy } from "../src/min.js";
|
||||
import { expect } from "chai";
|
||||
import {minBy} from '../src/min.js';
|
||||
import {expect} from 'chai';
|
||||
|
||||
describe("minBy", function () {
|
||||
it("should pick the minimum value based on transform", function () {
|
||||
describe('minBy', function () {
|
||||
it('should pick the minimum value based on transform', function () {
|
||||
expect(
|
||||
minBy(
|
||||
[
|
||||
{ id: 1, name: "A" },
|
||||
{ id: 2, name: "B" },
|
||||
{ id: 3, name: "C" },
|
||||
{id: 1, name: 'A'},
|
||||
{id: 2, name: 'B'},
|
||||
{id: 3, name: 'C'},
|
||||
],
|
||||
(it) => it.id
|
||||
)
|
||||
).to.deep.equal({ id: 1, name: "A" });
|
||||
it => it.id,
|
||||
),
|
||||
).to.deep.equal({id: 1, name: 'A'});
|
||||
});
|
||||
|
||||
it("should not return undefined if there are other choices", function () {
|
||||
it('should not return undefined if there are other choices', function () {
|
||||
expect(
|
||||
minBy(
|
||||
[
|
||||
{ id: undefined, name: "B" },
|
||||
{ id: 1, name: "A" },
|
||||
{ id: undefined, name: "C" },
|
||||
{id: undefined, name: 'B'},
|
||||
{id: 1, name: 'A'},
|
||||
{id: undefined, name: 'C'},
|
||||
],
|
||||
(it) => it.id
|
||||
)
|
||||
).to.deep.equal({ id: 1, name: "A" });
|
||||
it => it.id,
|
||||
),
|
||||
).to.deep.equal({id: 1, name: 'A'});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { omit } from "../src/omit.js";
|
||||
import { expect } from "chai";
|
||||
import {omit} from '../src/omit.js';
|
||||
import {expect} from 'chai';
|
||||
|
||||
describe("omit", function () {
|
||||
it("should omit keys", function () {
|
||||
const object = { a: 1, b: 2, c: 3 };
|
||||
const result = omit(object, "a", "c");
|
||||
expect(result).to.deep.equal({ b: 2 });
|
||||
describe('omit', function () {
|
||||
it('should omit keys', function () {
|
||||
const object = {a: 1, b: 2, c: 3};
|
||||
const result = omit(object, 'a', 'c');
|
||||
expect(result).to.deep.equal({b: 2});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { partition } from "../src/partition.js";
|
||||
import { expect } from "chai";
|
||||
import {partition} from '../src/partition.js';
|
||||
import {expect} from 'chai';
|
||||
|
||||
describe("partition", function () {
|
||||
it("should partition an array", function () {
|
||||
expect(partition([1, 2, 3, 4], (it) => it % 2 === 0)).to.deep.equal([
|
||||
describe('partition', function () {
|
||||
it('should partition an array', function () {
|
||||
expect(partition([1, 2, 3, 4], it => it % 2 === 0)).to.deep.equal([
|
||||
[2, 4],
|
||||
[1, 3],
|
||||
]);
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { pick } from "../src/pick.js";
|
||||
import { expect } from "chai";
|
||||
import {pick} from '../src/pick.js';
|
||||
import {expect} from 'chai';
|
||||
|
||||
describe("pick", function () {
|
||||
it("should pick properties", function () {
|
||||
const object = { a: 1, b: 2, c: 3 };
|
||||
const result = pick(object, ["a", "c"]);
|
||||
expect(result).to.deep.equal({ a: 1, c: 3 });
|
||||
describe('pick', function () {
|
||||
it('should pick properties', function () {
|
||||
const object = {a: 1, b: 2, c: 3};
|
||||
const result = pick(object, ['a', 'c']);
|
||||
expect(result).to.deep.equal({a: 1, c: 3});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { shuffle } from "../src/shuffle.js";
|
||||
import { expect } from "chai";
|
||||
import {shuffle} from '../src/shuffle.js';
|
||||
import {expect} from 'chai';
|
||||
|
||||
describe("shuffle", function () {
|
||||
it("should shuffle an array", function () {
|
||||
describe('shuffle', function () {
|
||||
it('should shuffle an array', function () {
|
||||
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
const shuffled = shuffle(array);
|
||||
expect(shuffled).not.to.deep.equal(array);
|
||||
expect(shuffled).to.contain.members(array);
|
||||
});
|
||||
|
||||
it("should not modify the original array", function () {
|
||||
it('should not modify the original array', function () {
|
||||
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
shuffle(array);
|
||||
expect(array).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
||||
|
||||
@@ -12,31 +12,19 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { stringSort, stringSortBy } from "../src/string-sort.js";
|
||||
import { expect } from "chai";
|
||||
import {stringSort, stringSortBy} from '../src/string-sort.js';
|
||||
import {expect} from 'chai';
|
||||
|
||||
describe("stringSort", () => {
|
||||
it("should sort an array of strings", () => {
|
||||
expect(["a", "c", "b", "d"].sort(stringSort)).to.deep.equal([
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"d",
|
||||
]);
|
||||
describe('stringSort', () => {
|
||||
it('should sort an array of strings', () => {
|
||||
expect(['a', 'c', 'b', 'd'].sort(stringSort)).to.deep.equal(['a', 'b', 'c', 'd']);
|
||||
});
|
||||
});
|
||||
|
||||
describe("stringSortBy", () => {
|
||||
it("should sort an array of strings", () => {
|
||||
describe('stringSortBy', () => {
|
||||
it('should sort an array of strings', () => {
|
||||
expect(
|
||||
[{ item: "a" }, { item: "c" }, { item: "b" }, { item: "d" }].sort(
|
||||
stringSortBy((it) => it.item)
|
||||
)
|
||||
).to.deep.equal([
|
||||
{ item: "a" },
|
||||
{ item: "b" },
|
||||
{ item: "c" },
|
||||
{ item: "d" },
|
||||
]);
|
||||
[{item: 'a'}, {item: 'c'}, {item: 'b'}, {item: 'd'}].sort(stringSortBy(it => it.item)),
|
||||
).to.deep.equal([{item: 'a'}, {item: 'b'}, {item: 'c'}, {item: 'd'}]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,21 +12,21 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { expect } from "chai";
|
||||
import { sum, sumBy } from "../src/sum.js";
|
||||
import {expect} from 'chai';
|
||||
import {sum, sumBy} from '../src/sum.js';
|
||||
|
||||
describe("sum", () => {
|
||||
it("should return the sum of all elements in the collection", () => {
|
||||
describe('sum', () => {
|
||||
it('should return the sum of all elements in the collection', () => {
|
||||
const collection = [1, 2, 3, 4, 5];
|
||||
const result = sum(collection);
|
||||
expect(result).to.equal(15);
|
||||
});
|
||||
});
|
||||
|
||||
describe("sumBy", function () {
|
||||
it("should return the sum of all elements in the collection", () => {
|
||||
const collection = [{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }, { a: 5 }];
|
||||
const result = sumBy(collection, (it) => it.a);
|
||||
describe('sumBy', function () {
|
||||
it('should return the sum of all elements in the collection', () => {
|
||||
const collection = [{a: 1}, {a: 2}, {a: 3}, {a: 4}, {a: 5}];
|
||||
const result = sumBy(collection, it => it.a);
|
||||
expect(result).to.equal(15);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,34 +12,34 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { expect } from "chai";
|
||||
import { Tree, treeGroupBy } from "../src/tree-group.js";
|
||||
import {expect} from 'chai';
|
||||
import {Tree, treeGroupBy} from '../src/tree-group.js';
|
||||
|
||||
interface TestItem {
|
||||
id: number;
|
||||
path?: string[];
|
||||
}
|
||||
|
||||
describe("tree-group", function () {
|
||||
it("should create a tree", function () {
|
||||
describe('tree-group', function () {
|
||||
it('should create a tree', function () {
|
||||
const items: Array<TestItem> = [
|
||||
{
|
||||
id: 1,
|
||||
path: ["a", "b", "c"],
|
||||
path: ['a', 'b', 'c'],
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
path: ["a", "b", "d"],
|
||||
path: ['a', 'b', 'd'],
|
||||
},
|
||||
];
|
||||
|
||||
const tree = treeGroupBy(items, (item) => item.path ?? []);
|
||||
const tree = treeGroupBy(items, item => item.path ?? []);
|
||||
|
||||
const expectedTree: Tree<TestItem> = {
|
||||
a: {
|
||||
b: {
|
||||
c: { _: [items[0]] },
|
||||
d: { _: [items[1]] },
|
||||
c: {_: [items[0]]},
|
||||
d: {_: [items[1]]},
|
||||
} as Tree<TestItem>,
|
||||
} as Tree<TestItem>,
|
||||
} as Tree<TestItem>;
|
||||
@@ -47,23 +47,23 @@ describe("tree-group", function () {
|
||||
expect(tree).to.deep.equal(expectedTree);
|
||||
});
|
||||
|
||||
it("should also sort empty paths", () => {
|
||||
it('should also sort empty paths', () => {
|
||||
const items: Array<TestItem> = [
|
||||
{
|
||||
id: 1,
|
||||
path: ["a", "b", "c"],
|
||||
path: ['a', 'b', 'c'],
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
},
|
||||
];
|
||||
|
||||
const tree = treeGroupBy(items, (item) => item.path ?? []);
|
||||
const tree = treeGroupBy(items, item => item.path ?? []);
|
||||
|
||||
const expectedTree: Tree<TestItem> = {
|
||||
a: {
|
||||
b: {
|
||||
c: { _: [items[0]] },
|
||||
c: {_: [items[0]]},
|
||||
} as Tree<TestItem>,
|
||||
} as Tree<TestItem>,
|
||||
_: [items[1]],
|
||||
|
||||
@@ -12,15 +12,13 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { expect } from "chai";
|
||||
import { uniqBy } from "../src/uniq.js";
|
||||
import {expect} from 'chai';
|
||||
import {uniqBy} from '../src/uniq.js';
|
||||
|
||||
describe("uniq", function () {
|
||||
it("should return an array with unique values", function () {
|
||||
const array = [
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
];
|
||||
const result = uniqBy(array, (it) => it);
|
||||
describe('uniq', function () {
|
||||
it('should return an array with unique values', function () {
|
||||
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
const result = uniqBy(array, it => it);
|
||||
expect(result).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { expect } from "chai";
|
||||
import { zip } from "../src/zip.js";
|
||||
import {expect} from 'chai';
|
||||
import {zip} from '../src/zip.js';
|
||||
|
||||
describe("zip", function () {
|
||||
it("should zip arrays together", function () {
|
||||
describe('zip', function () {
|
||||
it('should zip arrays together', function () {
|
||||
expect(zip([1, 2, 3], [4, 5, 6])).to.deep.equal([
|
||||
[1, 4],
|
||||
[2, 5],
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"extends": "./node_modules/@openstapps/configuration/tsconfig.json"
|
||||
"extends": "@openstapps/tsconfig"
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
@@ -1,2 +0,0 @@
|
||||
resources
|
||||
openapi
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "@openstapps"
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
image: registry.gitlab.com/openstapps/projectmanagement/node
|
||||
|
||||
|
||||
before_script:
|
||||
- npm ci
|
||||
|
||||
|
||||
@@ -2,35 +2,29 @@
|
||||
|
||||
(Summarize the bug encountered concisely)
|
||||
|
||||
|
||||
## Steps to reproduce
|
||||
|
||||
(How one can reproduce the issue - this is very important)
|
||||
|
||||
|
||||
## Example Project
|
||||
|
||||
(If possible, please create an example project here on GitLab.com that exhibits the problematic behaviour, and link to it here in the bug report)
|
||||
|
||||
(If you are using an older version of GitLab, this will also determine whether the bug has been fixed in a more recent version)
|
||||
|
||||
|
||||
## What is the current bug behavior?
|
||||
|
||||
(What actually happens)
|
||||
|
||||
|
||||
## What is the expected correct behavior?
|
||||
|
||||
(What you should see instead)
|
||||
|
||||
|
||||
## Relevant logs and/or screenshots
|
||||
|
||||
(Paste any relevant logs - please use code blocks (```) to format console output,
|
||||
logs, and code as it's very hard to read otherwise.)
|
||||
|
||||
|
||||
## Possible fixes
|
||||
|
||||
(If you can, link to the line of code that might be responsible for the problem)
|
||||
|
||||
@@ -2,15 +2,12 @@
|
||||
|
||||
(Describe the feature that you're requesting concisely)
|
||||
|
||||
|
||||
## Explanation
|
||||
|
||||
(Explain why the feature is necessary)
|
||||
|
||||
|
||||
## Dependencies, issues to be resolved beforehand
|
||||
|
||||
(List issues or dependencies that need to be resolved before this feature can be implemented)
|
||||
|
||||
|
||||
/label ~meeting
|
||||
|
||||
@@ -1,353 +1,228 @@
|
||||
# [0.34.0](https://gitlab.com/openstapps/core-tools/compare/v0.33.0...v0.34.0) (2023-01-30)
|
||||
|
||||
|
||||
|
||||
# [0.33.0](https://gitlab.com/openstapps/core-tools/compare/v0.32.0...v0.33.0) (2023-01-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* convert schema glob path to posix path ([c3d66b3](https://gitlab.com/openstapps/core-tools/commit/c3d66b36c8b4bdf84b3e23cd0ab8318d3fd068f9))
|
||||
|
||||
|
||||
- convert schema glob path to posix path ([c3d66b3](https://gitlab.com/openstapps/core-tools/commit/c3d66b36c8b4bdf84b3e23cd0ab8318d3fd068f9))
|
||||
|
||||
# [0.32.0](https://gitlab.com/openstapps/core-tools/compare/v0.31.0...v0.32.0) (2022-08-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* documentation not beeing generated ([51ae246](https://gitlab.com/openstapps/core-tools/commit/51ae246a0fd10144cf6af348bc7ded88e6dab27a))
|
||||
|
||||
|
||||
- documentation not beeing generated ([51ae246](https://gitlab.com/openstapps/core-tools/commit/51ae246a0fd10144cf6af348bc7ded88e6dab27a))
|
||||
|
||||
# [0.31.0](https://gitlab.com/openstapps/core-tools/compare/v0.30.1...v0.31.0) (2022-06-27)
|
||||
|
||||
|
||||
|
||||
## [0.30.1](https://gitlab.com/openstapps/core-tools/compare/v0.30.0...v0.30.1) (2022-05-27)
|
||||
|
||||
|
||||
|
||||
# [0.30.0](https://gitlab.com/openstapps/core-tools/compare/v0.29.1...v0.30.0) (2022-04-04)
|
||||
|
||||
|
||||
|
||||
## [0.29.1](https://gitlab.com/openstapps/core-tools/compare/v0.29.0...v0.29.1) (2022-03-21)
|
||||
|
||||
|
||||
|
||||
# [0.29.0](https://gitlab.com/openstapps/core-tools/compare/v0.28.0...v0.29.0) (2022-01-25)
|
||||
|
||||
|
||||
|
||||
# [0.28.0](https://gitlab.com/openstapps/core-tools/compare/v0.27.0...v0.28.0) (2021-12-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ajv related tranistive build errors ([e82f4e9](https://gitlab.com/openstapps/core-tools/commit/e82f4e92099359baed5ea89f64bd7204700c2785))
|
||||
|
||||
|
||||
- ajv related tranistive build errors ([e82f4e9](https://gitlab.com/openstapps/core-tools/commit/e82f4e92099359baed5ea89f64bd7204700c2785))
|
||||
|
||||
# [0.27.0](https://gitlab.com/openstapps/core-tools/compare/v0.26.0...v0.27.0) (2021-12-15)
|
||||
|
||||
|
||||
|
||||
# [0.26.0](https://gitlab.com/openstapps/core-tools/compare/v0.25.0...v0.26.0) (2021-12-15)
|
||||
|
||||
|
||||
|
||||
# [0.25.0](https://gitlab.com/openstapps/core-tools/compare/v0.24.3...v0.25.0) (2021-08-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* generate schemas for type aliases ([96e3acf](https://gitlab.com/openstapps/core-tools/commit/96e3acf9ba330c3414eb1e38b347ca9e597fee88))
|
||||
|
||||
|
||||
- generate schemas for type aliases ([96e3acf](https://gitlab.com/openstapps/core-tools/commit/96e3acf9ba330c3414eb1e38b347ca9e597fee88))
|
||||
|
||||
## [0.24.3](https://gitlab.com/openstapps/core-tools/compare/v0.24.2...v0.24.3) (2021-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add cruical Converter ceation option ([f82b465](https://gitlab.com/openstapps/core-tools/commit/f82b4652637808abf68f1e72b1de0c76b228457a))
|
||||
|
||||
|
||||
- add cruical Converter ceation option ([f82b465](https://gitlab.com/openstapps/core-tools/commit/f82b4652637808abf68f1e72b1de0c76b228457a))
|
||||
|
||||
## [0.24.2](https://gitlab.com/openstapps/core-tools/compare/v0.24.1...v0.24.2) (2021-08-25)
|
||||
|
||||
|
||||
|
||||
## [0.24.1](https://gitlab.com/openstapps/core-tools/compare/v0.24.0...v0.24.1) (2021-08-25)
|
||||
|
||||
|
||||
|
||||
# [0.24.0](https://gitlab.com/openstapps/core-tools/compare/v0.23.2...v0.24.0) (2021-08-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* modernize core-tools ([fe59204](https://gitlab.com/openstapps/core-tools/commit/fe59204b4210831b15445fa9aa7dbc20de75e96d))
|
||||
|
||||
|
||||
- modernize core-tools ([fe59204](https://gitlab.com/openstapps/core-tools/commit/fe59204b4210831b15445fa9aa7dbc20de75e96d))
|
||||
|
||||
## [0.23.2](https://gitlab.com/openstapps/core-tools/compare/v0.23.0...v0.23.2) (2021-08-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* rollback ajv version to 6.12.6 ([7a5d2bb](https://gitlab.com/openstapps/core-tools/commit/7a5d2bb1e98b41d1143fbfe21b29e3aef2133c8f))
|
||||
|
||||
|
||||
- rollback ajv version to 6.12.6 ([7a5d2bb](https://gitlab.com/openstapps/core-tools/commit/7a5d2bb1e98b41d1143fbfe21b29e3aef2133c8f))
|
||||
|
||||
# [0.23.0](https://gitlab.com/openstapps/core-tools/compare/v0.22.0...v0.23.0) (2021-07-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* replace route markdown with openapi ([f4bf7ab](https://gitlab.com/openstapps/core-tools/commit/f4bf7abc895f87a57fa34b2269311809f2a9413d))
|
||||
|
||||
|
||||
- replace route markdown with openapi ([f4bf7ab](https://gitlab.com/openstapps/core-tools/commit/f4bf7abc895f87a57fa34b2269311809f2a9413d))
|
||||
|
||||
# [0.22.0](https://gitlab.com/openstapps/core-tools/compare/v0.21.0...v0.22.0) (2021-07-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix inherited properties not working correctly ([f20038c](https://gitlab.com/openstapps/core-tools/commit/f20038c8f9a37424fd7a95484e744e0c672f5cfb))
|
||||
|
||||
|
||||
- fix inherited properties not working correctly ([f20038c](https://gitlab.com/openstapps/core-tools/commit/f20038c8f9a37424fd7a95484e744e0c672f5cfb))
|
||||
|
||||
# [0.21.0](https://gitlab.com/openstapps/core-tools/compare/v0.20.0...v0.21.0) (2021-05-12)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for non-external premaps ([7429806](https://gitlab.com/openstapps/core-tools/commit/74298065e0386c8e4646e565e5e383b5ae08dfaa))
|
||||
|
||||
|
||||
- add support for non-external premaps ([7429806](https://gitlab.com/openstapps/core-tools/commit/74298065e0386c8e4646e565e5e383b5ae08dfaa))
|
||||
|
||||
# [0.20.0](https://gitlab.com/openstapps/core-tools/compare/v0.19.0...v0.20.0) (2021-04-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add filterable annotation option for integer ([7ba8233](https://gitlab.com/openstapps/core-tools/commit/7ba8233f5b81f4ab3c3aeec2c8a47a7bad3ae502))
|
||||
|
||||
|
||||
- add filterable annotation option for integer ([7ba8233](https://gitlab.com/openstapps/core-tools/commit/7ba8233f5b81f4ab3c3aeec2c8a47a7bad3ae502))
|
||||
|
||||
# [0.19.0](https://gitlab.com/openstapps/core-tools/compare/v0.18.0...v0.19.0) (2021-04-06)
|
||||
|
||||
|
||||
|
||||
# [0.18.0](https://gitlab.com/openstapps/core-tools/compare/v0.17.0...v0.18.0) (2021-03-24)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* make Point type sortable in Elasticsearch ([724a686](https://gitlab.com/openstapps/core-tools/commit/724a6866c80a544dec4ce11d70d648bd724f9aba))
|
||||
|
||||
|
||||
- make Point type sortable in Elasticsearch ([724a686](https://gitlab.com/openstapps/core-tools/commit/724a6866c80a544dec4ce11d70d648bd724f9aba))
|
||||
|
||||
# [0.17.0](https://gitlab.com/openstapps/core-tools/compare/v0.16.0...v0.17.0) (2020-12-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for [@inherit](https://gitlab.com/inherit)Tags ([485430b](https://gitlab.com/openstapps/core-tools/commit/485430b7f27fb9c751a6f5697e74eb5531ac7889))
|
||||
* add support for date mapping ([a09be1d](https://gitlab.com/openstapps/core-tools/commit/a09be1d941df88826ccaa8aa468680ece29d35a5))
|
||||
|
||||
|
||||
- add support for [@inherit](https://gitlab.com/inherit)Tags ([485430b](https://gitlab.com/openstapps/core-tools/commit/485430b7f27fb9c751a6f5697e74eb5531ac7889))
|
||||
- add support for date mapping ([a09be1d](https://gitlab.com/openstapps/core-tools/commit/a09be1d941df88826ccaa8aa468680ece29d35a5))
|
||||
|
||||
# [0.16.0](https://gitlab.com/openstapps/core-tools/compare/v0.15.0...v0.16.0) (2020-10-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use value type in IndexSignature type instead of key type ([b7cdb6a](https://gitlab.com/openstapps/core-tools/commit/b7cdb6a9ad2bdb1fc09d0f535daf4ec778501fec))
|
||||
|
||||
|
||||
- use value type in IndexSignature type instead of key type ([b7cdb6a](https://gitlab.com/openstapps/core-tools/commit/b7cdb6a9ad2bdb1fc09d0f535daf4ec778501fec))
|
||||
|
||||
# [0.15.0](https://gitlab.com/openstapps/core-tools/compare/v0.14.0...v0.15.0) (2020-10-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* array tags did not propagate ([e5511d0](https://gitlab.com/openstapps/core-tools/commit/e5511d07386e93b032b5dbefa3e6cc46c07219ed))
|
||||
|
||||
|
||||
- array tags did not propagate ([e5511d0](https://gitlab.com/openstapps/core-tools/commit/e5511d07386e93b032b5dbefa3e6cc46c07219ed))
|
||||
|
||||
# [0.14.0](https://gitlab.com/openstapps/core-tools/compare/v0.13.0...v0.14.0) (2020-02-11)
|
||||
|
||||
|
||||
|
||||
# [0.13.0](https://gitlab.com/openstapps/core-tools/compare/v0.12.0...v0.13.0) (2020-01-28)
|
||||
|
||||
|
||||
|
||||
# [0.12.0](https://gitlab.com/openstapps/core-tools/compare/v0.11.0...v0.12.0) (2019-12-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* make fields with index signatures a dynamic mapping ([8f5570e](https://gitlab.com/openstapps/core-tools/commit/8f5570e2e2d350d6153b34f940f4cd5c407b5bc9))
|
||||
|
||||
|
||||
- make fields with index signatures a dynamic mapping ([8f5570e](https://gitlab.com/openstapps/core-tools/commit/8f5570e2e2d350d6153b34f940f4cd5c407b5bc9))
|
||||
|
||||
# [0.11.0](https://gitlab.com/openstapps/core-tools/compare/v0.10.0...v0.11.0) (2019-11-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use .raw field for aggregations ([4c1a374](https://gitlab.com/openstapps/core-tools/commit/4c1a374a9ee266884bd33e8a3b3f52fcef8f4019))
|
||||
|
||||
|
||||
- use .raw field for aggregations ([4c1a374](https://gitlab.com/openstapps/core-tools/commit/4c1a374a9ee266884bd33e8a3b3f52fcef8f4019))
|
||||
|
||||
# [0.10.0](https://gitlab.com/openstapps/core-tools/compare/v0.9.0...v0.10.0) (2019-11-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* make mapping of generics work correctly ([8f7201e](https://gitlab.com/openstapps/core-tools/commit/8f7201e2cf010ed9ef457d9cf938167a4e970963)), closes [#27](https://gitlab.com/openstapps/core-tools/issues/27)
|
||||
* make mapping tags work for overwritten values ([47361d4](https://gitlab.com/openstapps/core-tools/commit/47361d412a92ae34dc1b81298402d6b441b4f4ba))
|
||||
|
||||
- make mapping of generics work correctly ([8f7201e](https://gitlab.com/openstapps/core-tools/commit/8f7201e2cf010ed9ef457d9cf938167a4e970963)), closes [#27](https://gitlab.com/openstapps/core-tools/issues/27)
|
||||
- make mapping tags work for overwritten values ([47361d4](https://gitlab.com/openstapps/core-tools/commit/47361d412a92ae34dc1b81298402d6b441b4f4ba))
|
||||
|
||||
### Features
|
||||
|
||||
* generate aggreations from annotations in the core ([18ad651](https://gitlab.com/openstapps/core-tools/commit/18ad651286bafcbc929e14ee9429c7b852d86f3b))
|
||||
|
||||
|
||||
- generate aggreations from annotations in the core ([18ad651](https://gitlab.com/openstapps/core-tools/commit/18ad651286bafcbc929e14ee9429c7b852d86f3b))
|
||||
|
||||
# [0.9.0](https://gitlab.com/openstapps/core-tools/compare/v0.8.0...v0.9.0) (2019-09-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* read type tags correctly after the first time ([77e4914](https://gitlab.com/openstapps/core-tools/commit/77e49146c0619566919815bd5d63ddf34dc19387))
|
||||
|
||||
- read type tags correctly after the first time ([77e4914](https://gitlab.com/openstapps/core-tools/commit/77e49146c0619566919815bd5d63ddf34dc19387))
|
||||
|
||||
### Features
|
||||
|
||||
* add support for [@filterable](https://gitlab.com/filterable) tag ([36bf17e](https://gitlab.com/openstapps/core-tools/commit/36bf17e3236a555e6d1193466141be880b280db9))
|
||||
|
||||
|
||||
- add support for [@filterable](https://gitlab.com/filterable) tag ([36bf17e](https://gitlab.com/openstapps/core-tools/commit/36bf17e3236a555e6d1193466141be880b280db9))
|
||||
|
||||
# [0.8.0](https://gitlab.com/openstapps/core-tools/compare/v0.7.0...v0.8.0) (2019-07-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* apply stricter tslint rules ([967f946](https://gitlab.com/openstapps/core-tools/commit/967f94652723d8589b7f272454185449233ac838))
|
||||
* emend the imports in the test files ([53e8047](https://gitlab.com/openstapps/core-tools/commit/53e80476c85027194cf406ad87fe8950d6c2f3a8))
|
||||
* remove duplicate job ([af904a7](https://gitlab.com/openstapps/core-tools/commit/af904a7a05de56cdef6aea136a7e3bb237c4beb2))
|
||||
* update the uml job to use our node image ([a478715](https://gitlab.com/openstapps/core-tools/commit/a478715d8045dd26cd345ba3cbb469fda651b84f))
|
||||
|
||||
- apply stricter tslint rules ([967f946](https://gitlab.com/openstapps/core-tools/commit/967f94652723d8589b7f272454185449233ac838))
|
||||
- emend the imports in the test files ([53e8047](https://gitlab.com/openstapps/core-tools/commit/53e80476c85027194cf406ad87fe8950d6c2f3a8))
|
||||
- remove duplicate job ([af904a7](https://gitlab.com/openstapps/core-tools/commit/af904a7a05de56cdef6aea136a7e3bb237c4beb2))
|
||||
- update the uml job to use our node image ([a478715](https://gitlab.com/openstapps/core-tools/commit/a478715d8045dd26cd345ba3cbb469fda651b84f))
|
||||
|
||||
### Features
|
||||
|
||||
* add automatic mapping generation ([7b198f9](https://gitlab.com/openstapps/core-tools/commit/7b198f95ce7bbd75454247e70757d34af462cefc)), closes [#6](https://gitlab.com/openstapps/core-tools/issues/6)
|
||||
* add the uml generator ([0f21da4](https://gitlab.com/openstapps/core-tools/commit/0f21da4a92b4e0ef11a5f274468d3679fc9784ee))
|
||||
* added output file name for uml generation ([843e598](https://gitlab.com/openstapps/core-tools/commit/843e59811a5a104df1c746627aa668d26fdc9f60))
|
||||
|
||||
|
||||
- add automatic mapping generation ([7b198f9](https://gitlab.com/openstapps/core-tools/commit/7b198f95ce7bbd75454247e70757d34af462cefc)), closes [#6](https://gitlab.com/openstapps/core-tools/issues/6)
|
||||
- add the uml generator ([0f21da4](https://gitlab.com/openstapps/core-tools/commit/0f21da4a92b4e0ef11a5f274468d3679fc9784ee))
|
||||
- added output file name for uml generation ([843e598](https://gitlab.com/openstapps/core-tools/commit/843e59811a5a104df1c746627aa668d26fdc9f60))
|
||||
|
||||
# [0.7.0](https://gitlab.com/openstapps/core-tools/compare/v0.6.0...v0.7.0) (2019-06-24)
|
||||
|
||||
|
||||
|
||||
# [0.6.0](https://gitlab.com/openstapps/core-tools/compare/v0.5.1...v0.6.0) (2019-04-16)
|
||||
|
||||
|
||||
|
||||
## [0.5.1](https://gitlab.com/openstapps/core-tools/compare/v0.5.0...v0.5.1) (2019-04-09)
|
||||
|
||||
|
||||
|
||||
# [0.5.0](https://gitlab.com/openstapps/core-tools/compare/v0.4.0...v0.5.0) (2019-04-09)
|
||||
|
||||
|
||||
|
||||
# [0.4.0](https://gitlab.com/openstapps/core-tools/compare/v0.3.0...v0.4.0) (2019-04-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add feature to validate schemas directly ([1022150](https://gitlab.com/openstapps/core-tools/commit/1022150ca3d2af846b819e0e0e46ead71134d5f8))
|
||||
* adjust generation of route documentation ([d3ce936](https://gitlab.com/openstapps/core-tools/commit/d3ce936626751f24f20081403271d77e2c346e03)), closes [#12](https://gitlab.com/openstapps/core-tools/issues/12)
|
||||
|
||||
|
||||
- add feature to validate schemas directly ([1022150](https://gitlab.com/openstapps/core-tools/commit/1022150ca3d2af846b819e0e0e46ead71134d5f8))
|
||||
- adjust generation of route documentation ([d3ce936](https://gitlab.com/openstapps/core-tools/commit/d3ce936626751f24f20081403271d77e2c346e03)), closes [#12](https://gitlab.com/openstapps/core-tools/issues/12)
|
||||
|
||||
# [0.3.0](https://gitlab.com/openstapps/core-tools/compare/v0.2.1...v0.3.0) (2019-02-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ensure correct path for input files ([1c74432](https://gitlab.com/openstapps/core-tools/commit/1c744328eb03dc8019fe6dc3a309f68260210146))
|
||||
|
||||
|
||||
- ensure correct path for input files ([1c74432](https://gitlab.com/openstapps/core-tools/commit/1c744328eb03dc8019fe6dc3a309f68260210146))
|
||||
|
||||
## [0.2.1](https://gitlab.com/openstapps/core-tools/compare/v0.2.0...v0.2.1) (2019-01-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add SC prefix to the camel cased type of the instance ([e559234](https://gitlab.com/openstapps/core-tools/commit/e559234cea9ef245733f8117ab4a27e83db54e14))
|
||||
* use tsconfig.json of project for schema generation ([6b1a420](https://gitlab.com/openstapps/core-tools/commit/6b1a4202f92759c9ef36d32d0960faf4f56cc8db)), closes [#10](https://gitlab.com/openstapps/core-tools/issues/10)
|
||||
|
||||
- add SC prefix to the camel cased type of the instance ([e559234](https://gitlab.com/openstapps/core-tools/commit/e559234cea9ef245733f8117ab4a27e83db54e14))
|
||||
- use tsconfig.json of project for schema generation ([6b1a420](https://gitlab.com/openstapps/core-tools/commit/6b1a4202f92759c9ef36d32d0960faf4f56cc8db)), closes [#10](https://gitlab.com/openstapps/core-tools/issues/10)
|
||||
|
||||
### Features
|
||||
|
||||
* add function to find tsconfig.json ([aa645a2](https://gitlab.com/openstapps/core-tools/commit/aa645a2cc4661c58c6050196ee1944dfd9e5eea8))
|
||||
|
||||
|
||||
- add function to find tsconfig.json ([aa645a2](https://gitlab.com/openstapps/core-tools/commit/aa645a2cc4661c58c6050196ee1944dfd9e5eea8))
|
||||
|
||||
# [0.2.0](https://gitlab.com/openstapps/core-tools/compare/v0.1.1...v0.2.0) (2019-01-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add pack script ([7438465](https://gitlab.com/openstapps/core-tools/commit/7438465149b591ebf1583a8bd6b9da56aa9c9f57)), closes [#4](https://gitlab.com/openstapps/core-tools/issues/4)
|
||||
|
||||
|
||||
- add pack script ([7438465](https://gitlab.com/openstapps/core-tools/commit/7438465149b591ebf1583a8bd6b9da56aa9c9f57)), closes [#4](https://gitlab.com/openstapps/core-tools/issues/4)
|
||||
|
||||
## [0.1.1](https://gitlab.com/openstapps/core-tools/compare/v0.1.0...v0.1.1) (2019-01-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing dependency typedoc ([b248d1b](https://gitlab.com/openstapps/core-tools/commit/b248d1b5e0306247ce35e5c9d45637b0f3f83cac)), closes [#5](https://gitlab.com/openstapps/core-tools/issues/5)
|
||||
|
||||
|
||||
- add missing dependency typedoc ([b248d1b](https://gitlab.com/openstapps/core-tools/commit/b248d1b5e0306247ce35e5c9d45637b0f3f83cac)), closes [#5](https://gitlab.com/openstapps/core-tools/issues/5)
|
||||
|
||||
# [0.1.0](https://gitlab.com/openstapps/core-tools/compare/v0.0.3...v0.1.0) (2019-01-08)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* validate generated schemas ([7b7299d](https://gitlab.com/openstapps/core-tools/commit/7b7299d9c475105f9d2387c9dc31974139997483)), closes [#1](https://gitlab.com/openstapps/core-tools/issues/1)
|
||||
|
||||
|
||||
- validate generated schemas ([7b7299d](https://gitlab.com/openstapps/core-tools/commit/7b7299d9c475105f9d2387c9dc31974139997483)), closes [#1](https://gitlab.com/openstapps/core-tools/issues/1)
|
||||
|
||||
## [0.0.3](https://gitlab.com/openstapps/core-tools/compare/v0.0.2...v0.0.3) (2018-12-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* do not ignore resources ([6502bcf](https://gitlab.com/openstapps/core-tools/commit/6502bcf2b517ab98909626a7b8baa08e7cdcdc3e))
|
||||
|
||||
|
||||
- do not ignore resources ([6502bcf](https://gitlab.com/openstapps/core-tools/commit/6502bcf2b517ab98909626a7b8baa08e7cdcdc3e))
|
||||
|
||||
## [0.0.2](https://gitlab.com/openstapps/core-tools/compare/v0.0.1...v0.0.2) (2018-12-18)
|
||||
|
||||
|
||||
|
||||
## [0.0.1](https://gitlab.com/openstapps/core-tools/compare/1ac90ef6330bcfd0ea362505a11db66453f3386f...v0.0.1) (2018-12-18)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add core tools ([1ac90ef](https://gitlab.com/openstapps/core-tools/commit/1ac90ef6330bcfd0ea362505a11db66453f3386f))
|
||||
|
||||
|
||||
|
||||
- add core tools ([1ac90ef](https://gitlab.com/openstapps/core-tools/commit/1ac90ef6330bcfd0ea362505a11db66453f3386f))
|
||||
|
||||
@@ -30,6 +30,7 @@ openstapps-core-tools schema <srcPath> <schemaPath>
|
||||
```
|
||||
|
||||
where:
|
||||
|
||||
- `<srcPath>` is path to the project (where used `*.ts` files are, e.g. `src/core`,
|
||||
- `<schemaPath>` is directory to save output files to, e.g. `lib/schema`.
|
||||
|
||||
@@ -45,14 +46,6 @@ Inside of a script in `package.json` or if the npm package is installed globally
|
||||
openstapps-core-tools schema src/core lib/schema
|
||||
```
|
||||
|
||||
## What is Easy AST?
|
||||
|
||||
Easy [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) is a "wrapper" around the TypeScript Compiler API. The TS Compiler API is built for many
|
||||
much more complex things than just accessing type declarations, and thus comes with a ton of
|
||||
bloat that makes it really difficult to work with.
|
||||
|
||||
This is why we built the Easy AST, which converts the TS representation to a really easy and
|
||||
lightweight structure, that removes a lot of the stuff you wouldn't really need.
|
||||
|
||||
## How to use the validator?
|
||||
|
||||
@@ -65,7 +58,7 @@ import {ValidatorResult} from 'jsonschema';
|
||||
import {join} from 'path';
|
||||
|
||||
const objectToValidate: SCDish = {
|
||||
type: SCThingType.Dish,
|
||||
type: SCThingType.Dish,
|
||||
// more properties
|
||||
};
|
||||
|
||||
@@ -95,6 +88,7 @@ Your basic JSON object:
|
||||
```
|
||||
|
||||
JSON for validateFiles:
|
||||
|
||||
```json
|
||||
{
|
||||
"errorNames": [],
|
||||
@@ -120,6 +114,7 @@ openstapps-core-tools validate <schemaPath> <testPath> [reportPath]
|
||||
```
|
||||
|
||||
where:
|
||||
|
||||
- `<schemaPath>` is a directory where JSON schema files are, e.g. `lib/schema`,
|
||||
- `<testPath>` is a directory where test files are, e.g. `src/test/resources`,
|
||||
- `[reportPath]` is a file where the HTML report of the validation will be saved to, e.g. `report.html` (optional argument - if it's not provided no report will be written).
|
||||
@@ -144,14 +139,6 @@ To generate a openapi JSON file that represents the routes according to openapi
|
||||
openstapps-core-tools openapi PATH/TO/CORE/lib PATH/TO/PUT/FILES/TO
|
||||
```
|
||||
|
||||
## Pack definitions and implementations
|
||||
|
||||
To pack all the different files into two distribution files - one for definitions/one for implementations - use the following command:
|
||||
|
||||
```shell
|
||||
openstapps-core-tools pack
|
||||
```
|
||||
|
||||
## How to use the UML generator
|
||||
|
||||
The UML Generator generates PlantUML from the project reflection of the source files. By default it will include externals, which will take considerably longer to execute, you can disable this behaviour via an option. It can help you to visually explore the data model or document a specific part.
|
||||
@@ -202,7 +189,8 @@ The plantuml code is persisted inside the generated file at the very bottom. You
|
||||
openstapps-core-tools plantuml-file /PATH/TO/Project.plantuml http://PLANTUMLSERVER OptionalCustomFileName
|
||||
```
|
||||
|
||||
Example-File-Content of Project.plantuml
|
||||
Example-File-Content of Project.plantuml
|
||||
|
||||
```
|
||||
@startuml
|
||||
interface MyClass{
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
import './lib/cli.js'
|
||||
import './lib/app.js';
|
||||
|
||||
@@ -13,41 +13,43 @@
|
||||
"Rainer Killinger <mail-openstapps@killinger.co>",
|
||||
"Thea Schöbl <dev@theaninova.de>"
|
||||
],
|
||||
"prettier": "@openstapps",
|
||||
"keywords": [
|
||||
"StApps",
|
||||
"StAppsCore",
|
||||
"converter",
|
||||
"core",
|
||||
"validator"
|
||||
],
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"bin": {
|
||||
"openstapps-core-tools": "app.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rimraf lib && tsc",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
|
||||
"check-configuration": "openstapps-configuration",
|
||||
"documentation": "typedoc --out docs --readme README.md --includeVersion --validation.invalidLink true --entryPointStrategy expand src",
|
||||
"lint": "eslint -c .eslintrc.json --ignore-path .eslintignore --ext .ts src/",
|
||||
"lint:fix": "eslint --fix -c .eslintrc.json --ignore-path .eslintignore --ext .ts src/",
|
||||
"build": "tsup --dts",
|
||||
"format": "prettier .",
|
||||
"format:fix": "prettier --write .",
|
||||
"lint": "eslint --ext .ts src/",
|
||||
"lint:fix": "eslint --fix --ext .ts src/",
|
||||
"plantuml-restart": "docker restart plantuml-server",
|
||||
"plantuml-start": "docker run --name plantuml-server -d -p 8080:8080 registry.gitlab.com/openstapps/core-tools:latest",
|
||||
"plantuml-stop": "docker stop plantuml-server",
|
||||
"prepublishOnly": "npm ci && npm run build",
|
||||
"preversion": "npm run prepublishOnly",
|
||||
"push": "git push && git push origin \"v$npm_package_version\"",
|
||||
"test": "mocha --require ts-node/register test/*.spec.ts",
|
||||
"version": "npm run changelog"
|
||||
"test": "nyc mocha 'test/**/*.spec.ts'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@openstapps/collection-utils": "workspace:*",
|
||||
"@openstapps/logger": "workspace:*",
|
||||
"@openstapps/easy-ast": "workspace:*",
|
||||
"ajv": "8.12.0",
|
||||
"better-ajv-errors": "1.2.0",
|
||||
"chai": "4.3.7",
|
||||
"commander": "10.0.0",
|
||||
"deepmerge": "4.3.0",
|
||||
"deepmerge": "4.3.1",
|
||||
"del": "6.1.1",
|
||||
"eslint": "8.33.0",
|
||||
"flatted": "3.2.7",
|
||||
"fs-extra": "10.1.0",
|
||||
"glob": "8.1.0",
|
||||
"glob": "10.2.1",
|
||||
"got": "12.6.0",
|
||||
"humanize-string": "3.0.0",
|
||||
"json-schema": "0.4.0",
|
||||
@@ -61,9 +63,10 @@
|
||||
"typescript": "4.8.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openstapps/configuration": "workspace:*",
|
||||
"@openstapps/eslint-config": "workspace:*",
|
||||
"@openstapps/nyc-config": "workspace:*",
|
||||
"@openstapps/prettier-config": "workspace:*",
|
||||
"@openstapps/tsconfig": "workspace:*",
|
||||
"@testdeck/mocha": "0.3.3",
|
||||
"@types/chai": "4.3.4",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
@@ -72,25 +75,32 @@
|
||||
"@types/mocha": "10.0.1",
|
||||
"@types/mustache": "4.2.2",
|
||||
"@types/node": "18.15.3",
|
||||
"@types/rimraf": "3.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "5.49.0",
|
||||
"@typescript-eslint/parser": "5.49.0",
|
||||
"conventional-changelog-cli": "2.2.2",
|
||||
"eslint-config-prettier": "8.6.0",
|
||||
"eslint-plugin-jsdoc": "39.7.4",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"eslint-plugin-unicorn": "45.0.2",
|
||||
"mocha": "10.2.0",
|
||||
"nock": "13.3.0",
|
||||
"prettier": "2.8.3",
|
||||
"rimraf": "4.4.0",
|
||||
"typedoc": "0.23.26"
|
||||
"tsup": "6.7.0",
|
||||
"typedoc": "0.23.28"
|
||||
},
|
||||
"keywords": [
|
||||
"StApps",
|
||||
"StAppsCore",
|
||||
"converter",
|
||||
"core",
|
||||
"validator"
|
||||
]
|
||||
"tsup": {
|
||||
"entry": [
|
||||
"src/app.ts",
|
||||
"src/index.ts"
|
||||
],
|
||||
"sourcemap": true,
|
||||
"clean": true,
|
||||
"format": "esm",
|
||||
"outDir": "lib"
|
||||
},
|
||||
"prettier": "@openstapps/prettier-config",
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"@openstapps"
|
||||
]
|
||||
},
|
||||
"eslintIgnore": [
|
||||
"resources",
|
||||
"openapi"
|
||||
],
|
||||
"nyc": {
|
||||
"extends": "@openstapps/nyc-config"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ import {existsSync, readFileSync, writeFileSync} from 'fs';
|
||||
import {copy} from 'fs-extra';
|
||||
import path from 'path';
|
||||
import {mkdirPromisified, readFilePromisified} from './common.js';
|
||||
import {lightweightDefinitionsFromPath, lightweightProjectFromPath} from './easy-ast/easy-ast.js';
|
||||
import {pack} from './pack.js';
|
||||
import {lightweightDefinitionsFromPath, lightweightProjectFromPath} from '@openstapps/easy-ast';
|
||||
import {openapi3Template} from './resources/openapi-303-template.js';
|
||||
import {gatherRouteInformation, generateOpenAPIForRoute} from './routes.js';
|
||||
import {Converter, getValidatableTypesInPath} from './schema.js';
|
||||
@@ -27,7 +26,7 @@ import {createDiagram, createDiagramFromString} from './uml/create-diagram.js';
|
||||
import {UMLConfig} from './uml/uml-config.js';
|
||||
import {capitalize} from './util/string.js';
|
||||
import {validateFiles, writeReport} from './validate.js';
|
||||
import {fileURLToPath} from "url";
|
||||
import {fileURLToPath} from 'url';
|
||||
|
||||
// handle unhandled promise rejections
|
||||
process.on('unhandledRejection', async (reason: unknown) => {
|
||||
@@ -41,7 +40,11 @@ process.on('unhandledRejection', async (reason: unknown) => {
|
||||
const commander = new Command('openstapps-core-tools');
|
||||
|
||||
// eslint-disable-next-line unicorn/prefer-module
|
||||
commander.version(JSON.parse(readFileSync(path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'package.json')).toString()).version);
|
||||
commander.version(
|
||||
JSON.parse(
|
||||
readFileSync(path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'package.json')).toString(),
|
||||
).version,
|
||||
);
|
||||
|
||||
commander.command('prototype <srcBundle> <out>').action(async (sourcePath, out) => {
|
||||
const files = lightweightProjectFromPath(sourcePath);
|
||||
@@ -201,10 +204,6 @@ commander
|
||||
}
|
||||
});
|
||||
|
||||
commander.command('pack').action(async () => {
|
||||
await pack();
|
||||
});
|
||||
|
||||
commander
|
||||
.command('plantuml <srcPath> <plantumlserver>')
|
||||
.option('--definitions <definitions>', 'Shows these specific definitions (class, interface or enum)', it =>
|
||||
10
packages/core-tools/src/better-ajv-errors.d.ts
vendored
10
packages/core-tools/src/better-ajv-errors.d.ts
vendored
@@ -1,10 +1,10 @@
|
||||
declare module 'better-ajv-errors' {
|
||||
import type { ErrorObject } from 'ajv';
|
||||
import type {ErrorObject} from 'ajv';
|
||||
|
||||
export interface IOutputError {
|
||||
start: { line: number; column: number; offset: number };
|
||||
start: {line: number; column: number; offset: number};
|
||||
// Optional for required
|
||||
end?: { line: number; column: number; offset: number };
|
||||
end?: {line: number; column: number; offset: number};
|
||||
error: string;
|
||||
suggestion?: string;
|
||||
}
|
||||
@@ -21,6 +21,6 @@ declare module 'better-ajv-errors' {
|
||||
schema: S,
|
||||
data: T,
|
||||
errors: Array<ErrorObject>,
|
||||
options?: Options
|
||||
): Options extends { format: 'js' } ? Array<IOutputError> : string;
|
||||
options?: Options,
|
||||
): Options extends {format: 'js'} ? Array<IOutputError> : string;
|
||||
}
|
||||
|
||||
11
packages/core-tools/src/index.ts
Normal file
11
packages/core-tools/src/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export * from './validate.js'
|
||||
export * from './types/validator.js'
|
||||
|
||||
export * from './uml/uml-config.js'
|
||||
export * from './uml/create-diagram.js'
|
||||
|
||||
export * from './routes.js'
|
||||
export * from './types/routes.js'
|
||||
|
||||
export * from './schema.js'
|
||||
export * from './types/schema.js'
|
||||
@@ -1,465 +0,0 @@
|
||||
/* eslint-disable unicorn/error-message */
|
||||
/*
|
||||
* Copyright (C) 2021 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import del from 'del';
|
||||
import {existsSync} from 'fs';
|
||||
import {cwd} from 'process';
|
||||
import {globPromisified, readFilePromisified, unlinkPromisified, writeFilePromisified} from './common.js';
|
||||
import {JavaScriptModule} from './types/pack.js';
|
||||
import path from 'path';
|
||||
|
||||
const PACK_IDENTIFIER = '/* PACKED BY @openstapps/pack */';
|
||||
const posixCwd = cwd().replaceAll(path.win32.sep, path.posix.sep)
|
||||
|
||||
/**
|
||||
* Pack cli.js
|
||||
*
|
||||
* This finds all internal requires and replaces the paths with `./index` or internal requires if it has been
|
||||
* required already.
|
||||
*
|
||||
* Furthermore it checks that no shebang line is present and that it does not export anything.
|
||||
*/
|
||||
async function packCliJs(): Promise<void> {
|
||||
const cliPath = path.join(cwd(), 'lib', 'cli.js');
|
||||
|
||||
if (!existsSync(cliPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.info('Adjusting JavaScript CLI...');
|
||||
|
||||
const buffer = await readFilePromisified(cliPath);
|
||||
const content = buffer.toString();
|
||||
|
||||
if (content.indexOf('#!/') === 0) {
|
||||
throw new Error('`cli.js` must not contain a shebang line! It is added by this script.');
|
||||
}
|
||||
|
||||
let internalRequire: string | undefined;
|
||||
|
||||
const adjustedContent = content
|
||||
.split('\n')
|
||||
.map((line, lineNumber) => {
|
||||
// check for exports (cli.js is not allowed to export anything)
|
||||
if (Array.isArray(line.match(/^\s*((exports)|(module\.exports))/))) {
|
||||
throw new TypeError(
|
||||
`Line '${lineNumber}' in 'cli.js' exports something. cli.js is not for exporting. Line was:\n${line}`,
|
||||
);
|
||||
}
|
||||
|
||||
// replace lines with internal requires
|
||||
// extract module name from line
|
||||
const match = line.match(/^(\s*)(const|var) ([a-z0-9_]*) = require\(("[^"]+"|'[^']+')\);$/i);
|
||||
|
||||
if (match !== null) {
|
||||
const importedName = match[3];
|
||||
// eslint-disable-next-line unicorn/prefer-string-slice
|
||||
const moduleName = match[4].substring(1, match[4].length - 1);
|
||||
|
||||
// if it begins with '.' and not ends with json
|
||||
if (/^[.]{1,2}\/(?!.*\.json$).*$/i.test(moduleName)) {
|
||||
// is the first internal require
|
||||
if (internalRequire) {
|
||||
return `const ${importedName} = ${internalRequire};`;
|
||||
}
|
||||
|
||||
// only the first import needs a require
|
||||
internalRequire = importedName;
|
||||
|
||||
return `const ${importedName} = require("./index");`;
|
||||
}
|
||||
}
|
||||
|
||||
return line;
|
||||
})
|
||||
.join('\n');
|
||||
|
||||
return writeFilePromisified(cliPath, `#!/usr/bin/env node\n\n${adjustedContent}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list containing the contents of all type definition files
|
||||
*/
|
||||
async function getAllTypeDefinitions(): Promise<string[]> {
|
||||
const fileNames = await globPromisified(path.posix.join(posixCwd, '*(lib|src)', '**', '*.d.ts'), {
|
||||
ignore: [
|
||||
path.posix.join(posixCwd, 'lib', 'doc', '**', '*.d.ts'),
|
||||
path.posix.join(posixCwd, 'lib', 'test', '**', '*.d.ts'),
|
||||
path.posix.join(posixCwd, 'lib', 'cli.d.ts'),
|
||||
],
|
||||
});
|
||||
|
||||
const promises = fileNames.map(async (fileName: string) => {
|
||||
return readFilePromisified(fileName, 'utf8');
|
||||
});
|
||||
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack a list of type definitions into one file
|
||||
*/
|
||||
async function packTypeDefinitions(): Promise<void> {
|
||||
Logger.info('Packing TypeScript definition files...');
|
||||
|
||||
const indexPath = path.join(cwd(), 'lib', 'index.d.ts');
|
||||
|
||||
await deleteFileIfExistingAndPacked(indexPath);
|
||||
|
||||
const typeDefinitions = await getAllTypeDefinitions();
|
||||
|
||||
// pack TypeScript definition files
|
||||
const imports: {[k: string]: string[]} = {};
|
||||
|
||||
const referenceLines: string[] = [];
|
||||
|
||||
let allDefinitions = typeDefinitions
|
||||
// concat them separated by new lines
|
||||
.join('\n\n\n\n\n')
|
||||
// split all lines
|
||||
.split('\n')
|
||||
.map(line => {
|
||||
if (line.includes('export =')) {
|
||||
throw new Error('`export =` is not allowed by pack. Use named imports instead.');
|
||||
}
|
||||
|
||||
if (line.indexOf('/// <reference') === 0) {
|
||||
referenceLines.push(line);
|
||||
|
||||
return '// moved referenced line';
|
||||
}
|
||||
|
||||
// match import lines
|
||||
const match = line.match(/^import\s+{\s*([^}].*)\s*}\s+from\s+['"]([^'"].*)['"];$/);
|
||||
|
||||
if (match !== null) {
|
||||
const module = match[2];
|
||||
|
||||
// extract imported objects
|
||||
const importedObjects = match[1].split(',').map(object => {
|
||||
return object.trim();
|
||||
});
|
||||
|
||||
// add list of already imported objects for module
|
||||
if (imports[module] === undefined) {
|
||||
imports[module] = [];
|
||||
}
|
||||
|
||||
// count already imported objects and objects to import now
|
||||
const objectsToImport: string[] = [];
|
||||
for (const object of importedObjects) {
|
||||
if (!imports[module].includes(object)) {
|
||||
imports[module].push(object);
|
||||
objectsToImport.push(object);
|
||||
}
|
||||
}
|
||||
|
||||
// replace import line
|
||||
if (objectsToImport.length === 0) {
|
||||
return '// extraneous removed import';
|
||||
}
|
||||
|
||||
return `import {${objectsToImport.join(', ')}} from '${module}';`;
|
||||
}
|
||||
|
||||
return line;
|
||||
})
|
||||
// filter lines which contain "local" imports
|
||||
.filter(line => {
|
||||
return line.match(/^import .* from '\./) === null;
|
||||
})
|
||||
// concat all lines separated by new lines
|
||||
.join('\n');
|
||||
|
||||
if (allDefinitions.length > 0) {
|
||||
if (referenceLines.length > 0) {
|
||||
allDefinitions = `${referenceLines.join('\n')}
|
||||
|
||||
${allDefinitions}`;
|
||||
}
|
||||
|
||||
// write packed TypeScript definition files
|
||||
return writeFilePromisified(
|
||||
indexPath,
|
||||
`${PACK_IDENTIFIER}
|
||||
|
||||
${allDefinitions}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all JavaScript modules
|
||||
*/
|
||||
async function getAllJavaScriptModules(): Promise<JavaScriptModule[]> {
|
||||
const fileNames = await globPromisified(path.posix.join(posixCwd, 'lib', '**', '*.js'), {
|
||||
ignore: [
|
||||
path.posix.join(posixCwd, 'lib', 'doc', '**', '*.js'),
|
||||
path.posix.join(posixCwd, 'lib', 'test', '*.js'),
|
||||
path.posix.join(posixCwd, 'lib', 'cli.js'),
|
||||
],
|
||||
});
|
||||
|
||||
const promises = fileNames.map(async (fileName: string) => {
|
||||
const fileContent = await readFilePromisified(fileName, 'utf8');
|
||||
const directory = path.dirname(fileName).replace(new RegExp(`^${path.join(cwd(), 'lib')}`), '');
|
||||
|
||||
return {
|
||||
content: `(function() {
|
||||
${fileContent}
|
||||
})();
|
||||
`,
|
||||
dependencies: getAllInternalDependencies(fileContent),
|
||||
directory: directory,
|
||||
name: path.basename(fileName, '.js'),
|
||||
};
|
||||
});
|
||||
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack all javascript files
|
||||
*/
|
||||
async function packJavaScriptFiles(): Promise<void> {
|
||||
const indexPath = path.join(cwd(), 'lib', 'index.js');
|
||||
|
||||
Logger.info('Packing JavaScript files...');
|
||||
|
||||
await deleteFileIfExistingAndPacked(indexPath);
|
||||
|
||||
// topologically sort the modules (sort by dependencies)
|
||||
const jsModules = topologicalSort(await getAllJavaScriptModules());
|
||||
|
||||
let wholeCode = jsModules
|
||||
// convert modules to strings
|
||||
.map(module => {
|
||||
module.content = module.content
|
||||
.split('\n')
|
||||
.map(line => {
|
||||
const match = line.match(
|
||||
/^(\s*)(const|var) ([a-z0-9_]*) = ((require\("([^"]+)"\))|(require\('([^']+)'\)));$/i,
|
||||
);
|
||||
|
||||
// replace lines with internal requires
|
||||
if (match !== null) {
|
||||
if (match[6] === undefined) {
|
||||
match[6] = match[8];
|
||||
}
|
||||
|
||||
const whiteSpace = typeof match[1] === 'string' && match[1].length > 0 ? match[1] : '';
|
||||
const importedName = match[3];
|
||||
const modulePath = match[6];
|
||||
|
||||
// leave line unchanged if it is a "global" import
|
||||
if (modulePath.match(/^[.]{1,2}\//) === null) {
|
||||
return line;
|
||||
}
|
||||
|
||||
// replace internal requires with `module.exports`
|
||||
if (existsSync(path.join(cwd(), 'lib', module.directory, `${modulePath}.js`))) {
|
||||
return `${whiteSpace}const ${importedName} = module.exports;`;
|
||||
}
|
||||
|
||||
if (existsSync(path.join(cwd(), 'src', module.directory, modulePath))) {
|
||||
return `${whiteSpace} const ${importedName} = require(../src/${modulePath});`;
|
||||
}
|
||||
|
||||
Logger.warn(`Import ${importedName} could not be found in module.directory ${modulePath}.`);
|
||||
}
|
||||
|
||||
return line;
|
||||
})
|
||||
.join('\n');
|
||||
|
||||
return `// Module: ${module.name}
|
||||
${module.content}`;
|
||||
})
|
||||
// concat them separated by new lines
|
||||
.join('\n\n\n\n\n')
|
||||
// split all lines
|
||||
.split('\n')
|
||||
// filter lines
|
||||
.filter(line => {
|
||||
// remove strict usage
|
||||
if (line === '"use strict";') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// remove esModule property
|
||||
if (line === 'Object.defineProperty(exports, "__esModule", { value: true });') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// remove source map references
|
||||
if (line.indexOf('//# sourceMappingURL=') === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// keep all other lines
|
||||
return true;
|
||||
})
|
||||
// concat all lines separated by new lines
|
||||
.join('\n');
|
||||
|
||||
if (wholeCode.length > 0) {
|
||||
// add meta lines to the file
|
||||
wholeCode = `"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
||||
${wholeCode}`;
|
||||
|
||||
// write packed JavaScript files
|
||||
return writeFilePromisified(
|
||||
indexPath,
|
||||
`${PACK_IDENTIFIER}
|
||||
|
||||
${wholeCode}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete file if it exists and is packed by this script
|
||||
*
|
||||
* @param path Path to file to check/delete
|
||||
*/
|
||||
async function deleteFileIfExistingAndPacked(path: string): Promise<void> {
|
||||
try {
|
||||
const buffer = await readFilePromisified(path);
|
||||
const content = buffer.toString();
|
||||
|
||||
// check if packed by this script
|
||||
if (content.indexOf(PACK_IDENTIFIER) === 0) {
|
||||
Logger.log(`Found '${path}' which is packed by this script. Deleting it...`);
|
||||
|
||||
return unlinkPromisified(path);
|
||||
}
|
||||
} catch (error) {
|
||||
if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all internal dependencies from the content of a module
|
||||
*
|
||||
* @param moduleContent Module content to analyze
|
||||
*/
|
||||
function getAllInternalDependencies(moduleContent: string): string[] {
|
||||
// match all const <name> = require(<moduleName>);
|
||||
const requireLines = moduleContent.match(
|
||||
/^\s*(const|var) [a-z0-9_]* = require\("([^"]+)"\)|require\('([^']+)'\);$/gim,
|
||||
);
|
||||
|
||||
if (Array.isArray(requireLines)) {
|
||||
return requireLines
|
||||
.map(requireLine => {
|
||||
const matches = requireLine.match(/require\("([^"]+)"\)|require\('([^']+)'\);$/i);
|
||||
|
||||
// previously matched require line does not contain a require?!
|
||||
if (matches === null) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
// return only the moduleName
|
||||
return matches[1];
|
||||
})
|
||||
.filter(moduleName => {
|
||||
// filter out internal modules beginning with './' and not ending with '.json'
|
||||
return /^[.]{1,2}\/(?!.*\.json$).*$/i.test(moduleName);
|
||||
})
|
||||
.map(internalModuleName => {
|
||||
// cut './' from the name
|
||||
return internalModuleName.slice('./'.length);
|
||||
});
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort modules by their dependencies
|
||||
*
|
||||
* @param modules Modules to sort
|
||||
*/
|
||||
function topologicalSort(modules: JavaScriptModule[]): JavaScriptModule[] {
|
||||
// eslint-disable-next-line unicorn/prefer-module,@typescript-eslint/no-var-requires
|
||||
const topoSort = require('toposort');
|
||||
|
||||
// vertices are modules, an edge from a to b means that b depends on a
|
||||
const edges: string[][] = [];
|
||||
const nodes: string[] = [];
|
||||
|
||||
// add all edges
|
||||
for (const module of modules) {
|
||||
for (const dependencyPath of module.dependencies) {
|
||||
// add edge from dependency to our module
|
||||
edges.push([path.basename(dependencyPath), module.name]);
|
||||
}
|
||||
|
||||
nodes.push(module.name);
|
||||
}
|
||||
|
||||
// sort graph and return as an array of sorted modules
|
||||
return topoSort.array(nodes, edges).map((moduleName: string) => {
|
||||
return modules.find(module => {
|
||||
return module.name === moduleName;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack
|
||||
*/
|
||||
export async function pack() {
|
||||
Logger.log(`Packing project in ${process.cwd()}...`);
|
||||
|
||||
// run all tasks in parallel
|
||||
const promises: Array<Promise<void>> = [packCliJs(), packTypeDefinitions(), packJavaScriptFiles()];
|
||||
|
||||
await Promise.all(promises);
|
||||
|
||||
// clean up afterwards
|
||||
Logger.info('Deleting extraneous files...');
|
||||
|
||||
await del([
|
||||
// delete all transpiled files
|
||||
'lib/*',
|
||||
|
||||
// keep packed files
|
||||
'!lib/index.d.ts',
|
||||
'!lib/index.js',
|
||||
|
||||
// keep converted schema files
|
||||
'!lib/schema',
|
||||
'!lib/schema/*.json',
|
||||
|
||||
// keep documentation
|
||||
'!lib/doc',
|
||||
'!lib/doc/*',
|
||||
'!lib/doc/**/*',
|
||||
|
||||
// keep cli
|
||||
'!lib/cli.js',
|
||||
|
||||
// keep tests
|
||||
'!lib/test',
|
||||
'!lib/test/*',
|
||||
'!lib/test/**/*',
|
||||
]);
|
||||
}
|
||||
@@ -15,27 +15,27 @@
|
||||
import {OpenAPIV3} from 'openapi-types';
|
||||
|
||||
export const openapi3Template: OpenAPIV3.Document = {
|
||||
openapi: '3.0.3',
|
||||
info: {
|
||||
title: 'Openstapps Backend',
|
||||
description: `# Introduction
|
||||
openapi: '3.0.3',
|
||||
info: {
|
||||
title: 'Openstapps Backend',
|
||||
description: `# Introduction
|
||||
This is a human readable documentation of the backend OpenAPI representation.`,
|
||||
contact: {
|
||||
name: 'Openstapps Team',
|
||||
url: 'https://gitlab.com/openstapps/backend',
|
||||
email: 'app@uni-frankfurt.de',
|
||||
},
|
||||
license: {
|
||||
name: 'AGPL 3.0',
|
||||
url: 'https://www.gnu.org/licenses/agpl-3.0.en.html',
|
||||
},
|
||||
version: '2.0.0',
|
||||
contact: {
|
||||
name: 'Openstapps Team',
|
||||
url: 'https://gitlab.com/openstapps/backend',
|
||||
email: 'app@uni-frankfurt.de',
|
||||
},
|
||||
servers: [
|
||||
{
|
||||
url: 'https://mobile.server.uni-frankfurt.de:3000',
|
||||
description: 'Production server',
|
||||
},
|
||||
],
|
||||
paths: {},
|
||||
};
|
||||
license: {
|
||||
name: 'AGPL 3.0',
|
||||
url: 'https://www.gnu.org/licenses/agpl-3.0.en.html',
|
||||
},
|
||||
version: '2.0.0',
|
||||
},
|
||||
servers: [
|
||||
{
|
||||
url: 'https://mobile.server.uni-frankfurt.de:3000',
|
||||
description: 'Production server',
|
||||
},
|
||||
],
|
||||
paths: {},
|
||||
};
|
||||
|
||||
@@ -13,13 +13,11 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {OpenAPIV3} from 'openapi-types';
|
||||
import {isLightweightClass} from './easy-ast/ast-util.js';
|
||||
import {LightweightProjectWithIndex} from './easy-ast/types/lightweight-project.js';
|
||||
import {isLightweightClass, lightweightProjectFromPath, LightweightProjectWithIndex} from '@openstapps/easy-ast';
|
||||
import {RouteInstanceWithMeta, RouteWithMetaInformation} from './types/routes.js';
|
||||
import {rejectNil} from './util/collections.js';
|
||||
import {capitalize} from './util/string.js';
|
||||
import path from 'path';
|
||||
import {lightweightProjectFromPath} from './easy-ast/easy-ast.js';
|
||||
|
||||
/**
|
||||
* Gather relevant information of routes
|
||||
@@ -33,38 +31,42 @@ export async function gatherRouteInformation(path: string): Promise<RouteWithMet
|
||||
// find all classes that implement the SCAbstractRoute
|
||||
return rejectNil(
|
||||
await Promise.all(
|
||||
Object.values(project.definitions).filter(isLightweightClass).map(async node => {
|
||||
if (!node.extendedDefinitions?.some(it => it.referenceName === 'SCAbstractRoute')) {
|
||||
return undefined;
|
||||
}
|
||||
Object.values(project.definitions)
|
||||
.filter(isLightweightClass)
|
||||
.map(async node => {
|
||||
if (!node.extendedDefinitions?.some(it => it.referenceName === 'SCAbstractRoute')) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const instantiatedRoute = (await project.instantiateDefinitionByName(
|
||||
node.name,
|
||||
)) as RouteInstanceWithMeta;
|
||||
// instantiate all errors
|
||||
instantiatedRoute.errors = await Promise.all(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
instantiatedRoute.errorNames.map(async (error: any) =>
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
Object.assign((await project.instantiateDefinitionByName(error.name)) as object, {name: error.name}),
|
||||
),
|
||||
);
|
||||
instantiatedRoute.responseBodyDescription =
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
||||
project.definitions[instantiatedRoute.responseBodyName]?.comment?.shortSummary!;
|
||||
instantiatedRoute.requestBodyDescription =
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
||||
project.definitions[instantiatedRoute.requestBodyName]?.comment?.shortSummary!;
|
||||
const instantiatedRoute = (await project.instantiateDefinitionByName(
|
||||
node.name,
|
||||
)) as RouteInstanceWithMeta;
|
||||
// instantiate all errors
|
||||
instantiatedRoute.errors = await Promise.all(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
instantiatedRoute.errorNames.map(async (error: any) =>
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
Object.assign((await project.instantiateDefinitionByName(error.name)) as object, {
|
||||
name: error.name,
|
||||
}),
|
||||
),
|
||||
);
|
||||
instantiatedRoute.responseBodyDescription =
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
||||
project.definitions[instantiatedRoute.responseBodyName]?.comment?.shortSummary!;
|
||||
instantiatedRoute.requestBodyDescription =
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
||||
project.definitions[instantiatedRoute.requestBodyName]?.comment?.shortSummary!;
|
||||
|
||||
return {
|
||||
description: {
|
||||
shortText: node.comment?.shortSummary,
|
||||
text: node.comment?.description,
|
||||
},
|
||||
name: node.name!,
|
||||
route: instantiatedRoute,
|
||||
};
|
||||
}),
|
||||
return {
|
||||
description: {
|
||||
shortText: node.comment?.shortSummary,
|
||||
text: node.comment?.description,
|
||||
},
|
||||
name: node.name!,
|
||||
route: instantiatedRoute,
|
||||
};
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@ import {createFormatter} from 'ts-json-schema-generator';
|
||||
import {createParser} from 'ts-json-schema-generator';
|
||||
import {createProgram} from 'ts-json-schema-generator';
|
||||
import {getTsconfigPath} from './common.js';
|
||||
import {definitionsOf} from './easy-ast/ast-util.js';
|
||||
import {lightweightProjectFromPath} from './easy-ast/easy-ast.js';
|
||||
import {definitionsOf, lightweightProjectFromPath} from '@openstapps/easy-ast';
|
||||
import {isSchemaWithDefinitions} from './util/guards.js';
|
||||
import path from 'path';
|
||||
import re2 from './types/re2.js';
|
||||
@@ -111,5 +110,5 @@ export class Converter {
|
||||
export function getValidatableTypesInPath(path: string): string[] {
|
||||
return Object.values(definitionsOf(lightweightProjectFromPath(path)))
|
||||
.filter(type => !!type.comment?.tags?.find(it => it.name === 'validatable'))
|
||||
.map(type => type.name)
|
||||
.map(type => type.name);
|
||||
}
|
||||
|
||||
@@ -15,12 +15,15 @@
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import {createWriteStream} from 'fs';
|
||||
import * as request from 'got';
|
||||
import {expandTypeValue, isLightweightClass} from '../easy-ast/ast-util.js';
|
||||
import {LightweightAliasDefinition} from '../easy-ast/types/lightweight-alias-definition.js';
|
||||
import {LightweightClassDefinition} from '../easy-ast/types/lightweight-class-definition.js';
|
||||
import {LightweightDefinition} from '../easy-ast/types/lightweight-definition.js';
|
||||
import {LightweightProperty} from '../easy-ast/types/lightweight-property.js';
|
||||
import {LightweightType} from '../easy-ast/types/lightweight-type.js';
|
||||
import {
|
||||
expandTypeValue,
|
||||
isLightweightClass,
|
||||
LightweightAliasDefinition,
|
||||
LightweightClassDefinition,
|
||||
LightweightDefinition,
|
||||
LightweightProperty,
|
||||
LightweightType
|
||||
} from '@openstapps/easy-ast';
|
||||
import {UMLConfig} from './uml-config.js';
|
||||
|
||||
/**
|
||||
@@ -59,7 +62,8 @@ export async function createDiagram(
|
||||
isLightweightClass(definition)
|
||||
? createPlantUMLCodeForClass(config, definition)
|
||||
: createPlantUMLCodeForEnum(config, definition),
|
||||
).join('');
|
||||
)
|
||||
.join('');
|
||||
|
||||
return createDiagramFromString(modelPlantUMLCode, plantUmlBaseURL, config.outputFileName);
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ export function mapNotNil<T, S>(array: readonly T[], transform: (element: T) =>
|
||||
export function cleanupEmpty<T extends object>(object: T): T {
|
||||
const out = {} as T;
|
||||
for (const key in object) {
|
||||
const value = object[key]
|
||||
const value = object[key];
|
||||
// eslint-disable-next-line unicorn/no-null
|
||||
if (value != null && (typeof value !== 'object' || Object.values(value).length > 0)) {
|
||||
out[key] = value
|
||||
out[key] = value;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
|
||||
@@ -25,7 +25,7 @@ export function expandPathToFilesSync(sourcePath: string, accept: (fileName: str
|
||||
return directory.isDirectory()
|
||||
? readdirSync(fullPath).flatMap(fragment =>
|
||||
expandPathToFilesSync(path.resolve(sourcePath, fragment), accept),
|
||||
)
|
||||
)
|
||||
: [fullPath].filter(accept);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,8 @@ import {existsSync, unlinkSync} from 'fs';
|
||||
import {slow, suite, test, timeout} from '@testdeck/mocha';
|
||||
import {createDiagram, createDiagramFromString} from '../src/uml/create-diagram.js';
|
||||
import {UMLConfig} from '../src/uml/uml-config.js';
|
||||
import {LightweightDefinition} from '../src/easy-ast/types/lightweight-definition.js';
|
||||
import {LightweightDefinition, lightweightDefinitionsFromPath} from '@openstapps/easy-ast';
|
||||
import nock = require('nock');
|
||||
import {lightweightDefinitionsFromPath} from '../src/easy-ast/easy-ast.js';
|
||||
import path from 'path';
|
||||
|
||||
@suite(timeout(15_000), slow(5000))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "./node_modules/@openstapps/configuration/tsconfig.json",
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"compilerOptions": {
|
||||
"noUnusedLocals": false,
|
||||
"stripInternal": true
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
@@ -1,2 +0,0 @@
|
||||
resources
|
||||
openapi
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"extends": "@openstapps",
|
||||
"rules": {
|
||||
"@typescript-eslint/no-empty-interface": "off",
|
||||
"jsdoc/check-tag-names": [
|
||||
"error",
|
||||
{
|
||||
"definedTags": [
|
||||
"internal",
|
||||
"aggregatable",
|
||||
"float",
|
||||
"indexable",
|
||||
"integer",
|
||||
"keyword",
|
||||
"sortable",
|
||||
"text",
|
||||
"date",
|
||||
"validatable",
|
||||
"filterable",
|
||||
"inheritTags",
|
||||
"minLength",
|
||||
"pattern",
|
||||
"typeparam",
|
||||
"TJS-format"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
## What's wrong with the current model?
|
||||
|
||||
???
|
||||
|
||||
## How should the model be instead?
|
||||
|
||||
???
|
||||
|
||||
## Why should the model be that way?
|
||||
|
||||
??? - Describe use case!
|
||||
|
||||
/label ~bug ~meeting
|
||||
@@ -1,17 +0,0 @@
|
||||
## What needs to be remodeled?
|
||||
|
||||
??? - Describe use case!
|
||||
|
||||
## How is the current model not sufficient?
|
||||
|
||||
???
|
||||
|
||||
## Which changes are necessary?
|
||||
|
||||
???
|
||||
|
||||
## Do the proposed changes impact current use cases?
|
||||
|
||||
???
|
||||
|
||||
/label ~feature ~meeting
|
||||
@@ -1,15 +0,0 @@
|
||||
## What needs to be modeled?
|
||||
|
||||
???
|
||||
|
||||
## Why is a new model necessary?
|
||||
|
||||
??? - Describe use case!
|
||||
|
||||
## Dependencies, issues, features that need to be resolved beforehand
|
||||
|
||||
1. ???
|
||||
2. ???
|
||||
3. ...
|
||||
|
||||
/label ~feature ~meeting
|
||||
@@ -1,4 +0,0 @@
|
||||
Rainer Killinger <mail-openstapps@killinger.co> Rainer Killinger <git@killinger.co>
|
||||
Rainer Killinger <mail-openstapps@killinger.co> Rainer Killinger <killinge@hrz.uni-frankfurt.de>
|
||||
Rainer Killinger <mail-openstapps@killinger.co> Rainer Killinger <killinger@hrz.uni-frankfurt.de>
|
||||
Thea Schöbl <dev@theaninova.de>
|
||||
@@ -22,662 +22,429 @@
|
||||
|
||||
# [0.75.0](https://gitlab.com/openstapps/core/compare/v0.74.0...v0.75.0) (2023-02-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add rating for things ([28eacf7](https://gitlab.com/openstapps/core/commit/28eacf7925f84caa129cad4b94fb449effd4d6ea)), closes [#152](https://gitlab.com/openstapps/core/issues/152)
|
||||
|
||||
|
||||
- add rating for things ([28eacf7](https://gitlab.com/openstapps/core/commit/28eacf7925f84caa129cad4b94fb449effd4d6ea)), closes [#152](https://gitlab.com/openstapps/core/issues/152)
|
||||
|
||||
# [0.74.0](https://gitlab.com/openstapps/core/compare/v0.73.0...v0.74.0) (2023-01-30)
|
||||
|
||||
|
||||
|
||||
# [0.73.0](https://gitlab.com/openstapps/core/compare/v0.72.0...v0.73.0) (2023-01-12)
|
||||
|
||||
|
||||
|
||||
# [0.72.0](https://gitlab.com/openstapps/core/compare/v0.71.1...v0.72.0) (2022-12-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add dish menu section and service times ([be98fd8](https://gitlab.com/openstapps/core/commit/be98fd8c4c2fbb01eb80808bf3aa609b08b90ec6)), closes [#150](https://gitlab.com/openstapps/core/issues/150)
|
||||
|
||||
|
||||
- add dish menu section and service times ([be98fd8](https://gitlab.com/openstapps/core/commit/be98fd8c4c2fbb01eb80808bf3aa609b08b90ec6)), closes [#150](https://gitlab.com/openstapps/core/issues/150)
|
||||
|
||||
## [0.71.1](https://gitlab.com/openstapps/core/compare/v0.71.0...v0.71.1) (2022-11-22)
|
||||
|
||||
|
||||
|
||||
# [0.71.0](https://gitlab.com/openstapps/core/compare/v0.70.0...v0.71.0) (2022-10-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add new book categories ([dd138fd](https://gitlab.com/openstapps/core/commit/dd138fd0be6d8100fc242816f5eb2549f2672ab3)), closes [#147](https://gitlab.com/openstapps/core/issues/147)
|
||||
|
||||
|
||||
- add new book categories ([dd138fd](https://gitlab.com/openstapps/core/commit/dd138fd0be6d8100fc242816f5eb2549f2672ab3)), closes [#147](https://gitlab.com/openstapps/core/issues/147)
|
||||
|
||||
# [0.70.0](https://gitlab.com/openstapps/core/compare/v0.69.0...v0.70.0) (2022-09-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add auth provider to config menu items ([b183198](https://gitlab.com/openstapps/core/commit/b18319802969d711373e70cca5921730345aa3e8))
|
||||
|
||||
|
||||
- add auth provider to config menu items ([b183198](https://gitlab.com/openstapps/core/commit/b18319802969d711373e70cca5921730345aa3e8))
|
||||
|
||||
# [0.69.0](https://gitlab.com/openstapps/core/compare/v0.68.0...v0.69.0) (2022-08-17)
|
||||
|
||||
|
||||
|
||||
# [0.68.0](https://gitlab.com/openstapps/core/compare/v0.67.0...v0.68.0) (2022-06-27)
|
||||
|
||||
|
||||
|
||||
# [0.67.0](https://gitlab.com/openstapps/core/compare/v0.66.1...v0.67.0) (2022-05-31)
|
||||
|
||||
|
||||
|
||||
## [0.66.1](https://gitlab.com/openstapps/core/compare/v0.66.0...v0.66.1) (2022-05-27)
|
||||
|
||||
|
||||
|
||||
# [0.66.0](https://gitlab.com/openstapps/core/compare/v0.65.1...v0.66.0) (2022-05-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add geo filter envelope support ([484be6a](https://gitlab.com/openstapps/core/commit/484be6a890d743601efa5d40d33ea2c619f3126d))
|
||||
|
||||
|
||||
- add geo filter envelope support ([484be6a](https://gitlab.com/openstapps/core/commit/484be6a890d743601efa5d40d33ea2c619f3126d))
|
||||
|
||||
## [0.65.1](https://gitlab.com/openstapps/core/compare/v0.65.0...v0.65.1) (2022-04-04)
|
||||
|
||||
|
||||
|
||||
# [0.65.0](https://gitlab.com/openstapps/core/compare/v0.64.0...v0.65.0) (2022-04-04)
|
||||
|
||||
|
||||
|
||||
# [0.64.0](https://gitlab.com/openstapps/core/compare/v0.63.0...v0.64.0) (2022-03-21)
|
||||
|
||||
|
||||
|
||||
# [0.63.0](https://gitlab.com/openstapps/core/compare/v0.62.0...v0.63.0) (2022-01-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add auth object to index route ([e149931](https://gitlab.com/openstapps/core/commit/e14993114f0ec370775010eee4ad0d302a0beebb))
|
||||
|
||||
|
||||
- add auth object to index route ([e149931](https://gitlab.com/openstapps/core/commit/e14993114f0ec370775010eee4ad0d302a0beebb))
|
||||
|
||||
# [0.62.0](https://gitlab.com/openstapps/core/compare/v0.61.0...v0.62.0) (2022-01-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing lastPublished to SCCreativeWork ([e0adb23](https://gitlab.com/openstapps/core/commit/e0adb2332ec24ce388c4c008b51b7aa941948532))
|
||||
|
||||
|
||||
- add missing lastPublished to SCCreativeWork ([e0adb23](https://gitlab.com/openstapps/core/commit/e0adb2332ec24ce388c4c008b51b7aa941948532))
|
||||
|
||||
# [0.61.0](https://gitlab.com/openstapps/core/compare/v0.60.0...v0.61.0) (2022-01-21)
|
||||
|
||||
|
||||
|
||||
# [0.60.0](https://gitlab.com/openstapps/core/compare/v0.59.0...v0.60.0) (2022-01-21)
|
||||
|
||||
|
||||
|
||||
# [0.59.0](https://gitlab.com/openstapps/core/compare/v0.58.0...v0.59.0) (2022-01-20)
|
||||
|
||||
|
||||
|
||||
# [0.58.0](https://gitlab.com/openstapps/core/compare/v0.57.0...v0.58.0) (2022-01-18)
|
||||
|
||||
|
||||
|
||||
# [0.57.0](https://gitlab.com/openstapps/core/compare/v0.56.0...v0.57.0) (2022-01-18)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* extend config to describe auth providers ([7553620](https://gitlab.com/openstapps/core/commit/7553620a5d330ebfb66461afeab700e36bd37165))
|
||||
|
||||
|
||||
- extend config to describe auth providers ([7553620](https://gitlab.com/openstapps/core/commit/7553620a5d330ebfb66461afeab700e36bd37165))
|
||||
|
||||
# [0.56.0](https://gitlab.com/openstapps/core/compare/v0.55.0...v0.56.0) (2021-12-17)
|
||||
|
||||
|
||||
|
||||
# [0.55.0](https://gitlab.com/openstapps/core/compare/v0.54.0...v0.55.0) (2021-12-15)
|
||||
|
||||
|
||||
|
||||
# [0.54.0](https://gitlab.com/openstapps/core/compare/v0.53.0...v0.54.0) (2021-11-17)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add SCAssessment ([7a2e0f2](https://gitlab.com/openstapps/core/commit/7a2e0f20d1c64ab1deb7ab30bfb4bab4daaabd6d))
|
||||
|
||||
|
||||
- add SCAssessment ([7a2e0f2](https://gitlab.com/openstapps/core/commit/7a2e0f20d1c64ab1deb7ab30bfb4bab4daaabd6d))
|
||||
|
||||
# [0.53.0](https://gitlab.com/openstapps/core/compare/v0.52.0...v0.53.0) (2021-10-19)
|
||||
|
||||
|
||||
|
||||
# [0.52.0](https://gitlab.com/openstapps/core/compare/v0.51.0...v0.52.0) (2021-09-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add about config ([aa294c4](https://gitlab.com/openstapps/core/commit/aa294c4e29e9191bef6d79487b0b321fbc34f6fb))
|
||||
|
||||
|
||||
- add about config ([aa294c4](https://gitlab.com/openstapps/core/commit/aa294c4e29e9191bef6d79487b0b321fbc34f6fb))
|
||||
|
||||
# [0.51.0](https://gitlab.com/openstapps/core/compare/v0.50.0...v0.51.0) (2021-09-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add physicalobject to book categories ([ded8e7d](https://gitlab.com/openstapps/core/commit/ded8e7dfd51094c02a86e1383a4e94c069c10e64))
|
||||
|
||||
|
||||
- add physicalobject to book categories ([ded8e7d](https://gitlab.com/openstapps/core/commit/ded8e7dfd51094c02a86e1383a4e94c069c10e64))
|
||||
|
||||
# [0.50.0](https://gitlab.com/openstapps/core/compare/v0.49.5...v0.50.0) (2021-09-01)
|
||||
|
||||
|
||||
|
||||
## [0.49.5](https://gitlab.com/openstapps/core/compare/v0.49.3...v0.49.5) (2021-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* test resources from hds2 ([dfe35d7](https://gitlab.com/openstapps/core/commit/dfe35d71a38c35064726365f99714abff3b30ba6))
|
||||
|
||||
|
||||
- test resources from hds2 ([dfe35d7](https://gitlab.com/openstapps/core/commit/dfe35d71a38c35064726365f99714abff3b30ba6))
|
||||
|
||||
## [0.49.3](https://gitlab.com/openstapps/core/compare/v0.49.2...v0.49.3) (2021-08-18)
|
||||
|
||||
|
||||
|
||||
## [0.49.2](https://gitlab.com/openstapps/core/compare/v0.49.1...v0.49.2) (2021-08-17)
|
||||
|
||||
|
||||
|
||||
## [0.49.1](https://gitlab.com/openstapps/core/compare/v0.49.0...v0.49.1) (2021-08-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* documentation generation ([8a28d6f](https://gitlab.com/openstapps/core/commit/8a28d6fa8657d778d6ae0d38cda7da3531d6478c))
|
||||
|
||||
|
||||
- documentation generation ([8a28d6f](https://gitlab.com/openstapps/core/commit/8a28d6fa8657d778d6ae0d38cda7da3531d6478c))
|
||||
|
||||
# [0.49.0](https://gitlab.com/openstapps/core/compare/v0.48.0...v0.49.0) (2021-08-12)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add elasticsearch mappings to build ([21eeecd](https://gitlab.com/openstapps/core/commit/21eeecd5ee0d68a4faa93bb70d2187ce35807b01))
|
||||
|
||||
|
||||
- add elasticsearch mappings to build ([21eeecd](https://gitlab.com/openstapps/core/commit/21eeecd5ee0d68a4faa93bb70d2187ce35807b01))
|
||||
|
||||
# [0.48.0](https://gitlab.com/openstapps/core/compare/v0.47.0...v0.48.0) (2021-07-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct parameter name of thing update route ([872c1f5](https://gitlab.com/openstapps/core/commit/872c1f5fc3884b6df6f5025287873d98b27dd6b1))
|
||||
|
||||
- correct parameter name of thing update route ([872c1f5](https://gitlab.com/openstapps/core/commit/872c1f5fc3884b6df6f5025287873d98b27dd6b1))
|
||||
|
||||
### Features
|
||||
|
||||
* support geo shape queries ([882483e](https://gitlab.com/openstapps/core/commit/882483ee2490938014904bc26687bd1648992ae6))
|
||||
|
||||
|
||||
- support geo shape queries ([882483e](https://gitlab.com/openstapps/core/commit/882483ee2490938014904bc26687bd1648992ae6))
|
||||
|
||||
# [0.47.0](https://gitlab.com/openstapps/core/compare/v0.46.0...v0.47.0) (2021-06-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* set date-series frequency non translatable ([4a4cd4e](https://gitlab.com/openstapps/core/commit/4a4cd4e6d4b01ac34b5338dfcf4aeb959f54461d))
|
||||
|
||||
- set date-series frequency non translatable ([4a4cd4e](https://gitlab.com/openstapps/core/commit/4a4cd4e6d4b01ac34b5338dfcf4aeb959f54461d))
|
||||
|
||||
### Features
|
||||
|
||||
* make SCDateSeries.frequency compliant with schema.org ([942cd11](https://gitlab.com/openstapps/core/commit/942cd1146966aa9e60321160489a6605877925e9))
|
||||
|
||||
|
||||
- make SCDateSeries.frequency compliant with schema.org ([942cd11](https://gitlab.com/openstapps/core/commit/942cd1146966aa9e60321160489a6605877925e9))
|
||||
|
||||
# [0.46.0](https://gitlab.com/openstapps/core/compare/v0.45.0...v0.46.0) (2021-05-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* change range offer to use date range ([9c6972a](https://gitlab.com/openstapps/core/commit/9c6972af787678567409877b6bc9f9417e1374e2))
|
||||
|
||||
|
||||
- change range offer to use date range ([9c6972a](https://gitlab.com/openstapps/core/commit/9c6972af787678567409877b6bc9f9417e1374e2))
|
||||
|
||||
# [0.45.0](https://gitlab.com/openstapps/core/compare/v0.44.0...v0.45.0) (2021-04-26)
|
||||
|
||||
|
||||
|
||||
# [0.44.0](https://gitlab.com/openstapps/core/compare/v0.43.0...v0.44.0) (2021-04-12)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for multiple values in the value filter ([913c569](https://gitlab.com/openstapps/core/commit/913c5691da46ad2591fe14bcf7286f12b29ab5ee))
|
||||
|
||||
|
||||
- add support for multiple values in the value filter ([913c569](https://gitlab.com/openstapps/core/commit/913c5691da46ad2591fe14bcf7286f12b29ab5ee))
|
||||
|
||||
# [0.43.0](https://gitlab.com/openstapps/core/compare/v0.42.0...v0.43.0) (2021-04-07)
|
||||
|
||||
|
||||
|
||||
# [0.42.0](https://gitlab.com/openstapps/core/compare/v0.41.0...v0.42.0) (2021-02-16)
|
||||
|
||||
|
||||
|
||||
# [0.41.0](https://gitlab.com/openstapps/core/compare/v0.40.0...v0.41.0) (2021-02-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add date, numeric range filter to SCSearchFilter ([8510f11](https://gitlab.com/openstapps/core/commit/8510f11d7b4c62a6b239a70f47fe07e8cc86ab63))
|
||||
|
||||
|
||||
- add date, numeric range filter to SCSearchFilter ([8510f11](https://gitlab.com/openstapps/core/commit/8510f11d7b4c62a6b239a70f47fe07e8cc86ab63))
|
||||
|
||||
# [0.40.0](https://gitlab.com/openstapps/core/compare/v0.39.0...v0.40.0) (2021-02-05)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add range filter, date sorting support ([29bc006](https://gitlab.com/openstapps/core/commit/29bc00616e87a8d346d8c304fab2e3818921c75e))
|
||||
|
||||
|
||||
- add range filter, date sorting support ([29bc006](https://gitlab.com/openstapps/core/commit/29bc00616e87a8d346d8c304fab2e3818921c75e))
|
||||
|
||||
# [0.39.0](https://gitlab.com/openstapps/core/compare/v0.38.1...v0.39.0) (2020-12-01)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* extend property value translation retrival ([a246bde](https://gitlab.com/openstapps/core/commit/a246bdea84e0ca390be6ab38723d637626db87d2))
|
||||
|
||||
|
||||
- extend property value translation retrival ([a246bde](https://gitlab.com/openstapps/core/commit/a246bdea84e0ca390be6ab38723d637626db87d2))
|
||||
|
||||
## [0.38.1](https://gitlab.com/openstapps/core/compare/v0.38.0...v0.38.1) (2020-11-02)
|
||||
|
||||
|
||||
|
||||
# [0.38.0](https://gitlab.com/openstapps/core/compare/v0.37.0...v0.38.0) (2020-10-30)
|
||||
|
||||
|
||||
|
||||
# [0.37.0](https://gitlab.com/openstapps/core/compare/v0.36.0...v0.37.0) (2020-09-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove keyword tag from steps ([c369c85](https://gitlab.com/openstapps/core/commit/c369c8520a2eed169555a35a50ce745c08e1f9da))
|
||||
* remove redundant property declaration ([66075ef](https://gitlab.com/openstapps/core/commit/66075ef99b95198a9cd5c0a396603e089221bcd9))
|
||||
|
||||
|
||||
- remove keyword tag from steps ([c369c85](https://gitlab.com/openstapps/core/commit/c369c8520a2eed169555a35a50ce745c08e1f9da))
|
||||
- remove redundant property declaration ([66075ef](https://gitlab.com/openstapps/core/commit/66075ef99b95198a9cd5c0a396603e089221bcd9))
|
||||
|
||||
# [0.36.0](https://gitlab.com/openstapps/core/compare/v0.35.0...v0.36.0) (2020-07-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add function to get translated SCThingType ([fe7f1a5](https://gitlab.com/openstapps/core/commit/fe7f1a53ae46e052e23f1b39851f1547b5a8dded))
|
||||
|
||||
|
||||
- add function to get translated SCThingType ([fe7f1a5](https://gitlab.com/openstapps/core/commit/fe7f1a53ae46e052e23f1b39851f1547b5a8dded))
|
||||
|
||||
# [0.35.0](https://gitlab.com/openstapps/core/compare/v0.34.0...v0.35.0) (2020-05-13)
|
||||
|
||||
|
||||
|
||||
# [0.34.0](https://gitlab.com/openstapps/core/compare/v0.33.0...v0.34.0) (2020-04-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add [@sortable](https://gitlab.com/sortable) tags to certain translatable properties ([f5e8856](https://gitlab.com/openstapps/core/commit/f5e88569eb75578febbcde67259c0c14563e53fe))
|
||||
* annotate SCThing uid and url as filterable ([70c1a3e](https://gitlab.com/openstapps/core/commit/70c1a3eaa3d1c88f4b86f0df86d0d362ad1f930c))
|
||||
* Update src/things/book.ts - made ISBN optional ([6060113](https://gitlab.com/openstapps/core/commit/6060113df56b871bb5014a8a961974895e52158f))
|
||||
|
||||
|
||||
- add [@sortable](https://gitlab.com/sortable) tags to certain translatable properties ([f5e8856](https://gitlab.com/openstapps/core/commit/f5e88569eb75578febbcde67259c0c14563e53fe))
|
||||
- annotate SCThing uid and url as filterable ([70c1a3e](https://gitlab.com/openstapps/core/commit/70c1a3eaa3d1c88f4b86f0df86d0d362ad1f930c))
|
||||
- Update src/things/book.ts - made ISBN optional ([6060113](https://gitlab.com/openstapps/core/commit/6060113df56b871bb5014a8a961974895e52158f))
|
||||
|
||||
# [0.33.0](https://gitlab.com/openstapps/core/compare/v0.32.0...v0.33.0) (2020-02-11)
|
||||
|
||||
|
||||
|
||||
# [0.32.0](https://gitlab.com/openstapps/core/compare/v0.31.0...v0.32.0) (2020-02-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* make SCContactPoint extend SCThing ([0d89b14](https://gitlab.com/openstapps/core/commit/0d89b1493293f83e9096615f653a6094519d59f2))
|
||||
|
||||
|
||||
- make SCContactPoint extend SCThing ([0d89b14](https://gitlab.com/openstapps/core/commit/0d89b1493293f83e9096615f653a6094519d59f2))
|
||||
|
||||
# [0.31.0](https://gitlab.com/openstapps/core/compare/v0.30.0...v0.31.0) (2019-11-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove categories from custom translations ([9658f05](https://gitlab.com/openstapps/core/commit/9658f05d31366b3735da3aa548ef5ed0255d8054))
|
||||
* translator can now handle enum translations ([abda5cf](https://gitlab.com/openstapps/core/commit/abda5cf0caead37f085431e1e5a9771b79272ec6))
|
||||
|
||||
|
||||
- remove categories from custom translations ([9658f05](https://gitlab.com/openstapps/core/commit/9658f05d31366b3735da3aa548ef5ed0255d8054))
|
||||
- translator can now handle enum translations ([abda5cf](https://gitlab.com/openstapps/core/commit/abda5cf0caead37f085431e1e5a9771b79272ec6))
|
||||
|
||||
# [0.30.0](https://gitlab.com/openstapps/core/compare/v0.29.0...v0.30.0) (2019-11-08)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add aggregatable tag for type field ([443cb74](https://gitlab.com/openstapps/core/commit/443cb748fba1575f5f1e16c550fd33eb7fa7901c))
|
||||
* add new field sequenceIndex to message ([01f92ba](https://gitlab.com/openstapps/core/commit/01f92baa985013bfe1c79fad60351fdaf44bd676))
|
||||
|
||||
|
||||
- add aggregatable tag for type field ([443cb74](https://gitlab.com/openstapps/core/commit/443cb748fba1575f5f1e16c550fd33eb7fa7901c))
|
||||
- add new field sequenceIndex to message ([01f92ba](https://gitlab.com/openstapps/core/commit/01f92baa985013bfe1c79fad60351fdaf44bd676))
|
||||
|
||||
# [0.29.0](https://gitlab.com/openstapps/core/compare/v0.28.0...v0.29.0) (2019-09-17)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add mappingIgnoredTags property to SCBackend ([149f3ff](https://gitlab.com/openstapps/core/commit/149f3ffff15dce27337665abba520d11bc3014dd))
|
||||
|
||||
|
||||
- add mappingIgnoredTags property to SCBackend ([149f3ff](https://gitlab.com/openstapps/core/commit/149f3ffff15dce27337665abba520d11bc3014dd))
|
||||
|
||||
# [0.28.0](https://gitlab.com/openstapps/core/compare/v0.27.0...v0.28.0) (2019-09-10)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add onlyOnType field for SCFacet ([fba63db](https://gitlab.com/openstapps/core/commit/fba63db137c52212113545be1062d760f0c4213f))
|
||||
|
||||
|
||||
- add onlyOnType field for SCFacet ([fba63db](https://gitlab.com/openstapps/core/commit/fba63db137c52212113545be1062d760f0c4213f))
|
||||
|
||||
# [0.27.0](https://gitlab.com/openstapps/core/compare/v0.26.0...v0.27.0) (2019-09-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add [@filterable](https://gitlab.com/filterable) tags ([fec3371](https://gitlab.com/openstapps/core/commit/fec33715add996ae0a7125ad00ee043d288c6671))
|
||||
|
||||
|
||||
- add [@filterable](https://gitlab.com/filterable) tags ([fec3371](https://gitlab.com/openstapps/core/commit/fec33715add996ae0a7125ad00ee043d288c6671))
|
||||
|
||||
# [0.26.0](https://gitlab.com/openstapps/core/compare/v0.25.0...v0.26.0) (2019-08-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* complete german translations ([bad15dc](https://gitlab.com/openstapps/core/commit/bad15dc8728954ee6ee23fa68c471647328830b9))
|
||||
|
||||
- complete german translations ([bad15dc](https://gitlab.com/openstapps/core/commit/bad15dc8728954ee6ee23fa68c471647328830b9))
|
||||
|
||||
### Features
|
||||
|
||||
* add pluginRequestTimeout field to backend config ([88f579e](https://gitlab.com/openstapps/core/commit/88f579e09bc5e7726dbc4fc788737ba49a0801cd))
|
||||
|
||||
|
||||
- add pluginRequestTimeout field to backend config ([88f579e](https://gitlab.com/openstapps/core/commit/88f579e09bc5e7726dbc4fc788737ba49a0801cd))
|
||||
|
||||
# [0.25.0](https://gitlab.com/openstapps/core/compare/v0.24.0...v0.25.0) (2019-07-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct package job ([d4a8ef6](https://gitlab.com/openstapps/core/commit/d4a8ef6a9ca69849f8b981804da45e4ba907f37b))
|
||||
|
||||
|
||||
- correct package job ([d4a8ef6](https://gitlab.com/openstapps/core/commit/d4a8ef6a9ca69849f8b981804da45e4ba907f37b))
|
||||
|
||||
# [0.24.0](https://gitlab.com/openstapps/core/compare/v0.23.1...v0.24.0) (2019-07-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add new field receivingOrganisations to message ([d781dd6](https://gitlab.com/openstapps/core/commit/d781dd6de5cc7572b9218df959247b93cb2db305))
|
||||
|
||||
|
||||
- add new field receivingOrganisations to message ([d781dd6](https://gitlab.com/openstapps/core/commit/d781dd6de5cc7572b9218df959247b93cb2db305))
|
||||
|
||||
## [0.23.1](https://gitlab.com/openstapps/core/compare/v0.23.0...v0.23.1) (2019-07-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use correct generic for the distance filter ([f262a6b](https://gitlab.com/openstapps/core/commit/f262a6b8fa7a9d40234569ec490d5ef8e9437a75))
|
||||
|
||||
- use correct generic for the distance filter ([f262a6b](https://gitlab.com/openstapps/core/commit/f262a6b8fa7a9d40234569ec490d5ef8e9437a75))
|
||||
|
||||
### Features
|
||||
|
||||
* add type maps from routes to requests and responses ([e1d4b2b](https://gitlab.com/openstapps/core/commit/e1d4b2bc9de60a2332788c9a2264760d151c8813)), closes [#80](https://gitlab.com/openstapps/core/issues/80)
|
||||
|
||||
|
||||
- add type maps from routes to requests and responses ([e1d4b2b](https://gitlab.com/openstapps/core/commit/e1d4b2bc9de60a2332788c9a2264760d151c8813)), closes [#80](https://gitlab.com/openstapps/core/issues/80)
|
||||
|
||||
# [0.23.0](https://gitlab.com/openstapps/core/compare/v0.22.0...v0.23.0) (2019-07-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add mapping type from response to request and vice versa ([c18e3c1](https://gitlab.com/openstapps/core/commit/c18e3c15f1940338b6872343f6b20dba6346f84b)), closes [#80](https://gitlab.com/openstapps/core/issues/80)
|
||||
* support 404 (resource not found) error on plugin register route ([43851d2](https://gitlab.com/openstapps/core/commit/43851d2d358c4c342a80a863b059a6447c819c04))
|
||||
|
||||
|
||||
- add mapping type from response to request and vice versa ([c18e3c1](https://gitlab.com/openstapps/core/commit/c18e3c15f1940338b6872343f6b20dba6346f84b)), closes [#80](https://gitlab.com/openstapps/core/issues/80)
|
||||
- support 404 (resource not found) error on plugin register route ([43851d2](https://gitlab.com/openstapps/core/commit/43851d2d358c4c342a80a863b059a6447c819c04))
|
||||
|
||||
# [0.22.0](https://gitlab.com/openstapps/core/compare/v0.21.0...v0.22.0) (2019-06-28)
|
||||
|
||||
|
||||
|
||||
# [0.21.0](https://gitlab.com/openstapps/core/compare/v0.20.0...v0.21.0) (2019-06-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add ES annotations ([9c424b0](https://gitlab.com/openstapps/core/commit/9c424b0f96da26d3aae9ffaadb2c640e7369ca7e))
|
||||
* add static typed test for consistency ([ff1f554](https://gitlab.com/openstapps/core/commit/ff1f554e0beacb5ce2f3308c8212e2b8e4d8cbb0)), closes [#71](https://gitlab.com/openstapps/core/issues/71)
|
||||
|
||||
|
||||
- add ES annotations ([9c424b0](https://gitlab.com/openstapps/core/commit/9c424b0f96da26d3aae9ffaadb2c640e7369ca7e))
|
||||
- add static typed test for consistency ([ff1f554](https://gitlab.com/openstapps/core/commit/ff1f554e0beacb5ce2f3308c8212e2b8e4d8cbb0)), closes [#71](https://gitlab.com/openstapps/core/issues/71)
|
||||
|
||||
# [0.20.0](https://gitlab.com/openstapps/core/compare/v0.19.0...v0.20.0) (2019-06-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add translations for every SCThing ([f847a2a](https://gitlab.com/openstapps/core/commit/f847a2aa0cf576e2fd79197cdc7795638d929136))
|
||||
* rename properties floor and message so that they are not identical to SCThingTypes ([78b64ba](https://gitlab.com/openstapps/core/commit/78b64bae08d9ca12badaedf921a24fa5ffe90552))
|
||||
|
||||
|
||||
- add translations for every SCThing ([f847a2a](https://gitlab.com/openstapps/core/commit/f847a2aa0cf576e2fd79197cdc7795638d929136))
|
||||
- rename properties floor and message so that they are not identical to SCThingTypes ([78b64ba](https://gitlab.com/openstapps/core/commit/78b64bae08d9ca12badaedf921a24fa5ffe90552))
|
||||
|
||||
# [0.19.0](https://gitlab.com/openstapps/core/compare/v0.18.0...v0.19.0) (2019-05-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add thing without references, split thing ([da0507e](https://gitlab.com/openstapps/core/commit/da0507ee341af75cd15dddeeb3f4cbe08899434c)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
|
||||
* adjust model to remove references from things without references ([ca72c20](https://gitlab.com/openstapps/core/commit/ca72c20bd098032745ed0eb6978902b6ff6feac5)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
|
||||
* remove references from origins ([1d6a2b7](https://gitlab.com/openstapps/core/commit/1d6a2b7841e9c38e68c9e5c718377a9c04fe50d6)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
|
||||
|
||||
|
||||
- add thing without references, split thing ([da0507e](https://gitlab.com/openstapps/core/commit/da0507ee341af75cd15dddeeb3f4cbe08899434c)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
|
||||
- adjust model to remove references from things without references ([ca72c20](https://gitlab.com/openstapps/core/commit/ca72c20bd098032745ed0eb6978902b6ff6feac5)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
|
||||
- remove references from origins ([1d6a2b7](https://gitlab.com/openstapps/core/commit/1d6a2b7841e9c38e68c9e5c718377a9c04fe50d6)), closes [#69](https://gitlab.com/openstapps/core/issues/69)
|
||||
|
||||
# [0.18.0](https://gitlab.com/openstapps/core/compare/v0.17.0...v0.18.0) (2019-05-14)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add study module interface ([d3790ad](https://gitlab.com/openstapps/core/commit/d3790adbd82417923d79b4a5a35c74fcaab3e050))
|
||||
|
||||
|
||||
- add study module interface ([d3790ad](https://gitlab.com/openstapps/core/commit/d3790adbd82417923d79b4a5a35c74fcaab3e050))
|
||||
|
||||
# [0.17.0](https://gitlab.com/openstapps/core/compare/v0.16.0...v0.17.0) (2019-04-16)
|
||||
|
||||
|
||||
|
||||
# [0.16.0](https://gitlab.com/openstapps/core/compare/v0.15.0...v0.16.0) (2019-04-15)
|
||||
|
||||
|
||||
|
||||
# [0.15.0](https://gitlab.com/openstapps/core/compare/v0.14.0...v0.15.0) (2019-04-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* change SCThingMeta getInstance() return value ([4986042](https://gitlab.com/openstapps/core/commit/4986042428e24a04b73fb03d71c01353588419a7))
|
||||
* resolve issues with things that can be offered ([623ed61](https://gitlab.com/openstapps/core/commit/623ed613a9405b53a86a33c13d48bc49d48de1ce)), closes [#41](https://gitlab.com/openstapps/core/issues/41)
|
||||
|
||||
- change SCThingMeta getInstance() return value ([4986042](https://gitlab.com/openstapps/core/commit/4986042428e24a04b73fb03d71c01353588419a7))
|
||||
- resolve issues with things that can be offered ([623ed61](https://gitlab.com/openstapps/core/commit/623ed613a9405b53a86a33c13d48bc49d48de1ce)), closes [#41](https://gitlab.com/openstapps/core/issues/41)
|
||||
|
||||
### Features
|
||||
|
||||
* provide context based search ([3242411](https://gitlab.com/openstapps/core/commit/324241176849b338bee9f5d1dcaf1109f47a8bb9))
|
||||
|
||||
|
||||
- provide context based search ([3242411](https://gitlab.com/openstapps/core/commit/324241176849b338bee9f5d1dcaf1109f47a8bb9))
|
||||
|
||||
# [0.14.0](https://gitlab.com/openstapps/core/compare/v0.13.0...v0.14.0) (2019-04-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add model for plugin register route ([8188731](https://gitlab.com/openstapps/core/commit/81887315f8c3038ec37c2197db8e193da835f6fc))
|
||||
|
||||
|
||||
- add model for plugin register route ([8188731](https://gitlab.com/openstapps/core/commit/81887315f8c3038ec37c2197db8e193da835f6fc))
|
||||
|
||||
# [0.13.0](https://gitlab.com/openstapps/core/compare/v0.12.0...v0.13.0) (2019-04-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct isThing guard ([67868e9](https://gitlab.com/openstapps/core/commit/67868e9eb810de94ca0bb6e1298799ee3f550145))
|
||||
* update tslint dependencies ([bbe4fca](https://gitlab.com/openstapps/core/commit/bbe4fcac42c21c68b5c6aa6bcf9bbdecfdf84de7))
|
||||
|
||||
- correct isThing guard ([67868e9](https://gitlab.com/openstapps/core/commit/67868e9eb810de94ca0bb6e1298799ee3f550145))
|
||||
- update tslint dependencies ([bbe4fca](https://gitlab.com/openstapps/core/commit/bbe4fcac42c21c68b5c6aa6bcf9bbdecfdf84de7))
|
||||
|
||||
### Features
|
||||
|
||||
* add conditional "maps" for associated types ([c8bda2e](https://gitlab.com/openstapps/core/commit/c8bda2eae7f44ec4a284cc26fc85051a9a45e192)), closes [#50](https://gitlab.com/openstapps/core/issues/50)
|
||||
* provide sample JSON files with the package ([5d1e79d](https://gitlab.com/openstapps/core/commit/5d1e79d4879e6ce8f43d4cebb9d8c8500d5d16b7)), closes [#46](https://gitlab.com/openstapps/core/issues/46)
|
||||
|
||||
|
||||
- add conditional "maps" for associated types ([c8bda2e](https://gitlab.com/openstapps/core/commit/c8bda2eae7f44ec4a284cc26fc85051a9a45e192)), closes [#50](https://gitlab.com/openstapps/core/issues/50)
|
||||
- provide sample JSON files with the package ([5d1e79d](https://gitlab.com/openstapps/core/commit/5d1e79d4879e6ce8f43d4cebb9d8c8500d5d16b7)), closes [#46](https://gitlab.com/openstapps/core/issues/46)
|
||||
|
||||
# [0.12.0](https://gitlab.com/openstapps/core/compare/v0.11.0...v0.12.0) (2019-03-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add todo to SCThingsWithoutDiff and SCClasses ([9a49442](https://gitlab.com/openstapps/core/commit/9a49442902a9f49439083a9197bd9f0a231d007d)), closes [#39](https://gitlab.com/openstapps/core/issues/39)
|
||||
|
||||
- add todo to SCThingsWithoutDiff and SCClasses ([9a49442](https://gitlab.com/openstapps/core/commit/9a49442902a9f49439083a9197bd9f0a231d007d)), closes [#39](https://gitlab.com/openstapps/core/issues/39)
|
||||
|
||||
### Features
|
||||
|
||||
* add SCThingTranslator class. move functionality accordingly ([90e3d22](https://gitlab.com/openstapps/core/commit/90e3d2239921bbfcea27b64aef9344ffee270b6d))
|
||||
|
||||
|
||||
- add SCThingTranslator class. move functionality accordingly ([90e3d22](https://gitlab.com/openstapps/core/commit/90e3d2239921bbfcea27b64aef9344ffee270b6d))
|
||||
|
||||
# [0.11.0](https://gitlab.com/openstapps/core/compare/v0.10.0...v0.11.0) (2019-02-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add laboratory and computer as room categories ([a0ab72e](https://gitlab.com/openstapps/core/commit/a0ab72e597f6a14cfc0bd8935e1ef765b86b90f7)), closes [#33](https://gitlab.com/openstapps/core/issues/33)
|
||||
* add maxRequestBodySize in backend configuration ([b5bd09e](https://gitlab.com/openstapps/core/commit/b5bd09e40bfb49463815538ebaa44ff53b5d7b92))
|
||||
|
||||
|
||||
- add laboratory and computer as room categories ([a0ab72e](https://gitlab.com/openstapps/core/commit/a0ab72e597f6a14cfc0bd8935e1ef765b86b90f7)), closes [#33](https://gitlab.com/openstapps/core/issues/33)
|
||||
- add maxRequestBodySize in backend configuration ([b5bd09e](https://gitlab.com/openstapps/core/commit/b5bd09e40bfb49463815538ebaa44ff53b5d7b92))
|
||||
|
||||
# [0.10.0](https://gitlab.com/openstapps/core/compare/v0.9.0...v0.10.0) (2019-02-18)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add model for requestBodyTooLargeError ([bc3a0f6](https://gitlab.com/openstapps/core/commit/bc3a0f6d11cba836a55cbd5787d68cfe655b68a6))
|
||||
|
||||
|
||||
- add model for requestBodyTooLargeError ([bc3a0f6](https://gitlab.com/openstapps/core/commit/bc3a0f6d11cba836a55cbd5787d68cfe655b68a6))
|
||||
|
||||
# [0.9.0](https://gitlab.com/openstapps/core/compare/v0.8.0...v0.9.0) (2019-02-14)
|
||||
|
||||
|
||||
|
||||
# [0.8.0](https://gitlab.com/openstapps/core/compare/v0.7.0...v0.8.0) (2019-02-13)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add config for maximum queries ([c7ab473](https://gitlab.com/openstapps/core/commit/c7ab47397e2a33b1c460b9038cbf53fec148316d))
|
||||
|
||||
|
||||
- add config for maximum queries ([c7ab473](https://gitlab.com/openstapps/core/commit/c7ab47397e2a33b1c460b9038cbf53fec148316d))
|
||||
|
||||
# [0.7.0](https://gitlab.com/openstapps/core/compare/v0.6.0...v0.7.0) (2019-02-13)
|
||||
|
||||
|
||||
|
||||
# [0.6.0](https://gitlab.com/openstapps/core/compare/v0.5.0...v0.6.0) (2019-02-07)
|
||||
|
||||
|
||||
|
||||
# [0.5.0](https://gitlab.com/openstapps/core/compare/v0.4.0...v0.5.0) (2019-02-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add model for syntax error ([a3f9fcb](https://gitlab.com/openstapps/core/commit/a3f9fcbfb0c35206adabc95792de076518f604f7))
|
||||
|
||||
|
||||
- add model for syntax error ([a3f9fcb](https://gitlab.com/openstapps/core/commit/a3f9fcbfb0c35206adabc95792de076518f604f7))
|
||||
|
||||
# [0.4.0](https://gitlab.com/openstapps/core/compare/v0.3.0...v0.4.0) (2019-01-31)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add draft of todo ([2860a11](https://gitlab.com/openstapps/core/commit/2860a11b618081ab88ecb1780a280cab37217a0e))
|
||||
|
||||
|
||||
- add draft of todo ([2860a11](https://gitlab.com/openstapps/core/commit/2860a11b618081ab88ecb1780a280cab37217a0e))
|
||||
|
||||
# [0.3.0](https://gitlab.com/openstapps/core/compare/v0.2.0...v0.3.0) (2019-01-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* set larger v8 stack size ([d3d08e7](https://gitlab.com/openstapps/core/commit/d3d08e7735808d4eae5aab4b263e36047c608679))
|
||||
|
||||
- set larger v8 stack size ([d3d08e7](https://gitlab.com/openstapps/core/commit/d3d08e7735808d4eae5aab4b263e36047c608679))
|
||||
|
||||
### Features
|
||||
|
||||
* add different origin types: remote and user ([13a4965](https://gitlab.com/openstapps/core/commit/13a49650c4498f6edbe17c9de3598e0180b866da)), closes [#12](https://gitlab.com/openstapps/core/issues/12)
|
||||
* add saveable thing for saving user/client data ([a4f3fab](https://gitlab.com/openstapps/core/commit/a4f3fab033ca18352c0119061f2d0e64252d4bbb)), closes [#12](https://gitlab.com/openstapps/core/issues/12)
|
||||
|
||||
|
||||
- add different origin types: remote and user ([13a4965](https://gitlab.com/openstapps/core/commit/13a49650c4498f6edbe17c9de3598e0180b866da)), closes [#12](https://gitlab.com/openstapps/core/issues/12)
|
||||
- add saveable thing for saving user/client data ([a4f3fab](https://gitlab.com/openstapps/core/commit/a4f3fab033ca18352c0119061f2d0e64252d4bbb)), closes [#12](https://gitlab.com/openstapps/core/issues/12)
|
||||
|
||||
# [0.2.0](https://gitlab.com/openstapps/core/compare/v0.1.0...v0.2.0) (2019-01-09)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* use tag [@validatable](https://gitlab.com/validatable) to mark schema types ([7f248ee](https://gitlab.com/openstapps/core/commit/7f248eea13c732a95c4ee8e1bc91afeee52e8c2d))
|
||||
|
||||
|
||||
- use tag [@validatable](https://gitlab.com/validatable) to mark schema types ([7f248ee](https://gitlab.com/openstapps/core/commit/7f248eea13c732a95c4ee8e1bc91afeee52e8c2d))
|
||||
|
||||
# [0.1.0](https://gitlab.com/openstapps/core/compare/v0.0.2...v0.1.0) (2018-12-17)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add base scheme for academic degrees ([85c8fc4](https://gitlab.com/openstapps/core/commit/85c8fc49c14b0ce45cf0cfdaf46c1ebe43b23ec7))
|
||||
* add schema for course of studies ([2d4a76a](https://gitlab.com/openstapps/core/commit/2d4a76a555603a395c81a7a92ce5d95ed04de9de))
|
||||
* add tool to generate documentation for routes ([1a07df2](https://gitlab.com/openstapps/core/commit/1a07df2d676895264f43b0138645d7c13f60c9db))
|
||||
|
||||
|
||||
- add base scheme for academic degrees ([85c8fc4](https://gitlab.com/openstapps/core/commit/85c8fc49c14b0ce45cf0cfdaf46c1ebe43b23ec7))
|
||||
- add schema for course of studies ([2d4a76a](https://gitlab.com/openstapps/core/commit/2d4a76a555603a395c81a7a92ce5d95ed04de9de))
|
||||
- add tool to generate documentation for routes ([1a07df2](https://gitlab.com/openstapps/core/commit/1a07df2d676895264f43b0138645d7c13f60c9db))
|
||||
|
||||
## [0.0.2](https://gitlab.com/openstapps/core/compare/v0.0.1...v0.0.2) (2018-11-29)
|
||||
|
||||
|
||||
|
||||
## [0.0.1](https://gitlab.com/openstapps/core/compare/2d770dde4464dc4cf4cdc29927aa4e4382914148...v0.0.1) (2018-11-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add core ([2d770dd](https://gitlab.com/openstapps/core/commit/2d770dde4464dc4cf4cdc29927aa4e4382914148))
|
||||
|
||||
|
||||
|
||||
- add core ([2d770dd](https://gitlab.com/openstapps/core/commit/2d770dde4464dc4cf4cdc29927aa4e4382914148))
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
# Contributing to `@openstapps/core`
|
||||
|
||||
Please see the appropriate general group contributing guides in [project-management](https://gitlab.com/openstapps/projectmanagement/tree/master/project-docs/workflow).
|
||||
|
||||
## Updating and releasing related projects
|
||||
|
||||
Following semantic versioning patches to the core should not break existing usage.
|
||||
|
||||
### API
|
||||
|
||||
Every minor and major version of the core needs a corresponding version of the [API](https://openstapps.gitlab.io/api) to be used in the app and connectors.
|
||||
|
||||
Because the API is an integral part of the App and Node.js-based connectors this should be done for every new minor and major release of the core.
|
||||
|
||||
### Backend
|
||||
|
||||
The [backend](https://openstapps.gitlab.io/backend) uses the core to validate requests and responses. With the use of the [core tools](https://openstapps.gitlab.io/core-tools) it uses the core to set up the database according to the model.
|
||||
|
||||
Like for the API there should be a new release of the backend for every minor and major release of the core.
|
||||
|
||||
### Core tools
|
||||
|
||||
The [core tools](https://openstapps.gitlab.io/core-tools) are more or less not dependent on a specific core version and should normally not need adjustments for new core versions as long the structure of the code in the core stays the same.
|
||||
|
||||
### App and connectors
|
||||
|
||||
[App](https://openstapps.gitlab.io/app) and connectors use the API to communicate with the backend. To ensure compatibility the version of the used core must be the same as the one that is used in the used API.
|
||||
|
||||
App and connectors should be updated regularly to new releases of the core but not as important like API and backend. Since the app is just a view for the data stored in the backend it is not necessary to be up to date with the newest core immediately and the connectors are developed independently by every school and up to their responsibility.
|
||||
|
||||
## Adding new Types
|
||||
|
||||
Adding new types requires changes at multiple locations for it to work correctly
|
||||
|
||||
### Required changes
|
||||
|
||||
- Add your SCThing and SCThingWithoutReferences to `src/things/your-thing-name.ts` and make them extend `SCThingWithoutReferences` and `SCThing` respectively
|
||||
- Add your SCThingMeta to `src/things/your-thing-name.ts` and make it extend `SCThingMeta`
|
||||
- Add your SCThingMeta to `SCClasses` in `src/meta.ts`
|
||||
- Add your SCThing to `SCThingsWithoutDiff` in `src/meta.ts`
|
||||
- Add your SCThingWithoutReferences to `SCAssociatedThingWithoutReferences` in `src/meta.ts`
|
||||
- Add your SCThing to `SCAssociatedThing` in `src/meta.ts`
|
||||
- Add your SCThing to the `SCThingType` enum in `src/things/abstract/thing.ts`
|
||||
- Add an example file for your SCThing in `test/resources/YourThingName.json`
|
||||
- Add the following lines for your SCThing in `test/type.spec.ts`:
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* Types of properties of SCYourThingName
|
||||
*/
|
||||
type SCYourThingNamePropertyTypes = PropertyTypesNested<SCYourThingName>;
|
||||
assert<NotHas<SCYourThingNamePropertyTypes, SCThingWithoutReferences>>(false);
|
||||
assert<Has<SCYourThingNamePropertyTypes, SCThingWithoutReferences>>(true);
|
||||
assert<NotHas<SCYourThingNamePropertyTypes, SCThing>>(true);
|
||||
assert<Has<SCYourThingNamePropertyTypes, SCThing>>(false);
|
||||
assert<Extends<SCYourThingNameWithoutReferences, SCThing>>(false);
|
||||
assert<Extends<SCYourThingName, SCThing>>(true);
|
||||
```
|
||||
|
||||
## Additional coding style
|
||||
|
||||
### Extract inline type definitions
|
||||
|
||||
For consistency and correct functionality of `core-tools` we need well-defined type assignments.
|
||||
|
||||
Type assignments shall always be primitive types, classes, interfaces, enums or unions. Not allowed are inline type-definitions. Those shall be refactored accordingly:
|
||||
|
||||
```typescript
|
||||
export interface SCPlaceWithoutReferences extends SCThing {
|
||||
...
|
||||
// Use this:
|
||||
geo: SCGeoInformation;
|
||||
|
||||
// Instead of:
|
||||
geo: {
|
||||
point: Point,
|
||||
polygon?: Polygon,
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Reuse the map structure
|
||||
|
||||
If you come around a map-like-type use `SCMap<T>`.
|
||||
|
||||
```typescript
|
||||
// Use this:
|
||||
interface AnyClass {
|
||||
inventory: SCMap<number>;
|
||||
}
|
||||
|
||||
// Instead of:
|
||||
interface AnyClass {
|
||||
inventory?: Array<{key: string; value: number}>;
|
||||
}
|
||||
// or instead of
|
||||
interface AnyClass {
|
||||
inventory?: {[key: string]: number};
|
||||
}
|
||||
```
|
||||
@@ -1,200 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
|
||||
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
13. Use with the GNU Affero General Public License.
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||
14. Revised Versions of this License.
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
16. Limitation of Liability.
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/ licenses/why-not-lgpl.html>.
|
||||
@@ -1,6 +1,6 @@
|
||||
# @openstapps/core
|
||||
|
||||
[](https://gitlab.com/openstapps/core/commits/master)
|
||||
[](https://gitlab.com/openstapps/core/commits/master)
|
||||
[](https://npmjs.com/package/@openstapps/core)
|
||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||
[](https://openstapps.gitlab.io/core)
|
||||
|
||||
@@ -17,28 +17,28 @@
|
||||
"Rainer Killinger <mail-openstapps@killinger.co>",
|
||||
"Roman Klopsch",
|
||||
"Sebastian Lange",
|
||||
"Thea Schöbl"
|
||||
"Thea Schöbl <dev@theaninova.de>"
|
||||
],
|
||||
"keywords": [
|
||||
"Model",
|
||||
"StApps"
|
||||
],
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "pnpm run compile && pnpm run schema && pnpm run mappings",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
|
||||
"check-configuration": "openstapps-configuration",
|
||||
"compile": "rimraf lib && tsc",
|
||||
"documentation": "typedoc --name \"@openstapps/core\" --includeVersion --out docs --readme README.md --listInvalidSymbolLinks --entryPointStrategy expand src",
|
||||
"build": "tsup --dts",
|
||||
"format": "prettier .",
|
||||
"format:fix": "prettier --write .",
|
||||
"lint": "eslint --ext .ts src/",
|
||||
"lint:fix": "eslint --fix --ext .ts src/",
|
||||
"mappings": "openstapps-es-mapping-generator mapping ../core/src -i minlength,pattern,see,tjs-format -m lib/mappings/mappings.json -a lib/mappings/aggregations.json",
|
||||
"mappings-integration": "openstapps-es-mapping-generator put-es-templates lib/mappings/mappings.json http://elasticsearch:9200/",
|
||||
"prepublishOnly": "npm ci && npm run build",
|
||||
"preversion": "npm run prepublishOnly",
|
||||
"push": "git push && git push origin \"v$npm_package_version\"",
|
||||
"schema": "node --max-old-space-size=8192 --stack-size=10240 ./node_modules/@openstapps/core-tools/lib/cli.js schema src lib/schema",
|
||||
"test": "nyc mocha --recursive 'test/*.spec.ts'",
|
||||
"version": "npm run changelog"
|
||||
"test": "nyc mocha --recursive 'test/*.spec.ts'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@openstapps/core-tools": "workspace:*",
|
||||
"@types/geojson": "1.0.6",
|
||||
"fast-deep-equal": "3.1.3",
|
||||
"http-status-codes": "2.2.0",
|
||||
"json-patch": "0.7.0",
|
||||
@@ -46,78 +46,81 @@
|
||||
"rfdc": "1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openstapps/configuration": "workspace:*",
|
||||
"@openstapps/es-mapping-generator": "workspace:*",
|
||||
"@openstapps/eslint-config": "workspace:*",
|
||||
"@openstapps/logger": "workspace:*",
|
||||
"@openstapps/prettier-config": "workspace:*",
|
||||
"@openstapps/tsconfig": "workspace:*",
|
||||
"@testdeck/mocha": "0.3.3",
|
||||
"@types/chai": "4.3.4",
|
||||
"@types/geojson": "1.0.6",
|
||||
"@types/json-patch": "0.0.30",
|
||||
"@types/json-schema": "7.0.11",
|
||||
"@types/mocha": "10.0.1",
|
||||
"@types/node": "18.15.3",
|
||||
"@types/rimraf": "3.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "5.49.0",
|
||||
"@typescript-eslint/parser": "5.49.0",
|
||||
"chai": "4.3.7",
|
||||
"conditional-type-checks": "1.0.6",
|
||||
"conventional-changelog-cli": "2.2.2",
|
||||
"eslint": "8.33.0",
|
||||
"eslint-config-prettier": "8.6.0",
|
||||
"eslint-plugin-jsdoc": "39.7.4",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"eslint-plugin-unicorn": "45.0.2",
|
||||
"mocha": "10.2.0",
|
||||
"nyc": "15.1.0",
|
||||
"prettier": "2.8.3",
|
||||
"rimraf": "4.4.0",
|
||||
"source-map-support": "0.5.21",
|
||||
"surge": "0.23.1",
|
||||
"ts-node": "10.9.1",
|
||||
"typedoc": "0.23.26",
|
||||
"tsup": "6.7.0",
|
||||
"typescript": "4.8.4"
|
||||
},
|
||||
"tsup": {
|
||||
"entry": [
|
||||
"src/index.ts"
|
||||
],
|
||||
"sourcemap": true,
|
||||
"clean": true,
|
||||
"format": "esm",
|
||||
"outDir": "lib"
|
||||
},
|
||||
"prettier": "@openstapps/prettier-config",
|
||||
"keywords": [
|
||||
"Model",
|
||||
"StApps"
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"@openstapps"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-empty-interface": "off",
|
||||
"jsdoc/check-tag-names": [
|
||||
"error",
|
||||
{
|
||||
"definedTags": [
|
||||
"internal",
|
||||
"aggregatable",
|
||||
"float",
|
||||
"indexable",
|
||||
"integer",
|
||||
"keyword",
|
||||
"sortable",
|
||||
"text",
|
||||
"date",
|
||||
"validatable",
|
||||
"filterable",
|
||||
"inheritTags",
|
||||
"minLength",
|
||||
"pattern",
|
||||
"typeparam",
|
||||
"TJS-format"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"eslintIgnore": [
|
||||
"resources",
|
||||
"openapi"
|
||||
],
|
||||
"nyc": {
|
||||
"all": true,
|
||||
"branches": 90,
|
||||
"check-coverage": true,
|
||||
"exclude": [],
|
||||
"extension": [
|
||||
".ts"
|
||||
],
|
||||
"functions": 95,
|
||||
"include": [
|
||||
"src/protocol/route.ts",
|
||||
"src/things/abstract/thing.ts",
|
||||
"src/things/abstract/thing-that-can-be-offered.ts",
|
||||
"src/things/abstract/thing-with-categories.ts",
|
||||
"src/translator.ts",
|
||||
"src/guards.ts"
|
||||
],
|
||||
"lines": 95,
|
||||
"per-file": true,
|
||||
"reporter": [
|
||||
"cobertura",
|
||||
"html",
|
||||
"text-summary"
|
||||
],
|
||||
"require": [
|
||||
"ts-node/register"
|
||||
],
|
||||
"statements": 95
|
||||
"extends": "@openstapps/nyc-config"
|
||||
},
|
||||
"openstappsConfiguration": {
|
||||
"hasCli": false,
|
||||
"ignoreCiEntries": [
|
||||
"build"
|
||||
],
|
||||
"standardBuild": false,
|
||||
"standardDocumentation": false
|
||||
"openstapps-configuration": {
|
||||
"overrides": [
|
||||
"lint"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ValidationError} from '@openstapps/core-tools/lib/types/validator.js';
|
||||
import {ValidationError} from '@openstapps/core-tools';
|
||||
import {StatusCodes} from 'http-status-codes';
|
||||
import {SCError} from '../error.js';
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import equal = require('fast-deep-equal/es6');
|
||||
import clone = require('rfdc');
|
||||
import equal from 'fast-deep-equal/es6';
|
||||
import clone from 'rfdc';
|
||||
import {SCLanguageCode} from './general/i18n.js';
|
||||
import {isThing} from './guards.js';
|
||||
import {SCClasses} from './meta.js';
|
||||
@@ -92,12 +92,11 @@ export class SCThingTranslator {
|
||||
* @returns a T object allowing for access to translations or a translated value(s)
|
||||
*/
|
||||
private deeptranslate<T>(data: T): T {
|
||||
return typeof data === 'object' ? new Proxy(
|
||||
data as never,
|
||||
{
|
||||
get: (target, key) => this.deeptranslate(target[key as never]),
|
||||
},
|
||||
) as unknown as T : data;
|
||||
return typeof data === 'object'
|
||||
? (new Proxy(data as never, {
|
||||
get: (target, key) => this.deeptranslate(target[key as never]),
|
||||
}) as unknown as T)
|
||||
: data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,25 +253,22 @@ export class SCThingTranslator {
|
||||
* @returns an TSOCType<T> object allowing for access to translations or a translated value(s)
|
||||
*/
|
||||
public translatedAccess<T extends SCThing>(thing: T): T {
|
||||
return new Proxy(
|
||||
thing,
|
||||
{
|
||||
get: (target, key) => {
|
||||
const object: any = target;
|
||||
if (equal(this.sourceCache.get(thing), thing)) {
|
||||
const objectTranslatedFromCache = this.cache.get(thing);
|
||||
if (objectTranslatedFromCache !== undefined) {
|
||||
return this.deeptranslate((objectTranslatedFromCache as any)[key]);
|
||||
}
|
||||
return new Proxy(thing, {
|
||||
get: (target, key) => {
|
||||
const object: any = target;
|
||||
if (equal(this.sourceCache.get(thing), thing)) {
|
||||
const objectTranslatedFromCache = this.cache.get(thing);
|
||||
if (objectTranslatedFromCache !== undefined) {
|
||||
return this.deeptranslate((objectTranslatedFromCache as any)[key]);
|
||||
}
|
||||
const objectTranslated = this.translateThingInPlaceDestructively(clone()(object));
|
||||
this.cache.putObject(objectTranslated);
|
||||
this.sourceCache.putObject(thing);
|
||||
}
|
||||
const objectTranslated = this.translateThingInPlaceDestructively(clone()(object));
|
||||
this.cache.putObject(objectTranslated);
|
||||
this.sourceCache.putObject(thing);
|
||||
|
||||
return this.deeptranslate(objectTranslated[key]);
|
||||
},
|
||||
return this.deeptranslate(objectTranslated[key]);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"extends": "./node_modules/@openstapps/configuration/tsconfig.json"
|
||||
"extends": "@openstapps/tsconfig"
|
||||
}
|
||||
|
||||
8
packages/easy-ast/README.md
Normal file
8
packages/easy-ast/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# What is Easy AST?
|
||||
|
||||
Easy [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) is a "wrapper" around the TypeScript Compiler API. The TS Compiler API is built for many
|
||||
much more complex things than just accessing type declarations, and thus comes with a ton of
|
||||
bloat that makes it really difficult to work with.
|
||||
|
||||
This is why we built the Easy AST, which converts the TS representation to a really easy and
|
||||
lightweight structure, that removes a lot of the stuff you wouldn't really need.
|
||||
61
packages/easy-ast/package.json
Normal file
61
packages/easy-ast/package.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "@openstapps/easy-ast",
|
||||
"description": "Tool to easily handle TypeScript AST",
|
||||
"version": "2.1.0",
|
||||
"type": "module",
|
||||
"license": "GPL-3.0-only",
|
||||
"repository": "git@gitlab.com:openstapps/core-tools.git",
|
||||
"author": "Thea Schöbl <dev@theaninova.de>",
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsup --dts",
|
||||
"format": "prettier .",
|
||||
"format:fix": "prettier --write .",
|
||||
"lint": "eslint --ext .ts src/",
|
||||
"lint:fix": "eslint --fix --ext .ts src/",
|
||||
"test": "nyc mocha 'test/**/*.spec.ts'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@openstapps/collection-utils": "workspace:*",
|
||||
"@openstapps/logger": "workspace:*",
|
||||
"typescript": "4.8.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openstapps/eslint-config": "workspace:*",
|
||||
"@openstapps/nyc-config": "workspace:*",
|
||||
"@openstapps/prettier-config": "workspace:*",
|
||||
"@openstapps/tsconfig": "workspace:*",
|
||||
"@testdeck/mocha": "0.3.3",
|
||||
"@types/chai": "4.3.4",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
"@types/mocha": "10.0.1",
|
||||
"@types/node": "18.15.3",
|
||||
"mocha": "10.2.0",
|
||||
"nock": "13.3.0",
|
||||
"tsup": "6.7.0"
|
||||
},
|
||||
"tsup": {
|
||||
"entry": [
|
||||
"src/app.ts",
|
||||
"src/index.ts"
|
||||
],
|
||||
"sourcemap": true,
|
||||
"clean": true,
|
||||
"format": "esm",
|
||||
"outDir": "lib"
|
||||
},
|
||||
"prettier": "@openstapps/prettier-config",
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"@openstapps"
|
||||
]
|
||||
},
|
||||
"eslintIgnore": [
|
||||
"resources",
|
||||
"openapi"
|
||||
],
|
||||
"nyc": {
|
||||
"extends": "@openstapps/nyc-config"
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import * as ts from 'typescript';
|
||||
import {cleanupEmpty} from '../util/collections.js';
|
||||
import {cleanupEmpty} from './util.js';
|
||||
import {LightweightComment} from './types/lightweight-comment.js';
|
||||
|
||||
/** @internal */
|
||||
@@ -26,7 +26,7 @@ export function extractComment(node: ts.Node): LightweightComment | undefined {
|
||||
tags?: Array<{comment?: string; tagName?: {escapedText?: string}}>;
|
||||
}>
|
||||
| undefined;
|
||||
const jsDocument = jsDocuments?.[jsDocuments.length - 1]
|
||||
const jsDocument = jsDocuments?.[jsDocuments.length - 1];
|
||||
const comment = jsDocument?.comment?.split('\n\n');
|
||||
|
||||
return jsDocument === undefined
|
||||
@@ -20,7 +20,7 @@ import {LightweightDefinition} from './types/lightweight-definition.js';
|
||||
import {LightweightDefinitionKind} from './types/lightweight-definition-kind.js';
|
||||
import {LightweightProject} from './types/lightweight-project.js';
|
||||
import {LightweightType} from './types/lightweight-type.js';
|
||||
import {keyBy} from "@openstapps/collection-utils/lib/key-by.js";
|
||||
import {keyBy} from '@openstapps/collection-utils';
|
||||
|
||||
/**
|
||||
* Creates a printable name of a type
|
||||
@@ -46,27 +46,27 @@ export function definitionsOf(project: LightweightProject): Record<string, Light
|
||||
return keyBy(Object.values(project).flatMap(Object.values), it => it.name);
|
||||
}
|
||||
|
||||
export function isPrimitiveType(type: { flags: ts.TypeFlags }): boolean {
|
||||
export function isPrimitiveType(type: {flags: ts.TypeFlags}): boolean {
|
||||
return (type.flags & ts.TypeFlags.NonPrimitive) === 0;
|
||||
}
|
||||
|
||||
export function isLiteralType(type: { flags: ts.TypeFlags }): boolean {
|
||||
export function isLiteralType(type: {flags: ts.TypeFlags}): boolean {
|
||||
return (type.flags & ts.TypeFlags.Literal) !== 0;
|
||||
}
|
||||
|
||||
export function isEnumLiteralType(type: { flags: ts.TypeFlags }): boolean {
|
||||
export function isEnumLiteralType(type: {flags: ts.TypeFlags}): boolean {
|
||||
return (type.flags & ts.TypeFlags.EnumLiteral) !== 0;
|
||||
}
|
||||
|
||||
export function isStringLiteralType(type: { flags: ts.TypeFlags }): boolean {
|
||||
export function isStringLiteralType(type: {flags: ts.TypeFlags}): boolean {
|
||||
return (type.flags & ts.TypeFlags.StringLiteral) !== 0;
|
||||
}
|
||||
|
||||
export function isUnionOrIntersectionType(type: { flags: ts.TypeFlags }): boolean {
|
||||
export function isUnionOrIntersectionType(type: {flags: ts.TypeFlags}): boolean {
|
||||
return (type.flags & ts.TypeFlags.UnionOrIntersection) !== 0;
|
||||
}
|
||||
|
||||
export function isUnionType(type: { flags: ts.TypeFlags }): boolean {
|
||||
export function isUnionType(type: {flags: ts.TypeFlags}): boolean {
|
||||
return (type.flags & ts.TypeFlags.Union) !== 0;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,6 @@ export function isLightweightEnum(node?: LightweightDefinition): node is Lightwe
|
||||
return node?.kind === LightweightDefinitionKind.ALIAS_LIKE;
|
||||
}
|
||||
|
||||
export function isTypeVariable(type: { flags: ts.TypeFlags }): boolean {
|
||||
export function isTypeVariable(type: {flags: ts.TypeFlags}): boolean {
|
||||
return (type.flags & ts.TypeFlags.TypeVariable) !== 0;
|
||||
}
|
||||
@@ -14,8 +14,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import ts from 'typescript';
|
||||
import {cleanupEmpty, mapNotNil, rejectNil} from '../util/collections.js';
|
||||
import {expandPathToFilesSync} from '../util/io.js';
|
||||
import {cleanupEmpty, mapNotNil, rejectNil, expandPathToFilesSync} from './util.js';
|
||||
import {
|
||||
extractComment,
|
||||
filterChildrenTo,
|
||||
@@ -37,9 +36,7 @@ import {LightweightProject} from './types/lightweight-project.js';
|
||||
import {LightweightType} from './types/lightweight-type.js';
|
||||
import path from 'path';
|
||||
import {LightweightProperty} from './types/lightweight-property.js';
|
||||
import {mapValues} from "@openstapps/collection-utils/lib/map-values.js";
|
||||
import {groupBy} from "@openstapps/collection-utils/lib/group-by.js";
|
||||
import {keyBy} from "@openstapps/collection-utils/lib/key-by.js";
|
||||
import {mapValues, groupBy, keyBy} from '@openstapps/collection-utils';
|
||||
|
||||
/**
|
||||
* Convert a TypeScript project to a lightweight Type-AST representation of the project
|
||||
@@ -101,7 +98,9 @@ class LightweightDefinitionBuilder {
|
||||
this.sourceFiles = mapNotNil(this.program.getRootFileNames(), it => this.program.getSourceFile(it));
|
||||
}
|
||||
|
||||
private convertAliasLike(enumLike: ts.EnumDeclaration | ts.TypeAliasDeclaration): LightweightAliasDefinition {
|
||||
private convertAliasLike(
|
||||
enumLike: ts.EnumDeclaration | ts.TypeAliasDeclaration,
|
||||
): LightweightAliasDefinition {
|
||||
return cleanupEmpty({
|
||||
comment: this.includeComments ? extractComment(enumLike) : undefined,
|
||||
name: enumLike.name.getText() ?? 'ERROR',
|
||||
@@ -118,9 +117,11 @@ class LightweightDefinitionBuilder {
|
||||
});
|
||||
}
|
||||
|
||||
private convertClassLike(classLike: ts.ClassDeclaration | ts.InterfaceDeclaration): LightweightClassDefinition {
|
||||
private convertClassLike(
|
||||
classLike: ts.ClassDeclaration | ts.InterfaceDeclaration,
|
||||
): LightweightClassDefinition {
|
||||
const heritages = mapValues(
|
||||
groupBy([...(classLike.heritageClauses!)], it => it.token.toString()),
|
||||
groupBy([...classLike.heritageClauses!], it => it.token.toString()),
|
||||
heritages => heritages.flatMap(it => it.types),
|
||||
);
|
||||
|
||||
@@ -159,7 +160,9 @@ class LightweightDefinitionBuilder {
|
||||
});
|
||||
}
|
||||
|
||||
collectProperties(members: ts.NodeArray<ts.ClassElement | ts.TypeElement>): Record<string, LightweightProperty> {
|
||||
collectProperties(
|
||||
members: ts.NodeArray<ts.ClassElement | ts.TypeElement>,
|
||||
): Record<string, LightweightProperty> {
|
||||
return keyBy(
|
||||
filterNodeTo(members as ts.NodeArray<ts.ClassElement | ts.TypeElement>, isProperty).map(property =>
|
||||
cleanupEmpty({
|
||||
@@ -198,7 +201,8 @@ class LightweightDefinitionBuilder {
|
||||
|
||||
return out;
|
||||
}
|
||||
const isReference = typeNode !== undefined && ts.isTypeReferenceNode(typeNode) && !isEnumLiteralType(type);
|
||||
const isReference =
|
||||
typeNode !== undefined && ts.isTypeReferenceNode(typeNode) && !isEnumLiteralType(type);
|
||||
const isTypeLiteral = typeNode !== undefined && ts.isTypeLiteralNode(typeNode);
|
||||
// @ts-expect-error intrinsic name & value exist
|
||||
const intrinsicName = (type.intrinsicName ?? type.value) as string | undefined;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 StApps
|
||||
* Copyright (C) 2021 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -12,28 +12,14 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
export * from './easy-ast.js'
|
||||
export * from './ast-util.js'
|
||||
|
||||
/**
|
||||
* A JavaScript module representation to sort a list of them by dependencies
|
||||
*/
|
||||
export interface JavaScriptModule {
|
||||
/**
|
||||
* Content of the module
|
||||
*/
|
||||
content: string;
|
||||
|
||||
/**
|
||||
* List of names of dependencies
|
||||
*/
|
||||
dependencies: string[];
|
||||
|
||||
/**
|
||||
* Directory the module is in
|
||||
*/
|
||||
directory: string;
|
||||
|
||||
/**
|
||||
* The name of the module
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
export * from './types/lightweight-alias-definition.js'
|
||||
export * from './types/lightweight-class-definition.js'
|
||||
export * from './types/lightweight-comment.js'
|
||||
export * from './types/lightweight-definition.js'
|
||||
export * from './types/lightweight-definition-kind.js'
|
||||
export * from './types/lightweight-project.js'
|
||||
export * from './types/lightweight-property.js'
|
||||
export * from './types/lightweight-type.js'
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user