mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 08:42:13 +02:00
Compare commits
462 Commits
7.0.730
...
feature-fl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dca1d2c370 | ||
|
|
17509225ee | ||
|
|
447bac1d67 | ||
|
|
67b3b224a7 | ||
|
|
48fbf50973 | ||
|
|
9e2bd15cf4 | ||
|
|
17e9ad4fcd | ||
|
|
4d5a49f11e | ||
|
|
2d9b9950dd | ||
|
|
c3c0fbc853 | ||
|
|
f970b02e9e | ||
|
|
987394be41 | ||
|
|
34b3dff108 | ||
|
|
b603241d57 | ||
|
|
8df01fc098 | ||
|
|
268305e6cd | ||
|
|
bbb53b3321 | ||
|
|
c79fa88ad1 | ||
|
|
35c5e57752 | ||
|
|
c844bf8e43 | ||
|
|
c0288716da | ||
|
|
51e7fa6c9a | ||
|
|
d9eb60017a | ||
|
|
e9d7b36198 | ||
|
|
7308945061 | ||
|
|
3f8e5e4e0a | ||
|
|
3f7d186db0 | ||
|
|
8cb91d94eb | ||
|
|
3337ad2a45 | ||
|
|
438fbf4368 | ||
|
|
ffca1acc9a | ||
|
|
846d5ce104 | ||
|
|
43a075436a | ||
|
|
8fe35d9a29 | ||
|
|
849eeac23a | ||
|
|
01a4cac559 | ||
|
|
b4cd4d2c02 | ||
|
|
329484fb87 | ||
|
|
ee54a324d7 | ||
|
|
ba2feffbee | ||
|
|
4b0b91396b | ||
|
|
f2c6321216 | ||
|
|
67447c0bd7 | ||
|
|
323646ebcd | ||
|
|
81e4b4435c | ||
|
|
842b0664c7 | ||
|
|
0bdab474de | ||
|
|
ef1b22e62b | ||
|
|
3d229a0030 | ||
|
|
e34599d18a | ||
|
|
aa7594f2a8 | ||
|
|
0626669b02 | ||
|
|
35b949e448 | ||
|
|
2bb4086fd1 | ||
|
|
03f9c36f06 | ||
|
|
9fe998a43d | ||
|
|
3841b655e5 | ||
|
|
40ee5d775b | ||
|
|
88f0e2af51 | ||
|
|
2cdf1236be | ||
|
|
ed5a144735 | ||
|
|
e687a439e6 | ||
|
|
cfa20e2be6 | ||
|
|
32275837ac | ||
|
|
34568a39f5 | ||
|
|
b7b41dfebb | ||
|
|
9b40011196 | ||
|
|
d644287a0c | ||
|
|
ea7dc0b918 | ||
|
|
c34639a3bb | ||
|
|
41ba37be80 | ||
|
|
954d5be113 | ||
|
|
21a857d912 | ||
|
|
cb0f7bbad5 | ||
|
|
c3c94f3634 | ||
|
|
955141d42e | ||
|
|
352c9ffb8e | ||
|
|
d543757a7d | ||
|
|
b3cfdbf45a | ||
|
|
c629921d01 | ||
|
|
008e0c50b1 | ||
|
|
fcf916bdfe | ||
|
|
9850bcf0e7 | ||
|
|
e1efeec9ec | ||
|
|
7e34393fc6 | ||
|
|
262fffd9ff | ||
|
|
35db6e95ad | ||
|
|
17208b5e26 | ||
|
|
896dce3430 | ||
|
|
d844fa9df2 | ||
|
|
48542c4323 | ||
|
|
f57047c778 | ||
|
|
e471787462 | ||
|
|
dc4721f878 | ||
|
|
4bd4dbf3c1 | ||
|
|
6c0c79dd25 | ||
|
|
a9548858b0 | ||
|
|
6804e94850 | ||
|
|
63736aed6c | ||
|
|
c848032fdc | ||
|
|
22c2231e22 | ||
|
|
7a063d741c | ||
|
|
8a9cc10ff0 | ||
|
|
2e43fa0c02 | ||
|
|
f51a1828ab | ||
|
|
805139055a | ||
|
|
42c85b16e7 | ||
|
|
a59742cddb | ||
|
|
ba426b5580 | ||
|
|
1945bbfd45 | ||
|
|
58debb9959 | ||
|
|
6485f474b2 | ||
|
|
301d7f124c | ||
|
|
985217d2bf | ||
|
|
20f46177cb | ||
|
|
0453d995ba | ||
|
|
8ab7fbc95d | ||
|
|
2d99850596 | ||
|
|
c77b8e2d57 | ||
|
|
e12f73cebf | ||
|
|
0351480152 | ||
|
|
62e81bee06 | ||
|
|
11b500058e | ||
|
|
0b94b0ff70 | ||
|
|
9bd8275321 | ||
|
|
a25a1ed0b9 | ||
|
|
accffbe443 | ||
|
|
414bfdfec1 | ||
|
|
cc7037b549 | ||
|
|
725f41ef1b | ||
|
|
e7682c826d | ||
|
|
5347bc29ea | ||
|
|
aa975633dd | ||
|
|
199ef2b009 | ||
|
|
f0f690f24a | ||
|
|
ef43088692 | ||
|
|
8f36524583 | ||
|
|
d738d1378c | ||
|
|
b402450eac | ||
|
|
130d7b1af3 | ||
|
|
070fd415ae | ||
|
|
d8b6cf98fe | ||
|
|
3a8451aea3 | ||
|
|
0de056c4e9 | ||
|
|
8e02cf56ef | ||
|
|
1296707e0d | ||
|
|
80b848f757 | ||
|
|
4b2a9c74c0 | ||
|
|
62ed9583fc | ||
|
|
8a2f9f9913 | ||
|
|
1a1be22b16 | ||
|
|
7e48cb2451 | ||
|
|
8fc2f93e94 | ||
|
|
1892d06cec | ||
|
|
32960b90f8 | ||
|
|
7bd5efee1c | ||
|
|
f1b4214379 | ||
|
|
ff0314ae9b | ||
|
|
591c89a320 | ||
|
|
60b1f3bcc5 | ||
|
|
7e796dff42 | ||
|
|
34817a1066 | ||
|
|
45bdadde87 | ||
|
|
753e017efd | ||
|
|
6b80d76fda | ||
|
|
7daa955528 | ||
|
|
ff9117ab05 | ||
|
|
4405c5fe10 | ||
|
|
98a1ae95b8 | ||
|
|
bcc06324c3 | ||
|
|
d7f2432a0c | ||
|
|
e75c16b6f8 | ||
|
|
c13291c33c | ||
|
|
824fb68395 | ||
|
|
e0795f24fc | ||
|
|
0d178843e4 | ||
|
|
b6f8dbabc5 | ||
|
|
78e97b815d | ||
|
|
9ff18d6df5 | ||
|
|
9fec234b07 | ||
|
|
5fa633959f | ||
|
|
0b4373edcc | ||
|
|
be09a9354d | ||
|
|
d6549cd861 | ||
|
|
3ab1758f17 | ||
|
|
138a42326f | ||
|
|
c6689d2a36 | ||
|
|
3376c2cb96 | ||
|
|
d6e7b5840b | ||
|
|
0319e43a21 | ||
|
|
d9be0a76e3 | ||
|
|
75748274c1 | ||
|
|
08893110bb | ||
|
|
1140eb7270 | ||
|
|
b526306780 | ||
|
|
dc235464f4 | ||
|
|
f0413ac917 | ||
|
|
b00ce0e894 | ||
|
|
2c90d8c0be | ||
|
|
7ccb5fca6f | ||
|
|
b65d452632 | ||
|
|
c040d60da9 | ||
|
|
6fe40bc630 | ||
|
|
c85d9b8372 | ||
|
|
58cfe477c2 | ||
|
|
6d5cb57813 | ||
|
|
4761c747a4 | ||
|
|
7ca8d20c4d | ||
|
|
59a77c6c15 | ||
|
|
099af1f5fe | ||
|
|
d06c657a16 | ||
|
|
1d9abe8af0 | ||
|
|
9bf46fbcf1 | ||
|
|
91adc172bd | ||
|
|
2d4bb56ffa | ||
|
|
01b677ec77 | ||
|
|
ed7708ba7c | ||
|
|
1d7980f3ba | ||
|
|
43069791da | ||
|
|
ccedb52acd | ||
|
|
f0d69b8ca0 | ||
|
|
4359e8fa30 | ||
|
|
b1162446db | ||
|
|
cf80324382 | ||
|
|
f4e372cfce | ||
|
|
b47e95f836 | ||
|
|
e4af38dfa9 | ||
|
|
e51ed0edc0 | ||
|
|
746b396e4f | ||
|
|
1d08ffb130 | ||
|
|
231493b335 | ||
|
|
1cbd9d2d26 | ||
|
|
661e1b8b4d | ||
|
|
4a0ff353e6 | ||
|
|
36cbc22327 | ||
|
|
bbd57c917e | ||
|
|
f72d5550cf | ||
|
|
5920b97c6c | ||
|
|
2c8019bfc6 | ||
|
|
d3e3b7d918 | ||
|
|
f2d02c4a5a | ||
|
|
209ac74643 | ||
|
|
2a6cb19405 | ||
|
|
62db38520f | ||
|
|
31a41fed60 | ||
|
|
55fd9a87b9 | ||
|
|
91ed99f256 | ||
|
|
6f4963cdb0 | ||
|
|
9b6667e6c7 | ||
|
|
b42b93844b | ||
|
|
ca63e6fbfb | ||
|
|
515b8ba94c | ||
|
|
e9bdf80f84 | ||
|
|
31bcfc7531 | ||
|
|
4046da0523 | ||
|
|
e728501ddb | ||
|
|
c06c0f8b38 | ||
|
|
433e776d05 | ||
|
|
8e9a5a1077 | ||
|
|
8a892e643f | ||
|
|
7ea9f48089 | ||
|
|
6fd882afd4 | ||
|
|
917fb112d4 | ||
|
|
a02d5d420a | ||
|
|
35916a5836 | ||
|
|
df68a5e76a | ||
|
|
54462d4975 | ||
|
|
1441f3a345 | ||
|
|
41c6898d30 | ||
|
|
0d09047454 | ||
|
|
8a3b893521 | ||
|
|
0c13463c0d | ||
|
|
36860e6ee9 | ||
|
|
53efbaf7a0 | ||
|
|
8863c6a209 | ||
|
|
c069ae47a0 | ||
|
|
4c1e4ad1b2 | ||
|
|
82a1c3c93b | ||
|
|
52e4a1247f | ||
|
|
deec3cb6f4 | ||
|
|
2a6afd155f | ||
|
|
7bd6c14313 | ||
|
|
374a7e8267 | ||
|
|
4a1b6ce89e | ||
|
|
8a22320532 | ||
|
|
5634b7b586 | ||
|
|
a399648093 | ||
|
|
f927433fb7 | ||
|
|
55ca86efbd | ||
|
|
1be4e59319 | ||
|
|
c62b3568cd | ||
|
|
de3333f0e8 | ||
|
|
4c9e4cbb14 | ||
|
|
0d142a51a9 | ||
|
|
ef4a630c1b | ||
|
|
475da718b9 | ||
|
|
2d52cca8c3 | ||
|
|
0bb9ba47b8 | ||
|
|
2cf1b2f54b | ||
|
|
1e0444ee41 | ||
|
|
26aaee83b8 | ||
|
|
06a76ecc2b | ||
|
|
9867ef4824 | ||
|
|
c8a4ff73f3 | ||
|
|
623acf9212 | ||
|
|
4a9ef40d8f | ||
|
|
961034dd3f | ||
|
|
b7263ae132 | ||
|
|
0b3e45b8d9 | ||
|
|
5cf93f7173 | ||
|
|
e89db96254 | ||
|
|
663eb5ec6d | ||
|
|
b9a0c0297e | ||
|
|
264fcce55c | ||
|
|
32ed2f3183 | ||
|
|
4547fbe872 | ||
|
|
bb809874fd | ||
|
|
8e71d86651 | ||
|
|
85840ddeb4 | ||
|
|
799beb5303 | ||
|
|
9cfe6f49e0 | ||
|
|
f7cf41cab4 | ||
|
|
493e898647 | ||
|
|
f2f0e10ffe | ||
|
|
12c555dfe7 | ||
|
|
83bbd26eef | ||
|
|
55f8a32352 | ||
|
|
d7081c1bae | ||
|
|
6cd897c134 | ||
|
|
36cfc317a4 | ||
|
|
44f2b3ce13 | ||
|
|
f0dd4ec980 | ||
|
|
e4604b69e4 | ||
|
|
22bc05b32d | ||
|
|
9fe70fc864 | ||
|
|
24b9d301c8 | ||
|
|
5ad45237f5 | ||
|
|
b05cecc6b4 | ||
|
|
ab6ca0e52f | ||
|
|
3c15f2dc53 | ||
|
|
d96e00789c | ||
|
|
47ade5164c | ||
|
|
7f386e4c71 | ||
|
|
9ee710a16c | ||
|
|
3714c2c91a | ||
|
|
074c02729b | ||
|
|
1dc5584821 | ||
|
|
cf10f0df52 | ||
|
|
9893a7b8ad | ||
|
|
bbcdf93699 | ||
|
|
a001766d15 | ||
|
|
3576e86532 | ||
|
|
588ab1e925 | ||
|
|
f09260b374 | ||
|
|
43e75c342a | ||
|
|
08411211ab | ||
|
|
f510fdae5c | ||
|
|
0301f5ff42 | ||
|
|
013a49bd3a | ||
|
|
b4f2e738ea | ||
|
|
ac0bc23e1a | ||
|
|
666de177c8 | ||
|
|
99579677a1 | ||
|
|
8b25a006a9 | ||
|
|
5e82b0f158 | ||
|
|
b05294b386 | ||
|
|
984a77c9e7 | ||
|
|
864d0b3c00 | ||
|
|
14d22e5f12 | ||
|
|
614ba797b6 | ||
|
|
fcbe7fc5f0 | ||
|
|
9ce81a2704 | ||
|
|
88a997afaa | ||
|
|
7c5dc7b35c | ||
|
|
3dd150692a | ||
|
|
f09e129fd1 | ||
|
|
c9b15dcfc7 | ||
|
|
b039a5a045 | ||
|
|
3040b21484 | ||
|
|
af15c6f5f5 | ||
|
|
4c82c922e2 | ||
|
|
08f48ad082 | ||
|
|
34a8ea806d | ||
|
|
a70e98f802 | ||
|
|
ee1ec87781 | ||
|
|
f21de699dd | ||
|
|
b30f9a472a | ||
|
|
e7c54b369d | ||
|
|
53bf92fac0 | ||
|
|
6da56df5b1 | ||
|
|
931cccf86a | ||
|
|
027966cae3 | ||
|
|
f568473588 | ||
|
|
ada26e3cce | ||
|
|
15e2c9cef2 | ||
|
|
a091cd4faa | ||
|
|
1fa5604cdd | ||
|
|
d9ed5f579e | ||
|
|
0138e98506 | ||
|
|
2feb024032 | ||
|
|
55bf11bfd1 | ||
|
|
05d6dd2182 | ||
|
|
3595f5bf6f | ||
|
|
398c08854a | ||
|
|
af8d85f6d2 | ||
|
|
296dfd15d5 | ||
|
|
efc446edf1 | ||
|
|
8453d32a4f | ||
|
|
41a8ddb09a | ||
|
|
9f5fa3542a | ||
|
|
b801aba506 | ||
|
|
c6e5d642b5 | ||
|
|
002abb7498 | ||
|
|
0e141b9b1a | ||
|
|
230ccc4144 | ||
|
|
ac4d2cc9ec | ||
|
|
a1f12fd14a | ||
|
|
3e4ad34179 | ||
|
|
a21bde486b | ||
|
|
4adb2b58ca | ||
|
|
929c39dea7 | ||
|
|
206c7d9bf1 | ||
|
|
e16c9cb3b7 | ||
|
|
542fb4355e | ||
|
|
f63b910d78 | ||
|
|
8254b635fb | ||
|
|
dfa85982c2 | ||
|
|
8451f9f90d | ||
|
|
c447941755 | ||
|
|
112e2e4faa | ||
|
|
fed9ab4621 | ||
|
|
18461d58d6 | ||
|
|
11095fc0bc | ||
|
|
a567cee47f | ||
|
|
158e2abc12 | ||
|
|
ca2095e867 | ||
|
|
708a9ba4b8 | ||
|
|
91a60eabbb | ||
|
|
7f0e07bd40 | ||
|
|
01b17b9dff | ||
|
|
b7e5cf78b9 | ||
|
|
d92d8c260b | ||
|
|
0576199db8 | ||
|
|
6f5a804d77 | ||
|
|
2f6420152e | ||
|
|
1d1d11bee2 | ||
|
|
594c36a512 | ||
|
|
ec5c852175 | ||
|
|
01ff01029b | ||
|
|
bf5d16b64c | ||
|
|
26ee469467 | ||
|
|
b514c8c189 | ||
|
|
2bbac9a545 | ||
|
|
03386eeba0 | ||
|
|
a09842c8b0 | ||
|
|
847b75b555 | ||
|
|
c839317283 | ||
|
|
1f4fd86845 | ||
|
|
8ed8c6a05c | ||
|
|
a716d54cc6 | ||
|
|
668d00418d | ||
|
|
e20229ca9d |
@@ -6,6 +6,7 @@ node_modules
|
||||
# dependencies
|
||||
/node_modules
|
||||
node_modules
|
||||
**/node_modules
|
||||
|
||||
.idea
|
||||
# testing
|
||||
@@ -53,4 +54,7 @@ tests/coverage
|
||||
|
||||
settings.json
|
||||
|
||||
GoSDK/tester/
|
||||
GoSDK/tester/
|
||||
|
||||
Llama/Models/*
|
||||
|
||||
|
||||
@@ -87,10 +87,11 @@
|
||||
],
|
||||
// https://www.npmjs.com/package/eslint-plugin-unused-imports
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_"}],
|
||||
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
||||
"@typescript-eslint/no-floating-promises":"error",
|
||||
"@typescript-eslint/await-thenable":"error",
|
||||
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
||||
"unused-imports/no-unused-imports": "error",
|
||||
"unused-imports/no-unused-vars": [
|
||||
"error",
|
||||
|
||||
20
.github/workflows/code-analysis.yml
vendored
20
.github/workflows/code-analysis.yml
vendored
@@ -1,20 +0,0 @@
|
||||
name: Code Analysis
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
sonarcloud:
|
||||
name: SonarCloud
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
- name: SonarCloud Scan
|
||||
uses: SonarSource/sonarcloud-github-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -40,7 +40,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
|
||||
16
.github/workflows/common-jobs.yaml
vendored
16
.github/workflows/common-jobs.yaml
vendored
@@ -8,7 +8,21 @@ on:
|
||||
- 'release'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
helm-lint:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Helm
|
||||
run: |
|
||||
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
||||
- name: Lint Helm Chart
|
||||
run: |
|
||||
helm lint ./HelmChart/Public/oneuptime
|
||||
|
||||
js-lint:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
|
||||
32
.github/workflows/compile.yml
vendored
32
.github/workflows/compile.yml
vendored
@@ -151,20 +151,6 @@ jobs:
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd File && npm install && npm run compile
|
||||
|
||||
compile-helm-chart:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
- run: cd Common && npm install
|
||||
- run: cd Model && npm install
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd HelmChart && npm install && npm run compile
|
||||
|
||||
compile-home:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
@@ -207,20 +193,6 @@ jobs:
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd Integration && npm install && npm run compile
|
||||
|
||||
compile-licensing:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
- run: cd Common && npm install
|
||||
- run: cd Model && npm install
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd Licensing && npm install && npm run compile
|
||||
|
||||
compile-notification:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
@@ -262,7 +234,7 @@ jobs:
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd Probe && npm install && npm run compile
|
||||
|
||||
compile-probe-api:
|
||||
compile-ingestor:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
@@ -274,7 +246,7 @@ jobs:
|
||||
- run: cd Common && npm install
|
||||
- run: cd Model && npm install
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd ProbeAPI && npm install && npm run compile
|
||||
- run: cd Ingestor && npm install && npm run compile
|
||||
|
||||
|
||||
compile-realtime:
|
||||
|
||||
49
.github/workflows/docker-build.yml
vendored
49
.github/workflows/docker-build.yml
vendored
@@ -40,6 +40,21 @@ jobs:
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./LinkShortener/Dockerfile .
|
||||
|
||||
docker-build-otel-collector:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Preinstall
|
||||
run: npm run prerun
|
||||
|
||||
# build image for accounts service
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./OTelCollector/Dockerfile .
|
||||
|
||||
docker-build-api-reference:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
@@ -131,20 +146,6 @@ jobs:
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./Haraka/Dockerfile .
|
||||
|
||||
docker-build-helm-chart:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Preinstall
|
||||
run: npm run prerun
|
||||
|
||||
# build image for home
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./HelmChart/Dockerfile .
|
||||
|
||||
docker-build-home:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -187,24 +188,10 @@ jobs:
|
||||
- name: Preinstall
|
||||
run: npm run prerun
|
||||
|
||||
# build image for licensing
|
||||
# build image for integrations
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./Integration/Dockerfile .
|
||||
|
||||
docker-build-licensing:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Preinstall
|
||||
run: npm run prerun
|
||||
|
||||
# build image for licensing
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./Licensing/Dockerfile .
|
||||
|
||||
docker-build-notification:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -237,7 +224,7 @@ jobs:
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./Probe/Dockerfile .
|
||||
|
||||
docker-build-probe-api:
|
||||
docker-build-ingestor:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
@@ -250,7 +237,7 @@ jobs:
|
||||
|
||||
# build image probe api
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./ProbeAPI/Dockerfile .
|
||||
run: sudo docker build -f ./Ingestor/Dockerfile .
|
||||
|
||||
docker-build-realtime:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
2
.github/workflows/playwright.yml.skip
vendored
2
.github/workflows/playwright.yml.skip
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
env:
|
||||
BASE_URL: http://localhost
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
341
.github/workflows/release.yml
vendored
341
.github/workflows/release.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
- run: echo "${{needs.generate-build-number.outputs.build_number}}"
|
||||
@@ -39,6 +39,54 @@ jobs:
|
||||
body: |
|
||||
${{steps.build_changelog.outputs.changelog}}
|
||||
|
||||
|
||||
helm-chart-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: generate-build-number
|
||||
env:
|
||||
CI_COMMIT_AUTHOR: Continuous Integration
|
||||
steps:
|
||||
|
||||
- name: Install Helm
|
||||
run: curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- name: Build and Package Helm chart
|
||||
run: |
|
||||
cd ..
|
||||
echo '${{ secrets.GPG_PRIVATE_KEY }}' > private.key
|
||||
gpg --import private.key || true
|
||||
rm private.key
|
||||
echo "GPG key imported successfully"
|
||||
gpg --export-secret-keys >~/.gnupg/secring.gpg
|
||||
echo "GPG key exported successfully"
|
||||
eval `ssh-agent -s`
|
||||
ssh-add - <<< '${{ secrets.HELM_CHART_GITHUB_REPO_DEPLOY_KEY }}'
|
||||
git clone git@github.com:OneUptime/helm-chart.git
|
||||
cd oneuptime/HelmChart/Public
|
||||
helm lint oneuptime
|
||||
helm package --sign --key 'key@oneuptime.com' --keyring ~/.gnupg/secring.gpg oneuptime --version 7.0.${{needs.generate-build-number.outputs.build_number}} --app-version 7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
echo "Helm Chart Package created successfully"
|
||||
cd ..
|
||||
ls
|
||||
echo "Copying the package to helm-chart repo"
|
||||
rm -r ../../helm-chart/oneuptime
|
||||
cp -r ./Public/* ../../helm-chart
|
||||
echo "Package copied successfully"
|
||||
cd .. && cd .. && cd helm-chart
|
||||
echo "Updating helm-chart repo"
|
||||
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
|
||||
git config --global user.email "hello@oneuptime.com"
|
||||
echo "Git config set successfully"
|
||||
echo "Adding the package to helm-chart repo"
|
||||
helm repo index .
|
||||
git add -A
|
||||
git commit -m "Helm Chart Release 7.0.${{needs.generate-build-number.outputs.build_number}}"
|
||||
git push origin master
|
||||
|
||||
nginx-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -54,7 +102,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -114,7 +162,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -159,6 +207,68 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
otel-collector-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/otel-collector
|
||||
ghcr.io/oneuptime/otel-collector
|
||||
tags: |
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy otel-collector.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./OTelCollector/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
|
||||
|
||||
workflow-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -174,7 +284,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -234,7 +344,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -294,7 +404,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -354,7 +464,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -399,6 +509,66 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
test-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/test
|
||||
ghcr.io/oneuptime/test
|
||||
tags: |
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy test.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./Tests/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
realtime-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -414,7 +584,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -459,7 +629,7 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
probe-api-docker-image-deploy:
|
||||
ingestor-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -468,13 +638,13 @@ jobs:
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/probe-api
|
||||
ghcr.io/oneuptime/probe-api
|
||||
oneuptime/ingestor
|
||||
ghcr.io/oneuptime/ingestor
|
||||
tags: |
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -491,7 +661,7 @@ jobs:
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy probe-api.
|
||||
# Build and deploy ingestor.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
@@ -509,7 +679,7 @@ jobs:
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./ProbeAPI/Dockerfile
|
||||
file: ./Ingestor/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
@@ -534,7 +704,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -579,66 +749,6 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
licensing-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/licensing
|
||||
ghcr.io/oneuptime/licensing
|
||||
tags: |
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy licensing.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./Licensing/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
integrations-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -654,7 +764,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -714,7 +824,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -774,7 +884,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -834,7 +944,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -879,65 +989,6 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
helm-chart-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/helm-chart
|
||||
ghcr.io/oneuptime/helm-chart
|
||||
tags: |
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy helm-chart.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./HelmChart/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
haraka-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
@@ -954,7 +1005,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1014,7 +1065,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1075,7 +1126,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1136,7 +1187,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1196,7 +1247,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1256,7 +1307,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1316,7 +1367,7 @@ jobs:
|
||||
type=raw,value=release,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
|
||||
297
.github/workflows/test-release.yaml
vendored
297
.github/workflows/test-release.yaml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -96,7 +96,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -157,7 +157,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -202,6 +202,69 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
|
||||
|
||||
otel-collector-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/otel-collector
|
||||
ghcr.io/oneuptime/otel-collector
|
||||
tags: |
|
||||
type=raw,value=test,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy otel-collector.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./OTelCollector/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
link-shortener-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -218,7 +281,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -279,7 +342,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -340,7 +403,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -385,6 +448,69 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
|
||||
|
||||
test-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/test
|
||||
ghcr.io/oneuptime/test
|
||||
tags: |
|
||||
type=raw,value=test,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy test.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./Tests/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
realtime-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -401,7 +527,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -446,7 +572,7 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
probe-api-docker-image-deploy:
|
||||
ingestor-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -455,14 +581,14 @@ jobs:
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/probe-api
|
||||
ghcr.io/oneuptime/probe-api
|
||||
oneuptime/ingestor
|
||||
ghcr.io/oneuptime/ingestor
|
||||
tags: |
|
||||
type=raw,value=test,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -479,7 +605,7 @@ jobs:
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy probe-api.
|
||||
# Build and deploy ingestor.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
@@ -497,7 +623,7 @@ jobs:
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./ProbeAPI/Dockerfile
|
||||
file: ./Ingestor/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
@@ -523,7 +649,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -568,67 +694,6 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
licensing-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/licensing
|
||||
ghcr.io/oneuptime/licensing
|
||||
tags: |
|
||||
type=raw,value=test,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy licensing.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./Licensing/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
integrations-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
@@ -645,7 +710,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -706,7 +771,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -767,7 +832,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -828,7 +893,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -873,66 +938,6 @@ jobs:
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
helm-chart-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker Meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/helm-chart
|
||||
ghcr.io/oneuptime/helm-chart
|
||||
tags: |
|
||||
type=raw,value=test,enable=true
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy helm-chart.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./HelmChart/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.sha }}
|
||||
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
|
||||
|
||||
haraka-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
@@ -950,7 +955,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1011,7 +1016,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1072,7 +1077,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1133,7 +1138,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1194,7 +1199,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1255,7 +1260,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -1316,7 +1321,7 @@ jobs:
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
|
||||
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Probe Api Test
|
||||
name: Ingestor Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@@ -17,5 +17,5 @@ jobs:
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.3.0
|
||||
- run: cd ProbeAPI && npm install && npm run test
|
||||
- run: cd Ingestor && npm install && npm run test
|
||||
|
||||
9
.gitignore
vendored
9
.gitignore
vendored
@@ -88,3 +88,12 @@ Backups/*.tar
|
||||
|
||||
Haraka/dkim/keys/private_base64.txt
|
||||
Haraka/dkim/keys/public_base64.txt
|
||||
|
||||
.eslintcache
|
||||
|
||||
HelmChart/Values/*.values.yaml
|
||||
|
||||
Llama/Models/tokenizer*
|
||||
Llama/Models/llama*
|
||||
|
||||
Llama/__pycache__/*
|
||||
20
.vscode/launch.json
vendored
20
.vscode/launch.json
vendored
@@ -99,8 +99,8 @@
|
||||
},
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"localRoot": "${workspaceFolder}/ProbeAPI",
|
||||
"name": "Probe API: Debug with Docker",
|
||||
"localRoot": "${workspaceFolder}/Ingestor",
|
||||
"name": "Ingestor: Debug with Docker",
|
||||
"port": 9932,
|
||||
"remoteRoot": "/usr/src/app",
|
||||
"request": "attach",
|
||||
@@ -125,20 +125,6 @@
|
||||
"restart": true,
|
||||
"autoAttachChildProcesses": true
|
||||
},
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"localRoot": "${workspaceFolder}/data-ingestor",
|
||||
"name": "Data Ingestor: Debug with Docker",
|
||||
"port": 9338,
|
||||
"remoteRoot": "/usr/src/app",
|
||||
"request": "attach",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"type": "node",
|
||||
"restart": true,
|
||||
"autoAttachChildProcesses": true
|
||||
},
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"localRoot": "${workspaceFolder}/Notification",
|
||||
@@ -197,7 +183,7 @@
|
||||
},
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"localRoot": "${workspaceFolder}/ProbeAPI",
|
||||
"localRoot": "${workspaceFolder}/Ingestor",
|
||||
"name": "Probe API: Debug with Docker",
|
||||
"port": 9251,
|
||||
"remoteRoot": "/usr/src/app",
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
#
|
||||
|
||||
# Pull base image nodejs image.
|
||||
FROM node:current-alpine AS base
|
||||
FROM node:current-alpine
|
||||
USER root
|
||||
RUN mkdir /tmp/npm && chmod 2777 /tmp/npm && chown 1000:1000 /tmp/npm && npm config set cache /tmp/npm --global
|
||||
|
||||
|
||||
ARG GIT_SHA
|
||||
ARG APP_VERSION
|
||||
|
||||
@@ -23,9 +24,6 @@ SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN mkdir /usr/src
|
||||
|
||||
# Install common
|
||||
|
||||
FROM base AS common
|
||||
WORKDIR /usr/src/Common
|
||||
COPY ./Common/package*.json /usr/src/Common/
|
||||
RUN npm install
|
||||
@@ -33,9 +31,6 @@ COPY ./Common /usr/src/Common
|
||||
|
||||
|
||||
|
||||
# Install Model
|
||||
|
||||
FROM base AS model
|
||||
WORKDIR /usr/src/Model
|
||||
COPY ./Model/package*.json /usr/src/Model/
|
||||
RUN npm install
|
||||
@@ -43,9 +38,6 @@ COPY ./Model /usr/src/Model
|
||||
|
||||
|
||||
|
||||
# Install CommonServer
|
||||
|
||||
FROM base AS commonserver
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY ./CommonServer/package*.json /usr/src/CommonServer/
|
||||
RUN npm install
|
||||
@@ -56,7 +48,6 @@ COPY ./CommonServer /usr/src/CommonServer
|
||||
|
||||
# Install CommonUI
|
||||
|
||||
FROM base AS commonui
|
||||
WORKDIR /usr/src/CommonUI
|
||||
COPY ./CommonUI/package*.json /usr/src/CommonUI/
|
||||
RUN npm install --force
|
||||
@@ -64,22 +55,6 @@ COPY ./CommonUI /usr/src/CommonUI
|
||||
|
||||
|
||||
|
||||
#SET ENV Variables
|
||||
# Install app
|
||||
FROM base AS app
|
||||
|
||||
WORKDIR /usr/src/Common
|
||||
COPY --from=common /usr/src/Common .
|
||||
|
||||
WORKDIR /usr/src/Model
|
||||
COPY --from=model /usr/src/Model .
|
||||
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY --from=commonserver /usr/src/CommonServer .
|
||||
|
||||
WORKDIR /usr/src/CommonUI
|
||||
COPY --from=commonui /usr/src/CommonUI .
|
||||
|
||||
|
||||
ENV PRODUCTION=true
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
||||
|
||||
@@ -14,11 +14,14 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
} catch (err) {
|
||||
logger.error('App Init Failed:');
|
||||
logger.error(err);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
logger.info('Exiting node process');
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
||||
@@ -108,16 +108,7 @@
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
<script src="/accounts/dist/bundle.js"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
|
||||
@@ -107,7 +107,7 @@ const LoginPage: () => JSX.Element = () => {
|
||||
maxPrimaryButtonWidth={true}
|
||||
footer={
|
||||
<div className="actions pointer text-center mt-4 hover:underline fw-semibold">
|
||||
<p>
|
||||
<div>
|
||||
{!showSsoTip && (
|
||||
<div
|
||||
onClick={() => {
|
||||
@@ -128,13 +128,13 @@ const LoginPage: () => JSX.Element = () => {
|
||||
your project.
|
||||
</div>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-10 text-center">
|
||||
<p className="text-muted mb-0 text-gray-500">
|
||||
<div className="text-muted mb-0 text-gray-500">
|
||||
Don't have an account?{' '}
|
||||
<Link
|
||||
to={new Route('/accounts/register')}
|
||||
@@ -142,7 +142,7 @@ const LoginPage: () => JSX.Element = () => {
|
||||
>
|
||||
Register.
|
||||
</Link>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -16,14 +16,15 @@ export default abstract class LoginUtil {
|
||||
User
|
||||
) as User;
|
||||
|
||||
const token: string = value['token'] as string;
|
||||
|
||||
UserUtil.setAccessToken(token);
|
||||
UserUtil.setEmail(user.email as Email);
|
||||
UserUtil.setUserId(user.id as ObjectID);
|
||||
UserUtil.setName(user.name as Name);
|
||||
UserUtil.setName(user.name || new Name(''));
|
||||
UserUtil.setIsMasterAdmin(user.isMasterAdmin as boolean);
|
||||
|
||||
if (user.profilePictureId) {
|
||||
UserUtil.setProfilePicId(user.profilePictureId);
|
||||
}
|
||||
|
||||
Analytics.userAuth(user.email!);
|
||||
|
||||
// go to dashboard, user should be logged in.
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
#
|
||||
|
||||
# Pull base image nodejs image.
|
||||
FROM node:current-alpine AS base
|
||||
FROM node:current-alpine
|
||||
USER root
|
||||
RUN mkdir /tmp/npm && chmod 2777 /tmp/npm && chown 1000:1000 /tmp/npm && npm config set cache /tmp/npm --global
|
||||
|
||||
|
||||
ARG GIT_SHA
|
||||
ARG APP_VERSION
|
||||
|
||||
@@ -23,18 +24,12 @@ SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN mkdir /usr/src
|
||||
|
||||
# Install common
|
||||
|
||||
FROM base AS common
|
||||
WORKDIR /usr/src/Common
|
||||
COPY ./Common/package*.json /usr/src/Common/
|
||||
RUN npm install
|
||||
COPY ./Common /usr/src/Common
|
||||
|
||||
|
||||
# Install Model
|
||||
|
||||
FROM base AS model
|
||||
WORKDIR /usr/src/Model
|
||||
COPY ./Model/package*.json /usr/src/Model/
|
||||
RUN npm install
|
||||
@@ -42,9 +37,6 @@ COPY ./Model /usr/src/Model
|
||||
|
||||
|
||||
|
||||
# Install CommonServer
|
||||
|
||||
FROM base AS commonserver
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY ./CommonServer/package*.json /usr/src/CommonServer/
|
||||
RUN npm install
|
||||
@@ -55,29 +47,12 @@ COPY ./CommonServer /usr/src/CommonServer
|
||||
|
||||
# Install CommonUI
|
||||
|
||||
FROM base AS commonui
|
||||
WORKDIR /usr/src/CommonUI
|
||||
COPY ./CommonUI/package*.json /usr/src/CommonUI/
|
||||
RUN npm install --force
|
||||
COPY ./CommonUI /usr/src/CommonUI
|
||||
|
||||
|
||||
#SET ENV Variables
|
||||
# Install app
|
||||
FROM base AS app
|
||||
|
||||
WORKDIR /usr/src/Common
|
||||
COPY --from=common /usr/src/Common .
|
||||
|
||||
WORKDIR /usr/src/Model
|
||||
COPY --from=model /usr/src/Model .
|
||||
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY --from=commonserver /usr/src/CommonServer .
|
||||
|
||||
WORKDIR /usr/src/CommonUI
|
||||
COPY --from=commonui /usr/src/CommonUI .
|
||||
|
||||
|
||||
ENV PRODUCTION=true
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
||||
|
||||
@@ -13,11 +13,14 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
} catch (err) {
|
||||
logger.error('App Init Failed:');
|
||||
logger.error(err);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
logger.info('Exiting node process');
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
||||
34
AdminDashboard/package-lock.json
generated
34
AdminDashboard/package-lock.json
generated
@@ -66,7 +66,7 @@
|
||||
"moment-timezone": "^0.5.40",
|
||||
"nanoid": "^3.3.2",
|
||||
"nanoid-dictionary": "^4.3.0",
|
||||
"posthog-js": "^1.37.0",
|
||||
"posthog-js": "^1.77.0",
|
||||
"process": "^0.11.10",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"slugify": "^1.6.5",
|
||||
@@ -74,7 +74,7 @@
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@faker-js/faker": "^6.3.1",
|
||||
"@faker-js/faker": "^8.0.2",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@types/node": "^17.0.22",
|
||||
"jest": "^27.5.1",
|
||||
@@ -86,6 +86,7 @@
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@clickhouse/client": "^0.2.1",
|
||||
"@elastic/elasticsearch": "^8.1.0",
|
||||
"@opentelemetry/api": "^1.1.0",
|
||||
"@opentelemetry/auto-instrumentations-node": "^0.31.0",
|
||||
@@ -11913,9 +11914,9 @@
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/json5": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz",
|
||||
"integrity": "sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ==",
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
|
||||
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"bin": {
|
||||
@@ -17137,9 +17138,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/tsconfig-paths/node_modules/json5": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
|
||||
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
|
||||
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
@@ -23463,7 +23464,7 @@
|
||||
"Common": {
|
||||
"version": "file:../Common",
|
||||
"requires": {
|
||||
"@faker-js/faker": "^6.3.1",
|
||||
"@faker-js/faker": "^8.0.2",
|
||||
"@types/crypto-js": "^4.1.1",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@types/nanoid-dictionary": "^4.2.0",
|
||||
@@ -23477,7 +23478,7 @@
|
||||
"moment-timezone": "^0.5.40",
|
||||
"nanoid": "^3.3.2",
|
||||
"nanoid-dictionary": "^4.3.0",
|
||||
"posthog-js": "^1.37.0",
|
||||
"posthog-js": "^1.77.0",
|
||||
"process": "^0.11.10",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"slugify": "^1.6.5",
|
||||
@@ -23510,6 +23511,7 @@
|
||||
"CommonServer": {
|
||||
"version": "file:../CommonServer",
|
||||
"requires": {
|
||||
"@clickhouse/client": "^0.2.1",
|
||||
"@elastic/elasticsearch": "^8.1.0",
|
||||
"@faker-js/faker": "^6.3.1",
|
||||
"@opentelemetry/api": "^1.1.0",
|
||||
@@ -27674,9 +27676,9 @@
|
||||
"peer": true
|
||||
},
|
||||
"json5": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz",
|
||||
"integrity": "sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ==",
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
|
||||
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
|
||||
"dev": true,
|
||||
"peer": true
|
||||
},
|
||||
@@ -31459,9 +31461,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"json5": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
|
||||
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
|
||||
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"requires": {
|
||||
|
||||
@@ -102,16 +102,7 @@
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
<script src="/admin/dist/bundle.js"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
|
||||
@@ -19,11 +19,11 @@ import Users from './Pages/Users/Index';
|
||||
import Logout from './Pages/Logout/Logout';
|
||||
|
||||
// Settings Pages.
|
||||
import SettingsHost from './Pages/Settings/Host/Index';
|
||||
import SettingsEmail from './Pages/Settings/SMTP/Index';
|
||||
import SettingsCallSMS from './Pages/Settings/CallSMS/Index';
|
||||
import SettingsProbes from './Pages/Settings/Probes/Index';
|
||||
import SettingsAuthentication from './Pages/Settings/Authentication/Index';
|
||||
import SettingsAPIKey from './Pages/Settings/APIKey/Index';
|
||||
|
||||
const App: () => JSX.Element = () => {
|
||||
Navigation.setNavigateHook(useNavigate());
|
||||
@@ -72,12 +72,7 @@ const App: () => JSX.Element = () => {
|
||||
|
||||
<PageRoute
|
||||
path={RouteMap[PageMap.SETTINGS]?.toString() || ''}
|
||||
element={<SettingsHost />}
|
||||
/>
|
||||
|
||||
<PageRoute
|
||||
path={RouteMap[PageMap.SETTINGS_HOST]?.toString() || ''}
|
||||
element={<SettingsHost />}
|
||||
element={<SettingsAuthentication />}
|
||||
/>
|
||||
|
||||
<PageRoute
|
||||
@@ -105,6 +100,11 @@ const App: () => JSX.Element = () => {
|
||||
}
|
||||
element={<SettingsAuthentication />}
|
||||
/>
|
||||
|
||||
<PageRoute
|
||||
path={RouteMap[PageMap.SETTINGS_API_KEY]?.toString() || ''}
|
||||
element={<SettingsAPIKey />}
|
||||
/>
|
||||
</Routes>
|
||||
</MasterPage>
|
||||
);
|
||||
|
||||
@@ -9,12 +9,21 @@ import UserUtil from 'CommonUI/src/Utils/User';
|
||||
import Navigation from 'CommonUI/src/Utils/Navigation';
|
||||
import { ACCOUNTS_URL } from 'CommonUI/src/Config';
|
||||
import UiAnalytics from 'CommonUI/src/Utils/Analytics';
|
||||
import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
|
||||
|
||||
const Logout: FunctionComponent = (): ReactElement => {
|
||||
useEffect(() => {
|
||||
const [error, setError] = React.useState<string | null>(null);
|
||||
|
||||
const logout: Function = async () => {
|
||||
UiAnalytics.logout();
|
||||
UserUtil.logout();
|
||||
await UserUtil.logout();
|
||||
Navigation.navigate(ACCOUNTS_URL);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
logout().catch((error: Error) => {
|
||||
setError(error.message || error.toString());
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -35,7 +44,8 @@ const Logout: FunctionComponent = (): ReactElement => {
|
||||
},
|
||||
]}
|
||||
>
|
||||
<PageLoader isVisible={true} />
|
||||
{!error ? <PageLoader isVisible={true} /> : <></>}
|
||||
{error ? <ErrorMessage error={error} /> : <></>}
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ const Settings: FunctionComponent = (): ReactElement => {
|
||||
),
|
||||
},
|
||||
{
|
||||
title: 'Host',
|
||||
title: 'API Key',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.SETTINGS_HOST] as Route
|
||||
),
|
||||
@@ -38,38 +38,30 @@ const Settings: FunctionComponent = (): ReactElement => {
|
||||
>
|
||||
{/* Project Settings View */}
|
||||
<CardModelDetail
|
||||
name="Host Settings"
|
||||
name="API Key Settings"
|
||||
cardProps={{
|
||||
title: 'Host Settings',
|
||||
title: 'Master API Key Settings',
|
||||
description:
|
||||
'Host Settings for this OneUptime Server instance.',
|
||||
'This API key has root access to all the resources in all the projects on OneUptime.',
|
||||
}}
|
||||
isEditable={true}
|
||||
editButtonText="Edit Host"
|
||||
editButtonText="Edit API Key Settings"
|
||||
formFields={[
|
||||
{
|
||||
field: {
|
||||
host: true,
|
||||
},
|
||||
title: 'Host',
|
||||
fieldType: FormFieldSchemaType.Text,
|
||||
required: true,
|
||||
description:
|
||||
'IP address or Hostname of this server instance.',
|
||||
placeholder: 'oneuptime.yourcompany.com',
|
||||
validation: {
|
||||
minLength: 2,
|
||||
masterApiKey: true,
|
||||
},
|
||||
title: 'Master API Key',
|
||||
fieldType: FormFieldSchemaType.ObjectID,
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
field: {
|
||||
useHttps: true,
|
||||
isMasterApiKeyEnabled: true,
|
||||
},
|
||||
title: 'Use HTTPs',
|
||||
title: 'Enabled',
|
||||
fieldType: FormFieldSchemaType.Toggle,
|
||||
required: false,
|
||||
description:
|
||||
'Is this server hosted with a TLS / SSL cert?',
|
||||
},
|
||||
]}
|
||||
modelDetailProps={{
|
||||
@@ -78,22 +70,26 @@ const Settings: FunctionComponent = (): ReactElement => {
|
||||
fields: [
|
||||
{
|
||||
field: {
|
||||
host: true,
|
||||
masterApiKey: true,
|
||||
},
|
||||
title: 'Host',
|
||||
placeholder: 'None',
|
||||
title: 'Master API Key',
|
||||
description:
|
||||
'IP address or Hostname of this server instance.',
|
||||
'This API key has root access to all the resources in all the projects on OneUptime.',
|
||||
fieldType: FieldType.HiddenText,
|
||||
opts: {
|
||||
isCopyable: true,
|
||||
},
|
||||
placeholder: 'API Key not generated yet.',
|
||||
},
|
||||
{
|
||||
field: {
|
||||
useHttps: true,
|
||||
isMasterApiKeyEnabled: true,
|
||||
},
|
||||
fieldType: FieldType.Boolean,
|
||||
title: 'Use HTTPS',
|
||||
placeholder: 'No',
|
||||
title: 'Enabled',
|
||||
description:
|
||||
'Is this server hosted with a valid TLS / SSL cert?',
|
||||
'Enable or disable the master API key. If disabled, all requests using this key will fail.',
|
||||
fieldType: FieldType.Boolean,
|
||||
placeholder: 'Not Enabled',
|
||||
},
|
||||
],
|
||||
modelId: ObjectID.getZeroObjectID(),
|
||||
@@ -11,7 +11,7 @@ const DashboardSideMenu: () => JSX.Element = (): ReactElement => {
|
||||
return (
|
||||
<SideMenu>
|
||||
<SideMenuSection title="Basic">
|
||||
<SideMenuItem
|
||||
{/* <SideMenuItem
|
||||
link={{
|
||||
title: 'Host',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
@@ -19,7 +19,7 @@ const DashboardSideMenu: () => JSX.Element = (): ReactElement => {
|
||||
),
|
||||
}}
|
||||
icon={IconProp.Globe}
|
||||
/>
|
||||
/> */}
|
||||
<SideMenuItem
|
||||
link={{
|
||||
title: 'Authentication',
|
||||
@@ -63,6 +63,17 @@ const DashboardSideMenu: () => JSX.Element = (): ReactElement => {
|
||||
icon={IconProp.Signal}
|
||||
/>
|
||||
</SideMenuSection>
|
||||
<SideMenuSection title="API and Integrations">
|
||||
<SideMenuItem
|
||||
link={{
|
||||
title: 'API Key',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.SETTINGS_API_KEY] as Route
|
||||
),
|
||||
}}
|
||||
icon={IconProp.Code}
|
||||
/>
|
||||
</SideMenuSection>
|
||||
</SideMenu>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@ enum PageMap {
|
||||
SETTINGS_CALL_AND_SMS = 'SETTINGS_CALL_AND_SMS',
|
||||
SETTINGS_PROBES = 'SETTINGS_PROBES',
|
||||
SETTINGS_AUTHENTICATION = 'SETTINGS_AUTHENTICATION',
|
||||
SETTINGS_API_KEY = 'SETTINGS_API_KEY',
|
||||
}
|
||||
|
||||
export default PageMap;
|
||||
|
||||
@@ -18,6 +18,7 @@ const RouteMap: Dictionary<Route> = {
|
||||
[PageMap.SETTINGS_AUTHENTICATION]: new Route(
|
||||
`/admin/settings/authentication`
|
||||
),
|
||||
[PageMap.SETTINGS_API_KEY]: new Route(`/admin/settings/api-key`),
|
||||
};
|
||||
|
||||
export class RouteUtil {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# Pull base image nodejs image.
|
||||
FROM node:current-alpine AS base
|
||||
FROM node:current-alpine
|
||||
USER root
|
||||
RUN mkdir /tmp/npm && chmod 2777 /tmp/npm && chown 1000:1000 /tmp/npm && npm config set cache /tmp/npm --global
|
||||
|
||||
|
||||
ARG GIT_SHA
|
||||
ARG APP_VERSION
|
||||
|
||||
@@ -19,18 +20,12 @@ SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN mkdir /usr/src
|
||||
|
||||
# Install common
|
||||
|
||||
FROM base AS common
|
||||
WORKDIR /usr/src/Common
|
||||
COPY ./Common/package*.json /usr/src/Common/
|
||||
RUN npm install
|
||||
COPY ./Common /usr/src/Common
|
||||
|
||||
|
||||
# Install Model
|
||||
|
||||
FROM base AS model
|
||||
WORKDIR /usr/src/Model
|
||||
COPY ./Model/package*.json /usr/src/Model/
|
||||
RUN npm install
|
||||
@@ -38,9 +33,6 @@ COPY ./Model /usr/src/Model
|
||||
|
||||
|
||||
|
||||
# Install CommonServer
|
||||
|
||||
FROM base AS commonserver
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY ./CommonServer/package*.json /usr/src/CommonServer/
|
||||
RUN npm install
|
||||
@@ -49,16 +41,7 @@ COPY ./CommonServer /usr/src/CommonServer
|
||||
|
||||
|
||||
# Install app
|
||||
FROM base AS app
|
||||
|
||||
WORKDIR /usr/src/Common
|
||||
COPY --from=common /usr/src/Common .
|
||||
|
||||
WORKDIR /usr/src/Model
|
||||
COPY --from=model /usr/src/Model .
|
||||
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY --from=commonserver /usr/src/CommonServer .
|
||||
|
||||
|
||||
ENV PRODUCTION=true
|
||||
|
||||
@@ -93,11 +93,14 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
} catch (err) {
|
||||
logger.error('App Init Failed:');
|
||||
logger.error(err);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
logger.info('Exiting node process');
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ColumnAccessControl } from 'Common/Types/Database/AccessControl/AccessControl';
|
||||
import { ColumnAccessControl } from 'Common/Types/BaseDatabase/AccessControl';
|
||||
import { getTableColumns } from 'Common/Types/Database/TableColumn';
|
||||
import Dictionary from 'Common/Types/Dictionary';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
@@ -229,6 +229,9 @@ export default class ServiceHandler {
|
||||
DashboardApiRoute.toString() +
|
||||
currentResource.model.crudApiPath?.toString();
|
||||
|
||||
pageData.isMasterAdminApiDocs =
|
||||
currentResource.model.isMasterAdminApiDocs;
|
||||
|
||||
return res.render('pages/index', {
|
||||
page: page,
|
||||
resources: Resources,
|
||||
|
||||
@@ -2,6 +2,7 @@ import BaseModel from 'Common/Models/BaseModel';
|
||||
import Models from 'Model/Models/Index';
|
||||
import ArrayUtil from 'Common/Types/ArrayUtil';
|
||||
import Dictionary from 'Common/Types/Dictionary';
|
||||
import { IsBillingEnabled } from 'CommonServer/EnvironmentConfig';
|
||||
|
||||
export interface ModelDocumentation {
|
||||
name: string;
|
||||
@@ -15,7 +16,13 @@ export default class ResourceUtil {
|
||||
const resources: Array<ModelDocumentation> = Models.filter(
|
||||
(model: typeof BaseModel) => {
|
||||
const modelInstance: BaseModel = new model();
|
||||
return modelInstance.enableDocumentation;
|
||||
let showDocs: boolean = modelInstance.enableDocumentation;
|
||||
|
||||
if (modelInstance.isMasterAdminApiDocs && IsBillingEnabled) {
|
||||
showDocs = false;
|
||||
}
|
||||
|
||||
return showDocs;
|
||||
}
|
||||
)
|
||||
.map((model: typeof BaseModel) => {
|
||||
|
||||
@@ -9,8 +9,12 @@
|
||||
|
||||
|
||||
<h2>Permissions</h2>
|
||||
|
||||
<% if(!pageData.isMasterAdminApiDocs){ %>
|
||||
<p class="lead"> Your API Token needs permissions to create, update, read or delete this resource. If you do not have permissions to make a request a <code class="inline-code">4xx</code> status will be sent as response. </p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3 id="consuming-webhooks" >
|
||||
Read Permissions
|
||||
@@ -138,6 +142,28 @@
|
||||
|
||||
</div>
|
||||
|
||||
<% } %>
|
||||
|
||||
<% if(pageData.isMasterAdminApiDocs){ %>
|
||||
|
||||
|
||||
<div class="border-l-4 border-yellow-400 bg-yellow-50 p-4">
|
||||
<div class="flex">
|
||||
<div class="flex-shrink-0">
|
||||
<svg class="h-5 w-5 text-yellow-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
||||
<path fill-rule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ml-3">
|
||||
<div class="text-sm font-medium text-yellow-700 mb-0">
|
||||
This API can only be accessed through a Master API Token. You can create one on the Admin Dashboard. Please add the token to the <code class="inline-code">ApiKey</code> header to make the request.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% } %>
|
||||
|
||||
|
||||
<h2 id="the-contact-model" class="scroll-mt-24">
|
||||
The <%= pageData.title -%> model
|
||||
|
||||
25
Ci/README.md
25
Ci/README.md
@@ -1,25 +0,0 @@
|
||||
# Setup Production Server
|
||||
|
||||
### Run the production.yml file.
|
||||
|
||||
run the file specific to the project with their specific names.
|
||||
`kubectl create -f production.yml`
|
||||
|
||||
# Known Issues
|
||||
|
||||
### Issue 1
|
||||
|
||||
Sometimes you'll see this error
|
||||
|
||||
```
|
||||
$ kubectl create -f staging.yaml
|
||||
error: SchemaError(io.k8s.api.apps.v1beta2.DeploymentCondition): invalid object doesn't have additional properties
|
||||
```
|
||||
|
||||
**Solution:**
|
||||
|
||||
Run the kubectl command with validate false
|
||||
|
||||
```
|
||||
$ kubectl create -f staging.yaml --validate=false
|
||||
```
|
||||
@@ -1,27 +0,0 @@
|
||||
#########
|
||||
#Since Kubernetes jobs are immitable (you cannot update it with a new image).
|
||||
# To update these jobs, CI deletes the old jobs and recreates them using this file.
|
||||
#########
|
||||
|
||||
#########
|
||||
#UPDATE: Any update to this file should also be accompanied with ../test.yaml
|
||||
#########
|
||||
|
||||
########-InitScript-##########
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: InitScript
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: InitScript
|
||||
image: localhost:32000/InitScript:test
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: MONGO_URL
|
||||
value: 'mongodb://admin:372b60f4-704c-4205-8e5c-45cdbf44b1fc@mongo-0.mongo.default.svc.cluster.local:27017,mongo-1.mongo.default.svc.cluster.local:27017,mongo-2.mongo.default.svc.cluster.local:27017/oneuptimedb?replicaSet=rs0'
|
||||
restartPolicy: Never
|
||||
---
|
||||
###########################
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
chmod +x ./ci/scripts/hashexist.sh
|
||||
|
||||
if [[ $CI_COMMIT_BRANCH != "master" ]] && [[ $CI_COMMIT_BRANCH != "release" ]]
|
||||
then
|
||||
next_stage="skip"
|
||||
|
||||
# the first argument is always the job name ($1)
|
||||
for ((i = 2; i <= $#; i++ ))
|
||||
do
|
||||
hash_found=`./ci/scripts/hashexist.sh $1 ${!i}`
|
||||
if [[ $hash_found == *"false"* ]]
|
||||
then
|
||||
next_stage="continue"
|
||||
fi
|
||||
done
|
||||
|
||||
echo $next_stage
|
||||
fi
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "
|
||||
This script npm install's the every project
|
||||
"
|
||||
function clean_install {
|
||||
echo "Installing $1"
|
||||
cd $1
|
||||
rm package-lock.json
|
||||
rm -rf node_modules
|
||||
npm install
|
||||
npm audit fix
|
||||
cd ..
|
||||
echo "Complete $1"
|
||||
echo ""
|
||||
}
|
||||
|
||||
clean_install dashboard
|
||||
clean_install accounts
|
||||
clean_install backend
|
||||
clean_install home
|
||||
clean_install StatusPage
|
||||
clean_install ApiReference
|
||||
clean_install probe
|
||||
clean_install AdminDashboard
|
||||
clean_install InitScript
|
||||
clean_install licensing
|
||||
clean_install HelmChart
|
||||
clean_install JavaScriptSDK
|
||||
clean_install .
|
||||
@@ -1,52 +0,0 @@
|
||||
#
|
||||
sudo dpkg --configure -a
|
||||
echo "Running Cleanup Script..."
|
||||
if [[ $(which helm) ]]
|
||||
then
|
||||
# Remove oneuptime if helm is installed
|
||||
echo "RUNNING COMMAND: sudo helm uninstall oneuptime || echo 'oneuptime not installed'"
|
||||
sudo helm uninstall oneuptime || echo 'oneuptime not installed'
|
||||
fi
|
||||
|
||||
if [[ $(which microk8s) ]]
|
||||
then
|
||||
# Stop microk8s VM
|
||||
echo "Stopping microk8s..."
|
||||
# Delete microk8s cluster so it can be fresh for next job.
|
||||
echo "Delete microk8s Cluster..."
|
||||
echo "RUNNING COMMAND: sudo usermod -a -G microk8s $USER"
|
||||
sudo usermod -a -G microk8s $USER || echo "microk8s group not found"
|
||||
echo "RUNNING COMMAND: microk8s.reset || 'microk8s cannot delete'"
|
||||
sudo microk8s.reset || 'microk8s cannot delete'
|
||||
echo "RUNNING COMMAND: microk8s.kubectl delete all --all || 'microk8s.kubectl cannot delete'"
|
||||
sudo microk8s.kubectl delete all --all || 'microk8s.kubectl cannot delete'
|
||||
echo "RUNNING COMMAND: microk8s.stop || 'microk8s cannot Stop'"
|
||||
sudo microk8s.stop || "microk8s cannot Stop"
|
||||
echo "RUNNING COMMAND: sudo snap remove microk8s || 'microk8s cannot be removed.'"
|
||||
sudo snap remove microk8s || 'microk8s cannot be removed.'
|
||||
fi
|
||||
|
||||
if [[ $(which docker) ]]
|
||||
then
|
||||
# Stop all docker containers
|
||||
echo "Stop and Delete all docker containers..."
|
||||
echo "RUNNING COMMAND: sudo docker stop \$(sudo docker ps -aq) || echo 'No docker containers'"
|
||||
sudo docker stop $(sudo docker ps -aq) || echo 'No docker containers'
|
||||
# Remove all docker containers.
|
||||
echo "RUNNING COMMAND: sudo docker rm \$(sudo docker ps -aq) || echo 'No docker containers'"
|
||||
sudo docker rm $(sudo docker ps -aq) || echo 'No docker containers'
|
||||
# Delete all locally built images. (Comment this out to reduce build times)
|
||||
# echo "RUNNING COMMAND: sudo docker rmi -f \$(sudo docker images -q) || echo 'No docker containers'"
|
||||
# sudo docker rmi -f $(sudo docker images -q) || echo 'No docker containers'
|
||||
|
||||
# Comment line below to reduce build times.
|
||||
# sudo docker system prune -a --volumes --force
|
||||
fi
|
||||
|
||||
# fix broken unmet dependencies
|
||||
sudo apt --fix-broken install -y -y
|
||||
|
||||
# remove any service holding port 80
|
||||
sudo apt remove apache2 nginx -y
|
||||
sudo apt purge apache2 nginx -y
|
||||
sudo apt autoremove -y
|
||||
@@ -1,5 +0,0 @@
|
||||
curl -X POST "https://api.cloudflare.com/client/v4/zones/${CF_ZONE}/purge_cache" \
|
||||
-H "X-Auth-Email: ${CF_EMAIL}" \
|
||||
-H "X-Auth-Key: ${CF_API_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{"purge_everything":true}'
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "Connect machine with to communicate with aws cluster"
|
||||
# This command will automatically switch to the oneuptime-production cluster
|
||||
|
||||
# AWS command.
|
||||
#sudo aws eks update-kubeconfig --region $AWS_DEFAULT_REGION --name fyipe-production
|
||||
|
||||
|
||||
doctl kubernetes cluster kubeconfig save 5c53f2a7-e462-48ab-9c02-3fbe281b2568
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Install Kubectl
|
||||
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
|
||||
sudo kubectl version --client
|
||||
|
||||
# fix dpkg interruption
|
||||
sudo dpkg --configure -a
|
||||
|
||||
# fix broken unmet dependencies
|
||||
sudo apt --fix-broken install -y -y
|
||||
|
||||
# # Install and configure aws cli
|
||||
# sudo apt-get install -y unzip
|
||||
# curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" # download latest aws cli version
|
||||
# unzip awscliv2.zip
|
||||
# sudo ./aws/install
|
||||
# aws --version # confirm installation
|
||||
|
||||
# # Remove any already existing ~/.aws, /root/.kube or /root/.config directory
|
||||
# sudo rm -rf ~/.aws || echo "Directory already deleted"
|
||||
# sudo rm -rf /root/.config || echo "Directory already deleted"
|
||||
# sudo rm -rf /root/.kube || echo "Directory already deleted"
|
||||
|
||||
# # Configure aws cli
|
||||
# sudo aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
|
||||
# sudo aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
|
||||
# sudo aws configure set default.region $AWS_DEFAULT_REGION
|
||||
# sudo aws configure set default.output json
|
||||
|
||||
|
||||
# Install doctl.
|
||||
wget https://github.com/digitalocean/doctl/releases/download/v1.71.0/doctl-1.71.0-linux-amd64.tar.gz
|
||||
tar xf doctl-1.71.0-linux-amd64.tar.gz
|
||||
sudo mv doctl /usr/local/bin
|
||||
|
||||
# Setup access token
|
||||
doctl auth init -t $DIGITAL_OCEAN_API_KEY
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "Connect machine with to communicate with aws cluster"
|
||||
# This command will automatically switch to the oneuptime-staging cluster
|
||||
sudo aws eks update-kubeconfig --region $AWS_DEFAULT_REGION --name fyipe-staging
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "
|
||||
======== IMPORTANT! =========
|
||||
This script will take ~30+ mins to complete.
|
||||
- Builds a docker container
|
||||
- This script takes a long time to run when you run it for the first time
|
||||
- Next subsequent executions would be a lot faster.
|
||||
"
|
||||
|
||||
if [[ ! $(which docker) && ! $(docker --version) ]]
|
||||
then
|
||||
echo -e "\033[91mPlease install Docker. https://docs.docker.com/install"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ ! $(which git) && ! $(docker --git) ]]
|
||||
then
|
||||
echo -e "\033[91mPlease install Git. https://git-scm.com/book/en/v2/Getting-Started-Installing-Git"
|
||||
exit
|
||||
fi
|
||||
|
||||
DIR=$PWD
|
||||
ONEUPTIME_DIR="$DIR/.."
|
||||
|
||||
chmod +x ./ci/scripts/docker-build-and-push.sh
|
||||
function build {
|
||||
./ci/scripts/docker-build-and-push.sh $1 $2
|
||||
}
|
||||
|
||||
# cd ..
|
||||
|
||||
build dashboard $1
|
||||
build accounts $1
|
||||
build backend $1
|
||||
build home $1
|
||||
build StatusPage $1
|
||||
build ApiReference $1
|
||||
build probe $1
|
||||
build AdminDashboard $1
|
||||
build InitScript $1
|
||||
build slack $1
|
||||
build licensing $1
|
||||
build HelmChart $1
|
||||
build LighthouseRunner $1
|
||||
build ScriptRunner $1
|
||||
build ContainerScanner $1
|
||||
build ApplicationScanner $1
|
||||
build data-ingestor $1
|
||||
build realtime $1
|
||||
build haraka $1
|
||||
build HttpTestServer $1
|
||||
|
||||
cd $DIR
|
||||
@@ -1,6 +0,0 @@
|
||||
cd $1
|
||||
echo "Building $1"
|
||||
sudo docker build -t oneuptime/$1:$2 .
|
||||
echo "Pushing $1"
|
||||
sudo docker push oneuptime/$1:$2
|
||||
cd ..
|
||||
@@ -1,19 +0,0 @@
|
||||
#Install Docker and setup registry and insecure access to it.
|
||||
#IF docker is already installed, do not install docker.
|
||||
if [[ ! $(which docker) ]]
|
||||
then
|
||||
echo "INSTALLING DOCKER"
|
||||
sudo apt-get update
|
||||
sudo apt-get install \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
lsb-release
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
echo \
|
||||
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
sudo apt-get update
|
||||
sudo apt-get install docker-ce docker-ce-cli containerd.io
|
||||
fi
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# install jq only when it does not exist
|
||||
|
||||
function hashExist {
|
||||
# $1 is the job name
|
||||
# $2 is the project
|
||||
if [[ ! $(which jq) ]]
|
||||
then
|
||||
sudo apt-get install -y jq
|
||||
fi
|
||||
PROJECT_HASH=`find $2 -type f ! -path "*node_modules*" ! -path "*build*" -print0 | sort -z | xargs -0 sha256sum | sha256sum`
|
||||
HASH_VALUE=`echo $PROJECT_HASH$1 | sha256sum | head -c 64`
|
||||
RESPONSE=`curl -H "Content-Type: application/json" -d "{\"structuredQuery\": {\"from\": {\"collectionId\": \"builds\"},\"where\": {\"compositeFilter\": {\"op\": \"AND\",\"filters\": [{\"fieldFilter\": {\"field\": {\"fieldPath\": \"project\"},\"op\": \"EQUAL\",\"value\": {\"stringValue\": '$2'}}},{\"fieldFilter\": {\"field\": {\"fieldPath\": \"hash\"},\"op\": \"EQUAL\",\"value\": {\"stringValue\": '$HASH_VALUE'}}}]}}}}" -X POST "https://firestore.googleapis.com/v1/projects/oneuptime-devops/databases/(default)/documents:runQuery"`
|
||||
# if response contains an array of object with document key, then the hash already exist in db
|
||||
document=`jq '.[0].document' <<< "$RESPONSE"`
|
||||
if [[ $document == null ]]
|
||||
then
|
||||
echo false
|
||||
else
|
||||
echo true
|
||||
fi
|
||||
}
|
||||
|
||||
hashExist $1 $2
|
||||
@@ -1,31 +0,0 @@
|
||||
sudo sed -i '/accounts/c\' /etc/hosts
|
||||
ACCOUNTS_IP=`sudo k describe svc oneuptime-accounts | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $ACCOUNTS_IP' accounts.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/AdminDashboard/c\' /etc/hosts
|
||||
ADMIN_DASHBOARD_IP=`sudo k describe svc oneuptime-admin | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $ADMIN_DASHBOARD_IP' admin.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/dashboard/c\' /etc/hosts
|
||||
DASHBOARD_IP=`sudo k describe svc oneuptime-dashboard | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $DASHBOARD_IP' dashboard.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/backend/c\' /etc/hosts
|
||||
BACKEND_IP=`sudo k describe svc oneuptime-backend | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $BACKEND_IP' backend.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/home/c\' /etc/hosts
|
||||
HOME_IP=`sudo k describe svc oneuptime-home | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $HOME_IP' home.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/StatusPage/c\' /etc/hosts
|
||||
STATUSPAGE_IP=`sudo k describe svc oneuptime-status | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $STATUSPAGE_IP' status.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/ApiReference/c\' /etc/hosts
|
||||
ApiReference_IP=`sudo k describe svc oneuptime-ApiReference | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $ApiReference_IP' ApiReference.app.local' | sudo tee -a /etc/hosts
|
||||
|
||||
sudo sed -i '/licensing/c\' /etc/hosts
|
||||
LICENSING_IP=`sudo k describe svc oneuptime-licensing | grep Endpoints | cut -d ":" -f 2`
|
||||
echo $LICENSING_IP' licensing.app.local' | sudo tee -a /etc/hosts
|
||||
@@ -1,9 +0,0 @@
|
||||
echo "Installing helm..."
|
||||
|
||||
sudo https://baltocdn.com/helm/signing.asc | sudo apt-key add -
|
||||
sudo apt-get install apt-transport-https --yes
|
||||
sudo echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install helm
|
||||
|
||||
echo "Install helm complete."
|
||||
@@ -1,2 +0,0 @@
|
||||
sudo apt-get install -y jq
|
||||
curl -s -S --header "PRIVATE-TOKEN: $PERSONAL_ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs?per_page=50" | jq -c ".[] | select(.name==\"$1\") | .status"
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "
|
||||
This script rollbacks every project if any of the deployment fails
|
||||
"
|
||||
|
||||
chmod +x ./ci/scripts/job-status.sh
|
||||
|
||||
function rollback {
|
||||
export status=`./ci/scripts/job-status.sh production_$1`
|
||||
if [[ $status == \"success\" ]]
|
||||
then
|
||||
echo "Rolling back $1"
|
||||
sudo kubectl rollout undo deployment/$1
|
||||
else
|
||||
echo "Rollback skipped $1"
|
||||
fi
|
||||
}
|
||||
|
||||
function check {
|
||||
export status=`./ci/scripts/job-status.sh production_$1`
|
||||
if [[ $status == \"failed\" ]]
|
||||
then
|
||||
echo "Deployment unsuccessful for $1, rolling back all new deployments"
|
||||
rollback dashboard
|
||||
rollback accounts
|
||||
rollback backend
|
||||
rollback home
|
||||
rollback StatusPage
|
||||
rollback ApiReference
|
||||
rollback probe
|
||||
rollback AdminDashboard
|
||||
rollback licensing
|
||||
rollback HelmChart
|
||||
rollback slack
|
||||
exit 1
|
||||
else
|
||||
echo "$1 Deployment successful"
|
||||
fi
|
||||
}
|
||||
|
||||
check dashboard
|
||||
check accounts
|
||||
check backend
|
||||
check home
|
||||
check StatusPage
|
||||
check ApiReference
|
||||
check probe-1
|
||||
check probe-2
|
||||
check AdminDashboard
|
||||
check licensing
|
||||
check InitScript
|
||||
check slack
|
||||
check HelmChart
|
||||
@@ -1,26 +0,0 @@
|
||||
# Wait for all the services to come online.
|
||||
echo "RUNNING COMMAND: echo 'Wait for 10 mins....'"
|
||||
echo 'Wait for 10 mins....'
|
||||
echo "RUNNING COMMAND: sleep 10m"
|
||||
sleep 10m
|
||||
# Get the status of all the kubernetes resources for debugging purposes.
|
||||
echo "RUNNING COMMAND: sudo k get pods"
|
||||
sudo k get pods
|
||||
echo "RUNNING COMMAND: sudo k get services"
|
||||
sudo k get services
|
||||
echo "RUNNING COMMAND: sudo k get rc"
|
||||
sudo k get rc
|
||||
echo "RUNNING COMMAND: sudo k get deployments"
|
||||
sudo k get deployments
|
||||
echo "RUNNING COMMAND: sudo k get statefulset"
|
||||
sudo k get statefulset
|
||||
echo "RUNNING COMMAND: sudo k get pv"
|
||||
sudo k get pv
|
||||
echo "RUNNING COMMAND: sudo k get pvc"
|
||||
sudo k get pvc
|
||||
echo "RUNNING COMMAND: sudo k get storageclass"
|
||||
sudo k get storageclass
|
||||
echo "RUNNING COMMAND: sudo k cluster-info"
|
||||
sudo k cluster-info
|
||||
echo "RUNNING COMMAND: sudo k get all --all-namespaces"
|
||||
sudo k get all --all-namespaces
|
||||
@@ -1,36 +0,0 @@
|
||||
# Cleanup
|
||||
echo "RUNNING COMMAND: chmod +x ./ci/cleanup.sh"
|
||||
chmod +x ./ci/scripts/cleanup.sh
|
||||
echo "RUNNING COMMAND: ./ci/cleanup.sh"
|
||||
./ci/scripts/cleanup.sh
|
||||
|
||||
#Install Docker and setup registry and insecure access to it.
|
||||
#IF docker is already installed, do not install docker.
|
||||
if [[ ! $(which docker) ]]
|
||||
then
|
||||
echo "RUNNING COMMAND: curl -sSL https://get.docker.com/ | sh"
|
||||
curl -sSL https://get.docker.com/ | sh
|
||||
echo "RUNNING COMMAND: sudo touch /etc/docker/daemon.json"
|
||||
sudo touch /etc/docker/daemon.json
|
||||
echo "RUNNING COMMAND: echo -e "{\n "insecure-registries": ["localhost:32000"]\n}" | sudo tee -a /etc/docker/daemon.json >> /dev/null"
|
||||
echo -e "{\n "insecure-registries": ["localhost:32000"]\n}" | sudo tee -a /etc/docker/daemon.json >> /dev/null
|
||||
echo "RUNNING COMMAND: sudo systemctl restart docker"
|
||||
sudo systemctl restart docker
|
||||
fi
|
||||
|
||||
# Install packages.
|
||||
echo "RUNNING COMMAND: sudo apt-get update -y && sudo apt-get install -y bash git sudo nodejs"
|
||||
sudo apt-get update -y && sudo apt-get install -y bash git sudo nodejs
|
||||
|
||||
# Install additional dependencies for puppeteer.
|
||||
echo "RUNNING COMMAND: sudo apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
|
||||
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
|
||||
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
|
||||
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
|
||||
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils
|
||||
"
|
||||
sudo apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
|
||||
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
|
||||
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
|
||||
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
|
||||
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
|
||||
@@ -1,19 +0,0 @@
|
||||
##############
|
||||
# IMPORTANT:
|
||||
# This script sets the CI/CD machine up to run a build job. It's usually the first script that runs
|
||||
##############
|
||||
|
||||
# Cleanup
|
||||
echo "RUNNING COMMAND: chmod +x ./ci/cleanup.sh"
|
||||
chmod +x ./ci/scripts/cleanup.sh
|
||||
echo "RUNNING COMMAND: ./ci/cleanup.sh"
|
||||
./ci/scripts/cleanup.sh
|
||||
|
||||
# Setup Machine.
|
||||
echo "RUNNING COMMAND: chmod +x ./HelmChart/public/install.sh"
|
||||
chmod +x ./HelmChart/public/install.sh
|
||||
echo "RUNNING COMMAND: ./HelmChart/public/install.sh"
|
||||
./HelmChart/public/install.sh ci-install $1
|
||||
|
||||
# For dpkg interruption
|
||||
sudo dpkg --configure -a
|
||||
@@ -1,8 +0,0 @@
|
||||
# This will download, build and package docker containers.
|
||||
echo "RUNNING COMMAND: chmod +x ./ci/docker-build-all-and-push.sh"
|
||||
chmod +x ./ci/scripts/docker-build-all-and-push.sh
|
||||
./ci/scripts/docker-build-all-and-push.sh test
|
||||
# Setup Kubernetes Cluster
|
||||
chmod +x ./ci/scripts/setup-cluster.sh
|
||||
echo "RUNNING COMMAND: ./ci/setup-cluster.sh"
|
||||
./ci/scripts/setup-cluster.sh
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "
|
||||
This script rollbacks every project if any of the deployment fails
|
||||
"
|
||||
|
||||
chmod +x ./ci/scripts/job-status.sh
|
||||
|
||||
function rollback {
|
||||
export status=`./ci/scripts/job-status.sh staging_$1`
|
||||
if [[ $status == \"success\" ]]
|
||||
then
|
||||
echo "Rolling back $1"
|
||||
sudo kubectl rollout undo deployment/fi-$1
|
||||
if [[ $1 == \"probe\" ]]
|
||||
then
|
||||
echo "Rolling back probe1"
|
||||
sudo kubectl rollout undo deployment/fi-probe1
|
||||
sudo kubectl rollout undo deployment/fi-probe2
|
||||
fi
|
||||
else
|
||||
echo "Rollback skipped $1"
|
||||
fi
|
||||
}
|
||||
|
||||
function check {
|
||||
export status=`./ci/scripts/job-status.sh staging_$1`
|
||||
if [[ $status == \"failed\" ]]
|
||||
then
|
||||
echo "Deployment unsuccessful for $1, rolling back all new deployments"
|
||||
rollback dashboard
|
||||
rollback accounts
|
||||
rollback backend
|
||||
rollback home
|
||||
rollback StatusPage
|
||||
rollback ApiReference
|
||||
rollback probe
|
||||
rollback AdminDashboard
|
||||
rollback licensing
|
||||
rollback HelmChart
|
||||
rollback slack
|
||||
exit 1
|
||||
else
|
||||
echo "$1 Deployment successful"
|
||||
fi
|
||||
}
|
||||
|
||||
check dashboard
|
||||
check accounts
|
||||
check backend
|
||||
check home
|
||||
check StatusPage
|
||||
check ApiReference
|
||||
check probe-1
|
||||
check probe-2
|
||||
check AdminDashboard
|
||||
check licensing
|
||||
check slack
|
||||
check HelmChart
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
chmod +x ./ci/scripts/hashexist.sh
|
||||
|
||||
function storeHash {
|
||||
# $1 -> Job Name; $2 -> Project
|
||||
PROJECT_HASH=`find $2 -type f ! -path "*node_modules*" ! -path "*build*" -print0 | sort -z | xargs -0 sha256sum | sha256sum`
|
||||
HASH_VALUE=`echo $PROJECT_HASH$1 | sha256sum | head -c 64`
|
||||
curl -H "Content-Type: application/json" -d "{\"fields\": {\"project\": {\"stringValue\": '$2'},\"hash\": {\"stringValue\": '$HASH_VALUE'}}}" -X POST "https://firestore.googleapis.com/v1/projects/oneuptime-devops/databases/(default)/documents/builds"
|
||||
}
|
||||
|
||||
if [[ $CI_COMMIT_BRANCH != "master" ]] && [[ $CI_COMMIT_BRANCH != "release" ]]
|
||||
then
|
||||
# the first argument is always the job name ($1)
|
||||
for ((i = 2; i <= $#; i++ ))
|
||||
do
|
||||
hash_exist=`./ci/scripts/hashexist.sh $1 ${!i}`
|
||||
if [[ $hash_exist == *"false"* ]]
|
||||
then
|
||||
storeHash $1 ${!i}
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "
|
||||
This script changes version of every project
|
||||
"
|
||||
function version {
|
||||
cd $1
|
||||
npm version "6.0.$CI_PIPELINE_ID"
|
||||
cd ..
|
||||
}
|
||||
|
||||
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
|
||||
version dashboard
|
||||
version accounts
|
||||
version backend
|
||||
version home
|
||||
version StatusPage
|
||||
version ApiReference
|
||||
version probe
|
||||
version AdminDashboard
|
||||
version InitScript
|
||||
version licensing
|
||||
version HelmChart
|
||||
version JavaScriptSDK
|
||||
version oneuptime-le-store
|
||||
version oneuptime-acme-http-01
|
||||
version LighthouseRunner
|
||||
version ScriptRunner
|
||||
version ContainerScanner
|
||||
version ApplicationScanner
|
||||
version data-ingestor
|
||||
version realtime
|
||||
version ProbeAPI
|
||||
version .
|
||||
42
Clickhouse/Docs/ClickhouseOps.md
Normal file
42
Clickhouse/Docs/ClickhouseOps.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# Some basic commands for Clickhouse
|
||||
|
||||
## Show tables in the database
|
||||
|
||||
```sql
|
||||
show tables from oneuptime
|
||||
```
|
||||
|
||||
## Show table structure
|
||||
|
||||
```sql
|
||||
DESCRIBE TABLE oneuptime.Span
|
||||
```
|
||||
|
||||
## Show table data
|
||||
|
||||
```sql
|
||||
select * from table_name
|
||||
```
|
||||
|
||||
## Delete table data
|
||||
|
||||
```sql
|
||||
truncate table_name
|
||||
```
|
||||
|
||||
## Delete table
|
||||
|
||||
```sql
|
||||
drop table oneuptime.table_name
|
||||
```
|
||||
|
||||
## Insert for nested data
|
||||
|
||||
```sql
|
||||
INSERT INTO opentelemetry_spans (trace_id, span_id, attributes.key, attributes.value) VALUES
|
||||
('trace1', 'span1', ['key1', 'key2'], ['value1', 'value2']),
|
||||
('trace2', 'span2', ['keyA', 'keyB'], ['valueA', 'valueB']);
|
||||
```
|
||||
|
||||
|
||||
|
||||
261
Common/AnalyticsModels/BaseModel.ts
Normal file
261
Common/AnalyticsModels/BaseModel.ts
Normal file
@@ -0,0 +1,261 @@
|
||||
import TableColumnType from '../Types/AnalyticsDatabase/TableColumnType';
|
||||
import AnalyticsTableColumn from '../Types/AnalyticsDatabase/TableColumn';
|
||||
import BadDataException from '../Types/Exception/BadDataException';
|
||||
import AnalyticsTableEngine from '../Types/AnalyticsDatabase/AnalyticsTableEngine';
|
||||
import ColumnBillingAccessControl from '../Types/BaseDatabase/ColumnBillingAccessControl';
|
||||
import TableBillingAccessControl from '../Types/BaseDatabase/TableBillingAccessControl';
|
||||
import { TableAccessControl } from '../Types/BaseDatabase/AccessControl';
|
||||
import EnableWorkflowOn from '../Types/BaseDatabase/EnableWorkflowOn';
|
||||
import ObjectID from '../Types/ObjectID';
|
||||
import CommonModel from './CommonModel';
|
||||
|
||||
export default class AnalyticsDataModel extends CommonModel {
|
||||
public constructor(data: {
|
||||
tableName: string;
|
||||
singularName: string;
|
||||
pluralName: string;
|
||||
tableEngine?: AnalyticsTableEngine | undefined;
|
||||
tableColumns: Array<AnalyticsTableColumn>;
|
||||
allowAccessIfSubscriptionIsUnpaid?: boolean | undefined;
|
||||
tableBillingAccessControl?: TableBillingAccessControl | undefined;
|
||||
accessControl?: TableAccessControl | undefined;
|
||||
primaryKeys: Array<string>; // this should be the subset of tableColumns
|
||||
enableWorkflowOn?: EnableWorkflowOn | undefined;
|
||||
}) {
|
||||
super({
|
||||
tableColumns: data.tableColumns,
|
||||
});
|
||||
const columns: Array<AnalyticsTableColumn> = [...data.tableColumns];
|
||||
|
||||
this.tableName = data.tableName;
|
||||
|
||||
if (data.tableEngine) {
|
||||
this.tableEngine = data.tableEngine;
|
||||
}
|
||||
|
||||
columns.push(
|
||||
new AnalyticsTableColumn({
|
||||
key: '_id',
|
||||
title: 'ID',
|
||||
description: 'ID of this object',
|
||||
required: true,
|
||||
type: TableColumnType.ObjectID,
|
||||
})
|
||||
);
|
||||
|
||||
columns.push(
|
||||
new AnalyticsTableColumn({
|
||||
key: 'createdAt',
|
||||
title: 'Created',
|
||||
description: 'Date and Time when the object was created.',
|
||||
required: true,
|
||||
type: TableColumnType.Date,
|
||||
})
|
||||
);
|
||||
|
||||
columns.push(
|
||||
new AnalyticsTableColumn({
|
||||
key: 'updatedAt',
|
||||
title: 'Updated',
|
||||
description: 'Date and Time when the object was updated.',
|
||||
required: true,
|
||||
type: TableColumnType.Date,
|
||||
})
|
||||
);
|
||||
|
||||
if (!data.primaryKeys || data.primaryKeys.length === 0) {
|
||||
throw new BadDataException('Primary keys are required');
|
||||
}
|
||||
|
||||
// check if primary keys are subset of tableColumns
|
||||
|
||||
data.primaryKeys.forEach((primaryKey: string) => {
|
||||
const column: AnalyticsTableColumn | undefined = columns.find(
|
||||
(column: AnalyticsTableColumn) => {
|
||||
return column.key === primaryKey;
|
||||
}
|
||||
);
|
||||
|
||||
if (!column) {
|
||||
throw new BadDataException(
|
||||
'Primary key ' + primaryKey + ' is not part of tableColumns'
|
||||
);
|
||||
}
|
||||
|
||||
if (!column.required) {
|
||||
throw new BadDataException(
|
||||
'Primary key ' +
|
||||
primaryKey +
|
||||
' is not required. Primary keys must be required.'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
this.primaryKeys = data.primaryKeys;
|
||||
this.tableColumns = columns;
|
||||
this.singularName = data.singularName;
|
||||
this.pluralName = data.pluralName;
|
||||
this.tableBillingAccessControl = data.tableBillingAccessControl;
|
||||
this.allowAccessIfSubscriptionIsUnpaid =
|
||||
data.allowAccessIfSubscriptionIsUnpaid || false;
|
||||
this.accessControl = data.accessControl;
|
||||
this.enableWorkflowOn = data.enableWorkflowOn;
|
||||
|
||||
// initialize Arrays.
|
||||
for (const column of this.tableColumns) {
|
||||
if (column.type === TableColumnType.NestedModel) {
|
||||
this.setColumnValue(column.key, []);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private _enableWorkflowOn: EnableWorkflowOn | undefined;
|
||||
public get enableWorkflowOn(): EnableWorkflowOn | undefined {
|
||||
return this._enableWorkflowOn;
|
||||
}
|
||||
public set enableWorkflowOn(v: EnableWorkflowOn | undefined) {
|
||||
this._enableWorkflowOn = v;
|
||||
}
|
||||
|
||||
private _accessControl: TableAccessControl | undefined;
|
||||
public get accessControl(): TableAccessControl | undefined {
|
||||
return this._accessControl;
|
||||
}
|
||||
public set accessControl(v: TableAccessControl | undefined) {
|
||||
this._accessControl = v;
|
||||
}
|
||||
|
||||
private _tableName: string = '';
|
||||
public get tableName(): string {
|
||||
return this._tableName;
|
||||
}
|
||||
public set tableName(v: string) {
|
||||
this._tableName = v;
|
||||
}
|
||||
|
||||
private _tableEngine: AnalyticsTableEngine = AnalyticsTableEngine.MergeTree;
|
||||
public get tableEngine(): AnalyticsTableEngine {
|
||||
return this._tableEngine;
|
||||
}
|
||||
public set tableEngine(v: AnalyticsTableEngine) {
|
||||
this._tableEngine = v;
|
||||
}
|
||||
|
||||
private _primaryKeys: Array<string> = [];
|
||||
public get primaryKeys(): Array<string> {
|
||||
return this._primaryKeys;
|
||||
}
|
||||
public set primaryKeys(v: Array<string>) {
|
||||
this._primaryKeys = v;
|
||||
}
|
||||
|
||||
private _singularName: string = '';
|
||||
public get singularName(): string {
|
||||
return this._singularName;
|
||||
}
|
||||
public set singularName(v: string) {
|
||||
this._singularName = v;
|
||||
}
|
||||
|
||||
private _pluralName: string = '';
|
||||
public get pluralName(): string {
|
||||
return this._pluralName;
|
||||
}
|
||||
public set pluralName(v: string) {
|
||||
this._pluralName = v;
|
||||
}
|
||||
|
||||
private _tableBillingAccessControl: TableBillingAccessControl | undefined;
|
||||
public get tableBillingAccessControl():
|
||||
| TableBillingAccessControl
|
||||
| undefined {
|
||||
return this._tableBillingAccessControl;
|
||||
}
|
||||
public set tableBillingAccessControl(
|
||||
v: TableBillingAccessControl | undefined
|
||||
) {
|
||||
this._tableBillingAccessControl = v;
|
||||
}
|
||||
|
||||
private _allowAccessIfSubscriptionIsUnpaid: boolean = false;
|
||||
public get allowAccessIfSubscriptionIsUnpaid(): boolean {
|
||||
return this._allowAccessIfSubscriptionIsUnpaid;
|
||||
}
|
||||
public set allowAccessIfSubscriptionIsUnpaid(v: boolean) {
|
||||
this._allowAccessIfSubscriptionIsUnpaid = v;
|
||||
}
|
||||
|
||||
public getTenantColumn(): AnalyticsTableColumn | null {
|
||||
const column: AnalyticsTableColumn | undefined = this.tableColumns.find(
|
||||
(column: AnalyticsTableColumn) => {
|
||||
return column.isTenantId;
|
||||
}
|
||||
);
|
||||
|
||||
if (!column) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return column;
|
||||
}
|
||||
|
||||
public getRequiredColumns(): Array<AnalyticsTableColumn> {
|
||||
return this.tableColumns.filter((column: AnalyticsTableColumn) => {
|
||||
return column.required;
|
||||
});
|
||||
}
|
||||
|
||||
public isDefaultValueColumn(columnName: string): boolean {
|
||||
const column: AnalyticsTableColumn | null =
|
||||
this.getTableColumn(columnName);
|
||||
|
||||
if (!column) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return column.isDefaultValueColumn;
|
||||
}
|
||||
|
||||
public getColumnBillingAccessControl(
|
||||
columnName: string
|
||||
): ColumnBillingAccessControl | null {
|
||||
const column: AnalyticsTableColumn | null =
|
||||
this.getTableColumn(columnName);
|
||||
|
||||
if (!column) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return column.billingAccessControl || null;
|
||||
}
|
||||
|
||||
public get id(): ObjectID | undefined {
|
||||
return this.getColumnValue('_id') as ObjectID | undefined;
|
||||
}
|
||||
public set id(v: ObjectID | undefined) {
|
||||
this.setColumnValue('_id', v);
|
||||
}
|
||||
|
||||
public get _id(): ObjectID | undefined {
|
||||
return this.getColumnValue('_id') as ObjectID | undefined;
|
||||
}
|
||||
public set _id(v: ObjectID | undefined) {
|
||||
this.setColumnValue('_id', v);
|
||||
}
|
||||
|
||||
public get createdAt(): Date | undefined {
|
||||
return this.getColumnValue('createdAt') as Date | undefined;
|
||||
}
|
||||
|
||||
public set createdAt(v: Date | undefined) {
|
||||
this.setColumnValue('createdAt', v);
|
||||
}
|
||||
|
||||
public get updatedAt(): Date | undefined {
|
||||
return this.getColumnValue('updatedAt') as Date | undefined;
|
||||
}
|
||||
|
||||
public set updatedAt(v: Date | undefined) {
|
||||
this.setColumnValue('updatedAt', v);
|
||||
}
|
||||
}
|
||||
178
Common/AnalyticsModels/CommonModel.ts
Normal file
178
Common/AnalyticsModels/CommonModel.ts
Normal file
@@ -0,0 +1,178 @@
|
||||
// This model will be extended by BaseModel and Nested Mdoel
|
||||
|
||||
import AnalyticsTableColumn from '../Types/AnalyticsDatabase/TableColumn';
|
||||
import TableColumnType from '../Types/AnalyticsDatabase/TableColumnType';
|
||||
import OneUptimeDate from '../Types/Date';
|
||||
import BadDataException from '../Types/Exception/BadDataException';
|
||||
import { JSONObject, JSONValue } from '../Types/JSON';
|
||||
import ObjectID from '../Types/ObjectID';
|
||||
|
||||
export type RecordValue =
|
||||
| ObjectID
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| Date
|
||||
| Array<number>
|
||||
| Array<string>
|
||||
| Array<CommonModel>;
|
||||
|
||||
export type Record = Array<RecordValue | Record>;
|
||||
|
||||
export default class CommonModel {
|
||||
protected data: JSONObject = {};
|
||||
|
||||
private _tableColumns: Array<AnalyticsTableColumn> = [];
|
||||
public get tableColumns(): Array<AnalyticsTableColumn> {
|
||||
return this._tableColumns;
|
||||
}
|
||||
public set tableColumns(v: Array<AnalyticsTableColumn>) {
|
||||
this._tableColumns = v;
|
||||
}
|
||||
|
||||
public setColumnValue(
|
||||
columnName: string,
|
||||
value: JSONValue | Array<CommonModel>
|
||||
): void {
|
||||
const column: AnalyticsTableColumn | null =
|
||||
this.getTableColumn(columnName);
|
||||
|
||||
if (column) {
|
||||
if (
|
||||
column.type === TableColumnType.ObjectID &&
|
||||
typeof value === 'string'
|
||||
) {
|
||||
value = new ObjectID(value);
|
||||
}
|
||||
|
||||
if (
|
||||
column.type === TableColumnType.Date &&
|
||||
typeof value === 'string'
|
||||
) {
|
||||
value = OneUptimeDate.fromString(value);
|
||||
}
|
||||
|
||||
if (
|
||||
column.type === TableColumnType.JSON &&
|
||||
typeof value === 'string'
|
||||
) {
|
||||
value = JSON.parse(value);
|
||||
}
|
||||
|
||||
if (
|
||||
column.type === TableColumnType.Number &&
|
||||
typeof value === 'string'
|
||||
) {
|
||||
value = parseInt(value);
|
||||
}
|
||||
|
||||
// decimal
|
||||
if (
|
||||
column.type === TableColumnType.Decimal &&
|
||||
typeof value === 'string'
|
||||
) {
|
||||
value = parseFloat(value);
|
||||
}
|
||||
|
||||
return (this.data[columnName] = value as any);
|
||||
}
|
||||
throw new BadDataException('Column ' + columnName + ' does not exist');
|
||||
}
|
||||
|
||||
public constructor(data: { tableColumns: Array<AnalyticsTableColumn> }) {
|
||||
this.tableColumns = data.tableColumns;
|
||||
}
|
||||
|
||||
public getColumnValue<T extends RecordValue>(
|
||||
columnName: string
|
||||
): T | undefined {
|
||||
if (this.getTableColumn(columnName)) {
|
||||
return this.data[columnName] as T;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public getTableColumn(name: string): AnalyticsTableColumn | null {
|
||||
const column: AnalyticsTableColumn | undefined = this.tableColumns.find(
|
||||
(column: AnalyticsTableColumn) => {
|
||||
return column.key === name;
|
||||
}
|
||||
);
|
||||
|
||||
if (!column) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return column;
|
||||
}
|
||||
|
||||
public getTableColumns(): Array<AnalyticsTableColumn> {
|
||||
return this.tableColumns;
|
||||
}
|
||||
|
||||
public fromJSON(json: JSONObject): CommonModel {
|
||||
for (const key in json) {
|
||||
this.setColumnValue(key, json[key]);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public toJSON(): JSONObject {
|
||||
const json: JSONObject = {};
|
||||
|
||||
this.tableColumns.forEach((column: AnalyticsTableColumn) => {
|
||||
const recordValue: RecordValue | undefined = this.getColumnValue(
|
||||
column.key
|
||||
);
|
||||
|
||||
if (recordValue instanceof CommonModel) {
|
||||
json[column.key] = recordValue.toJSON();
|
||||
return;
|
||||
}
|
||||
|
||||
if (recordValue instanceof Array) {
|
||||
if (
|
||||
recordValue.length > 0 &&
|
||||
recordValue[0] instanceof CommonModel
|
||||
) {
|
||||
json[column.key] = CommonModel.toJSONArray(
|
||||
recordValue as Array<CommonModel>
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
json[column.key] = recordValue;
|
||||
});
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static fromJSONArray<TBaseModel extends CommonModel>(
|
||||
modelType: { new (): CommonModel },
|
||||
jsonArray: Array<JSONObject>
|
||||
): Array<TBaseModel> {
|
||||
const models: Array<CommonModel> = [];
|
||||
|
||||
jsonArray.forEach((json: JSONObject) => {
|
||||
const model: CommonModel = new modelType();
|
||||
model.fromJSON(json);
|
||||
models.push(model);
|
||||
});
|
||||
|
||||
return models as Array<TBaseModel>;
|
||||
}
|
||||
|
||||
public static toJSONArray(models: Array<CommonModel>): Array<JSONObject> {
|
||||
const json: Array<JSONObject> = [];
|
||||
|
||||
models.forEach((model: CommonModel) => {
|
||||
json.push(model.toJSON());
|
||||
});
|
||||
|
||||
return json;
|
||||
}
|
||||
}
|
||||
8
Common/AnalyticsModels/NestedModel.ts
Normal file
8
Common/AnalyticsModels/NestedModel.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import AnalyticsTableColumn from '../Types/AnalyticsDatabase/TableColumn';
|
||||
import CommonModel from './CommonModel';
|
||||
|
||||
export default class NestedModel extends CommonModel {
|
||||
public constructor(data: { tableColumns: Array<AnalyticsTableColumn> }) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
import TableColumnType from '../Types/BaseDatabase/TableColumnType';
|
||||
import AnalyticsTableColumn from '../Types/AnalyticsDatabase/TableColumn';
|
||||
import BadDataException from '../Types/Exception/BadDataException';
|
||||
import AnalyticsTableEngine from '../Types/AnalyticsDatabase/AnalyticsTableEngine';
|
||||
|
||||
export default class AnalyticsDataModel {
|
||||
private _tableColumns: Array<AnalyticsTableColumn> = [];
|
||||
public get tableColumns(): Array<AnalyticsTableColumn> {
|
||||
return this._tableColumns;
|
||||
}
|
||||
public set tableColumns(v: Array<AnalyticsTableColumn>) {
|
||||
this._tableColumns = v;
|
||||
}
|
||||
|
||||
private _tableName: string = '';
|
||||
public get tableName(): string {
|
||||
return this._tableName;
|
||||
}
|
||||
public set tableName(v: string) {
|
||||
this._tableName = v;
|
||||
}
|
||||
|
||||
private _tableEngine: AnalyticsTableEngine = AnalyticsTableEngine.MergeTree;
|
||||
public get tableEngine(): AnalyticsTableEngine {
|
||||
return this._tableEngine;
|
||||
}
|
||||
public set tableEngine(v: AnalyticsTableEngine) {
|
||||
this._tableEngine = v;
|
||||
}
|
||||
|
||||
private _primaryKeys: Array<string> = [];
|
||||
public get primaryKeys(): Array<string> {
|
||||
return this._primaryKeys;
|
||||
}
|
||||
public set primaryKeys(v: Array<string>) {
|
||||
this._primaryKeys = v;
|
||||
}
|
||||
|
||||
public constructor(data: {
|
||||
tableName: string;
|
||||
tableEngine?: AnalyticsTableEngine | undefined;
|
||||
tableColumns: Array<AnalyticsTableColumn>;
|
||||
primaryKeys: Array<string>; // this should be the subset of tableColumns
|
||||
}) {
|
||||
const columns: Array<AnalyticsTableColumn> = [...data.tableColumns];
|
||||
|
||||
this.tableName = data.tableName;
|
||||
|
||||
if (data.tableEngine) {
|
||||
this.tableEngine = data.tableEngine;
|
||||
}
|
||||
|
||||
columns.push(
|
||||
new AnalyticsTableColumn({
|
||||
key: '_id',
|
||||
title: 'ID',
|
||||
description: 'ID of this object',
|
||||
required: true,
|
||||
type: TableColumnType.ObjectID,
|
||||
})
|
||||
);
|
||||
|
||||
columns.push(
|
||||
new AnalyticsTableColumn({
|
||||
key: 'createdAt',
|
||||
title: 'Created',
|
||||
description: 'Date and Time when the object was created.',
|
||||
required: true,
|
||||
type: TableColumnType.Date,
|
||||
})
|
||||
);
|
||||
|
||||
columns.push(
|
||||
new AnalyticsTableColumn({
|
||||
key: 'updatedAt',
|
||||
title: 'Updated',
|
||||
description: 'Date and Time when the object was updated.',
|
||||
required: true,
|
||||
type: TableColumnType.Date,
|
||||
})
|
||||
);
|
||||
|
||||
if (!data.primaryKeys || data.primaryKeys.length === 0) {
|
||||
throw new BadDataException('Primary keys are required');
|
||||
}
|
||||
|
||||
// check if primary keys are subset of tableColumns
|
||||
|
||||
data.primaryKeys.forEach((primaryKey: string) => {
|
||||
if (
|
||||
!columns.find((column: AnalyticsTableColumn) => {
|
||||
return column.key === primaryKey;
|
||||
})
|
||||
) {
|
||||
throw new BadDataException(
|
||||
'Primary key ' + primaryKey + ' is not part of tableColumns'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
this.primaryKeys = data.primaryKeys;
|
||||
this.tableColumns = columns;
|
||||
}
|
||||
}
|
||||
@@ -21,24 +21,22 @@ import Email from '../Types/Email';
|
||||
import Phone from '../Types/Phone';
|
||||
import PositiveNumber from '../Types/PositiveNumber';
|
||||
import Route from '../Types/API/Route';
|
||||
import TableColumnType from '../Types/BaseDatabase/TableColumnType';
|
||||
import TableColumnType from '../Types/Database/TableColumnType';
|
||||
import Permission, {
|
||||
instanceOfUserTenantAccessPermission,
|
||||
PermissionHelper,
|
||||
UserPermission,
|
||||
UserTenantAccessPermission,
|
||||
} from '../Types/Permission';
|
||||
import {
|
||||
ColumnAccessControl,
|
||||
ColumnBillingAccessControl,
|
||||
} from '../Types/Database/AccessControl/AccessControl';
|
||||
import { ColumnAccessControl } from '../Types/BaseDatabase/AccessControl';
|
||||
import { getColumnAccessControlForAllColumns } from '../Types/Database/AccessControl/ColumnAccessControl';
|
||||
import BadDataException from '../Types/Exception/BadDataException';
|
||||
import { PlanSelect } from '../Types/Billing/SubscriptionPlan';
|
||||
import { EnableWorkflowOn } from '../Types/Model/EnableWorkflow';
|
||||
import EnableWorkflowOn from '../Types/BaseDatabase/EnableWorkflowOn';
|
||||
import IconProp from '../Types/Icon/IconProp';
|
||||
import Text from '../Types/Text';
|
||||
import { getColumnBillingAccessControlForAllColumns } from '../Types/Database/AccessControl/ColumnBillingAccessControl';
|
||||
import ColumnBillingAccessControl from '../Types/BaseDatabase/ColumnBillingAccessControl';
|
||||
|
||||
export type DbTypes =
|
||||
| string
|
||||
@@ -110,6 +108,7 @@ export default class BaseModel extends BaseEntity {
|
||||
public enableWorkflowOn!: EnableWorkflowOn;
|
||||
|
||||
public enableDocumentation!: boolean;
|
||||
public isMasterAdminApiDocs!: boolean;
|
||||
|
||||
public currentUserCanAccessColumnBy!: string | null;
|
||||
public labelsColumn!: string | null;
|
||||
@@ -254,6 +253,10 @@ export default class BaseModel extends BaseEntity {
|
||||
(this as any)[columnName] = value;
|
||||
}
|
||||
|
||||
public removeValue(columnName: string): void {
|
||||
(this as any)[columnName] = undefined;
|
||||
}
|
||||
|
||||
public doesPermissionHaveConditions(
|
||||
permission: Permission
|
||||
): JSONObject | null {
|
||||
|
||||
@@ -4,7 +4,7 @@ import ColumnLength from '../Types/Database/ColumnLength';
|
||||
import ColumnType from '../Types/Database/ColumnType';
|
||||
import SlugifyColumn from '../Types/Database/SlugifyColumn';
|
||||
import TableColumn from '../Types/Database/TableColumn';
|
||||
import TableColumnType from '../Types/BaseDatabase/TableColumnType';
|
||||
import TableColumnType from '../Types/Database/TableColumnType';
|
||||
import MimeType from '../Types/File/MimeType';
|
||||
import ObjectID from '../Types/ObjectID';
|
||||
import Permission from '../Types/Permission';
|
||||
|
||||
@@ -18,14 +18,12 @@ export const IntegrationRoute: Route = new Route('/integration');
|
||||
|
||||
export const NotificationRoute: Route = new Route('/notification');
|
||||
|
||||
export const HelmRoute: Route = new Route('/helm-chart');
|
||||
|
||||
export const AccountsRoute: Route = new Route('/accounts');
|
||||
|
||||
export const WorkflowRoute: Route = new Route('/workflow');
|
||||
|
||||
export const ApiReferenceRoute: Route = new Route('/api-reference');
|
||||
export const ApiReferenceRoute: Route = new Route('/reference');
|
||||
|
||||
export const AdminDashboardRoute: Route = new Route('/admin');
|
||||
|
||||
export const ProbeApiRoute: Route = new Route('/probe-api');
|
||||
export const IngestorRoute: Route = new Route('/ingestor');
|
||||
|
||||
61
Common/Tests/Types/API/HTTPErrorResponse.test.ts
Normal file
61
Common/Tests/Types/API/HTTPErrorResponse.test.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import HTTPErrorResponse from '../../../Types/API/HTTPErrorResponse';
|
||||
|
||||
describe('HTTPErrorResponse', () => {
|
||||
it('should return an empty string when data is null', () => {
|
||||
const httpResponse: HTTPErrorResponse = new HTTPErrorResponse(
|
||||
404,
|
||||
{ data: null },
|
||||
{}
|
||||
);
|
||||
expect(httpResponse.message).toBe('');
|
||||
});
|
||||
|
||||
it('should return the message from the "data" property if present', () => {
|
||||
const httpResponse: HTTPErrorResponse = new HTTPErrorResponse(
|
||||
200,
|
||||
{ data: 'Data message' },
|
||||
{}
|
||||
);
|
||||
expect(httpResponse.message).toBe('Data message');
|
||||
});
|
||||
|
||||
it('should return the message from the "message" property if present', () => {
|
||||
const httpResponse: HTTPErrorResponse = new HTTPErrorResponse(
|
||||
200,
|
||||
{ message: 'Message message' },
|
||||
{}
|
||||
);
|
||||
expect(httpResponse.message).toBe('Message message');
|
||||
});
|
||||
|
||||
it('should return the message from the "error" property if no other message properties are present', () => {
|
||||
const httpResponse: HTTPErrorResponse = new HTTPErrorResponse(
|
||||
500,
|
||||
{ error: 'Error message' },
|
||||
{}
|
||||
);
|
||||
expect(httpResponse.message).toBe('Error message');
|
||||
});
|
||||
|
||||
it('should return an empty string when no relevant message properties are present', () => {
|
||||
const httpResponse: HTTPErrorResponse = new HTTPErrorResponse(
|
||||
204,
|
||||
{ otherProperty: 'Other message' },
|
||||
{}
|
||||
);
|
||||
expect(httpResponse.message).toBe('');
|
||||
});
|
||||
|
||||
it('should prioritize "data" > "message" > "error" when multiple message properties are present', () => {
|
||||
const httpResponse: HTTPErrorResponse = new HTTPErrorResponse(
|
||||
201,
|
||||
{
|
||||
data: 'Data message',
|
||||
message: 'Message message',
|
||||
error: 'Error message',
|
||||
},
|
||||
{}
|
||||
);
|
||||
expect(httpResponse.message).toBe('Data message');
|
||||
});
|
||||
});
|
||||
82
Common/Tests/Types/Database/Date.test.ts
Normal file
82
Common/Tests/Types/Database/Date.test.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
import DatabaseDate from '../../../Types/Database/Date';
|
||||
import moment from 'moment';
|
||||
import InBetween from '../../../Types/Database/InBetween';
|
||||
import { JSONObject } from '../../../Types/JSON';
|
||||
|
||||
describe('DatabaseDate', () => {
|
||||
describe('asDateStartOfTheDayEndOfTheDayForDatabaseQuery', () => {
|
||||
it('should return InBetween object for a valid Date input', () => {
|
||||
const inputDate: Date = new Date('2023-10-24T12:00:00Z');
|
||||
const result: JSONObject =
|
||||
DatabaseDate.asDateStartOfTheDayEndOfTheDayForDatabaseQuery(
|
||||
inputDate
|
||||
).toJSON();
|
||||
|
||||
const expectedStart: string = moment(inputDate)
|
||||
.startOf('day')
|
||||
.format('YYYY-MM-DD HH:mm:ss');
|
||||
const expectedEnd: string = moment(inputDate)
|
||||
.endOf('day')
|
||||
.format('YYYY-MM-DD HH:mm:ss');
|
||||
expect(result).toEqual({
|
||||
startValue: expectedStart,
|
||||
endValue: expectedEnd,
|
||||
_type: 'InBetween',
|
||||
});
|
||||
});
|
||||
|
||||
it('should return InBetween object for a valid Date string input', () => {
|
||||
const inputDate: string = '2023-10-24T12:00:00Z';
|
||||
const result: JSONObject =
|
||||
DatabaseDate.asDateStartOfTheDayEndOfTheDayForDatabaseQuery(
|
||||
inputDate
|
||||
).toJSON();
|
||||
const expectedStart: string = moment(inputDate)
|
||||
.startOf('day')
|
||||
.format('YYYY-MM-DD HH:mm:ss');
|
||||
const expectedEnd: string = moment(inputDate)
|
||||
.endOf('day')
|
||||
.format('YYYY-MM-DD HH:mm:ss');
|
||||
expect(result).toEqual({
|
||||
startValue: expectedStart,
|
||||
endValue: expectedEnd,
|
||||
_type: 'InBetween',
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle invalid date string gracefully', () => {
|
||||
const inputDate: string = 'invalid-date';
|
||||
const result: JSONObject =
|
||||
DatabaseDate.asDateStartOfTheDayEndOfTheDayForDatabaseQuery(
|
||||
inputDate
|
||||
).toJSON();
|
||||
expect(result).toEqual({
|
||||
startValue: 'Invalid date',
|
||||
endValue: 'Invalid date',
|
||||
_type: 'InBetween',
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle empty string input gracefully', () => {
|
||||
const inputDate: string = '';
|
||||
const result: JSONObject =
|
||||
DatabaseDate.asDateStartOfTheDayEndOfTheDayForDatabaseQuery(
|
||||
inputDate
|
||||
).toJSON();
|
||||
expect(result).toEqual({
|
||||
startValue: 'Invalid date',
|
||||
endValue: 'Invalid date',
|
||||
_type: 'InBetween',
|
||||
});
|
||||
});
|
||||
|
||||
it('should be a type of InBetween', () => {
|
||||
const inputDate: string = '2023-10-24T12:00:00Z';
|
||||
const result: InBetween =
|
||||
DatabaseDate.asDateStartOfTheDayEndOfTheDayForDatabaseQuery(
|
||||
inputDate
|
||||
);
|
||||
expect(result).toBeInstanceOf(InBetween);
|
||||
});
|
||||
});
|
||||
});
|
||||
70
Common/Tests/Types/Database/EqualToOrNull.test.ts
Normal file
70
Common/Tests/Types/Database/EqualToOrNull.test.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import EqualToOrNull from '../../../Types/Database/EqualToOrNull';
|
||||
import BadDataException from '../../../Types/Exception/BadDataException';
|
||||
import { JSONObject } from '../../../Types/JSON';
|
||||
|
||||
describe('EqualToOrNull', () => {
|
||||
it('should create an EqualToOrNull object with a valid value', () => {
|
||||
const value: string = 'oneuptime';
|
||||
const equalObj: EqualToOrNull = new EqualToOrNull(value);
|
||||
expect(equalObj.value).toBe(value);
|
||||
});
|
||||
|
||||
it('should get the value property of an EqualToOrNull object', () => {
|
||||
const value: string = 'oneuptime';
|
||||
const equalObj: EqualToOrNull = new EqualToOrNull(value);
|
||||
expect(equalObj.value).toBe(value);
|
||||
});
|
||||
|
||||
it('should set the value property of an EqualToOrNull object', () => {
|
||||
const equalObj: EqualToOrNull = new EqualToOrNull('oldValue');
|
||||
equalObj.value = 'newValue';
|
||||
expect(equalObj.value).toBe('newValue');
|
||||
});
|
||||
|
||||
it('should return the correct string representation using toString method', () => {
|
||||
const equalObj: EqualToOrNull = new EqualToOrNull('oneuptime');
|
||||
expect(equalObj.toString()).toBe('oneuptime');
|
||||
});
|
||||
|
||||
it('should generate the correct JSON representation using toJSON method', () => {
|
||||
const equalObj: EqualToOrNull = new EqualToOrNull('oneuptime');
|
||||
const expectedJSON: JSONObject = {
|
||||
_type: 'EqualToOrNull',
|
||||
value: 'oneuptime',
|
||||
};
|
||||
expect(equalObj.toJSON()).toEqual(expectedJSON);
|
||||
});
|
||||
|
||||
it('should create an EqualToOrNull object from valid JSON input', () => {
|
||||
const jsonInput: JSONObject = {
|
||||
_type: 'EqualToOrNull',
|
||||
value: 'oneuptime',
|
||||
};
|
||||
const equalObj: EqualToOrNull = EqualToOrNull.fromJSON(jsonInput);
|
||||
expect(equalObj.value).toBe('oneuptime');
|
||||
});
|
||||
|
||||
it('should throw a BadDataException when using invalid JSON input', () => {
|
||||
const jsonInput: JSONObject = {
|
||||
_type: 'InvalidType',
|
||||
value: 'oneuptime',
|
||||
};
|
||||
expect(() => {
|
||||
return EqualToOrNull.fromJSON(jsonInput);
|
||||
}).toThrow(BadDataException);
|
||||
});
|
||||
|
||||
it('should be a type of EqualToOrNull', () => {
|
||||
const equalObj: EqualToOrNull = new EqualToOrNull('oneuptime');
|
||||
expect(equalObj).toBeInstanceOf(EqualToOrNull);
|
||||
});
|
||||
|
||||
it('should handle null value when using fromJSON method', () => {
|
||||
const jsonInput: JSONObject = {
|
||||
_type: 'EqualToOrNull',
|
||||
value: null,
|
||||
};
|
||||
const equalObj: EqualToOrNull = EqualToOrNull.fromJSON(jsonInput);
|
||||
expect(equalObj.value).toBeNull();
|
||||
});
|
||||
});
|
||||
80
Common/Tests/Types/Database/InBetween.test.ts
Normal file
80
Common/Tests/Types/Database/InBetween.test.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import InBetween from '../../../Types/Database/InBetween';
|
||||
import BadDataException from '../../../Types/Exception/BadDataException';
|
||||
import { JSONObject } from '../../../Types/JSON';
|
||||
|
||||
describe('InBetween', () => {
|
||||
it('should create an InBetween object with valid start and end values', () => {
|
||||
const startValue: number = 10;
|
||||
const endValue: number = 20;
|
||||
const betweenObj: InBetween = new InBetween(startValue, endValue);
|
||||
expect(betweenObj.startValue).toBe(10);
|
||||
expect(betweenObj.endValue).toBe(20);
|
||||
});
|
||||
|
||||
it('should generate the correct JSON representation using toJSON method', () => {
|
||||
const startValue: number = 10;
|
||||
const endValue: number = 20;
|
||||
const betweenObj: InBetween = new InBetween(startValue, endValue);
|
||||
const expectedJSON: JSONObject = {
|
||||
_type: 'InBetween',
|
||||
startValue: 10,
|
||||
endValue: 20,
|
||||
};
|
||||
expect(betweenObj.toJSON()).toEqual(expectedJSON);
|
||||
});
|
||||
|
||||
it('should create an InBetween object from valid JSON input', () => {
|
||||
const jsonInput: JSONObject = {
|
||||
_type: 'InBetween',
|
||||
startValue: 10,
|
||||
endValue: 20,
|
||||
};
|
||||
const betweenObj: InBetween = InBetween.fromJSON(jsonInput);
|
||||
expect(betweenObj.startValue).toBe(10);
|
||||
expect(betweenObj.endValue).toBe(20);
|
||||
});
|
||||
|
||||
it('should throw a BadDataException when using invalid JSON input', () => {
|
||||
const jsonInput: JSONObject = {
|
||||
_type: 'InvalidType',
|
||||
startValue: 10,
|
||||
endValue: 20,
|
||||
};
|
||||
expect(() => {
|
||||
return InBetween.fromJSON(jsonInput);
|
||||
}).toThrow(BadDataException);
|
||||
});
|
||||
|
||||
it('should return a string with start and end values matching', () => {
|
||||
const startValue: number = 15;
|
||||
const endValue: number = 15;
|
||||
const betweenObj: InBetween = new InBetween(startValue, endValue);
|
||||
expect(betweenObj.toString()).toBe('15');
|
||||
});
|
||||
|
||||
it('should return a string with start and end values different', () => {
|
||||
const startValue: number = 10;
|
||||
const endValue: number = 20;
|
||||
const betweenObj: InBetween = new InBetween(startValue, endValue);
|
||||
expect(betweenObj.toString()).toBe('10 - 20');
|
||||
});
|
||||
|
||||
it('should return the start value as a string', () => {
|
||||
const startValue: number = 10;
|
||||
const endValue: number = 20;
|
||||
const betweenObj: InBetween = new InBetween(startValue, endValue);
|
||||
expect(betweenObj.toStartValueString()).toBe('10');
|
||||
});
|
||||
|
||||
it('should return the end value as a string', () => {
|
||||
const startValue: number = 10;
|
||||
const endValue: number = 20;
|
||||
const betweenObj: InBetween = new InBetween(startValue, endValue);
|
||||
expect(betweenObj.toEndValueString()).toBe('20');
|
||||
});
|
||||
|
||||
it('should be a type of InBetween', () => {
|
||||
const inBetweenObj: InBetween = new InBetween(10, 15);
|
||||
expect(inBetweenObj).toBeInstanceOf(InBetween);
|
||||
});
|
||||
});
|
||||
@@ -349,6 +349,10 @@ const httpMethodTests: Array<HTTPMethodType> = [
|
||||
name: 'delete',
|
||||
method: HTTPMethod.DELETE,
|
||||
},
|
||||
{
|
||||
name: 'head',
|
||||
method: HTTPMethod.HEAD,
|
||||
},
|
||||
];
|
||||
|
||||
describe.each(httpMethodTests)('$name', ({ name, method }: HTTPMethodType) => {
|
||||
|
||||
85
Common/Tests/Utils/Analytics.test.ts
Normal file
85
Common/Tests/Utils/Analytics.test.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
import Analytics from '../../Utils/Analytics';
|
||||
import Email from '../../Types/Email';
|
||||
import { JSONObject } from '../../Types/JSON';
|
||||
import posthog from 'posthog-js';
|
||||
|
||||
jest.mock('posthog-js', () => {
|
||||
return {
|
||||
init: jest.fn(),
|
||||
identify: jest.fn(),
|
||||
reset: jest.fn(),
|
||||
capture: jest.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
const apiHost: string = 'https://example.com';
|
||||
const apiKey: string = 'your-api-key';
|
||||
|
||||
describe('Analytics Class', () => {
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should initialize the Analytics class', () => {
|
||||
const analytics: Analytics = new Analytics(apiHost, apiKey);
|
||||
|
||||
expect(posthog.init).toHaveBeenCalledWith(apiKey, {
|
||||
api_host: apiHost,
|
||||
autocapture: false,
|
||||
});
|
||||
expect(analytics.isInitialized).toBe(true);
|
||||
});
|
||||
|
||||
it('should not initialize if apiHost and apiKey are not provided', () => {
|
||||
const analytics: Analytics = new Analytics('', '');
|
||||
|
||||
expect(posthog.init).not.toHaveBeenCalled();
|
||||
expect(analytics.isInitialized).toBe(false);
|
||||
});
|
||||
|
||||
it('should authenticate a user', () => {
|
||||
const analytics: Analytics = new Analytics(apiHost, apiKey);
|
||||
const email: Email = new Email('test@example.com');
|
||||
|
||||
analytics.userAuth(email);
|
||||
expect(posthog.identify).toHaveBeenCalledWith(email.toString());
|
||||
});
|
||||
|
||||
it('should not authenticate a user if not initialized', () => {
|
||||
const analytics: Analytics = new Analytics('', '');
|
||||
const email: Email = new Email('test@example.com');
|
||||
|
||||
analytics.userAuth(email);
|
||||
expect(posthog.identify).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reset the user session on logout', () => {
|
||||
const analytics: Analytics = new Analytics(apiHost, apiKey);
|
||||
|
||||
analytics.logout();
|
||||
expect(posthog.reset).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not reset the user session if not initialized', () => {
|
||||
const analytics: Analytics = new Analytics('', '');
|
||||
|
||||
analytics.logout();
|
||||
expect(posthog.reset).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should capture an event with optional data', () => {
|
||||
const analytics: Analytics = new Analytics(apiHost, apiKey);
|
||||
const eventName: string = 'testEvent';
|
||||
const data: JSONObject = { key: 'value' };
|
||||
|
||||
analytics.capture(eventName, data);
|
||||
expect(posthog.capture).toHaveBeenCalledWith(eventName, data);
|
||||
});
|
||||
|
||||
it('should not capture an event if not initialized', () => {
|
||||
const analytics: Analytics = new Analytics('', '');
|
||||
|
||||
analytics.capture('testEvent');
|
||||
expect(posthog.capture).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
34
Common/Tests/Utils/CronTime.test.ts
Normal file
34
Common/Tests/Utils/CronTime.test.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import {
|
||||
EVERY_MINUTE,
|
||||
EVERY_DAY,
|
||||
EVERY_HOUR,
|
||||
EVERY_FIVE_MINUTE,
|
||||
EVERY_FIVE_SECONDS,
|
||||
EVERY_WEEK,
|
||||
} from '../../Utils/CronTime';
|
||||
|
||||
describe('CronTime', () => {
|
||||
test('should return every minute', () => {
|
||||
expect(EVERY_MINUTE).toEqual('* * * * *');
|
||||
});
|
||||
|
||||
test('should return every day', () => {
|
||||
expect(EVERY_DAY).toEqual('0 8 * * *');
|
||||
});
|
||||
|
||||
test('should return every hour', () => {
|
||||
expect(EVERY_HOUR).toEqual('1 * * * *');
|
||||
});
|
||||
|
||||
test('should return every five minute', () => {
|
||||
expect(EVERY_FIVE_MINUTE).toEqual('*/5 * * * *');
|
||||
});
|
||||
|
||||
test('should return every five seconds', () => {
|
||||
expect(EVERY_FIVE_SECONDS).toEqual('*/5 * * * * *');
|
||||
});
|
||||
|
||||
test('should return every week', () => {
|
||||
expect(EVERY_WEEK).toEqual('0 0 * * 0');
|
||||
});
|
||||
});
|
||||
38
Common/Tests/Utils/Faker.test.ts
Normal file
38
Common/Tests/Utils/Faker.test.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import Faker from '../../Utils/Faker';
|
||||
import Email from '../../Types/Email';
|
||||
import Name from '../../Types/Name';
|
||||
import Phone from '../../Types/Phone';
|
||||
|
||||
describe('Faker Class', () => {
|
||||
it('should generate a random name with alphanumeric characters', () => {
|
||||
expect(Faker.generateName()).toMatch(/^[a-zA-Z0-9]{10}$/);
|
||||
});
|
||||
|
||||
it('should generate a random company name', () => {
|
||||
expect(Faker.generateCompanyName()).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should generate a string of random numbers of specified length', () => {
|
||||
expect(Faker.randomNumbers(8)).toMatch(/^\d{8}$/);
|
||||
});
|
||||
|
||||
it('should generate a user full name', () => {
|
||||
const userFullName: Name = Faker.generateUserFullName();
|
||||
expect(userFullName).toHaveProperty('name');
|
||||
expect(userFullName.name).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should generate a valid email address', () => {
|
||||
const email: Email = Faker.generateEmail();
|
||||
expect(email.email).toMatch(
|
||||
/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,9}$/i
|
||||
);
|
||||
});
|
||||
|
||||
it('should generate a valid phone number', () => {
|
||||
const phone: Phone = Faker.generatePhone();
|
||||
expect(phone.phone).toMatch(
|
||||
/^[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4,7}$/
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,9 +1,12 @@
|
||||
import Slug from '../../Utils/Slug';
|
||||
describe('Slug.getSlug()', () => {
|
||||
test('should return empty string, if name is empty ', () => {
|
||||
test('should return empty string, if name is empty ', () => {
|
||||
expect(Slug.getSlug('')).toEqual('');
|
||||
expect(Slug.getSlug(' ')).toEqual('');
|
||||
});
|
||||
test('should generate a slug from a valid name when name is null', () => {
|
||||
expect(Slug.getSlug(null)).toMatch(/^[a-z0-9-]+$/);
|
||||
});
|
||||
test('should replaces spaces in nonEmpty with hyphen -', () => {
|
||||
expect(Slug.getSlug('this is slug')).toMatch(/this-is-slug/g);
|
||||
});
|
||||
|
||||
@@ -20,6 +20,8 @@ export default class Hostname extends DatabaseProperty {
|
||||
}
|
||||
|
||||
public set hostname(value: string) {
|
||||
value = value.trim();
|
||||
|
||||
if (Hostname.isValid(value)) {
|
||||
this._route = value;
|
||||
} else {
|
||||
|
||||
@@ -209,7 +209,15 @@ export default class URL extends DatabaseProperty {
|
||||
return this;
|
||||
}
|
||||
|
||||
public addQueryParam(paramName: string, value: string): URL {
|
||||
public addQueryParam(
|
||||
paramName: string,
|
||||
value: string,
|
||||
encode?: boolean | undefined
|
||||
): URL {
|
||||
if (encode) {
|
||||
value = encodeURIComponent(value);
|
||||
}
|
||||
|
||||
this.params[paramName] = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import TableColumnType from '../BaseDatabase/TableColumnType';
|
||||
import { ColumnAccessControl } from '../BaseDatabase/AccessControl';
|
||||
import ColumnBillingAccessControl from '../BaseDatabase/ColumnBillingAccessControl';
|
||||
import TableColumnType from '../AnalyticsDatabase/TableColumnType';
|
||||
import { JSONValue } from '../JSON';
|
||||
import NestedModel from '../../AnalyticsModels/NestedModel';
|
||||
|
||||
export default class AnalyticsTableColumn {
|
||||
private _key: string = 'id';
|
||||
|
||||
public get key(): string {
|
||||
return this._key;
|
||||
}
|
||||
@@ -33,7 +38,15 @@ export default class AnalyticsTableColumn {
|
||||
this._required = v;
|
||||
}
|
||||
|
||||
private _type: TableColumnType = TableColumnType.ShortText;
|
||||
private _isTenantId: boolean = false;
|
||||
public get isTenantId(): boolean {
|
||||
return this._isTenantId;
|
||||
}
|
||||
public set isTenantId(v: boolean) {
|
||||
this._isTenantId = v;
|
||||
}
|
||||
|
||||
private _type: TableColumnType = TableColumnType.Text;
|
||||
public get type(): TableColumnType {
|
||||
return this._type;
|
||||
}
|
||||
@@ -41,17 +54,96 @@ export default class AnalyticsTableColumn {
|
||||
this._type = v;
|
||||
}
|
||||
|
||||
private _forceGetDefaultValueOnCreate?:
|
||||
| (() => Date | string | number | boolean)
|
||||
| undefined;
|
||||
public get forceGetDefaultValueOnCreate():
|
||||
| (() => Date | string | number | boolean)
|
||||
| undefined {
|
||||
return this._forceGetDefaultValueOnCreate;
|
||||
}
|
||||
public set forceGetDefaultValueOnCreate(
|
||||
v: (() => Date | string | number | boolean) | undefined
|
||||
) {
|
||||
this._forceGetDefaultValueOnCreate = v;
|
||||
}
|
||||
|
||||
private _defaultValue: JSONValue | undefined;
|
||||
public get defaultValue(): JSONValue {
|
||||
return this._defaultValue;
|
||||
}
|
||||
public set defaultValue(v: JSONValue) {
|
||||
this._defaultValue = v;
|
||||
}
|
||||
|
||||
public get isDefaultValueColumn(): boolean {
|
||||
return Boolean(this.defaultValue !== undefined);
|
||||
}
|
||||
|
||||
private _billingAccessControl?: ColumnBillingAccessControl | undefined;
|
||||
public get billingAccessControl(): ColumnBillingAccessControl | undefined {
|
||||
return this._billingAccessControl;
|
||||
}
|
||||
public set billingAccessControl(v: ColumnBillingAccessControl | undefined) {
|
||||
this._billingAccessControl = v;
|
||||
}
|
||||
|
||||
private _allowAccessIfSubscriptionIsUnpaid: boolean = false;
|
||||
public get allowAccessIfSubscriptionIsUnpaid(): boolean {
|
||||
return this._allowAccessIfSubscriptionIsUnpaid;
|
||||
}
|
||||
public set allowAccessIfSubscriptionIsUnpaid(v: boolean) {
|
||||
this._allowAccessIfSubscriptionIsUnpaid = v;
|
||||
}
|
||||
|
||||
private _accessControl: ColumnAccessControl | undefined;
|
||||
public get accessControl(): ColumnAccessControl | undefined {
|
||||
return this._accessControl;
|
||||
}
|
||||
public set accessControl(v: ColumnAccessControl | undefined) {
|
||||
this._accessControl = v;
|
||||
}
|
||||
|
||||
private _nestedModel?: NestedModel | undefined;
|
||||
public get nestedModel(): NestedModel | undefined {
|
||||
return this._nestedModel;
|
||||
}
|
||||
public set nestedModel(v: NestedModel | undefined) {
|
||||
this._nestedModel = v;
|
||||
}
|
||||
|
||||
public constructor(data: {
|
||||
key: string;
|
||||
nestedModel?: NestedModel | undefined;
|
||||
title: string;
|
||||
description: string;
|
||||
required: boolean;
|
||||
defaultValue?: JSONValue | undefined;
|
||||
type: TableColumnType;
|
||||
billingAccessControl?: ColumnBillingAccessControl | undefined;
|
||||
isTenantId?: boolean | undefined;
|
||||
accessControl?: ColumnAccessControl | undefined;
|
||||
allowAccessIfSubscriptionIsUnpaid?: boolean | undefined;
|
||||
forceGetDefaultValueOnCreate?:
|
||||
| (() => Date | string | number | boolean)
|
||||
| undefined;
|
||||
}) {
|
||||
if (data.type === TableColumnType.NestedModel && !data.nestedModel) {
|
||||
throw new Error('NestedModel is required when type is NestedModel');
|
||||
}
|
||||
|
||||
this.accessControl = data.accessControl;
|
||||
this.key = data.key;
|
||||
this.title = data.title;
|
||||
this.description = data.description;
|
||||
this.required = data.required;
|
||||
this.type = data.type;
|
||||
this.isTenantId = data.isTenantId || false;
|
||||
this.forceGetDefaultValueOnCreate = data.forceGetDefaultValueOnCreate;
|
||||
this.defaultValue = data.defaultValue;
|
||||
this.billingAccessControl = data.billingAccessControl;
|
||||
this.allowAccessIfSubscriptionIsUnpaid =
|
||||
data.allowAccessIfSubscriptionIsUnpaid || false;
|
||||
this.nestedModel = data.nestedModel;
|
||||
}
|
||||
}
|
||||
|
||||
15
Common/Types/AnalyticsDatabase/TableColumnType.ts
Normal file
15
Common/Types/AnalyticsDatabase/TableColumnType.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
enum ColumnType {
|
||||
ObjectID = 'Object ID',
|
||||
Date = 'Date',
|
||||
Boolean = 'Boolean',
|
||||
Number = 'Number',
|
||||
Text = 'Text',
|
||||
NestedModel = 'Nested Model',
|
||||
JSON = 'JSON',
|
||||
Decimal = 'Decimal',
|
||||
ArrayNumber = 'Array of Numbers',
|
||||
ArrayText = 'Array of Text',
|
||||
LongNumber = 'Long Number',
|
||||
}
|
||||
|
||||
export default ColumnType;
|
||||
11
Common/Types/BaseDatabase/AccessControl.ts
Normal file
11
Common/Types/BaseDatabase/AccessControl.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import Permission from '../Permission';
|
||||
|
||||
export interface ColumnAccessControl {
|
||||
read: Array<Permission>;
|
||||
create: Array<Permission>;
|
||||
update: Array<Permission>;
|
||||
}
|
||||
|
||||
export interface TableAccessControl extends ColumnAccessControl {
|
||||
delete: Array<Permission>;
|
||||
}
|
||||
7
Common/Types/BaseDatabase/ColumnBillingAccessControl.ts
Normal file
7
Common/Types/BaseDatabase/ColumnBillingAccessControl.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { PlanSelect } from '../Billing/SubscriptionPlan';
|
||||
|
||||
export default interface ColumnBillingAccessControl {
|
||||
create: PlanSelect;
|
||||
read: PlanSelect;
|
||||
update: PlanSelect;
|
||||
}
|
||||
@@ -20,4 +20,5 @@ export default interface DatabaseCommonInteractionProps {
|
||||
ignoreHooks?: boolean | undefined;
|
||||
currentPlan?: PlanSelect | undefined;
|
||||
isSubscriptionUnpaid?: boolean | undefined;
|
||||
isMasterAdmin?: boolean | undefined;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import Permission, { UserPermission } from '../Permission';
|
||||
import DatabaseCommonInteractionProps from './DatabaseCommonInteractionProps';
|
||||
|
||||
export default class DatabaseCommonInteractionPropsUtil {
|
||||
public static getUserPermissions(
|
||||
props: DatabaseCommonInteractionProps
|
||||
): Array<UserPermission> {
|
||||
// Check first if the user has Global Permissions.
|
||||
// Global permissions includes all the tenantId user has access to.
|
||||
// and it includes all the global permissions that applies to all the tenant, like PUBLIC.
|
||||
if (!props.userGlobalAccessPermission) {
|
||||
props.userGlobalAccessPermission = {
|
||||
globalPermissions: [Permission.Public],
|
||||
projectIds: [],
|
||||
_type: 'UserGlobalAccessPermission',
|
||||
};
|
||||
}
|
||||
|
||||
// If the PUBLIC Permission is not found in global permissions, include it.
|
||||
if (
|
||||
props.userGlobalAccessPermission &&
|
||||
!props.userGlobalAccessPermission.globalPermissions.includes(
|
||||
Permission.Public
|
||||
)
|
||||
) {
|
||||
props.userGlobalAccessPermission.globalPermissions.push(
|
||||
Permission.Public
|
||||
); // add public permission if not already.
|
||||
}
|
||||
|
||||
// If the CurrentUser Permission is not found in global permissions, include it.
|
||||
if (
|
||||
props.userId &&
|
||||
props.userGlobalAccessPermission &&
|
||||
!props.userGlobalAccessPermission.globalPermissions.includes(
|
||||
Permission.CurrentUser
|
||||
)
|
||||
) {
|
||||
props.userGlobalAccessPermission.globalPermissions.push(
|
||||
Permission.CurrentUser
|
||||
);
|
||||
}
|
||||
|
||||
let userPermissions: Array<UserPermission> = [];
|
||||
|
||||
// Include global permission in userPermissions.
|
||||
|
||||
if (props.userGlobalAccessPermission) {
|
||||
/// take global permissions.
|
||||
userPermissions =
|
||||
props.userGlobalAccessPermission.globalPermissions.map(
|
||||
(permission: Permission) => {
|
||||
return {
|
||||
permission: permission,
|
||||
labelIds: [],
|
||||
_type: 'UserPermission',
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (props.tenantId && props.userTenantAccessPermission) {
|
||||
// Include Tenant Permission in userPermissions.
|
||||
userPermissions = [
|
||||
...userPermissions,
|
||||
...(props.userTenantAccessPermission[props.tenantId.toString()]
|
||||
?.permissions || []),
|
||||
];
|
||||
}
|
||||
|
||||
return userPermissions;
|
||||
}
|
||||
}
|
||||
6
Common/Types/BaseDatabase/EnableWorkflowOn.ts
Normal file
6
Common/Types/BaseDatabase/EnableWorkflowOn.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export default interface EnableWorkflowOn {
|
||||
create?: boolean | undefined;
|
||||
update?: boolean | undefined;
|
||||
delete?: boolean | undefined;
|
||||
read?: boolean | undefined;
|
||||
}
|
||||
8
Common/Types/BaseDatabase/TableBillingAccessControl.ts
Normal file
8
Common/Types/BaseDatabase/TableBillingAccessControl.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { PlanSelect } from '../Billing/SubscriptionPlan';
|
||||
|
||||
export default interface TableBillingAccessControl {
|
||||
create: PlanSelect;
|
||||
read: PlanSelect;
|
||||
update: PlanSelect;
|
||||
delete: PlanSelect;
|
||||
}
|
||||
@@ -28,3 +28,12 @@ export interface CallRequestMessage {
|
||||
export default interface CallRequest extends CallRequestMessage {
|
||||
to: Phone;
|
||||
}
|
||||
|
||||
export const isHighRiskPhoneNumber: Function = (phoneNumber: Phone): boolean => {
|
||||
// Pakistan
|
||||
if (phoneNumber.toString().startsWith('+92')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import { PlanSelect } from '../../Billing/SubscriptionPlan';
|
||||
import Permission from '../../Permission';
|
||||
|
||||
export interface ColumnAccessControl {
|
||||
read: Array<Permission>;
|
||||
create: Array<Permission>;
|
||||
update: Array<Permission>;
|
||||
}
|
||||
|
||||
export interface TableAccessControl extends ColumnAccessControl {
|
||||
delete: Array<Permission>;
|
||||
}
|
||||
|
||||
export interface BillingAccessControl {
|
||||
create: PlanSelect;
|
||||
read: PlanSelect;
|
||||
update: PlanSelect;
|
||||
delete: PlanSelect;
|
||||
}
|
||||
|
||||
export interface ColumnBillingAccessControl {
|
||||
create: PlanSelect;
|
||||
read: PlanSelect;
|
||||
update: PlanSelect;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import 'reflect-metadata';
|
||||
import BaseModel from '../../../Models/BaseModel';
|
||||
import Dictionary from '../../Dictionary';
|
||||
import { ReflectionMetadataType } from '../../Reflection';
|
||||
import { ColumnAccessControl } from './AccessControl';
|
||||
import { ColumnAccessControl } from '../../BaseDatabase/AccessControl';
|
||||
|
||||
const accessControlSymbol: Symbol = Symbol('ColumnAccessControl');
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'reflect-metadata';
|
||||
import BaseModel from '../../../Models/BaseModel';
|
||||
import Dictionary from '../../Dictionary';
|
||||
import { ReflectionMetadataType } from '../../Reflection';
|
||||
import { ColumnBillingAccessControl } from './AccessControl';
|
||||
import ColumnBillingAccessControl from '../../BaseDatabase/ColumnBillingAccessControl';
|
||||
|
||||
const accessControlSymbol: Symbol = Symbol('ColumnBillingAccessControl');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TableAccessControl } from './AccessControl';
|
||||
import { TableAccessControl } from '../../BaseDatabase/AccessControl';
|
||||
|
||||
export default (accessControl: TableAccessControl) => {
|
||||
return (ctr: Function) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BillingAccessControl } from './AccessControl';
|
||||
import TableBillingAccessControl from '../../BaseDatabase/TableBillingAccessControl';
|
||||
|
||||
export default (accessControl: BillingAccessControl) => {
|
||||
export default (accessControl: TableBillingAccessControl) => {
|
||||
return (ctr: Function) => {
|
||||
if (accessControl.create) {
|
||||
ctr.prototype.createBillingPlan = accessControl.create;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import TableColumnType from '../BaseDatabase/TableColumnType';
|
||||
import TableColumnType from './TableColumnType';
|
||||
|
||||
enum ColumnLength {
|
||||
Version = 30,
|
||||
|
||||
11
Common/Types/Database/EnableDocumentation.ts
Normal file
11
Common/Types/Database/EnableDocumentation.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export interface EnableDocumentationProps {
|
||||
isMasterAdminApiDocs?: boolean | undefined;
|
||||
}
|
||||
|
||||
export default (props?: EnableDocumentationProps | undefined) => {
|
||||
return (ctr: Function) => {
|
||||
ctr.prototype.enableDocumentation = true;
|
||||
ctr.prototype.isMasterAdminApiDocs =
|
||||
props?.isMasterAdminApiDocs || false;
|
||||
};
|
||||
};
|
||||
7
Common/Types/Database/EnableWorkflow.ts
Normal file
7
Common/Types/Database/EnableWorkflow.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import EnableWorkflowOn from '../BaseDatabase/EnableWorkflowOn';
|
||||
|
||||
export default (enableWorkflowOn: EnableWorkflowOn) => {
|
||||
return (ctr: Function) => {
|
||||
ctr.prototype.enableWorkflowOn = enableWorkflowOn;
|
||||
};
|
||||
};
|
||||
@@ -1,5 +1,4 @@
|
||||
const LIMIT_MAX: number = 10000;
|
||||
|
||||
export const LIMIT_PER_PROJECT: number = 300;
|
||||
|
||||
export const DEFAULT_LIMIT: number = 10;
|
||||
export default LIMIT_MAX;
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'reflect-metadata';
|
||||
import BaseModel from '../../Models/BaseModel';
|
||||
import Dictionary from '../Dictionary';
|
||||
import { ReflectionMetadataType } from '../Reflection';
|
||||
import TableColumnType from '../BaseDatabase/TableColumnType';
|
||||
import TableColumnType from './TableColumnType';
|
||||
|
||||
const tableColumn: Symbol = Symbol('TableColumn');
|
||||
|
||||
|
||||
@@ -29,6 +29,10 @@ export default class OneUptimeDate {
|
||||
return this.getSomeDaysAgo(new PositiveNumber(1));
|
||||
}
|
||||
|
||||
public static fromUnixNano(timestamp: number): Date {
|
||||
return moment(timestamp / 1000000).toDate();
|
||||
}
|
||||
|
||||
public static getSecondsTo(date: Date): number {
|
||||
date = this.fromString(date);
|
||||
const dif: number = date.getTime() - this.getCurrentDate().getTime();
|
||||
@@ -98,6 +102,10 @@ export default class OneUptimeDate {
|
||||
return days.positiveNumber * 24 * 60 * 60;
|
||||
}
|
||||
|
||||
public static getMillisecondsInDays(days: PositiveNumber | number): number {
|
||||
return this.getSecondsInDays(days) * 1000;
|
||||
}
|
||||
|
||||
public static getSomeHoursAgo(hours: PositiveNumber | number): Date {
|
||||
if (!(hours instanceof PositiveNumber)) {
|
||||
hours = new PositiveNumber(hours);
|
||||
|
||||
@@ -7,6 +7,7 @@ enum ExceptionCode {
|
||||
WebRequestException = 6,
|
||||
BadDataException = 400,
|
||||
BadRequestException = 400,
|
||||
UnabletoReachServerException = 415,
|
||||
ServerException = 500,
|
||||
NotAuthorizedException = 403,
|
||||
NotAuthenticatedException = 401,
|
||||
|
||||
8
Common/Types/Exception/UnableToReachServer.ts
Normal file
8
Common/Types/Exception/UnableToReachServer.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import Exception from './Exception';
|
||||
import ExceptionCode from './ExceptionCode';
|
||||
|
||||
export default class UnableToReachServer extends Exception {
|
||||
public constructor(message: string) {
|
||||
super(ExceptionCode.UnabletoReachServerException, message);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user