@fdm-monster/server 1.5.4 → 1.6.0-rc1

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 (155) hide show
  1. package/.env.template +7 -0
  2. package/README.md +2 -1
  3. package/dist/consoles/upload-test.js +52 -0
  4. package/dist/consoles/upload-test.js.map +1 -0
  5. package/dist/constants/event.constants.js.map +1 -1
  6. package/dist/constants/service.constants.js +3 -18
  7. package/dist/constants/service.constants.js.map +1 -1
  8. package/dist/controllers/custom-gcode.controller.js.map +1 -1
  9. package/dist/controllers/printer-files.controller.js +9 -42
  10. package/dist/controllers/printer-files.controller.js.map +1 -1
  11. package/dist/entities/base.entity.js +29 -0
  12. package/dist/entities/base.entity.js.map +1 -0
  13. package/dist/models/Printer.js +4 -43
  14. package/dist/models/Printer.js.map +1 -1
  15. package/dist/models/PrinterFile.js +81 -0
  16. package/dist/models/PrinterFile.js.map +1 -0
  17. package/dist/models/index.js +4 -0
  18. package/dist/models/index.js.map +1 -1
  19. package/dist/mongo-migrations/20231202183902-printer-files-simpler.js +41 -0
  20. package/dist/mongo-migrations/20231202183902-printer-files-simpler.js.map +1 -0
  21. package/dist/server.constants.js +1 -1
  22. package/dist/services/core/multer.service.js +3 -3
  23. package/dist/services/core/multer.service.js.map +1 -1
  24. package/dist/services/interfaces/print-completion.dto.js +0 -2
  25. package/dist/services/interfaces/print-completion.dto.js.map +1 -1
  26. package/dist/services/interfaces/print-completion.interface.js +6 -0
  27. package/dist/services/interfaces/{print-completion.service.js.map → print-completion.interface.js.map} +1 -1
  28. package/dist/services/interfaces/printer-file.dto.js +3 -1
  29. package/dist/services/interfaces/printer-file.dto.js.map +1 -1
  30. package/dist/services/octoprint/dto/connection-state.dto.js +46 -0
  31. package/dist/services/octoprint/dto/connection-state.dto.js.map +1 -0
  32. package/dist/services/octoprint/dto/octoprint-currentuser.dto.js +6 -0
  33. package/dist/services/octoprint/dto/octoprint-currentuser.dto.js.map +1 -0
  34. package/dist/services/octoprint/dto/octoprint-event.dto.js +41 -0
  35. package/dist/services/octoprint/dto/octoprint-event.dto.js.map +1 -0
  36. package/dist/services/octoprint/dto/octoprint-file.dto.js +84 -0
  37. package/dist/services/octoprint/dto/octoprint-file.dto.js.map +1 -0
  38. package/dist/services/octoprint/dto/octoprint-files.dto.js +17 -0
  39. package/dist/services/octoprint/dto/octoprint-files.dto.js.map +1 -0
  40. package/dist/services/{interfaces/print-completion.service.js → octoprint/dto/octoprint-session.dto.js} +1 -1
  41. package/dist/services/octoprint/dto/octoprint-session.dto.js.map +1 -0
  42. package/dist/services/octoprint/dto/octoprint-settings.dto.js +29 -0
  43. package/dist/services/octoprint/dto/octoprint-settings.dto.js.map +1 -0
  44. package/dist/services/octoprint/dto/octoprint-system-info.dto.js +41 -0
  45. package/dist/services/octoprint/dto/octoprint-system-info.dto.js.map +1 -0
  46. package/dist/services/octoprint/dto/state.dto.js +38 -0
  47. package/dist/services/octoprint/dto/state.dto.js.map +1 -0
  48. package/dist/services/octoprint/dto/websocket-output/connection-message.dto.js +6 -0
  49. package/dist/services/octoprint/dto/websocket-output/connection-message.dto.js.map +1 -0
  50. package/dist/services/octoprint/dto/websocket-output/current-message.dto.js +6 -0
  51. package/dist/services/octoprint/dto/websocket-output/current-message.dto.js.map +1 -0
  52. package/dist/services/octoprint/dto/websocket-output/event-message.dto.js +6 -0
  53. package/dist/services/octoprint/dto/websocket-output/event-message.dto.js.map +1 -0
  54. package/dist/services/octoprint/dto/websocket-output/event.type.js +54 -0
  55. package/dist/services/octoprint/dto/websocket-output/event.type.js.map +1 -0
  56. package/dist/services/octoprint/dto/websocket-output/events/client-authed.dto.js +6 -0
  57. package/dist/services/octoprint/dto/websocket-output/events/client-authed.dto.js.map +1 -0
  58. package/dist/services/octoprint/dto/websocket-output/events/client-closed.dto.js +6 -0
  59. package/dist/services/octoprint/dto/websocket-output/events/client-closed.dto.js.map +1 -0
  60. package/dist/services/octoprint/dto/websocket-output/events/client-opened.dto.js +6 -0
  61. package/dist/services/octoprint/dto/websocket-output/events/client-opened.dto.js.map +1 -0
  62. package/dist/services/octoprint/dto/websocket-output/events/dwelling.dto.js +6 -0
  63. package/dist/services/octoprint/dto/websocket-output/events/dwelling.dto.js.map +1 -0
  64. package/dist/services/octoprint/dto/websocket-output/events/file-added.dto.js +6 -0
  65. package/dist/services/octoprint/dto/websocket-output/events/file-added.dto.js.map +1 -0
  66. package/dist/services/octoprint/dto/websocket-output/events/file-deselected.dto.js +6 -0
  67. package/dist/services/octoprint/dto/websocket-output/events/file-deselected.dto.js.map +1 -0
  68. package/dist/services/octoprint/dto/websocket-output/events/file-removed.dto.js +6 -0
  69. package/dist/services/octoprint/dto/websocket-output/events/file-removed.dto.js.map +1 -0
  70. package/dist/services/octoprint/dto/websocket-output/events/folder-added.dto.js +6 -0
  71. package/dist/services/octoprint/dto/websocket-output/events/folder-added.dto.js.map +1 -0
  72. package/dist/services/octoprint/dto/websocket-output/events/home.dto.js +6 -0
  73. package/dist/services/octoprint/dto/websocket-output/events/home.dto.js.map +1 -0
  74. package/dist/services/octoprint/dto/websocket-output/events/metadata-analysis-finished.dto.js +6 -0
  75. package/dist/services/octoprint/dto/websocket-output/events/metadata-analysis-finished.dto.js.map +1 -0
  76. package/dist/services/octoprint/dto/websocket-output/events/metadata-analysis-started.dto.js +6 -0
  77. package/dist/services/octoprint/dto/websocket-output/events/metadata-analysis-started.dto.js.map +1 -0
  78. package/dist/services/octoprint/dto/websocket-output/events/metadata-statistics-updated.dto.js +6 -0
  79. package/dist/services/octoprint/dto/websocket-output/events/metadata-statistics-updated.dto.js.map +1 -0
  80. package/dist/services/octoprint/dto/websocket-output/events/position-update.dto.js +6 -0
  81. package/dist/services/octoprint/dto/websocket-output/events/position-update.dto.js.map +1 -0
  82. package/dist/services/octoprint/dto/websocket-output/events/print-cancelled.dto.js +6 -0
  83. package/dist/services/octoprint/dto/websocket-output/events/print-cancelled.dto.js.map +1 -0
  84. package/dist/services/octoprint/dto/websocket-output/events/print-cancelling.dto.js +6 -0
  85. package/dist/services/octoprint/dto/websocket-output/events/print-cancelling.dto.js.map +1 -0
  86. package/dist/services/octoprint/dto/websocket-output/events/print-done.dto.js +6 -0
  87. package/dist/services/octoprint/dto/websocket-output/events/print-done.dto.js.map +1 -0
  88. package/dist/services/octoprint/dto/websocket-output/events/print-failed.dto.js +6 -0
  89. package/dist/services/octoprint/dto/websocket-output/events/print-failed.dto.js.map +1 -0
  90. package/dist/services/octoprint/dto/websocket-output/events/print-paused.dto.js +6 -0
  91. package/dist/services/octoprint/dto/websocket-output/events/print-paused.dto.js.map +1 -0
  92. package/dist/services/octoprint/dto/websocket-output/events/print-resumed.dto.js +6 -0
  93. package/dist/services/octoprint/dto/websocket-output/events/print-resumed.dto.js.map +1 -0
  94. package/dist/services/octoprint/dto/websocket-output/events/print-started.dto.js +6 -0
  95. package/dist/services/octoprint/dto/websocket-output/events/print-started.dto.js.map +1 -0
  96. package/dist/services/octoprint/dto/websocket-output/events/printer-state-changed.dto.js +6 -0
  97. package/dist/services/octoprint/dto/websocket-output/events/printer-state-changed.dto.js.map +1 -0
  98. package/dist/services/octoprint/dto/websocket-output/events/transfer-done.dto.js +6 -0
  99. package/dist/services/octoprint/dto/websocket-output/events/transfer-done.dto.js.map +1 -0
  100. package/dist/services/octoprint/dto/websocket-output/events/transfer-started.dto.js +6 -0
  101. package/dist/services/octoprint/dto/websocket-output/events/transfer-started.dto.js.map +1 -0
  102. package/dist/services/octoprint/dto/websocket-output/events/updated-files.dto.js +6 -0
  103. package/dist/services/octoprint/dto/websocket-output/events/updated-files.dto.js.map +1 -0
  104. package/dist/services/octoprint/dto/websocket-output/events/upload.dto.js +6 -0
  105. package/dist/services/octoprint/dto/websocket-output/events/upload.dto.js.map +1 -0
  106. package/dist/services/octoprint/dto/websocket-output/events/user-logged-in.dto.js +6 -0
  107. package/dist/services/octoprint/dto/websocket-output/events/user-logged-in.dto.js.map +1 -0
  108. package/dist/services/octoprint/dto/websocket-output/events/z-change.dto.js +6 -0
  109. package/dist/services/octoprint/dto/websocket-output/events/z-change.dto.js.map +1 -0
  110. package/dist/services/octoprint/dto/websocket-output/history-message.dto.js +6 -0
  111. package/dist/services/octoprint/dto/websocket-output/history-message.dto.js.map +1 -0
  112. package/dist/services/octoprint/dto/websocket-output/plugin-message.dto.js +6 -0
  113. package/dist/services/octoprint/dto/websocket-output/plugin-message.dto.js.map +1 -0
  114. package/dist/services/octoprint/dto/websocket-output/timelapse-message.dto.js +6 -0
  115. package/dist/services/octoprint/dto/websocket-output/timelapse-message.dto.js.map +1 -0
  116. package/dist/services/octoprint/octoprint-api.routes.js +15 -15
  117. package/dist/services/octoprint/octoprint-api.routes.js.map +1 -1
  118. package/dist/services/octoprint/octoprint-api.service.js +186 -138
  119. package/dist/services/octoprint/octoprint-api.service.js.map +1 -1
  120. package/dist/services/octoprint/octoprint-sockio.adapter.js +45 -47
  121. package/dist/services/octoprint/octoprint-sockio.adapter.js.map +1 -1
  122. package/dist/services/octoprint/utils/api.utils.js +0 -35
  123. package/dist/services/octoprint/utils/api.utils.js.map +1 -1
  124. package/dist/services/orm/base.interface.js +6 -0
  125. package/dist/services/orm/base.interface.js.map +1 -0
  126. package/dist/services/orm/base.service.js +69 -0
  127. package/dist/services/orm/base.service.js.map +1 -0
  128. package/dist/services/print-completion.service.js +0 -1
  129. package/dist/services/print-completion.service.js.map +1 -1
  130. package/dist/services/printer-files.service.js +70 -49
  131. package/dist/services/printer-files.service.js.map +1 -1
  132. package/dist/services/printer.service.js +0 -2
  133. package/dist/services/printer.service.js.map +1 -1
  134. package/dist/shared/dtos/printer-login.dto.js +58 -0
  135. package/dist/shared/dtos/printer-login.dto.js.map +1 -0
  136. package/dist/{utils → shared}/websocket.adapter.js +3 -3
  137. package/dist/shared/websocket.adapter.js.map +1 -0
  138. package/dist/state/file-upload-tracker.cache.js.map +1 -1
  139. package/dist/state/file.cache.js +19 -35
  140. package/dist/state/file.cache.js.map +1 -1
  141. package/dist/state/printer-events.cache.js.map +1 -1
  142. package/dist/state/printer-files.store.js +15 -18
  143. package/dist/state/printer-files.store.js.map +1 -1
  144. package/dist/state/printer.cache.js.map +1 -1
  145. package/dist/state/settings.store.js +6 -1
  146. package/dist/state/settings.store.js.map +1 -1
  147. package/dist/tasks/print-completion.socketio.task.js +13 -18
  148. package/dist/tasks/print-completion.socketio.task.js.map +1 -1
  149. package/dist/tasks/printer-websocket.task.js.map +1 -1
  150. package/dist/utils/env.utils.js +0 -10
  151. package/dist/utils/env.utils.js.map +1 -1
  152. package/package.json +43 -33
  153. package/dist/utils/find-predicate.utils.js +0 -18
  154. package/dist/utils/find-predicate.utils.js.map +0 -1
  155. package/dist/utils/websocket.adapter.js.map +0 -1
