@ostro/filesystem 1.0.3 → 2.0.0-alpha.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 (66) hide show
  1. package/adapter/CoreAdapter.d.ts +139 -0
  2. package/adapter/CoreAdapter.d.ts.map +1 -0
  3. package/adapter/CoreAdapter.js +164 -57
  4. package/adapter/CoreAdapter.js.map +1 -0
  5. package/adapter/azure.d.ts +36 -0
  6. package/adapter/azure.d.ts.map +1 -0
  7. package/adapter/azure.js +93 -56
  8. package/adapter/azure.js.map +1 -0
  9. package/adapter/local.d.ts +78 -0
  10. package/adapter/local.d.ts.map +1 -0
  11. package/adapter/local.js +136 -66
  12. package/adapter/local.js.map +1 -0
  13. package/adapter/s3.d.ts +36 -0
  14. package/adapter/s3.d.ts.map +1 -0
  15. package/adapter/s3.js +102 -70
  16. package/adapter/s3.js.map +1 -0
  17. package/callbackHandler.d.ts +69 -0
  18. package/callbackHandler.d.ts.map +1 -0
  19. package/callbackHandler.js +93 -23
  20. package/callbackHandler.js.map +1 -0
  21. package/clients/azure.d.ts +32 -0
  22. package/clients/azure.d.ts.map +1 -0
  23. package/clients/azure.js +43 -13
  24. package/clients/azure.js.map +1 -0
  25. package/clients/s3.d.ts +27 -0
  26. package/clients/s3.d.ts.map +1 -0
  27. package/clients/s3.js +40 -9
  28. package/clients/s3.js.map +1 -0
  29. package/directoryCreateException.d.ts +18 -0
  30. package/directoryCreateException.d.ts.map +1 -0
  31. package/directoryCreateException.js +27 -5
  32. package/directoryCreateException.js.map +1 -0
  33. package/fileDeleteException.d.ts +19 -0
  34. package/fileDeleteException.d.ts.map +1 -0
  35. package/fileDeleteException.js +28 -4
  36. package/fileDeleteException.js.map +1 -0
  37. package/fileNotFoundException.d.ts +18 -0
  38. package/fileNotFoundException.d.ts.map +1 -0
  39. package/fileNotFoundException.js +27 -5
  40. package/fileNotFoundException.js.map +1 -0
  41. package/fileUploadException.d.ts +18 -0
  42. package/fileUploadException.d.ts.map +1 -0
  43. package/fileUploadException.js +28 -5
  44. package/fileUploadException.js.map +1 -0
  45. package/filesystem.d.ts +300 -0
  46. package/filesystem.d.ts.map +1 -0
  47. package/filesystem.js +389 -192
  48. package/filesystem.js.map +1 -0
  49. package/filesystemAdapter.d.ts +91 -0
  50. package/filesystemAdapter.d.ts.map +1 -0
  51. package/filesystemAdapter.js +134 -52
  52. package/filesystemAdapter.js.map +1 -0
  53. package/filesystemManager.d.ts +94 -0
  54. package/filesystemManager.d.ts.map +1 -0
  55. package/filesystemManager.js +141 -57
  56. package/filesystemManager.js.map +1 -0
  57. package/filesystemServiceProvider.d.ts +40 -0
  58. package/filesystemServiceProvider.d.ts.map +1 -0
  59. package/filesystemServiceProvider.js +49 -21
  60. package/filesystemServiceProvider.js.map +1 -0
  61. package/invalidArgumentException.d.ts +17 -0
  62. package/invalidArgumentException.d.ts.map +1 -0
  63. package/invalidArgumentException.js +26 -4
  64. package/invalidArgumentException.js.map +1 -0
  65. package/package.json +24 -10
  66. package/.github/workflows/npm-publish.yml +0 -22
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Class FilesystemHandler.
3
+ */
4
+ declare class FilesystemHandler {
5
+ /**
6
+ * exists method.
7
+ *
8
+ * @param error - Potential error.
9
+ * @param data - Existence check result.
10
+ * @param callback - Resolution callback.
11
+ * @param path - File path.
12
+ * @param options - Options object.
13
+ * @param basePath - Base path.
14
+ */
15
+ exists(error: unknown, data: Record<string, any> | boolean | null, callback: (res: any) => void, path?: string, options?: Record<string, any>, basePath?: any): void;
16
+ /**
17
+ * get method.
18
+ *
19
+ * @param error - Potential error.
20
+ * @param data - Retrieved data.
21
+ * @param callback - Resolution callback.
22
+ * @param path - File path.
23
+ * @param options - Options object.
24
+ * @param basePath - Base path.
25
+ */
26
+ get(error: unknown, data: any, callback: (res: any) => void, path?: string, options?: Record<string, any>, basePath?: any): void;
27
+ /**
28
+ * delete method.
29
+ *
30
+ * @param error - Potential error.
31
+ * @param data - Deletion result.
32
+ * @param callback - Resolution callback.
33
+ * @param path - File path.
34
+ * @param options - Options object.
35
+ * @param basePath - Base path.
36
+ */
37
+ delete(error: unknown, data: any, callback: (res: any) => void, path?: string, options?: Record<string, any>, basePath?: any): void;
38
+ /**
39
+ * put method.
40
+ *
41
+ * @param error - Potential error.
42
+ * @param data - Write result.
43
+ * @param callback - Resolution callback.
44
+ * @param path - File path.
45
+ * @param options - Options object.
46
+ * @param basePath - Base path.
47
+ */
48
+ put(error: unknown, data: any, callback: (res: any) => void, path?: string, options?: Record<string, any>, basePath?: any): void;
49
+ /**
50
+ * global method.
51
+ *
52
+ * @param error - Potential error.
53
+ * @param data - Global data.
54
+ * @param callback - Resolution callback.
55
+ * @param path - File path.
56
+ * @param options - Options object.
57
+ */
58
+ global(error: unknown, data: any, callback: (res: any) => void, path?: string, options?: Record<string, any>): void;
59
+ /**
60
+ * createDir method.
61
+ *
62
+ * @param error - Potential error.
63
+ * @param data - Creation result.
64
+ * @param callback - Resolution callback.
65
+ */
66
+ createDir(error: unknown, data: any, callback: (res: any) => void): void;
67
+ }
68
+ export default FilesystemHandler;
69
+ //# sourceMappingURL=callbackHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callbackHandler.d.ts","sourceRoot":"","sources":["../src/callbackHandler.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAM,iBAAiB;IACnB;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,IAAI,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,GAAG,GAAG,IAAI;IAQpK;;;;;;;;;OASG;IACH,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,GAAG,GAAG,IAAI;IAQhI;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,GAAG,GAAG,IAAI;IAQnI;;;;;;;;;OASG;IACH,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,GAAG,GAAG,IAAI;IAQhI;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAQnH;;;;;;OAMG;IACH,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;CAO3E;AAED,eAAe,iBAAiB,CAAC"}
@@ -1,49 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Class FilesystemHandler.
5
+ */
1
6
  class FilesystemHandler {
7
+ /**
8
+ * exists method.
9
+ *
10
+ * @param error - Potential error.
11
+ * @param data - Existence check result.
12
+ * @param callback - Resolution callback.
13
+ * @param path - File path.
14
+ * @param options - Options object.
15
+ * @param basePath - Base path.
16
+ */
2
17
  exists(error, data, callback, path, options, basePath) {
3
18
  if (error) {
4
- callback(error)
5
- } else {
6
- callback(data)
19
+ callback(error);
20
+ }
21
+ else {
22
+ callback(data);
7
23
  }
8
-
9
24
  }
10
-
25
+ /**
26
+ * get method.
27
+ *
28
+ * @param error - Potential error.
29
+ * @param data - Retrieved data.
30
+ * @param callback - Resolution callback.
31
+ * @param path - File path.
32
+ * @param options - Options object.
33
+ * @param basePath - Base path.
34
+ */
11
35
  get(error, data, callback, path, options, basePath) {
12
36
  if (error) {
13
- callback(error)
14
- } else {
15
- callback(data)
37
+ callback(error);
38
+ }
39
+ else {
40
+ callback(data);
16
41
  }
17
42
  }
18
-
43
+ /**
44
+ * delete method.
45
+ *
46
+ * @param error - Potential error.
47
+ * @param data - Deletion result.
48
+ * @param callback - Resolution callback.
49
+ * @param path - File path.
50
+ * @param options - Options object.
51
+ * @param basePath - Base path.
52
+ */
19
53
  delete(error, data, callback, path, options, basePath) {
20
54
  if (error) {
21
- callback(error)
22
- } else {
23
- callback(data)
55
+ callback(error);
56
+ }
57
+ else {
58
+ callback(data);
24
59
  }
25
60
  }
26
-
61
+ /**
62
+ * put method.
63
+ *
64
+ * @param error - Potential error.
65
+ * @param data - Write result.
66
+ * @param callback - Resolution callback.
67
+ * @param path - File path.
68
+ * @param options - Options object.
69
+ * @param basePath - Base path.
70
+ */
27
71
  put(error, data, callback, path, options, basePath) {
28
72
  if (error) {
29
- callback(error)
30
- } else {
31
- callback(data)
73
+ callback(error);
74
+ }
75
+ else {
76
+ callback(data);
32
77
  }
33
78
  }
79
+ /**
80
+ * global method.
81
+ *
82
+ * @param error - Potential error.
83
+ * @param data - Global data.
84
+ * @param callback - Resolution callback.
85
+ * @param path - File path.
86
+ * @param options - Options object.
87
+ */
34
88
  global(error, data, callback, path, options) {
35
89
  if (error) {
36
- callback(error)
37
- } else {
38
- callback(data)
90
+ callback(error);
91
+ }
92
+ else {
93
+ callback(data);
39
94
  }
40
95
  }
96
+ /**
97
+ * createDir method.
98
+ *
99
+ * @param error - Potential error.
100
+ * @param data - Creation result.
101
+ * @param callback - Resolution callback.
102
+ */
41
103
  createDir(error, data, callback) {
42
104
  if (error) {
43
- callback(error)
44
- } else {
45
- callback(true)
105
+ callback(error);
106
+ }
107
+ else {
108
+ callback(true);
46
109
  }
47
110
  }
48
111
  }
