@cyklang/cli 0.2.3 → 0.3.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.
@@ -60,7 +60,7 @@ class AssetList extends Cmd_1.Cmd {
60
60
  if (this.dbManager === undefined)
61
61
  throw 'dbManager undefined';
62
62
  const dbClient = new DBClient_1.DBClient(this.dbManager);
63
- dbClient.selectFromTable('List of Assets', 'cyk_asset', { fields: 'asset_id,asset_route,asset_last_update,asset_mimetype', sort: options.sort || '1' });
63
+ dbClient.selectFromTable('List of Assets', 'cyk_asset', { fields: 'asset_id,asset_route,asset_auth,asset_access,asset_mimetype,asset_last_update', sort: options.sort || '1' });
64
64
  }
65
65
  catch (err) {
66
66
  logger.error(err);
@@ -75,7 +75,8 @@ class AssetUpload extends Cmd_1.Cmd {
75
75
  //----------------------------------------------------------------------------------------------
76
76
  this.ignorePatterns = ['.git', 'node_modules'];
77
77
  this.description(description)
78
- .option('-d --dest <destination>', 'route of destination')
78
+ .option('-d --dest <destination>', 'destination path, directory name')
79
+ .option('-c --clean', 'clean destination path before uploading')
79
80
  .option('-y --yes', 'upload list is automatically confirmed')
80
81
  .argument('[sources...]', 'local files or directories to upload as assets to the server')
81
82
  .action(async (sources, options) => {
@@ -106,6 +107,9 @@ class AssetUpload extends Cmd_1.Cmd {
106
107
  dest = '/' + dest;
107
108
  if (dest.substring(dest.length - 1) !== '/')
108
109
  dest = dest + '/';
110
+ if (options.clean) {
111
+ await this.cleanDestination(dest);
112
+ }
109
113
  for (let ind = 0; ind < sources.length; ind++) {
110
114
  const source = sources[ind];
111
115
  if (fs.existsSync(source) === false)
@@ -126,6 +130,19 @@ class AssetUpload extends Cmd_1.Cmd {
126
130
  }
127
131
  }
128
132
  //----------------------------------------------------------------------------------------------
133
+ // cleanDestination
134
+ //----------------------------------------------------------------------------------------------
135
+ async cleanDestination(dest) {
136
+ const remoteList = await this.scanAssets();
137
+ for (let ind = 0; ind < remoteList.length; ind++) {
138
+ const fd = remoteList[ind];
139
+ if (fd.path.startsWith(dest)) {
140
+ const url = '/api/admin/assets/' + fd.id;
141
+ await this.dbRemote?.apiServer.delete(url);
142
+ }
143
+ }
144
+ }
145
+ //----------------------------------------------------------------------------------------------
129
146
  // uploadDirectory
130
147
  //----------------------------------------------------------------------------------------------
131
148
  async uploadDirectory(source, dest, options) {
@@ -140,8 +157,7 @@ class AssetUpload extends Cmd_1.Cmd {
140
157
  }
141
158
  logger.debug('options', options);
142
159
  this.scanDir(dirName, localList);
143
- const remoteList = [];
144
- await this.scanAssets(remoteList);
160
+ const remoteList = await this.scanAssets();
145
161
  const uploadList = this.buildUploadList(dirName, dest, localList, remoteList);
146
162
  // logger.info(fileNames.join('\n'))
147
163
  if (uploadList.length === 0)
@@ -193,7 +209,8 @@ class AssetUpload extends Cmd_1.Cmd {
193
209
  //----------------------------------------------------------------------------------------------
194
210
  // scanAssets
195
211
  //----------------------------------------------------------------------------------------------
196
- async scanAssets(result) {
212
+ async scanAssets() {
213
+ const result = [];
197
214
  if (this.dbManager === undefined)
198
215
  throw 'dbManager undefined';
199
216
  const dbReq = new core_1.DBExecuteRequest();
@@ -209,11 +226,13 @@ class AssetUpload extends Cmd_1.Cmd {
209
226
  for (let ind = 0; ind < rows.list.length; ind++) {
210
227
  const { variable: row } = rows.list[ind];
211
228
  const record = row.data;
229
+ const asset_id = record.variables.getData('asset_id').value;
212
230
  const asset_route = record.variables.getData('asset_route').value;
213
- const asset_last_update = record.variables.getData('asset_last_update').value;
231
+ const asset_last_update = record.variables.getData('asset_last_update')?.value;
214
232
  // logger.debug('asset_route ' + asset_route,'asset_last_update ' + asset_last_update)
215
- result.push({ path: asset_route, mtime: asset_last_update });
233
+ result.push({ path: asset_route, mtime: asset_last_update, id: asset_id });
216
234
  }
235
+ return result;
217
236
  }
218
237
  //----------------------------------------------------------------------------------------------
219
238
  // scanDir
@@ -301,7 +320,7 @@ class AssetUpload extends Cmd_1.Cmd {
301
320
  const file = fs.createReadStream(fileName);
302
321
  const form = new form_data_1.default();
303
322
  form.append('uploadFile', file);
304
- const route = '/upload/cyk_asset/asset_content?asset_id=' + dbAsset.id;
323
+ const route = '/api/upload/cyk_asset/asset_content?asset_id=' + dbAsset.id;
305
324
  const resp = await this.dbRemote?.apiServer.post(route, form);
306
325
  if (resp.status === 200) {
307
326
  logger.info(fileName + ' uploaded');
package/build/Cmd.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { DBManager, DBRemote } from "@cyklang/core";
1
+ import { DBManager, DBRemote, SigninResponse } from "@cyklang/core";
2
2
  import { Command } from "commander";
3
3
  export declare class Cmd extends Command {
4
4
  dbManager: DBManager | undefined;
5
5
  dbRemote: DBRemote | undefined;
6
6
  constructor(name: string);
7
- prologue(options: any): Promise<void>;
7
+ prologue(options: any): Promise<SigninResponse>;
8
8
  }
package/build/Cmd.js CHANGED
@@ -17,24 +17,20 @@ class Cmd extends commander_1.Command {
17
17
  this.option('--env <env>', 'path to the environment variables file');
18
18
  }
19
19
  async prologue(options) {
20
- try {
21
- const dotenvOutput = dotenv_1.default.config({ path: options.env });
22
- if (dotenvOutput.error !== undefined)
23
- throw dotenvOutput.error;
24
- const structure = new core_1.Structure();
25
- if (process.env.DBREMOTE_URL === undefined)
26
- throw 'DBREMOTE_URL undefined';
27
- logger.debug('Cmd.DBREMOTE_URL ' + process.env.DBREMOTE_URL);
28
- const nodeCrypto = new NodeCrypto_1.NodeCrypto();
29
- this.dbRemote = new core_1.DBRemote(structure.scope, process.env.DBREMOTE_URL, nodeCrypto);
30
- const login = await this.dbRemote.signin(process.env.USER_NAME, undefined, process.env.USER_PASSWORD);
31
- // logger.debug(login)
32
- this.dbManager = new core_1.DBManager(structure.scope, this.dbRemote);
33
- await this.dbManager.initialize();
34
- }
35
- catch (err) {
36
- logger.error(err);
37
- }
20
+ const dotenvOutput = dotenv_1.default.config({ path: options.env });
21
+ if (dotenvOutput.error !== undefined)
22
+ throw dotenvOutput.error;
23
+ const structure = new core_1.Structure();
24
+ if (process.env.DBREMOTE_URL === undefined)
25
+ throw 'DBREMOTE_URL undefined';
26
+ logger.debug('Cmd.DBREMOTE_URL ' + process.env.DBREMOTE_URL);
27
+ const nodeCrypto = new NodeCrypto_1.NodeCrypto();
28
+ this.dbRemote = new core_1.DBRemote(structure.scope, process.env.DBREMOTE_URL, nodeCrypto);
29
+ const login = await this.dbRemote.signin(process.env.USER_NAME, undefined, process.env.USER_PASSWORD);
30
+ // logger.debug(login)
31
+ this.dbManager = new core_1.DBManager(structure.scope, this.dbRemote);
32
+ await this.dbManager.initialize();
33
+ return login;
38
34
  }
39
35
  }
40
36
  exports.Cmd = Cmd;
@@ -2,6 +2,7 @@ import { DBManager } from "@cyklang/core";
2
2
  export declare class DBClient {
3
3
  dbManager: DBManager;
4
4
  constructor(dbManager: DBManager);
5
+ runQuery(): Promise<void>;
5
6
  selectFromTable(title: string, tableName: string, options: {
6
7
  fields: string;
7
8
  sort?: string | undefined;
package/build/DBClient.js CHANGED
@@ -13,6 +13,8 @@ class DBClient {
13
13
  constructor(dbManager) {
14
14
  this.dbManager = dbManager;
15
15
  }
16
+ async runQuery() {
17
+ }
16
18
  async selectFromTable(title, tableName, options) {
17
19
  try {
18
20
  const objectDataType = this.dbManager.scope.structure.objectDataType;
@@ -215,6 +217,8 @@ class List {
215
217
  else {
216
218
  result = value.toString();
217
219
  }
220
+ // replace \n with a space
221
+ result = result.replace(/\n/, ' ');
218
222
  if (width !== undefined && width !== 0) {
219
223
  if (result.length >= width) {
220
224
  result = result.substring(0, width);
@@ -59,7 +59,7 @@ function getModuleDBName(filePath) {
59
59
  // if (filePath.endsWith('.xml') === false) throw filePath + ' does not have .xml extension'
60
60
  // result = path.basename(filePath, '.xml')
61
61
  const result = path_1.default.parse(filePath).name;
62
- const identifierRegex = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
62
+ const identifierRegex = /^[_a-zA-Z][-_a-zA-Z0-9]*$/;
63
63
  if (result.match(identifierRegex) === null)
64
64
  throw 'filename ' + result + ' does not match identifier syntax';
65
65
  return result;
@@ -196,7 +196,7 @@ class ModuleList extends Cmd_1.Cmd {
196
196
  if (this.dbManager === undefined)
197
197
  throw 'dbManager undefined';
198
198
  const dbClient = new DBClient_1.DBClient(this.dbManager);
199
- dbClient.selectFromTable('List of Modules', 'cyk_module', { fields: 'module_id,module_dbname,module_access,module_description', sort: options.sort || '1' });
199
+ dbClient.selectFromTable('List of Modules', 'cyk_module', { fields: 'module_id,module_dbname,module_auth,module_access,module_description', sort: options.sort || '1' });
200
200
  }
201
201
  catch (err) {
202
202
  logger.error(err);
@@ -5,58 +5,68 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.QueryCommand = void 0;
8
- const core_1 = require("@cyklang/core");
9
8
  const loglevel_1 = __importDefault(require("loglevel"));
9
+ const Cmd_1 = require("./Cmd");
10
10
  const commander_1 = require("commander");
11
+ const DBClient_1 = require("./DBClient");
11
12
  const logger = loglevel_1.default.getLogger("QueryCommand.ts");
12
13
  logger.setLevel("debug");
13
14
  class QueryCommand extends commander_1.Command {
14
15
  constructor(name) {
15
16
  super(name);
17
+ this.description('query management');
18
+ this.addCommand(new QueryList('list', 'list queries'));
19
+ this.addCommand(new QueryList('l', 'list queries'));
16
20
  }
17
21
  }
18
22
  exports.QueryCommand = QueryCommand;
19
- function parseXmlFile(filepath, basename, xmlSource) {
20
- const tag = (0, core_1.parseXML)(filepath, xmlSource);
21
- if (tag.name !== 'DB.QUERY') {
22
- throw Error('tag ' + tag.name + ', should be <db.query>');
23
- }
24
- const name = tag.attributes.NAME;
25
- if (name === undefined) {
26
- throw Error('name attribute is missing');
23
+ //--------------------------------------------------------------------------------------------------------------------
24
+ // class TableList
25
+ //--------------------------------------------------------------------------------------------------------------------
26
+ class QueryList extends Cmd_1.Cmd {
27
+ constructor(name, description) {
28
+ super(name);
29
+ this.description(description)
30
+ .option('-s --sort <columns>', 'sort list by column numbers (begins with 0) separated by comma')
31
+ .action(async (options) => {
32
+ await this.commandList(options);
33
+ });
27
34
  }
28
- if (basename !== name + '.xml') {
29
- throw Error('filename ' + filepath + ' and name ' + name + ' do not correspond');
35
+ async commandList(options) {
36
+ await this.prologue(options);
37
+ if (this.dbManager === undefined)
38
+ throw 'dbManager undefined';
39
+ const dbClient = new DBClient_1.DBClient(this.dbManager);
40
+ dbClient.selectFromTable('List of Queries', 'cyk_query', { fields: 'query_id,query_name,query_auth,query_access,query_description', sort: options.sort || '1' });
30
41
  }
31
- return tag;
32
42
  }
33
- async function executeXml(structure, tag, xmlSource) {
34
- try {
35
- logger.debug('executeXml ' + tag.attributes.NAME);
36
- // structure.setInstructionType("print", new PrintInstructionType(logfilename))
37
- const dbQueryInstructionType = structure.scope.getInstructionType('db.query');
38
- if (dbQueryInstructionType === undefined) {
39
- throw Error('dbQueryInstructionType not found');
40
- }
41
- const scopeParse = new core_1.Scope(structure, structure.scope, undefined);
42
- const dbQueryInst = await dbQueryInstructionType.parseInstruction(tag, scopeParse);
43
- dbQueryInst.source = xmlSource;
44
- const scopeExecute = new core_1.Scope(structure, structure.scope, undefined);
45
- await dbQueryInst.execute(scopeExecute);
43
+ //--------------------------------------------------------------------------------------------------------------------
44
+ // class queryData
45
+ //--------------------------------------------------------------------------------------------------------------------
46
+ class queryData extends Cmd_1.Cmd {
47
+ constructor(name, description) {
48
+ super(name);
49
+ this.description(description)
50
+ .argument('<query>', 'query name')
51
+ .option('--where <clause_where_sql>', 'criteria in SQL syntax')
52
+ .option('-s --sort <columns>', 'sort by columns positions (begins by 0) separated by comma')
53
+ .option('-w --width <colwidth>', 'columns widths separated by comma')
54
+ .action(async (query, options) => {
55
+ this.commandData(query, options);
56
+ });
46
57
  }
47
- catch (err) {
48
- logger.error(err);
58
+ async commandData(query, options) {
59
+ try {
60
+ await this.prologue(options);
61
+ if (this.dbManager === undefined)
62
+ throw 'dbManager undefined';
63
+ const dbQuery = await this.dbManager.dbQueryExist(query);
64
+ if (dbQuery === undefined)
65
+ throw 'query ' + query + ' not found';
66
+ //DBClient
67
+ }
68
+ catch (err) {
69
+ logger.error(err);
70
+ }
49
71
  }
50
72
  }
51
- async function testQuery(structure, queryName) {
52
- const xmlScript = `
53
- <block>
54
- <object name='result'/>
55
- <db.execute query='${queryName}' result='result' />
56
- <print>string(result)</print>
57
- </block>
58
- `;
59
- const script = new core_1.Script(structure.scope, 'test', xmlScript);
60
- await script.parseInstructions();
61
- await script.execute();
62
- }
@@ -61,11 +61,11 @@ async function runFile(filename) {
61
61
  if (filename.indexOf(".") !== -1) {
62
62
  filename = filename.substring(0, filename.indexOf("."));
63
63
  }
64
+ // skip filename with double underscore
65
+ if (filename.indexOf("__") !== -1)
66
+ return;
64
67
  let xmlfilename = filename + ".xml";
65
- // let logfilename = filename + ".log"
66
- // let outfilename = filename + ".output"
67
68
  let xml = fs.readFileSync(xmlfilename);
68
- // fs.writeFileSync(logfilename, "")
69
69
  try {
70
70
  if (process.env.DBREMOTE_URL === undefined)
71
71
  throw 'DBREMOTE_URL undefined';
@@ -76,14 +76,24 @@ async function runFile(filename) {
76
76
  const login = await dbRemote.signin(process.env.USER_NAME, undefined, process.env.USER_PASSWORD);
77
77
  const dbManager = new core_1.DBManager(structure.scope, dbRemote);
78
78
  await dbManager.initialize();
79
- const tag = (0, core_1.parseXML)(xmlfilename, xml.toString());
80
- const moduleInstruction = new core_1.ModuleInstruction(tag, dbManager);
81
- await moduleInstruction.parse(structure.scope);
82
- await moduleInstruction.execute(structure.scope);
83
- // structure.scope.addInstructionType(new PrintInstructionType(logfilename))
84
- // let script = new Script(structure.scope, xmlfilename, xml.toString())
85
- // await script.parseInstructions()
86
- // await script.execute()
79
+ const user_lang = login.content.user_lang;
80
+ if (user_lang && user_lang.trim() !== '') {
81
+ const langfilename = filename + "__" + user_lang + ".xml";
82
+ if (fs.existsSync(langfilename)) {
83
+ const langXml = fs.readFileSync(langfilename);
84
+ const tag = (0, core_1.parseXML)(xmlfilename, langXml.toString());
85
+ const modLang = new core_1.ModuleInstruction(tag, dbManager);
86
+ await modLang.parse(structure.scope);
87
+ await modLang.execute(structure.scope);
88
+ const langMap = modLang.objectData?.variables.getData(user_lang);
89
+ if (langMap !== null && langMap !== undefined) {
90
+ structure.mapLang = langMap;
91
+ }
92
+ }
93
+ }
94
+ let script = new core_1.Script(structure.scope, xmlfilename, xml.toString());
95
+ await script.parseInstructions();
96
+ await script.execute();
87
97
  }
88
98
  catch (err) {
89
99
  if (err instanceof core_1.XmlError) {
@@ -92,21 +102,4 @@ async function runFile(filename) {
92
102
  }
93
103
  console.log(err);
94
104
  }
95
- // let log = fs.readFileSync(logfilename)
96
- // if (fs.existsSync(outfilename) === true ) {
97
- // let out = fs.readFileSync(outfilename)
98
- // if (log.toString() === out.toString()) {
99
- // console.log("test " + xmlfilename + " SUCCESS")
100
- // result = true
101
- // }
102
- // else {
103
- // console.log("test " + xmlfilename + " FAILURE")
104
- // result = false
105
- // }
106
- // }
107
- // else {
108
- // console.log("test " + xmlfilename + " output file not found ")
109
- // result = false
110
- // }
111
- // return result
112
105
  }
@@ -41,8 +41,8 @@ class TableCommand extends commander_1.Command {
41
41
  this.addCommand(new TableImportCmd());
42
42
  this.addCommand(new TableList('list', 'list database tables'));
43
43
  this.addCommand(new TableList('l', '(l)ist database tables'));
44
- this.addCommand(new TableQuery('query', 'query select table content'));
45
- this.addCommand(new TableQuery('q', 'query select table content'));
44
+ this.addCommand(new TableData('data', 'table (d)ata'));
45
+ this.addCommand(new TableData('d', 'table (d)ata'));
46
46
  }
47
47
  }
48
48
  exports.TableCommand = TableCommand;
@@ -271,25 +271,25 @@ class TableList extends Cmd_1.Cmd {
271
271
  if (this.dbManager === undefined)
272
272
  throw 'dbManager undefined';
273
273
  const dbClient = new DBClient_1.DBClient(this.dbManager);
274
- dbClient.selectFromTable('List of Tables', 'cyk_table', { fields: 'table_id,table_name,table_description,table_access', sort: options.sort || '1' });
274
+ dbClient.selectFromTable('List of Tables', 'cyk_table', { fields: 'table_id,table_name,table_auth,table_access,table_description', sort: options.sort || '1' });
275
275
  }
276
276
  }
277
277
  //--------------------------------------------------------------------------------------------------------------------
278
- // class TableQuery
278
+ // class TableData
279
279
  //--------------------------------------------------------------------------------------------------------------------
280
- class TableQuery extends Cmd_1.Cmd {
280
+ class TableData extends Cmd_1.Cmd {
281
281
  constructor(name, description) {
282
282
  super(name);
283
283
  this.description(description)
284
- .argument('<table>', 'table to query')
284
+ .argument('<table>', 'table name')
285
285
  .option('--where <clause_where_sql>', 'criteria in SQL syntax')
286
286
  .option('-s --sort <columns>', 'sort by columns positions (begins by 0) separated by comma')
287
287
  .option('-w --width <colwidth>', 'columns widths separated by comma')
288
288
  .action(async (table, options) => {
289
- this.commandQuery(table, options);
289
+ this.commandData(table, options);
290
290
  });
291
291
  }
292
- async commandQuery(table, options) {
292
+ async commandData(table, options) {
293
293
  try {
294
294
  await this.prologue(options);
295
295
  if (this.dbManager === undefined)
@@ -42,7 +42,7 @@ class TestCommand extends Cmd_1.Cmd {
42
42
  }
43
43
  async testRun(files, options) {
44
44
  try {
45
- await this.prologue(options);
45
+ const signinResponse = await this.prologue(options);
46
46
  for (let ind = 0; ind < files.length; ind++) {
47
47
  const result = await testfile(files[ind]);
48
48
  if (result === false) {
@@ -61,6 +61,9 @@ async function testfile(filename) {
61
61
  if (filename.indexOf(".") !== -1) {
62
62
  filename = filename.substring(0, filename.indexOf("."));
63
63
  }
64
+ // skip filename with double underscore
65
+ if (filename.indexOf("__") !== -1)
66
+ return true;
64
67
  let xmlfilename = filename + ".xml";
65
68
  let logfilename = filename + ".log";
66
69
  let outfilename = filename + ".output";
@@ -80,6 +83,22 @@ async function testfile(filename) {
80
83
  await dbManager.initialize();
81
84
  structure.scope.addInstructionType(new console_1.PrintInstructionType(logfilename));
82
85
  let script = new core_1.Script(structure.scope, xmlfilename, xml.toString());
86
+ const user_lang = login.content.user_lang;
87
+ if (user_lang && user_lang.trim() !== '') {
88
+ const langfilename = filename + "__" + user_lang + ".xml";
89
+ if (fs.existsSync(langfilename)) {
90
+ const langXml = fs.readFileSync(langfilename);
91
+ const tag = (0, core_1.parseXML)(xmlfilename, langXml.toString());
92
+ const modLang = new core_1.ModuleInstruction(tag, dbManager);
93
+ await modLang.parse(structure.scope);
94
+ await modLang.execute(structure.scope);
95
+ const langMap = modLang.objectData?.variables.getData(user_lang);
96
+ if (langMap !== null && langMap !== undefined) {
97
+ structure.mapLang = langMap;
98
+ outfilename = filename + "__" + user_lang + ".output";
99
+ }
100
+ }
101
+ }
83
102
  await script.parseInstructions();
84
103
  await script.execute();
85
104
  // console.log(JSON.stringify(script.block.toString()))
@@ -36,6 +36,7 @@ class UserAddCmd extends Cmd_1.Cmd {
36
36
  .option('-a --access <acl>', 'access control list')
37
37
  .option('-m --module <module_name>', 'module to launch by default')
38
38
  .option('-d --disable', 'user not abled to connect')
39
+ .option('-l --lang <language>', 'user language')
39
40
  .action(async (options) => {
40
41
  const dbUser = new core_1.DBUser();
41
42
  dbUser.name = options.name;
@@ -44,6 +45,7 @@ class UserAddCmd extends Cmd_1.Cmd {
44
45
  dbUser.access = options.access;
45
46
  dbUser.appli = options.module;
46
47
  dbUser.disable = options.disable || false;
48
+ dbUser.lang = options.lang;
47
49
  await this.commandAdd(dbUser, options);
48
50
  });
49
51
  }
@@ -75,7 +77,7 @@ class UserListCmd extends Cmd_1.Cmd {
75
77
  if (this.dbManager === undefined)
76
78
  throw 'dbManager undefined';
77
79
  const dbClient = new DBClient_1.DBClient(this.dbManager);
78
- dbClient.selectFromTable('List of users', 'cyk_user', { fields: 'user_id,user_name,user_email,user_access,user_appli,user_disable', sort: options.sort || '1' });
80
+ dbClient.selectFromTable('List of users', 'cyk_user', { fields: 'user_id,user_name,user_email,user_access,user_appli,user_lang,user_disable', sort: options.sort || '1' });
79
81
  }
80
82
  catch (err) {
81
83
  logger.error(err);
@@ -91,6 +93,7 @@ class UserUpdateCmd extends Cmd_1.Cmd {
91
93
  .option('-e --email <email>', 'user email address')
92
94
  .option('-a --access <acl>', 'access control list')
93
95
  .option('-m --module <module_name>', 'module to launch by default')
96
+ .option('-l --lang <language>', 'user language')
94
97
  .option('-d --disable', 'user not able to connect')
95
98
  .action(async (options) => {
96
99
  const dbUser = new core_1.DBUser();
@@ -99,6 +102,7 @@ class UserUpdateCmd extends Cmd_1.Cmd {
99
102
  dbUser.email = options.email;
100
103
  dbUser.access = options.access;
101
104
  dbUser.appli = options.module;
105
+ dbUser.lang = options.lang;
102
106
  dbUser.disable = options.disable;
103
107
  await this.commandUpdate(dbUser, options);
104
108
  });
@@ -122,6 +126,8 @@ class UserUpdateCmd extends Cmd_1.Cmd {
122
126
  dbUser1.access = dbUser2.access;
123
127
  if (dbUser2.appli !== undefined)
124
128
  dbUser1.appli = dbUser2.appli;
129
+ if (dbUser2.lang !== undefined)
130
+ dbUser1.lang = dbUser2.lang;
125
131
  if (dbUser2.disable !== undefined)
126
132
  dbUser1.disable = dbUser2.disable;
127
133
  // logger.debug('dbUser1 before dbUserUpdate : ', dbUser1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyklang/cli",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "cyklang CLI",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -17,22 +17,20 @@
17
17
  "author": "",
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
- "@cyklang/core": "^0.4.2",
20
+ "@cyklang/core": "^0.5.0",
21
21
  "commander": "^9.4.0",
22
22
  "dotenv": "^16.0.1",
23
23
  "form-data": "^4.0.0",
24
24
  "inquirer": "^8.2.5",
25
25
  "loglevel": "^1.8.0",
26
26
  "mime-types": "^2.1.35",
27
- "pako": "^2.0.4",
28
- "xml": "^1.0.1"
27
+ "pako": "^2.0.4"
29
28
  },
30
29
  "devDependencies": {
31
30
  "@types/inquirer": "^8.2.4",
32
31
  "@types/mime-types": "^2.1.1",
33
32
  "@types/pako": "^2.0.0",
34
33
  "@types/sax": "^1.2.4",
35
- "@types/xml": "^1.0.8",
36
34
  "nodemon": "^2.0.16",
37
35
  "ts-node": "^10.7.0",
38
36
  "typescript": "4.5.2"