@xyo-network/image-thumbnail-plugin 2.99.4 → 2.99.5

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 (77) hide show
  1. package/dist/neutral/Plugin.d.cts +3 -3
  2. package/dist/neutral/Plugin.d.mts +3 -3
  3. package/dist/neutral/Plugin.d.ts +3 -3
  4. package/dist/neutral/Witness/Params.d.cts +1 -1
  5. package/dist/neutral/Witness/Params.d.mts +1 -1
  6. package/dist/neutral/Witness/Params.d.ts +1 -1
  7. package/dist/neutral/Witness/Witness.d.cts +2 -2
  8. package/dist/neutral/Witness/Witness.d.mts +2 -2
  9. package/dist/neutral/Witness/Witness.d.ts +2 -2
  10. package/dist/neutral/Witness/ffmpeg/fluent/index.d.cts +1 -1
  11. package/dist/neutral/Witness/ffmpeg/fluent/index.d.mts +1 -1
  12. package/dist/neutral/Witness/ffmpeg/fluent/index.d.ts +1 -1
  13. package/dist/neutral/Witness/ffmpeg/index.d.cts +2 -2
  14. package/dist/neutral/Witness/ffmpeg/index.d.mts +2 -2
  15. package/dist/neutral/Witness/ffmpeg/index.d.ts +2 -2
  16. package/dist/neutral/Witness/ffmpeg/spawn/index.d.cts +2 -2
  17. package/dist/neutral/Witness/ffmpeg/spawn/index.d.mts +2 -2
  18. package/dist/neutral/Witness/ffmpeg/spawn/index.d.ts +2 -2
  19. package/dist/neutral/Witness/index.d.cts +3 -3
  20. package/dist/neutral/Witness/index.d.mts +3 -3
  21. package/dist/neutral/Witness/index.d.ts +3 -3
  22. package/dist/neutral/Witness/lib/index.d.cts +3 -3
  23. package/dist/neutral/Witness/lib/index.d.mts +3 -3
  24. package/dist/neutral/Witness/lib/index.d.ts +3 -3
  25. package/dist/neutral/index.cjs +113 -85
  26. package/dist/neutral/index.cjs.map +1 -1
  27. package/dist/neutral/index.d.cts +2 -2
  28. package/dist/neutral/index.d.mts +2 -2
  29. package/dist/neutral/index.d.ts +2 -2
  30. package/dist/neutral/{index.js → index.mjs} +116 -86
  31. package/dist/neutral/index.mjs.map +1 -0
  32. package/dist/node/Plugin.d.cts +3 -3
  33. package/dist/node/Plugin.d.mts +3 -3
  34. package/dist/node/Plugin.d.ts +3 -3
  35. package/dist/node/Witness/Params.d.cts +1 -1
  36. package/dist/node/Witness/Params.d.mts +1 -1
  37. package/dist/node/Witness/Params.d.ts +1 -1
  38. package/dist/node/Witness/Witness.d.cts +2 -2
  39. package/dist/node/Witness/Witness.d.mts +2 -2
  40. package/dist/node/Witness/Witness.d.ts +2 -2
  41. package/dist/node/Witness/ffmpeg/fluent/index.d.cts +1 -1
  42. package/dist/node/Witness/ffmpeg/fluent/index.d.mts +1 -1
  43. package/dist/node/Witness/ffmpeg/fluent/index.d.ts +1 -1
  44. package/dist/node/Witness/ffmpeg/index.d.cts +2 -2
  45. package/dist/node/Witness/ffmpeg/index.d.mts +2 -2
  46. package/dist/node/Witness/ffmpeg/index.d.ts +2 -2
  47. package/dist/node/Witness/ffmpeg/spawn/index.d.cts +2 -2
  48. package/dist/node/Witness/ffmpeg/spawn/index.d.mts +2 -2
  49. package/dist/node/Witness/ffmpeg/spawn/index.d.ts +2 -2
  50. package/dist/node/Witness/index.d.cts +3 -3
  51. package/dist/node/Witness/index.d.mts +3 -3
  52. package/dist/node/Witness/index.d.ts +3 -3
  53. package/dist/node/Witness/lib/index.d.cts +3 -3
  54. package/dist/node/Witness/lib/index.d.mts +3 -3
  55. package/dist/node/Witness/lib/index.d.ts +3 -3
  56. package/dist/node/index.cjs +122 -93
  57. package/dist/node/index.cjs.map +1 -1
  58. package/dist/node/index.d.cts +2 -2
  59. package/dist/node/index.d.mts +2 -2
  60. package/dist/node/index.d.ts +2 -2
  61. package/dist/node/{index.js → index.mjs} +126 -94
  62. package/dist/node/index.mjs.map +1 -0
  63. package/package.json +27 -27
  64. package/src/Plugin.ts +1 -1
  65. package/src/Witness/Params.ts +1 -1
  66. package/src/Witness/Witness.ts +10 -10
  67. package/src/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.ts +1 -1
  68. package/src/Witness/ffmpeg/fluent/index.ts +1 -1
  69. package/src/Witness/ffmpeg/index.ts +2 -2
  70. package/src/Witness/ffmpeg/spawn/getVideoFrameAsImage.ts +1 -1
  71. package/src/Witness/ffmpeg/spawn/index.ts +2 -2
  72. package/src/Witness/index.ts +3 -3
  73. package/src/Witness/lib/checkIpfsUrl.ts +3 -3
  74. package/src/Witness/lib/index.ts +3 -3
  75. package/src/index.ts +2 -2
  76. package/dist/neutral/index.js.map +0 -1
  77. package/dist/node/index.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { ImageThumbnailDiviner } from '@xyo-network/diviner-image-thumbnail';