49
- module.exports = FilesystemHandler
112
+ exports.default = FilesystemHandler;
113
+ //# sourceMappingURL=callbackHandler.js.map
114
+ if (exports.default) {
115
+ const d = exports.default;
116
+ module.exports = d;
117
+ Object.assign(module.exports, exports);
118
+ module.exports.default = d;
119
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callbackHandler.js","sourceRoot":"","sources":["../src/callbackHandler.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,MAAM,iBAAiB;IACnB;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAc,EAAE,IAA0C,EAAE,QAA4B,EAAE,IAAa,EAAE,OAA6B,EAAE,QAAc;QACzJ,IAAI,KAAK,EAAE,CAAC;YACR,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACJ,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,GAAG,CAAC,KAAc,EAAE,IAAS,EAAE,QAA4B,EAAE,IAAa,EAAE,OAA6B,EAAE,QAAc;QACrH,IAAI,KAAK,EAAE,CAAC;YACR,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACJ,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAc,EAAE,IAAS,EAAE,QAA4B,EAAE,IAAa,EAAE,OAA6B,EAAE,QAAc;QACxH,IAAI,KAAK,EAAE,CAAC;YACR,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACJ,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,GAAG,CAAC,KAAc,EAAE,IAAS,EAAE,QAA4B,EAAE,IAAa,EAAE,OAA6B,EAAE,QAAc;QACrH,IAAI,KAAK,EAAE,CAAC;YACR,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACJ,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAc,EAAE,IAAS,EAAE,QAA4B,EAAE,IAAa,EAAE,OAA6B;QACxG,IAAI,KAAK,EAAE,CAAC;YACR,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACJ,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,SAAS,CAAC,KAAc,EAAE,IAAS,EAAE,QAA4B;QAC7D,IAAI,KAAK,EAAE,CAAC;YACR,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACJ,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACL,CAAC;CACJ;AAED,kBAAe,iBAAiB,CAAC"}
@@ -0,0 +1,32 @@
1
+ declare const kContainer: unique symbol;
2
+ declare const kConnection: unique symbol;
3
+ /**
4
+ * Class AzureClient.
5
+ */
6
+ declare class AzureClient {
7
+ [kContainer]: any;
8
+ [kConnection]: any;
9
+ /**
10
+ * Create a new instance.
11
+ *
12
+ * @param $config - Azure connection configuration.
13
+ */
14
+ constructor($config: Record<string, any>);
15
+ /**
16
+ * getConnection method.
17
+ *
18
+ * @param account - Storage account name.
19
+ * @param key - Storage account key.
20
+ * @returns BlobServiceClient instance or existing connection.
21
+ */
22
+ getConnection(account?: string, key?: string): any;
23
+ /**
24
+ * getContainer method.
25
+ *
26
+ * @param container - Container name.
27
+ * @returns ContainerClient instance or default container.
28
+ */
29
+ getContainer(container?: string): any;
30
+ }
31
+ export default AzureClient;
32
+ //# sourceMappingURL=azure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azure.d.ts","sourceRoot":"","sources":["../../src/clients/azure.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,UAAU,EAAE,OAAO,MAA4B,CAAC;AACtD,QAAA,MAAM,WAAW,EAAE,OAAO,MAA6B,CAAC;AAExD;;GAEG;AACH,cAAM,WAAW;IACb,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC;IAClB,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC;IAEnB;;;;OAIG;gBACS,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAMxC;;;;;;OAMG;IACI,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG;IAazD;;;;;OAKG;IACI,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,GAAG;CAM/C;AAED,eAAe,WAAW,CAAC"}
package/clients/azure.js CHANGED
@@ -1,27 +1,57 @@
1
- const { BlobServiceClient, StorageSharedKeyCredential } = require("@azure/storage-blob");
2
- const kContainer = Symbol('container')
3
- const kConnection = Symbol('connection')
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const kContainer = Symbol('container');
4
+ const kConnection = Symbol('connection');
5
+ /**
6
+ * Class AzureClient.
7
+ */
4
8
  class AzureClient {
9
+ [kContainer];
10
+ [kConnection];
11
+ /**
12
+ * Create a new instance.
13
+ *
14
+ * @param $config - Azure connection configuration.
15
+ */
5
16
  constructor($config) {
6
17
  this[kConnection] = this.getConnection($config['account'], Buffer.from($config['key'], 'base64').toString('ascii'));
7
18
  this[kContainer] = this.getContainer($config['container']);
8
- return this
19
+ return this;
9
20
  }
21
+ /**
22
+ * getConnection method.
23
+ *
24
+ * @param account - Storage account name.
25
+ * @param key - Storage account key.
26
+ * @returns BlobServiceClient instance or existing connection.
27
+ */
10
28
  getConnection(account, key) {
11
29
  if (account || key) {
12
- return new BlobServiceClient(
13
- `https://${account}.blob.core.windows.net`,
14
- new StorageSharedKeyCredential(account, key)
15
- );
30
+ const azureBlob = require('@azure/storage-blob');
31
+ const BlobServiceClient = azureBlob.BlobServiceClient;
32
+ const StorageSharedKeyCredential = azureBlob.StorageSharedKeyCredential;
33
+ return new BlobServiceClient(`https://${account}.blob.core.windows.net`, new StorageSharedKeyCredential(account, key));
16
34
  }
17
- return this[kConnection]
35
+ return this[kConnection];
18
36
  }
37
+ /**
38
+ * getContainer method.
39
+ *
40
+ * @param container - Container name.
41
+ * @returns ContainerClient instance or default container.
42
+ */
19
43
  getContainer(container) {
20
44
  if (container) {
21
- return this[kConnection].getContainerClient(container)
45
+ return this[kConnection].getContainerClient(container);
22
46
  }
23
- return this[kContainer]
47
+ return this[kContainer];
24
48
  }
25
-
26
49
  }
27
- module.exports = AzureClient
50
+ exports.default = AzureClient;
51
+ //# sourceMappingURL=azure.js.map
52
+ if (exports.default) {
53
+ const d = exports.default;
54
+ module.exports = d;
55
+ Object.assign(module.exports, exports);
56
+ module.exports.default = d;
57
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azure.js","sourceRoot":"","sources":["../../src/clients/azure.ts"],"names":[],"mappings":";;AAAA,MAAM,UAAU,GAAkB,MAAM,CAAC,WAAW,CAAC,CAAC;AACtD,MAAM,WAAW,GAAkB,MAAM,CAAC,YAAY,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW;IACb,CAAC,UAAU,CAAC,CAAM;IAClB,CAAC,WAAW,CAAC,CAAM;IAEnB;;;;OAIG;IACH,YAAY,OAA4B;QACpC,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QACpH,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACI,aAAa,CAAC,OAAgB,EAAE,GAAY;QAC/C,IAAI,OAAO,IAAI,GAAG,EAAE,CAAC;YACjB,MAAM,SAAS,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;YACjD,MAAM,iBAAiB,GAAG,SAAS,CAAC,iBAAiB,CAAC;YACtD,MAAM,0BAA0B,GAAG,SAAS,CAAC,0BAA0B,CAAC;YACxE,OAAO,IAAI,iBAAiB,CACxB,WAAW,OAAO,wBAAwB,EAC1C,IAAI,0BAA0B,CAAC,OAAQ,EAAE,GAAI,CAAC,CACjD,CAAC;QACN,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACI,YAAY,CAAC,SAAkB;QAClC,IAAI,SAAS,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC;CACJ;AAED,kBAAe,WAAW,CAAC"}
@@ -0,0 +1,27 @@
1
+ declare const kConnection: unique symbol;
2
+ /**
3
+ * Class S3Client.
4
+ */
5
+ declare class S3Client {
6
+ [kConnection]: any;
7
+ /**
8
+ * Create a new instance.
9
+ *
10
+ * @param $config - S3 connection options.
11
+ */
12
+ constructor($config: Record<string, any>);
13
+ /**
14
+ * getConnection method.
15
+ *
16
+ * @returns S3 instance.
17
+ */
18
+ getConnection(): any;
19
+ /**
20
+ * applyConnection method.
21
+ *
22
+ * @param $config - S3 connection options.
23
+ */
24
+ applyConnection($config: Record<string, any>): void;
25
+ }
26
+ export default S3Client;
27
+ //# sourceMappingURL=s3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../src/clients/s3.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW,EAAE,OAAO,MAA6B,CAAC;AAExD;;GAEG;AACH,cAAM,QAAQ;IACV,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC;IAEnB;;;;OAIG;gBACS,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAKxC;;;;OAIG;IACI,aAAa,IAAI,GAAG;IAI3B;;;;OAIG;IACI,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;CAS7D;AAED,eAAe,QAAQ,CAAC"}
package/clients/s3.js CHANGED
@@ -1,17 +1,48 @@
1
- const { S3 } = require("aws-sdk");
2
- const kConnection = Symbol('connection')
3
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const kConnection = Symbol('connection');
4
+ /**
5
+ * Class S3Client.
6
+ */
4
7
  class S3Client {
8
+ [kConnection];
9
+ /**
10
+ * Create a new instance.
11
+ *
12
+ * @param $config - S3 connection options.
13
+ */
5
14
  constructor($config) {
6
- this.applyConnection($config)
7
- return this
15
+ this.applyConnection($config);
16
+ return this;
8
17
  }
18
+ /**
19
+ * getConnection method.
20
+ *
21
+ * @returns S3 instance.
22
+ */
9
23
  getConnection() {
10
- return this[kConnection]
24
+ return this[kConnection];
11
25
  }
26
+ /**
27
+ * applyConnection method.
28
+ *
29
+ * @param $config - S3 connection options.
30
+ */
12
31
  applyConnection($config) {
13
- this[kConnection] = new S3({ accessKeyId: $config['key'], secretAccessKey: $config['secret'], params: { Bucket: $config['bucket'] } })
32
+ const awsSdk = require('aws-sdk');
33
+ const S3 = awsSdk.S3;
34
+ this[kConnection] = new S3({
35
+ accessKeyId: $config['key'],
36
+ secretAccessKey: $config['secret'],
37
+ params: { Bucket: $config['bucket'] }
38
+ });
14
39
  }
15
-
16
40
  }
17
- module.exports = S3Client
41
+ exports.default = S3Client;
42
+ //# sourceMappingURL=s3.js.map
43
+ if (exports.default) {
44
+ const d = exports.default;
45
+ module.exports = d;
46
+ Object.assign(module.exports, exports);
47
+ module.exports.default = d;
48
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3.js","sourceRoot":"","sources":["../../src/clients/s3.ts"],"names":[],"mappings":";;AAAA,MAAM,WAAW,GAAkB,MAAM,CAAC,YAAY,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,QAAQ;IACV,CAAC,WAAW,CAAC,CAAM;IAEnB;;;;OAIG;IACH,YAAY,OAA4B;QACpC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,aAAa;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACI,eAAe,CAAC,OAA4B;QAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAClC,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,EAAE,CAAC;YACvB,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC;YAC3B,eAAe,EAAE,OAAO,CAAC,QAAQ,CAAC;YAClC,MAAM,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE;SACxC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,18 @@
1
+ import DirectoryCreateExceptionContract from '@ostro/contracts/filesystem/directoryCreateException';
2
+ /**
3
+ * Class DirectoryCreateException.
4
+ */
5
+ declare class DirectoryCreateException extends DirectoryCreateExceptionContract {
6
+ name: string;
7
+ message: string;
8
+ errors: unknown;
9
+ statusCode: number;
10
+ /**
11
+ * Create a new instance.
12
+ *
13
+ * @param errors - Error details or message.
14
+ */
15
+ constructor(errors: unknown);
16
+ }
17
+ export default DirectoryCreateException;
18
+ //# sourceMappingURL=directoryCreateException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directoryCreateException.d.ts","sourceRoot":"","sources":["../src/directoryCreateException.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,MAAM,sDAAsD,CAAC;AAEpG;;GAEG;AACH,cAAM,wBAAyB,SAAQ,gCAAgC;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;gBACS,MAAM,EAAE,OAAO;CAQ9B;AAED,eAAe,wBAAwB,CAAC"}
@@ -1,14 +1,36 @@
1
- const DirectoryCreateExceptionContract = require('@ostro/contracts/filesystem/directoryCreateException')
2
- class DirectoryCreateException extends DirectoryCreateExceptionContract {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const directoryCreateException_1 = __importDefault(require("@ostro/contracts/filesystem/directoryCreateException"));
7
+ /**
8
+ * Class DirectoryCreateException.
9
+ */
10
+ class DirectoryCreateException extends directoryCreateException_1.default {
11
+ name;
12
+ message;
13
+ errors;
14
+ statusCode;
15
+ /**
16
+ * Create a new instance.
17
+ *
18
+ * @param errors - Error details or message.
19
+ */
3
20
  constructor(errors) {
4
21
  super();
5
-
6
22
  this.name = this.constructor.name;
7
23
  this.message = 'Unable to create directory';
8
24
  this.errors = errors;
9
25
  this.statusCode = 404;
10
26
  Error.captureStackTrace(this, this.constructor);
11
-
12
27
  }
13
28
  }
14
- module.exports = DirectoryCreateException
29
+ exports.default = DirectoryCreateException;
30
+ //# sourceMappingURL=directoryCreateException.js.map
31
+ if (exports.default) {
32
+ const d = exports.default;
33
+ module.exports = d;
34
+ Object.assign(module.exports, exports);
35
+ module.exports.default = d;
36
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directoryCreateException.js","sourceRoot":"","sources":["../src/directoryCreateException.ts"],"names":[],"mappings":";;;;;AAAA,oHAAoG;AAEpG;;GAEG;AACH,MAAM,wBAAyB,SAAQ,kCAAgC;IAC5D,IAAI,CAAS;IACb,OAAO,CAAS;IAChB,MAAM,CAAU;IAChB,UAAU,CAAS;IAE1B;;;;OAIG;IACH,YAAY,MAAe;QACvB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,4BAA4B,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;CACJ;AAED,kBAAe,wBAAwB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import FileNotFoundExceptionContract from '@ostro/contracts/filesystem/fileNotFoundException';
2
+ /**
3
+ * Class FileNotFoundException.
4
+ */
5
+ declare class FileNotFoundException extends FileNotFoundExceptionContract {
6
+ name: string;
7
+ message: string;
8
+ errors: unknown;
9
+ statusCode: number;
10
+ /**
11
+ * Create a new instance.
12
+ *
13
+ * @param errors - Error details or message.
14
+ * @param path - File path that failed to delete.
15
+ */
16
+ constructor(errors: unknown, path?: string);
17
+ }
18
+ export default FileNotFoundException;
19
+ //# sourceMappingURL=fileDeleteException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileDeleteException.d.ts","sourceRoot":"","sources":["../src/fileDeleteException.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,MAAM,mDAAmD,CAAC;AAE9F;;GAEG;AACH,cAAM,qBAAsB,SAAQ,6BAA6B;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IAE1B;;;;;OAKG;gBACS,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM;CAQ7C;AAED,eAAe,qBAAqB,CAAC"}
@@ -1,5 +1,23 @@
1
- const fileNotFoundExceptionContract = require('@ostro/contracts/filesystem/fileNotFoundException')
2
- class FileNotFoundException extends fileNotFoundExceptionContract {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fileNotFoundException_1 = __importDefault(require("@ostro/contracts/filesystem/fileNotFoundException"));
7
+ /**
8
+ * Class FileNotFoundException.
9
+ */
10
+ class FileNotFoundException extends fileNotFoundException_1.default {
11
+ name;
12
+ message;
13
+ errors;
14
+ statusCode;
15
+ /**
16
+ * Create a new instance.
17
+ *
18
+ * @param errors - Error details or message.
19
+ * @param path - File path that failed to delete.
20
+ */
3
21
  constructor(errors, path) {
4
22
  super();
5
23
  this.name = this.constructor.name;
@@ -7,7 +25,13 @@ class FileNotFoundException extends fileNotFoundExceptionContract {
7
25
  this.errors = errors;
8
26
  this.statusCode = 500;
9
27
  Error.captureStackTrace(this, this.constructor);
10
-
11
28
  }
12
29
  }
13
- module.exports = FileNotFoundException
30
+ exports.default = FileNotFoundException;
31
+ //# sourceMappingURL=fileDeleteException.js.map
32
+ if (exports.default) {
33
+ const d = exports.default;
34
+ module.exports = d;
35
+ Object.assign(module.exports, exports);
36
+ module.exports.default = d;
37
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileDeleteException.js","sourceRoot":"","sources":["../src/fileDeleteException.ts"],"names":[],"mappings":";;;;;AAAA,8GAA8F;AAE9F;;GAEG;AACH,MAAM,qBAAsB,SAAQ,+BAA6B;IACtD,IAAI,CAAS;IACb,OAAO,CAAS;IAChB,MAAM,CAAU;IAChB,UAAU,CAAS;IAE1B;;;;;OAKG;IACH,YAAY,MAAe,EAAE,IAAa;QACtC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;CACJ;AAED,kBAAe,qBAAqB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import FileNotFoundExceptionContract from '@ostro/contracts/filesystem/fileNotFoundException';
2
+ /**
3
+ * Class FileNotFoundException.
4
+ */
5
+ declare class FileNotFoundException extends FileNotFoundExceptionContract {
6
+ name: string;
7
+ message: string;
8
+ errors: unknown;
9
+ statusCode: number;
10
+ /**
11
+ * Create a new instance.
12
+ *
13
+ * @param errors - Error details or message.
14
+ */
15
+ constructor(errors: unknown);
16
+ }
17
+ export default FileNotFoundException;
18
+ //# sourceMappingURL=fileNotFoundException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileNotFoundException.d.ts","sourceRoot":"","sources":["../src/fileNotFoundException.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,MAAM,mDAAmD,CAAC;AAE9F;;GAEG;AACH,cAAM,qBAAsB,SAAQ,6BAA6B;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;gBACS,MAAM,EAAE,OAAO;CAQ9B;AAED,eAAe,qBAAqB,CAAC"}
@@ -1,14 +1,36 @@
1
- const fileNotFoundExceptionContract = require('@ostro/contracts/filesystem/fileNotFoundException')
2
- class FileNotFoundException extends fileNotFoundExceptionContract {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fileNotFoundException_1 = __importDefault(require("@ostro/contracts/filesystem/fileNotFoundException"));
7
+ /**
8
+ * Class FileNotFoundException.
9
+ */
10
+ class FileNotFoundException extends fileNotFoundException_1.default {
11
+ name;
12
+ message;
13
+ errors;
14
+ statusCode;
15
+ /**
16
+ * Create a new instance.
17
+ *
18
+ * @param errors - Error details or message.
19
+ */
3
20
  constructor(errors) {
4
21
  super();
5
-
6
22
  this.name = this.constructor.name;
7
23
  this.message = 'Specefied file is not found';
8
24
  this.errors = errors;
9
25
  this.statusCode = 404;
10
26
  Error.captureStackTrace(this, this.constructor);
11
-
12
27
  }
13
28
  }
14
- module.exports = FileNotFoundException
29
+ exports.default = FileNotFoundException;
30
+ //# sourceMappingURL=fileNotFoundException.js.map
31
+ if (exports.default) {
32
+ const d = exports.default;
33
+ module.exports = d;
34
+ Object.assign(module.exports, exports);
35
+ module.exports.default = d;
36
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileNotFoundException.js","sourceRoot":"","sources":["../src/fileNotFoundException.ts"],"names":[],"mappings":";;;;;AAAA,8GAA8F;AAE9F;;GAEG;AACH,MAAM,qBAAsB,SAAQ,+BAA6B;IACtD,IAAI,CAAS;IACb,OAAO,CAAS;IAChB,MAAM,CAAU;IAChB,UAAU,CAAS;IAE1B;;;;OAIG;IACH,YAAY,MAAe;QACvB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,6BAA6B,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;CACJ;AAED,kBAAe,qBAAqB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import FileUploadExceptionContract from '@ostro/contracts/filesystem/fileUploadException';
2
+ /**
3
+ * Class FileUploadException.
4
+ */
5
+ declare class FileUploadException extends FileUploadExceptionContract {
6
+ name: string;
7
+ message: string;
8
+ errors: unknown;
9
+ statusCode: number;
10
+ /**
11
+ * Create a new instance.
12
+ *
13
+ * @param errors - Error details or message.
14
+ */
15
+ constructor(errors: unknown);
16
+ }
17
+ export default FileUploadException;
18
+ //# sourceMappingURL=fileUploadException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileUploadException.d.ts","sourceRoot":"","sources":["../src/fileUploadException.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,MAAM,iDAAiD,CAAC;AAE1F;;GAEG;AACH,cAAM,mBAAoB,SAAQ,2BAA2B;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;gBACS,MAAM,EAAE,OAAO;CAQ9B;AAED,eAAe,mBAAmB,CAAC"}