aaden-cli 1.1.118 → 1.1.122

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/aws.js CHANGED
@@ -1,6 +1,5 @@
1
1
  const AWS = require('aws-sdk')
2
2
  const fs = require('fs')
3
- const loadIniFile = require('read-ini-file')
4
3
 
5
4
  const id = 'AKIA4TTJEQRYQ7CBPK5W'
6
5
  const secret = 'qhdoKOeKHGtCcbLfmNp7hx1ILVbHFbtLB4jEswFI'
@@ -26,7 +25,7 @@ const uploadFile = (fileName) => {
26
25
 
27
26
  const params = {
28
27
  Bucket: bucketName,
29
- Key: getMyDeviceId() + '/sql/' + 'backup.sql',
28
+ Key: getMyDeviceId() + '/backups/' + 'backup.sql',
30
29
  Body: fileContent
31
30
  }
32
31
 
package/dist/index.js CHANGED
@@ -7,7 +7,6 @@
7
7
 
8
8
  const AWS = __nccwpck_require__(71786)
9
9
  const fs = __nccwpck_require__(35747)
10
- const loadIniFile = __nccwpck_require__(89264)
11
10
 
12
11
  const id = 'AKIA4TTJEQRYQ7CBPK5W'
13
12
  const secret = 'qhdoKOeKHGtCcbLfmNp7hx1ILVbHFbtLB4jEswFI'
@@ -33,7 +32,7 @@ const uploadFile = (fileName) => {
33
32
 
34
33
  const params = {
35
34
  Bucket: bucketName,
36
- Key: getMyDeviceId() + '/sql/' + 'backup.sql',
35
+ Key: getMyDeviceId() + '/backups/' + 'backup.sql',
37
36
  Body: fileContent
38
37
  }
39
38
 
@@ -57463,7 +57462,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.19.2","description":"P
57463
57462
  /***/ ((module) => {
57464
57463
 
57465
57464
  "use strict";
57466
- module.exports = {"i8":"1.1.117"};
57465
+ module.exports = {"i8":"1.1.121"};
57467
57466
 
57468
57467
  /***/ }),
57469
57468
 
@@ -57720,7 +57719,7 @@ program.command('load-new-version').action(loadNewVersion) // auto execute.
57720
57719
  program.command('local-version').action(() => {
57721
57720
  console.log('storage:' + getStorageBackendFileVersion())
57722
57721
  })
57723
- program.command('backup [full]').action(backup)
57722
+ program.command('backup [noUpload]').action(backup)
57724
57723
  program.command('ngrok').action(startNgrokService)
57725
57724
  program.command('update-ngrok-config <deviceId>').action(updateNgrokConfig)
57726
57725
  program.command('get-database').action(getDatabase)
@@ -57950,7 +57949,7 @@ async function startNgrokService () {
57950
57949
  cli.executeInShell(command, program.debug)
57951
57950
  }
57952
57951
 
57953
- async function backup (full = true) {
57952
+ async function backup (noUpload = false) {
57954
57953
  const timeStamp = dayjs().format(InnerKenTimeStampFormat)
57955
57954
  const backupHome = 'appendBackup'
57956
57955
  const command = [
@@ -57960,7 +57959,7 @@ async function backup (full = true) {
57960
57959
  'sudo mkdir -p backups/' + timeStamp,
57961
57960
  'sudo chmod 777 backups/' + timeStamp,
57962
57961
  'cd backups/' + timeStamp,
57963
- `mysqldump aaden -uaaden -pInnerken322. ${full ? '-c' : '-c -t'} > ${timeStamp}@cli.sql`,
57962
+ `mysqldump aaden -uaaden -pInnerken322. -c> ${timeStamp}@cli.sql`,
57964
57963
  'cd',
57965
57964
  'sudo mkdir -p ' + backupHome,
57966
57965
  'sudo chmod 777 ' + backupHome,
@@ -57969,11 +57968,14 @@ async function backup (full = true) {
57969
57968
  ]
57970
57969
 
57971
57970
  cli.executeInShell(command, program.debug)
57972
- setTimeout(() => {
57973
- const homedir = __nccwpck_require__(12087).homedir()
57974
- const fileName = [homedir, 'backups', timeStamp, `${timeStamp}@cli.sql`].join('/')
57975
- uploadFile(fileName)
57976
- }, 8000)
57971
+ if(!noUpload){
57972
+ setTimeout(() => {
57973
+ const homedir = __nccwpck_require__(12087).homedir()
57974
+ const fileName = [homedir, 'backups', timeStamp, `${timeStamp}@cli.sql`].join('/')
57975
+ uploadFile(fileName)
57976
+ }, 8000)
57977
+ }
57978
+
57977
57979
 
57978
57980
 
57979
57981
  }
@@ -0,0 +1,21 @@
1
+ const fs = require('fs')
2
+ const sql = fs.readFileSync('sql/1.sql')
3
+
4
+
5
+ const queries = sql.toString().split(';')
6
+ const res = []
7
+ queries.forEach(q => {
8
+ // console.log(q)
9
+ const lines = q.split('\n')
10
+ // console.log(lines)
11
+ const tableName = lines.find(l => l.includes('INTO'))
12
+ if (tableName) {
13
+ const realTableName = tableName.split('`')[1]
14
+ const ids = lines.filter(l => l.includes('(')).map(l => l.split('(')[1].split(',')[0])
15
+ const query = 'Delete from ' + realTableName + ' where id in (' + ids.join(',') + ');'
16
+ // console.log(query)
17
+ res.push(query)
18
+ }
19
+
20
+ })
21
+ fs.writeFileSync('sql/clean.sql', res.join('\n'))
package/index.js CHANGED
@@ -37,7 +37,7 @@ program.command('load-new-version').action(loadNewVersion) // auto execute.
37
37
  program.command('local-version').action(() => {
38
38
  console.log('storage:' + getStorageBackendFileVersion())
39
39
  })
40
- program.command('backup [full]').action(backup)
40
+ program.command('backup [noUpload]').action(backup)
41
41
  program.command('ngrok').action(startNgrokService)
42
42
  program.command('update-ngrok-config <deviceId>').action(updateNgrokConfig)
43
43
  program.command('get-database').action(getDatabase)
@@ -267,7 +267,7 @@ async function startNgrokService () {
267
267
  cli.executeInShell(command, program.debug)
268
268
  }
269
269
 
270
- async function backup (full = true) {
270
+ async function backup (noUpload = false) {
271
271
  const timeStamp = dayjs().format(InnerKenTimeStampFormat)
272
272
  const backupHome = 'appendBackup'
273
273
  const command = [
@@ -277,7 +277,7 @@ async function backup (full = true) {
277
277
  'sudo mkdir -p backups/' + timeStamp,
278
278
  'sudo chmod 777 backups/' + timeStamp,
279
279
  'cd backups/' + timeStamp,
280
- `mysqldump aaden -uaaden -pInnerken322. ${full ? '-c' : '-c -t'} > ${timeStamp}@cli.sql`,
280
+ `mysqldump aaden -uaaden -pInnerken322. -c> ${timeStamp}@cli.sql`,
281
281
  'cd',
282
282
  'sudo mkdir -p ' + backupHome,
283
283
  'sudo chmod 777 ' + backupHome,
@@ -286,11 +286,14 @@ async function backup (full = true) {
286
286
  ]
287
287
 
288
288
  cli.executeInShell(command, program.debug)
289
- setTimeout(() => {
290
- const homedir = require('os').homedir()
291
- const fileName = [homedir, 'backups', timeStamp, `${timeStamp}@cli.sql`].join('/')
292
- uploadFile(fileName)
293
- }, 8000)
289
+ if(!noUpload){
290
+ setTimeout(() => {
291
+ const homedir = require('os').homedir()
292
+ const fileName = [homedir, 'backups', timeStamp, `${timeStamp}@cli.sql`].join('/')
293
+ uploadFile(fileName)
294
+ }, 8000)
295
+ }
296
+
294
297
 
295
298
 
296
299
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aaden-cli",
3
- "version": "1.1.118",
3
+ "version": "1.1.122",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {