@spinajs/fs 2.0.85 → 2.0.87

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 (53) hide show
  1. package/lib/{config → cjs/config}/fs.d.ts +0 -0
  2. package/lib/cjs/config/fs.d.ts.map +1 -0
  3. package/lib/cjs/config/fs.js +28 -0
  4. package/lib/cjs/config/fs.js.map +1 -0
  5. package/lib/{decorators.d.ts → cjs/decorators.d.ts} +0 -0
  6. package/lib/cjs/decorators.d.ts.map +1 -0
  7. package/lib/cjs/decorators.js +24 -0
  8. package/lib/cjs/decorators.js.map +1 -0
  9. package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
  10. package/lib/cjs/index.d.ts.map +1 -0
  11. package/lib/cjs/index.js +69 -0
  12. package/lib/cjs/index.js.map +1 -0
  13. package/lib/cjs/interfaces.d.ts +61 -0
  14. package/lib/cjs/interfaces.d.ts.map +1 -0
  15. package/lib/cjs/interfaces.js +21 -0
  16. package/lib/cjs/interfaces.js.map +1 -0
  17. package/lib/cjs/local-provider.d.ts +102 -0
  18. package/lib/cjs/local-provider.d.ts.map +1 -0
  19. package/lib/cjs/local-provider.js +257 -0
  20. package/lib/cjs/local-provider.js.map +1 -0
  21. package/lib/mjs/config/fs.d.ts +12 -0
  22. package/lib/mjs/config/fs.d.ts.map +1 -0
  23. package/lib/{config → mjs/config}/fs.js +0 -0
  24. package/lib/mjs/config/fs.js.map +1 -0
  25. package/lib/mjs/decorators.d.ts +8 -0
  26. package/lib/mjs/decorators.d.ts.map +1 -0
  27. package/lib/{decorators.js → mjs/decorators.js} +0 -0
  28. package/lib/mjs/decorators.js.map +1 -0
  29. package/lib/mjs/index.d.ts +8 -0
  30. package/lib/mjs/index.d.ts.map +1 -0
  31. package/lib/{index.js → mjs/index.js} +0 -0
  32. package/lib/mjs/index.js.map +1 -0
  33. package/lib/{interfaces.d.ts → mjs/interfaces.d.ts} +0 -0
  34. package/lib/mjs/interfaces.d.ts.map +1 -0
  35. package/lib/{interfaces.js → mjs/interfaces.js} +0 -0
  36. package/lib/mjs/interfaces.js.map +1 -0
  37. package/lib/{local-provider.d.ts → mjs/local-provider.d.ts} +0 -0
  38. package/lib/mjs/local-provider.d.ts.map +1 -0
  39. package/lib/{local-provider.js → mjs/local-provider.js} +0 -0
  40. package/lib/mjs/local-provider.js.map +1 -0
  41. package/lib/tsconfig.cjs.tsbuildinfo +1 -0
  42. package/lib/tsconfig.tsbuildinfo +1 -0
  43. package/package.json +12 -3
  44. package/lib/config/fs.d.ts.map +0 -1
  45. package/lib/config/fs.js.map +0 -1
  46. package/lib/decorators.d.ts.map +0 -1
  47. package/lib/decorators.js.map +0 -1
  48. package/lib/index.d.ts.map +0 -1
  49. package/lib/index.js.map +0 -1
  50. package/lib/interfaces.d.ts.map +0 -1
  51. package/lib/interfaces.js.map +0 -1
  52. package/lib/local-provider.d.ts.map +0 -1
  53. package/lib/local-provider.js.map +0 -1
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/config/fs.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,EAAE;;;;;;;;;CAmBP,CAAC;AAEF,eAAe,EAAE,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ function dir(path) {
5
+ return (0, path_1.resolve)((0, path_1.normalize)((0, path_1.join)(process.cwd(), path)));
6
+ }
7
+ const fs = {
8
+ fs: {
9
+ defaultProvider: 'fs-local',
10
+ providers: [
11
+ {
12
+ service: 'fsNative',
13
+ name: 'fs-local',
14
+ basePath: dir('./../fs/files'),
15
+ },
16
+ /**
17
+ * provide temporary fs access
18
+ */
19
+ {
20
+ service: 'fsNative',
21
+ name: 'fs-temp',
22
+ basePath: dir('./../fs/temp'),
23
+ },
24
+ ],
25
+ },
26
+ };
27
+ exports.default = fs;
28
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/config/fs.ts"],"names":[],"mappings":";;AAAA,+BAAgD;AAEhD,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,IAAA,cAAO,EAAC,IAAA,gBAAS,EAAC,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,EAAE,GAAG;IACT,EAAE,EAAE;QACF,eAAe,EAAE,UAAU;QAC3B,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,UAAU;gBACnB,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,GAAG,CAAC,eAAe,CAAC;aAC/B;YACD;;eAEG;YACH;gBACE,OAAO,EAAE,UAAU;gBACnB,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,GAAG,CAAC,cAAc,CAAC;aAC9B;SACF;KACF;CACF,CAAC;AAEF,kBAAe,EAAE,CAAC"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/decorators.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,aACtB,GAAG,QAAQ,MAAM,KAAG,GAAG,CAY3C"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileSystem = void 0;
4
+ const di_1 = require("@spinajs/di");
5
+ /**
6
+ * Injects file system provider. Provider must be configured in configuration files & exists
7
+ *
8
+ * @param provider - provider name
9
+ * @returns
10
+ */
11
+ function FileSystem(provider) {
12
+ return (target, key) => {
13
+ const getter = () => {
14
+ return di_1.DI.resolve("__file_provider__", [provider]);
15
+ };
16
+ Object.defineProperty(target, key, {
17
+ get: getter,
18
+ enumerable: false,
19
+ configurable: false,
20
+ });
21
+ };
22
+ }
23
+ exports.FileSystem = FileSystem;
24
+ //# sourceMappingURL=decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/decorators.ts"],"names":[],"mappings":";;;AAAA,oCAAiC;AAGjC;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,QAAgB;IACvC,OAAO,CAAC,MAAY,EAAE,GAAY,EAAO,EAAE;QAEvC,MAAM,MAAM,GAAG,GAAG,EAAE;YAChB,OAAO,OAAE,CAAC,OAAO,CAAK,mBAAmB,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC;QAEF,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE;YAC/B,GAAG,EAAE,MAAM;YACX,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,KAAK;SACtB,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AAbD,gCAaC"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,YAAY,EAAkB,MAAM,aAAa,CAAC;AAGvE,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAEhC,qBACa,aAAc,SAAQ,YAAY;IACtC,SAAS,IAAI,IAAI;CA8CzB"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
14
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16
+ 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;
17
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
18
+ };
19
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.FsBootsrapper = void 0;
24
+ const configuration_1 = require("@spinajs/configuration");
25
+ const di_1 = require("@spinajs/di");
26
+ const di_2 = require("@spinajs/di");
27
+ const interfaces_js_1 = require("./interfaces.js");
28
+ __exportStar(require("./interfaces.js"), exports);
29
+ __exportStar(require("./local-provider.js"), exports);
30
+ __exportStar(require("./decorators.js"), exports);
31
+ let FsBootsrapper = class FsBootsrapper extends di_2.Bootstrapper {
32
+ bootstrap() {
33
+ di_2.DI.once('di.resolved.Configuration', (container) => {
34
+ const cfg = container.get(configuration_1.Configuration).get('fs');
35
+ const defaultProvider = cfg.defaultProvider;
36
+ if (!defaultProvider) {
37
+ throw new configuration_1.InvalidConfiguration('fs default provider is not set. Please set default file provider ');
38
+ }
39
+ const providers = new Map();
40
+ // collapse provider config
41
+ // when name is the same, addes last is created
42
+ // eg fs-temp can have default config from package
43
+ // but is overriden in application
44
+ cfg.providers.forEach(x => {
45
+ providers.set(x.name, x);
46
+ });
47
+ const rProviders = di_2.DI.RootContainer.Registry.getTypes(interfaces_js_1.fs);
48
+ const list = Array.from(providers, ([name, value]) => ({ name, value }));
49
+ for (const cProvider of list) {
50
+ const type = rProviders.find((x) => x.name === cProvider.value.service);
51
+ if (!type) {
52
+ throw new di_1.ResolveException(`Type ${cProvider.value.service} not registered, make sure all fs providers are registered`);
53
+ }
54
+ di_2.DI.resolve(type, [cProvider.value]).then((result) => {
55
+ di_2.DI.register(result).asValue('__file_provider_instance_' + cProvider.value.name);
56
+ });
57
+ }
58
+ });
59
+ di_2.DI.register((_container, name) => {
60
+ const provider = di_2.DI.get('__file_provider_instance_' + name);
61
+ return provider;
62
+ }).as('__file_provider__');
63
+ }
64
+ };
65
+ FsBootsrapper = __decorate([
66
+ (0, di_2.Injectable)(di_2.Bootstrapper)
67
+ ], FsBootsrapper);
68
+ exports.FsBootsrapper = FsBootsrapper;
69
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA6E;AAC7E,oCAA+C;AAC/C,oCAAuE;AACvE,mDAA+E;AAE/E,kDAAgC;AAChC,sDAAoC;AACpC,kDAAgC;AAGzB,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,iBAAY;IACtC,SAAS;QAEd,OAAE,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,SAAqB,EAAE,EAAE;YAC7D,MAAM,GAAG,GAAqB,SAAS,CAAC,GAAG,CAAC,6BAAa,CAAC,CAAC,GAAG,CAAmB,IAAI,CAAC,CAAC;YAEvF,MAAM,eAAe,GAAG,GAAG,CAAC,eAAe,CAAC;YAE5C,IAAI,CAAC,eAAe,EAAE;gBACpB,MAAM,IAAI,oCAAoB,CAAC,mEAAmE,CAAC,CAAC;aACrG;YAED,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkC,CAAC;YAC5D,2BAA2B;YAC3B,+CAA+C;YAC/C,kDAAkD;YAClD,kCAAkC;YAClC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBACxB,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;YAEH,MAAM,UAAU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types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import { AsyncService, IInstanceCheck, IMappableService } from '@spinajs/di';
5
+ import { ReadStream, WriteStream } from 'fs';
6
+ import { DateTime } from 'luxon';
7
+ import { PassThrough } from 'stream';
8
+ export interface IProviderConfiguration {
9
+ name: string;
10
+ service: string;
11
+ }
12
+ export interface IFsConfiguration {
13
+ defaultProvider: string;
14
+ providers: IProviderConfiguration[];
15
+ }
16
+ export interface IStat {
17
+ IsDirectory?: boolean;
18
+ IsFile?: boolean;
19
+ Size?: number;
20
+ AccessTime?: DateTime;
21
+ ModifiedTime?: DateTime;
22
+ CreationTime?: DateTime;
23
+ AdditionalData?: unknown;
24
+ }
25
+ export interface IZipResult {
26
+ asFilePath(): string;
27
+ asStream(): ReadStream;
28
+ asBase64(): string;
29
+ }
30
+ export declare abstract class fs extends AsyncService implements IMappableService, IInstanceCheck {
31
+ get ServiceName(): string;
32
+ __checkInstance__(creationOptions: any): boolean;
33
+ abstract Name: string;
34
+ abstract download(path: string): Promise<string>;
35
+ abstract read(path: string, encoding: BufferEncoding): Promise<string | Buffer>;
36
+ abstract readStream(path: string, encoding?: BufferEncoding): Promise<ReadStream>;
37
+ abstract write(path: string, data: string | Buffer, encoding?: BufferEncoding): Promise<void>;
38
+ abstract writeStream(path: string, encoding?: BufferEncoding): Promise<WriteStream | PassThrough>;
39
+ abstract exists(path: string): Promise<boolean>;
40
+ abstract dirExists(path: string): Promise<boolean>;
41
+ abstract copy(path: string, dest: string): Promise<void>;
42
+ abstract move(oldPath: string, newPath: string): Promise<void>;
43
+ abstract rename(oldPath: string, newPath: string): Promise<void>;
44
+ abstract unlink(path: string, downloaded?: boolean): Promise<void>;
45
+ abstract rm(path: string): Promise<void>;
46
+ abstract mkdir(path: string): Promise<void>;
47
+ abstract stat(path: string): Promise<IStat>;
48
+ abstract list(path: string): Promise<string[]>;
49
+ abstract tmppath(): string;
50
+ abstract append(path: string, data: string | Buffer, encoding?: BufferEncoding): Promise<void>;
51
+ /**
52
+ *
53
+ * Compress specified file or dir in provided path. If
54
+ * Dir is compressed recursively
55
+ *
56
+ * @param path - path to zip
57
+ */
58
+ abstract zip(path: string): Promise<IZipResult>;
59
+ tmpname(): string;
60
+ }
61
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":";;;AACA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGrC,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,sBAAsB,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,KAAK;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,IAAI,MAAM,CAAC;IACrB,QAAQ,IAAI,UAAU,CAAC;IACvB,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED,8BAAsB,EAAG,SAAQ,YAAa,YAAW,gBAAgB,EAAE,cAAc;IACvF,IAAW,WAAW,WAErB;IAGM,iBAAiB,CAAC,eAAe,EAAE,G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AM,GAAG,OAAO,CAAC,KAAK,CAAC;aAClC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;aACrC,OAAO,IAAI,MAAM;aACjB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IACrG;;;;;;OAMG;aACa,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAE/C,OAAO;CAGf"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fs = void 0;
4
+ /* eslint-disable security/detect-non-literal-fs-filename */
5
+ const di_1 = require("@spinajs/di");
6
+ const uuid_1 = require("uuid");
7
+ class fs extends di_1.AsyncService {
8
+ get ServiceName() {
9
+ return this.Name;
10
+ }
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ __checkInstance__(creationOptions) {
13
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
14
+ return this.Name === creationOptions[0].name;
15
+ }
16
+ tmpname() {
17
+ return (0, uuid_1.v4)();
18
+ }
19
+ }
20
+ exports.fs = fs;
21
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":";;;AAAA,4DAA4D;AAC5D,oCAA6E;AAI7E,+BAAoC;AA2BpC,MAAsB,EAAG,SAAQ,iBAAY;IAC3C,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,8DAA8D;IACvD,iBAAiB,CAAC,eAAoB;QAC3C,sEAAsE;QACtE,OAAO,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/C,CAAC;IA6BM,OAAO;QACZ,OAAO,IAAA,SAAM,GAAE,CAAC;IAClB,CAAC;CACF;AAzCD,gBAyCC"}
@@ -0,0 +1,102 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { fs, IStat, IZipResult } from './interfaces.js';
4
+ import { ILog } from '@spinajs/log';
5
+ export interface IFsLocalOptions {
6
+ basePath: string;
7
+ name: string;
8
+ }
9
+ /**
10
+ * Abstract layer for file operations.
11
+ * Basic implementation is just wrapper for native node fs functions
12
+ *
13
+ * It allows to wrap other libs eg. aws s3, ftp
14
+ * and inject it into code without changing logic that use them.
15
+ *
16
+ * TODO: map errors to some kind of common errors shared with other implementations
17
+ */
18
+ export declare class fsNative extends fs {
19
+ Options: IFsLocalOptions;
20
+ protected Logger: ILog;
21
+ /**
22
+ * Name of provider. We can have multiple providers of the same type but with different options.
23
+ * Also used in InjectService decorator for mapping
24
+ */
25
+ get Name(): string;
26
+ constructor(Options: IFsLocalOptions);
27
+ resolve(): Promise<void>;
28
+ /**
29
+ *
30
+ * Tries to download file to local filesystem, then returns local filesystem path.
31
+ * Native implementation simply returns local path and does nothing.
32
+ *
33
+ * @param path - file to download
34
+ */
35
+ download(path: string): Promise<string>;
36
+ /**
37
+ * read all content of file
38
+ */
39
+ read(path: string, encoding?: BufferEncoding): Promise<string | Buffer>;
40
+ readStream(path: string, encoding?: BufferEncoding): Promise<import("fs").ReadStream>;
41
+ /**
42
+ * Write to file string or buffer
43
+ */
44
+ write(path: string, data: string | Buffer, encoding: BufferEncoding): Promise<void>;
45
+ append(path: string, data: string | Buffer, encoding?: BufferEncoding): Promise<void>;
46
+ writeStream(path: string, encoding?: BufferEncoding): Promise<import("fs").WriteStream>;
47
+ /**
48
+ * Checks if file existst
49
+ * @param path - path to check
50
+ */
51
+ exists(path: string): Promise<boolean>;
52
+ dirExists(path: string): Promise<boolean>;
53
+ /**
54
+ * Copy file to another location
55
+ * @param path - src path
56
+ * @param dest - dest path
57
+ */
58
+ copy(path: string, dest: string): Promise<void>;
59
+ /**
60
+ * Copy file to another location and deletes src file
61
+ */
62
+ move(oldPath: string, newPath: string): Promise<void>;
63
+ /**
64
+ * Change name of a file
65
+ */
66
+ rename(oldPath: string, newPath: string): Promise<void>;
67
+ /**
68
+ * Deletes file permanently
69
+ *
70
+ * @param path - path to file that will be deleted
71
+ * @param onlyTemp - remote filesystems need to download file before, if so, calling unlink with this flag removes only local temp file after we finished processing
72
+ */
73
+ unlink(path: string, onlyTemp?: boolean): Promise<void>;
74
+ /**
75
+ *
76
+ * Deletes dir recursively & all contents inside
77
+ *
78
+ * @param path - dir to remove
79
+ */
80
+ rm(path: string): Promise<void>;
81
+ /**
82
+ *
83
+ * Creates directory, recursively
84
+ *
85
+ * @param path - directory to create
86
+ */
87
+ mkdir(path: string): Promise<void>;
88
+ /**
89
+ * Returns file statistics, not all fields may be accesible
90
+ */
91
+ stat(path: string): Promise<IStat>;
92
+ tmppath(): string;
93
+ /**
94
+ * List content of directory
95
+ *
96
+ * @param path - path to directory
97
+ */
98
+ list(path: string): Promise<string[]>;
99
+ zip(path: string, zName?: string): Promise<IZipResult>;
100
+ protected resolvePath(path: string): string;
101
+ }
102
+ //# sourceMappingURL=local-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-provider.d.ts","sourceRoot":"","sources":["../../src/local-provider.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,IAAI,EAAU,MAAM,cAAc,CAAC;AAE5C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,qBAEa,QAAS,SAAQ,EAAE;IAYX,OAAO,EAAE,eAAe;IAV3C,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC;IAEvB;;;OAGG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;gBAEkB,OAAO,E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,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAmCnE,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM;CAOnC"}
@@ -0,0 +1,257 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.fsNative = void 0;
16
+ /* eslint-disable security/detect-non-literal-fs-filename */
17
+ const exceptions_1 = require("@spinajs/exceptions");
18
+ const fs_1 = require("fs");
19
+ const promises_1 = require("node:fs/promises");
20
+ const luxon_1 = require("luxon");
21
+ const di_1 = require("@spinajs/di");
22
+ const interfaces_js_1 = require("./interfaces.js");
23
+ const path_1 = require("path");
24
+ const log_1 = require("@spinajs/log");
25
+ const archiver_1 = __importDefault(require("archiver"));
26
+ /**
27
+ * Abstract layer for file operations.
28
+ * Basic implementation is just wrapper for native node fs functions
29
+ *
30
+ * It allows to wrap other libs eg. aws s3, ftp
31
+ * and inject it into code without changing logic that use them.
32
+ *
33
+ * TODO: map errors to some kind of common errors shared with other implementations
34
+ */
35
+ let fsNative = class fsNative extends interfaces_js_1.fs {
36
+ /**
37
+ * Name of provider. We can have multiple providers of the same type but with different options.
38
+ * Also used in InjectService decorator for mapping
39
+ */
40
+ get Name() {
41
+ return this.Options.name;
42
+ }
43
+ constructor(Options) {
44
+ super();
45
+ this.Options = Options;
46
+ }
47
+ async resolve() {
48
+ // yup, exceptions as conditional execution path is bad :)
49
+ try {
50
+ await (0, promises_1.access)(this.Options.basePath, fs_1.constants.F_OK);
51
+ }
52
+ catch {
53
+ this.Logger.warn(`Base path ${this.Options.basePath} for file provider ${this.Options.name} not exists, trying to create base folder`);
54
+ await (0, promises_1.mkdir)(this.Options.basePath, { recursive: true });
55
+ this.Logger.success(`Base path ${this.Options.basePath} created`);
56
+ }
57
+ }
58
+ /**
59
+ *
60
+ * Tries to download file to local filesystem, then returns local filesystem path.
61
+ * Native implementation simply returns local path and does nothing.
62
+ *
63
+ * @param path - file to download
64
+ */
65
+ async download(path) {
66
+ const exists = await this.exists(this.resolvePath(path));
67
+ if (!exists) {
68
+ throw new exceptions_1.IOFail(`file ${path} does not exists`);
69
+ }
70
+ return this.resolvePath(path);
71
+ }
72
+ /**
73
+ * read all content of file
74
+ */
75
+ async read(path, encoding) {
76
+ return new Promise((resolve, reject) => {
77
+ (0, fs_1.readFile)(this.resolvePath(path), { encoding: encoding ?? 'binary' }, (err, data) => {
78
+ if (err) {
79
+ reject(err);
80
+ }
81
+ else {
82
+ resolve(data);
83
+ }
84
+ });
85
+ });
86
+ }
87
+ readStream(path, encoding) {
88
+ return Promise.resolve((0, fs_1.createReadStream)(this.resolvePath(path), { encoding: encoding ?? 'binary' }));
89
+ }
90
+ /**
91
+ * Write to file string or buffer
92
+ */
93
+ async write(path, data, encoding) {
94
+ const fDesc = await (0, promises_1.open)(this.resolvePath(path), 'w');
95
+ return await fDesc.writeFile(data, { encoding });
96
+ }
97
+ async append(path, data, encoding) {
98
+ await (0, promises_1.appendFile)(path, data, encoding);
99
+ }
100
+ writeStream(path, encoding) {
101
+ return Promise.resolve((0, fs_1.createWriteStream)(this.resolvePath(path), { encoding: encoding ?? 'binary' }));
102
+ }
103
+ /**
104
+ * Checks if file existst
105
+ * @param path - path to check
106
+ */
107
+ async exists(path) {
108
+ try {
109
+ await (0, promises_1.access)(this.resolvePath(path), fs_1.constants.F_OK);
110
+ return true;
111
+ }
112
+ catch {
113
+ return false;
114
+ }
115
+ }
116
+ async dirExists(path) {
117
+ return this.exists(this.resolvePath(path));
118
+ }
119
+ /**
120
+ * Copy file to another location
121
+ * @param path - src path
122
+ * @param dest - dest path
123
+ */
124
+ async copy(path, dest) {
125
+ await (0, promises_1.copyFile)(this.resolvePath(path), this.resolvePath(dest));
126
+ }
127
+ /**
128
+ * Copy file to another location and deletes src file
129
+ */
130
+ async move(oldPath, newPath) {
131
+ const oPath = this.resolvePath(oldPath);
132
+ const nPath = this.resolvePath(newPath);
133
+ try {
134
+ await (0, promises_1.rename)(oPath, nPath);
135
+ }
136
+ catch (err) {
137
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
138
+ if (err.code === 'EXDEV') {
139
+ await (0, promises_1.copyFile)(oPath, nPath);
140
+ await (0, promises_1.unlink)(oPath);
141
+ }
142
+ else {
143
+ throw err;
144
+ }
145
+ }
146
+ }
147
+ /**
148
+ * Change name of a file
149
+ */
150
+ async rename(oldPath, newPath) {
151
+ await (0, promises_1.rename)(this.resolvePath(oldPath), this.resolvePath(newPath));
152
+ }
153
+ /**
154
+ * Deletes file permanently
155
+ *
156
+ * @param path - path to file that will be deleted
157
+ * @param onlyTemp - remote filesystems need to download file before, if so, calling unlink with this flag removes only local temp file after we finished processing
158
+ */
159
+ async unlink(path, onlyTemp) {
160
+ // local fs returns only local path to file, we dont want to delete it
161
+ if (onlyTemp) {
162
+ return;
163
+ }
164
+ await (0, promises_1.unlink)(this.resolvePath(path));
165
+ }
166
+ /**
167
+ *
168
+ * Deletes dir recursively & all contents inside
169
+ *
170
+ * @param path - dir to remove
171
+ */
172
+ async rm(path) {
173
+ await (0, promises_1.rm)(this.resolvePath(path), { recursive: true, force: true, maxRetries: 3, retryDelay: 1000 });
174
+ }
175
+ /**
176
+ *
177
+ * Creates directory, recursively
178
+ *
179
+ * @param path - directory to create
180
+ */
181
+ async mkdir(path) {
182
+ await (0, promises_1.mkdir)(this.resolvePath(path), { recursive: true });
183
+ }
184
+ /**
185
+ * Returns file statistics, not all fields may be accesible
186
+ */
187
+ async stat(path) {
188
+ const result = await (0, promises_1.stat)(this.resolvePath(path));
189
+ return {
190
+ IsDirectory: result.isDirectory(),
191
+ IsFile: result.isFile(),
192
+ CreationTime: luxon_1.DateTime.fromJSDate(result.ctime),
193
+ ModifiedTime: luxon_1.DateTime.fromJSDate(result.mtime),
194
+ AccessTime: luxon_1.DateTime.fromJSDate(result.atime),
195
+ Size: result.size,
196
+ };
197
+ }
198
+ tmppath() {
199
+ return (0, path_1.join)(this.Options.basePath, super.tmpname());
200
+ }
201
+ /**
202
+ * List content of directory
203
+ *
204
+ * @param path - path to directory
205
+ */
206
+ async list(path) {
207
+ return await (0, promises_1.readdir)(this.resolvePath(path));
208
+ }
209
+ async zip(path, zName) {
210
+ const outFile = this.resolvePath(this.tmpname() + '.zip');
211
+ const output = (0, fs_1.createWriteStream)(outFile);
212
+ const pStat = await this.stat(path);
213
+ const fPath = this.resolvePath(path);
214
+ const archive = (0, archiver_1.default)('zip', {
215
+ zlib: { level: 9 }, // Sets the compression level.
216
+ });
217
+ // pipe archive data to the file
218
+ archive.pipe(output);
219
+ if (pStat.IsDirectory) {
220
+ archive.directory(fPath, false);
221
+ }
222
+ else {
223
+ archive.file(fPath, { name: zName ?? (0, path_1.basename)(fPath) });
224
+ }
225
+ await archive.finalize();
226
+ return {
227
+ asFilePath: () => {
228
+ return outFile;
229
+ },
230
+ asStream: (encoding) => {
231
+ return (0, fs_1.createReadStream)(outFile, {
232
+ encoding: encoding ?? 'binary',
233
+ });
234
+ },
235
+ asBase64: () => {
236
+ return (0, fs_1.readFileSync)(outFile, { encoding: 'base64' });
237
+ },
238
+ };
239
+ }
240
+ resolvePath(path) {
241
+ if (path.startsWith(this.Options.basePath)) {
242
+ return path;
243
+ }
244
+ return (0, path_1.join)(this.Options.basePath, path);
245
+ }
246
+ };
247
+ __decorate([
248
+ (0, log_1.Logger)('fs'),
249
+ __metadata("design:type", Object)
250
+ ], fsNative.prototype, "Logger", void 0);
251
+ fsNative = __decorate([
252
+ (0, di_1.Injectable)('fs'),
253
+ (0, di_1.PerInstanceCheck)(),
254
+ __metadata("design:paramtypes", [Object])
255
+ ], fsNative);
256
+ exports.fsNative = fsNative;
257
+ //# sourceMappingURL=local-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-provider.js","sourceRoot":"","sources":["../../src/local-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4DAA4D;AAC5D,oDAA6C;AAC7C,2BAA4F;AAC5F,+CAAgH;AAChH,iCAAiC;AACjC,oCAA2D;AAC3D,mDAAwD;AACxD,+BAAsC;AACtC,sCAA4C;AAC5C,wDAAgC;AAMhC;;;;;;;;GAQG;AAGI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,kBAAE;IAI9B;;;OAGG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,YAAmB,OAAwB;QACzC,KAAK,EAAE,CAAC;QADS,YAAO,GAAP,OAAO,CAAiB;IAE3C,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,0DAA0D;QAC1D,IAAI;YACF,MAAM,IAAA,iBAAM,EAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,cAAS,CAAC,IAAI,CAAC,CAAC;SACrD;QAAC,MAAM;YACN,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,aAAa,IAAI,CAAC,OAAO,CAAC,QAAQ,sBAAsB,IAAI,CAAC,OAAO,CAAC,IAAI,2CAA2C,CACrH,CAAC;YAEF,MAAM,IAAA,gBAAK,EAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE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
+ declare const fs: {
2
+ fs: {
3
+ defaultProvider: string;
4
+ providers: {
5
+ service: string;
6
+ name: string;
7
+ basePath: string;
8
+ }[];
9
+ };
10
+ };
11
+ export default fs;
12
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/config/fs.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,EAAE;;;;;;;;;CAmBP,CAAC;AAEF,eAAe,EAAE,CAAC"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/config/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEhD,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,EAAE,GAAG;IACT,EAAE,EAAE;QACF,eAAe,EAAE,UAAU;QAC3B,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,UAAU;gBACnB,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,GAAG,CAAC,eAAe,CAAC;aAC/B;YACD;;eAEG;YACH;gBACE,OAAO,EAAE,UAAU;gBACnB,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,GAAG,CAAC,cAAc,CAAC;aAC9B;SACF;KACF;CACF,CAAC;AAEF,eAAe,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Injects file system provider. Provider must be configured in configuration files & exists
3
+ *
4
+ * @param provider - provider name
5
+ * @returns
6
+ */
7
+ export declare function FileSystem(provider: string): (target?: any, key?: string) => any;
8
+ //# sourceMappingURL=decorators.d.ts.map