@internxt/cli 1.6.4 → 1.6.6

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 (105) hide show
  1. package/README.md +94 -40
  2. package/dist/commands/add-cert.d.ts +4 -1
  3. package/dist/commands/add-cert.js +4 -1
  4. package/dist/commands/config.js +1 -0
  5. package/dist/commands/create-folder.js +1 -0
  6. package/dist/commands/delete-permanently-file.js +1 -0
  7. package/dist/commands/delete-permanently-folder.js +1 -0
  8. package/dist/commands/download-file.js +1 -0
  9. package/dist/commands/list.js +1 -0
  10. package/dist/commands/login-legacy.js +3 -0
  11. package/dist/commands/login.d.ts +2 -0
  12. package/dist/commands/login.js +4 -0
  13. package/dist/commands/logout.d.ts +4 -1
  14. package/dist/commands/logout.js +4 -1
  15. package/dist/commands/logs.d.ts +4 -1
  16. package/dist/commands/logs.js +4 -1
  17. package/dist/commands/move-file.js +1 -0
  18. package/dist/commands/move-folder.js +1 -0
  19. package/dist/commands/rename-file.js +1 -0
  20. package/dist/commands/rename-folder.js +1 -0
  21. package/dist/commands/trash-clear.js +1 -0
  22. package/dist/commands/trash-file.js +1 -0
  23. package/dist/commands/trash-folder.js +1 -0
  24. package/dist/commands/trash-list.d.ts +2 -0
  25. package/dist/commands/trash-list.js +2 -0
  26. package/dist/commands/trash-restore-file.js +1 -0
  27. package/dist/commands/trash-restore-folder.js +1 -0
  28. package/dist/commands/upload-file.js +16 -26
  29. package/dist/commands/upload-folder.js +1 -0
  30. package/dist/commands/webdav-config.js +1 -0
  31. package/dist/commands/webdav.d.ts +4 -1
  32. package/dist/commands/webdav.js +4 -1
  33. package/dist/commands/whoami.d.ts +4 -1
  34. package/dist/commands/whoami.js +4 -1
  35. package/dist/commands/workspaces-list.js +1 -0
  36. package/dist/commands/workspaces-unset.js +1 -0
  37. package/dist/commands/workspaces-use.js +1 -0
  38. package/dist/hooks/prerun/auth_check.js +2 -0
  39. package/dist/services/auth.service.js +10 -1
  40. package/dist/services/cache.service.d.ts +13 -0
  41. package/dist/services/cache.service.js +36 -0
  42. package/dist/services/config.service.js +19 -3
  43. package/dist/services/database/database.service.d.ts +1 -1
  44. package/dist/services/database/database.service.js +6 -5
  45. package/dist/services/database/drive-item/drive-item.attributes.d.ts +7 -0
  46. package/dist/services/database/drive-item/drive-item.domain.d.ts +10 -0
  47. package/dist/services/database/drive-item/drive-item.domain.js +27 -0
  48. package/dist/services/database/drive-item/drive-item.model.d.ts +8 -0
  49. package/dist/services/database/{drive-folder/drive-folder.model.js → drive-item/drive-item.model.js} +11 -23
  50. package/dist/services/database/drive-item/drive-item.repository.d.ts +12 -0
  51. package/dist/services/database/drive-item/drive-item.repository.js +88 -0
  52. package/dist/services/drive/drive-file.service.d.ts +2 -3
  53. package/dist/services/drive/drive-file.service.js +9 -34
  54. package/dist/services/drive/drive-folder.service.d.ts +1 -3
  55. package/dist/services/drive/drive-folder.service.js +9 -87
  56. package/dist/services/drive/drive-item.service.d.ts +8 -0
  57. package/dist/services/drive/drive-item.service.js +98 -0
  58. package/dist/services/network/network-facade.service.d.ts +1 -3
  59. package/dist/services/network/network-facade.service.js +5 -8
  60. package/dist/services/network/upload/upload-file.service.js +2 -1
  61. package/dist/services/thumbnail.service.js +2 -2
  62. package/dist/services/usage.service.d.ts +2 -0
  63. package/dist/services/usage.service.js +18 -0
  64. package/dist/utils/cli.utils.d.ts +5 -3
  65. package/dist/utils/cli.utils.js +36 -18
  66. package/dist/utils/format.utils.js +3 -2
  67. package/dist/utils/upload.utils.d.ts +19 -0
  68. package/dist/utils/upload.utils.js +40 -0
  69. package/dist/utils/webdav.utils.d.ts +4 -2
  70. package/dist/utils/webdav.utils.js +14 -18
  71. package/dist/utils/xml.utils.js +5 -1
  72. package/dist/webdav/handlers/DELETE.handler.js +2 -0
  73. package/dist/webdav/handlers/LOCK.handler.d.ts +5 -0
  74. package/dist/webdav/handlers/LOCK.handler.js +50 -0
  75. package/dist/webdav/handlers/MKCOL.handler.js +15 -3
  76. package/dist/webdav/handlers/MOVE.handler.js +11 -0
  77. package/dist/webdav/handlers/OPTIONS.handler.js +4 -4
  78. package/dist/webdav/handlers/PROPFIND.handler.js +30 -9
  79. package/dist/webdav/handlers/PUT.handler.js +44 -40
  80. package/dist/webdav/handlers/UNLOCK.handler.d.ts +5 -0
  81. package/dist/webdav/handlers/UNLOCK.handler.js +12 -0
  82. package/dist/webdav/middewares/auth.middleware.js +9 -2
  83. package/dist/webdav/middewares/errors.middleware.js +2 -0
  84. package/dist/webdav/middewares/request-logger.middleware.js +10 -6
  85. package/dist/webdav/middewares/webdav-auth.middleware.js +0 -3
  86. package/dist/webdav/webdav-server.js +4 -0
  87. package/oclif.manifest.json +134 -1
  88. package/package.json +47 -46
  89. package/dist/services/database/drive-file/drive-file.attributes.d.ts +0 -14
  90. package/dist/services/database/drive-file/drive-file.domain.d.ts +0 -20
  91. package/dist/services/database/drive-file/drive-file.domain.js +0 -68
  92. package/dist/services/database/drive-file/drive-file.model.d.ts +0 -15
  93. package/dist/services/database/drive-file/drive-file.model.js +0 -67
  94. package/dist/services/database/drive-file/drive-file.repository.d.ts +0 -11
  95. package/dist/services/database/drive-file/drive-file.repository.js +0 -63
  96. package/dist/services/database/drive-folder/drive-folder.attributes.d.ts +0 -10
  97. package/dist/services/database/drive-folder/drive-folder.attributes.js +0 -2
  98. package/dist/services/database/drive-folder/drive-folder.domain.d.ts +0 -16
  99. package/dist/services/database/drive-folder/drive-folder.domain.js +0 -53
  100. package/dist/services/database/drive-folder/drive-folder.model.d.ts +0 -11
  101. package/dist/services/database/drive-folder/drive-folder.repository.d.ts +0 -13
  102. package/dist/services/database/drive-folder/drive-folder.repository.js +0 -99
  103. package/dist/utils/database.utils.d.ts +0 -11
  104. package/dist/utils/database.utils.js +0 -26
  105. /package/dist/services/database/{drive-file/drive-file.attributes.js → drive-item/drive-item.attributes.js} +0 -0
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UNLOCKRequestHandler = void 0;
4
+ const logger_utils_1 = require("../../utils/logger.utils");
5
+ class UNLOCKRequestHandler {
6
+ handle = async (req, res) => {
7
+ const lockToken = req.headers['lock-token'] ?? 'unknown';
8
+ logger_utils_1.webdavLogger.info(`[UNLOCK] Released lock ${lockToken} for ${req.url}`);
9
+ res.status(204).send();
10
+ };
11
+ }
12
+ exports.UNLOCKRequestHandler = UNLOCKRequestHandler;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuthMiddleware = void 0;
4
4
  const sdk_manager_service_1 = require("../../services/sdk-manager.service");
