@lenne.tech/nest-server 11.33.1 → 11.34.1

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 (49) hide show
  1. package/.claude/rules/testing.md +181 -3
  2. package/FRAMEWORK-API.md +1 -1
  3. package/dist/core/common/helpers/gridfs.helper.d.ts +1 -0
  4. package/dist/core/common/helpers/gridfs.helper.js +43 -5
  5. package/dist/core/common/helpers/gridfs.helper.js.map +1 -1
  6. package/dist/core/common/helpers/validation-message.helper.d.ts +3 -0
  7. package/dist/core/common/helpers/validation-message.helper.js +41 -0
  8. package/dist/core/common/helpers/validation-message.helper.js.map +1 -0
  9. package/dist/core/common/pipes/map-and-validate.pipe.js +16 -6
  10. package/dist/core/common/pipes/map-and-validate.pipe.js.map +1 -1
  11. package/dist/core/common/services/core-s3.service.d.ts +4 -0
  12. package/dist/core/common/services/core-s3.service.js +28 -1
  13. package/dist/core/common/services/core-s3.service.js.map +1 -1
  14. package/dist/core/modules/file/core-file.service.d.ts +4 -2
  15. package/dist/core/modules/file/core-file.service.js +46 -47
  16. package/dist/core/modules/file/core-file.service.js.map +1 -1
  17. package/dist/core/modules/hub/helpers/hub-client-js.helper.js +12 -1
  18. package/dist/core/modules/hub/helpers/hub-client-js.helper.js.map +1 -1
  19. package/dist/core/modules/hub/hub-action-messages.d.ts +1 -0
  20. package/dist/core/modules/hub/hub-action-messages.js +1 -0
  21. package/dist/core/modules/hub/hub-action-messages.js.map +1 -1
  22. package/dist/core/modules/hub/interfaces/hub-panels.interface.d.ts +9 -0
  23. package/dist/core/modules/hub/services/core-hub-actions.service.d.ts +2 -0
  24. package/dist/core/modules/hub/services/core-hub-actions.service.js.map +1 -1
  25. package/dist/core/modules/hub/services/core-hub-db.service.d.ts +10 -2
  26. package/dist/core/modules/hub/services/core-hub-db.service.js +85 -29
  27. package/dist/core/modules/hub/services/core-hub-db.service.js.map +1 -1
  28. package/dist/server/modules/file/file.service.d.ts +2 -1
  29. package/dist/server/modules/file/file.service.js +2 -2
  30. package/dist/server/modules/file/file.service.js.map +1 -1
  31. package/dist/tsconfig.build.tsbuildinfo +1 -1
  32. package/migration-guides/11.23.x-to-11.24.0.md +1 -1
  33. package/migration-guides/11.32.x-to-11.33.x.md +2 -0
  34. package/migration-guides/11.33.x-to-11.34.x.md +394 -0
  35. package/migration-guides/11.34.0-to-11.34.1.md +132 -0
  36. package/package.json +3 -1
  37. package/src/core/common/helpers/gridfs.helper.ts +92 -7
  38. package/src/core/common/helpers/validation-message.helper.ts +83 -0
  39. package/src/core/common/pipes/map-and-validate.pipe.ts +25 -7
  40. package/src/core/common/services/core-s3.service.ts +71 -9
  41. package/src/core/modules/file/README.md +42 -6
  42. package/src/core/modules/file/core-file.service.ts +131 -59
  43. package/src/core/modules/hub/README.md +35 -9
  44. package/src/core/modules/hub/helpers/hub-client-js.helper.ts +12 -1
  45. package/src/core/modules/hub/hub-action-messages.ts +9 -1
  46. package/src/core/modules/hub/interfaces/hub-panels.interface.ts +31 -1
  47. package/src/core/modules/hub/services/core-hub-actions.service.ts +10 -2
  48. package/src/core/modules/hub/services/core-hub-db.service.ts +155 -31
  49. package/src/server/modules/file/file.service.ts +20 -3
@@ -5,6 +5,7 @@ import { Connection } from 'mongoose';
5
5
  import { RoleEnum } from '../../../core/common/enums/role.enum';
6
6
  import { ConfigService } from '../../../core/common/services/config.service';
7
7
  import { CoreS3Service } from '../../../core/common/services/core-s3.service';
8
+ import { CoreFileInfo } from '../../../core/modules/file/core-file-info.model';
8
9
  import { CoreFileService, FileInputCheckType } from '../../../core/modules/file/core-file.service';
9
10
  import { FileServiceOptions } from '../../../core/modules/file/interfaces/file-service-options.interface';
10
11
 
@@ -22,10 +23,26 @@ export class FileService extends CoreFileService {
22
23
  }
23
24
 
24
25
  /**
25
- * Duplicate file by name
26
+ * Duplicate file by name.
27
+ *
28
+ * Delegates instead of reaching into `this.files` directly. The direct GridFS
29
+ * pipe this used to be was wrong in four separate ways, and every one of them
30
+ * is the kind of thing a consuming project copies out of here:
31
+ *
32
+ * - it only ever worked on the GridFS driver — under `file.storage: 's3'` or
33
+ * `'filesystem'` the source is simply not in the bucket;
34
+ * - it bypassed `checkRights()` entirely, so the owner rule below did not apply
35
+ * to a duplicate at all;
36
+ * - it returned the write stream without awaiting it, so the caller was told the
37
+ * copy existed while it was still being written;
38
+ * - neither stream carried an error handler, and an unhandled stream `'error'`
39
+ * takes the whole process down.
40
+ *
41
+ * `duplicateByName()` answers all four. Forward the caller's context so the
42
+ * duplicate is COVERED by the ownership rule rather than exempt from it.
26
43
  */
27
- async duplicate(fileName: string, newName: string): Promise<any> {
28
- return this.files.openDownloadStreamByName(fileName).pipe(this.files.openUploadStream(newName));
44
+ async duplicate(fileName: string, newName: string, serviceOptions?: FileServiceOptions): Promise<CoreFileInfo> {
45
+ return this.duplicateByName(fileName, newName, serviceOptions);
29
46
  }
30
47
 
31
48
  /**