fix(core): update

This commit is contained in:
Philipp Kunz 2021-05-16 23:50:56 +00:00
parent 0ba352e90a
commit 7765ff77f9
11 changed files with 413 additions and 140 deletions

18
.gitignore vendored
View File

@ -1,4 +1,20 @@
node_modules/
.nogit/
# artifacts
coverage/
public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom

View File

@ -1,38 +1,76 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmci
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
key: "$CI_BUILD_STAGE"
- .npmci_cache/
key: '$CI_BUILD_STAGE'
stages:
- test
- release
- trigger
- pages
- security
- test
- release
- metadata
testLEGACY:
stage: test
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci test legacy
coverage: /\d+.?\d+?\%\s*coverage/
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags:
- docker
allow_failure: true
testLTS:
# ====================
# test stage
# ====================
testStable:
stage: test
script:
- npmci test lts
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testSTABLE:
testBuild:
stage: test
script:
- npmci test stable
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
@ -40,32 +78,60 @@ testSTABLE:
release:
stage: release
script:
- npmci publish
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
- priv
trigger:
stage: trigger
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
stage: pages
stage: metadata
script:
- npmci command yarn global add npmpage
- npmci command npmpage
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- lossless
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
- public
allow_failure: true

29
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

106
package-lock.json generated
View File