5
5
  const auth_service_1 = require("../../services/auth.service");
6
+ const cache_service_1 = require("../../services/cache.service");
6
7
  const logger_utils_1 = require("../../utils/logger.utils");
7
8
  const xml_utils_1 = require("../../utils/xml.utils");
8
9
  const errors_utils_1 = require("../../utils/errors.utils");
@@ -10,8 +11,14 @@ const AuthMiddleware = () => {
10
11
  return (_, res, next) => {
11
12
  (async () => {
12
13
  try {
13
- const { token, workspace } = await auth_service_1.AuthService.instance.getAuthDetails();
14
- sdk_manager_service_1.SdkManager.init({ token, workspaceToken: workspace?.workspaceCredentials.token });
14
+ const cached = cache_service_1.CacheService.instance.get(cache_service_1.CacheService.AUTH_CACHE_KEY);
15
+ if (cached) {
16
+ sdk_manager_service_1.SdkManager.init({ token: cached.token, workspaceToken: cached.workspace?.workspaceCredentials?.token });
17
+ next();
18
+ return;
19
+ }
20
+ const authDetails = await auth_service_1.AuthService.instance.getAuthDetails();
21
+ cache_service_1.CacheService.instance.set(cache_service_1.CacheService.AUTH_CACHE_KEY, authDetails);
15
22
  next();
16
23
  }
17
24
  catch (error) {
@@ -19,6 +19,8 @@ const ErrorHandlingMiddleware = (err, req, res, _) => {
19
19
  if ('statusCode' in err && !Number.isNaN(err.statusCode)) {
20
20
  statusCode = err.statusCode;
21
21
  }
22
+ res.set('Content-Type', 'application/xml; charset="utf-8"');
22
23
  res.status(statusCode).send(errorBodyXML);
24
+ req.destroy();
23
25
  };
24
26
  exports.ErrorHandlingMiddleware = ErrorHandlingMiddleware;
@@ -3,16 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RequestLoggerMiddleware = void 0;
4
4
  const logger_utils_1 = require("../../utils/logger.utils");
5
5
  const RequestLoggerMiddleware = (config) => {
6
- return (req, _, next) => {
6
+ return (req, res, next) => {
7
7
  if (!config.enable)
8
8
  return next();
9
9
  if (config.methods && !config.methods.includes(req.method))
10
10
  return next();
11
- logger_utils_1.webdavLogger.info('WebDav request received\n' +
12
- `Method: ${req.method}\n` +
13
- `URL: ${req.url}\n` +
14
- `Body: ${JSON.stringify(req.body)}\n` +
15
- `Headers: ${JSON.stringify(req.headers)}`);
11
+ const start = Date.now();
12
+ const contentLength = req.headers['content-length'] ?? '0';
13
+ logger_utils_1.webdavLogger.info(`[${req.method}] ${req.url} - Start (${contentLength}B)`);
14
+ const originalEnd = res.end.bind(res);
15
+ res.end = function (...args) {
16
+ const duration = Date.now() - start;
17
+ logger_utils_1.webdavLogger.info(`[${req.method}] ${req.url} - ${res.statusCode} (${duration}ms)`);
18
+ return originalEnd(...args);
19
+ };
16
20
  next();
17
21
  };
18
22
  };
@@ -24,12 +24,10 @@ const WebDAVAuthMiddleware = (configs) => {
24
24
  }
25
25
  else {
26
26
  next();
27
- return;
28
27
  }
29
28
  }
30
29
  else {
31
30
  next();
32
- return;
33
31
  }
34
32
  })();
35
33
  };
@@ -40,5 +38,4 @@ const sendUnauthorizedError = (res, message) => {
40
38
  [xml_utils_1.XMLUtils.addDefaultNamespace('responsedescription')]: message,
41
39
  }, {}, 'error');
42
40
  res.status(401).send(errorBodyXML);
43
- return;
44
41
  };
