@bgord/bun 0.22.0 → 0.23.0

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 (80) hide show
  1. package/dist/file-hash-noop.adapter.d.ts +10 -0
  2. package/dist/file-hash-noop.adapter.d.ts.map +1 -0
  3. package/dist/file-hash-noop.adapter.js +7 -0
  4. package/dist/file-hash-noop.adapter.js.map +1 -0
  5. package/dist/file-hash-sha256-bun.adapter.d.ts +10 -0
  6. package/dist/file-hash-sha256-bun.adapter.d.ts.map +1 -0
  7. package/dist/file-hash-sha256-bun.adapter.js +15 -0
  8. package/dist/file-hash-sha256-bun.adapter.js.map +1 -0
  9. package/dist/file-hash.port.d.ts +10 -0
  10. package/dist/file-hash.port.d.ts.map +1 -0
  11. package/dist/file-hash.port.js +2 -0
  12. package/dist/file-hash.port.js.map +1 -0
  13. package/dist/image-alpha-noop.adapter.d.ts +5 -0
  14. package/dist/image-alpha-noop.adapter.d.ts.map +1 -0
  15. package/dist/image-alpha-noop.adapter.js +6 -0
  16. package/dist/image-alpha-noop.adapter.js.map +1 -0
  17. package/dist/image-alpha-sharp.adapter.d.ts +5 -0
  18. package/dist/image-alpha-sharp.adapter.d.ts.map +1 -0
  19. package/dist/image-alpha-sharp.adapter.js +83 -0
  20. package/dist/image-alpha-sharp.adapter.js.map +1 -0
  21. package/dist/image-alpha.port.d.ts +24 -0
  22. package/dist/image-alpha.port.d.ts.map +1 -0
  23. package/dist/image-alpha.port.js +2 -0
  24. package/dist/image-alpha.port.js.map +1 -0
  25. package/dist/image-blur-noop.adapter.d.ts +1 -1
  26. package/dist/image-blur-sharp.adapter.d.ts +1 -1
  27. package/dist/image-compressor-noop.adapter.d.ts +1 -1
  28. package/dist/image-compressor-sharp.adapter.d.ts +1 -1
  29. package/dist/image-exif-clear-noop.adapter.d.ts +1 -1
  30. package/dist/image-exif-clear-sharp.adapter.d.ts +1 -1
  31. package/dist/image-formatter-sharp.adapter.d.ts +1 -1
  32. package/dist/image-info.port.d.ts +1 -2
  33. package/dist/image-info.port.d.ts.map +1 -1
  34. package/dist/image-processor-noop.adapter.d.ts +6 -0
  35. package/dist/image-processor-noop.adapter.d.ts.map +1 -0
  36. package/dist/image-processor-noop.adapter.js +8 -0
  37. package/dist/image-processor-noop.adapter.js.map +1 -0
  38. package/dist/image-processor-sharp.adapter.d.ts +7 -0
  39. package/dist/image-processor-sharp.adapter.d.ts.map +1 -0
  40. package/dist/image-processor-sharp.adapter.js +96 -0
  41. package/dist/image-processor-sharp.adapter.js.map +1 -0
  42. package/dist/image-processor.port.d.ts +30 -0
  43. package/dist/image-processor.port.d.ts.map +1 -0
  44. package/dist/image-processor.port.js +2 -0
  45. package/dist/image-processor.port.js.map +1 -0
  46. package/dist/image-resizer-noop.adapter.d.ts +1 -1
  47. package/dist/image-resizer-sharp.adapter.d.ts +1 -1
  48. package/dist/index.d.ts +12 -0
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +12 -0
  51. package/dist/index.js.map +1 -1
  52. package/dist/remote-file-storage-disk.adapter.d.ts +20 -0
  53. package/dist/remote-file-storage-disk.adapter.d.ts.map +1 -0
  54. package/dist/remote-file-storage-disk.adapter.js +54 -0
  55. package/dist/remote-file-storage-disk.adapter.js.map +1 -0
  56. package/dist/remote-file-storage-noop.adapter.d.ts +19 -0
  57. package/dist/remote-file-storage-noop.adapter.d.ts.map +1 -0
  58. package/dist/remote-file-storage-noop.adapter.js +52 -0
  59. package/dist/remote-file-storage-noop.adapter.js.map +1 -0
  60. package/dist/remote-file-storage.port.d.ts +20 -0
  61. package/dist/remote-file-storage.port.d.ts.map +1 -0
  62. package/dist/remote-file-storage.port.js +2 -0
  63. package/dist/remote-file-storage.port.js.map +1 -0
  64. package/dist/tsconfig.tsbuildinfo +1 -1
  65. package/package.json +2 -2
  66. package/readme.md +12 -0
  67. package/src/file-hash-noop.adapter.ts +8 -0
  68. package/src/file-hash-sha256-bun.adapter.ts +18 -0
  69. package/src/file-hash.port.ts +7 -0
  70. package/src/image-alpha-noop.adapter.ts +7 -0
  71. package/src/image-alpha-sharp.adapter.ts +28 -0
  72. package/src/image-alpha.port.ts +22 -0
  73. package/src/image-info.port.ts +6 -1
  74. package/src/image-processor-noop.adapter.ts +10 -0
  75. package/src/image-processor-sharp.adapter.ts +49 -0
  76. package/src/image-processor.port.ts +28 -0
  77. package/src/index.ts +12 -0
  78. package/src/remote-file-storage-disk.adapter.ts +74 -0
  79. package/src/remote-file-storage-noop.adapter.ts +69 -0
  80. package/src/remote-file-storage.port.ts +19 -0
