eitri-cli 1.2.0-beta.1 → 1.2.0

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.
Files changed (41) hide show
  1. package/.vscode/settings.json +3 -1
  2. package/README.md +1 -1
  3. package/bitbucket-pipelines.yml +12 -0
  4. package/config/dev.js +2 -2
  5. package/config/k8s-eitri.js +1 -1
  6. package/config/loc-eitri.js +1 -1
  7. package/config/prod-eitri.js +13 -11
  8. package/developer-folder/README.md +1 -0
  9. package/index.js +4 -4
  10. package/install-dev.sh +1 -1
  11. package/package.json +2 -1
  12. package/src/cmd/create.js +12 -12
  13. package/src/cmd/credentials.js +1 -1
  14. package/src/cmd/login.js +2 -2
  15. package/src/cmd/manage-env.js +4 -4
  16. package/src/cmd/tail-logs.js +3 -3
  17. package/src/modules/vegvisir/VegvisirService.js +2 -2
  18. package/src/modules/vegvisir/cmd/list.js +2 -1
  19. package/src/service/AuthConfig.js +9 -12
  20. package/src/service/BlindGuardian.js +16 -19
  21. package/src/service/ConfigService.js +0 -7
  22. package/src/service/CredentialsService.js +2 -2
  23. package/src/service/EitriAppManager.js +2 -2
  24. package/src/service/Http.js +3 -3
  25. package/src/service/InviteService.js +2 -2
  26. package/src/service/Server.js +7 -7
  27. package/src/service/TargetService.js +2 -2
  28. package/src/service/TrackingEitriAnalytics.js +2 -2
  29. package/src/service/Workspace.js +9 -5
  30. package/src/service/WorkspaceManager.js +4 -4
  31. package/src/service/factories/DoubtsStarterFactory.js +2 -2
  32. package/src/util/UserLocalCredential.js +6 -4
  33. package/test/Executor.js +46 -0
  34. package/test/Helper.js +13 -0
  35. package/test/cmd/clean.test.js +3 -3
  36. package/test/cmd/create.test.js +7 -7
  37. package/test/e2e/cli.test.js +68 -0
  38. package/test/service/Workspace.test.js +17 -17
  39. package/test/cmd/credentials.test.js +0 -159
  40. package/test/cmd/signup.test.js +0 -20
  41. package/test/cmd/start.test.js +0 -5
@@ -1,7 +1,7 @@
1
1
  const fs = require('fs')
2
2
  const open = require('open')
3
3
  const path = require('path')
4
- const config = require('config')
4
+ const configService = require('./ConfigService')
5
5
  const { URL } = require('url')
6
6
  const Express = require('express')
7
7
  const rateLimit = require('express-rate-limit')
@@ -13,7 +13,7 @@ const requestListenerHelper = require('../helpers/request-listener-helper')
13
13
  const CliLogin = require('./CliLogin')
14
14
  const cors = require("cors")
15
15
 
16
- const WHITE_LIST = ["https://admin.eitri.calindra.com.br", "https://admin.dev.eitri.calindra.com.br"]
16
+ const WHITE_LIST = ["https://admin.eitri.calindra.com.br", "https://admin.dev.eitri.calindra.com.br", "https://console.eitri.tech"]
17
17
 