@@ -25,6 +25,8 @@ const DELETE_handler_1 = require("./handlers/DELETE.handler");
25
25
  const PROPPATCH_handler_1 = require("./handlers/PROPPATCH.handler");
26
26
  const MOVE_handler_1 = require("./handlers/MOVE.handler");
27
27
  const COPY_handler_1 = require("./handlers/COPY.handler");
28
+ const LOCK_handler_1 = require("./handlers/LOCK.handler");
29
+ const UNLOCK_handler_1 = require("./handlers/UNLOCK.handler");
28
30
  const mkcol_middleware_1 = require("./middewares/mkcol.middleware");
29
31
  const webdav_auth_middleware_1 = require("./middewares/webdav-auth.middleware");
30
32
  class WebDavServer {
@@ -51,6 +53,8 @@ class WebDavServer {
51
53
  this.app.options(serverListenPath, (0, express_async_handler_1.default)(new OPTIONS_handler_1.OPTIONSRequestHandler().handle));
52
54
  this.app.propfind(serverListenPath, (0, express_async_handler_1.default)(new PROPFIND_handler_1.PROPFINDRequestHandler().handle));
53
55
  this.app.put(serverListenPath, (0, express_async_handler_1.default)(new PUT_handler_1.PUTRequestHandler().handle));
56
+ this.app.lock(serverListenPath, (0, express_async_handler_1.default)(new LOCK_handler_1.LOCKRequestHandler().handle));
57
+ this.app.unlock(serverListenPath, (0, express_async_handler_1.default)(new UNLOCK_handler_1.UNLOCKRequestHandler().handle));
54
58
  this.app.mkcol(serverListenPath, (0, express_async_handler_1.default)(new MKCOL_handler_1.MKCOLRequestHandler().handle));
55
59
  this.app.delete(serverListenPath, (0, express_async_handler_1.default)(new DELETE_handler_1.DELETERequestHandler().handle));
56
60
  this.app.proppatch(serverListenPath, (0, express_async_handler_1.default)(new PROPPATCH_handler_1.PROPPATCHRequestHandler().handle));
@@ -16,6 +16,25 @@
16
16
  "name": "json",
17
17
  "allowNo": false,
18
18
  "type": "boolean"
19
+ },
20
+ "non-interactive": {
21
+ "char": "x",
22
+ "description": "Prevents the CLI from being interactive. When enabled, the CLI will not request input through the console and will throw errors directly.",
23
+ "env": "INXT_NONINTERACTIVE",
24
+ "helpGroup": "helper",
25
+ "name": "non-interactive",
26
+ "required": false,
27
+ "allowNo": false,
28
+ "type": "boolean"
29
+ },
30
+ "debug": {
31
+ "description": "Enables debug mode. When enabled, the CLI will print debug messages to the console.",
32
+ "env": "INXT_DEBUG",
33
+ "helpGroup": "helper",
34
+ "name": "debug",
35
+ "required": false,
36
+ "allowNo": false,
37
+ "type": "boolean"
19
38
  }
20
39
  },