2
- import { ImageThumbnailWitness } from './Witness/index.js';
2
+ import { ImageThumbnailWitness } from './Witness/index.ts';
3
3
  export declare const ImageThumbnailPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetDualPlugin<ImageThumbnailWitness<import("@xylabs/object").BaseParamsFields & {
4
4
  account?: import("@xyo-network/account-model").AccountInstance | "random";
5
5
  addToResolvers?: boolean;
@@ -9,7 +9,7 @@ export declare const ImageThumbnailPlugin: () => import("@xyo-network/payloadset
9
9
  schema: "network.xyo.image.thumbnail.witness.config";
10
10
  } & {
11
11
  dataUrlPassthrough?: boolean;
12
- encoding?: import("./Witness/Config.js").ImageThumbnailEncoding;
12
+ encoding?: import("./Witness/Config.ts").ImageThumbnailEncoding;
13
13
  height?: number;
14
14
  ipfsGateway?: string;
15
15
  maxAsyncProcesses?: number;
@@ -17,7 +17,7 @@ export declare const ImageThumbnailPlugin: () => import("@xyo-network/payloadset
17
17
  maxCacheEntries?: number;
18
18
  quality?: number;
19
19
  runExclusive?: boolean;
20
- schema: import("./Witness/Config.js").ImageThumbnailWitnessConfigSchema;
20
+ schema: import("./Witness/Config.ts").ImageThumbnailWitnessConfigSchema;
21
21
  width?: number;
22
22
  }, "schema"> & {
23
23
  schema: "network.xyo.image.thumbnail.witness.config";
@@ -1,5 +1,5 @@
1
1
  import { ImageThumbnailDiviner } from '@xyo-network/diviner-image-thumbnail';
2
- import { ImageThumbnailWitness } from './Witness/index.js';
2
+ import { ImageThumbnailWitness } from './Witness/index.ts';
3
3
  export declare const ImageThumbnailPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetDualPlugin<ImageThumbnailWitness<import("@xylabs/object").BaseParamsFields & {
4
4
  account?: import("@xyo-network/account-model").AccountInstance | "random";
5
5
  addToResolvers?: boolean;
@@ -9,7 +9,7 @@ export declare const ImageThumbnailPlugin: () => import("@xyo-network/payloadset
9
9
  schema: "network.xyo.image.thumbnail.witness.config";
10
10
  } & {
11
11
  dataUrlPassthrough?: boolean;
12
- encoding?: import("./Witness/Config.js").ImageThumbnailEncoding;
12
+ encoding?: import("./Witness/Config.ts").ImageThumbnailEncoding;
13
13
  height?: number;
14
14
  ipfsGateway?: string;
15
15
  maxAsyncProcesses?: number;
@@ -17,7 +17,7 @@ export declare const ImageThumbnailPlugin: () => import("@xyo-network/payloadset
17
17
  maxCacheEntries?: number;
18
18
  quality?: number;
19
19
  runExclusive?: boolean;
20
- schema: import("./Witness/Config.js").ImageThumbnailWitnessConfigSchema;
20
+ schema: import("./Witness/Config.ts").ImageThumbnailWitnessConfigSchema;
21
21
  width?: number;
22
22
  }, "schema"> & {
23
23
  schema: "network.xyo.image.thumbnail.witness.config";
@@ -1,5 +1,5 @@
1
1
  import { ImageThumbnailDiviner } from '@xyo-network/diviner-image-thumbnail';
2
- import { ImageThumbnailWitness } from './Witness/index.js';
2
+ import { ImageThumbnailWitness } from './Witness/index.ts';
3
3
  export declare const ImageThumbnailPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetDualPlugin<ImageThumbnailWitness<import("@xylabs/object").BaseParamsFields & {
4
4
  account?: import("@xyo-network/account-model").AccountInstance | "random";
5
5
  addToResolvers?: boolean;
@@ -9,7 +9,7 @@ export declare const ImageThumbnailPlugin: () => import("@xyo-network/payloadset
9
9
  schema: "network.xyo.image.thumbnail.witness.config";
10
10
  } & {
11
11
  dataUrlPassthrough?: boolean;
12
- encoding?: import("./Witness/Config.js").ImageThumbnailEncoding;
12
+ encoding?: import("./Witness/Config.ts").ImageThumbnailEncoding;
13
13
  height?: number;
14
14
  ipfsGateway?: string;
15
15
  maxAsyncProcesses?: number;
@@ -17,7 +17,7 @@ export declare const ImageThumbnailPlugin: () => import("@xyo-network/payloadset
17
17
  maxCacheEntries?: number;
18
18
  quality?: number;
19
19
  runExclusive?: boolean;
20
- schema: import("./Witness/Config.js").ImageThumbnailWitnessConfigSchema;
20
+ schema: import("./Witness/Config.ts").ImageThumbnailWitnessConfigSchema;
21
21
  width?: number;
22
22
  }, "schema"> & {
23
23
  schema: "network.xyo.image.thumbnail.witness.config";
@@ -1,6 +1,6 @@
1
1
  import { AnyConfigSchema } from '@xyo-network/module-model';
2
2
  import { WitnessParams } from '@xyo-network/witness-model';
3
- import { ImageThumbnailWitnessConfig } from './Config.js';
3
+ import { ImageThumbnailWitnessConfig } from './Config.ts';
4
4
  export type ImageThumbnailWitnessParams = WitnessParams<AnyConfigSchema<ImageThumbnailWitnessConfig>, {
5
5
  loaders?: string[];
6
6
  }>;
@@ -1,6 +1,6 @@
1
1
  import { AnyConfigSchema } from '@xyo-network/module-model';
2
2
  import { WitnessParams } from '@xyo-network/witness-model';
3
- import { ImageThumbnailWitnessConfig } from './Config.js';
3
+ import { ImageThumbnailWitnessConfig } from './Config.ts';
4
4
  export type ImageThumbnailWitnessParams = WitnessParams<AnyConfigSchema<ImageThumbnailWitnessConfig>, {
5
5
  loaders?: string[];
6
6
  }>;
@@ -1,6 +1,6 @@
1
1
  import { AnyConfigSchema } from '@xyo-network/module-model';
2
2
  import { WitnessParams } from '@xyo-network/witness-model';
3
- import { ImageThumbnailWitnessConfig } from './Config.js';
3
+ import { ImageThumbnailWitnessConfig } from './Config.ts';
4
4
  export type ImageThumbnailWitnessParams = WitnessParams<AnyConfigSchema<ImageThumbnailWitnessConfig>, {
5
5
  loaders?: string[];
6
6
  }>;
@@ -2,8 +2,8 @@ import { AbstractWitness } from '@xyo-network/abstract-witness';
2
2
  import { ImageThumbnail } from '@xyo-network/image-thumbnail-payload-plugin';
3
3
  import { Schema } from '@xyo-network/payload-model';
4
4
  import { UrlPayload } from '@xyo-network/url-payload-plugin';
5
- import { ImageThumbnailEncoding } from './Config.js';
6
- import { ImageThumbnailWitnessParams } from './Params.js';
5
+ import { ImageThumbnailEncoding } from './Config.ts';
6
+ import { ImageThumbnailWitnessParams } from './Params.ts';
7
7
  export interface ImageThumbnailWitnessError extends Error {
8
8
  name: 'ImageThumbnailWitnessError';
9
9
  url: string;
@@ -2,8 +2,8 @@ import { AbstractWitness } from '@xyo-network/abstract-witness';
2
2
  import { ImageThumbnail } from '@xyo-network/image-thumbnail-payload-plugin';
3
3
  import { Schema } from '@xyo-network/payload-model';
4
4
  import { UrlPayload } from '@xyo-network/url-payload-plugin';
5
- import { ImageThumbnailEncoding } from './Config.js';
6
- import { ImageThumbnailWitnessParams } from './Params.js';
5
+ import { ImageThumbnailEncoding } from './Config.ts';
6
+ import { ImageThumbnailWitnessParams } from './Params.ts';
7
7
  export interface ImageThumbnailWitnessError extends Error {
8
8
  name: 'ImageThumbnailWitnessError';
9
9
  url: string;
@@ -2,8 +2,8 @@ import { AbstractWitness } from '@xyo-network/abstract-witness';
2
2
  import { ImageThumbnail } from '@xyo-network/image-thumbnail-payload-plugin';
3
3
  import { Schema } from '@xyo-network/payload-model';
4
4
  import { UrlPayload } from '@xyo-network/url-payload-plugin';
5
- import { ImageThumbnailEncoding } from './Config.js';
6
- import { ImageThumbnailWitnessParams } from './Params.js';
5
+ import { ImageThumbnailEncoding } from './Config.ts';
6
+ import { ImageThumbnailWitnessParams } from './Params.ts';
7
7
  export interface ImageThumbnailWitnessError extends Error {
8
8
  name: 'ImageThumbnailWitnessError';
9
9
  url: string;
@@ -1,2 +1,2 @@
1
- export * from './getVideoFrameAsImageFluent.js';
1
+ export * from './getVideoFrameAsImageFluent.ts';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from './getVideoFrameAsImageFluent.js';
1
+ export * from './getVideoFrameAsImageFluent.ts';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from './getVideoFrameAsImageFluent.js';
1
+ export * from './getVideoFrameAsImageFluent.ts';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * from './fluent/index.js';
2
- export * from './spawn/index.js';
1
+ export * from './fluent/index.ts';
2
+ export * from './spawn/index.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * from './fluent/index.js';
2
- export * from './spawn/index.js';
1
+ export * from './fluent/index.ts';
2
+ export * from './spawn/index.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * from './fluent/index.js';
2
- export * from './spawn/index.js';
1
+ export * from './fluent/index.ts';
2
+ export * from './spawn/index.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * from './executeFfmpeg.js';
2
- export * from './getVideoFrameAsImage.js';
1
+ export * from './executeFfmpeg.ts';
2
+ export * from './getVideoFrameAsImage.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * from './executeFfmpeg.js';
2
- export * from './getVideoFrameAsImage.js';
1
+ export * from './executeFfmpeg.ts';
2
+ export * from './getVideoFrameAsImage.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * from './executeFfmpeg.js';
2
- export * from './getVideoFrameAsImage.js';
1
+ export * from './executeFfmpeg.ts';
2
+ export * from './getVideoFrameAsImage.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- export * from './Config.js';
2
- export * from './Params.js';
3
- export * from './Witness.js';
1
+ export * from './Config.ts';
2
+ export * from './Params.ts';
3
+ export * from './Witness.ts';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- export * from './Config.js';
2
- export * from './Params.js';
3
- export * from './Witness.js';
1
+ export * from './Config.ts';
2
+ export * from './Params.ts';
3
+ export * from './Witness.ts';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- export * from './Config.js';
2
- export * from './Params.js';
3
- export * from './Witness.js';
1
+ export * from './Config.ts';
2
+ export * from './Params.ts';
3
+ export * from './Witness.ts';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- export * from './checkIpfsUrl.js';
2
- export * from './createDataUrl.js';
3
- export * from './resolveDynamicSvg.js';
1
+ export * from './checkIpfsUrl.ts';
2
+ export * from './createDataUrl.ts';
3
+ export * from './resolveDynamicSvg.ts';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- export * from './checkIpfsUrl.js';
2
- export * from './createDataUrl.js';
3
- export * from './resolveDynamicSvg.js';
1
+ export * from './checkIpfsUrl.ts';
2
+ export * from './createDataUrl.ts';
3
+ export * from './resolveDynamicSvg.ts';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- export * from './checkIpfsUrl.js';
2
- export * from './createDataUrl.js';
3
- export * from './resolveDynamicSvg.js';
1
+ export * from './checkIpfsUrl.ts';
2
+ export * from './createDataUrl.ts';
3
+ export * from './resolveDynamicSvg.ts';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -5,6 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
9
  var __export = (target, all) => {
9
10
  for (var name in all)
10
11
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -71,7 +72,10 @@ var import_node_os = require("os");
71
72
  var import_node_stream = require("stream");
72
73
  var import_fluent_ffmpeg = __toESM(require("fluent-ffmpeg"), 1);
73
74
  var import_uuid = require("uuid");
74
- var FfmpegOutputStream = class extends import_node_stream.Writable {
75
+ var FfmpegOutputStream = class FfmpegOutputStream2 extends import_node_stream.Writable {
76
+ static {
77
+ __name(this, "FfmpegOutputStream");
78
+ }
75
79
  chunks = [];
76
80
  constructor(options) {
77
81
  super(options);
@@ -81,16 +85,18 @@ var FfmpegOutputStream = class extends import_node_stream.Writable {
81
85
  callback();
82
86
  }
83
87
  /**
84
- * Collects the output from ffmpeg into a buffer.
85
- * @returns A buffer containing the concatenated
86
- * output from ffmpeg.
87
- */
88
- toBuffer = () => Buffer.concat(this.chunks);
88
+ * Collects the output from ffmpeg into a buffer.
89
+ * @returns A buffer containing the concatenated
90
+ * output from ffmpeg.
91
+ */
92
+ toBuffer = /* @__PURE__ */ __name(() => Buffer.concat(this.chunks), "toBuffer");
89
93
  };
90
- var getVideoFrameAsImageFluent = async (videoBuffer) => {
94
+ var getVideoFrameAsImageFluent = /* @__PURE__ */ __name(async (videoBuffer) => {
91
95
  const tmpFile = `/${(0, import_node_os.tmpdir)()}/${(0, import_uuid.v4)()}`;
92
96
  try {
93
- await (0, import_promises.writeFile)(tmpFile, new Uint8Array(videoBuffer), { encoding: "binary" });
97
+ await (0, import_promises.writeFile)(tmpFile, new Uint8Array(videoBuffer), {
98
+ encoding: "binary"
99
+ });
94
100
  const imageBuffer = await new Promise((resolve, reject) => {
95
101
  const ffmpegOutput = new FfmpegOutputStream();
96
102
  (0, import_fluent_ffmpeg.default)().on("error", (err) => reject(err.message)).on("end", () => resolve(ffmpegOutput.toBuffer())).input(tmpFile).takeFrames(1).withNoAudio().outputOptions("-f image2pipe").videoCodec("png").pipe(ffmpegOutput);
@@ -102,12 +108,12 @@ var getVideoFrameAsImageFluent = async (videoBuffer) => {
102
108
  } catch {
103
109
  }
104
110
  }
105
- };
111
+ }, "getVideoFrameAsImageFluent");
106
112
 
107
113
  // src/Witness/lib/checkIpfsUrl.ts
108
114
  var import_assert = require("@xylabs/assert");
109
115
  var allowIpfsIoRepair = true;
110
- var checkIpfsUrl = (urlToCheck, ipfsGateway) => {
116
+ var checkIpfsUrl = /* @__PURE__ */ __name((urlToCheck, ipfsGateway) => {
111
117
  try {
112
118
  const url = new URL(urlToCheck);
113
119
  let protocol = url.protocol;
@@ -136,19 +142,19 @@ var checkIpfsUrl = (urlToCheck, ipfsGateway) => {
136
142
  } catch {
137
143
  return urlToCheck;
138
144
  }
139
- };
145
+ }, "checkIpfsUrl");
140
146
 
141
147
  // src/Witness/lib/createDataUrl.ts
142
148
  var import_base64_js = require("base64-js");
143
- var createDataUrl = (data, contextType, encoding = "base64") => {
149
+ var createDataUrl = /* @__PURE__ */ __name((data, contextType, encoding = "base64") => {
144
150
  return `data:${contextType};${encoding},${(0, import_base64_js.fromByteArray)(new Uint8Array(data))}`;
145
- };
151
+ }, "createDataUrl");
146
152
 
147
153
  // src/Witness/lib/resolveDynamicSvg.ts
148
154
  var import_axios = require("@xylabs/axios");
149
155
  var import_base64_js2 = require("base64-js");
150
156
  var import_xml2js = require("xml2js");
151
- var resolveDynamicSvg = async (base64Bytes) => {
157
+ var resolveDynamicSvg = /* @__PURE__ */ __name(async (base64Bytes) => {
152
158
  const decoder = new TextDecoder();
153
159
  const bytes = (0, import_base64_js2.toByteArray)(base64Bytes);
154
160
  const svg = decoder.decode(bytes);
@@ -166,20 +172,42 @@ var resolveDynamicSvg = async (base64Bytes) => {
166
172
  const image = imageResults.map(([href, response]) => {
167
173
  if (response.data) {
168
174
  const sourceBuffer = Buffer.from(response.data, "binary");
169
- return { $: { href: `data:${response.headers["content-type"]?.toString()};base64,${sourceBuffer.toString("base64")}` } };
175
+ return {
176
+ $: {
177
+ href: `data:${response.headers["content-type"]?.toString()};base64,${sourceBuffer.toString("base64")}`
178
+ }
179
+ };
170
180
  } else {
171
- return { $: { href } };
181
+ return {
182
+ $: {
183
+ href
184
+ }
185
+ };
172
186
  }
173
187
  });
174
- const updatedSVG = { ...svgObj, svg: { ...svgNode, image } };
188
+ const updatedSVG = {
189
+ ...svgObj,
190
+ svg: {
191
+ ...svgNode,
192
+ image
193
+ }
194
+ };
175
195
  const builder = new import_xml2js.Builder();
176
196
  return builder.buildObject(updatedSVG);
177
- };
197
+ }, "resolveDynamicSvg");
178
198
 
179
199
  // src/Witness/Witness.ts
180
- var gm = import_gm.default.subClass({ imageMagick: "7+" });
200
+ var gm = import_gm.default.subClass({
201
+ imageMagick: "7+"
202
+ });
181
203
  var ImageThumbnailWitness = class _ImageThumbnailWitness extends import_abstract_witness.AbstractWitness {
182
- static configSchemas = [...super.configSchemas, ImageThumbnailWitnessConfigSchema];
204
+ static {
205
+ __name(this, "ImageThumbnailWitness");
206
+ }
207
+ static configSchemas = [
208
+ ...super.configSchemas,
209
+ ImageThumbnailWitnessConfigSchema
210
+ ];
183
211
  static defaultConfigSchema = ImageThumbnailWitnessConfigSchema;
184
212
  _semaphore = new import_async_mutex.Semaphore(this.maxAsyncProcesses);
185
213
  get encoding() {
@@ -232,50 +260,42 @@ var ImageThumbnailWitness = class _ImageThumbnailWitness extends import_abstract
232
260
  throw new Error("ImageMagick is required for this witness");
233
261
  }
234
262
  const urlPayloads = payloads.filter((payload) => payload.schema === import_url_payload_plugin.UrlSchema);
235
- const process = async () => {
236
- return (0, import_lodash.compact)(
237
- await Promise.all(
238
- urlPayloads.map(async ({ url }) => {
239
- let result;
240
- const dataBuffer = _ImageThumbnailWitness.bufferFromDataUrl(url);
241
- if (dataBuffer) {
242
- if (this.config.dataUrlPassthrough) {
243
- result = {
244
- schema: import_image_thumbnail_payload_plugin2.ImageThumbnailSchema,
245
- sourceHash: await _ImageThumbnailWitness.binaryToSha256(dataBuffer),
246
- sourceUrl: url,
247
- url
248
- };
249
- } else {
250
- let cookedDataBuffer = dataBuffer;
251
- const urlParts = url.split(";");
252
- const [, contentType] = urlParts[0].split(":");
253
- if (contentType.startsWith("image/svg")) {
254
- const [encoding, byteString] = urlParts[1].split(",");
255
- if (encoding === "base64") {
256
- const newSvg = await resolveDynamicSvg(byteString);
257
- const newSvgDataUrl = createDataUrl(import_node_buffer.Buffer.from(newSvg), contentType);
258
- cookedDataBuffer = _ImageThumbnailWitness.bufferFromDataUrl(newSvgDataUrl) ?? dataBuffer;
259
- }
260
- }
261
- result = await this.processMedia(
262
- cookedDataBuffer,
263
- {
264
- schema: import_image_thumbnail_payload_plugin2.ImageThumbnailSchema,
265
- sourceUrl: url
266
- },
267
- contentType
268
- );
263
+ const process = /* @__PURE__ */ __name(async () => {
264
+ return (0, import_lodash.compact)(await Promise.all(urlPayloads.map(async ({ url }) => {
265
+ let result;
266
+ const dataBuffer = _ImageThumbnailWitness.bufferFromDataUrl(url);
267
+ if (dataBuffer) {
268
+ if (this.config.dataUrlPassthrough) {
269
+ result = {
270
+ schema: import_image_thumbnail_payload_plugin2.ImageThumbnailSchema,
271
+ sourceHash: await _ImageThumbnailWitness.binaryToSha256(dataBuffer),
272
+ sourceUrl: url,
273
+ url
274
+ };
275
+ } else {
276
+ let cookedDataBuffer = dataBuffer;
277
+ const urlParts = url.split(";");
278
+ const [, contentType] = urlParts[0].split(":");
279
+ if (contentType.startsWith("image/svg")) {
280
+ const [encoding, byteString] = urlParts[1].split(",");
281
+ if (encoding === "base64") {
282
+ const newSvg = await resolveDynamicSvg(byteString);
283
+ const newSvgDataUrl = createDataUrl(import_node_buffer.Buffer.from(newSvg), contentType);
284
+ cookedDataBuffer = _ImageThumbnailWitness.bufferFromDataUrl(newSvgDataUrl) ?? dataBuffer;
269
285
  }
270
- } else {
271
- const mutatedUrl = checkIpfsUrl(url, this.ipfsGateway);
272
- result = await this.fromHttp(mutatedUrl, url);
273
286
  }
274
- return result;
275
- })
276
- )
277
- );
278
- };
287
+ result = await this.processMedia(cookedDataBuffer, {
288
+ schema: import_image_thumbnail_payload_plugin2.ImageThumbnailSchema,
289
+ sourceUrl: url
290
+ }, contentType);
291
+ }
292
+ } else {
293
+ const mutatedUrl = checkIpfsUrl(url, this.ipfsGateway);
294
+ result = await this.fromHttp(mutatedUrl, url);
295
+ }
296
+ return result;
297
+ })));
298
+ }, "process");
279
299
  return this.config.runExclusive ? await this._semaphore.runExclusive(() => process()) : process();
280
300
  }
281
301
  async createThumbnailDataUrl(sourceBuffer, encoding) {
@@ -291,10 +311,10 @@ var ImageThumbnailWitness = class _ImageThumbnailWitness extends import_abstract
291
311
  return createDataUrl(thumb, "image/png");
292
312
  }
293
313
  /**
294
- * Creates an image thumbnail from a video.
295
- * @param videoBuffer The input video buffer.
296
- * @returns An buffer containing an image thumbnail for the video.
297
- */
314
+ * Creates an image thumbnail from a video.
315
+ * @param videoBuffer The input video buffer.
316
+ * @returns An buffer containing an image thumbnail for the video.
317
+ */
298
318
  async createThumbnailFromVideo(videoBuffer) {
299
319
  const imageBuffer = await getVideoFrameAsImageFluent(videoBuffer);
300
320
  return this.createThumbnailDataUrl(imageBuffer);
@@ -359,7 +379,10 @@ var ImageThumbnailWitness = class _ImageThumbnailWitness extends import_abstract
359
379
  return result;
360
380
  }
361
381
  async processMedia(sourceBuffer, imageThumbnail, contentType) {
362
- const [mediaType, fileType] = contentType?.split("/") ?? ["", ""];
382
+ const [mediaType, fileType] = contentType?.split("/") ?? [
383
+ "",
384
+ ""
385
+ ];
363
386
  imageThumbnail.mime = imageThumbnail.mime ?? {};
364
387
  imageThumbnail.mime.returned = mediaType;
365
388
  try {
@@ -368,11 +391,11 @@ var ImageThumbnailWitness = class _ImageThumbnailWitness extends import_abstract
368
391
  const error = ex;
369
392
  this.logger?.error(`FileType error: ${error.message}`);
370
393
  }
371
- const processImage = async (encoding2) => {
394
+ const processImage = /* @__PURE__ */ __name(async (encoding2) => {
372
395
  imageThumbnail.sourceHash = await _ImageThumbnailWitness.binaryToSha256(sourceBuffer);
373
396
  imageThumbnail.url = await this.createThumbnailDataUrl(sourceBuffer, encoding2);
374
- };
375
- const processVideo = async () => {
397
+ }, "processImage");
398
+ const processVideo = /* @__PURE__ */ __name(async () => {
376
399
  if (import_hasbin.default.sync("ffmpeg")) {
377
400
  imageThumbnail.sourceHash = await _ImageThumbnailWitness.binaryToSha256(sourceBuffer);
378
401
  imageThumbnail.url = await this.createThumbnailFromVideo(sourceBuffer);
@@ -380,7 +403,7 @@ var ImageThumbnailWitness = class _ImageThumbnailWitness extends import_abstract
380
403
  imageThumbnail.mime = imageThumbnail.mime ?? {};
381
404
  imageThumbnail.mime.invalid = true;
382
405
  }
383
- };
406
+ }, "processVideo");
384
407
  let encoding = "PNG";
385
408
  switch (fileType.toUpperCase()) {
386
409
  case "GIF": {
@@ -405,7 +428,10 @@ var ImageThumbnailWitness = class _ImageThumbnailWitness extends import_abstract
405
428
  break;
406
429
  }
407
430
  default: {
408
- const [detectedMediaType] = imageThumbnail.mime.detected?.mime?.split("/") ?? ["", ""];
431
+ const [detectedMediaType] = imageThumbnail.mime.detected?.mime?.split("/") ?? [
432
+ "",
433
+ ""
434
+ ];
409
435
  switch (detectedMediaType) {
410
436
  case "image": {
411
437
  await processImage();
@@ -430,19 +456,21 @@ var ImageThumbnailWitness = class _ImageThumbnailWitness extends import_abstract
430
456
  };
431
457
 
432
458
  // src/Plugin.ts
433
- var ImageThumbnailPlugin = () => (0, import_payloadset_plugin.createPayloadSetDualPlugin)(
434
- { required: { [import_image_thumbnail_payload_plugin3.ImageThumbnailSchema]: 1 }, schema: import_payload_model.PayloadSetSchema },
435
- {
436
- diviner: async (params) => {
437
- const result = await import_diviner_image_thumbnail.ImageThumbnailDiviner.create(params);
438
- return result;
439
- },
440
- witness: async (params) => {
441
- const result = await ImageThumbnailWitness.create(params);
442
- return result;
443
- }
444
- }
445
- );
459
+ var ImageThumbnailPlugin = /* @__PURE__ */ __name(() => (0, import_payloadset_plugin.createPayloadSetDualPlugin)({
460
+ required: {
461
+ [import_image_thumbnail_payload_plugin3.ImageThumbnailSchema]: 1
462
+ },
463
+ schema: import_payload_model.PayloadSetSchema
464
+ }, {
465
+ diviner: /* @__PURE__ */ __name(async (params) => {
466
+ const result = await import_diviner_image_thumbnail.ImageThumbnailDiviner.create(params);
467
+ return result;
468
+ }, "diviner"),
469
+ witness: /* @__PURE__ */ __name(async (params) => {
470
+ const result = await ImageThumbnailWitness.create(params);
471
+ return result;
472
+ }, "witness")
473
+ }), "ImageThumbnailPlugin");
446
474
 
447
475
  // src/index.ts
448
476
  __reExport(src_exports, require("@xyo-network/diviner-image-thumbnail"), module.exports);