package/.env.template CHANGED
@@ -44,3 +44,10 @@ OVERRIDE_DEMO_ROLE=ADMIN
44
44
 
45
45
  # Debug express routes
46
46
  DEBUG_ROUTES=false
47
+
48
+ # Enables TypeORM
49
+ ENABLE_EXPERIMENTAL_TYPEORM=false
50
+ # Saves SQLite database to ./database/fdm-monster.sqlite
51
+ DATABASE_PATH=./database
52
+ # Optional, default: fdm-monster.sqlite
53
+ DATABASE_FILE=fdm-monster.sqlite
package/README.md CHANGED
@@ -61,7 +61,7 @@ Please join the discord, but stay professional and proactive!
61
61
  These are the people involved in the project. Find the meaning of the emoji keys [here](https://allcontributors.org/docs/en/emoji-key).
62
62
 
63
63
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
64
- [![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors-)
64
+ [![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors-)
65
65
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
66
66
 
67
67
  <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
@@ -82,6 +82,7 @@ These are the people involved in the project. Find the meaning of the emoji keys
82
82
  <td align="center" valign="top" width="14.28%"><a href="http://www.tophattwaffle.com"><img src="https://avatars.githubusercontent.com/u/6774125?v=4?s=80" width="80px;" alt="tophattwaffle"/><br /><sub><b>tophattwaffle</b></sub></a><br /><a href="https://github.com/fdm-monster/fdm-monster/issues?q=author%3Atophattwaffle" title="Bug reports">🐛</a> <a href="#ideas-tophattwaffle" title="Ideas, Planning, & Feedback">🤔</a></td>
83
83
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/rmhenn"><img src="https://avatars.githubusercontent.com/u/22482801?v=4?s=80" width="80px;" alt="rmhenn"/><br /><sub><b>rmhenn</b></sub></a><br /><a href="#ideas-rmhenn" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/fdm-monster/fdm-monster/issues?q=author%3Armhenn" title="Bug reports">🐛</a></td>
84
84
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/cyrixdx4"><img src="https://avatars.githubusercontent.com/u/62126724?v=4?s=80" width="80px;" alt="cyrixdx4"/><br /><sub><b>cyrixdx4</b></sub></a><br /><a href="https://github.com/fdm-monster/fdm-monster/issues?q=author%3Acyrixdx4" title="Bug reports">🐛</a></td>
85
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/doucettom"><img src="https://avatars.githubusercontent.com/u/6595645?v=4?s=80" width="80px;" alt="doucettom"/><br /><sub><b>doucettom</b></sub></a><br /><a href="https://github.com/fdm-monster/fdm-monster/issues?q=author%3Adoucettom" title="Bug reports">🐛</a></td>
85
86
  </tr>
86
87
  </tbody>
87
88
  </table>
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const Parser = require("stream-parser");
6
+ const inherits = require("util").inherits;
7
+ const Transform = require("stream").Transform;
8
+ function Throttle(opts) {
9
+ if (!(this instanceof Throttle)) return new Throttle(opts);
10
+ if ("number" == typeof opts) opts = {
11
+ bps: opts
12
+ };
13
+ if (!opts) opts = {};
14
+ if (null == opts.lowWaterMark) opts.lowWaterMark = 0;
15
+ if (null == opts.highWaterMark) opts.highWaterMark = 0;
16
+ if (null == opts.bps) throw new Error('must pass a "bps" bytes-per-second option');
17
+ if (null == opts.chunkSize) opts.chunkSize = opts.bps / 10 | 0;
18
+ Transform.call(this, opts);
19
+ this.bps = opts.bps;
20
+ this.chunkSize = Math.max(1, opts.chunkSize);
21
+ this.totalBytes = 0;
22
+ this.startTime = Date.now();
23
+ this._passthroughChunk();
24
+ }
25
+ inherits(Throttle, Transform);
26
+ Parser(Throttle.prototype);
27
+ Throttle.prototype._passthroughChunk = function() {
28
+ this._passthrough(this.chunkSize, this._onchunk);
29
+ this.totalBytes += this.chunkSize;
30
+ };
31
+ Throttle.prototype._onchunk = function(output, done) {
32
+ const self = this;
33
+ const totalSeconds = (Date.now() - this.startTime) / 1000;
34
+ const expected = totalSeconds * this.bps;
35
+ function d() {
36
+ self._passthroughChunk();
37
+ done();
38
+ }
39
+ if (this.totalBytes > expected) {
40
+ const remainder = this.totalBytes - expected;
41
+ const sleepTime = remainder / this.bps * 1000;
42
+ if (sleepTime > 0) {
43
+ setTimeout(d, sleepTime);
44
+ } else {
45
+ d();
46
+ }
47
+ } else {
48
+ d();
49
+ }
50
+ };
51
+
52
+ //# sourceMappingURL=upload-test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/consoles/upload-test.ts"],"names":["Parser","require","inherits","Transform","Throttle","opts","bps","lowWaterMark","highWaterMark","Error","chunkSize","call","Math","max","totalBytes","startTime","Date","now","_passthroughChunk","prototype","_passthrough","_onchunk","output","done","self","totalSeconds","expected","d","remainder","sleepTime","setTimeout"],"mappings":";;;;AAQA,MAAMA,SAASC,QAAQ;AACvB,MAAMC,WAAWD,QAAQ,QAAQC,QAAQ;AACzC,MAAMC,YAAYF,QAAQ,UAAUE,SAAS;AAG7C,SAASC,SAASC,IAAI;IACpB,IAAI,CAAE,CAAA,IAAI,YAAYD,QAAO,GAAI,OAAO,IAAIA,SAASC;IAErD,IAAI,YAAY,OAAOA,MAAMA,OAAO;QAAEC,KAAKD;IAA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jBC,WAAWH,GAAGE;QAChB,OAAO;YACLF;QACF;IACF,OAAO;QACLA;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/constants/event.constants.ts"],"names":["fdmMonsterPrinterStoppedEvent","fdmPrinterEventToPrinterId","firmwareFlashUploadEvent","octoPrintWebsocketCurrentEvent","octoPrintWebsocketEvent","prefix","printerEvents","socketIoConnectedEvent","uploadProgressEvent","printersDeleted","printerUpdated","printerCreated","batchPrinterCreated","printerId","token","event","split"],"mappings":";;;;;;;;;;;IAeaA,6BAA6B;eAA7BA;;IACAC,0BAA0B;eAA1BA;;IAJAC,wBAAwB;eAAxBA;;IAFAC,8BAA8B;eAA9BA;;IADAC,uBAAuB;eAAvBA;;IAKAC,MAAM;eAANA;;IAZAC,aAAa;eAAbA;;IAFAC,sBAAsB;eAAtBA;;IAWAC,mBAAmB;eAAnBA;;;AAXN,MAAMD,yBAAyB;AAE/B,MAAMD,gBAAgB;IAC3BG,iBAAiB;IACjBC,gBAAgB;IAChBC,gBAAgB;IAChBC,qBAAqB;AACvB;AAEO,MAAMR,0BAA0B,CAACS,YAAc,CAAC,UAAU,EAAEA,UAAU,CAAC;AACvE,MAAMV,iCAAiC,CAACU,YAAc,CAAC,UAAU,EAAEA,UAAU,QAAQ,CAAC;AACtF,MAAML,sBAAsB,CAACM,QAAU,CAAC,gBAAgB,EAAEA,MAAM,CAAC;AACjE,MAAMZ,2BAA2B,CAACW,YAAc,CAAC,gBAAgB,EAAEA,UAAU,CAAC;AAE9E,MAAMR,SAAS;AACf,MAAML,gCAAgC,CAACa,YAAc,CAAC,EAAER,OAAO,CAAC,EAAEQ,UAAU,gBAAgB,CAAC;AAC7F,MAAMZ,6BAA6B,CAACc,QAAUA,MAAMC,KAAK,CAAC,IAAI,CAAC,EAAE"}
1
+ {"version":3,"sources":["../../src/constants/event.constants.ts"],"names":["fdmMonsterPrinterStoppedEvent","fdmPrinterEventToPrinterId","firmwareFlashUploadEvent","octoPrintWebsocketCurrentEvent","octoPrintWebsocketEvent","prefix","printerEvents","socketIoConnectedEvent","uploadProgressEvent","printersDeleted","printerUpdated","printerCreated","batchPrinterCreated","printerId","token","event","split"],"mappings":";;;;;;;;;;;IAeaA,6BAA6B;eAA7BA;;IACAC,0BAA0B;eAA1BA;;IAJAC,wBAAwB;eAAxBA;;IAFAC,8BAA8B;eAA9BA;;IADAC,uBAAuB;eAAvBA;;IAKAC,MAAM;eAANA;;IAZAC,aAAa;eAAbA;;IAFAC,sBAAsB;eAAtBA;;IAWAC,mBAAmB;eAAnBA;;;AAXN,MAAMD,yBAAyB;AAE/B,MAAMD,gBAAgB;IAC3BG,iBAAiB;IACjBC,gBAAgB;IAChBC,gBAAgB;IAChBC,qBAAqB;AACvB;AAEO,MAAMR,0BAA0B,CAACS,YAAsB,CAAC,UAAU,EAAEA,UAAU,CAAC;AAC/E,MAAMV,iCAAiC,CAACU,YAAsB,CAAC,UAAU,EAAEA,UAAU,QAAQ,CAAC;AAC9F,MAAML,sBAAsB,CAACM,QAAkB,CAAC,gBAAgB,EAAEA,MAAM,CAAC;AACzE,MAAMZ,2BAA2B,CAACW,YAAsB,CAAC,gBAAgB,EAAEA,UAAU,CAAC;AAEtF,MAAMR,SAAS;AACf,MAAML,gCAAgC,CAACa,YAAsB,CAAC,EAAER,OAAO,CAAC,EAAEQ,UAAU,gBAAgB,CAAC;AACrG,MAAMZ,6BAA6B,CAACc,QAAkBA,MAAMC,KAAK,CAAC,IAAI,CAAC,EAAE"}
@@ -12,30 +12,15 @@ _export(exports, {
12
12
  UUID_LENGTH: function() {
13
13
  return UUID_LENGTH;
14
14
  },
15
- getDefaultPrinterEntry: function() {
16
- return getDefaultPrinterEntry;
17
- },
18
- getFileListDefault: function() {
19
- return getFileListDefault;
15
+ apiKeyLengthMinimumDefault: function() {
16
+ return apiKeyLengthMinimumDefault;
20
17
  },
21
18
  minFloorNameLength: function() {
22
19
  return minFloorNameLength;
23
20
  }
24
21
  });
25
- function getFileListDefault() {
26
- return {
27
- files: [],
28
- folders: [],
29
- free: 0,
30
- total: 0
31
- };
32
- }
33
- function getDefaultPrinterEntry() {
34
- return {
35
- fileList: getFileListDefault()
36
- };
37
- }
38
22
  const UUID_LENGTH = 32;
39
23
  const minFloorNameLength = 3;
24
+ const apiKeyLengthMinimumDefault = 32;
40
25
 
41
26
  //# sourceMappingURL=service.constants.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/constants/service.constants.ts"],"names":["UUID_LENGTH","getDefaultPrinterEntry","getFileListDefault","minFloorNameLength","files","folders","free","total","fileList"],"mappings":";;;;;;;;;;;IAeaA,WAAW;eAAXA;;IANGC,sBAAsB;eAAtBA;;IATAC,kBAAkB;eAAlBA;;IAgBHC,kBAAkB;eAAlBA;;;AAhBN,SAASD;IACd,OAAO;QACLE,OAAO,EAAE;QACTC,SAAS,EAAE;QACXC,MAAM;QACNC,OAAO;IACT;AACF;AAEO,SAASN;IACd,OAAO;QACLO,UAAUN;IACZ;AACF;AAEO,MAAMF,cAAc;AACpB,MAAMG,qBAAqB"}
1
+ {"version":3,"sources":["../../src/constants/service.constants.ts"],"names":["UUID_LENGTH","apiKeyLengthMinimumDefault","minFloorNameLength"],"mappings":";;;;;;;;;;;IAAaA,WAAW;eAAXA;;IAGAC,0BAA0B;eAA1BA;;IAFAC,kBAAkB;eAAlBA;;;AADN,MAAMF,cAAc;AACpB,MAAME,qBAAqB;AAE3B,MAAMD,6BAA6B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/controllers/custom-gcode.controller.ts"],"names":["CustomGcodeController","octoPrintApiService","customGCodeService","isTypeormMode","constructor","list","req","res","entities","send","map","e","toDto","get","id","validateInput","params","idRulesV2","entity","sendEmergencyM112","printerLogin","getScopedPrinter","response","sendCustomGCodeCommand","create","body","delete","update","updatedScript","createController","prefix","AppConstants","apiRoute","before","authenticate","authorizeRoles","ROLES","ADMIN","OPERATOR","post","printerResolveMiddleware","put"],"mappings":";;;;;;;;;;;IAWaA,qBAAq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AACM;IACzC;IAEA,MAAMQ,OAAOpB,GAAY,EAAEC,GAAa,EAAE;QACxC,MAAM,EAAEO,EAAE,EAAE,GAAG,MAAMC,IAAAA,yBAAa,EAACT,IAAIU,MAAM,EAAEC,IAAAA,4BAAS,EAAC,IAAI,CAACd,aAAa;QAC3E,MAAM,IAAI,CAACD,kBAAkB,CAACwB,MAAM,CAACZ;QACrCP,IAAIE,IAAI;IACV;IAEA,MAAMkB,OAAOrB,GAAY,EAAEC,GAAa,EAAE;QACxC,MAAM,EAAEO,EAAE,EAAE,GAAG,MAAMC,IAAAA,yBAAa,EAACT,IAAIU,MAAM,EAAEC,IAAAA,4BAAS,EAAC,IAAI,CAACd,aAAa;QAC3E,MAAMyB,gBAAgB,MAAM,IAAI,CAAC1B,kBAAkB,CAACyB,MAAM,CAACb,IAAIR,IAAImB,IAAI;QACvElB,IAAIE,IAAI,CAAC,IAAI,CAACP,kBAAkB,CAACU,KAAK,CAACgB;IACzC;AACF;MAEA,WAAeC,IAAAA,+BAAgB,EAAC7B,uBAC7B8B,MAAM,CAAC,CAAC,EAAEC,6BAAY,CAACC,QAAQ,CAAC,aAAa,CAAC,EAC9CC,MAAM,CAAC;IAACC,IAAAA,0BAAY;IAAIC,IAAAA,4BAAc,EAAC;QAACC,6BAAK,CAACC,KAAK;QAAED,6BAAK,CAACE,QAAQ;KAAC;CAAE,EACtEzB,GAAG,CAAC,KAAK,QACTA,GAAG,CAAC,QAAQ,OACZ0B,IAAI,CAAC,KAAK,UACVA,IAAI,CAAC,mCAAmC,qBAAqB;IAAEN,QAAQ;QAACO,IAAAA,iCAAwB,EAAC;KAAa;AAAC,GAC/Gd,MAAM,CAAC,QAAQ,UACfe,GAAG,CAAC,QAAQ"}
1
+ {"version":3,"sources":["../../src/controllers/custom-gcode.controller.ts"],"names":["CustomGcodeController","octoPrintApiService","customGCodeService","isTypeormMode","constructor","list","req","res","entities","send","map","e","toDto","get","id","validateInput","params","idRulesV2","entity","sendEmergencyM112","printerLogin","getScopedPrinter","response","sendCustomGCodeCommand","create","body","delete","update","updatedScript","createController","prefix","AppConstants","apiRoute","before","authenticate","authorizeRoles","ROLES","ADMIN","OPERATOR","post","printerResolveMiddleware","put"],"mappings":";;;;;;;;;;;IAWaA,qBAAqB;eAArBA;;IAyDb,OAQyB;eARzB;;;+BApEiC;8BACY;iCAChB;wCACP;4BAC0B;mCACtB;yBACe;AAKlC,MAAMA;IACHC,oBAAyC;IACzCC,mBAAwC;IAChDC,cAAuB;IAEvBC,YAAY,EACVF,kBAAkB,EAClBD,mBAAmB,EACnBE,aAAa,EAKd,CAAE;QACD,IAAI,CAACD,kBAAkB,GAAGA;QAC1B,IAAI,CAACD,mBAAmB,GAAGA;QAC3B,IAAI,CAACE,aAAa,GAAGA;IACvB;IAEA,MAAME,KAAKC,GAAY,EAAEC,GAAa,EAAE;QACtC,MAAMC,WAAW,MAAM,IAAI,CAACN,kBAAkB,CAACG,IAAI;QACnDE,IAAIE,IAAI,CAACD,SAASE,GAAG,CAAC,CAACC,IAAM,IAAI,CAACT,kBAAkB,CAACU,KAAK,CAACD;IAC7D;IAEA,MAAME,IAAIP,GAAY,EAAEC,GAAa,EAAE;QACrC,MAAM,EAAEO,EAAE,EAAE,GAAG,MAAMC,IAAAA,yBAAa,EAACT,IAAIU,MAAM,EAAEC,IAAAA,4BAAS,EAAC,IAAI,CAACd,aAAa;QAC3E,MAAMe,SAAS,MAAM,IAAI,CAAChB,kBAAkB,CAACW,GAAG,CAACC;QACjDP,IAAIE,IAAI,CAAC,IAAI,CAACP,kBAAkB,CAACU,KAAK,CAACM;IACzC;IAKA,MAAMC,kBAAkBb,GAAY,EAAEC,GAAa,EAAE;QACnD,MAAM,EAAEa,YAAY,EAAE,GAAGC,IAAAA,4BAAgB,EAACf;QAC1C,MAAMgB,WAAW,MAAM,IAAI,CAACrB,mBAAmB,CAACsB,sBAAsB,CAACH,cAAc;QACrFb,IAAIE,IAAI,CAACa;IACX;IAEA,MAAME,OAAOlB,GAAY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"}
@@ -25,7 +25,6 @@ const _batchcontrollervalidation = require("./validation/batch-controller.valida
25
25
  const _runtimeexceptions = require("../exceptions/runtime.exceptions");
26
26
  const _printer = require("../middleware/printer");
27
27
  const _authorizationconstants = require("../constants/authorization.constants");
28
- const _nodefs = require("node:fs");
29
28
  class PrinterFilesController {
30
29
  printerFilesStore;
31
30
  settingsStore;
@@ -53,8 +52,8 @@ class PrinterFilesController {
53
52
  const { currentPrinterId } = (0, _validators.getScopedPrinter)(req);
54
53
  const { recursive } = await (0, _validators.validateInput)(req.query, _printerfilescontrollervalidation.getFilesRules);
55
54
  this.logger.log("Refreshing file storage by eager load");
56
- const response = await this.printerFilesStore.eagerLoadPrinterFiles(currentPrinterId, recursive);
57
- this.statusResponse(res, response);
55
+ const files = await this.printerFilesStore.eagerLoadPrinterFiles(currentPrinterId, recursive);
56
+ res.send(files);
58
57
  }
59
58
  async getFilesCache(req, res) {
60
59
  const { currentPrinter } = (0, _validators.getScopedPrinter)(req);
@@ -63,7 +62,7 @@ class PrinterFilesController {
63
62
  }
64
63
  async clearPrinterFiles(req, res) {
65
64
  const { currentPrinterId, printerLogin } = (0, _validators.getScopedPrinter)(req);
66
- const nonRecursiveFiles = await this.octoPrintApiService.getFiles(printerLogin, false);
65
+ const nonRecursiveFiles = await this.octoPrintApiService.getLocalFiles(printerLogin, false);
67
66
  const failedFiles = [];
68
67
  const succeededFiles = [];
69
68
  for (let file of nonRecursiveFiles.files){
@@ -110,10 +109,9 @@ class PrinterFilesController {
110
109
  res.send(results);
111
110
  }
112
111
  async selectAndPrintFile(req, res) {
113
- const { currentPrinterId, printerLogin } = (0, _validators.getScopedPrinter)(req);
112
+ const { printerLogin } = (0, _validators.getScopedPrinter)(req);
114
113
  const { filePath: path, print } = await (0, _validators.validateInput)(req.body, _printerfilescontrollervalidation.selectAndPrintFileRules);
115
114
  const result = await this.octoPrintApiService.selectPrintFile(printerLogin, path, print);
116
- await this.printerFilesStore.setExistingFileForPrint(currentPrinterId, path);
117
115
  res.send(result);
118
116
  }
119
117
  async uploadFile(req, res) {
@@ -136,48 +134,17 @@ class PrinterFilesController {
136
134
  if (fileCleanEnabled) {
137
135
  await this.printerFileCleanTask.cleanPrinterFiles(currentPrinterId);
138
136
  }
139
- const token = this.multerService.startTrackingSession(files);
137
+ const token = this.multerService.startTrackingSession(uploadedFile);
140
138
  const response = await this.octoPrintApiService.uploadFileAsMultiPart(printerLogin, uploadedFile, {
141
139
  print,
142
140
  select
143
141
  }, token);
144
- if (response.success !== false) {
145
- const newOrUpdatedFile = response.files.local;
146
- await this.printerFilesStore.appendOrSetPrinterFile(currentPrinterId, newOrUpdatedFile);
142
+ if (response.success !== false && response?.files?.local?.path?.length) {
143
+ const file = await this.octoPrintApiService.getFile(printerLogin, response?.files?.local?.path);
144
+ await this.printerFilesStore.appendOrSetPrinterFile(currentPrinterId, file);
147
145
  }
148
146
  res.send(response);
149
147
  }
150
- async localUploadFile(req, res) {
151
- const { currentPrinterId, printerLogin } = (0, _validators.getScopedPrinter)(req);
152
- const { select, print, localLocation } = await (0, _validators.validateInput)(req.body, _printerfilescontrollervalidation.localFileUploadRules);
153
- if (!localLocation.endsWith(".gcode")) {
154
- throw new _runtimeexceptions.ValidationException({
155
- localLocation: "The indicated file extension did not match '.gcode'"
156
- });
157
- }
158
- if (!(0, _nodefs.existsSync)(localLocation)) {
159
- throw new _runtimeexceptions.NotFoundException("The indicated file was not found.");
160
- }
161
- if ((0, _nodefs.lstatSync)(localLocation).isDirectory()) {
162
- throw new _runtimeexceptions.ValidationException({
163
- localLocation: "The indicated file was not correctly found."
164
- });
165
- }
166
- const stream = (0, _nodefs.createReadStream)(localLocation);
167
- const response = await this.octoPrintApiService.uploadFileAsMultiPart(printerLogin, stream, {
168
- select,
169
- print
170
- });
171
- if (response.success !== false) {
172
- const newOrUpdatedFile = response.files.local;
173
- await this.printerFilesStore.appendOrSetPrinterFile(currentPrinterId, newOrUpdatedFile);
174
- }
175
- res.send(response);
176
- }
177
- statusResponse(res, response) {
178
- res.statusCode = response.status;
179
- res.send(response.data);
180
- }
181
148
  }
182
149
  const _default = (0, _awilixexpress.createController)(PrinterFilesController).prefix(_serverconstants.AppConstants.apiRoute + "/printer-files").before([
183
150
  (0, _authenticate.authenticate)(),
@@ -186,6 +153,6 @@ const _default = (0, _awilixexpress.createController)(PrinterFilesController).pr
186
153
  _authorizationconstants.ROLES.OPERATOR
187
154
  ]),
188
155
  (0, _printer.printerResolveMiddleware)()
189
- ]).post("/purge", "purgeIndexedFiles", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Clear)).get("/tracked-uploads", "getTrackedUploads", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Upload)).post("/batch/reprint-files", "batchReprintFiles", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Actions)).get("/:id", "getFiles", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Get)).get("/:id/cache", "getFilesCache", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Get)).post("/:id/local-upload", "localUploadFile", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Upload)).post("/:id/upload", "uploadFile", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Upload)).post("/:id/create-folder", "createFolder", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Actions)).post("/:id/select", "selectAndPrintFile", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Actions)).post("/:id/move", "moveFileOrFolder", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Actions)).delete("/:id", "deleteFileOrFolder", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Delete)).delete("/:id/clear", "clearPrinterFiles", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Clear));
156
+ ]).post("/purge", "purgeIndexedFiles", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Clear)).get("/tracked-uploads", "getTrackedUploads", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Upload)).post("/batch/reprint-files", "batchReprintFiles", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Actions)).get("/:id", "getFiles", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Get)).get("/:id/cache", "getFilesCache", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Get)).post("/:id/upload", "uploadFile", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Upload)).post("/:id/create-folder", "createFolder", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Actions)).post("/:id/select", "selectAndPrintFile", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Actions)).post("/:id/move", "moveFileOrFolder", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Actions)).delete("/:id", "deleteFileOrFolder", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Delete)).delete("/:id/clear", "clearPrinterFiles", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrinterFiles.Clear));
190
157
 