21
40
  "hasDynamicHelp": false,
@@ -548,6 +567,25 @@
548
567
  "allowNo": false,
549
568
  "type": "boolean"
550
569
  },
570
+ "non-interactive": {
571
+ "char": "x",
572
+ "description": "Prevents the CLI from being interactive. When enabled, the CLI will not request input through the console and will throw errors directly.",
573
+ "env": "INXT_NONINTERACTIVE",
574
+ "helpGroup": "helper",
575
+ "name": "non-interactive",
576
+ "required": false,
577
+ "allowNo": false,
578
+ "type": "boolean"
579
+ },
580
+ "debug": {
581
+ "description": "Enables debug mode. When enabled, the CLI will print debug messages to the console.",
582
+ "env": "INXT_DEBUG",
583
+ "helpGroup": "helper",
584
+ "name": "debug",
585
+ "required": false,
586
+ "allowNo": false,
587
+ "type": "boolean"
588
+ },
551
589
  "host": {
552
590
  "aliases": [
553
591
  "host"
@@ -604,6 +642,25 @@
604
642
  "name": "json",
605
643
  "allowNo": false,
606
644
  "type": "boolean"
645
+ },
646
+ "non-interactive": {
647
+ "char": "x",
648
+ "description": "Prevents the CLI from being interactive. When enabled, the CLI will not request input through the console and will throw errors directly.",
649
+ "env": "INXT_NONINTERACTIVE",
650
+ "helpGroup": "helper",
651
+ "name": "non-interactive",
652
+ "required": false,
653
+ "allowNo": false,
654
+ "type": "boolean"
655
+ },
656
+ "debug": {
657
+ "description": "Enables debug mode. When enabled, the CLI will print debug messages to the console.",
658
+ "env": "INXT_DEBUG",
659
+ "helpGroup": "helper",
660
+ "name": "debug",
661
+ "required": false,
662
+ "allowNo": false,
663
+ "type": "boolean"
607
664
  }
608
665
  },
609
666
  "hasDynamicHelp": false,
@@ -635,6 +692,25 @@
635
692
  "name": "json",
636
693
  "allowNo": false,
637
694
  "type": "boolean"
695
+ },
696
+ "non-interactive": {
697
+ "char": "x",
698
+ "description": "Prevents the CLI from being interactive. When enabled, the CLI will not request input through the console and will throw errors directly.",
699
+ "env": "INXT_NONINTERACTIVE",
700
+ "helpGroup": "helper",
701
+ "name": "non-interactive",
702
+ "required": false,
703
+ "allowNo": false,
704
+ "type": "boolean"
705
+ },
706
+ "debug": {
707
+ "description": "Enables debug mode. When enabled, the CLI will print debug messages to the console.",
708
+ "env": "INXT_DEBUG",
709
+ "helpGroup": "helper",
710
+ "name": "debug",
711
+ "required": false,
712
+ "allowNo": false,
713
+ "type": "boolean"
638
714
  }