@@ -0,0 +1,10 @@
1
+ import * as tools from "@bgord/tools";
2
+ import type { FileHashPort } from "./file-hash.port";
3
+ export declare class FileHashNoopAdapter implements FileHashPort {
4
+ hash(_path: tools.FilePathAbsolute | tools.FilePathRelative): Promise<{
5
+ etag: string;
6
+ size: tools.Size;
7
+ lastModified: number & import("zod/v4").$brand<"Timestamp">;
8
+ }>;
9
+ }
10
+ //# sourceMappingURL=file-hash-noop.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-hash-noop.adapter.d.ts","sourceRoot":"","sources":["../src/file-hash-noop.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,qBAAa,mBAAoB,YAAW,YAAY;IAChD,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB;;;;;CAGlE"}
@@ -0,0 +1,7 @@
1
+ import * as tools from "@bgord/tools";
2
+ export class FileHashNoopAdapter {
3
+ async hash(_path) {
4
+ return { etag: "noop", size: tools.Size.fromBytes(0), lastModified: tools.Timestamp.parse(1000) };
5
+ }
6
+ }
7
+ //# sourceMappingURL=file-hash-noop.adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-hash-noop.adapter.js","sourceRoot":"","sources":["../src/file-hash-noop.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,MAAM,OAAO,mBAAmB;IAC9B,KAAK,CAAC,IAAI,CAAC,KAAsD;QAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;IACpG,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import * as tools from "@bgord/tools";
2
+ import type { FileHashPort } from "./file-hash.port";
3
+ export declare class FileHashSha256BunAdapter implements FileHashPort {
4
+ hash(path: tools.FilePathAbsolute | tools.FilePathRelative): Promise<{
5
+ etag: string;
6
+ size: tools.Size;
7
+ lastModified: number & import("zod/v4").$brand<"Timestamp">;
8
+ }>;
9
+ }
10
+ //# sourceMappingURL=file-hash-sha256-bun.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-hash-sha256-bun.adapter.d.ts","sourceRoot":"","sources":["../src/file-hash-sha256-bun.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,qBAAa,wBAAyB,YAAW,YAAY;IACrD,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB;;;;;CAajE"}
@@ -0,0 +1,15 @@
1
+ import * as tools from "@bgord/tools";
2
+ export class FileHashSha256BunAdapter {
3
+ async hash(path) {
4
+ const file = Bun.file(path.get());
5
+ const arrayBuffer = await file.arrayBuffer();
6
+ const digest = await crypto.subtle.digest("SHA-256", arrayBuffer);
7
+ const etag = Buffer.from(digest).toString("hex");
8
+ return {
9
+ etag,
10
+ size: tools.Size.fromBytes(arrayBuffer.byteLength),
11
+ lastModified: tools.Timestamp.parse(file.lastModified),
12
+ };
13
+ }
14
+ }
15
+ //# sourceMappingURL=file-hash-sha256-bun.adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-hash-sha256-bun.adapter.js","sourceRoot":"","sources":["../src/file-hash-sha256-bun.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,MAAM,OAAO,wBAAwB;IACnC,KAAK,CAAC,IAAI,CAAC,IAAqD;QAC9D,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAElC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC7C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAClE,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAEjD,OAAO;YACL,IAAI;YACJ,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,UAAU,CAAC;YAClD,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC;SACvD,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import type * as tools from "@bgord/tools";
2
+ export type FileHashResult = {
3
+ etag: string;
4
+ size: tools.Size;
5
+ lastModified: tools.TimestampType;
6
+ };
7
+ export interface FileHashPort {
8
+ hash(path: tools.FilePathAbsolute | tools.FilePathRelative): Promise<FileHashResult>;
9
+ }
10
+ //# sourceMappingURL=file-hash.port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-hash.port.d.ts","sourceRoot":"","sources":["../src/file-hash.port.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;IAAC,YAAY,EAAE,KAAK,CAAC,aAAa,CAAA;CAAE,CAAC;AAEnG,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACtF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=file-hash.port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-hash.port.js","sourceRoot":"","sources":["../src/file-hash.port.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ImageAlphaPort, ImageAlphaStrategy } from "./image-alpha.port";
2
+ export declare class ImageAlphaNoopAdapter implements ImageAlphaPort {
3
+ flatten(recipe: ImageAlphaStrategy): Promise<import("@bgord/tools").FilePathAbsolute | import("@bgord/tools").FilePathRelative>;
4
+ }
5
+ //# sourceMappingURL=image-alpha-noop.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-alpha-noop.adapter.d.ts","sourceRoot":"","sources":["../src/image-alpha-noop.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7E,qBAAa,qBAAsB,YAAW,cAAc;IACpD,OAAO,CAAC,MAAM,EAAE,kBAAkB;CAGzC"}
@@ -0,0 +1,6 @@
1
+ export class ImageAlphaNoopAdapter {
2
+ async flatten(recipe) {
3
+ return recipe.strategy === "output_path" ? recipe.output : recipe.input;
4
+ }
5
+ }
6
+ //# sourceMappingURL=image-alpha-noop.adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-alpha-noop.adapter.js","sourceRoot":"","sources":["../src/image-alpha-noop.adapter.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,qBAAqB;IAChC,KAAK,CAAC,OAAO,CAAC,MAA0B;QACtC,OAAO,MAAM,CAAC,QAAQ,KAAK,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;IAC1E,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import type { ImageAlphaPort, ImageAlphaStrategy } from "./image-alpha.port";
2
+ export declare class ImageAlphaSharpAdapter implements ImageAlphaPort {
3
+ flatten(recipe: ImageAlphaStrategy): Promise<import("@bgord/tools").FilePathAbsolute | import("@bgord/tools").FilePathRelative>;
4
+ }
5
+ //# sourceMappingURL=image-alpha-sharp.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-alpha-sharp.adapter.d.ts","sourceRoot":"","sources":["../src/image-alpha-sharp.adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7E,qBAAa,sBAAuB,YAAW,cAAc;IACrD,OAAO,CAAC,MAAM,EAAE,kBAAkB;CAsBzC"}
@@ -0,0 +1,83 @@
1
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
2
+ if (value !== null && value !== void 0) {
3
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
4
+ var dispose, inner;
5
+ if (async) {
6
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
7
+ dispose = value[Symbol.asyncDispose];
8
+ }
9
+ if (dispose === void 0) {
10
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
11
+ dispose = value[Symbol.dispose];
12
+ if (async) inner = dispose;
13
+ }
14
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
15
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
16
+ env.stack.push({ value: value, dispose: dispose, async: async });
17
+ }
18
+ else if (async) {
19
+ env.stack.push({ async: true });
20
+ }
21
+ return value;
22
+ };
23
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
24
+ return function (env) {
25
+ function fail(e) {
26
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
27
+ env.hasError = true;
28
+ }
29
+ var r, s = 0;
30
+ function next() {
31
+ while (r = env.stack.pop()) {
32
+ try {
33
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
34
+ if (r.dispose) {
35
+ var result = r.dispose.call(r.value);
36
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
37
+ }
38
+ else s |= 1;
39
+ }
40
+ catch (e) {
41
+ fail(e);
42
+ }
43
+ }
44
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
45
+ if (env.hasError) throw env.error;
46
+ }
47
+ return next();
48
+ };
49
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
50
+ var e = new Error(message);
51
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52
+ });
53
+ import fs from "node:fs/promises";
54
+ import sharp from "sharp";
55
+ export class ImageAlphaSharpAdapter {
56
+ async flatten(recipe) {
57
+ const env_1 = { stack: [], error: void 0, hasError: false };
58
+ try {
59
+ const final = recipe.strategy === "output_path" ? recipe.output : recipe.input;
60
+ const filename = final.getFilename();
61
+ const temporary = final.withFilename(filename.withSuffix("-flattened"));
62
+ const extension = String(final.getFilename().getExtension());
63
+ const format = (extension === "jpg" ? "jpeg" : extension);
64
+ const pipeline = sharp(recipe.input.get());
65
+ const _sharp_ = __addDisposableResource(env_1, { [Symbol.dispose]: () => pipeline.destroy() }, false);
66
+ await pipeline
67
+ .rotate()
68
+ .flatten({ background: recipe.background })
69
+ .toFormat(format)
70
+ .toFile(temporary.get());
71
+ await fs.rename(temporary.get(), final.get());
72
+ return final;
73
+ }
74
+ catch (e_1) {
75
+ env_1.error = e_1;
76
+ env_1.hasError = true;
77
+ }
78
+ finally {
79
+ __disposeResources(env_1);
80
+ }
81
+ }
82
+ }
83
+ //# sourceMappingURL=image-alpha-sharp.adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-alpha-sharp.adapter.js","sourceRoot":"","sources":["../src/image-alpha-sharp.adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,OAAO,sBAAsB;IACjC,KAAK,CAAC,OAAO,CAAC,MAA0B;;;YACtC,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,KAAK,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAE/E,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;YACrC,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;YAExE,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC;YAC7D,MAAM,MAAM,GAAG,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAA2B,CAAC;YAEpF,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;YAC3C,MAAM,OAAO,kCAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,QAAA,CAAC;YAE/D,MAAM,QAAQ;iBACX,MAAM,EAAE;iBACR,OAAO,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;iBAC1C,QAAQ,CAAC,MAAM,CAAC;iBAChB,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC;YAE3B,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;YAE9C,OAAO,KAAK,CAAC;;;;;;;;;KACd;CACF"}
@@ -0,0 +1,24 @@
1
+ import type * as tools from "@bgord/tools";
2
+ type ImageAlphaBackground = string | {
3
+ r: number;
4
+ g: number;
5
+ b: number;
6
+ alpha?: number;
7
+ };
8
+ type ImageAlphaOutputPathStrategy = {
9
+ strategy: "output_path";
10
+ input: tools.FilePathRelative | tools.FilePathAbsolute;
11
+ output: tools.FilePathRelative | tools.FilePathAbsolute;
12
+ background: ImageAlphaBackground;
13
+ };
14
+ type ImageAlphaInPlaceStrategy = {
15
+ strategy: "in_place";
16
+ input: tools.FilePathRelative | tools.FilePathAbsolute;
17
+ background: ImageAlphaBackground;
18
+ };
19
+ export type ImageAlphaStrategy = ImageAlphaInPlaceStrategy | ImageAlphaOutputPathStrategy;
20
+ export interface ImageAlphaPort {
21
+ flatten(recipe: ImageAlphaStrategy): Promise<tools.FilePathRelative | tools.FilePathAbsolute>;
22
+ }
23
+ export {};
24
+ //# sourceMappingURL=image-alpha.port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-alpha.port.d.ts","sourceRoot":"","sources":["../src/image-alpha.port.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,KAAK,oBAAoB,GAAG,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzF,KAAK,4BAA4B,GAAG;IAClC,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;IACvD,MAAM,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;IACxD,UAAU,EAAE,oBAAoB,CAAC;CAClC,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,EAAE,UAAU,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;IACvD,UAAU,EAAE,oBAAoB,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,yBAAyB,GAAG,4BAA4B,CAAC;AAE1F,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAC;CAC/F"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=image-alpha.port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-alpha.port.js","sourceRoot":"","sources":["../src/image-alpha.port.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import type { ImageBlurPort, ImageBlurStrategy } from "./image-blur.port";
2
2
  export declare class ImageBlurNoopAdapter implements ImageBlurPort {
3
- blur(recipe: ImageBlurStrategy): Promise<import("@bgord/tools").FilePathRelative | import("@bgord/tools").FilePathAbsolute>;
3
+ blur(recipe: ImageBlurStrategy): Promise<import("@bgord/tools").FilePathAbsolute | import("@bgord/tools").FilePathRelative>;
4
4
  }
5
5
  //# sourceMappingURL=image-blur-noop.adapter.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { ImageBlurPort, ImageBlurStrategy } from "./image-blur.port";
2
2
  export declare class ImageBlurSharpAdapter implements ImageBlurPort {
3
- blur(recipe: ImageBlurStrategy): Promise<import("@bgord/tools").FilePathRelative | import("@bgord/tools").FilePathAbsolute>;
3
+ blur(recipe: ImageBlurStrategy): Promise<import("@bgord/tools").FilePathAbsolute | import("@bgord/tools").FilePathRelative>;
4
4
  }
5
5
  //# sourceMappingURL=image-blur-sharp.adapter.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { ImageCompressorPort, ImageCompressorStrategy } from "./image-compressor.port";
2
2
  export declare class ImageCompressorNoopAdapter implements ImageCompressorPort {
3
- compress(recipe: ImageCompressorStrategy): Promise<import("@bgord/tools").FilePathRelative | import("@bgord/tools").FilePathAbsolute>;
3
+ compress(recipe: ImageCompressorStrategy): Promise<import("@bgord/tools").FilePathAbsolute | import("@bgord/tools").FilePathRelative>;
4
4
  }
5
5
  //# sourceMappingURL=image-compressor-noop.adapter.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import type { ImageCompressorPort, ImageCompressorStrategy } from "./image-compressor.port";