191
158
  //# sourceMappingURL=printer-files.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/controllers/printer-files.controller.ts"],"names":["PrinterFilesController","printerFilesStore","settingsStore","octoPrintApiService","batchCallService","multerService","printerFileCleanTask","logger","isTypeormMode","constructor","loggerFactory","name","getTrackedUploads","req","res","sessions","getSessions","send","getFiles","currentPrinterId","getScopedPrinter","recursive","validateInput","query","getFilesRules","log","response","eagerLoadPrinterFiles","statusResponse","getFilesCache","currentPrinter","filesCache","id","clearPrinterFiles","printerLogin","nonRecursiveFiles","failedFiles","succeededFiles","file","files","deleteFileOrFolder","path","push","e","purgePrinterFiles","purgeIndexedFiles","purgeFiles","moveFileOrFolder","filePath","destination","validateMiddleware","moveFileOrFolderRules","result","createFolder","foldername","createFolderRules","getFileRules","deleteFile","batchReprintFiles","printerIds","body","batchPrinterRules","results","batchReprintCalls","selectAndPrintFile","print","selectAndPrintFileRules","selectPrintFile","setExistingFileForPrint","uploadFile","uploadFileRules","multerLoadFileAsync","length","ValidationException","error","select","fileUploadCommandsRules","uploadedFile","fileCleanEnabled","isPreUploadFileCleanEnabled","cleanPrinterFiles","token","startTrackingSession","uploadFileAsMultiPart","success","newOrUpdatedFile","local","appendOrSetPrinterFile","localUploadFile","localLocation","localFileUploadRules","endsWith","existsSync","NotFoundException","lstatSync","isDirectory","stream","createReadStream","statusCode","status","data","createController","prefix","AppConstants","apiRoute","before","authenticate","authorizeRoles","ROLES","ADMIN","OPERATOR","printerResolveMiddleware","post","withPermission","PERMS","PrinterFiles","Clear","get","Upload","Actions","Get","delete","Delete"],"mappings":";;;;;;;;;;;IA8BaA,sBAAsB;eAAtBA;;IA8Ob,OAiBuF;eAjBvF;;;+BA5QiC;8BAC4B;4BACO;iCACvC;kDAUtB;2CAC2B;mCACqB;yBACd;wCACZ;wBAW2B;AAEjD,MAAMA;IACXC,kBAAqC;IACrCC,cAA6B;IAC7BC,oBAAyC;IACzCC,iBAAmC;IACnCC,cAA6B;IAC7BC,qBAA2C;IAC3CC,OAAsB;IACtBC,cAAuB;IAEvBC,YAAY,EACVR,iBAAiB,EACjBE,mBAAmB,EACnBC,gBAAgB,EAChBE,oBAAoB,EACpBJ,aAAa,EACbQ,aAAa,EACbL,aAAa,EACbG,aAAa,EAUd,CAAE;QACD,IAAI,CAACP,iBAAiB,GAAGA;QACzB,IAAI,CAACC,aAAa,GAAGA;QACrB,IAAI,CAACI,oBAAoB,GAAGA;QAC5B,IAAI,CAACH,mBAAmB,GAAGA;QAC3B,IAAI,CAACC,gBAAgB,GAAGA;QACxB,IAAI,CAACC,aAAa,GAAGA;QACrB,IAAI,CAACG,aAAa,GAAGA;QACrB,IAAI,CAACD,MAAM,GAAGG,cAAcV,uBAAuBW,IAAI;IACzD;IAEAC,kBAAkBC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IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACK,GAAG,GACxER,IAAI,CAAC,qBAAqB,mBAAmBC,IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACG,MAAM,GACrFN,IAAI,CAAC,eAAe,cAAcC,IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACG,MAAM,GAC1EN,IAAI,CAAC,sBAAsB,gBAAgBC,IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACI,OAAO,GACpFP,IAAI,CAAC,eAAe,sBAAsBC,IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACI,OAAO,GACnFP,IAAI,CAAC,aAAa,oBAAoBC,IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACI,OAAO,GAC/EE,MAAM,CAAC,QAAQ,sBAAsBR,IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACO,MAAM,GAC7ED,MAAM,CAAC,cAAc,qBAAqBR,IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACC,KAAK"}