639
715
  },
640
716
  "hasDynamicHelp": false,
@@ -1131,6 +1207,25 @@
1131
1207
  "allowNo": false,
1132
1208
  "type": "boolean"
1133
1209
  },
1210
+ "non-interactive": {
1211
+ "char": "x",
1212
+ "description": "Prevents the CLI from being interactive. When enabled, the CLI will not request input through the console and will throw errors directly.",
1213
+ "env": "INXT_NONINTERACTIVE",
1214
+ "helpGroup": "helper",
1215
+ "name": "non-interactive",
1216
+ "required": false,
1217
+ "allowNo": false,
1218
+ "type": "boolean"
1219
+ },
1220
+ "debug": {
1221
+ "description": "Enables debug mode. When enabled, the CLI will print debug messages to the console.",
1222
+ "env": "INXT_DEBUG",
1223
+ "helpGroup": "helper",
1224
+ "name": "debug",
1225
+ "required": false,
1226
+ "allowNo": false,
1227
+ "type": "boolean"
1228
+ },
1134
1229
  "extended": {
1135
1230
  "char": "e",
1136
1231
  "description": "Displays additional information in the trash list.",
@@ -1606,6 +1701,25 @@
1606
1701
  "name": "json",
1607
1702
  "allowNo": false,
1608
1703
  "type": "boolean"
1704
+ },
1705
+ "non-interactive": {
1706
+ "char": "x",
1707
+ "description": "Prevents the CLI from being interactive. When enabled, the CLI will not request input through the console and will throw errors directly.",
1708
+ "env": "INXT_NONINTERACTIVE",
1709
+ "helpGroup": "helper",
1710
+ "name": "non-interactive",
1711
+ "required": false,
1712
+ "allowNo": false,
1713
+ "type": "boolean"
1714
+ },
1715
+ "debug": {
1716
+ "description": "Enables debug mode. When enabled, the CLI will print debug messages to the console.",
1717
+ "env": "INXT_DEBUG",
1718
+ "helpGroup": "helper",
1719
+ "name": "debug",
1720
+ "required": false,
1721
+ "allowNo": false,
1722
+ "type": "boolean"
1609
1723
  }
1610
1724
  },
1611
1725
  "hasDynamicHelp": false,
@@ -1637,6 +1751,25 @@
1637
1751
  "name": "json",
1638
1752
  "allowNo": false,
1639
1753
  "type": "boolean"
1754
+ },
1755
+ "non-interactive": {
1756
+ "char": "x",
1757
+ "description": "Prevents the CLI from being interactive. When enabled, the CLI will not request input through the console and will throw errors directly.",
1758
+ "env": "INXT_NONINTERACTIVE",
1759
+ "helpGroup": "helper",
1760
+ "name": "non-interactive",
1761
+ "required": false,
1762
+ "allowNo": false,
1763
+ "type": "boolean"
1764
+ },
1765
+ "debug": {
1766
+ "description": "Enables debug mode. When enabled, the CLI will print debug messages to the console.",
1767
+ "env": "INXT_DEBUG",
1768
+ "helpGroup": "helper",
1769
+ "name": "debug",
1770
+ "required": false,
1771
+ "allowNo": false,
1772
+ "type": "boolean"
1640
1773
  }
1641
1774
  },
1642
1775
  "hasDynamicHelp": false,
@@ -1839,5 +1972,5 @@
1839
1972
  ]
1840
1973
  }
1841
1974
  },