@ -1633,7 +1633,6 @@
"version": "8.0.10",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-8.0.10.tgz",
"integrity": "sha512-/Sca8r6pOKLGFsKAfzsHm+3s9BQZM+1WlEkkcnwv7akI7SbE5EYGGDG6veM3+CYhSLlr/AQaNTz47Hx3bZK4/w==",
"dev": true,
"requires": {
"@pushrocks/smartfile-interfaces": "^1.0.7",
"@pushrocks/smarthash": "^2.1.10",
@ -1653,14 +1652,12 @@
"@pushrocks/smartfile-interfaces": {
"version": "1.0.7",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile-interfaces/-/smartfile-interfaces-1.0.7.tgz",
"integrity": "sha512-C/v9Scbx1J+ByMk3YBZrlLRYXdObty/Uz/h6kSZqsO8ghYuT9l7OVpEcyduiSVPakaMi6YnzfME3Nfs3oLj//Q==",
"dev": true
"integrity": "sha512-C/v9Scbx1J+ByMk3YBZrlLRYXdObty/Uz/h6kSZqsO8ghYuT9l7OVpEcyduiSVPakaMi6YnzfME3Nfs3oLj//Q=="
},
"@pushrocks/smarthash": {
"version": "2.1.10",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarthash/-/smarthash-2.1.10.tgz",
"integrity": "sha512-f6lnQPa2lmkSQOMvWwZ6R6wcNvbDWuXH5OhQNvwmog8af3hBEmOEXxjauj6XU+l7ICJ6qxr3wsvpt4y7Ogyc9A==",
"dev": true,
"requires": {
"@pushrocks/smartjson": "^4.0.6",
"@pushrocks/smartpromise": "^3.1.3",
@ -1672,7 +1669,6 @@
"version": "4.0.6",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartjson/-/smartjson-4.0.6.tgz",
"integrity": "sha512-lykr068RSDHs0+EXCvIDVxjKnDtRQ2M7EXOo5jVrUU6/OEdfRl9ErM1K/oPafiEi47/PtTrwLlp1KdSgqkRjmg==",
"dev": true,
"requires": {
"@types/buffer-json": "^2.0.0",
"@types/fast-json-stable-stringify": "^2.0.0",
@ -1914,7 +1910,6 @@
"version": "1.0.3",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartmime/-/smartmime-1.0.3.tgz",
"integrity": "sha512-hLOZwwAzYOOFobUmYy4OyjJJgM3Cw4fQQySF0zqTjd7UIMuAi6cighCNB5M68YHmPr1+XZw/UtHDX8z3tYiehg==",
"dev": true,
"requires": {
"@types/mime-types": "^2.1.0",
"mime-types": "^2.1.26"
@ -1959,8 +1954,7 @@
"@pushrocks/smartpath": {
"version": "4.0.3",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpath/-/smartpath-4.0.3.tgz",
"integrity": "sha512-KWz4DWOrB0sPfk6L4i+CPOo+UK5HXNaLI7ZAaqJe1nEWoDrpyeds1dNDaqVAmSgX4riLGxVpslKH5MnABCPsPg==",
"dev": true
"integrity": "sha512-KWz4DWOrB0sPfk6L4i+CPOo+UK5HXNaLI7ZAaqJe1nEWoDrpyeds1dNDaqVAmSgX4riLGxVpslKH5MnABCPsPg=="
},
"@pushrocks/smartpdf": {
"version": "2.0.9",
@ -1995,13 +1989,14 @@
}
},
"@pushrocks/smartrequest": {
"version": "1.1.51",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.51.tgz",
"integrity": "sha512-RJUvo7MEIAm+gFueJrmf8LcpVals5jp7PgOZ+ebGTvDoVwCpor0Z6nmJDOs9ykjFCIvvPhfiterQeb6hJr2uDw==",
"version": "1.1.52",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.52.tgz",
"integrity": "sha512-ctQvj/o3UQ3thK3TejflOh0wNSvPgmli4hiTPgXiUlHZyJEnkoRiRB+cmtJHDWngO/l83kwxWHQPrseNBYRN6Q==",
"requires": {
"@pushrocks/smartpromise": "^3.0.6",
"agentkeepalive": "^4.1.3",
"form-data": "^3.0.0"
"@pushrocks/smartpromise": "^3.1.5",
"@pushrocks/smarturl": "^2.0.1",
"agentkeepalive": "^4.1.4",
"form-data": "^4.0.0"
}
},
"@pushrocks/smartrx": {
@ -2292,8 +2287,7 @@
"@types/buffer-json": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/@types%2fbuffer-json/-/buffer-json-2.0.0.tgz",
"integrity": "sha512-nFKOrY93Tvv5Tobws+YbkGlPOJsn1nVpZah3BlSyQ4EniFm97KLvSr54tZ5xQp8mlf/XxbYwskNCYQB9EdrPlQ==",
"dev": true
"integrity": "sha512-nFKOrY93Tvv5Tobws+YbkGlPOJsn1nVpZah3BlSyQ4EniFm97KLvSr54tZ5xQp8mlf/XxbYwskNCYQB9EdrPlQ=="
},
"@types/chai": {
"version": "4.2.17",
@ -2390,8 +2384,7 @@
"@types/fast-json-stable-stringify": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/@types%2ffast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
"integrity": "sha512-mky/O83TXmGY39P1H9YbUpjV6l6voRYlufqfFCvel8l1phuy8HRjdWc1rrPuN53ITBJlbyMSV6z3niOySO5pgQ==",
"dev": true
"integrity": "sha512-mky/O83TXmGY39P1H9YbUpjV6l6voRYlufqfFCvel8l1phuy8HRjdWc1rrPuN53ITBJlbyMSV6z3niOySO5pgQ=="
},
"@types/figures": {
"version": "3.0.1",
@ -2415,7 +2408,6 @@
"version": "9.0.11",
"resolved": "https://verdaccio.lossless.one/@types%2ffs-extra/-/fs-extra-9.0.11.tgz",
"integrity": "sha512-mZsifGG4QeQ7hlkhO56u7zt/ycBgGxSVsFI/6lGTU34VtwkiqrrSDgw0+ygs8kFGWcXnFQWMrzF2h7TtDFNixA==",
"dev": true,
"requires": {
"@types/node": "*"
}
@ -2424,7 +2416,6 @@
"version": "7.1.3",
"resolved": "https://verdaccio.lossless.one/@types%2fglob/-/glob-7.1.3.tgz",
"integrity": "sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==",
"dev": true,
"requires": {
"@types/minimatch": "*",
"@types/node": "*"
@ -2453,8 +2444,7 @@
"@types/js-yaml": {
"version": "4.0.1",
"resolved": "https://verdaccio.lossless.one/@types%2fjs-yaml/-/js-yaml-4.0.1.tgz",
"integrity": "sha512-xdOvNmXmrZqqPy3kuCQ+fz6wA0xU5pji9cd1nDrflWaAWtYLLGk5ykW0H6yg5TVyehHP1pfmuuSaZkhP+kspVA==",
"dev": true
"integrity": "sha512-xdOvNmXmrZqqPy3kuCQ+fz6wA0xU5pji9cd1nDrflWaAWtYLLGk5ykW0H6yg5TVyehHP1pfmuuSaZkhP+kspVA=="
},
"@types/mime": {
"version": "1.3.2",
@ -2465,20 +2455,17 @@
"@types/mime-types": {
"version": "2.1.0",
"resolved": "https://verdaccio.lossless.one/@types%2fmime-types/-/mime-types-2.1.0.tgz",
"integrity": "sha1-nKUs2jY/aZxpRmwqbM2q2RPqenM=",
"dev": true
"integrity": "sha1-nKUs2jY/aZxpRmwqbM2q2RPqenM="
},
"@types/minimatch": {
"version": "3.0.4",
"resolved": "https://verdaccio.lossless.one/@types%2fminimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==",
"dev": true
"integrity": "sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA=="
},
"@types/node": {
"version": "14.14.43",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.43.tgz",
"integrity": "sha512-3pwDJjp1PWacPTpH0LcfhgjvurQvrZFBrC6xxjaUEZ7ifUtT32jtjPxEMMblpqd2Mvx+k8haqQJLQxolyGN/cQ==",
"dev": true
"integrity": "sha512-3pwDJjp1PWacPTpH0LcfhgjvurQvrZFBrC6xxjaUEZ7ifUtT32jtjPxEMMblpqd2Mvx+k8haqQJLQxolyGN/cQ=="
},
"@types/parcel-bundler": {
"version": "1.12.3",
@ -2551,7 +2538,6 @@
"version": "2.0.36",
"resolved": "https://verdaccio.lossless.one/@types%2fthrough2/-/through2-2.0.36.tgz",
"integrity": "sha512-vuifQksQHJXhV9McpVsXKuhnf3lsoX70PnhcqIAbs9dqLH2NgrGz0DzZPDY3+Yh6eaRqcE1gnCQ6QhBn1/PT5A==",
"dev": true,
"requires": {
"@types/node": "*"
}
@ -2756,8 +2742,7 @@
"argparse": {
"version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
},
"arr-diff": {
"version": "4.0.0",
@ -2889,8 +2874,7 @@
"at-least-node": {
"version": "1.0.0",
"resolved": "https://verdaccio.lossless.one/at-least-node/-/at-least-node-1.0.0.tgz",
"integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==",
"dev": true
"integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg=="
},
"atob": {
"version": "2.1.2",
@ -3001,8 +2985,7 @@
"balanced-match": {
"version": "1.0.2",
"resolved": "https://verdaccio.lossless.one/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"base": {
"version": "0.11.2",
@ -3188,7 +3171,6 @@
"version": "1.1.11",
"resolved": "https://verdaccio.lossless.one/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -3417,8 +3399,7 @@
"buffer-json": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/buffer-json/-/buffer-json-2.0.0.tgz",
"integrity": "sha512-+jjPFVqyfF1esi9fvfUs3NqM0pH1ziZ36VP4hmA/y/Ssfo/5w5xHKfTw9BwQjoJ1w/oVtpLomqwUHKdefGyuHw==",
"dev": true
"integrity": "sha512-+jjPFVqyfF1esi9fvfUs3NqM0pH1ziZ36VP4hmA/y/Ssfo/5w5xHKfTw9BwQjoJ1w/oVtpLomqwUHKdefGyuHw=="
},
"buffer-xor": {
"version": "1.0.3",
@ -3853,8 +3834,7 @@
"concat-map": {
"version": "0.0.1",
"resolved": "https://verdaccio.lossless.one/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"concat-stream": {
"version": "1.6.2",
@ -5308,8 +5288,7 @@
"fast-json-stable-stringify": {
"version": "2.1.0",
"resolved": "https://verdaccio.lossless.one/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
"dev": true
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
},
"fast-levenshtein": {
"version": "2.0.6",
@ -5460,9 +5439,9 @@
"dev": true
},
"form-data": {
"version": "3.0.1",
"resolved": "https://verdaccio.lossless.one/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
"version": "4.0.0",
"resolved": "https://verdaccio.lossless.one/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
@ -5500,7 +5479,6 @@
"version": "9.1.0",
"resolved": "https://verdaccio.lossless.one/fs-extra/-/fs-extra-9.1.0.tgz",
"integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",
"dev": true,
"requires": {
"at-least-node": "^1.0.0",
"graceful-fs": "^4.2.0",
@ -5511,8 +5489,7 @@
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://verdaccio.lossless.one/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
},
"fsevents": {
"version": "1.2.12",
@ -6134,7 +6111,6 @@
"version": "7.1.6",
"resolved": "https://verdaccio.lossless.one/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
@ -6199,8 +6175,7 @@
"graceful-fs": {
"version": "4.2.6",
"resolved": "https://verdaccio.lossless.one/graceful-fs/-/graceful-fs-4.2.6.tgz",
"integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==",
"dev": true
"integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ=="
},
"grapheme-breaker": {
"version": "0.3.2",
@ -6602,7 +6577,6 @@
"version": "1.0.6",
"resolved": "https://verdaccio.lossless.one/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
@ -6611,8 +6585,7 @@
"inherits": {
"version": "2.0.4",
"resolved": "https://verdaccio.lossless.one/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"ini": {
"version": "1.3.8",
@ -7074,7 +7047,6 @@
"version": "4.1.0",
"resolved": "https://verdaccio.lossless.one/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"requires": {
"argparse": "^2.0.1"
}
@ -7211,7 +7183,6 @@
"version": "6.1.0",
"resolved": "https://verdaccio.lossless.one/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.6",
"universalify": "^2.0.0"
@ -7349,8 +7320,7 @@
"lodash.clonedeep": {
"version": "4.5.0",
"resolved": "https://verdaccio.lossless.one/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=",
"dev": true
"integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8="
},
"lodash.debounce": {
"version": "4.0.8",
@ -7647,7 +7617,6 @@
"version": "3.0.4",
"resolved": "https://verdaccio.lossless.one/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -8010,7 +7979,6 @@
"version": "1.4.0",
"resolved": "https://verdaccio.lossless.one/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"requires": {
"wrappy": "1"
}
@ -8495,8 +8463,7 @@
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://verdaccio.lossless.one/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
},
"path-key": {
"version": "2.0.1",
@ -9471,7 +9438,6 @@
"version": "3.6.0",
"resolved": "https://verdaccio.lossless.one/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"dev": true,
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
@ -10585,7 +10551,6 @@
"version": "1.3.0",
"resolved": "https://verdaccio.lossless.one/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
"dev": true,
"requires": {
"safe-buffer": "~5.2.0"
},
@ -10593,8 +10558,7 @@
"safe-buffer": {
"version": "5.2.1",
"resolved": "https://verdaccio.lossless.one/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"dev": true
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
}
}
},
@ -10763,7 +10727,6 @@
"version": "4.0.2",
"resolved": "https://verdaccio.lossless.one/through2/-/through2-4.0.2.tgz",
"integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==",
"dev": true,
"requires": {
"readable-stream": "3"
}
@ -11185,8 +11148,7 @@
"universalify": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/universalify/-/universalify-2.0.0.tgz",
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
"dev": true
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
},
"unpipe": {
"version": "1.0.0",
@ -11320,8 +11282,7 @@
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://verdaccio.lossless.one/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
"dev": true
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"util.promisify": {
"version": "1.0.1",
@ -11517,8 +11478,7 @@
"wrappy": {
"version": "1.0.2",
"resolved": "https://verdaccio.lossless.one/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
},
"ws": {
"version": "5.2.2",

View File

@ -19,7 +19,24 @@
"tslint-config-prettier": "^1.18.0"
},
"dependencies": {
"@pushrocks/smartrequest": "^1.1.51",
"@pushrocks/smartfile": "^8.0.10",
"@pushrocks/smartrequest": "^1.1.52",
"@pushrocks/smarturl": "^2.0.1"
}
},
"private": false,
"browserslist": [
"last 1 chrome versions"
],
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
]
}

View File

@ -1,29 +1,47 @@
# glab
api abstraction package for gitlab
# @mojoio/gitlab
a gitlab api abstraction package
## Availabililty
[![npm](https://mojoio.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/glab)
[![git](https://mojoio.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/mojoio/glab)
[![git](https://mojoio.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/mojoio/glab)
[![docs](https://mojoio.gitlab.io/assets/repo-button-docs.svg)](https://mojoio.gitlab.io/glab/)
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@mojoio/gitlab)
* [gitlab.com (source)](https://gitlab.com/mojoio/gitlab)
* [github.com (source mirror)](https://github.com/mojoio/gitlab)
* [docs (typedoc)](https://mojoio.gitlab.io/gitlab/)
## Status for master
[![build status](https://GitLab.com/mojoio/glab/badges/master/build.svg)](https://GitLab.com/mojoio/glab/commits/master)
[![coverage report](https://GitLab.com/mojoio/glab/badges/master/coverage.svg)](https://GitLab.com/mojoio/glab/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/glab.svg)](https://www.npmjs.com/package/glab)
[![Dependency Status](https://david-dm.org/mojoio/glab.svg)](https://david-dm.org/mojoio/glab)
[![bitHound Dependencies](https://www.bithound.io/github/mojoio/glab/badges/dependencies.svg)](https://www.bithound.io/github/mojoio/glab/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/mojoio/glab/badges/code.svg)](https://www.bithound.io/github/mojoio/glab)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/mojoio/gitlab/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/mojoio/gitlab/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@mojoio/gitlab)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/mojoio/gitlab)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@mojoio/gitlab)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@mojoio/gitlab)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@mojoio/gitlab)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage
Use TypeScript for best in class instellisense.
For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://mojoio.gitlab.io/assets/repo-footer.svg)](https://mojo.io)
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -1,4 +1,4 @@
import { expect, tap } from '@pushrocks/tapbundle'
import { expect, tap } from '@pushrocks/tapbundle';
import * as gitlab from '../ts/index';
let testGitlabAccount: gitlab.GitlabAccount;
@ -20,4 +20,16 @@ tap.test('should get the pushrocks group', async () => {
await pushrocksGroup.getProjects();
});
tap.test('should get the readme of a project', async () => {
const pushrocksGroup = await testGitlabAccount.getGroupByName('pushrocks');
expect(pushrocksGroup).to.be.instanceOf(gitlab.GitlabGroup);
const projects = await pushrocksGroup.getProjects();
const selectedProject = projects.find((project) => {
return project.data?.name === 'smartfile';
});
expect(selectedProject.data.name).to.equal('smartfile');
const readme = await selectedProject.getReadmeAsMarkdown('master');
expect(readme).to.startWith('# @pushrocks/smartfile');
});
tap.start();

View File

@ -11,23 +11,29 @@ export class GitlabAccount {
return GitlabGroup.getByName(nameArg, this);
}
/**
* handles the basic request/response patterns with the gitlab.com API
*/
public async request (methodArg: 'GET' | 'POST', routeArg: string, searchParamsArg: {[key: string]: string}) {
if(!routeArg.startsWith('/')) {
public async request(
methodArg: 'GET' | 'POST',
routeArg: string,
searchParamsArg: { [key: string]: string }
) {
if (!routeArg.startsWith('/')) {
throw new Error(`"${routeArg}" -> routeArg must start with a slash`);
}
const smarturlInstance = plugins.smarturl.Smarturl.createFromUrl(`https://gitlab.com/api/v4${routeArg}`, {
searchParams: searchParamsArg
});
const smarturlInstance = plugins.smarturl.Smarturl.createFromUrl(
`https://gitlab.com/api/v4${routeArg}`,
{
searchParams: searchParamsArg,
}
);
const response = await plugins.smartrequest.request(smarturlInstance.toString(), {
method: methodArg
method: methodArg,
});
// lets deal with pagination headers
const fintLinkName = (markup) => {
const findLinkName = (markup) => {
const pattern = /<([^\s>]+)(\s|>)+/;
return markup.match(pattern)[1];
};
@ -37,6 +43,17 @@ export class GitlabAccount {
original: string;
link: string;
}[] = [];
for (const link of links) {
linkObjects.push({
original: link,
link: findLinkName(link)
});
}
const next = linkObjects.find(linkObject => linkObject.original.includes('rel="next"'));
if (next && response.body instanceof Array) {
const nextResponse = await this.request(methodArg, next.link.replace('https://gitlab.com/api/v4', ''), {});
response.body = response.body.concat(nextResponse);
}
}
return response.body;
}

View File

@ -1,27 +1,141 @@
import { GitlabGroup } from './gitlab.classes.group';
import * as plugins from './gitlab.plugins';
export interface IGitlabData {
id: number;
description: string;
name: string;
name_with_namespace: string;
path: string;
path_with_namespace: string;
created_at: string;
default_branch: string;
tag_list: string[];
ssh_url_to_repo: string;
http_url_to_repo: string;
web_url: string;
readme_url: string;
avatar_url: null;
forks_count: number;
star_count: number;
last_activity_at: string;
namespace: {
id: number;
name: string;
path: string;
kind: string;
full_path: string;
parent_id: null;
avatar_url: string;
web_url: string;
};
container_registry_image_prefix: string;
_links: {
self: string;
issues: string;
merge_requests: string;
repo_branches: string;
labels: string;
events: string;
members: string;
};
packages_enabled: null;
empty_repo: boolean;
archived: boolean;
visibility: 'public' | 'private';
resolve_outdated_diff_discussions: null;
container_registry_enabled: boolean;
issues_enabled: boolean;
merge_requests_enabled: boolean;
wiki_enabled: boolean;
jobs_enabled: boolean;
snippets_enabled: boolean;
service_desk_enabled: null;
service_desk_address: null;
can_create_merge_request_in: boolean;
issues_access_level: 'enabled' | 'disabled';
repository_access_level: 'enabled' | 'disabled';
merge_requests_access_level: 'enabled' | 'disabled';
forking_access_level: 'enabled' | 'disabled';
wiki_access_level: 'enabled' | 'disabled';
builds_access_level: 'enabled' | 'disabled';
snippets_access_level: 'enabled' | 'disabled';
pages_access_level: 'enabled' | 'disabled';
operations_access_level: 'enabled' | 'disabled';
analytics_access_level: 'enabled' | 'disabled';
emails_disabled: null;
shared_runners_enabled: boolean;
lfs_enabled: boolean;
creator_id: number;
import_status: 'none';
open_issues_count: number;
ci_default_git_depth: null;
ci_forward_deployment_enabled: null;
public_jobs: boolean;
build_timeout: number;
auto_cancel_pending_pipelines: 'enabled' | 'disabled';
build_coverage_regex: '';
ci_config_path: '';
shared_with_groups: [];
only_allow_merge_if_pipeline_succeeds: boolean;
allow_merge_on_skipped_pipeline: null;
restrict_user_defined_variables: boolean;
request_access_enabled: boolean;
only_allow_merge_if_all_discussions_are_resolved: boolean;
remove_source_branch_after_merge: null;
printing_merge_request_link_enabled: boolean;
merge_method: 'merge';
suggestion_commit_message: null;
auto_devops_enabled: boolean;
auto_devops_deploy_strategy: 'continuous';
autoclose_referenced_issues: boolean;
approvals_before_merge: number;
mirror: boolean;
external_authorization_classification_label: '';
marked_for_deletion_at: null;
marked_for_deletion_on: null;
requirements_enabled: boolean;
security_and_compliance_enabled: null;
compliance_frameworks: [];
issues_template: '';
merge_requests_template: '';
}
export class GitlabProject {
// STATIC
public static async getProjectsForGroup(gitlabGroupArg: GitlabGroup) {
const response = await gitlabGroupArg.gitlabAccountRef.request('GET', `/groups/${gitlabGroupArg.data.id}/projects`, {
per_page: '100'
});
console.log(response);
public static async getProjectsForGroup(gitlabGroupArg: GitlabGroup): Promise<GitlabProject[]> {
const response = await gitlabGroupArg.gitlabAccountRef.request(
'GET',
`/groups/${gitlabGroupArg.data.id}/projects`,
{
per_page: '100',
}
);
const allProjects: GitlabProject[] = []
for (const projectData of response) {
console.log(projectData);
allProjects.push(new GitlabProject(projectData, gitlabGroupArg));
}
console.log(response.length);
return allProjects;
}
// INSTANCE
gitlabGroupRef: GitlabGroup;
data: any;
data: IGitlabData;
constructor(dataArg: any, gitlabGroupRefArg: GitlabGroup) {
constructor(dataArg: IGitlabData, gitlabGroupRefArg: GitlabGroup) {
this.data = dataArg;
this.gitlabGroupRef = gitlabGroupRefArg;
}
public async getReadmeAsMarkdown() {};
public async getFileFromProject(filePathArg: string, refArg: string): Promise<plugins.smartfile.Smartfile> {
const response = await this.gitlabGroupRef.gitlabAccountRef.request('GET', `/projects/${this.data.id}/repository/files/${filePathArg}`, {
ref: refArg
});
return plugins.smartfile.Smartfile.fromBuffer(filePathArg, Buffer.from(response.content, response.encoding));
}
public async getReadmeAsMarkdown(refArg: string = 'master'): Promise<string> {
const readmeFile = await this.getFileFromProject('readme.md', refArg);
return readmeFile.contents.toString('utf8');
}
}

View File

@ -1,8 +1,6 @@
// pushrocks scope
import * as smartfile from '@pushrocks/smartfile';
import * as smartrequest from '@pushrocks/smartrequest';
import * as smarturl from '@pushrocks/smarturl';
export {
smartrequest,
smarturl
};
export { smartfile, smartrequest, smarturl };