@venturialstd/file-system 0.0.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 (138) hide show
  1. package/README.md +127 -0
  2. package/dist/constants/file-system-entity.constant.d.ts +13 -0
  3. package/dist/constants/file-system-entity.constant.d.ts.map +1 -0
  4. package/dist/constants/file-system-entity.constant.js +16 -0
  5. package/dist/constants/file-system-entity.constant.js.map +1 -0
  6. package/dist/constants/file-system-error.constant.d.ts +25 -0
  7. package/dist/constants/file-system-error.constant.d.ts.map +1 -0
  8. package/dist/constants/file-system-error.constant.js +29 -0
  9. package/dist/constants/file-system-error.constant.js.map +1 -0
  10. package/dist/constants/file-system-message.constant.d.ts +16 -0
  11. package/dist/constants/file-system-message.constant.d.ts.map +1 -0
  12. package/dist/constants/file-system-message.constant.js +19 -0
  13. package/dist/constants/file-system-message.constant.js.map +1 -0
  14. package/dist/constants/file-system-provider.constant.d.ts +12 -0
  15. package/dist/constants/file-system-provider.constant.d.ts.map +1 -0
  16. package/dist/constants/file-system-provider.constant.js +16 -0
  17. package/dist/constants/file-system-provider.constant.js.map +1 -0
  18. package/dist/constants/file-system-tree.constant.d.ts +8 -0
  19. package/dist/constants/file-system-tree.constant.d.ts.map +1 -0
  20. package/dist/constants/file-system-tree.constant.js +12 -0
  21. package/dist/constants/file-system-tree.constant.js.map +1 -0
  22. package/dist/constants/file-system.constant.d.ts +13 -0
  23. package/dist/constants/file-system.constant.d.ts.map +1 -0
  24. package/dist/constants/file-system.constant.js +31 -0
  25. package/dist/constants/file-system.constant.js.map +1 -0
  26. package/dist/constants/file-system.settings.constants.d.ts +8 -0
  27. package/dist/constants/file-system.settings.constants.d.ts.map +1 -0
  28. package/dist/constants/file-system.settings.constants.js +11 -0
  29. package/dist/constants/file-system.settings.constants.js.map +1 -0
  30. package/dist/constants/index.d.ts +2 -0
  31. package/dist/constants/index.d.ts.map +1 -0
  32. package/dist/constants/index.js +20 -0
  33. package/dist/constants/index.js.map +1 -0
  34. package/dist/entities/file-system-file.entity.d.ts +22 -0
  35. package/dist/entities/file-system-file.entity.d.ts.map +1 -0
  36. package/dist/entities/file-system-file.entity.js +108 -0
  37. package/dist/entities/file-system-file.entity.js.map +1 -0
  38. package/dist/entities/file-system-folder.entity.d.ts +17 -0
  39. package/dist/entities/file-system-folder.entity.d.ts.map +1 -0
  40. package/dist/entities/file-system-folder.entity.js +92 -0
  41. package/dist/entities/file-system-folder.entity.js.map +1 -0
  42. package/dist/errors/file-system-not-found.error.d.ts +6 -0
  43. package/dist/errors/file-system-not-found.error.d.ts.map +1 -0
  44. package/dist/errors/file-system-not-found.error.js +17 -0
  45. package/dist/errors/file-system-not-found.error.js.map +1 -0
  46. package/dist/errors/file-system-not-supported.error.d.ts +6 -0
  47. package/dist/errors/file-system-not-supported.error.d.ts.map +1 -0
  48. package/dist/errors/file-system-not-supported.error.js +17 -0
  49. package/dist/errors/file-system-not-supported.error.js.map +1 -0
  50. package/dist/errors/file-system-permission-denied.error.d.ts +6 -0
  51. package/dist/errors/file-system-permission-denied.error.d.ts.map +1 -0
  52. package/dist/errors/file-system-permission-denied.error.js +17 -0
  53. package/dist/errors/file-system-permission-denied.error.js.map +1 -0
  54. package/dist/errors/file-system-rate-limit.error.d.ts +6 -0
  55. package/dist/errors/file-system-rate-limit.error.d.ts.map +1 -0
  56. package/dist/errors/file-system-rate-limit.error.js +17 -0
  57. package/dist/errors/file-system-rate-limit.error.js.map +1 -0
  58. package/dist/errors/file-system.error.d.ts +10 -0
  59. package/dist/errors/file-system.error.d.ts.map +1 -0
  60. package/dist/errors/file-system.error.js +19 -0
  61. package/dist/errors/file-system.error.js.map +1 -0
  62. package/dist/errors/index.d.ts +6 -0
  63. package/dist/errors/index.d.ts.map +1 -0
  64. package/dist/errors/index.js +14 -0
  65. package/dist/errors/index.js.map +1 -0
  66. package/dist/file-system.module.d.ts +10 -0
  67. package/dist/file-system.module.d.ts.map +1 -0
  68. package/dist/file-system.module.js +68 -0
  69. package/dist/file-system.module.js.map +1 -0
  70. package/dist/index.d.ts +11 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +30 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/interfaces/backblaze-file-system-provider-options.interface.d.ts +9 -0
  75. package/dist/interfaces/backblaze-file-system-provider-options.interface.d.ts.map +1 -0
  76. package/dist/interfaces/backblaze-file-system-provider-options.interface.js +3 -0
  77. package/dist/interfaces/backblaze-file-system-provider-options.interface.js.map +1 -0
  78. package/dist/interfaces/file-system-backblaze-config.interface.d.ts +11 -0
  79. package/dist/interfaces/file-system-backblaze-config.interface.d.ts.map +1 -0
  80. package/dist/interfaces/file-system-backblaze-config.interface.js +3 -0
  81. package/dist/interfaces/file-system-backblaze-config.interface.js.map +1 -0
  82. package/dist/interfaces/file-system-module-options.interface.d.ts +9 -0
  83. package/dist/interfaces/file-system-module-options.interface.d.ts.map +1 -0
  84. package/dist/interfaces/file-system-module-options.interface.js +3 -0
  85. package/dist/interfaces/file-system-module-options.interface.js.map +1 -0
  86. package/dist/interfaces/file-system-provider.interface.d.ts +67 -0
  87. package/dist/interfaces/file-system-provider.interface.d.ts.map +1 -0
  88. package/dist/interfaces/file-system-provider.interface.js +3 -0
  89. package/dist/interfaces/file-system-provider.interface.js.map +1 -0
  90. package/dist/interfaces/file-system-tree-node.interface.d.ts +16 -0
  91. package/dist/interfaces/file-system-tree-node.interface.d.ts.map +1 -0
  92. package/dist/interfaces/file-system-tree-node.interface.js +3 -0
  93. package/dist/interfaces/file-system-tree-node.interface.js.map +1 -0
  94. package/dist/interfaces/index.d.ts +6 -0
  95. package/dist/interfaces/index.d.ts.map +1 -0
  96. package/dist/interfaces/index.js +3 -0
  97. package/dist/interfaces/index.js.map +1 -0
  98. package/dist/providers/backblaze-file-system.provider.d.ts +31 -0
  99. package/dist/providers/backblaze-file-system.provider.d.ts.map +1 -0
  100. package/dist/providers/backblaze-file-system.provider.js +160 -0
  101. package/dist/providers/backblaze-file-system.provider.js.map +1 -0
  102. package/dist/services/file-system.service.d.ts +52 -0
  103. package/dist/services/file-system.service.d.ts.map +1 -0
  104. package/dist/services/file-system.service.js +268 -0
  105. package/dist/services/file-system.service.js.map +1 -0
  106. package/dist/settings/file-system.settings.d.ts +5 -0
  107. package/dist/settings/file-system.settings.d.ts.map +1 -0
  108. package/dist/settings/file-system.settings.js +36 -0
  109. package/dist/settings/file-system.settings.js.map +1 -0
  110. package/dist/types/file-metadata.type.d.ts +12 -0
  111. package/dist/types/file-metadata.type.d.ts.map +1 -0
  112. package/dist/types/file-metadata.type.js +3 -0
  113. package/dist/types/file-metadata.type.js.map +1 -0
  114. package/dist/types/index.d.ts +7 -0
  115. package/dist/types/index.d.ts.map +1 -0
  116. package/dist/types/index.js +3 -0
  117. package/dist/types/index.js.map +1 -0
  118. package/dist/types/list-options.type.d.ts +10 -0
  119. package/dist/types/list-options.type.d.ts.map +1 -0
  120. package/dist/types/list-options.type.js +3 -0
  121. package/dist/types/list-options.type.js.map +1 -0
  122. package/dist/types/list-result-entry.type.d.ts +9 -0
  123. package/dist/types/list-result-entry.type.d.ts.map +1 -0
  124. package/dist/types/list-result-entry.type.js +3 -0
  125. package/dist/types/list-result-entry.type.js.map +1 -0
  126. package/dist/types/list-result.type.d.ts +10 -0
  127. package/dist/types/list-result.type.d.ts.map +1 -0
  128. package/dist/types/list-result.type.js +3 -0
  129. package/dist/types/list-result.type.js.map +1 -0
  130. package/dist/types/signed-url-result.type.d.ts +9 -0
  131. package/dist/types/signed-url-result.type.d.ts.map +1 -0
  132. package/dist/types/signed-url-result.type.js +3 -0
  133. package/dist/types/signed-url-result.type.js.map +1 -0
  134. package/dist/types/upload-options.type.d.ts +12 -0
  135. package/dist/types/upload-options.type.d.ts.map +1 -0
  136. package/dist/types/upload-options.type.js +3 -0
  137. package/dist/types/upload-options.type.js.map +1 -0
  138. package/package.json +35 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system-provider.interface.d.ts","sourceRoot":"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
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=file-system-provider.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system-provider.interface.js","sourceRoot":"","sources":["../../src/interfaces/file-system-provider.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { FileSystemTreeNodeType } from '../constants/file-system-tree.constant';
2
+ /** Tree node for API responses (folder with optional children and files). */
3
+ export interface FileSystemTreeNode {
4
+ id: string;
5
+ name: string;
6
+ type: FileSystemTreeNodeType;
7
+ path?: string | null;
8
+ children?: FileSystemTreeNode[];
9
+ /** Present when type === FILE. */
10
+ key?: string;
11
+ size?: number | null;
12
+ mimeType?: string | null;
13
+ createdAt: Date;
14
+ updatedAt: Date;
15
+ }
16
+ //# sourceMappingURL=file-system-tree-node.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system-tree-node.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/file-system-tree-node.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,6EAA6E;AAC7E,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,sBAAsB,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAChC,kCAAkC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=file-system-tree-node.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system-tree-node.interface.js","sourceRoot":"","sources":["../../src/interfaces/file-system-tree-node.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export type { IFileSystemProvider } from './file-system-provider.interface';
2
+ export type { FileSystemBackblazeConfig } from './file-system-backblaze-config.interface';
3
+ export type { FileSystemModuleOptions } from './file-system-module-options.interface';
4
+ export type { BackblazeFileSystemProviderOptions } from './backblaze-file-system-provider-options.interface';
5
+ export type { FileSystemTreeNode } from './file-system-tree-node.interface';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,YAAY,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,YAAY,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACtF,YAAY,EAAE,kCAAkC,EAAE,MAAM,oDAAoD,CAAC;AAC7G,YAAY,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import { BackblazeObjectService } from '@venturialstd/backblaze';
2
+ import type { IFileSystemProvider } from '../interfaces/file-system-provider.interface';
3
+ import type { BackblazeFileSystemProviderOptions } from '../interfaces/backblaze-file-system-provider-options.interface';
4
+ import type { FileMetadata, ListOptions, ListResult, SignedUrlResult, UploadOptions } from '../types';
5
+ /**
6
+ * File system provider implementation using Backblaze B2 (S3-compatible API).
7
+ * Uses the existing @venturialstd/backblaze module; no new Backblaze client logic here.
8
+ */
9
+ export declare class BackblazeFileSystemProvider implements IFileSystemProvider {
10
+ private readonly backblazeObjectService;
11
+ private readonly options;
12
+ constructor(backblazeObjectService: BackblazeObjectService, options: BackblazeFileSystemProviderOptions);
13
+ /**
14
+ * Always returns undefined so BackblazeObjectService uses the Backblaze
15
+ * package configuration (Settings). Credentials and region are never
16
+ * supplied by the file-system; they are inherited from Backblaze.
17
+ */
18
+ private getBackblazeOptions;
19
+ upload(key: string, body: Buffer | Uint8Array | string, options?: UploadOptions): Promise<void>;
20
+ download(key: string): Promise<ArrayBuffer>;
21
+ delete(key: string, options?: {
22
+ versionId?: string;
23
+ }): Promise<void>;
24
+ deleteMany(keys: string[]): Promise<void>;
25
+ list(prefix: string, listOptions?: ListOptions): Promise<ListResult>;
26
+ exists(key: string): Promise<FileMetadata>;
27
+ getSignedDownloadUrl(_key: string, _expiresInSeconds?: number): Promise<SignedUrlResult>;
28
+ getSignedUploadUrl(_key: string, _contentType?: string, _expiresInSeconds?: number): Promise<SignedUrlResult>;
29
+ private normalizeError;
30
+ }
31
+ //# sourceMappingURL=backblaze-file-system.provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backblaze-file-system.provider.d.ts","sourceRoot":"","sources":["../../src/providers/backblaze-file-system.provider.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EAEvB,MAAM,yBAAyB,CAAC;AAejC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,gEAAgE,CAAC;AACzH,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,UAAU,EACV,eAAe,EACf,aAAa,EACd,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,qBACa,2BAA4B,YAAW,mBAAmB;IAEnE,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,sBAAsB,EAAE,sBAAsB,EAC9C,OAAO,EAAE,kCAAkC;IAG9D;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAIrB,MAAM,CACV,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,EAClC,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,IAAI,CAAC;IAyBV,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAW3C,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAepE,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IA8BpE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAwB1C,oBAAoB,CACxB,IAAI,EAAE,MAAM,EACZ,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,eAAe,CAAC;IAIrB,kBAAkB,CACtB,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,EACrB,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,eAAe,CAAC;IAI3B,OAAO,CAAC,cAAc;CAkBvB"}
@@ -0,0 +1,160 @@
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.BackblazeFileSystemProvider = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const backblaze_1 = require("@venturialstd/backblaze");
15
+ const constants_1 = require("../constants");
16
+ const file_system_message_constant_1 = require("../constants/file-system-message.constant");
17
+ const errors_1 = require("../errors");
18
+ /**
19
+ * File system provider implementation using Backblaze B2 (S3-compatible API).
20
+ * Uses the existing @venturialstd/backblaze module; no new Backblaze client logic here.
21
+ */
22
+ let BackblazeFileSystemProvider = class BackblazeFileSystemProvider {
23
+ backblazeObjectService;
24
+ options;
25
+ constructor(backblazeObjectService, options) {
26
+ this.backblazeObjectService = backblazeObjectService;
27
+ this.options = options;
28
+ }
29
+ /**
30
+ * Always returns undefined so BackblazeObjectService uses the Backblaze
31
+ * package configuration (Settings). Credentials and region are never
32
+ * supplied by the file-system; they are inherited from Backblaze.
33
+ */
34
+ getBackblazeOptions() {
35
+ return undefined;
36
+ }
37
+ async upload(key, body, options) {
38
+ const buf = typeof body === 'string'
39
+ ? Buffer.from(body, 'utf8')
40
+ : body instanceof Uint8Array
41
+ ? Buffer.from(body)
42
+ : body;
43
+ try {
44
+ await this.backblazeObjectService.putObject({
45
+ bucketName: this.options.bucketName,
46
+ key,
47
+ body: buf,
48
+ contentType: options?.contentType,
49
+ metadata: options?.metadata,
50
+ cacheControl: options?.cacheControl,
51
+ contentDisposition: options?.contentDisposition,
52
+ }, this.getBackblazeOptions());
53
+ }
54
+ catch (err) {
55
+ throw this.normalizeError(err);
56
+ }
57
+ }
58
+ async download(key) {
59
+ try {
60
+ return await this.backblazeObjectService.getObject({ bucketName: this.options.bucketName, key }, this.getBackblazeOptions());
61
+ }
62
+ catch (err) {
63
+ throw this.normalizeError(err);
64
+ }
65
+ }
66
+ async delete(key, options) {
67
+ try {
68
+ await this.backblazeObjectService.deleteObject({
69
+ bucketName: this.options.bucketName,
70
+ key,
71
+ versionId: options?.versionId,
72
+ }, this.getBackblazeOptions());
73
+ }
74
+ catch (err) {
75
+ throw this.normalizeError(err);
76
+ }
77
+ }
78
+ async deleteMany(keys) {
79
+ await Promise.all(keys.map((k) => this.delete(k, undefined)));
80
+ }
81
+ async list(prefix, listOptions) {
82
+ try {
83
+ const result = await this.backblazeObjectService.listObjectsV2({
84
+ bucketName: this.options.bucketName,
85
+ prefix,
86
+ maxKeys: listOptions?.maxKeys,
87
+ continuationToken: listOptions?.continuationToken,
88
+ startAfter: listOptions?.startAfter,
89
+ }, this.getBackblazeOptions());
90
+ return {
91
+ entries: result.objects.map((o) => ({
92
+ key: o.key ?? '',
93
+ lastModified: o.lastModified,
94
+ etag: o.etag,
95
+ size: o.size,
96
+ storageClass: o.storageClass,
97
+ })),
98
+ isTruncated: result.isTruncated,
99
+ keyCount: result.keyCount,
100
+ nextContinuationToken: result.nextContinuationToken,
101
+ prefix: result.prefix,
102
+ };
103
+ }
104
+ catch (err) {
105
+ throw this.normalizeError(err);
106
+ }
107
+ }
108
+ async exists(key) {
109
+ try {
110
+ const headers = await this.backblazeObjectService.headObject({ bucketName: this.options.bucketName, key }, this.getBackblazeOptions());
111
+ const versionId = headers['x-amz-version-id'] ?? headers['X-Amz-Version-Id'];
112
+ return {
113
+ key,
114
+ contentLength: headers['content-length']
115
+ ? parseInt(headers['content-length'], 10)
116
+ : undefined,
117
+ contentType: headers['content-type'],
118
+ etag: headers.etag,
119
+ lastModified: headers['last-modified'],
120
+ metadata: undefined,
121
+ versionId: versionId ?? undefined,
122
+ };
123
+ }
124
+ catch (err) {
125
+ throw this.normalizeError(err);
126
+ }
127
+ }
128
+ async getSignedDownloadUrl(_key, _expiresInSeconds) {
129
+ throw new errors_1.FileSystemNotSupportedError(file_system_message_constant_1.FILE_SYSTEM_MESSAGES.SIGNED_DOWNLOAD_URL_BACKBLAZE);
130
+ }
131
+ async getSignedUploadUrl(_key, _contentType, _expiresInSeconds) {
132
+ throw new errors_1.FileSystemNotSupportedError(file_system_message_constant_1.FILE_SYSTEM_MESSAGES.SIGNED_UPLOAD_URL_BACKBLAZE);
133
+ }
134
+ normalizeError(err) {
135
+ if (err instanceof errors_1.FileSystemNotFoundError)
136
+ return err;
137
+ if (err instanceof errors_1.FileSystemPermissionDeniedError)
138
+ return err;
139
+ if (err instanceof errors_1.FileSystemRateLimitError)
140
+ return err;
141
+ if (err instanceof errors_1.FileSystemNotSupportedError)
142
+ return err;
143
+ if (err instanceof backblaze_1.BackblazeS3Error) {
144
+ if (err.isNotFound)
145
+ return new errors_1.FileSystemNotFoundError(err.message);
146
+ if (err.isAccessDenied)
147
+ return new errors_1.FileSystemPermissionDeniedError(err.message);
148
+ if (err.statusCode === constants_1.FILE_SYSTEM_HTTP_STATUS_RATE_LIMIT)
149
+ return new errors_1.FileSystemRateLimitError(err.message);
150
+ }
151
+ const message = err instanceof Error ? err.message : constants_1.FILE_SYSTEM_ERROR_MESSAGES.UNKNOWN;
152
+ return new errors_1.FileSystemError(message, constants_1.FileSystemErrorCode.UNKNOWN);
153
+ }
154
+ };
155
+ exports.BackblazeFileSystemProvider = BackblazeFileSystemProvider;
156
+ exports.BackblazeFileSystemProvider = BackblazeFileSystemProvider = __decorate([
157
+ (0, common_1.Injectable)(),
158
+ __metadata("design:paramtypes", [backblaze_1.BackblazeObjectService, Object])
159
+ ], BackblazeFileSystemProvider);
160
+ //# sourceMappingURL=backblaze-file-system.provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backblaze-file-system.provider.js","sourceRoot":"","sources":["../../src/providers/backblaze-file-system.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,uDAGiC;AAEjC,4CAIsB;AACtB,4FAAiF;AACjF,sCAMmB;AAWnB;;;GAGG;AAEI,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;I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orm';
2
+ import { FileSystemStorageProvider } from '../constants';
3
+ import { FileSystemFile } from '../entities/file-system-file.entity';
4
+ import { FileSystemFolder } from '../entities/file-system-folder.entity';
5
+ import type { IFileSystemProvider } from '../interfaces/file-system-provider.interface';
6
+ import type { FileSystemTreeNode } from '../interfaces/file-system-tree-node.interface';
7
+ import type { FileMetadata, ListOptions, ListResult, SignedUrlResult, UploadOptions } from '../types';
8
+ export declare class FileSystemService {
9
+ private readonly provider;
10
+ private readonly fileRepo;
11
+ private readonly folderRepo;
12
+ constructor(provider: IFileSystemProvider, fileRepo: Repository<FileSystemFile>, folderRepo: Repository<FileSystemFolder>);
13
+ upload(key: string, body: Buffer | Uint8Array | string, options?: UploadOptions): Promise<void>;
14
+ download(key: string): Promise<ArrayBuffer>;
15
+ deleteObject(key: string, options?: {
16
+ versionId?: string;
17
+ }): Promise<void>;
18
+ list(prefix: string, options?: ListOptions): Promise<ListResult>;
19
+ exists(key: string): Promise<FileMetadata>;
20
+ getSignedDownloadUrl(key: string, expiresInSeconds?: number): Promise<SignedUrlResult>;
21
+ getSignedUploadUrl(key: string, contentType?: string, expiresInSeconds?: number): Promise<SignedUrlResult>;
22
+ createFolder(name: string, parentId: string | null, metadata?: {
23
+ description?: string;
24
+ ownerId?: string;
25
+ }): Promise<FileSystemFolder>;
26
+ getFolder(id: string): Promise<FileSystemFolder>;
27
+ getFile(id: string): Promise<FileSystemFile>;
28
+ getChildren(folderId: string | null): Promise<{
29
+ folders: FileSystemFolder[];
30
+ files: FileSystemFile[];
31
+ }>;
32
+ getTree(rootFolderId?: string | null): Promise<FileSystemTreeNode[]>;
33
+ createFileRecord(params: {
34
+ name: string;
35
+ key: string;
36
+ folderId: string | null;
37
+ storageProvider: FileSystemStorageProvider;
38
+ mimeType?: string;
39
+ size?: number;
40
+ isPublic?: boolean;
41
+ originalFilename?: string;
42
+ metadata?: Record<string, unknown>;
43
+ }): Promise<FileSystemFile>;
44
+ moveFile(fileId: string, targetFolderId: string | null): Promise<void>;
45
+ moveFolder(folderId: string, targetParentId: string | null): Promise<void>;
46
+ deleteFile(id: string): Promise<void>;
47
+ deleteFolder(id: string): Promise<void>;
48
+ uploadAndCreateFile(folderId: string | null, fileName: string, body: Buffer | Uint8Array | string, options?: UploadOptions & {
49
+ storageProvider?: FileSystemStorageProvider;
50
+ }): Promise<FileSystemFile>;
51
+ }
52
+ //# sourceMappingURL=file-system.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system.service.d.ts","sourceRoot":"","sources":["../../src/services/file-system.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,UAAU,EAAE,MAAM,SAAS,CAAC;AAG7C,OAAO,EAML,yBAAyB,EAE1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACxF,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,UAAU,EACV,eAAe,EACf,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,qBACa,iBAAiB;IAG1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAEzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAEzB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAJV,QAAQ,EAAE,mBAAmB,EAE7B,QAAQ,EAAE,UAAU,CAAC,cAAc,CAAC,EAEpC,UAAU,EAAE,UAAU,CAAC,gBAAgB,CAAC;IAGrD,MAAM,CACV,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,EAClC,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,IAAI,CAAC;IAIV,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,W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ACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,eAAe,EAAE,yBAAyB,CAAC;QAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,cAAc,CAAC;IAcrB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBtE,UAAU,CACd,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GAAG,IAAI,GAC5B,OAAO,CAAC,IAAI,CAAC;IAyBV,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYrC,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBvC,mBAAmB,CACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,EAClC,OAAO,CAAC,EAAE,aAAa,GAAG;QAAE,eAAe,CAAC,EAAE,yBAAyB,CAAA;KAAE,GACxE,OAAO,CAAC,cAAc,CAAC;CAuB3B"}
@@ -0,0 +1,268 @@
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
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.FileSystemService = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const typeorm_1 = require("@nestjs/typeorm");
18
+ const typeorm_2 = require("typeorm");
19
+ const uuid_1 = require("uuid");
20
+ const constants_1 = require("../constants");
21
+ const file_system_file_entity_1 = require("../entities/file-system-file.entity");
22
+ const file_system_folder_entity_1 = require("../entities/file-system-folder.entity");
23
+ let FileSystemService = class FileSystemService {
24
+ provider;
25
+ fileRepo;
26
+ folderRepo;
27
+ constructor(provider, fileRepo, folderRepo) {
28
+ this.provider = provider;
29
+ this.fileRepo = fileRepo;
30
+ this.folderRepo = folderRepo;
31
+ }
32
+ async upload(key, body, options) {
33
+ return this.provider.upload(key, body, options);
34
+ }
35
+ async download(key) {
36
+ return this.provider.download(key);
37
+ }
38
+ async deleteObject(key, options) {
39
+ return this.provider.delete(key, options);
40
+ }
41
+ async list(prefix, options) {
42
+ return this.provider.list(prefix, options);
43
+ }
44
+ async exists(key) {
45
+ return this.provider.exists(key);
46
+ }
47
+ async getSignedDownloadUrl(key, expiresInSeconds) {
48
+ if (!this.provider.getSignedDownloadUrl) {
49
+ throw new Error(constants_1.FILE_SYSTEM_MESSAGES.SIGNED_DOWNLOAD_URL_NOT_SUPPORTED);
50
+ }
51
+ return this.provider.getSignedDownloadUrl(key, expiresInSeconds);
52
+ }
53
+ async getSignedUploadUrl(key, contentType, expiresInSeconds) {
54
+ if (!this.provider.getSignedUploadUrl) {
55
+ throw new Error(constants_1.FILE_SYSTEM_MESSAGES.SIGNED_UPLOAD_URL_NOT_SUPPORTED);
56
+ }
57
+ return this.provider.getSignedUploadUrl(key, contentType, expiresInSeconds);
58
+ }
59
+ async createFolder(name, parentId, metadata) {
60
+ const folder = this.folderRepo.create({
61
+ name,
62
+ parentId,
63
+ isRoot: parentId == null,
64
+ description: metadata?.description ?? null,
65
+ ownerId: metadata?.ownerId ?? null,
66
+ });
67
+ if (parentId) {
68
+ const parent = await this.folderRepo.findOne({ where: { id: parentId } });
69
+ if (parent)
70
+ folder.parent = parent;
71
+ }
72
+ return this.folderRepo.save(folder);
73
+ }
74
+ async getFolder(id) {
75
+ const folder = await this.folderRepo.findOne({
76
+ where: { id },
77
+ relations: ['parent', 'children', 'files'],
78
+ });
79
+ if (!folder)
80
+ throw new common_1.NotFoundException(constants_1.FILE_SYSTEM_MESSAGES.FOLDER_NOT_FOUND);
81
+ return folder;
82
+ }
83
+ async getFile(id) {
84
+ const file = await this.fileRepo.findOne({
85
+ where: { id },
86
+ relations: ['folder'],
87
+ });
88
+ if (!file)
89
+ throw new common_1.NotFoundException(constants_1.FILE_SYSTEM_MESSAGES.FILE_NOT_FOUND);
90
+ return file;
91
+ }
92
+ async getChildren(folderId) {
93
+ const parentWhere = folderId == null ? { parentId: (0, typeorm_2.IsNull)() } : { parentId: folderId };
94
+ const folderWhere = folderId == null ? { folderId: (0, typeorm_2.IsNull)() } : { folderId };
95
+ const folders = await this.folderRepo.find({
96
+ where: parentWhere,
97
+ order: { name: 'ASC' },
98
+ });
99
+ const files = await this.fileRepo.find({
100
+ where: folderWhere,
101
+ order: { name: 'ASC' },
102
+ });
103
+ return { folders, files };
104
+ }
105
+ async getTree(rootFolderId) {
106
+ const treeRepo = this.folderRepo.manager.getTreeRepository(file_system_folder_entity_1.FileSystemFolder);
107
+ const toNode = (folder) => ({
108
+ id: folder.id,
109
+ name: folder.name,
110
+ type: constants_1.FileSystemTreeNodeType.FOLDER,
111
+ path: folder.path,
112
+ children: [
113
+ ...(folder.children?.map(toNode) ?? []),
114
+ ...(folder.files?.map((f) => ({
115
+ id: f.id,
116
+ name: f.name,
117
+ type: constants_1.FileSystemTreeNodeType.FILE,
118
+ key: f.key,
119
+ size: f.size,
120
+ mimeType: f.mimeType,
121
+ createdAt: f.createdAt,
122
+ updatedAt: f.updatedAt,
123
+ })) ?? []),
124
+ ],
125
+ createdAt: folder.createdAt,
126
+ updatedAt: folder.updatedAt,
127
+ });
128
+ if (rootFolderId) {
129
+ const root = await this.folderRepo.findOne({
130
+ where: { id: rootFolderId },
131
+ relations: ['files'],
132
+ });
133
+ if (!root)
134
+ throw new common_1.NotFoundException(constants_1.FILE_SYSTEM_MESSAGES.FOLDER_NOT_FOUND);
135
+ const tree = await treeRepo.findDescendantsTree(root, {
136
+ depth: constants_1.FILE_SYSTEM_TREE_DEPTH_DEFAULT,
137
+ relations: ['files'],
138
+ });
139
+ return [toNode(tree)];
140
+ }
141
+ const roots = await treeRepo.findTrees({ relations: ['files'] });
142
+ return roots.map(toNode);
143
+ }
144
+ async createFileRecord(params) {
145
+ const file = this.fileRepo.create({
146
+ ...params,
147
+ fileType: constants_1.FILE_SYSTEM_FILE_TYPE_DEFAULT,
148
+ });
149
+ if (params.folderId) {
150
+ const folder = await this.folderRepo.findOne({
151
+ where: { id: params.folderId },
152
+ });
153
+ if (folder)
154
+ file.folder = folder;
155
+ }
156
+ return this.fileRepo.save(file);
157
+ }
158
+ async moveFile(fileId, targetFolderId) {
159
+ const file = await this.fileRepo.findOne({ where: { id: fileId } });
160
+ if (!file)
161
+ throw new common_1.NotFoundException(constants_1.FILE_SYSTEM_MESSAGES.FILE_NOT_FOUND);
162
+ if (targetFolderId) {
163
+ const folder = await this.folderRepo.findOne({
164
+ where: { id: targetFolderId },
165
+ });
166
+ if (!folder)
167
+ throw new common_1.NotFoundException(constants_1.FILE_SYSTEM_MESSAGES.TARGET_FOLDER_NOT_FOUND);
168
+ file.folderId = targetFolderId;
169
+ file.folder = folder;
170
+ }
171
+ else {
172
+ file.folderId = null;
173
+ file.folder = null;
174
+ }
175
+ await this.fileRepo.save(file);
176
+ }
177
+ async moveFolder(folderId, targetParentId) {
178
+ if (folderId === targetParentId) {
179
+ throw new Error(constants_1.FILE_SYSTEM_MESSAGES.FOLDER_CANNOT_MOVE_INTO_ITSELF);
180
+ }
181
+ const folder = await this.folderRepo.findOne({ where: { id: folderId } });
182
+ if (!folder)
183
+ throw new common_1.NotFoundException(constants_1.FILE_SYSTEM_MESSAGES.FOLDER_NOT_FOUND);
184
+ if (targetParentId) {
185
+ const target = await this.folderRepo.findOne({
186
+ where: { id: targetParentId },
187
+ });
188
+ if (!target)
189
+ throw new common_1.NotFoundException(constants_1.FILE_SYSTEM_MESSAGES.DESTINATION_FOLDER_NOT_FOUND);
190
+ folder.parentId = targetParentId;
191
+ folder.parent = target;
192
+ folder.isRoot = false;
193
+ }
194
+ else {
195
+ folder.parentId = null;
196
+ folder.parent = null;
197
+ folder.isRoot = true;
198
+ }
199
+ await this.folderRepo.save(folder);
200
+ }
201
+ async deleteFile(id) {
202
+ const file = await this.fileRepo.findOne({ where: { id } });
203
+ if (!file)
204
+ throw new common_1.NotFoundException(constants_1.FILE_SYSTEM_MESSAGES.FILE_NOT_FOUND);
205
+ try {
206
+ const meta = await this.provider.exists(file.key);
207
+ await this.provider.delete(file.key, { versionId: meta.versionId });
208
+ }
209
+ catch {
210
+ // Object may already be gone; still remove DB record
211
+ }
212
+ await this.fileRepo.remove(file);
213
+ }
214
+ async deleteFolder(id) {
215
+ const folder = await this.folderRepo.findOne({
216
+ where: { id },
217
+ relations: ['files', 'children'],
218
+ });
219
+ if (!folder)
220
+ throw new common_1.NotFoundException(constants_1.FILE_SYSTEM_MESSAGES.FOLDER_NOT_FOUND);
221
+ for (const file of folder.files ?? []) {
222
+ try {
223
+ const meta = await this.provider.exists(file.key);
224
+ await this.provider.delete(file.key, { versionId: meta.versionId });
225
+ }
226
+ catch {
227
+ // Object may already be gone; still remove DB record
228
+ }
229
+ await this.fileRepo.remove(file);
230
+ }
231
+ for (const child of folder.children ?? []) {
232
+ await this.deleteFolder(child.id);
233
+ }
234
+ await this.folderRepo.remove(folder);
235
+ }
236
+ async uploadAndCreateFile(folderId, fileName, body, options) {
237
+ const ext = fileName.includes('.')
238
+ ? fileName.slice(fileName.lastIndexOf('.'))
239
+ : '';
240
+ const pathSegment = folderId ?? constants_1.FILE_SYSTEM_PATH_SEGMENT_ROOT;
241
+ const key = `${pathSegment}/${(0, uuid_1.v4)()}${ext}`;
242
+ await this.provider.upload(key, body, options);
243
+ return this.createFileRecord({
244
+ name: fileName,
245
+ key,
246
+ folderId,
247
+ storageProvider: options?.storageProvider ?? constants_1.FileSystemStorageProvider.BACKBLAZE,
248
+ mimeType: options?.contentType,
249
+ size: Buffer.isBuffer(body)
250
+ ? body.length
251
+ : typeof body === 'string'
252
+ ? Buffer.byteLength(body)
253
+ : body.byteLength,
254
+ originalFilename: fileName,
255
+ metadata: options?.metadata,
256
+ });
257
+ }
258
+ };
259
+ exports.FileSystemService = FileSystemService;
260
+ exports.FileSystemService = FileSystemService = __decorate([
261
+ (0, common_1.Injectable)(),
262
+ __param(0, (0, common_1.Inject)(constants_1.FILE_SYSTEM_DI_TOKENS.PROVIDER)),
263
+ __param(1, (0, typeorm_1.InjectRepository)(file_system_file_entity_1.FileSystemFile)),
264
+ __param(2, (0, typeorm_1.InjectRepository)(file_system_folder_entity_1.FileSystemFolder)),
265
+ __metadata("design:paramtypes", [Object, typeorm_2.Repository,
266
+ typeorm_2.Repository])
267
+ ], FileSystemService);
268
+ //# sourceMappingURL=file-system.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system.service.js","sourceRoot":"","sources":["../../src/services/file-system.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuE;AACvE,6CAAmD;AACnD,qCAA6C;AAC7C,+BAAoC;AAEpC,4CAQsB;AACtB,iFAAqE;AACrE,qFAAyE;AAYlE,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAGT;IAEA;IAEA;IANnB,YAEmB,QAA6B,EAE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,CAAC,UAAU,CAAC,IAAI,CAAC;oBACzB,CAAC,CAAC,IAAI,CAAC,UAAU;YACrB,gBAAgB,EAAE,QAAQ;YAC1B,QAAQ,EAAE,OAAO,EAAE,QAA+C;SACnE,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA1RY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,iCAAqB,CAAC,QAAQ,CAAC,CAAA;IAEtC,WAAA,IAAA,0BAAgB,EAAC,wCAAc,CAAC,CAAA;IAEhC,WAAA,IAAA,0BAAgB,EAAC,4CAAgB,CAAC,CAAA;6CADR,oBAAU;QAER,oBAAU;GAP9B,iBAAiB,CA0R7B"}
@@ -0,0 +1,5 @@
1
+ import { Settings } from '@venturialstd/core';
2
+ export declare const FILE_SYSTEM_SETTINGS: Omit<Settings, 'id' | 'createdAt' | 'updatedAt'>[];
3
+ /** Exported as SETTINGS so @venturialstd/core can discover and register these settings. */
4
+ export declare const SETTINGS: Omit<Settings, "id" | "createdAt" | "updatedAt">[];
5
+ //# sourceMappingURL=file-system.settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system.settings.d.ts","sourceRoot":"","sources":["../../src/settings/file-system.settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,oBAAoB,CAAC;AAI7D,eAAO,MAAM,oBAAoB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,CAAC,EA2BlF,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,QAAQ,oDAAuB,CAAC"}