1842
- "version": "1.6.4"
1975
+ "version": "1.6.6"
1843
1976
  }
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "author": "Internxt <hello@internxt.com>",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "Internxt CLI to manage your encrypted storage",
5
5
  "scripts": {
6
- "build": "yarn clean && tsc",
6
+ "build": "npm run clean && tsc",
7
7
  "clean": "rimraf dist coverage tsconfig.tsbuildinfo oclif.manifest.json",
8
8
  "lint": "eslint .",
9
9
  "format": "prettier --write **/*.{js,jsx,tsx,ts}",
10
10
  "postpack": "rimraf oclif.manifest.json",
11
- "posttest": "yarn lint",
12
- "prepack": "yarn build && oclif manifest && oclif readme",
11
+ "posttest": "npm run lint",
12
+ "prepack": "npm run build && oclif manifest && oclif readme",
13
13
  "prepare": "husky || true",
14
- "test": "yarn test:unit",
14
+ "test": "npm run test:unit",
15
15
  "test:unit": "vitest run --coverage",
16
16
  "test:watch": "vitest watch",
17
17
  "dev:webdav": "nodemon -e ts --exec ts-node src/webdav/index.ts",
@@ -37,63 +37,64 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@dashlane/pqc-kem-kyber512-node": "1.0.0",
40
- "@inquirer/prompts": "8.3.2",
41
- "@internxt/inxt-js": "3.0.2",
42
- "@internxt/lib": "1.4.1",
43
- "@internxt/sdk": "1.15.4",
44
- "@oclif/core": "4.9.0",
45
- "@oclif/plugin-autocomplete": "3.2.41",
46
- "axios": "1.13.6",
47
- "better-sqlite3": "12.8.0",
40
+ "@inquirer/prompts": "8.5.2",
41
+ "@internxt/inxt-js": "3.3.1",
42
+ "@internxt/lib": "1.4.2",
43
+ "@internxt/sdk": "1.17.9",
44
+ "@oclif/core": "4.11.10",
45
+ "@oclif/plugin-autocomplete": "3.2.52",
46
+ "axios": "1.18.0",
47
+ "better-sqlite3": "12.11.1",
48
48
  "bip39": "3.1.0",
49
- "body-parser": "2.2.2",
49
+ "body-parser": "2.3.0",
50
50
  "cli-progress": "3.12.0",
51
- "dayjs": "1.11.20",
52
- "dotenv": "17.3.1",
51
+ "dayjs": "1.11.21",
52
+ "dotenv": "17.4.2",
53
53
  "express": "5.2.1",
54
54
  "express-async-handler": "1.2.0",
55
- "fast-xml-parser": "5.5.6",
55
+ "fast-xml-builder": "1.2.0",
56
+ "fast-xml-parser": "5.9.3",
56
57
  "hash-wasm": "4.12.0",
57
58
  "mime-types": "3.0.2",
58
59
  "open": "11.0.0",
59
- "openpgp": "6.3.0",
60
- "otpauth": "9.5.0",
61
- "pm2": "6.0.14",
60
+ "openpgp": "6.3.1",
61
+ "otpauth": "9.5.1",
62
+ "pm2": "7.0.1",
62
63
  "range-parser": "1.2.1",
63
64
  "selfsigned": "5.5.0",
64
65
  "tty-table": "5.0.0",
65
- "typeorm": "0.3.28",
66
+ "typeorm": "1.0.0",
66
67
  "winston": "3.19.0"
67
68
  },
68
69
  "devDependencies": {
69
- "@internxt/eslint-config-internxt": "2.1.0",
70
- "@internxt/prettier-config": "internxt/prettier-config#v1.0.2",
71
- "@openpgp/web-stream-tools": "0.3.0",
72
- "@types/cli-progress": "3.11.6",
73
- "@types/express": "5.0.6",
74
- "@types/mime-types": "3.0.1",
75
- "@types/node": "25.5.0",
76
- "@types/range-parser": "1.2.7",
77
- "@vitest/coverage-istanbul": "4.1.0",
78
- "@vitest/spy": "4.1.0",
79
- "eslint": "10.0.3",
80
- "husky": "9.1.7",
81
- "lint-staged": "16.4.0",
82
- "nodemon": "3.1.14",
83
- "oclif": "4.22.92",
84
- "prettier": "3.8.1",
85
- "rimraf": "6.1.3",
86
- "sql.js": "1.14.1",
87
- "ts-node": "10.9.2",
88
- "typescript": "5.9.3",
89
- "vitest": "4.1.0",
90
- "vitest-mock-express": "2.2.0"
70
+ "@internxt/eslint-config-internxt": "^2.1.0",
71
+ "@internxt/prettier-config": "^2.0.1",
72
+ "@openpgp/web-stream-tools": "^0.3.1",
73
+ "@types/cli-progress": "^3.11.6",
74
+ "@types/express": "^5.0.6",
75
+ "@types/mime-types": "^3.0.1",
76
+ "@types/node": "^26.0.0",
77
+ "@types/range-parser": "^1.2.7",
78
+ "@vitest/coverage-istanbul": "^4.1.9",
79
+ "@vitest/spy": "^4.1.9",
80
+ "eslint": "^10.5.0",
81
+ "husky": "^9.1.7",
82
+ "lint-staged": "^17.0.8",
83
+ "nodemon": "^3.1.14",
84
+ "oclif": "^4.23.19",
85
+ "prettier": "^3.8.4",
86
+ "rimraf": "^6.1.3",
87
+ "sql.js": "^1.14.1",
88
+ "ts-node": "^10.9.2",
89
+ "typescript": "^6.0.3",
90
+ "vitest": "^4.1.9",
91
+ "vitest-mock-express": "^2.2.0"
91
92
  },