1
+ {"version":3,"sources":["../../src/controllers/printer-files.controller.ts"],"names":["PrinterFilesController","printerFilesStore","settingsStore","octoPrintApiService","batchCallService","multerService","printerFileCleanTask","logger","isTypeormMode","constructor","loggerFactory","name","getTrackedUploads","req","res","sessions","getSessions","send","getFiles","currentPrinterId","getScopedPrinter","recursive","validateInput","query","getFilesRules","log","files","eagerLoadPrinterFiles","getFilesCache","currentPrinter","filesCache","id","clearPrinterFiles","printerLogin","nonRecursiveFiles","getLocalFiles","failedFiles","succeededFiles","file","deleteFileOrFolder","path","push","e","purgePrinterFiles","purgeIndexedFiles","purgeFiles","moveFileOrFolder","filePath","destination","validateMiddleware","moveFileOrFolderRules","result","createFolder","foldername","createFolderRules","getFileRules","deleteFile","batchReprintFiles","printerIds","body","batchPrinterRules","results","batchReprintCalls","selectAndPrintFile","print","selectAndPrintFileRules","selectPrintFile","uploadFile","uploadFileRules","multerLoadFileAsync","length","ValidationException","error","select","fileUploadCommandsRules","uploadedFile","fileCleanEnabled","isPreUploadFileCleanEnabled","cleanPrinterFiles","token","startTrackingSession","response","uploadFileAsMultiPart","success","local","getFile","appendOrSetPrinterFile","createController","prefix","AppConstants","apiRoute","before","authenticate","authorizeRoles","ROLES","ADMIN","OPERATOR","printerResolveMiddleware","post","withPermission","PERMS","PrinterFiles","Clear","get","Upload","Actions","Get","delete","Delete"],"mappings":";;;;;;;;;;;IA6BaA,sBAAsB;eAAtBA;;IAiMb,OAgBuF;eAhBvF;;;+BA9NiC;8BAC4B;4BACO;iCACvC;kDAStB;2CAC2B;mCACE;yBACK;wCACZ;AAatB,MAAMA;IACXC,kBAAqC;IACrCC,cAA6B;IAC7BC,oBAAyC;IACzCC,iBAAmC;IACnCC,cAA6B;IAC7BC,qBAA2C;IAC3CC,OAAsB;IACtBC,cAAuB;IAEvBC,YAAY,EACVR,iBAAiB,EACjBE,mBAAmB,EACnBC,gBAAgB,EAChBE,oBAAoB,EACpBJ,aAAa,EACbQ,aAAa,EACbL,aAAa,EACbG,aAAa,EAUd,CAAE;QACD,IAAI,CAACP,iBAAiB,GAAGA;QACzB,IAAI,CAACC,aAAa,GAAGA;QACrB,IAAI,CAACI,oBAAoB,GAAGA;QAC5B,IAAI,CAACH,mBAAmB,GAAGA;QAC3B,IAAI,CAACC,gBAAgB,GAAGA;QACxB,IAAI,CAACC,aAAa,GAAGA;QACrB,IAAI,CAACG,aAAa,GAAGA;QACrB,IAAI,CAACD,MAAM,GAAGG,cAAcV,uBAAuBW,IAAI;IACzD;IAEAC,kBAAkBC,GAAY,EAAEC,GAAa,EAAE;QAC7C,MAAMC,WAAW,IAAI,CAACV,aAAa,CAACW,WAAW;QAC/CF,IAAIG,IAAI,CAACF;IACX;IAEA,MAAMG,SAASL,GAAY,EAAEC,GAAa,EAAE;QAC1C,MAAM,EAAEK,gBAAgB,EAAE,GAAGC,IAAAA,4BAAgB,EAACP;QAC9C,MAAM,EAAEQ,SA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e,cAAcC,IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACG,MAAM,GAC1EN,IAAI,CAAC,sBAAsB,gBAAgBC,IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACI,OAAO,GACpFP,IAAI,CAAC,eAAe,sBAAsBC,IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACI,OAAO,GACnFP,IAAI,CAAC,aAAa,oBAAoBC,IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACI,OAAO,GAC/EE,MAAM,CAAC,QAAQ,sBAAsBR,IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACO,MAAM,GAC7ED,MAAM,CAAC,cAAc,qBAAqBR,IAAAA,4BAAc,EAACC,6BAAK,CAACC,YAAY,CAACC,KAAK"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "BaseEntity", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return BaseEntity;
9
+ }
10
+ });
11
+ const _typeorm = require("typeorm");
12
+ function _ts_decorate(decorators, target, key, desc) {
13
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
15
+ 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;
16
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
17
+ }
18
+ function _ts_metadata(k, v) {
19
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
20
+ }
21
+ class BaseEntity {
22
+ id;
23
+ }
24
+ _ts_decorate([
25
+ (0, _typeorm.PrimaryGeneratedColumn)(),
26
+ _ts_metadata("design:type", Number)
27
+ ], BaseEntity.prototype, "id", void 0);
28
+
29
+ //# sourceMappingURL=base.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/entities/base.entity.ts"],"names":["BaseEntity","id","PrimaryGeneratedColumn"],"mappings":";;;;+BAEaA;;;eAAAA;;;yBAF0B;;;;;;;;;;AAEhC,MAAMA;IAEXC,GAAY;AACd;;IAFGC,IAAAA,+BAAsB;;GADZF"}
@@ -35,6 +35,10 @@ const PrinterSchema = new _mongoose.Schema({
35
35
  type: String,
36
36
  required: false
37
37
  },
38
+ assignee: {
39
+ type: String,
40
+ required: false
41
+ },
38
42
  name: {
39
43
  type: String,
40
44
  required: true
@@ -47,49 +51,6 @@ const PrinterSchema = new _mongoose.Schema({
47
51
  type: Number,
48
52
  required: false
49
53
  },
50
- lastPrintedFile: {
51
- type: {
52
- fileName: {
53
- type: String,
54
- required: true
55
- },
56
- editTimestamp: {
57
- type: Number,
58
- required: true
59
- },
60
- parsedColor: {
61
- type: String,
62
- required: false
63
- },
64
- parsedVisualizationRAL: {
65
- type: Number,
66
- required: false
67
- },
68
- parsedAmount: {
69
- type: Number,
70
- required: false
71
- },
72
- parsedMaterial: {
73
- type: String,
74
- required: false
75
- },
76
- parsedOrderCode: {
77
- type: String,
78
- required: false
79
- }
80
- },
81
- required: false
82
- },
83
- fileList: {
84
- type: Object,
85
- default: {
86
- files: [],
87
- folders: [],
88
- free: 0,
89
- total: 0
90
- },
91
- required: true
92
- },
93
54
  feedRate: {
94
55
  type: Number,
95
56
  required: false
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/models/Printer.ts"],"names":["Printer","PrinterSchema","Schema","apiKey","type","String","required","printerURL","enabled","Boolean","default","disabledReason","name","currentUser","dateAdded","Number","lastPrintedFile","fileName","editTimestamp","parsedColor","parsedVisualizationRAL","parsedAmount","parsedMaterial","parsedOrderCode","fileList","Object","files","folders","free","total","feedRate","flowRate","model"],"mappings":";;;;;;;;;;;IAoHaA,OAAO;eAAPA;;IAtFAC,aAAa;eAAbA;;;0BA9BiB;AA8BvB,MAAMA,gBAAgB,IAAIC,gBAAM,CAAW;IAChDC,QAAQ;QACNC,MAAMC;QACNC,UAAU;IACZ;IACAC,YAAY;QACVH,MAAMC;QACNC,UAAU;IACZ;IACAE,SAAS;QACPJ,MAAMK;QACNH,UAAU;QACVI,SAAS;IACX;IACAC,gBAAgB;QACdP,MAAMC;QACNC,UAAU;IACZ;IACAM,MAAM;QACJR,MAAMC;QACNC,UAAU;IACZ;IAEAO,aAAa;QACXT,MAAMC;QACNC,UAAU;IACZ;IACAQ,WAAW;QACTV,MAAMW;QACNT,UAAU;IACZ;IAEAU,iBAAiB;QACfZ,MAAM;YACJa,UAAU;gBACRb,MAAMC;gBACNC,UAAU;YACZ;YACAY,eAAe;gBACbd,MAAMW;gBACNT,UAAU;YACZ;YACAa,aAAa;gBACXf,MAAMC;gBACNC,UAAU;YACZ;YACAc,wBAAwB;gBACtBhB,MAAMW;gBACNT,UAAU;YACZ;YACAe,cAAc;gBACZjB,MAAMW;gBACNT,UAAU;YACZ;YACAgB,gBAAgB;gBACdlB,MAAMC;gBACNC,UAAU;YACZ;YACAiB,iBAAiB;gBACfnB,MAAMC;gBACNC,UAAU;YACZ;QACF;QACAA,UAAU;IACZ;IAEAkB,UAAU;QACRpB,MAAMqB;QACNf,SAAS;YACPgB,OAAO,EAAE;YACTC,SAAS,EAAE;YACXC,MAAM;YACNC,OAAO;QACT;QACAvB,UAAU;IACZ;IACAwB,UAAU;QACR1B,MAAMW;QACNT,UAAU;IACZ;IACAyB,UAAU;QACR3B,MAAMW;QACNT,UAAU;IACZ;AACF;AAEO,MAAMN,UAAUgC,IAAAA,eAAK,EAAC,WAAW/B"}
1
+ {"version":3,"sources":["../../src/models/Printer.ts"],"names":["Printer","PrinterSchema","Schema","apiKey","type","String","required","printerURL","enabled","Boolean","default","disabledReason","assignee","name","currentUser","dateAdded","Number","feedRate","flowRate","model"],"mappings":";;;;;;;;;;;IA6DaA,OAAO;eAAPA;;IA7CAC,aAAa;eAAbA;;;0BAhBiB;AAgBvB,MAAMA,gBAAgB,IAAIC,gBAAM,CAAW;IAChDC,QAAQ;QACNC,MAAMC;QACNC,UAAU;IACZ;IACAC,YAAY;QACVH,MAAMC;QACNC,UAAU;IACZ;IACAE,SAAS;QACPJ,MAAMK;QACNH,UAAU;QACVI,SAAS;IACX;IACAC,gBAAgB;QACdP,MAAMC;QACNC,UAAU;IACZ;IACAM,UAAU;QACRR,MAAMC;QACNC,UAAU;IACZ;IACAO,MAAM;QACJT,MAAMC;QACNC,UAAU;IACZ;IAEAQ,aAAa;QACXV,MAAMC;QACNC,UAAU;IACZ;IACAS,WAAW;QACTX,MAAMY;QACNV,UAAU;IACZ;IACAW,UAAU;QACRb,MAAMY;QACNV,UAAU;IACZ;IACAY,UAAU;QACRd,MAAMY;QACNV,UAAU;IACZ;AACF;AAEO,MAAMN,UAAUmB,IAAAA,eAAK,EAAC,WAAWlB"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ PrinterFile: function() {
13
+ return PrinterFile;
14
+ },
15
+ PrinterFileSchema: function() {
16
+ return PrinterFileSchema;
17
+ }
18
+ });
19
+ const _mongoose = require("mongoose");
20
+ const PrinterFileSchema = new _mongoose.Schema({
21
+ printerId: {
22
+ type: _mongoose.Schema.Types.ObjectId,
23
+ required: true
24
+ },
25
+ name: {
26
+ type: String,
27
+ required: true
28
+ },
29
+ date: {
30
+ type: Number,
31
+ required: true
32
+ },
33
+ display: {
34
+ type: String,
35
+ required: true
36
+ },
37
+ gcodeAnalysis: {
38
+ type: Object,
39
+ default: null,
40
+ required: false
41
+ },
42
+ hash: {
43
+ type: String,
44
+ required: true
45
+ },
46
+ origin: {
47
+ type: String,
48
+ required: true
49
+ },
50
+ path: {
51
+ type: String,
52
+ required: true
53
+ },
54
+ prints: {
55
+ type: Object,
56
+ required: false
57
+ },
58
+ refs: {
59
+ type: Object,
60
+ required: false
61
+ },
62
+ size: {
63
+ type: Number,
64
+ required: false
65
+ },
66
+ statistics: {
67
+ type: Object,
68
+ required: false
69
+ },
70
+ type: {
71
+ type: String,
72
+ required: false
73
+ },
74
+ typePath: {
75
+ type: Array(String),
76
+ required: false
77
+ }
78
+ });
79
+ const PrinterFile = (0, _mongoose.model)("PrinterFile", PrinterFileSchema);
80
+
81
+ //# sourceMappingURL=PrinterFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/models/PrinterFile.ts"],"names":["PrinterFile","PrinterFileSchema","Schema","printerId","type","Types","ObjectId","required","name","String","date","Number","display","gcodeAnalysis","Object","default","hash","origin","path","prints","refs","size","statistics","typePath","Array","model"],"mappings":";;;;;;;;;;;IAgFaA,WAAW;eAAXA;;IA5DAC,iBAAiB;eAAjBA;;;0BApBiB;AAoBvB,MAAMA,oBAAoB,IAAIC,gBAAM,CAAe;IACxDC,WAAW;QACTC,MAAMF,gBAAM,CAACG,KAAK,CAACC,QAAQ;QAC3BC,UAAU;IACZ;IACAC,MAAM;QACJJ,MAAMK;QACNF,UAAU;IACZ;IACAG,MAAM;QACJN,MAAMO;QACNJ,UAAU;IACZ;IACAK,SAAS;QACPR,MAAMK;QACNF,UAAU;IACZ;IACAM,eAAe;QACbT,MAAMU;QACNC,SAAS;QACTR,UAAU;IACZ;IACAS,MAAM;QACJZ,MAAMK;QACNF,UAAU;IACZ;IACAU,QAAQ;QACNb,MAAMK;QACNF,UAAU;IACZ;IACAW,MAAM;QACJd,MAAMK;QACNF,UAAU;IACZ;IACAY,QAAQ;QACNf,MAAMU;QACNP,UAAU;IACZ;IACAa,MAAM;QACJhB,MAAMU;QACNP,UAAU;IACZ;IACAc,MAAM;QACJjB,MAAMO;QACNJ,UAAU;IACZ;IACAe,YAAY;QACVlB,MAAMU;QACNP,UAAU;IACZ;IACAH,MAAM;QACJA,MAAMK;QACNF,UAAU;IACZ;IACAgB,UAAU;QACRnB,MAAMoB,MAAMf;QACZF,UAAU;IACZ;AACF;AAEO,MAAMP,cAAcyB,IAAAA,eAAK,EAAC,eAAexB"}
@@ -27,6 +27,9 @@ _export(exports, {
27
27
  Printer: function() {
28
28
  return _Printer.Printer;
29
29
  },
30
+ PrinterFile: function() {
31
+ return _PrinterFile.PrinterFile;
32
+ },
30
33
  RefreshToken: function() {
31
34
  return _RefreshToken.RefreshToken;
32
35
  },
@@ -50,5 +53,6 @@ const _PrintCompletion = require("./PrintCompletion");
50
53
  const _RefreshToken = require("./Auth/RefreshToken");
51
54
  const _CameraStream = require("./CameraStream");
52
55
  const _CustomGcode = require("./CustomGcode");
56
+ const _PrinterFile = require("./PrinterFile");
53
57
 
54
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/models/index.ts"],"names":["CameraStream","CustomGcode","Floor","Permission","PrintCompletion","Printer","RefreshToken","Role","Settings","User"],"mappings":";;;;;;;;;;;IAWuGA,YAAY;eAAZA,0BAAY;;IAAzEC,WAAW;eAAXA,wBAAW;;IAAnCC,KAAK;eAALA,YAAK;;IAAsDC,UAAU;eAAVA,sBAAU;;IAA9DC,eAAe;eAAfA,gCAAe;;IAA/BC,OAAO;eAAPA,gBAAO;;IAAyEC,YAAY;eAAZA,0BAAY;;IAA9BC,IAAI;eAAJA,UAAI;;IAApBC,QAAQ;eAARA,kBAAQ;;IAAEC,IAAI;eAAJA,UAAI;;;yBAX7C;uBACF;0BACG;sBACJ;sBACA;4BACM;iCACK;8BACH;8BACA;6BACD"}
1
+ {"version":3,"sources":["../../src/models/index.ts"],"names":["CameraStream","CustomGcode","Floor","Permission","PrintCompletion","Printer","PrinterFile","RefreshToken","Role","Settings","User"],"mappings":";;;;;;;;;;;IAuBEA,YAAY;eAAZA,0BAAY;;IANZC,WAAW;eAAXA,wBAAW;;IAFXC,KAAK;eAALA,YAAK;;IAMLC,UAAU;eAAVA,sBAAU;;IALVC,eAAe;eAAfA,gCAAe;;IAHfC,OAAO;eAAPA,gBAAO;;IACPC,WAAW;eAAXA,wBAAW;;IAQXC,YAAY;eAAZA,0BAAY;;IAFZC,IAAI;eAAJA,UAAI;;IAFJC,QAAQ;eAARA,kBAAQ;;IACRC,IAAI;eAAJA,UAAI;;;yBAnBkB;uBACF;0BACG;sBACJ;sBACA;4BACM;iCACK;8BACH;8BACA;6BACD;6BACA"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ module.exports = {
3
+ async up (db, client) {
4
+ const session = client.startSession();
5
+ try {
6
+ await session.withTransaction(async ()=>{
7
+ const dbCollection = db.collection("printers");
8
+ await dbCollection.updateMany({}, {
9
+ $set: {
10
+ fileList: []
11
+ }
12
+ });
13
+ });
14
+ } catch (e) {
15
+ console.log("Error executing up migration", e);
16
+ throw e;
17
+ } finally{
18
+ await session.endSession();
19
+ }
20
+ },
21
+ async down (db, client) {
22
+ const session = client.startSession();
23
+ try {
24
+ await session.withTransaction(async ()=>{
25
+ const dbCollection = db.collection("printers");
26
+ await dbCollection.updateMany({}, {
27
+ $set: {
28
+ fileList: {}
29
+ }
30
+ });
31
+ });
32
+ } catch (e) {
33
+ console.log("Error executing down migration", e);
34
+ throw e;
35
+ } finally{
36
+ await session.endSession();
37
+ }
38
+ }
39
+ };
40
+
41
+ //# sourceMappingURL=20231202183902-printer-files-simpler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/mongo-migrations/20231202183902-printer-files-simpler.ts"],"names":["module","exports","up","db","client","session","startSession","withTransaction","dbCollection","collection","updateMany","$set","fileList","e","console","log","endSession","down"],"mappings":";AAAAA,OAAOC,OAAO,GAAG;IACf,MAAMC,IAAGC,EAAE,EAAEC,MAAM;QACjB,MAAMC,UAAUD,OAAOE,YAAY;QACnC,IAAI;YACF,MAAMD,QAAQE,eAAe,CAAC;gBAC5B,MAAMC,eAAeL,GAAGM,UAAU,CAAC;gBACnC,MAAMD,aAAaE,UAAU,CAAC,CAAC,GAAG;oBAAEC,MAAM;wBAAEC,UAAU,EAAE;oBAAC;gBAAE;YAC7D;QACF,EAAE,OAAOC,GAAG;YACVC,QAAQC,GAAG,CAAC,gCAAgCF;YAC5C,MAAMA;QACR,SAAU;YACR,MAAMR,QAAQW,UAAU;QAC1B;IACF;IAEA,MAAMC,MAAKd,EAAE,EAAEC,MAAM;QACnB,MAAMC,UAAUD,OAAOE,YAAY;QACnC,IAAI;YAEF,MAAMD,QAAQE,eAAe,CAAC;gBAE5B,MAAMC,eAAeL,GAAGM,UAAU,CAAC;gBACnC,MAAMD,aAAaE,UAAU,CAAC,CAAC,GAAG;oBAAEC,MAAM;wBAAEC,UAAU,CAAC;oBAAE;gBAAE;YAC7D;QACF,EAAE,OAAOC,GAAG;YACVC,QAAQC,GAAG,CAAC,kCAAkCF;YAC9C,MAAMA;QACR,SAAU;YACR,MAAMR,QAAQW,UAAU;QAC1B;IACF;AACF"}
@@ -63,7 +63,7 @@ const AppConstants = {
63
63
  serverRepoName: "fdm-monster",
64
64
  orgName: "fdm-monster",
65
65
  currentWizardVersion: 1,
66
- defaultClientMinimum: "1.4.4",
66
+ defaultClientMinimum: "1.5.0-rc3",
67
67
  influxUrl: "INFLUX_URL",
68
68
  influxToken: "INFLUX_TOKEN",
69
69
  influxOrg: "INFLUX_ORG",
@@ -63,12 +63,12 @@ class MulterService {
63
63
  return reject(err);
64
64
  });
65
65
  fileStream.on("finish", async ()=>{
66
- return resolve();
66
+ return resolve(null);
67
67
  });
68
68
  fileStream.on("close", async ()=>{
69
- return resolve();
69
+ return resolve(null);
70
70
  });
71
- resolve();
71
+ resolve(null);
72
72
  });
73
73
  }
74
74
  getMulterGCodeFileFilter(storeAsFile = true) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/services/core/multer.service.ts"],"names":["MulterService","fileUploadTrackerCache","httpClient","constructor","getNewestFile","collection","dirPath","collectionPath","files","orderRecentFiles","latestFile","length","undefined","join","file","clearUploadsFolder","fileStoragePath","superRootPath","AppConstants","defaultFileStorageFolder","existsSync","readdirSync","withFileTypes","filter","item","isDirectory","map","name","unlink","err","fileExists","downloadFilename","downloadPath","downloadFile","downloadUrl","downloadFolder","mkdirSync","recursive","fileStream","createWriteStream","res","get","Promise","resolve","reject","write","data","on","getMulterGCodeFileFilter","storeAsFile","getMulterFileFilter","multerLoadFileAsync","req","fileExtension","multer","storage","diskStorage","destination","memoryStorage","fileFilter","multerFileFilter","any","extension","callback","ext","extname","originalname","Error","startTrackingSession","multerFile","addUploadTracker","getSessions","getUploads","dir","lstatSync","isFile","mtime","sort","a","b","getTime"],"mappings":";;;;+BAQaA;;;eAAAA;;;iDARM;sBACW;oBAC2D;yBAC3D;iCACD;;;;;;AAItB,MAAMA;IACXC,uBAA+C;IAC/CC,WAAwB;IAExBC,YAAY,EACVF,sBAAsB,EACtBC,UAAU,EAIX,CAAE;QACD,IAAI,CAACD,sBAAsB,GAAGA;QAC9B,IAAI,CAACC,UAAU,GAAGA;IACpB;IAEAE,cAAcC,UAAU,EAAE;QACxB,MAAMC,UAAU,IAAI,CAACC,cAAc,CAACF;QACpC,MAAMG,QAAQ,IAAI,CAACC,gBAAgB,CAACH;QACpC,MAAMI,aAAaF,MAAMG,MAAM,GAAGH,KAAK,CAAC,EAAE,GAAGI;QAC7C,OAAOF,aAAaG,IAAAA,UAAI,EAACP,SAASI,WAAWI,IAAI,IAAIF;IACvD;IAEAG,qBAAqB;QACnB,MAAMC,kBAAkBH,IAAAA,UAAI,EAACI,IAAAA,sBAAa,KAAIC,6BAAY,CAACC,wBAAwB;QACnF,IAAI,CAACC,IAAAA,cAAU,EAACJ,kBAAkB;QAElC,MAAMR,QAAQa,IAAAA,eAAW,EAACL,iBAAiB;YAAEM,eAAe;QAAK,GAC9DC,MAAM,CAAC,CAACC,OAAS,CAACA,KAAKC,WAAW,IAClCC,GAAG,CAAC,CAACF,OAASA,KAAKG,IAAI;QAE1B,KAAK,MAAMb,QAAQN,MA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,GAC/DC,IAAI,CAAC,CAACC,GAAGC,IAAMA,EAAEH,KAAK,CAACI,OAAO,KAAKF,EAAEF,KAAK,CAACI,OAAO;IACvD,EAAE;IAEMzE,eAAeF,UAAU,EAAU;QACzC,OAAOQ,IAAAA,UAAI,EAACI,IAAAA,sBAAa,KAAIC,6BAAY,CAACC,wBAAwB,EAAEd;IACtE;AACF"}
1
+ {"version":3,"sources":["../../../src/services/core/multer.service.ts"],"names":["MulterService","fileUploadTrackerCache","httpClient","constructor","getNewestFile","collection","dirPath","collectionPath","files","orderRecentFiles","latestFile","length","undefined","join","file","clearUploadsFolder","fileStoragePath","superRootPath","AppConstants","defaultFileStorageFolder","existsSync","readdirSync","withFileTypes","filter","item","isDirectory","map","name","unlink","err","fileExists","downloadFilename","downloadPath","downloadFile","downloadUrl","downloadFolder","mkdirSync","recursive","fileStream","createWriteStream","res","get","Promise","resolve","reject","write","data","on","getMulterGCodeFileFilter","storeAsFile","getMulterFileFilter","multerLoadFileAsync","req","fileExtension","multer","storage","diskStorage","destination","memoryStorage","fileFilter","multerFileFilter","any","extension","callback","ext","extname","originalname","Error","startTrackingSession","multerFile","addUploadTracker","getSessions","getUploads","dir","lstatSync","isFile","mtime","sort","a","b","getTime"],"mappings":";;;;+BASaA;;;eAAAA;;;iDAT8B;sBACb;oBAC2D;yBAC3D;iCACD;;;;;;AAKtB,MAAMA;IACXC,uBAA+C;IAC/CC,WAAwB;IAExBC,YAAY,EACVF,sBAAsB,EACtBC,UAAU,EAIX,CAAE;QACD,IAAI,CAACD,sBAAsB,GAAGA;QAC9B,IAAI,CAACC,UAAU,GAAGA;IACpB;IAEAE,cAAcC,UAAkB,EAAE;QAChC,MAAMC,UAAU,IAAI,CAACC,cAAc,CAACF;QACpC,MAAMG,QAAQ,IAAI,CAACC,gBAAgB,CAACH;QACpC,MAAMI,aAAaF,MAAMG,MAAM,GAAGH,KAAK,CAAC,EAAE,GAAGI;QAC7C,OAAOF,aAAaG,IAAAA,UAAI,EAACP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