2
2
  export declare class ImageCompressorSharpAdapter implements ImageCompressorPort {
3
3
  private static readonly DEFAULT_QUALITY;
4
- compress(recipe: ImageCompressorStrategy): Promise<import("@bgord/tools").FilePathRelative | import("@bgord/tools").FilePathAbsolute>;
4
+ compress(recipe: ImageCompressorStrategy): Promise<import("@bgord/tools").FilePathAbsolute | import("@bgord/tools").FilePathRelative>;
5
5
  }
6
6
  //# sourceMappingURL=image-compressor-sharp.adapter.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { ImageExifClearPort, ImageExifClearStrategy } from "./image-exif-clear.port";
2
2
  export declare class ImageExifClearNoopAdapter implements ImageExifClearPort {
3
- clear(recipe: ImageExifClearStrategy): Promise<import("@bgord/tools").FilePathRelative | import("@bgord/tools").FilePathAbsolute>;
3
+ clear(recipe: ImageExifClearStrategy): Promise<import("@bgord/tools").FilePathAbsolute | import("@bgord/tools").FilePathRelative>;
4
4
  }
5
5
  //# sourceMappingURL=image-exif-clear-noop.adapter.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { ImageExifClearPort, ImageExifClearStrategy } from "./image-exif-clear.port";