92
93
  "optionalDependencies": {
93
- "sharp": "0.34.5"
94
+ "sharp": "0.35.2"
94
95
  },
95
96
  "engines": {
96
- "node": ">=22.13.0"
97
+ "node": "^22.13.0 || >=24.11.0"
97
98
  },
98
99
  "bin": {
99
100
  "internxt": "./bin/run.js"
@@ -115,7 +116,7 @@
115
116
  }
116
117
  },
117
118
  "lint-staged": {
118
- "*.{js,jsx,tsx,ts}": [
119
+ "*.{js,jsx,tsx,ts,cjs,mjs}": [
119
120
  "prettier --write"
120
121
  ]
121
122
  }
@@ -1,14 +0,0 @@
1
- export interface DriveFileAttributes {
2
- uuid: string;
3
- name: string;
4
- type: string | null;
5
- fileId: string | null;
6
- folderUuid: string;
7
- bucket: string;
8
- createdAt: Date;
9
- updatedAt: Date;
10
- size: number;
11
- status: 'EXISTS' | 'TRASHED' | 'DELETED';
12
- creationTime: Date;
13
- modificationTime: Date;
14
- }
@@ -1,20 +0,0 @@
1
- import { DriveFileItem } from '../../../types/drive.types';
2
- import { DriveFileAttributes } from './drive-file.attributes';
3
- export declare class DriveFile implements DriveFileAttributes {
4
- name: string;
5
- type: string | null;
6
- uuid: string;
7
- fileId: string | null;
8
- folderUuid: string;
9
- bucket: string;
10
- createdAt: Date;
11
- updatedAt: Date;
12
- size: number;
13
- status: 'EXISTS' | 'TRASHED' | 'DELETED';
14
- creationTime: Date;
15
- modificationTime: Date;
16
- constructor({ name, type, uuid, fileId, folderUuid, bucket, createdAt, updatedAt, size, status, creationTime, modificationTime, }: DriveFileAttributes);
17
- static build(file: DriveFileAttributes): DriveFile;
18
- toJSON(): DriveFileAttributes;
19
- toItem(): DriveFileItem;
20
- }
@@ -1,68 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DriveFile = void 0;
4
- class DriveFile {
5
- name;
6
- type;
7
- uuid;
8
- fileId;
9
- folderUuid;
10
- bucket;
11
- createdAt;
12
- updatedAt;
13
- size;
14
- status;
15
- creationTime;
16
- modificationTime;
17
- constructor({ name, type, uuid, fileId, folderUuid, bucket, createdAt, updatedAt, size, status, creationTime, modificationTime, }) {
18
- this.name = name;
19
- this.type = type;
20
- this.uuid = uuid;
21
- this.fileId = fileId;
22
- this.folderUuid = folderUuid;
23
- this.bucket = bucket;
24
- this.createdAt = createdAt;
25
- this.updatedAt = updatedAt;
26
- this.size = size;
27
- this.status = status;
28
- this.creationTime = creationTime;
29
- this.modificationTime = modificationTime;
30
- }
31
- static build(file) {
32
- return new DriveFile(file);
33
- }
34
- toJSON() {
35
- return {
36
- name: this.name,
37
- type: this.type,
38
- uuid: this.uuid,
39
- fileId: this.fileId,
40
- folderUuid: this.folderUuid,
41
- bucket: this.bucket,
42
- createdAt: this.createdAt,
43
- updatedAt: this.updatedAt,
44
- size: this.size,
45
- status: this.status,
46
- creationTime: this.creationTime,
47
- modificationTime: this.modificationTime,
48
- };
49
- }
50
- toItem() {
51
- return {
52
- itemType: 'file',
53
- name: this.name,
54
- type: this.type,
55
- uuid: this.uuid,
56
- fileId: this.fileId,
57
- folderUuid: this.folderUuid,
58
- bucket: this.bucket,
59
- createdAt: this.createdAt,
60
- updatedAt: this.updatedAt,
61
- size: this.size,
62
- status: this.status,
63
- creationTime: this.creationTime,
64
- modificationTime: this.modificationTime,
65
- };
66
- }
67
- }
68
- exports.DriveFile = DriveFile;
@@ -1,15 +0,0 @@
1
- import { DriveFileAttributes } from './drive-file.attributes';
2
- export declare class DriveFileModel implements DriveFileAttributes {
3
- uuid: string;
4
- name: string;
5
- type: string | null;
6
- fileId: string | null;
7
- folderUuid: string;
8
- bucket: string;
9
- createdAt: Date;
10
- updatedAt: Date;
11
- size: number;
12
- status: 'EXISTS' | 'TRASHED' | 'DELETED';
13
- creationTime: Date;
14
- modificationTime: Date;
15
- }
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DriveFileModel = void 0;
13
- const typeorm_1 = require("typeorm");
14
- let DriveFileModel = class DriveFileModel {
15
- };
16
- exports.DriveFileModel = DriveFileModel;
17
- __decorate([
18
- (0, typeorm_1.PrimaryColumn)({ nullable: false, type: 'varchar' }),
19
- __metadata("design:type", String)
20
- ], DriveFileModel.prototype, "uuid", void 0);
21
- __decorate([
22
- (0, typeorm_1.Column)({ nullable: false, type: 'varchar' }),
23
- __metadata("design:type", String)
24
- ], DriveFileModel.prototype, "name", void 0);
25
- __decorate([
26
- (0, typeorm_1.Column)({ nullable: true, type: 'varchar' }),
27
- __metadata("design:type", Object)
28
- ], DriveFileModel.prototype, "type", void 0);
29
- __decorate([
30
- (0, typeorm_1.Column)({ nullable: true, type: 'varchar' }),
31
- __metadata("design:type", Object)
32
- ], DriveFileModel.prototype, "fileId", void 0);
33
- __decorate([
34
- (0, typeorm_1.Column)({ nullable: false, type: 'varchar' }),
35
- __metadata("design:type", String)
36
- ], DriveFileModel.prototype, "folderUuid", void 0);
37
- __decorate([
38
- (0, typeorm_1.Column)({ nullable: false, type: 'varchar' }),
39
- __metadata("design:type", String)
40
- ], DriveFileModel.prototype, "bucket", void 0);
41
- __decorate([
42
- (0, typeorm_1.Column)({ nullable: false, type: 'varchar' }),
43
- __metadata("design:type", Date)
44
- ], DriveFileModel.prototype, "createdAt", void 0);
45
- __decorate([
46
- (0, typeorm_1.Column)({ nullable: false, type: 'varchar' }),
47
- __metadata("design:type", Date)
48
- ], DriveFileModel.prototype, "updatedAt", void 0);
49
- __decorate([
50
- (0, typeorm_1.Column)({ nullable: false, type: 'bigint' }),
51
- __metadata("design:type", Number)
52
- ], DriveFileModel.prototype, "size", void 0);
53
- __decorate([
54
- (0, typeorm_1.Column)({ nullable: false, type: 'varchar' }),
55
- __metadata("design:type", String)
56
- ], DriveFileModel.prototype, "status", void 0);
57
- __decorate([
58
- (0, typeorm_1.Column)({ nullable: false, type: 'varchar' }),
59
- __metadata("design:type", Date)
60
- ], DriveFileModel.prototype, "creationTime", void 0);
61
- __decorate([
62
- (0, typeorm_1.Column)({ nullable: false, type: 'varchar' }),
63
- __metadata("design:type", Date)
64
- ], DriveFileModel.prototype, "modificationTime", void 0);
65
- exports.DriveFileModel = DriveFileModel = __decorate([
66
- (0, typeorm_1.Entity)('drive_file')
67
- ], DriveFileModel);
@@ -1,11 +0,0 @@
1
- import { DriveFile } from './drive-file.domain';
2
- import { DriveFileModel } from './drive-file.model';
3
- export declare class FileRepository {
4
- static readonly instance: FileRepository;
5
- private readonly fileRepository;
6
- createOrUpdate: (files: DriveFileModel[]) => Promise<DriveFile[] | undefined>;
7
- updateByUuid: (uuid: string, update: Partial<DriveFileModel>) => Promise<import("typeorm").UpdateResult | undefined>;
8
- delete: (uuids: string[]) => Promise<import("typeorm").DeleteResult | undefined>;
9
- deleteByParentUuid: (parentUuid: string) => Promise<import("typeorm").DeleteResult | undefined>;
10
- getByParentUuidNameAndType: (parentUuid: string, name: string, type: string | null) => Promise<DriveFile | undefined>;
11
- }