eitri-cli 1.20.0-beta.1 → 1.20.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bitbucket-pipelines.yml +21 -5
- package/config/dev.js +16 -16
- package/config/k8s-eitri.js +45 -40
- package/config/loc-eitri.js +19 -19
- package/config/prod-eitri.js +20 -20
- package/eitri-cli-v2/eitri-cli-v2.linux-x64-gnu.node +0 -0
- package/eitri-cli-v2/eitri-cli-v2.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
- package/src/service/LibsService.js +78 -43
package/bitbucket-pipelines.yml
CHANGED
|
@@ -50,13 +50,13 @@ pipelines:
|
|
|
50
50
|
- cp -r eitri-cli-v2/tests/fixtures/fake-workspace ~/.eitri/workspaces/workspace
|
|
51
51
|
- cd eitri-cli-v2
|
|
52
52
|
- cargo test -- --test-threads=1 --nocapture
|
|
53
|
-
- step: &
|
|
53
|
+
- step: &macOSCrossCompileArm
|
|
54
54
|
image:
|
|
55
55
|
name: 343482176926.dkr.ecr.us-east-1.amazonaws.com/eitri-base-cli-pipeline:macos
|
|
56
56
|
aws:
|
|
57
57
|
access-key: $EITRI_PROD_AWS_ACCESS_KEY_ID
|
|
58
58
|
secret-key: $EITRI_PROD_AWS_SECRET_ACCESS_KEY
|
|
59
|
-
name: "macOS cross compile"
|
|
59
|
+
name: "macOS cross compile ARM"
|
|
60
60
|
caches:
|
|
61
61
|
- node
|
|
62
62
|
script:
|
|
@@ -64,14 +64,29 @@ pipelines:
|
|
|
64
64
|
- cargo add openssl --features vendored
|
|
65
65
|
- npm install
|
|
66
66
|
- npm run build -- --target aarch64-apple-darwin
|
|
67
|
-
- npm run build -- --target x86_64-apple-darwin
|
|
68
67
|
- rm -rf target
|
|
69
68
|
- cp -r ./eitri-cli-v2.darwin-arm64.node ../eitri-cli-v2.darwin-arm64.node
|
|
69
|
+
artifacts:
|
|
70
|
+
- eitri-cli-v2.darwin-arm64.node
|
|
71
|
+
- step: &macOSCrossCompileX86_64
|
|
72
|
+
image:
|
|
73
|
+
name: 343482176926.dkr.ecr.us-east-1.amazonaws.com/eitri-base-cli-pipeline:macos
|
|
74
|
+
aws:
|
|
75
|
+
access-key: $EITRI_PROD_AWS_ACCESS_KEY_ID
|
|
76
|
+
secret-key: $EITRI_PROD_AWS_SECRET_ACCESS_KEY
|
|
77
|
+
name: "macOS cross compile x86_64"
|
|
78
|
+
caches:
|
|
79
|
+
- node
|
|
80
|
+
script:
|
|
81
|
+
- cd eitri-cli-v2
|
|
82
|
+
- cargo add openssl --features vendored
|
|
83
|
+
- npm install
|
|
84
|
+
- npm run build -- --target x86_64-apple-darwin
|
|
85
|
+
- rm -rf target
|
|
70
86
|
- cp -r ./eitri-cli-v2.darwin-x64.node ../eitri-cli-v2.darwin-x64.node
|
|
71
87
|
- cp -r ./index.d.ts ../index.d.ts
|
|
72
88
|
- cp -r ./index.js ../rust-index.js
|
|
73
89
|
artifacts:
|
|
74
|
-
- eitri-cli-v2.darwin-arm64.node
|
|
75
90
|
- eitri-cli-v2.darwin-x64.node
|
|
76
91
|
- index.d.ts
|
|
77
92
|
- rust-index.js
|
|
@@ -116,7 +131,8 @@ pipelines:
|
|
|
116
131
|
- step: *runRustTests
|
|
117
132
|
- step: *windowsCrossCompile
|
|
118
133
|
- step: *linuxCrossCompile
|
|
119
|
-
- step: *
|
|
134
|
+
- step: *macOSCrossCompileArm
|
|
135
|
+
- step: *macOSCrossCompileX86_64
|
|
120
136
|
- step:
|
|
121
137
|
name: "Generation of a new version: beta or stable."
|
|
122
138
|
caches:
|
package/config/dev.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
/* eslint-disable no-undef */
|
|
2
|
-
const HOST = "api.eitri.tech"
|
|
3
|
-
const packageJson = require("../package.json")
|
|
4
|
-
const path = require("path")
|
|
5
|
-
const FOUNDRY_CONTEXT_PATH = process.env.FOUNDRY_CONTEXT_PATH ??
|
|
2
|
+
const HOST = "api.eitri.tech"
|
|
3
|
+
const packageJson = require("../package.json")
|
|
4
|
+
const path = require("path")
|
|
5
|
+
const FOUNDRY_CONTEXT_PATH = process.env.FOUNDRY_CONTEXT_PATH ?? "foundry"
|
|
6
6
|
|
|
7
7
|
const config = {
|
|
8
8
|
userAgent: packageJson.name,
|
|
9
9
|
signup: {
|
|
10
|
-
configFilePath: `.eitri/${path
|
|
11
|
-
|
|
12
|
-
.replace(".js", ".")}conf.js`,
|
|
13
|
-
oldConfigFilePath: `.miniapp/${path
|
|
14
|
-
.basename(__filename)
|
|
15
|
-
.replace(".js", ".")}conf.js`,
|
|
10
|
+
configFilePath: `.eitri/${path.basename(__filename).replace(".js", ".")}conf.js`,
|
|
11
|
+
oldConfigFilePath: `.miniapp/${path.basename(__filename).replace(".js", ".")}conf.js`,
|
|
16
12
|
},
|
|
17
13
|
doc: {
|
|
18
14
|
createUrl: `https://admin.${HOST}/docs`,
|
|
@@ -105,13 +101,17 @@ const config = {
|
|
|
105
101
|
library: {
|
|
106
102
|
url: "https://cdn.83io.com.br/library",
|
|
107
103
|
bifrost: {
|
|
108
|
-
versions: "/eitri-bifrost/versions/index.json"
|
|
104
|
+
versions: "/eitri-bifrost/versions/index.json",
|
|
109
105
|
},
|
|
110
106
|
luminusUi: {
|
|
111
|
-
versions: "/luminus-ui/versions/index.json"
|
|
107
|
+
versions: "/luminus-ui/versions/index.json",
|
|
112
108
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
commons: {
|
|
110
|
+
versions: "/eitri-commons/versions/index.json",
|
|
111
|
+
getVersion: "/eitri-commons/assets/$VERSION_NUMBER/eitri-commons-$VERSION_NUMBER.js",
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
116
|
|
|
117
|
-
module.exports = config
|
|
117
|
+
module.exports = config
|
package/config/k8s-eitri.js
CHANGED
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
/* eslint-disable no-undef */
|
|
2
|
-
const HOST =
|
|
3
|
-
const packageJson = require(
|
|
4
|
-
const path = require(
|
|
5
|
-
const
|
|
2
|
+
const HOST = "k8s.eitri.calindra.com.br"
|
|
3
|
+
const packageJson = require("../package.json")
|
|
4
|
+
const path = require("path")
|
|
5
|
+
const { getVersion } = require("../src/cmd/version")
|
|
6
|
+
const HOST_MINIAPPS = "k8s.eitri.calindra.com.br"
|
|
6
7
|
|
|
7
8
|
const config = {
|
|
8
9
|
userAgent: packageJson.name,
|
|
9
10
|
signup: {
|
|
10
|
-
configFilePath: `.eitri/${path.basename(__filename).replace(
|
|
11
|
-
oldConfigFilePath: `.miniapp/${path.basename(__filename).replace(
|
|
11
|
+
configFilePath: `.eitri/${path.basename(__filename).replace(".js", ".")}conf.js`,
|
|
12
|
+
oldConfigFilePath: `.miniapp/${path.basename(__filename).replace(".js", ".")}conf.js`,
|
|
12
13
|
},
|
|
13
14
|
doc: {
|
|
14
|
-
createUrl: `https://admin.${HOST_MINIAPPS}/docs
|
|
15
|
+
createUrl: `https://admin.${HOST_MINIAPPS}/docs`,
|
|
15
16
|
},
|
|
16
17
|
blindGuardian: {
|
|
17
|
-
url: `https://${HOST_MINIAPPS}/blind-guardian-api
|
|
18
|
+
url: `https://${HOST_MINIAPPS}/blind-guardian-api`,
|
|
18
19
|
},
|
|
19
20
|
shareApi: {
|
|
20
21
|
url: `https://${HOST_MINIAPPS}/share-api/share`,
|
|
21
22
|
},
|
|
22
23
|
workspace: {
|
|
23
24
|
url: `https://${HOST}`,
|
|
24
|
-
basePath:
|
|
25
|
-
targetPath:
|
|
25
|
+
basePath: "workspace",
|
|
26
|
+
targetPath: "/workspace/targets",
|
|
26
27
|
target: {
|
|
27
28
|
knownTargets: [
|
|
28
29
|
{
|
|
29
30
|
default: true,
|
|
30
|
-
code:
|
|
31
|
-
description:
|
|
32
|
-
bootstrapBaseUrl: `https://${HOST}
|
|
33
|
-
}
|
|
34
|
-
]
|
|
31
|
+
code: "CALINDRA_MOBILE",
|
|
32
|
+
description: "CALINDRA_MOBILE",
|
|
33
|
+
bootstrapBaseUrl: `https://${HOST}`,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
35
36
|
},
|
|
36
37
|
apiVersion: {
|
|
37
|
-
v1Header:
|
|
38
|
-
v2Header:
|
|
38
|
+
v1Header: "application/vnd.workspace.api.v1+json",
|
|
39
|
+
v2Header: "application/vnd.workspace.api.v2+json",
|
|
39
40
|
},
|
|
40
41
|
colossus: {
|
|
41
42
|
// url: 'https://colossus.lab.calindra.com.br/colossus-api/v1',
|
|
@@ -43,44 +44,44 @@ const config = {
|
|
|
43
44
|
url: `https://${HOST}/foundry/server`,
|
|
44
45
|
|
|
45
46
|
// pasta do miniapp dentro de src
|
|
46
|
-
watchUserDir:
|
|
47
|
+
watchUserDir: "/server",
|
|
47
48
|
},
|
|
48
49
|
credentials: {
|
|
49
|
-
approvalUrlPath:
|
|
50
|
-
upsertUrlPath:
|
|
51
|
-
defaultGrantType:
|
|
50
|
+
approvalUrlPath: "workspace/credential-approval",
|
|
51
|
+
upsertUrlPath: "workspace/miniapps/:publicKey/credential",
|
|
52
|
+
defaultGrantType: "client_credentials",
|
|
52
53
|
},
|
|
53
54
|
libs: {
|
|
54
|
-
updateLibsEndpointVersion:
|
|
55
|
-
}
|
|
55
|
+
updateLibsEndpointVersion: "application/vnd.workspace.api.v2+json",
|
|
56
|
+
},
|
|
56
57
|
},
|
|
57
58
|
qrCode: {
|
|
58
|
-
url:
|
|
59
|
+
url: "https://k8s.eitri.calindra.com.br/workspace/share",
|
|
59
60
|
},
|
|
60
61
|
miniLog: {
|
|
61
62
|
url: `https://${HOST_MINIAPPS}/mini-log/rooms`,
|
|
62
|
-
path:
|
|
63
|
+
path: "/mini-log/socket.io",
|
|
63
64
|
},
|
|
64
65
|
managerApi: {
|
|
65
66
|
url: `https://${HOST_MINIAPPS}/miniapp-manager-api`,
|
|
66
67
|
invites: {
|
|
67
|
-
send:
|
|
68
|
-
slug:
|
|
69
|
-
my:
|
|
70
|
-
remove:
|
|
71
|
-
accept:
|
|
68
|
+
send: "/p/invites",
|
|
69
|
+
slug: "/p/invites/s/:slug",
|
|
70
|
+
my: "/p/myInvites",
|
|
71
|
+
remove: "/p/invites/:inviteToken",
|
|
72
|
+
accept: "/p/invites/accept",
|
|
73
|
+
},
|
|
74
|
+
miniapp: {
|
|
75
|
+
miniAppsPath: "/o/mini-apps",
|
|
72
76
|
},
|
|
73
|
-
miniapp:{
|
|
74
|
-
miniAppsPath: '/o/mini-apps',
|
|
75
|
-
}
|
|
76
77
|
},
|
|
77
78
|
workspaceManager: {
|
|
78
79
|
url: `https://${HOST_MINIAPPS}`,
|
|
79
|
-
path:
|
|
80
|
-
contextPath:
|
|
80
|
+
path: "/workspace-manager/socket.io",
|
|
81
|
+
contextPath: "/workspace-manager",
|
|
81
82
|
},
|
|
82
83
|
eitriAnalytics: {
|
|
83
|
-
url: "https://analytics.dev.eitri.calindra.com.br/analytics/event"
|
|
84
|
+
url: "https://analytics.dev.eitri.calindra.com.br/analytics/event",
|
|
84
85
|
},
|
|
85
86
|
managerFront: {
|
|
86
87
|
url: `https://console.eitri.tech`,
|
|
@@ -89,13 +90,17 @@ const config = {
|
|
|
89
90
|
library: {
|
|
90
91
|
url: "https://cdn.83io.com.br/library",
|
|
91
92
|
bifrost: {
|
|
92
|
-
versions: "/eitri-bifrost/versions/index.json"
|
|
93
|
+
versions: "/eitri-bifrost/versions/index.json",
|
|
93
94
|
},
|
|
94
95
|
luminusUi: {
|
|
95
|
-
versions: "/luminus-ui/versions/index.json"
|
|
96
|
+
versions: "/luminus-ui/versions/index.json",
|
|
97
|
+
},
|
|
98
|
+
commons: {
|
|
99
|
+
versions: "/eitri-commons/versions/index.json",
|
|
100
|
+
getVersion: "/eitri-commons/assets/$VERSION_NUMBER/eitri-commons-$VERSION_NUMBER.js",
|
|
96
101
|
},
|
|
97
|
-
}
|
|
98
|
-
}
|
|
102
|
+
},
|
|
103
|
+
},
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
module.exports = config
|
package/config/loc-eitri.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
const ipv4 = require("../src/util/ipv4")
|
|
2
|
-
const HOST = ipv4()[0]
|
|
3
|
-
const packageJson = require("../package.json")
|
|
4
|
-
const PORT = process.env.EITRI_APP_TOOLS_PORT || 3333
|
|
5
|
-
const path = require("path")
|
|
6
|
-
const HOST_EITRIAPPS = "api.eitri.tech"
|
|
7
|
-
const FOUNDRY_CONTEXT_PATH = process.env.FOUNDRY_CONTEXT_PATH ??
|
|
1
|
+
const ipv4 = require("../src/util/ipv4")
|
|
2
|
+
const HOST = ipv4()[0]
|
|
3
|
+
const packageJson = require("../package.json")
|
|
4
|
+
const PORT = process.env.EITRI_APP_TOOLS_PORT || 3333
|
|
5
|
+
const path = require("path")
|
|
6
|
+
const HOST_EITRIAPPS = "api.eitri.tech"
|
|
7
|
+
const FOUNDRY_CONTEXT_PATH = process.env.FOUNDRY_CONTEXT_PATH ?? "runes-foundry"
|
|
8
8
|
|
|
9
9
|
const config = {
|
|
10
10
|
userAgent: packageJson.name,
|
|
11
11
|
signup: {
|
|
12
|
-
configFilePath: `.eitri/${path
|
|
13
|
-
|
|
14
|
-
.replace(".js", ".")}conf.js`,
|
|
15
|
-
oldConfigFilePath: `.miniapp/${path
|
|
16
|
-
.basename(__filename)
|
|
17
|
-
.replace(".js", ".")}conf.js`,
|
|
12
|
+
configFilePath: `.eitri/${path.basename(__filename).replace(".js", ".")}conf.js`,
|
|
13
|
+
oldConfigFilePath: `.miniapp/${path.basename(__filename).replace(".js", ".")}conf.js`,
|
|
18
14
|
},
|
|
19
15
|
doc: {
|
|
20
16
|
createUrl: "https://developer.eitri.calindra.com.br/#/?id=create",
|
|
@@ -107,13 +103,17 @@ const config = {
|
|
|
107
103
|
library: {
|
|
108
104
|
url: "https://cdn.83io.com.br/library",
|
|
109
105
|
bifrost: {
|
|
110
|
-
versions: "/eitri-bifrost/versions/index.json"
|
|
106
|
+
versions: "/eitri-bifrost/versions/index.json",
|
|
111
107
|
},
|
|
112
108
|
luminusUi: {
|
|
113
|
-
versions: "/luminus-ui/versions/index.json"
|
|
109
|
+
versions: "/luminus-ui/versions/index.json",
|
|
114
110
|
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
111
|
+
commons: {
|
|
112
|
+
versions: "/eitri-commons/versions/index.json",
|
|
113
|
+
getVersion: "/eitri-commons/assets/$VERSION_NUMBER/eitri-commons-$VERSION_NUMBER.js",
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
118
|
|
|
119
|
-
module.exports = config
|
|
119
|
+
module.exports = config
|
package/config/prod-eitri.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
/* eslint-disable no-undef */
|
|
2
|
-
const HOST = "prod.eitri.calindra.com.br"
|
|
3
|
-
const EITRI_TECH_HOST = "eitri.tech"
|
|
2
|
+
const HOST = "prod.eitri.calindra.com.br"
|
|
3
|
+
const EITRI_TECH_HOST = "eitri.tech"
|
|
4
4
|
const API_EITRI_TECH_URL = `api.${EITRI_TECH_HOST}`
|
|
5
|
-
const packageJson = require("../package.json")
|
|
6
|
-
const path = require("path")
|
|
7
|
-
const FOUNDRY_CONTEXT_PATH = process.env.FOUNDRY_CONTEXT_PATH ??
|
|
5
|
+
const packageJson = require("../package.json")
|
|
6
|
+
const path = require("path")
|
|
7
|
+
const FOUNDRY_CONTEXT_PATH = process.env.FOUNDRY_CONTEXT_PATH ?? "foundry"
|
|
8
8
|
|
|
9
9
|
const config = {
|
|
10
10
|
userAgent: packageJson.name,
|
|
11
11
|
signup: {
|
|
12
|
-
configFilePath: `.eitri/${path
|
|
13
|
-
|
|
14
|
-
.replace(".js", ".")}conf.js`,
|
|
15
|
-
oldConfigFilePath: `.miniapp/${path
|
|
16
|
-
.basename(__filename)
|
|
17
|
-
.replace(".js", ".")}conf.js`,
|
|
12
|
+
configFilePath: `.eitri/${path.basename(__filename).replace(".js", ".")}conf.js`,
|
|
13
|
+
oldConfigFilePath: `.miniapp/${path.basename(__filename).replace(".js", ".")}conf.js`,
|
|
18
14
|
},
|
|
19
15
|
doc: {
|
|
20
16
|
createUrl: `https://console.${EITRI_TECH_HOST}/docs`,
|
|
@@ -45,9 +41,9 @@ const config = {
|
|
|
45
41
|
},
|
|
46
42
|
hugin: {
|
|
47
43
|
url: `https://${API_EITRI_TECH_URL}/eitri-hugin-api`,
|
|
48
|
-
uploadZip:
|
|
49
|
-
uploadFile:
|
|
50
|
-
|
|
44
|
+
uploadZip: "/uploadAll",
|
|
45
|
+
uploadFile: "/uploadSingle",
|
|
46
|
+
|
|
51
47
|
// pasta do eitriapp dentro de src
|
|
52
48
|
watchUserDir: "/server",
|
|
53
49
|
},
|
|
@@ -107,13 +103,17 @@ const config = {
|
|
|
107
103
|
library: {
|
|
108
104
|
url: "https://cdn.83io.com.br/library",
|
|
109
105
|
bifrost: {
|
|
110
|
-
versions: "/eitri-bifrost/versions/index.json"
|
|
106
|
+
versions: "/eitri-bifrost/versions/index.json",
|
|
111
107
|
},
|
|
112
108
|
luminusUi: {
|
|
113
|
-
versions: "/luminus-ui/versions/index.json"
|
|
109
|
+
versions: "/luminus-ui/versions/index.json",
|
|
110
|
+
},
|
|
111
|
+
commons: {
|
|
112
|
+
versions: "/eitri-commons/versions/index.json",
|
|
113
|
+
getVersion: "/eitri-commons/assets/$VERSION_NUMBER/eitri-commons-$VERSION_NUMBER.js",
|
|
114
114
|
},
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
118
|
|
|
119
|
-
module.exports = config
|
|
119
|
+
module.exports = config
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,97 +1,134 @@
|
|
|
1
|
-
const axios = require(
|
|
2
|
-
const configService = require(
|
|
3
|
-
const CDN_83io_LIBRARY = configService.get(
|
|
4
|
-
const TrackingEitriAnalytics = require(
|
|
5
|
-
const { validateUUID } = require(
|
|
1
|
+
const axios = require("axios")
|
|
2
|
+
const configService = require("./ConfigService")
|
|
3
|
+
const CDN_83io_LIBRARY = configService.get("cdn")?.library
|
|
4
|
+
const TrackingEitriAnalytics = require("./TrackingEitriAnalytics")
|
|
5
|
+
const { validateUUID } = require("../util/GenericUtils")
|
|
6
6
|
|
|
7
7
|
class LibsService {
|
|
8
|
-
|
|
9
8
|
static async validateLibsVersions({ libs = [], eitriAppConf = {} }) {
|
|
10
|
-
const
|
|
9
|
+
const libsList = libs
|
|
10
|
+
|
|
11
|
+
if (eitriAppConf["eitri-commons"]) {
|
|
12
|
+
libsList.push({
|
|
13
|
+
name: "eitri-commons",
|
|
14
|
+
version: eitriAppConf["eitri-commons"],
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { luminusUiVersion, bifrostVersion, commonsVersion } = this.getEitriConfLibsVersions(libsList)
|
|
19
|
+
|
|
20
|
+
if (commonsVersion) {
|
|
21
|
+
const validCommonsVersion = await this.validCommonsVersion(commonsVersion)
|
|
22
|
+
if (!validCommonsVersion) {
|
|
23
|
+
throw new Error(`A versão [${commonsVersion}] do [eitri-commons] definida em seu eitri-app.conf é inválida.`)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
11
27
|
if (!luminusUiVersion) {
|
|
12
|
-
throw new Error("Nenhuma versão do [luminus-ui/eitri-app-components] encontrada em seu eitri-app.conf")
|
|
28
|
+
throw new Error("Nenhuma versão do [luminus-ui/eitri-app-components] encontrada em seu eitri-app.conf")
|
|
13
29
|
}
|
|
14
30
|
|
|
15
31
|
if (!bifrostVersion) {
|
|
16
|
-
throw new Error("Nenhuma versão do [bifrost/eitri-app-client] encontrada em seu eitri-app.conf")
|
|
32
|
+
throw new Error("Nenhuma versão do [bifrost/eitri-app-client] encontrada em seu eitri-app.conf")
|
|
17
33
|
}
|
|
18
34
|
|
|
19
|
-
const { luminusUiVersions, bifrostVersions } = await this.simultaneousRequestAndHandleData()
|
|
20
|
-
const allBifrostVersions = bifrostVersions?.versions?.concat(
|
|
21
|
-
|
|
35
|
+
const { luminusUiVersions, bifrostVersions } = await this.simultaneousRequestAndHandleData()
|
|
36
|
+
const allBifrostVersions = bifrostVersions?.versions?.concat(
|
|
37
|
+
bifrostVersions?.betaVersions,
|
|
38
|
+
bifrostVersions?.alphaVersions,
|
|
39
|
+
)
|
|
22
40
|
|
|
23
41
|
if (!luminusUiVersion.includes("@") && !validateUUID(luminusUiVersion)) {
|
|
24
|
-
const existsLuminus = luminusUiVersions?.versions?.some(version => version === luminusUiVersion)
|
|
42
|
+
const existsLuminus = luminusUiVersions?.versions?.some((version) => version === luminusUiVersion)
|
|
25
43
|
if (!existsLuminus) {
|
|
26
44
|
this.throwNonExistentLibError({
|
|
27
45
|
libName: "luminus-ui/eitri-app-components",
|
|
28
46
|
eitriConfLibVersion: luminusUiVersion,
|
|
29
47
|
availableVersions: luminusUiVersions,
|
|
30
48
|
eitriAppConf,
|
|
31
|
-
})
|
|
49
|
+
})
|
|
32
50
|
}
|
|
33
51
|
}
|
|
34
52
|
|
|
35
53
|
if (!bifrostVersion.includes("@")) {
|
|
36
|
-
const existsBifrost = allBifrostVersions.some(version => version === bifrostVersion)
|
|
54
|
+
const existsBifrost = allBifrostVersions.some((version) => version === bifrostVersion)
|
|
37
55
|
if (!existsBifrost) {
|
|
38
56
|
this.throwNonExistentLibError({
|
|
39
57
|
libName: "bifrost/eitri-app-client",
|
|
40
58
|
eitriConfLibVersion: bifrostVersion,
|
|
41
59
|
availableVersions: allBifrostVersions,
|
|
42
60
|
eitriAppConf,
|
|
43
|
-
})
|
|
61
|
+
})
|
|
44
62
|
}
|
|
45
63
|
}
|
|
64
|
+
}
|
|
46
65
|
|
|
66
|
+
static async validCommonsVersion(commonsVersion) {
|
|
67
|
+
try {
|
|
68
|
+
const fullUrl = `${CDN_83io_LIBRARY.url}${CDN_83io_LIBRARY.commons.getVersion}`.replace(
|
|
69
|
+
/\$VERSION_NUMBER/g,
|
|
70
|
+
commonsVersion,
|
|
71
|
+
)
|
|
72
|
+
const response = await axios.get(fullUrl)
|
|
73
|
+
if (response.data) {
|
|
74
|
+
return true
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
const errorMessage = error?.message || "Erro na obtenção de versões do Bifrost"
|
|
78
|
+
this.sendErrorToAnalytics("getBifrostVersions", errorMessage)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return false
|
|
47
82
|
}
|
|
48
83
|
|
|
49
84
|
static getEitriConfLibsVersions(libs = []) {
|
|
50
|
-
const luminusUiNames = ["eitri-app-components", "eitri-luminus"]
|
|
51
|
-
const biFrostNames = ["eitri-app-client", "eitri-bifrost"]
|
|
52
|
-
const
|
|
53
|
-
const
|
|
85
|
+
const luminusUiNames = ["eitri-app-components", "eitri-luminus"]
|
|
86
|
+
const biFrostNames = ["eitri-app-client", "eitri-bifrost"]
|
|
87
|
+
const commonsNames = ["eitri-commons"]
|
|
88
|
+
const bifrostVersion = libs.find((lib) => biFrostNames?.includes(lib.name))?.version
|
|
89
|
+
const luminusUiVersion = libs.find((lib) => luminusUiNames?.includes(lib.name))?.version
|
|
90
|
+
const commonsVersion = libs.find((lib) => commonsNames?.includes(lib.name))?.version
|
|
54
91
|
|
|
55
92
|
return {
|
|
56
93
|
luminusUiVersion,
|
|
57
|
-
bifrostVersion
|
|
94
|
+
bifrostVersion,
|
|
95
|
+
commonsVersion,
|
|
58
96
|
}
|
|
59
97
|
}
|
|
60
98
|
|
|
61
99
|
static async simultaneousRequestAndHandleData() {
|
|
62
|
-
const promises = await Promise.allSettled([
|
|
63
|
-
|
|
64
|
-
|
|
100
|
+
const promises = await Promise.allSettled([this.getBifrostVersions(), this.getLuminusUiVersions()])
|
|
101
|
+
.then((res) => res)
|
|
102
|
+
.catch((err) => err)
|
|
65
103
|
|
|
66
|
-
const [bifrost, luminus] = promises
|
|
104
|
+
const [bifrost, luminus] = promises
|
|
67
105
|
|
|
68
|
-
let allBifrostVersions = {}
|
|
106
|
+
let allBifrostVersions = {}
|
|
69
107
|
if (bifrost?.status === "fulfilled") {
|
|
70
108
|
allBifrostVersions = bifrost.value
|
|
71
109
|
}
|
|
72
110
|
|
|
73
|
-
let allLuminusVersions = {}
|
|
111
|
+
let allLuminusVersions = {}
|
|
74
112
|
if (luminus?.status === "fulfilled") {
|
|
75
113
|
allLuminusVersions = luminus.value
|
|
76
114
|
}
|
|
77
115
|
|
|
78
116
|
return {
|
|
79
117
|
luminusUiVersions: allLuminusVersions,
|
|
80
|
-
bifrostVersions: allBifrostVersions
|
|
118
|
+
bifrostVersions: allBifrostVersions,
|
|
81
119
|
}
|
|
82
120
|
}
|
|
83
121
|
|
|
84
122
|
static handleRawDatas(promises = []) {
|
|
123
|
+
const [bifrost, luminus] = promises
|
|
85
124
|
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
const allBifrostVersions = [];
|
|
125
|
+
const allBifrostVersions = []
|
|
89
126
|
if (bifrost?.status === "fulfilled") {
|
|
90
|
-
const versions = bifrost?.value?.versions?.concat(bifrost?.value?.betaVersions, bifrost?.value?.alphaVersions)
|
|
127
|
+
const versions = bifrost?.value?.versions?.concat(bifrost?.value?.betaVersions, bifrost?.value?.alphaVersions)
|
|
91
128
|
allBifrostVersions.push(...versions)
|
|
92
129
|
}
|
|
93
130
|
|
|
94
|
-
const allLuminusVersions = []
|
|
131
|
+
const allLuminusVersions = []
|
|
95
132
|
if (luminus?.status === "fulfilled") {
|
|
96
133
|
allLuminusVersions.push(...luminus.value.versions)
|
|
97
134
|
}
|
|
@@ -102,9 +139,8 @@ class LibsService {
|
|
|
102
139
|
}
|
|
103
140
|
}
|
|
104
141
|
|
|
105
|
-
|
|
106
142
|
static async getBifrostVersions() {
|
|
107
|
-
const fullUrl = `${CDN_83io_LIBRARY.url}${CDN_83io_LIBRARY.bifrost.versions}
|
|
143
|
+
const fullUrl = `${CDN_83io_LIBRARY.url}${CDN_83io_LIBRARY.bifrost.versions}`
|
|
108
144
|
try {
|
|
109
145
|
const response = await axios.get(fullUrl)
|
|
110
146
|
return response.data
|
|
@@ -115,7 +151,7 @@ class LibsService {
|
|
|
115
151
|
}
|
|
116
152
|
|
|
117
153
|
static async getLuminusUiVersions() {
|
|
118
|
-
const fullUrl = `${CDN_83io_LIBRARY.url}${CDN_83io_LIBRARY.luminusUi.versions}
|
|
154
|
+
const fullUrl = `${CDN_83io_LIBRARY.url}${CDN_83io_LIBRARY.luminusUi.versions}`
|
|
119
155
|
try {
|
|
120
156
|
const response = await axios.get(fullUrl)
|
|
121
157
|
return response.data
|
|
@@ -129,16 +165,16 @@ class LibsService {
|
|
|
129
165
|
TrackingEitriAnalytics.sendEvent({
|
|
130
166
|
eventName: `${method}.error`,
|
|
131
167
|
userId: "",
|
|
132
|
-
data: { errorMessage }
|
|
168
|
+
data: { errorMessage },
|
|
133
169
|
})
|
|
134
170
|
}
|
|
135
171
|
|
|
136
172
|
static throwNonExistentLibError(input = { libName: "", eitriConfLibVersion: "", availableVersions: [], eitriAppConf: {} }) {
|
|
137
173
|
const { libName, eitriConfLibVersion, availableVersions, eitriAppConf } = input
|
|
138
174
|
|
|
139
|
-
const friendlyErrorMessage = `Versão da biblioteca [${libName}] não encontrada
|
|
140
|
-
console.log(`\n\x1b[1m\x1b[31m${friendlyErrorMessage}\x1b[0m\n`)
|
|
141
|
-
console.log("Veja as versões disponíveis abaixo e atualize o arquivo eitri-app.conf\n")
|
|
175
|
+
const friendlyErrorMessage = `Versão da biblioteca [${libName}] não encontrada`
|
|
176
|
+
console.log(`\n\x1b[1m\x1b[31m${friendlyErrorMessage}\x1b[0m\n`)
|
|
177
|
+
console.log("Veja as versões disponíveis abaixo e atualize o arquivo eitri-app.conf\n")
|
|
142
178
|
console.log(availableVersions)
|
|
143
179
|
|
|
144
180
|
TrackingEitriAnalytics.sendEvent({
|
|
@@ -149,12 +185,11 @@ class LibsService {
|
|
|
149
185
|
eitriConfLibVersion,
|
|
150
186
|
availableVersions,
|
|
151
187
|
eitriAppConf,
|
|
152
|
-
}
|
|
188
|
+
},
|
|
153
189
|
})
|
|
154
190
|
|
|
155
191
|
process.exit(1)
|
|
156
192
|
}
|
|
157
|
-
|
|
158
193
|
}
|
|
159
194
|
|
|
160
|
-
module.exports = LibsService
|
|
195
|
+
module.exports = LibsService
|