biz-a-cli 2.3.0 → 2.3.1

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 (3) hide show
  1. package/bin/hub.js +1 -16
  2. package/bin/index.js +11 -3
  3. package/package.json +1 -1
package/bin/hub.js CHANGED
@@ -59,16 +59,9 @@ return new Promise((resolve, reject) => {
59
59
 
60
60
  // clean and concat requested url
61
61
  let url;
62
- let subdomain = argv['subdomain'].toString();
62
+ // let subdomain = argv['subdomain'].toString();
63
63
  let server = argv['server'].toString();
64
64
 
65
- // if (server.includes('https://')) {
66
- // url = `https://${subdomain}.${server.slice(8)}`;
67
- // } else if (server.includes('http://')) {
68
- // url = `http://${subdomain}.${server.slice(7)}`;
69
- // } else {
70
- // url = `https://${subdomain}.${server}`;
71
- // }
72
65
  url = server;
73
66
 
74
67
  // resolve promise with requested URL
@@ -78,25 +71,17 @@ return new Promise((resolve, reject) => {
78
71
  });
79
72
  socket.on('incomingClient', (clientId) => {
80
73
  console.log(clientId, 'incoming clientId')
81
- // console.log(`connecting to ${argv['hostname']}:${argv['port']}`)
82
74
  let client = net.connect(argv['port'], argv['hostname']);
83
- // let client = net.createConnection(argv['port'], argv['hostname']);
84
75
 
85
76
  client.on('connect', () => {
86
77
  console.log(`client connected to ${argv['hostname']}:${argv['port']}`)
87
- // console.log('client:', client)
88
78
  let s = ss.createStream();
89
79
  s.pipe(client).pipe(s);
90
80
 
91
81
  s.on('end', () => {
92
82
  client.destroy();
93
83
  });
94
- // console.log(client, '<===client')
95
84
  ss(socket).emit(clientId, s);
96
-
97
- // s.on('data', (chunk)=>{
98
- // console.log(chunk.toString(), 'chunk')
99
- // })
100
85
  })
101
86
 
102
87
  client.setTimeout(IDLE_SOCKET_TIMEOUT_MILLISECONDS);
package/bin/index.js CHANGED
@@ -10,14 +10,22 @@ const { option, number } = require("yargs");
10
10
  const options = yargs
11
11
  .option("s", {alias:"server", describe:"Server URL", type:"string", demandOption:true})
12
12
  .option("i", {alias:"dbindex", describe:"database index", type:number, demandOption:true})
13
- .option("d", {alias:"dir", describe:"Directory", type:"string", demandOption:false})
13
+ // .option("d", {alias:"dir", describe:"Directory", type:"string", demandOption:false})
14
+ .option("sub", {alias:"subdomain", describe:"Subdomain", type:"string", demandOption:false})
14
15
  .argv;
15
16
 
16
17
  const sendFile = async (filename, data)=>{
17
- const url = `http://${options.server}:212/fina/rest/TOrmMethod/%22setTemplate%22`
18
+ const baseUrl = 'fina/rest/TOrmMethod/%22setTemplate%22'
19
+ const url = options.sub ?
20
+ `${options.server}/hub/${baseUrl}?subdomain=${options.sub}` :
21
+ `http://${options.server}:212/${baseUrl}`
22
+ // console.log('url', url)
18
23
 
24
+ const headers={
25
+ 'Content-Type':'text/plain'
26
+ }
19
27
  const param = {_parameters: [options.dbindex, filename, data]};
20
- return await axios.post(url, param);
28
+ return await axios.post(url, param, {headers:headers});
21
29
  }
22
30
 
23
31
  function getParam(funcName){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz-a-cli",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "scripts": {