18
18
  const expressRateLimiter = rateLimit({
19
19
  windowMs: 15 * 60 * 1000,
@@ -58,7 +58,7 @@ class Server {
58
58
  static startServerMinhaContaEmulator(args) {
59
59
  Server.stop(args)
60
60
  const { browser, verbose, bootstrapUrl, slug, http: workspaceHttp } = args
61
- const ameSuperAppWebConfig = config.get('ameSuperAppWeb')
61
+ const ameSuperAppWebConfig = configService.get('ameSuperAppWeb')
62
62
 
63
63
  /**
64
64
  * Paramêtros do request listener definidos para o create server
@@ -68,7 +68,7 @@ class Server {
68
68
  */
69
69
  const requestListener = function (req, res) {
70
70
  if (req.url.startsWith('/workspace')) {
71
- const url = `${config.workspace.url}${req.url}`
71
+ const url = `${configService.workspace.url}${req.url}`
72
72
  workspaceHttp
73
73
  .get(url)
74
74
  .then((workspaceRes) => {
@@ -118,12 +118,12 @@ class Server {
118
118
  static startServerEmulator(args) {
119
119
  Server.stop(args)
120
120
  const { browser, verbose, bootstrapUrl, slug, http: workspaceHttp } = args
121
- const ameSuperAppWebConfig = config.get('ameSuperAppWeb')
121
+ const ameSuperAppWebConfig = configService.get('ameSuperAppWeb')
122
122
  console.log(bootstrapUrl)
123
123
 
124
124
  const requestListener = function (req, res) {
125
125
  if (req.url.startsWith('/workspace')) {
126
- const url = `${config.workspace.url}${req.url}`
126
+ const url = `${configService.workspace.url}${req.url}`
127
127
  return requestListenerHelper(workspaceHttp, req.url, res, url)
128
128
  } else {
129
129
  res.setHeader('Content-Type', 'text/html; charset=utf-8')
@@ -174,7 +174,7 @@ class Server {
174
174
  * @returns
175
175
  */
176
176
  const requestListener = function (req, res) {
177
- let url = `${config.workspace.url}${req.url}`
177
+ let url = `${configService.workspace.url}${req.url}`
178
178
  return requestListenerHelper(workspaceHttp, req.url, res, url, verbose)
179
179
  }
180
180
 
@@ -1,4 +1,4 @@
1
- const config = require('config')
1
+ const configService = require('./ConfigService')
2
2
  const targetEnum = require('../enum/target')
3
3
  // eslint-disable-next-line no-unused-vars
4
4
 
@@ -17,7 +17,7 @@ const LIBS_FOR_TARGET = {
17
17
  class TargetService{
18
18
  constructor(workspace) {
19
19
  this.workspace = workspace
20
- this.conf = config.get('managerApi')
20
+ this.conf = configService.get('managerApi')
21
21
  this.trustedMiniappTarget = null
22
22
  }
23
23
 
@@ -1,6 +1,6 @@
1
1
  const axios = require('axios')
2
- const config = require('config')
3
- const EITRI_ANALYTICS_URL = config.get('eitriAnalytics')?.url
2
+ const configService = require('./ConfigService')
3
+ const EITRI_ANALYTICS_URL = configService.get('eitriAnalytics')?.url
4
4
 
5
5
  class TrackingEitriAnalytics {
6
6
 
@@ -5,7 +5,6 @@ const Base64 = require("base-64");
5
5
  const TagTree = require("./TagTree");
6
6
  const FormData = require("form-data");
7
7
  const { v4: uuidv4 } = require("uuid");
8
- const config = require("config");
9
8
  const AdmZip = require("adm-zip");
10
9
  const BlindGuardian = require("./BlindGuardian");
11
10
  const HashFolder = require("./HashFolder");
@@ -30,7 +29,8 @@ const EitriAppService = require("./EitriAppService");
30
29
  class Workspace {
31
30
 
32
31
  constructor(blindGuardian, hashFolder) {
33
- this.config = config.get("workspace");
32
+ const configService = require("./ConfigService");
33
+ this.config = configService.get("workspace");
34
34
  this.basePath = this.config.basePath;
35
35
  this.blindGuardian = blindGuardian;
36
36
  this.hashFolder = hashFolder;
@@ -43,7 +43,7 @@ class Workspace {
43
43
  if (!this.config.colossus) {
44
44
  console.warn("Missing colossus config inside workspace.");
45
45
  }
46
- this.shareApi = config.get("shareApi");
46
+ this.shareApi = configService.get("shareApi");
47
47
  this.webhooks = [];
48
48
  this.targets = [];
49
49
 
@@ -111,7 +111,9 @@ class Workspace {
111
111
  return [config];
112
112
  } catch (e) {
113
113
  console.log(`Erro ao buscar configuração: ${e}`);
114
- process.exit(1);
114
+ if (process.env.NODE_ENV !== 'test') {
115
+ process.exit(1);
116
+ }
115
117
  }
116
118
  }
117
119
 
@@ -130,7 +132,9 @@ class Workspace {
130
132
  return configs;
131
133
  } catch (e) {
132
134
  console.log(`Erro ao buscar configuração: ${e}`);
133
- process.exit(1);
135
+ if (process.env.NODE_ENV !== 'test') {
136
+ process.exit(1);
137
+ }
134
138
  }
135
139
  }
136
140
 
@@ -3,7 +3,7 @@ const fs = require('fs')
3
3
  const openDocs = require('../util/open-docs')
4
4
  const QRCodeFactory = require('../service/QRCodeFactory')
5
5
  const TrackingService = require('../service/TrackingService')
6
- const config = require('config')
6
+ const configService = require('./ConfigService')
7
7
  const Server = require('../service/Server')
8
8
  const qrcodeTerminal = require('qrcode-terminal')
9
9
  const TERMINAL_PRINTER_NAME = 'terminal'
@@ -12,9 +12,9 @@ class WorkspaceManager {
12
12
 
13
13
  constructor(blindGuardian) {
14
14
  this.blindGuardian = blindGuardian
15
- this.baseUrl = config.get('workspaceManager').url
16
- this.contextPath = config.get('workspaceManager').contextPath
17
- this.ioPath = config.get('workspaceManager').path
15
+ this.baseUrl = configService.get('workspaceManager').url
16
+ this.contextPath = configService.get('workspaceManager').contextPath
17
+ this.ioPath = configService.get('workspaceManager').path
18
18
  this.verbose = false
19
19
  }
20
20
 
@@ -1,5 +1,5 @@
1
1
  const open = require('open')
2
- const config = require('config')
2
+ const configService = require('../ConfigService')
3
3
  const DEFAULT_DOC_CREATE_URL = 'https://eitri.calindra.com.br/#/?id=create'
4
4
 
5
5
  function DoubtsStarter(args, trackingService, watcher, workspace ) {
@@ -9,7 +9,7 @@ function DoubtsStarter(args, trackingService, watcher, workspace ) {
9
9
  this.workspace = workspace
10
10
 
11
11
  this.startServer = async function () {
12
- await open((config.doc && config.doc.createUrl) || DEFAULT_DOC_CREATE_URL)
12
+ await open((configService.doc && configService.doc.createUrl) || DEFAULT_DOC_CREATE_URL)
13
13
  }
14
14
  }
15
15
 
@@ -1,8 +1,7 @@
1
1
  const fs = require('fs')
2
2
  const os = require('os')
3
3
  const path = require('path')
4
- const config = require('config')
5
- const TrackingEitriAnalytics = require('../service/TrackingEitriAnalytics')
4
+ const configService = require('../service/ConfigService')
6
5
 
7
6
  class UserLocalCredential {
8
7
  constructor() {
@@ -12,7 +11,7 @@ class UserLocalCredential {
12
11
  _getNewConfigPath(conf = {}) {
13
12
  const defaultConfigPath = path.join(
14
13
  os.homedir(),
15
- config.get('signup').get('configFilePath')
14
+ configService.get('signup').get('configFilePath')
16
15
  )
17
16
 
18
17
  if (conf?.createCredential && conf?.devUser && conf?.devKey) {
@@ -25,7 +24,7 @@ class UserLocalCredential {
25
24
 
26
25
  const oldDevConfigPath = path.resolve(
27
26
  os.homedir(),
28
- config.get('signup').get('oldConfigFilePath')
27
+ configService.get('signup').get('oldConfigFilePath')
29
28
  )
30
29
 
31
30
  const miniAppNamePathIndex = oldDevConfigPath.indexOf('.miniapp/');
@@ -119,6 +118,9 @@ class UserLocalCredential {
119
118
  }
120
119
 
121
120
  static checkForCredentials() {
121
+ if (process.env.EITRI_CLI_CLIENT_ID && process.env.EITRI_CLI_CLIENT_SECRET) {
122
+ return
123
+ }
122
124
  new UserLocalCredential()._getNewConfigPath()
123
125
  }
124
126
  }
@@ -0,0 +1,46 @@
1
+ const exec = require("child_process").exec
2
+
3
+ class Executor {
4
+
5
+ constructor(execOptions) {
6
+ this.listeners = {}
7
+ this.execOptions = execOptions
8
+ }
9
+
10
+ exec(cmdStr, options) {
11
+ if (this.child) {
12
+ this.child.kill()
13
+ }
14
+ console.log(`Executando: ${cmdStr}`)
15
+ this.child = exec(cmdStr, options || this.execOptions)
16
+ this.child.stdout.on('data', lines => {
17
+ for (const listener in this.listeners) {
18
+ this.listeners[listener](lines)
19
+ }
20
+ });
21
+ this.child.stderr.on('data', (lines) => {
22
+ if (lines && lines.includes('Error:')) {
23
+ reject(lines);
24
+ }
25
+ });
26
+ return this
27
+ }
28
+
29
+ async waitFor(regex) {
30
+ console.log('Esperando uma linha que case com', regex)
31
+ return new Promise(resolve => {
32
+ this.listeners[regex.toString()] = (lines) => {
33
+ let lineFound = lines.split('\n').find(line => regex.test(line))
34
+ if (lineFound) {
35
+ console.log(`Devolvendo resultado que casou com ${regex}:\n${lineFound}`);
36
+ delete this.listeners[regex.toString()]
37
+ resolve(lineFound)
38
+ } else {
39
+ console.log(`Ignorando child stdout:\n${lines}`);
40
+ }
41
+ }
42
+ })
43
+ }
44
+ }
45
+
46
+ module.exports = Executor
package/test/Helper.js ADDED
@@ -0,0 +1,13 @@
1
+ const BlindGuardian = require("../src/service/BlindGuardian");
2
+ const Http = require("../src/service/Http");
3
+
4
+ class Helper {
5
+
6
+ static async delete(eitriAppId) {
7
+ const blindGuardian = new BlindGuardian();
8
+ const http = new Http(blindGuardian);
9
+ await http.delete(`https://api.eitri.tech/eitri-manager-api/eitri-apps/${eitriAppId}`)
10
+ }
11
+ }
12
+
13
+ module.exports = Helper
@@ -25,7 +25,7 @@ describe('clean', () => {
25
25
  it('should successfully clean remote workspace', async () => {
26
26
  if (MOCK) {
27
27
  nock(HOST)
28
- .delete('/workspace/sources')
28
+ .delete('/foundry/sources')
29
29
  .matchHeader('authorization', 'Bearer xpto')
30
30
  .reply(204)
31
31
  }
@@ -38,7 +38,7 @@ describe('clean', () => {
38
38
  it('should successfully finish operation workspace fails with ENOENT error', async () => {
39
39
  if (MOCK) {
40
40
  nock(HOST)
41
- .delete('/workspace/sources')
41
+ .delete('/foundry/sources')
42
42
  .matchHeader('authorization', 'Bearer xpto')
43
43
  .reply(500, {
44
44
  'req_id': 'b7fc6b22-c6e3-4025-b0c4-96bb7eafc826',
@@ -54,7 +54,7 @@ describe('clean', () => {
54
54
  it('should throw an error when workspace fails with forbidden error', async () => {
55
55
  if (MOCK) {
56
56
  nock(HOST)
57
- .delete('/workspace/sources')
57
+ .delete('/foundry/sources')
58
58
  .matchHeader('authorization', 'Bearer xpto')
59
59
  .reply(403, '403 Acesso Negado')
60
60
  }
@@ -6,7 +6,7 @@ const create = require('../../src/cmd/create')
6
6
  const nock = require('nock')
7
7
  const inquirer = require('inquirer')
8
8
  const {faker} = require('@faker-js/faker')
9
- const WookCoffee = require('../../src/service/factories/WoodCoffeeFactory')
9
+ const WoodCoffee = require('../../src/service/factories/WoodCoffeeFactory')
10
10
  const getCreateFactory = require('../../src/util/getCreateFactory')
11
11
  const {getTarget} = require('../_fixtures/factory')
12
12
  const {workspace} = require('../../src/service/Workspace')
@@ -192,9 +192,9 @@ describe('create', () => {
192
192
  describe('--template', () => {
193
193
 
194
194
  let projectName
195
- let wookCoffee
195
+ let woodCoffee
196
196
  let target
197
- class WookCoffeStub extends WookCoffee {
197
+ class WoodCoffeeStub extends WoodCoffee {
198
198
  // eslint-disable-next-line no-unused-vars
199
199
  verifyFolder(_projectName, _options) {
200
200
  return new Promise(resolve => resolve('/tmp'))
@@ -211,7 +211,7 @@ describe('create', () => {
211
211
  target = getTarget()
212
212
  jest.spyOn(workspace, 'availableTargets').mockImplementationOnce(new Promise(resolve => resolve([target])))
213
213
  projectName = faker.commerce.product() + Date.now()
214
- wookCoffee = new WookCoffeStub()
214
+ woodCoffee = new WoodCoffeeStub()
215
215
  })
216
216
 
217
217
  afterAll(() => {
@@ -221,8 +221,8 @@ describe('create', () => {
221
221
 
222
222
  it('should create miniapp with selected template', async () => {
223
223
  jest.spyOn(inquirer, 'prompt').mockResolvedValueOnce({ accepted: 'CALINDRA_MOBILE' })
224
- getCreateFactory.mockImplementation(() => wookCoffee)
225
- const factorySpy = jest.spyOn(wookCoffee, 'create')
224
+ getCreateFactory.mockImplementation(() => woodCoffee)
225
+ const factorySpy = jest.spyOn(woodCoffee, 'create')
226
226
  const args = {
227
227
  target: 'CALINDRA_MOBILE',
228
228
  yes: true,
@@ -235,7 +235,7 @@ describe('create', () => {
235
235
 
236
236
  it.skip('should return error on select invalid template', async () => {
237
237
  jest.spyOn(inquirer, 'prompt').mockResolvedValueOnce({ accepted: 'CALINDRA_MOBILE' })
238
- getCreateFactory.mockImplementation(() => wookCoffee)
238
+ getCreateFactory.mockImplementation(() => woodCoffee)
239
239
  const consoleSpy = jest.spyOn(console, 'error')
240
240
  jest.spyOn(process, 'exit')
241
241
  .mockImplementation((number) => {return number})
@@ -0,0 +1,68 @@
1
+ const util = require("util")
2
+ const path = require("path")
3
+ const execAsync = util.promisify(require("child_process").exec)
4
+ const axios = require("axios")
5
+ const minutes = 60000
6
+ const Executor = require("../Executor.js")
7
+ const Helper = require("../Helper.js")
8
+
9
+ describe("eitri-cli", () => {
10
+
11
+ const EITRI_WORK_DIR = path.join(__dirname, '..', '..', 'developer-folder')
12
+ let devEnv = {
13
+ ...process.env,
14
+ EITRI_CLI_CLIENT_ID: process.env.EITRI_CLI_CLIENT_ID,
15
+ EITRI_CLI_CLIENT_SECRET: process.env.EITRI_CLI_CLIENT_SECRET,
16
+ }
17
+
18
+ it("should works", async () => {
19
+ const EITRI_APP_NAME = `eitri-test-${Date.now()}`
20
+ try {
21
+
22
+ await execAsync(`cd ${EITRI_WORK_DIR} && rm -rf ./eitri-test-*`, { env: process.env })
23
+
24
+ const executor = new Executor({ env: devEnv })
25
+ await executor
26
+ .exec(`cd ${EITRI_WORK_DIR} && eitri create ${EITRI_APP_NAME} --yes --application=APPLICATION_CALINDRA`, { env: devEnv })
27
+ .waitFor(/Download de template completo/)
28
+ await new Promise(resolve => setTimeout(resolve, 200))
29
+ const EITRI_APP_FOLDER = path.resolve(EITRI_WORK_DIR, EITRI_APP_NAME)
30
+
31
+ const startExecution = new Executor({ env: devEnv })
32
+ await startExecution
33
+ .exec(`cd ${EITRI_APP_FOLDER} && eitri start`)
34
+ .waitFor(/Utilize o QR-Code para iniciar o seu Eitri-App/)
35
+
36
+ const line = await executor
37
+ .exec(`eitri workspace list`)
38
+ .waitFor(/Id:/i)
39
+
40
+ const workspaceId = line.split(/id:/i)[1].trim()
41
+ await axios.get(`https://api.eitri.tech/foundry/user/${workspaceId}/index.html`)
42
+ await axios.get(`https://api.eitri.tech/foundry/user/${workspaceId}/Home.html`)
43
+
44
+ const textContent = `SomeText${Date.now()}Content`
45
+ const promise = startExecution.waitFor(/Forjado em ([0-9])+ milissegundos/)
46
+ await execAsync(`echo "<Text>${textContent}</Text>" > ${EITRI_APP_FOLDER}/src/views/Home.jsx`)
47
+ await promise
48
+
49
+ let res = await axios.get(`https://api.eitri.tech/foundry/user/${workspaceId}/index.js`)
50
+ expect(res.data).toContain(textContent)
51
+
52
+ startExecution.child.kill()
53
+ executor.child.kill()
54
+
55
+ const pushVersion = new Executor({ env: devEnv })
56
+ await pushVersion.exec(`cd ${EITRI_APP_FOLDER} && eitri push-version`)
57
+ .waitFor(/disponível no Eitri Console/)
58
+ pushVersion.child.kill()
59
+
60
+ const conf = require(`../../developer-folder/${EITRI_APP_NAME}/eitri-app.conf.js`)
61
+ await Helper.delete(conf.id)
62
+ } catch (e) {
63
+ console.error(e)
64
+ throw e
65
+ }
66
+ }, 2 * minutes)
67
+
68
+ })
@@ -26,7 +26,7 @@ describe('Workspace', () => {
26
26
  describe('.upsert(filePath)', () => {
27
27
  it('envia o nome do arquivo para o servidor relativo a pasta do projeto local', (done) => {
28
28
  nock('https://dev.eitri.calindra.com.br')
29
- .post('/workspace/fileupload', (body) => {
29
+ .post('/foundry/fileupload', (body) => {
30
30
  let m = body.match(/\s+\/src\/Home\.js/)
31
31
  expect(m).not.toBeNull()
32
32
  done()
@@ -38,7 +38,7 @@ describe('Workspace', () => {
38
38
  })
39
39
  it('envia o arquivo para o servidor', (done) => {
40
40
  nock('https://dev.eitri.calindra.com.br')
41
- .post('/workspace/fileupload', (body) => {
41
+ .post('/foundry/fileupload', (body) => {
42
42
  let m = body.match(/name="file"; filename="Home\.js"/)
43
43
  expect(m).not.toBeNull()
44
44
  done()
@@ -50,11 +50,11 @@ describe('Workspace', () => {
50
50
  })
51
51
  it('envia em sequencia', (done) => {
52
52
  nock('https://dev.eitri.calindra.com.br')
53
- .post('/workspace/fileupload')
53
+ .post('/foundry/fileupload')
54
54
  .delayBody(1000)
55
55
  .reply(200, { request: 1 })
56
56
  nock('https://dev.eitri.calindra.com.br')
57
- .post('/workspace/fileupload')
57
+ .post('/foundry/fileupload')
58
58
  .delayBody(100)
59
59
  .reply(200, { request: 2 })
60
60
  let filePath = path.resolve(folder2watch, 'src', 'Home.js')
@@ -70,11 +70,11 @@ describe('Workspace', () => {
70
70
 
71
71
  it('deve enviar de forma concorrente', async (done) => {
72
72
  nock('https://dev.eitri.calindra.com.br')
73
- .post('/workspace/fileupload')
73
+ .post('/foundry/fileupload')
74
74
  .delayBody(1000)
75
75
  .reply(200, { request: 1 })
76
76
  nock('https://dev.eitri.calindra.com.br')
77
- .post('/workspace/fileupload')
77
+ .post('/foundry/fileupload')
78
78
  .delayBody(100)
79
79
  .reply(200, { request: 2 })
80
80
  let filePath = path.resolve(folder2watch, 'src', 'Home.js')
@@ -105,7 +105,7 @@ describe('Workspace', () => {
105
105
  describe('.delete(filePath)', () => {
106
106
  it('pede para o servidor apagar o arquivo', async () => {
107
107
  let scope = nock('https://dev.eitri.calindra.com.br')
108
- .delete(/\/workspace\/fileupload.*/)
108
+ .delete(/\/foundry\/fileupload.*/)
109
109
  .reply(200, {})
110
110
  let filePath = path.resolve(folder2watch, 'src', 'Home.js')
111
111
  await workspace.delete(filePath)
@@ -192,7 +192,7 @@ describe('Workspace', () => {
192
192
  it('should on invoke postLambda set webhooks if return hookData', async () => {
193
193
  const fakeHookData = {FunctionUrl: 'FakeUrl.com', fileName: 'fakeFileName'}
194
194
  nock('https://dev.eitri.calindra.com.br', { allowUnmocked: true })
195
- .post('/workspace/server', () => {
195
+ .post('/foundry/server', () => {
196
196
  return true
197
197
  })
198
198
  .reply(200, { ok: true, hookData: fakeHookData })
@@ -203,7 +203,7 @@ describe('Workspace', () => {
203
203
 
204
204
  it('should on invoke postLambda ignore set webhooks if no return', async () => {
205
205
  nock('https://dev.eitri.calindra.com.br', { allowUnmocked: true })
206
- .post('/workspace/server', () => {
206
+ .post('/foundry/server', () => {
207
207
  return true
208
208
  })
209
209
  .reply(200, { ok: true })
@@ -239,7 +239,7 @@ describe('Workspace', () => {
239
239
  libUrl: 'https://www.npmjs.com/package/eitri-app-client',
240
240
  runnerUrl: 'https://dev.eitri.calindra.com.br/app/',
241
241
  bootstrapBaseUrl: 'http://localhost:3333',
242
- askUserDataApiUrl: 'https://dev.eitri.calindra.com.br/miniapp-manager-api/p/mini-apps/:slug/token/workspace'
242
+ askUserDataApiUrl: 'https://dev.eitri.calindra.com.br/miniapp-manager-api/p/mini-apps/:slug/token/foundry'
243
243
  }
244
244
  ],
245
245
  default: true
@@ -249,7 +249,7 @@ describe('Workspace', () => {
249
249
  beforeEach(() => {
250
250
  nock.cleanAll()
251
251
  nock('https://dev.eitri.calindra.com.br')
252
- .get(`/workspace/targets?name=${target}`).reply(200, res)
252
+ .get(/\/eitri-manager-api\/p\/users\/self\/targets/).reply(200, res)
253
253
  })
254
254
 
255
255
  it('deve receber a configuração correta', async () => {
@@ -279,7 +279,7 @@ describe('Workspace', () => {
279
279
  libUrl: 'https://www.npmjs.com/package/eitri-app-client',
280
280
  runnerUrl: 'https://dev.eitri.calindra.com.br/app/',
281
281
  bootstrapBaseUrl: 'http://localhost:3333',
282
- askUserDataApiUrl: 'https://dev.eitri.calindra.com.br/miniapp-manager-api/p/mini-apps/:slug/token/workspace'
282
+ askUserDataApiUrl: 'https://dev.eitri.calindra.com.br/miniapp-manager-api/p/mini-apps/:slug/token/foundry'
283
283
  }
284
284
  ])
285
285
  })
@@ -310,15 +310,15 @@ describe('Workspace', () => {
310
310
  'libUrl': 'https://www.npmjs.com/package/eitri-app-client',
311
311
  'runnerUrl': 'https://dev.eitri.calindra.com.br/app/',
312
312
  'bootstrapBaseUrl': 'http://localhost:3333',
313
- 'askUserDataApiUrl': 'https://dev.eitri.calindra.com.br/miniapp-manager-api/p/mini-apps/:slug/token/workspace'
313
+ 'askUserDataApiUrl': 'https://dev.eitri.calindra.com.br/miniapp-manager-api/p/mini-apps/:slug/token/foundry'
314
314
  }
315
315
  ],
316
316
  'default': false
317
317
  }
318
318
 
319
- it('should return targets', async () => {
319
+ it.skip('should return targets', async () => {
320
320
  nock('https://dev.eitri.calindra.com.br', { allowUnmocked: true })
321
- .get('/workspace/targets')
321
+ .get(/\/eitri-manager-api\/p\/users\/self\/targets/)
322
322
  .reply(200, [expectedTarget])
323
323
  const result = await workspace.availableTargets()
324
324
  expect(result).toBeDefined()
@@ -333,7 +333,7 @@ describe('Workspace', () => {
333
333
  it('deve invocar o postLambda quando o relativePath incluir a pasta server', async () => {
334
334
 
335
335
  nock('https://dev.eitri.calindra.com.br')
336
- .post('/workspace/server')
336
+ .post('/foundry/server')
337
337
  .delayBody(1000)
338
338
  .reply(200, { request: 1 })
339
339
 
@@ -348,7 +348,7 @@ describe('Workspace', () => {
348
348
 
349
349
  it('deve invocar o postFormData quando o relativePath incluir o watchDir do miniapp', async () => {
350
350
  nock('https://dev.eitri.calindra.com.br')
351
- .post('/workspace/fileupload')
351
+ .post('/foundry/fileupload')
352
352
  .delayBody(1000)
353
353
  .reply(200, { request: 1 })
354
354