2
2
  export declare class ImageExifClearSharpAdapter implements ImageExifClearPort {
3
- clear(recipe: ImageExifClearStrategy): Promise<import("@bgord/tools").FilePathRelative | import("@bgord/tools").FilePathAbsolute>;
3
+ clear(recipe: ImageExifClearStrategy): Promise<import("@bgord/tools").FilePathAbsolute | import("@bgord/tools").FilePathRelative>;
4
4
  }
5
5
  //# sourceMappingURL=image-exif-clear-sharp.adapter.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { ImageFormatterPort, ImageFormatterStrategy } from "./image-formatter.port";
2
2
  export declare class ImageFormatterSharpAdapter implements ImageFormatterPort {
3
- format(recipe: ImageFormatterStrategy): Promise<import("@bgord/tools").FilePathRelative | import("@bgord/tools").FilePathAbsolute>;
3
+ format(recipe: ImageFormatterStrategy): Promise<import("@bgord/tools").FilePathAbsolute | import("@bgord/tools").FilePathRelative>;
4
4
  }
5
5
  //# sourceMappingURL=image-formatter-sharp.adapter.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type * as tools from "@bgord/tools";
2
- type ImageInfoType = {
2
+ export type ImageInfoType = {
3
3
  height: tools.HeightType;
4
4
  width: tools.WidthType;
5
5
  mime: tools.Mime;
@@ -8,5 +8,4 @@ type ImageInfoType = {
8
8
  export interface ImageInfoPort {
9
9
  inspect(filePath: tools.FilePathRelative | tools.FilePathAbsolute): Promise<ImageInfoType>;
10
10
  }
11
- export {};
12
11
  //# sourceMappingURL=image-info.port.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"image-info.port.d.ts","sourceRoot":"","sources":["../src/image-info.port.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,KAAK,aAAa,GAAG;IAAE,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAA;CAAE,CAAC;AAE9G,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC5F"}
1
+ {"version":3,"file":"image-info.port.d.ts","sourceRoot":"","sources":["../src/image-info.port.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;IACjB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC5F"}
@@ -0,0 +1,6 @@
1
+ import type * as tools from "@bgord/tools";
2
+ import type { ImageProcessorPort, ImageProcessorStrategy } from "./image-processor.port";
3
+ export declare class ImageProcessorNoopAdapter implements ImageProcessorPort {
4
+ process(recipe: ImageProcessorStrategy): Promise<tools.FilePathRelative | tools.FilePathAbsolute>;
5
+ }
6
+ //# sourceMappingURL=image-processor-noop.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-processor-noop.adapter.d.ts","sourceRoot":"","sources":["../src/image-processor-noop.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEzF,qBAAa,yBAA0B,YAAW,kBAAkB;IAC5D,OAAO,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;CAKxG"}
@@ -0,0 +1,8 @@
1
+ export class ImageProcessorNoopAdapter {
2
+ async process(recipe) {
3
+ return recipe.strategy === "output_path"
4
+ ? recipe.output
5
+ : recipe.input.withFilename(recipe.input.getFilename().withExtension(recipe.to));
6
+ }
7
+ }
8
+ //# sourceMappingURL=image-processor-noop.adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-processor-noop.adapter.js","sourceRoot":"","sources":["../src/image-processor-noop.adapter.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,yBAAyB;IACpC,KAAK,CAAC,OAAO,CAAC,MAA8B;QAC1C,OAAO,MAAM,CAAC,QAAQ,KAAK,aAAa;YACtC,CAAC,CAAC,MAAM,CAAC,MAAM;YACf,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IACrF,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ import type * as tools from "@bgord/tools";
2
+ import type { ImageProcessorPort, ImageProcessorStrategy } from "./image-processor.port";
3
+ export declare class ImageProcessorSharpAdapter implements ImageProcessorPort {
4
+ private static readonly DEFAULT_QUALITY;
5
+ process(recipe: ImageProcessorStrategy): Promise<tools.FilePathRelative | tools.FilePathAbsolute>;
6
+ }
7
+ //# sourceMappingURL=image-processor-sharp.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-processor-sharp.adapter.d.ts","sourceRoot":"","sources":["../src/image-processor-sharp.adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEzF,qBAAa,0BAA2B,YAAW,kBAAkB;IACnE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAM;IAEvC,OAAO,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;CAwCxG"}
@@ -0,0 +1,96 @@
1
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
2
+ if (value !== null && value !== void 0) {
3
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
4
+ var dispose, inner;
5
+ if (async) {
6
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
7
+ dispose = value[Symbol.asyncDispose];
8
+ }
9
+ if (dispose === void 0) {
10
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
11
+ dispose = value[Symbol.dispose];
12
+ if (async) inner = dispose;
13
+ }
14
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
15
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
16
+ env.stack.push({ value: value, dispose: dispose, async: async });
17
+ }
18
+ else if (async) {
19
+ env.stack.push({ async: true });
20
+ }
21
+ return value;
22
+ };
23
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
24
+ return function (env) {
25
+ function fail(e) {
26
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
27
+ env.hasError = true;
28
+ }
29
+ var r, s = 0;
30
+ function next() {
31
+ while (r = env.stack.pop()) {
32
+ try {
33
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
34
+ if (r.dispose) {
35
+ var result = r.dispose.call(r.value);
36
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
37
+ }
38
+ else s |= 1;
39
+ }
40
+ catch (e) {
41
+ fail(e);
42
+ }
43
+ }
44
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
45
+ if (env.hasError) throw env.error;
46
+ }
47
+ return next();
48
+ };
49
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
50
+ var e = new Error(message);
51
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52
+ });
53
+ import fs from "node:fs/promises";
54
+ import sharp from "sharp";
55
+ export class ImageProcessorSharpAdapter {
56
+ static DEFAULT_QUALITY = 85;
57
+ async process(recipe) {
58
+ const env_1 = { stack: [], error: void 0, hasError: false };
59
+ try {
60
+ const final = recipe.strategy === "output_path"
61
+ ? recipe.output
62
+ : recipe.input.withFilename(recipe.input.getFilename().withExtension(recipe.to));
63
+ const temporary = final.withFilename(final.getFilename().withSuffix("-processed"));
64
+ const finalExtension = final.getFilename().getExtension();
65
+ const encoder = (finalExtension === "jpg" ? "jpeg" : finalExtension);
66
+ const quality = recipe.quality ?? ImageProcessorSharpAdapter.DEFAULT_QUALITY;
67
+ const pipeline = sharp(recipe.input.get());
68
+ const _sharp_ = __addDisposableResource(env_1, { [Symbol.dispose]: () => pipeline.destroy() }, false);
69
+ let processor = pipeline.rotate();
70
+ if (recipe.background) {
71
+ processor = processor.flatten({ background: recipe.background });
72
+ }
73
+ processor = processor.resize({
74
+ width: recipe.maxSide,
75
+ height: recipe.maxSide,
76
+ fit: "inside",
77
+ withoutEnlargement: true,
78
+ });
79
+ processor = processor.toFormat(encoder, { quality });
80
+ await processor.toFile(temporary.get());
81
+ await fs.rename(temporary.get(), final.get());
82
+ if (recipe.strategy === "in_place" && final.get() !== recipe.input.get()) {
83
+ await fs.unlink(recipe.input.get());
84
+ }
85
+ return final;
86
+ }
87
+ catch (e_1) {
88
+ env_1.error = e_1;
89
+ env_1.hasError = true;
90
+ }
91
+ finally {
92
+ __disposeResources(env_1);
93
+ }
94
+ }
95
+ }
96
+ //# sourceMappingURL=image-processor-sharp.adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-processor-sharp.adapter.js","sourceRoot":"","sources":["../src/image-processor-sharp.adapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAA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,SAAS,CAAC,MAAM,CAAC;gBAC3B,KAAK,EAAE,MAAM,CAAC,OAAO;gBACrB,MAAM,EAAE,MAAM,CAAC,OAAO;gBACtB,GAAG,EAAE,QAAQ;gBACb,kBAAkB,EAAE,IAAI;aACzB,CAAC,CAAC;YAEH,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;YAErD,MAAM,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC;YACxC,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;YAE9C,IAAI,MAAM,CAAC,QAAQ,KAAK,UAAU,IAAI,KAAK,CAAC,GAAG,EAAE,KAAK,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC;gBACzE,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;YACtC,CAAC;YAED,OAAO,KAAK,CAAC;;;;;;;;;KACd"}
@@ -0,0 +1,30 @@
1
+ import type * as tools from "@bgord/tools";
2
+ type ImageBackground = string | {
3
+ r: number;
4
+ g: number;
5
+ b: number;
6
+ alpha?: number;
7
+ };
8
+ type ImageProcessorOutputPathStrategy = {
9
+ strategy: "output_path";
10
+ input: tools.FilePathRelative | tools.FilePathAbsolute;
11
+ output: tools.FilePathRelative | tools.FilePathAbsolute;
12
+ maxSide: number;
13
+ to: tools.ExtensionType;
14
+ quality?: number;
15
+ background?: ImageBackground;
16
+ };
17
+ type ImageProcessorInPlaceStrategy = {
18
+ strategy: "in_place";
19
+ input: tools.FilePathRelative | tools.FilePathAbsolute;
20
+ maxSide: number;
21
+ to: tools.ExtensionType;
22
+ quality?: number;
23
+ background?: ImageBackground;
24
+ };
25
+ export type ImageProcessorStrategy = ImageProcessorInPlaceStrategy | ImageProcessorOutputPathStrategy;
26
+ export interface ImageProcessorPort {
27
+ process(recipe: ImageProcessorStrategy): Promise<tools.FilePathRelative | tools.FilePathAbsolute>;
28
+ }
29
+ export {};
30
+ //# sourceMappingURL=image-processor.port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-processor.port.d.ts","sourceRoot":"","sources":["../src/image-processor.port.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,KAAK,eAAe,GAAG,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpF,KAAK,gCAAgC,GAAG;IACtC,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;IACvD,MAAM,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,KAAK,CAAC,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,KAAK,6BAA6B,GAAG;IACnC,QAAQ,EAAE,UAAU,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,KAAK,CAAC,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,6BAA6B,GAAG,gCAAgC,CAAC;AAEtG,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAC;CACnG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=image-processor.port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-processor.port.js","sourceRoot":"","sources":["../src/image-processor.port.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import type { ImageResizerPort, ImageResizerStrategy } from "./image-resizer.port";
2
2
  export declare class ImageResizerNoopAdapter implements ImageResizerPort {
3
- resize(recipe: ImageResizerStrategy): Promise<import("@bgord/tools").FilePathRelative | import("@bgord/tools").FilePathAbsolute>;
3
+ resize(recipe: ImageResizerStrategy): Promise<import("@bgord/tools").FilePathAbsolute | import("@bgord/tools").FilePathRelative>;
4
4
  }
5
5
  //# sourceMappingURL=image-resizer-noop.adapter.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { ImageResizerPort, ImageResizerStrategy } from "./image-resizer.port";
2
2
  export declare class ImageResizerSharpAdapter implements ImageResizerPort {
3
- resize(recipe: ImageResizerStrategy): Promise<import("@bgord/tools").FilePathRelative | import("@bgord/tools").FilePathAbsolute>;
3
+ resize(recipe: ImageResizerStrategy): Promise<import("@bgord/tools").FilePathAbsolute | import("@bgord/tools").FilePathRelative>;
4
4
  }
5
5
  //# sourceMappingURL=image-resizer-sharp.adapter.d.ts.map
package/dist/index.d.ts CHANGED
@@ -29,12 +29,18 @@ export * from "./event-store-like.types";
29
29
  export * from "./event-stream.vo";
30
30
  export * from "./file-draft.service";
31
31
  export * from "./file-draft-zip.service";
32
+ export * from "./file-hash.port";
33
+ export * from "./file-hash-noop.adapter";
34
+ export * from "./file-hash-sha256-bun.adapter";
32
35
  export * from "./file-uploader.middleware";
33
36
  export * from "./graceful-shutdown.service";
34
37
  export * from "./gzip.service";
35
38
  export * from "./healthcheck.service";
36
39
  export * from "./http-logger.middleware";
37
40
  export * from "./i18n.service";
41
+ export * from "./image-alpha.port";
42
+ export * from "./image-alpha-noop.adapter";
43
+ export * from "./image-alpha-sharp.adapter";
38
44
  export * from "./image-blur.port";
39
45
  export * from "./image-blur-noop.adapter";
40
46
  export * from "./image-blur-sharp.adapter";
@@ -50,6 +56,9 @@ export * from "./image-formatter-sharp.adapter";
50
56
  export * from "./image-info.port";
51
57
  export * from "./image-info-noop.adapter";
52
58
  export * from "./image-info-sharp.adapter";
59
+ export * from "./image-processor.port";
60
+ export * from "./image-processor-noop.adapter";
61
+ export * from "./image-processor-sharp.adapter";
53
62
  export * from "./image-resizer.port";
54
63
  export * from "./image-resizer-noop.adapter";
55
64
  export * from "./image-resizer-sharp.adapter";
@@ -77,6 +86,9 @@ export * from "./prerequisites/index";
77
86
  export * from "./prerequisites.service";
78
87
  export * from "./rate-limit-store.port";
79
88
  export * from "./rate-limit-store-node-cache.adapter";
89
+ export * from "./remote-file-storage.port";
90
+ export * from "./remote-file-storage-disk.adapter";
91
+ export * from "./remote-file-storage-noop.adapter";
80
92
  export * from "./safe-parse-body.service";
81
93
  export * from "./setup.service";
82
94
  export * from "./shield-api-key.middleware";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc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