aaden-cli 1.2.18 → 1.2.19

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/dist/index.js +358 -121
  2. package/index.js +1 -1
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -34987,22 +34987,18 @@ exports.default = _default;
34987
34987
 
34988
34988
  /***/ }),
34989
34989
 
34990
- /***/ 28885:
34991
- /***/ ((__unused_webpack_module, exports) => {
34992
-
34993
- exports.parse = exports.decode = decode
34994
-
34995
- exports.stringify = exports.encode = encode
34990
+ /***/ 80045:
34991
+ /***/ ((module) => {
34996
34992
 
34997
- exports.safe = safe
34998
- exports.unsafe = unsafe
34993
+ const { hasOwnProperty } = Object.prototype
34999
34994
 
35000
- var eol = typeof process !== 'undefined' &&
34995
+ /* istanbul ignore next */
34996
+ const eol = typeof process !== 'undefined' &&
35001
34997
  process.platform === 'win32' ? '\r\n' : '\n'
35002
34998
 
35003
- function encode (obj, opt) {
35004
- var children = []
35005
- var out = ''
34999
+ const encode = (obj, opt) => {
35000
+ const children = []
35001
+ let out = ''
35006
35002
 
35007
35003
  if (typeof opt === 'string') {
35008
35004
  opt = {
@@ -35010,193 +35006,221 @@ function encode (obj, opt) {
35010
35006
  whitespace: false,
35011
35007
  }
35012
35008
  } else {
35013
- opt = opt || {}
35009
+ opt = opt || Object.create(null)
35014
35010
  opt.whitespace = opt.whitespace === true
35015
35011
  }
35016
35012
 
35017
- var separator = opt.whitespace ? ' = ' : '='
35013
+ const separator = opt.whitespace ? ' = ' : '='
35018
35014
 
35019
- Object.keys(obj).forEach(function (k, _, __) {
35020
- var val = obj[k]
35015
+ for (const k of Object.keys(obj)) {
35016
+ const val = obj[k]
35021
35017
  if (val && Array.isArray(val)) {
35022
- val.forEach(function (item) {
35023
- out += safe(k + '[]') + separator + safe(item) + '\n'
35024
- })
35025
- } else if (val && typeof val === 'object')
35018
+ for (const item of val) {
35019
+ out += safe(k + '[]') + separator + safe(item) + eol
35020
+ }
35021
+ } else if (val && typeof val === 'object') {
35026
35022
  children.push(k)
35027
- else
35023
+ } else {
35028
35024
  out += safe(k) + separator + safe(val) + eol
35029
- })
35025
+ }
35026
+ }
35030
35027
 
35031
- if (opt.section && out.length)
35028
+ if (opt.section && out.length) {
35032
35029
  out = '[' + safe(opt.section) + ']' + eol + out
35030
+ }
35033
35031
 
35034
- children.forEach(function (k, _, __) {
35035
- var nk = dotSplit(k).join('\\.')
35036
- var section = (opt.section ? opt.section + '.' : '') + nk
35037
- var child = encode(obj[k], {
35038
- section: section,
35039
- whitespace: opt.whitespace,
35032
+ for (const k of children) {
35033
+ const nk = dotSplit(k).join('\\.')
35034
+ const section = (opt.section ? opt.section + '.' : '') + nk
35035
+ const { whitespace } = opt
35036
+ const child = encode(obj[k], {
35037
+ section,
35038
+ whitespace,
35040
35039
  })
35041
- if (out.length && child.length)
35040
+ if (out.length && child.length) {
35042
35041
  out += eol
35042
+ }
35043
35043
 
35044
35044
  out += child
35045
- })
35045
+ }
35046
35046
 
35047
35047
  return out
35048
35048
  }
35049
35049
 
35050
- function dotSplit (str) {
35051
- return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
35050
+ const dotSplit = str =>
35051
+ str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
35052
35052
  .replace(/\\\./g, '\u0001')
35053
- .split(/\./).map(function (part) {
35054
- return part.replace(/\1/g, '\\.')
35055
- .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001')
35056
- })
35057
- }
35058
-
35059
- function decode (str) {
35060
- var out = {}
35061
- var p = out
35062
- var section = null
35053
+ .split(/\./)
35054
+ .map(part =>
35055
+ part.replace(/\1/g, '\\.')
35056
+ .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001'))
35057
+
35058
+ const decode = str => {
35059
+ const out = Object.create(null)
35060
+ let p = out
35061
+ let section = null
35063
35062
  // section |key = value
35064
- var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i
35065
- var lines = str.split(/[\r\n]+/g)
35063
+ const re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i
35064
+ const lines = str.split(/[\r\n]+/g)
35066
35065
 
35067
- lines.forEach(function (line, _, __) {
35068
- if (!line || line.match(/^\s*[;#]/))
35069
- return
35070
- var match = line.match(re)
35071
- if (!match)
35072
- return
35066
+ for (const line of lines) {
35067
+ if (!line || line.match(/^\s*[;#]/)) {
35068
+ continue
35069
+ }
35070
+ const match = line.match(re)
35071
+ if (!match) {
35072
+ continue
35073
+ }
35073
35074
  if (match[1] !== undefined) {
35074
35075
  section = unsafe(match[1])
35075
35076
  if (section === '__proto__') {
35076
35077
  // not allowed
35077
35078
  // keep parsing the section, but don't attach it.
35078
- p = {}
35079
- return
35079
+ p = Object.create(null)
35080
+ continue
35080
35081
  }
35081
- p = out[section] = out[section] || {}
35082
- return
35082
+ p = out[section] = out[section] || Object.create(null)
35083
+ continue
35083
35084
  }
35084
- var key = unsafe(match[2])
35085
- if (key === '__proto__')
35086
- return
35087
- var value = match[3] ? unsafe(match[4]) : true
35088
- switch (value) {
35089
- case 'true':
35090
- case 'false':
35091
- case 'null': value = JSON.parse(value)
35085
+ const keyRaw = unsafe(match[2])
35086
+ const isArray = keyRaw.length > 2 && keyRaw.slice(-2) === '[]'
35087
+ const key = isArray ? keyRaw.slice(0, -2) : keyRaw
35088
+ if (key === '__proto__') {
35089
+ continue
35092
35090
  }
35091
+ const valueRaw = match[3] ? unsafe(match[4]) : true
35092
+ const value = valueRaw === 'true' ||
35093
+ valueRaw === 'false' ||
35094
+ valueRaw === 'null' ? JSON.parse(valueRaw)
35095
+ : valueRaw
35093
35096
 
35094
35097
  // Convert keys with '[]' suffix to an array
35095
- if (key.length > 2 && key.slice(-2) === '[]') {
35096
- key = key.substring(0, key.length - 2)
35097
- if (key === '__proto__')
35098
- return
35099
- if (!p[key])
35098
+ if (isArray) {
35099
+ if (!hasOwnProperty.call(p, key)) {
35100
35100
  p[key] = []
35101
- else if (!Array.isArray(p[key]))
35101
+ } else if (!Array.isArray(p[key])) {
35102
35102
  p[key] = [p[key]]
35103
+ }
35103
35104
  }
35104
35105
 
35105
35106
  // safeguard against resetting a previously defined
35106
35107
  // array by accidentally forgetting the brackets
35107
- if (Array.isArray(p[key]))
35108
+ if (Array.isArray(p[key])) {
35108
35109
  p[key].push(value)
35109
- else
35110
+ } else {
35110
35111
  p[key] = value
35111
- })
35112
+ }
35113
+ }
35112
35114
 
35113
35115
  // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}}
35114
35116
  // use a filter to return the keys that have to be deleted.
35115
- Object.keys(out).filter(function (k, _, __) {
35116
- if (!out[k] ||
35117
- typeof out[k] !== 'object' ||
35118
- Array.isArray(out[k]))
35119
- return false
35117
+ const remove = []
35118
+ for (const k of Object.keys(out)) {
35119
+ if (!hasOwnProperty.call(out, k) ||
35120
+ typeof out[k] !== 'object' ||
35121
+ Array.isArray(out[k])) {
35122
+ continue
35123
+ }
35120
35124
 
35121
35125
  // see if the parent section is also an object.
35122
35126
  // if so, add it to that, and mark this one for deletion
35123
- var parts = dotSplit(k)
35124
- var p = out
35125
- var l = parts.pop()
35126
- var nl = l.replace(/\\\./g, '.')
35127
- parts.forEach(function (part, _, __) {
35128
- if (part === '__proto__')
35129
- return
35130
- if (!p[part] || typeof p[part] !== 'object')
35131
- p[part] = {}
35127
+ const parts = dotSplit(k)
35128
+ p = out
35129
+ const l = parts.pop()
35130
+ const nl = l.replace(/\\\./g, '.')
35131
+ for (const part of parts) {
35132
+ if (part === '__proto__') {
35133
+ continue
35134
+ }
35135
+ if (!hasOwnProperty.call(p, part) || typeof p[part] !== 'object') {
35136
+ p[part] = Object.create(null)
35137
+ }
35132
35138
  p = p[part]
35133
- })
35134
- if (p === out && nl === l)
35135
- return false
35139
+ }
35140
+ if (p === out && nl === l) {
35141
+ continue
35142
+ }
35136
35143
 
35137
35144
  p[nl] = out[k]
35138
- return true
35139
- }).forEach(function (del, _, __) {
35145
+ remove.push(k)
35146
+ }
35147
+ for (const del of remove) {
35140
35148
  delete out[del]
35141
- })
35149
+ }
35142
35150
 
35143
35151
  return out
35144
35152
  }
35145
35153
 
35146
- function isQuoted (val) {
35147
- return (val.charAt(0) === '"' && val.slice(-1) === '"') ||
35148
- (val.charAt(0) === "'" && val.slice(-1) === "'")
35154
+ const isQuoted = val => {
35155
+ return (val.startsWith('"') && val.endsWith('"')) ||
35156
+ (val.startsWith("'") && val.endsWith("'"))
35149
35157
  }
35150
35158
 
35151
- function safe (val) {
35152
- return (typeof val !== 'string' ||
35159
+ const safe = val => {
35160
+ if (
35161
+ typeof val !== 'string' ||
35153
35162
  val.match(/[=\r\n]/) ||
35154
35163
  val.match(/^\[/) ||
35155
- (val.length > 1 &&
35156
- isQuoted(val)) ||
35157
- val !== val.trim())
35158
- ? JSON.stringify(val)
35159
- : val.replace(/;/g, '\\;').replace(/#/g, '\\#')
35164
+ (val.length > 1 && isQuoted(val)) ||
35165
+ val !== val.trim()
35166
+ ) {
35167
+ return JSON.stringify(val)
35168
+ }
35169
+ return val.split(';').join('\\;').split('#').join('\\#')
35160
35170
  }
35161
35171
 
35162
- function unsafe (val, doUnesc) {
35172
+ const unsafe = (val, doUnesc) => {
35163
35173
  val = (val || '').trim()
35164
35174
  if (isQuoted(val)) {
35165
35175
  // remove the single quotes before calling JSON.parse
35166
- if (val.charAt(0) === "'")
35167
- val = val.substr(1, val.length - 2)
35168
-
35176
+ if (val.charAt(0) === "'") {
35177
+ val = val.slice(1, -1)
35178
+ }
35169
35179
  try {
35170
35180
  val = JSON.parse(val)
35171
- } catch (_) {}
35181
+ } catch {
35182
+ // ignore errors
35183
+ }
35172
35184
  } else {
35173
35185
  // walk the val to find the first not-escaped ; character
35174
- var esc = false
35175
- var unesc = ''
35176
- for (var i = 0, l = val.length; i < l; i++) {
35177
- var c = val.charAt(i)
35186
+ let esc = false
35187
+ let unesc = ''
35188
+ for (let i = 0, l = val.length; i < l; i++) {
35189
+ const c = val.charAt(i)
35178
35190
  if (esc) {
35179
- if ('\\;#'.indexOf(c) !== -1)
35191
+ if ('\\;#'.indexOf(c) !== -1) {
35180
35192
  unesc += c
35181
- else
35193
+ } else {
35182
35194
  unesc += '\\' + c
35195
+ }
35183
35196
 
35184
35197
  esc = false
35185
- } else if (';#'.indexOf(c) !== -1)
35198
+ } else if (';#'.indexOf(c) !== -1) {
35186
35199
  break
35187
- else if (c === '\\')
35200
+ } else if (c === '\\') {
35188
35201
  esc = true
35189
- else
35202
+ } else {
35190
35203
  unesc += c
35204
+ }
35191
35205
  }
35192
- if (esc)
35206
+ if (esc) {
35193
35207
  unesc += '\\'
35208
+ }
35194
35209
 
35195
35210
  return unesc.trim()
35196
35211
  }
35197
35212
  return val
35198
35213
  }
35199
35214
 
35215
+ module.exports = {
35216
+ parse: decode,
35217
+ decode,
35218
+ stringify: encode,
35219
+ encode,
35220
+ safe,
35221
+ unsafe,
35222
+ }
35223
+
35200
35224
 
35201
35225
  /***/ }),
35202
35226
 
@@ -43852,7 +43876,7 @@ module.exports = {
43852
43876
 
43853
43877
  const fs = __nccwpck_require__(77758)
43854
43878
  const stripBom = __nccwpck_require__(88551)
43855
- const ini = __nccwpck_require__(28885)
43879
+ const ini = __nccwpck_require__(62945)
43856
43880
  const pify = __nccwpck_require__(80237)
43857
43881
 
43858
43882
  const parse = (data) => ini.parse(stripBom(data))
@@ -43861,6 +43885,219 @@ module.exports = fp => pify(fs.readFile)(fp, 'utf8').then(parse)
43861
43885
  module.exports.sync = fp => parse(fs.readFileSync(fp, 'utf8'))
43862
43886
 
43863
43887
 
43888
+ /***/ }),
43889
+
43890
+ /***/ 62945:
43891
+ /***/ ((__unused_webpack_module, exports) => {
43892
+
43893
+ exports.parse = exports.decode = decode
43894
+
43895
+ exports.stringify = exports.encode = encode
43896
+
43897
+ exports.safe = safe
43898
+ exports.unsafe = unsafe
43899
+
43900
+ var eol = typeof process !== 'undefined' &&
43901
+ process.platform === 'win32' ? '\r\n' : '\n'
43902
+
43903
+ function encode (obj, opt) {
43904
+ var children = []
43905
+ var out = ''
43906
+
43907
+ if (typeof opt === 'string') {
43908
+ opt = {
43909
+ section: opt,
43910
+ whitespace: false,
43911
+ }
43912
+ } else {
43913
+ opt = opt || {}
43914
+ opt.whitespace = opt.whitespace === true
43915
+ }
43916
+
43917
+ var separator = opt.whitespace ? ' = ' : '='
43918
+
43919
+ Object.keys(obj).forEach(function (k, _, __) {
43920
+ var val = obj[k]
43921
+ if (val && Array.isArray(val)) {
43922
+ val.forEach(function (item) {
43923
+ out += safe(k + '[]') + separator + safe(item) + '\n'
43924
+ })
43925
+ } else if (val && typeof val === 'object')
43926
+ children.push(k)
43927
+ else
43928
+ out += safe(k) + separator + safe(val) + eol
43929
+ })
43930
+
43931
+ if (opt.section && out.length)
43932
+ out = '[' + safe(opt.section) + ']' + eol + out
43933
+
43934
+ children.forEach(function (k, _, __) {
43935
+ var nk = dotSplit(k).join('\\.')
43936
+ var section = (opt.section ? opt.section + '.' : '') + nk
43937
+ var child = encode(obj[k], {
43938
+ section: section,
43939
+ whitespace: opt.whitespace,
43940
+ })
43941
+ if (out.length && child.length)
43942
+ out += eol
43943
+
43944
+ out += child
43945
+ })
43946
+
43947
+ return out
43948
+ }
43949
+
43950
+ function dotSplit (str) {
43951
+ return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
43952
+ .replace(/\\\./g, '\u0001')
43953
+ .split(/\./).map(function (part) {
43954
+ return part.replace(/\1/g, '\\.')
43955
+ .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001')
43956
+ })
43957
+ }
43958
+
43959
+ function decode (str) {
43960
+ var out = {}
43961
+ var p = out
43962
+ var section = null
43963
+ // section |key = value
43964
+ var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i
43965
+ var lines = str.split(/[\r\n]+/g)
43966
+
43967
+ lines.forEach(function (line, _, __) {
43968
+ if (!line || line.match(/^\s*[;#]/))
43969
+ return
43970
+ var match = line.match(re)
43971
+ if (!match)
43972
+ return
43973
+ if (match[1] !== undefined) {
43974
+ section = unsafe(match[1])
43975
+ if (section === '__proto__') {
43976
+ // not allowed
43977
+ // keep parsing the section, but don't attach it.
43978
+ p = {}
43979
+ return
43980
+ }
43981
+ p = out[section] = out[section] || {}
43982
+ return
43983
+ }
43984
+ var key = unsafe(match[2])
43985
+ if (key === '__proto__')
43986
+ return
43987
+ var value = match[3] ? unsafe(match[4]) : true
43988
+ switch (value) {
43989
+ case 'true':
43990
+ case 'false':
43991
+ case 'null': value = JSON.parse(value)
43992
+ }
43993
+
43994
+ // Convert keys with '[]' suffix to an array
43995
+ if (key.length > 2 && key.slice(-2) === '[]') {
43996
+ key = key.substring(0, key.length - 2)
43997
+ if (key === '__proto__')
43998
+ return
43999
+ if (!p[key])
44000
+ p[key] = []
44001
+ else if (!Array.isArray(p[key]))
44002
+ p[key] = [p[key]]
44003
+ }
44004
+
44005
+ // safeguard against resetting a previously defined
44006
+ // array by accidentally forgetting the brackets
44007
+ if (Array.isArray(p[key]))
44008
+ p[key].push(value)
44009
+ else
44010
+ p[key] = value
44011
+ })
44012
+
44013
+ // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}}
44014
+ // use a filter to return the keys that have to be deleted.
44015
+ Object.keys(out).filter(function (k, _, __) {
44016
+ if (!out[k] ||
44017
+ typeof out[k] !== 'object' ||
44018
+ Array.isArray(out[k]))
44019
+ return false
44020
+
44021
+ // see if the parent section is also an object.
44022
+ // if so, add it to that, and mark this one for deletion
44023
+ var parts = dotSplit(k)
44024
+ var p = out
44025
+ var l = parts.pop()
44026
+ var nl = l.replace(/\\\./g, '.')
44027
+ parts.forEach(function (part, _, __) {
44028
+ if (part === '__proto__')
44029
+ return
44030
+ if (!p[part] || typeof p[part] !== 'object')
44031
+ p[part] = {}
44032
+ p = p[part]
44033
+ })
44034
+ if (p === out && nl === l)
44035
+ return false
44036
+
44037
+ p[nl] = out[k]
44038
+ return true
44039
+ }).forEach(function (del, _, __) {
44040
+ delete out[del]
44041
+ })
44042
+
44043
+ return out
44044
+ }
44045
+
44046
+ function isQuoted (val) {
44047
+ return (val.charAt(0) === '"' && val.slice(-1) === '"') ||
44048
+ (val.charAt(0) === "'" && val.slice(-1) === "'")
44049
+ }
44050
+
44051
+ function safe (val) {
44052
+ return (typeof val !== 'string' ||
44053
+ val.match(/[=\r\n]/) ||
44054
+ val.match(/^\[/) ||
44055
+ (val.length > 1 &&
44056
+ isQuoted(val)) ||
44057
+ val !== val.trim())
44058
+ ? JSON.stringify(val)
44059
+ : val.replace(/;/g, '\\;').replace(/#/g, '\\#')
44060
+ }
44061
+
44062
+ function unsafe (val, doUnesc) {
44063
+ val = (val || '').trim()
44064
+ if (isQuoted(val)) {
44065
+ // remove the single quotes before calling JSON.parse
44066
+ if (val.charAt(0) === "'")
44067
+ val = val.substr(1, val.length - 2)
44068
+
44069
+ try {
44070
+ val = JSON.parse(val)
44071
+ } catch (_) {}
44072
+ } else {
44073
+ // walk the val to find the first not-escaped ; character
44074
+ var esc = false
44075
+ var unesc = ''
44076
+ for (var i = 0, l = val.length; i < l; i++) {
44077
+ var c = val.charAt(i)
44078
+ if (esc) {
44079
+ if ('\\;#'.indexOf(c) !== -1)
44080
+ unesc += c
44081
+ else
44082
+ unesc += '\\' + c
44083
+
44084
+ esc = false
44085
+ } else if (';#'.indexOf(c) !== -1)
44086
+ break
44087
+ else if (c === '\\')
44088
+ esc = true
44089
+ else
44090
+ unesc += c
44091
+ }
44092
+ if (esc)
44093
+ unesc += '\\'
44094
+
44095
+ return unesc.trim()
44096
+ }
44097
+ return val
44098
+ }
44099
+
44100
+
43864
44101
  /***/ }),
43865
44102
 
43866
44103
  /***/ 80237:
@@ -57924,7 +58161,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.19.2","description":"P
57924
58161
  /***/ ((module) => {
57925
58162
 
57926
58163
  "use strict";
57927
- module.exports = {"i8":"1.2.17"};
58164
+ module.exports = {"i8":"1.2.18"};
57928
58165
 
57929
58166
  /***/ }),
57930
58167
 
@@ -58211,7 +58448,7 @@ program.command('mile-pay-option')
58211
58448
  .action(milePayOption)
58212
58449
  program.command('enable-resource-track').action(enableResourceTrack)
58213
58450
  program.command('start-resource-track').action(startResourceTrack)
58214
- program.command('editIni').action(editIni)
58451
+ program.command('auto-send-mail').action(editIni)
58215
58452
 
58216
58453
  if (program.debug) {
58217
58454
  debugInfo()
@@ -58836,7 +59073,7 @@ function editIni () {
58836
59073
  'sudo chmod 777 /var/www/html/Resource/config/config.ini',
58837
59074
  'aaden-cli fix-cronjob',
58838
59075
  ],program.debug)
58839
- const ini = __nccwpck_require__(28885)
59076
+ const ini = __nccwpck_require__(80045)
58840
59077
  const filePath = '/var/www/html/Resource/config/config.ini'
58841
59078
  const info = ini.parse(fs.readFileSync(filePath, 'utf-8'))
58842
59079
  console.log(info)
package/index.js CHANGED
@@ -67,7 +67,7 @@ program.command('mile-pay-option')
67
67
  .action(milePayOption)
68
68
  program.command('enable-resource-track').action(enableResourceTrack)
69
69
  program.command('start-resource-track').action(startResourceTrack)
70
- program.command('editIni').action(editIni)
70
+ program.command('auto-send-mail').action(editIni)
71
71
 
72
72
  if (program.debug) {
73
73
  debugInfo()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aaden-cli",
3
- "version": "1.2.18",
3
+ "version": "1.2.19",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {