@xyo-network/image-thumbnail-plugin 2.74.4 → 2.75.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.
- package/dist/node/Diviner/Config.d.mts.map +1 -0
- package/dist/node/Diviner/Config.d.ts.map +1 -0
- package/dist/node/Diviner/Config.js +30 -0
- package/dist/node/Diviner/Config.js.map +1 -0
- package/dist/node/Diviner/Config.mjs +6 -0
- package/dist/node/Diviner/Config.mjs.map +1 -0
- package/dist/node/Diviner/Diviner.d.mts.map +1 -0
- package/dist/node/Diviner/Diviner.d.ts.map +1 -0
- package/dist/node/Diviner/Diviner.js +199 -0
- package/dist/node/Diviner/Diviner.js.map +1 -0
- package/dist/node/Diviner/Diviner.mjs +175 -0
- package/dist/node/Diviner/Diviner.mjs.map +1 -0
- package/dist/node/Diviner/Params.d.mts.map +1 -0
- package/dist/node/Diviner/Params.d.ts.map +1 -0
- package/dist/node/Diviner/Params.js +17 -0
- package/dist/node/Diviner/Params.js.map +1 -0
- package/dist/node/Diviner/Params.mjs +1 -0
- package/dist/node/Diviner/Params.mjs.map +1 -0
- package/dist/node/Diviner/index.d.mts.map +1 -0
- package/dist/node/Diviner/index.d.ts.map +1 -0
- package/dist/node/Diviner/index.js +27 -0
- package/dist/node/Diviner/index.js.map +1 -0
- package/dist/node/Diviner/index.mjs +4 -0
- package/dist/node/Diviner/index.mjs.map +1 -0
- package/dist/node/Plugin.d.mts.map +1 -0
- package/dist/node/Plugin.d.ts.map +1 -0
- package/dist/node/Plugin.js +46 -0
- package/dist/node/Plugin.js.map +1 -0
- package/dist/node/Plugin.mjs +22 -0
- package/dist/node/Plugin.mjs.map +1 -0
- package/dist/node/Witness/Config.d.mts.map +1 -0
- package/dist/node/Witness/Config.d.ts.map +1 -0
- package/dist/node/Witness/Config.js +30 -0
- package/dist/node/Witness/Config.js.map +1 -0
- package/dist/node/Witness/Config.mjs +6 -0
- package/dist/node/Witness/Config.mjs.map +1 -0
- package/dist/node/Witness/Params.d.mts.map +1 -0
- package/dist/node/Witness/Params.d.ts.map +1 -0
- package/dist/node/Witness/Params.js +17 -0
- package/dist/node/Witness/Params.js.map +1 -0
- package/dist/node/Witness/Params.mjs +1 -0
- package/dist/node/Witness/Params.mjs.map +1 -0
- package/dist/node/Witness/Witness.d.mts.map +1 -0
- package/dist/node/Witness/Witness.d.ts.map +1 -0
- package/dist/node/Witness/Witness.js +310 -0
- package/dist/node/Witness/Witness.js.map +1 -0
- package/dist/node/Witness/Witness.mjs +276 -0
- package/dist/node/Witness/Witness.mjs.map +1 -0
- package/dist/node/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.d.mts.map +1 -0
- package/dist/node/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.d.ts.map +1 -0
- package/dist/node/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.js +75 -0
- package/dist/node/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.js.map +1 -0
- package/dist/node/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.mjs +41 -0
- package/dist/node/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.mjs.map +1 -0
- package/dist/node/Witness/ffmpeg/fluent/index.d.mts.map +1 -0
- package/dist/node/Witness/ffmpeg/fluent/index.d.ts.map +1 -0
- package/dist/node/Witness/ffmpeg/fluent/index.js +23 -0
- package/dist/node/Witness/ffmpeg/fluent/index.js.map +1 -0
- package/dist/node/Witness/ffmpeg/fluent/index.mjs +2 -0
- package/dist/node/Witness/ffmpeg/fluent/index.mjs.map +1 -0
- package/dist/node/Witness/ffmpeg/index.d.mts.map +1 -0
- package/dist/node/Witness/ffmpeg/index.d.ts.map +1 -0
- package/dist/node/Witness/ffmpeg/index.js +25 -0
- package/dist/node/Witness/ffmpeg/index.js.map +1 -0
- package/dist/node/Witness/ffmpeg/index.mjs +3 -0
- package/dist/node/Witness/ffmpeg/index.mjs.map +1 -0
- package/dist/node/Witness/ffmpeg/spawn/executeFfmpeg.d.mts.map +1 -0
- package/dist/node/Witness/ffmpeg/spawn/executeFfmpeg.d.ts.map +1 -0
- package/dist/node/Witness/ffmpeg/spawn/executeFfmpeg.js +46 -0
- package/dist/node/Witness/ffmpeg/spawn/executeFfmpeg.js.map +1 -0
- package/dist/node/Witness/ffmpeg/spawn/executeFfmpeg.mjs +22 -0
- package/dist/node/Witness/ffmpeg/spawn/executeFfmpeg.mjs.map +1 -0
- package/dist/node/Witness/ffmpeg/spawn/getVideoFrameAsImage.d.mts.map +1 -0
- package/dist/node/Witness/ffmpeg/spawn/getVideoFrameAsImage.d.ts.map +1 -0
- package/dist/node/Witness/ffmpeg/spawn/getVideoFrameAsImage.js +33 -0
- package/dist/node/Witness/ffmpeg/spawn/getVideoFrameAsImage.js.map +1 -0
- package/dist/node/Witness/ffmpeg/spawn/getVideoFrameAsImage.mjs +9 -0
- package/dist/node/Witness/ffmpeg/spawn/getVideoFrameAsImage.mjs.map +1 -0
- package/dist/node/Witness/ffmpeg/spawn/index.d.mts.map +1 -0
- package/dist/node/Witness/ffmpeg/spawn/index.d.ts.map +1 -0
- package/dist/node/Witness/ffmpeg/spawn/index.js +25 -0
- package/dist/node/Witness/ffmpeg/spawn/index.js.map +1 -0
- package/dist/node/Witness/ffmpeg/spawn/index.mjs +3 -0
- package/dist/node/Witness/ffmpeg/spawn/index.mjs.map +1 -0
- package/dist/node/Witness/index.d.mts.map +1 -0
- package/dist/node/Witness/index.d.ts.map +1 -0
- package/dist/node/Witness/index.js +27 -0
- package/dist/node/Witness/index.js.map +1 -0
- package/dist/node/Witness/index.mjs +4 -0
- package/dist/node/Witness/index.mjs.map +1 -0
- package/dist/node/index.d.mts.map +1 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +36 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/index.mjs +9 -0
- package/dist/node/index.mjs.map +1 -0
- package/package.json +39 -38
- package/dist/Diviner/Config.d.mts.map +0 -1
- package/dist/Diviner/Config.d.ts.map +0 -1
- package/dist/Diviner/Diviner.d.mts.map +0 -1
- package/dist/Diviner/Diviner.d.ts.map +0 -1
- package/dist/Diviner/Params.d.mts.map +0 -1
- package/dist/Diviner/Params.d.ts.map +0 -1
- package/dist/Diviner/index.d.mts.map +0 -1
- package/dist/Diviner/index.d.ts.map +0 -1
- package/dist/Plugin.d.mts.map +0 -1
- package/dist/Plugin.d.ts.map +0 -1
- package/dist/Witness/Config.d.mts.map +0 -1
- package/dist/Witness/Config.d.ts.map +0 -1
- package/dist/Witness/Params.d.mts.map +0 -1
- package/dist/Witness/Params.d.ts.map +0 -1
- package/dist/Witness/Witness.d.mts.map +0 -1
- package/dist/Witness/Witness.d.ts.map +0 -1
- package/dist/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.d.mts.map +0 -1
- package/dist/Witness/ffmpeg/fluent/getVideoFrameAsImageFluent.d.ts.map +0 -1
- package/dist/Witness/ffmpeg/fluent/index.d.mts.map +0 -1
- package/dist/Witness/ffmpeg/fluent/index.d.ts.map +0 -1
- package/dist/Witness/ffmpeg/index.d.mts.map +0 -1
- package/dist/Witness/ffmpeg/index.d.ts.map +0 -1
- package/dist/Witness/ffmpeg/spawn/executeFfmpeg.d.mts.map +0 -1
- package/dist/Witness/ffmpeg/spawn/executeFfmpeg.d.ts.map +0 -1
- package/dist/Witness/ffmpeg/spawn/getVideoFrameAsImage.d.mts.map +0 -1
- package/dist/Witness/ffmpeg/spawn/getVideoFrameAsImage.d.ts.map +0 -1
- package/dist/Witness/ffmpeg/spawn/index.d.mts.map +0 -1
- package/dist/Witness/ffmpeg/spawn/index.d.ts.map +0 -1
- package/dist/Witness/index.d.mts.map +0 -1
- package/dist/Witness/index.d.ts.map +0 -1
- package/dist/docs.json +0 -50260
- package/dist/index.d.mts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -565
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -524
- package/dist/index.mjs.map +0 -1
- /package/dist/{Diviner → node/Diviner}/Config.d.mts +0 -0
- /package/dist/{Diviner → node/Diviner}/Config.d.ts +0 -0
- /package/dist/{Diviner → node/Diviner}/Diviner.d.mts +0 -0
- /package/dist/{Diviner → node/Diviner}/Diviner.d.ts +0 -0
- /package/dist/{Diviner → node/Diviner}/Params.d.mts +0 -0
- /package/dist/{Diviner → node/Diviner}/Params.d.ts +0 -0
- /package/dist/{Diviner → node/Diviner}/index.d.mts +0 -0
- /package/dist/{Diviner → node/Diviner}/index.d.ts +0 -0
- /package/dist/{Plugin.d.mts → node/Plugin.d.mts} +0 -0
- /package/dist/{Plugin.d.ts → node/Plugin.d.ts} +0 -0
- /package/dist/{Witness → node/Witness}/Config.d.mts +0 -0
- /package/dist/{Witness → node/Witness}/Config.d.ts +0 -0
- /package/dist/{Witness → node/Witness}/Params.d.mts +0 -0
- /package/dist/{Witness → node/Witness}/Params.d.ts +0 -0
- /package/dist/{Witness → node/Witness}/Witness.d.mts +0 -0
- /package/dist/{Witness → node/Witness}/Witness.d.ts +0 -0
- /package/dist/{Witness → node/Witness}/ffmpeg/fluent/getVideoFrameAsImageFluent.d.mts +0 -0
- /package/dist/{Witness → node/Witness}/ffmpeg/fluent/getVideoFrameAsImageFluent.d.ts +0 -0
- /package/dist/{Witness → node/Witness}/ffmpeg/fluent/index.d.mts +0 -0
- /package/dist/{Witness → node/Witness}/ffmpeg/fluent/index.d.ts +0 -0
- /package/dist/{Witness → node/Witness}/ffmpeg/index.d.mts +0 -0
- /package/dist/{Witness → node/Witness}/ffmpeg/index.d.ts +0 -0
- /package/dist/{Witness → node/Witness}/ffmpeg/spawn/executeFfmpeg.d.mts +0 -0
- /package/dist/{Witness → node/Witness}/ffmpeg/spawn/executeFfmpeg.d.ts +0 -0
- /package/dist/{Witness → node/Witness}/ffmpeg/spawn/getVideoFrameAsImage.d.mts +0 -0
- /package/dist/{Witness → node/Witness}/ffmpeg/spawn/getVideoFrameAsImage.d.ts +0 -0
- /package/dist/{Witness → node/Witness}/ffmpeg/spawn/index.d.mts +0 -0
- /package/dist/{Witness → node/Witness}/ffmpeg/spawn/index.d.ts +0 -0
- /package/dist/{Witness → node/Witness}/index.d.mts +0 -0
- /package/dist/{Witness → node/Witness}/index.d.ts +0 -0
- /package/dist/{index.d.mts → node/index.d.mts} +0 -0
- /package/dist/{index.d.ts → node/index.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../../src/Diviner/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAG1D,eAAO,MAAM,iCAAiC,8CAAoD,CAAA;AAClG,MAAM,MAAM,iCAAiC,GAAG,OAAO,iCAAiC,CAAA;AAExF,MAAM,MAAM,2BAA2B,GAAG,aAAa,CAAC;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,iCAAiC,CAAA;CAC1C,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../../src/Diviner/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAG1D,eAAO,MAAM,iCAAiC,8CAAoD,CAAA;AAClG,MAAM,MAAM,iCAAiC,GAAG,OAAO,iCAAiC,CAAA;AAExF,MAAM,MAAM,2BAA2B,GAAG,aAAa,CAAC;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,iCAAiC,CAAA;CAC1C,CAAC,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Config_exports = {};
|
|
20
|
+
__export(Config_exports, {
|
|
21
|
+
ImageThumbnailDivinerConfigSchema: () => ImageThumbnailDivinerConfigSchema
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Config_exports);
|
|
24
|
+
var import_image_thumbnail_payload_plugin = require("@xyo-network/image-thumbnail-payload-plugin");
|
|
25
|
+
const ImageThumbnailDivinerConfigSchema = `${import_image_thumbnail_payload_plugin.ImageThumbnailSchema}.diviner.config`;
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
ImageThumbnailDivinerConfigSchema
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=Config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Diviner/Config.ts"],"sourcesContent":["import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { ImageThumbnailSchema } from '@xyo-network/image-thumbnail-payload-plugin'\n\nexport const ImageThumbnailDivinerConfigSchema = `${ImageThumbnailSchema}.diviner.config` as const\nexport type ImageThumbnailDivinerConfigSchema = typeof ImageThumbnailDivinerConfigSchema\n\nexport type ImageThumbnailDivinerConfig = DivinerConfig<{\n archivist?: string\n payloadDiviner?: string\n payloadDivinerLimit?: number\n pollFrequency?: number\n schema: ImageThumbnailDivinerConfigSchema\n}>\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,4CAAqC;AAE9B,MAAM,oCAAoC,GAAG,0DAAoB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Diviner/Config.ts"],"sourcesContent":["import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { ImageThumbnailSchema } from '@xyo-network/image-thumbnail-payload-plugin'\n\nexport const ImageThumbnailDivinerConfigSchema = `${ImageThumbnailSchema}.diviner.config` as const\nexport type ImageThumbnailDivinerConfigSchema = typeof ImageThumbnailDivinerConfigSchema\n\nexport type ImageThumbnailDivinerConfig = DivinerConfig<{\n archivist?: string\n payloadDiviner?: string\n payloadDivinerLimit?: number\n pollFrequency?: number\n schema: ImageThumbnailDivinerConfigSchema\n}>\n"],"mappings":"AACA,SAAS,4BAA4B;AAE9B,MAAM,oCAAoC,GAAG,oBAAoB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/Diviner/Diviner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAuB,MAAM,8BAA8B,CAAA;AAErF,OAAO,EAA0C,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAEpG,OAAO,EAAE,cAAc,EAAwB,MAAM,6CAA6C,CAAA;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAG5D,OAAO,EAAE,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E,MAAM,UAAU,CAAA;AAEtD,qBAAa,qBAAqB,CAAC,OAAO,SAAS,2BAA2B,GAAG,2BAA2B,CAAE,SAAQ,eAAe,CAAC,OAAO,CAAC;IAC5I,OAAgB,aAAa,kFAA2D;IAExF,OAAO,CAAC,kBAAkB,CAAwC;IAClE,OAAO,CAAC,6CAA6C,CAA2B;IAChF,OAAO,CAAC,IAAI,CAAoC;IAChD,OAAO,CAAC,uBAAuB,CAAsC;IACrE,OAAO,CAAC,OAAO,CAAC,CAAkC;IAMlD,IAAI,SAAS,mJAEZ;IAED,IAAI,cAAc,uBAEjB;IAED,IAAI,mBAAmB,WAEtB;IAED,IAAI,aAAa,uBAEhB;IAGK,oBAAoB,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAelD,yBAAyB,IAAI,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;cAkB9C,aAAa,CAAC,QAAQ,GAAE,UAAU,EAAO,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAU9F,SAAS,CAAC,qCAAqC;cAc/B,OAAO;cAQP,cAAc;cAiBd,yBAAyB;cAgChB,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;YAQvE,qBAAqB;YAUrB,UAAU;YAcV,IAAI;CAcnB"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Diviner_exports = {};
|
|
20
|
+
__export(Diviner_exports, {
|
|
21
|
+
ImageThumbnailDiviner: () => ImageThumbnailDiviner
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Diviner_exports);
|
|
24
|
+
var import_assert = require("@xylabs/assert");
|
|
25
|
+
var import_delay = require("@xylabs/delay");
|
|
26
|
+
var import_lodash = require("@xylabs/lodash");
|
|
27
|
+
var import_abstract_diviner = require("@xyo-network/abstract-diviner");
|
|
28
|
+
var import_archivist_model = require("@xyo-network/archivist-model");
|
|
29
|
+
var import_core = require("@xyo-network/core");
|
|
30
|
+
var import_diviner_model = require("@xyo-network/diviner-model");
|
|
31
|
+
var import_diviner_payload_model = require("@xyo-network/diviner-payload-model");
|
|
32
|
+
var import_image_thumbnail_payload_plugin = require("@xyo-network/image-thumbnail-payload-plugin");
|
|
33
|
+
var import_Config = require("./Config");
|
|
34
|
+
class ImageThumbnailDiviner extends import_abstract_diviner.AbstractDiviner {
|
|
35
|
+
static configSchemas = [import_Config.ImageThumbnailDivinerConfigSchema, import_diviner_model.DivinerConfigSchema];
|
|
36
|
+
_archivistInstance;
|
|
37
|
+
_initializeArchivistConnectionIfNeededPromise;
|
|
38
|
+
_map;
|
|
39
|
+
_payloadDivinerInstance;
|
|
40
|
+
_pollId;
|
|
41
|
+
// static override get configSchema() {
|
|
42
|
+
// return ImageThumbnailDivinerConfigSchema
|
|
43
|
+
// }
|
|
44
|
+
get archivist() {
|
|
45
|
+
return this.config.archivist;
|
|
46
|
+
}
|
|
47
|
+
get payloadDiviner() {
|
|
48
|
+
return this.config.payloadDiviner;
|
|
49
|
+
}
|
|
50
|
+
get payloadDivinerLimit() {
|
|
51
|
+
return this.config.payloadDivinerLimit ?? 1e4;
|
|
52
|
+
}
|
|
53
|
+
get pollFrequency() {
|
|
54
|
+
return this.config.pollFrequency;
|
|
55
|
+
}
|
|
56
|
+
//using promise as mutex
|
|
57
|
+
async getArchivistInstance() {
|
|
58
|
+
if (this._archivistInstance && !await this._archivistInstance) {
|
|
59
|
+
this._archivistInstance = void 0;
|
|
60
|
+
}
|
|
61
|
+
this._archivistInstance = this._archivistInstance ?? (async () => {
|
|
62
|
+
const module2 = this.archivist ? await this.resolve(this.archivist) : void 0;
|
|
63
|
+
return (0, import_archivist_model.asArchivistInstance)(module2, "Provided archivist address did not resolve to an Archivist");
|
|
64
|
+
})();
|
|
65
|
+
return this._archivistInstance;
|
|
66
|
+
}
|
|
67
|
+
//using promise as mutex
|
|
68
|
+
async getPayloadDivinerInstance() {
|
|
69
|
+
const payloadDivinerAddress = this.payloadDiviner;
|
|
70
|
+
if (payloadDivinerAddress) {
|
|
71
|
+
if (this._payloadDivinerInstance && !await this._payloadDivinerInstance) {
|
|
72
|
+
this._payloadDivinerInstance = void 0;
|
|
73
|
+
}
|
|
74
|
+
this._payloadDivinerInstance = this._payloadDivinerInstance ?? (async () => {
|
|
75
|
+
const module2 = await this.resolve(payloadDivinerAddress);
|
|
76
|
+
return (0, import_diviner_model.asDivinerInstance)(module2, "Provided payload diviner address did not resolve to a Diviner");
|
|
77
|
+
})();
|
|
78
|
+
return this._payloadDivinerInstance;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async divineHandler(payloads = []) {
|
|
82
|
+
await this.initializeArchivistConnectionIfNeeded();
|
|
83
|
+
const urls = payloads.map((urlPayload) => urlPayload.url);
|
|
84
|
+
const map = await this.getSafeMap();
|
|
85
|
+
const archivist = await this.getArchivistInstance();
|
|
86
|
+
const hashes = (0, import_lodash.compact)(urls.map((url) => map?.[url]));
|
|
87
|
+
return (await archivist.get(hashes)).filter((payload) => payload.schema === import_image_thumbnail_payload_plugin.ImageThumbnailSchema);
|
|
88
|
+
}
|
|
89
|
+
//using promise as mutex
|
|
90
|
+
initializeArchivistConnectionIfNeeded() {
|
|
91
|
+
this._initializeArchivistConnectionIfNeededPromise = this._initializeArchivistConnectionIfNeededPromise ?? (async () => {
|
|
92
|
+
if (!this._map) {
|
|
93
|
+
await this.attachArchivistEvents();
|
|
94
|
+
console.log("initializeArchivistConnectionIfNeeded: attachArchivistEvents done");
|
|
95
|
+
await this.poll();
|
|
96
|
+
console.log("initializeArchivistConnectionIfNeeded: poll done");
|
|
97
|
+
}
|
|
98
|
+
})();
|
|
99
|
+
return this._initializeArchivistConnectionIfNeededPromise;
|
|
100
|
+
}
|
|
101
|
+
async loadMap() {
|
|
102
|
+
if (this.payloadDiviner) {
|
|
103
|
+
return await this.loadMapWithPayloadDiviner();
|
|
104
|
+
} else {
|
|
105
|
+
return await this.loadMapWithAll();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async loadMapWithAll() {
|
|
109
|
+
if (await this.started()) {
|
|
110
|
+
const archivist = await this.getArchivistInstance();
|
|
111
|
+
(0, import_assert.assertEx)(archivist.all, "Archivist does not support 'all'");
|
|
112
|
+
const allPayloads = await archivist.all?.() ?? [];
|
|
113
|
+
const imagePayloadPairs = await Promise.all(
|
|
114
|
+
allPayloads.filter((payload) => payload.schema === import_image_thumbnail_payload_plugin.ImageThumbnailSchema).map(async (payload) => [await import_core.PayloadHasher.hashAsync(payload), payload])
|
|
115
|
+
);
|
|
116
|
+
this._map = imagePayloadPairs.reduce((prev, [hash, payload]) => {
|
|
117
|
+
prev[payload.sourceUrl] = hash;
|
|
118
|
+
return prev;
|
|
119
|
+
}, {});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async loadMapWithPayloadDiviner() {
|
|
123
|
+
console.log("loadMapWithPayloadDiviner: started");
|
|
124
|
+
if (await this.started()) {
|
|
125
|
+
const diviner = await this.getPayloadDivinerInstance();
|
|
126
|
+
let offset = void 0;
|
|
127
|
+
let moreAvailable = true;
|
|
128
|
+
if (diviner) {
|
|
129
|
+
const newMap = {};
|
|
130
|
+
while (moreAvailable) {
|
|
131
|
+
const payloadDivinerQuery = {
|
|
132
|
+
limit: this.payloadDivinerLimit,
|
|
133
|
+
offset,
|
|
134
|
+
schema: import_diviner_payload_model.PayloadDivinerQuerySchema,
|
|
135
|
+
schemas: [import_image_thumbnail_payload_plugin.ImageThumbnailSchema]
|
|
136
|
+
};
|
|
137
|
+
const payloads = await diviner.divine([payloadDivinerQuery]);
|
|
138
|
+
offset = (offset ?? 0) + payloads.length;
|
|
139
|
+
moreAvailable = payloads.length > 0;
|
|
140
|
+
console.log(`loadMapWithPayloadDiviner.offset: ${offset}`);
|
|
141
|
+
console.log(`loadMapWithPayloadDiviner.moreAvailable: ${moreAvailable}`);
|
|
142
|
+
const imagePayloadPairs = await Promise.all(
|
|
143
|
+
payloads.filter((payload) => payload.schema === import_image_thumbnail_payload_plugin.ImageThumbnailSchema).map(async (payload) => [await import_core.PayloadHasher.hashAsync(payload), payload])
|
|
144
|
+
);
|
|
145
|
+
imagePayloadPairs.forEach(([hash, payload]) => newMap[payload.sourceUrl] = hash);
|
|
146
|
+
}
|
|
147
|
+
this._map = newMap;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
async stopHandler(_timeout) {
|
|
152
|
+
if (this._pollId) {
|
|
153
|
+
clearTimeout(this._pollId);
|
|
154
|
+
this._pollId = void 0;
|
|
155
|
+
}
|
|
156
|
+
return await super.stopHandler();
|
|
157
|
+
}
|
|
158
|
+
async attachArchivistEvents() {
|
|
159
|
+
const archivist = await this.getArchivistInstance();
|
|
160
|
+
const mapPromise = this.getSafeMap();
|
|
161
|
+
archivist.on("inserted", async ({ payloads }) => {
|
|
162
|
+
const map = await mapPromise;
|
|
163
|
+
const thumbnails = (0, import_lodash.compact)(payloads.filter((payload) => payload.schema === import_image_thumbnail_payload_plugin.ImageThumbnailSchema));
|
|
164
|
+
await Promise.all(thumbnails.map(async (payload) => map[payload.sourceUrl] = await import_core.PayloadHasher.hashAsync(payload)));
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
async getSafeMap() {
|
|
168
|
+
let mapRetry = 100;
|
|
169
|
+
let map = this._map;
|
|
170
|
+
while (!map) {
|
|
171
|
+
await (0, import_delay.delay)(100);
|
|
172
|
+
mapRetry = mapRetry - 1;
|
|
173
|
+
if (mapRetry === 0) {
|
|
174
|
+
throw Error("Map Not Loaded");
|
|
175
|
+
}
|
|
176
|
+
map = this._map;
|
|
177
|
+
}
|
|
178
|
+
return map;
|
|
179
|
+
}
|
|
180
|
+
async poll() {
|
|
181
|
+
if (await this.started()) {
|
|
182
|
+
const pollFrequency = this.pollFrequency;
|
|
183
|
+
if (pollFrequency) {
|
|
184
|
+
this._pollId = setTimeout(async () => {
|
|
185
|
+
this._pollId = void 0;
|
|
186
|
+
await this.loadMap();
|
|
187
|
+
await this.poll();
|
|
188
|
+
}, pollFrequency);
|
|
189
|
+
} else {
|
|
190
|
+
await this.loadMap();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
196
|
+
0 && (module.exports = {
|
|
197
|
+
ImageThumbnailDiviner
|
|
198
|
+
});
|
|
199
|
+
//# sourceMappingURL=Diviner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Diviner/Diviner.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { delay } from '@xylabs/delay'\nimport { compact } from '@xylabs/lodash'\nimport { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { ArchivistInstance, asArchivistInstance } from '@xyo-network/archivist-model'\nimport { PayloadHasher } from '@xyo-network/core'\nimport { asDivinerInstance, DivinerConfigSchema, DivinerInstance } from '@xyo-network/diviner-model'\nimport { PayloadDivinerQueryPayload, PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'\nimport { ImageThumbnail, ImageThumbnailSchema } from '@xyo-network/image-thumbnail-payload-plugin'\nimport { UrlPayload } from '@xyo-network/url-payload-plugin'\n\nimport { ImageThumbnailDivinerConfigSchema } from './Config'\nimport { ImageThumbnailDivinerParams } from './Params'\n\nexport class ImageThumbnailDiviner<TParams extends ImageThumbnailDivinerParams = ImageThumbnailDivinerParams> extends AbstractDiviner<TParams> {\n static override configSchemas = [ImageThumbnailDivinerConfigSchema, DivinerConfigSchema]\n\n private _archivistInstance: Promise<ArchivistInstance> | undefined\n private _initializeArchivistConnectionIfNeededPromise: Promise<void> | undefined\n private _map: Record<string, string> | undefined\n private _payloadDivinerInstance: Promise<DivinerInstance> | undefined\n private _pollId?: string | number | NodeJS.Timeout\n\n // static override get configSchema() {\n // return ImageThumbnailDivinerConfigSchema\n // }\n\n get archivist() {\n return this.config.archivist\n }\n\n get payloadDiviner() {\n return this.config.payloadDiviner\n }\n\n get payloadDivinerLimit() {\n return this.config.payloadDivinerLimit ?? 10000\n }\n\n get pollFrequency() {\n return this.config.pollFrequency\n }\n\n //using promise as mutex\n async getArchivistInstance(): Promise<ArchivistInstance> {\n //if previously checked, but not found, clear promise\n if (this._archivistInstance && !(await this._archivistInstance)) {\n this._archivistInstance = undefined\n }\n this._archivistInstance =\n this._archivistInstance ??\n (async () => {\n const module = this.archivist ? await this.resolve(this.archivist) : undefined\n return asArchivistInstance(module, 'Provided archivist address did not resolve to an Archivist')\n })()\n return this._archivistInstance\n }\n\n //using promise as mutex\n async getPayloadDivinerInstance(): Promise<DivinerInstance | undefined> {\n const payloadDivinerAddress = this.payloadDiviner\n if (payloadDivinerAddress) {\n //if previously checked, but not found, clear promise\n if (this._payloadDivinerInstance && !(await this._payloadDivinerInstance)) {\n this._payloadDivinerInstance = undefined\n }\n this._payloadDivinerInstance =\n this._payloadDivinerInstance ??\n (async () => {\n const module = await this.resolve(payloadDivinerAddress)\n return asDivinerInstance(module, 'Provided payload diviner address did not resolve to a Diviner')\n })()\n\n return this._payloadDivinerInstance\n }\n }\n\n protected override async divineHandler(payloads: UrlPayload[] = []): Promise<ImageThumbnail[]> {\n await this.initializeArchivistConnectionIfNeeded()\n const urls = payloads.map((urlPayload) => urlPayload.url)\n const map = await this.getSafeMap()\n const archivist = await this.getArchivistInstance()\n const hashes = compact(urls.map((url) => map?.[url]))\n return (await archivist.get(hashes)).filter((payload): payload is ImageThumbnail => payload.schema === ImageThumbnailSchema)\n }\n\n //using promise as mutex\n protected initializeArchivistConnectionIfNeeded() {\n this._initializeArchivistConnectionIfNeededPromise =\n this._initializeArchivistConnectionIfNeededPromise ??\n (async () => {\n if (!this._map) {\n await this.attachArchivistEvents()\n console.log('initializeArchivistConnectionIfNeeded: attachArchivistEvents done')\n await this.poll()\n console.log('initializeArchivistConnectionIfNeeded: poll done')\n }\n })()\n return this._initializeArchivistConnectionIfNeededPromise\n }\n\n protected async loadMap() {\n if (this.payloadDiviner) {\n return await this.loadMapWithPayloadDiviner()\n } else {\n return await this.loadMapWithAll()\n }\n }\n\n protected async loadMapWithAll() {\n if (await this.started()) {\n const archivist = await this.getArchivistInstance()\n assertEx(archivist.all, \"Archivist does not support 'all'\")\n const allPayloads = (await archivist.all?.()) ?? []\n const imagePayloadPairs = await Promise.all(\n allPayloads\n .filter((payload): payload is ImageThumbnail => payload.schema === ImageThumbnailSchema)\n .map<Promise<[string, ImageThumbnail]>>(async (payload) => [await PayloadHasher.hashAsync(payload), payload]),\n )\n this._map = imagePayloadPairs.reduce<Record<string, string>>((prev, [hash, payload]) => {\n prev[payload.sourceUrl] = hash\n return prev\n }, {})\n }\n }\n\n protected async loadMapWithPayloadDiviner() {\n console.log('loadMapWithPayloadDiviner: started')\n if (await this.started()) {\n const diviner = await this.getPayloadDivinerInstance()\n let offset: number | undefined = undefined\n let moreAvailable = true\n if (diviner) {\n const newMap: Record<string, string> = {}\n while (moreAvailable) {\n const payloadDivinerQuery: PayloadDivinerQueryPayload = {\n limit: this.payloadDivinerLimit,\n offset,\n schema: PayloadDivinerQuerySchema,\n schemas: [ImageThumbnailSchema],\n }\n const payloads = await diviner.divine([payloadDivinerQuery])\n offset = (offset ?? 0) + payloads.length\n moreAvailable = payloads.length > 0\n console.log(`loadMapWithPayloadDiviner.offset: ${offset}`)\n console.log(`loadMapWithPayloadDiviner.moreAvailable: ${moreAvailable}`)\n const imagePayloadPairs = await Promise.all(\n payloads\n .filter((payload): payload is ImageThumbnail => payload.schema === ImageThumbnailSchema)\n .map<Promise<[string, ImageThumbnail]>>(async (payload) => [await PayloadHasher.hashAsync(payload), payload]),\n )\n imagePayloadPairs.forEach(([hash, payload]) => (newMap[payload.sourceUrl] = hash))\n }\n this._map = newMap\n }\n }\n }\n\n protected override async stopHandler(_timeout?: number | undefined): Promise<boolean> {\n if (this._pollId) {\n clearTimeout(this._pollId)\n this._pollId = undefined\n }\n return await super.stopHandler()\n }\n\n private async attachArchivistEvents() {\n const archivist = await this.getArchivistInstance()\n const mapPromise = this.getSafeMap()\n archivist.on('inserted', async ({ payloads }) => {\n const map = await mapPromise\n const thumbnails = compact(payloads.filter((payload): payload is ImageThumbnail => payload.schema === ImageThumbnailSchema))\n await Promise.all(thumbnails.map(async (payload) => (map[payload.sourceUrl] = await PayloadHasher.hashAsync(payload))))\n })\n }\n\n private async getSafeMap() {\n let mapRetry = 100 //10 seconds max\n let map = this._map\n while (!map) {\n await delay(100)\n mapRetry = mapRetry - 1\n if (mapRetry === 0) {\n throw Error('Map Not Loaded')\n }\n map = this._map\n }\n return map\n }\n\n private async poll() {\n if (await this.started()) {\n const pollFrequency = this.pollFrequency\n if (pollFrequency) {\n this._pollId = setTimeout(async () => {\n this._pollId = undefined\n await this.loadMap()\n await this.poll()\n }, pollFrequency)\n } else {\n await this.loadMap()\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyB;AACzB,mBA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AM;AAClB,YAAM,iBAAa,uBAAQ,SAAS,OAAO,CAAC,YAAuC,QAAQ,WAAW,0DAAoB,CAAC;AAC3H,YAAM,QAAQ,IAAI,WAAW,IAAI,OAAO,YAAa,IAAI,QAAQ,SAAS,IAAI,MAAM,0BAAc,UAAU,OAAO,CAAE,CAAC;AAAA,IACxH,CAAC;AAAA,EACH;AAAA,EAEA,MAAc,aAAa;AACzB,QAAI,WAAW;AACf,QAAI,MAAM,KAAK;AACf,WAAO,CAAC,KAAK;AACX,gBAAM,oBAAM,GAAG;AACf,iBAAW,WAAW;AACtB,UAAI,aAAa,GAAG;AAClB,cAAM,MAAM,gBAAgB;AAAA,MAC9B;AACA,YAAM,KAAK;AAAA,IACb;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,OAAO;AACnB,QAAI,MAAM,KAAK,QAAQ,GAAG;AACxB,YAAM,gBAAgB,KAAK;AAC3B,UAAI,eAAe;AACjB,aAAK,UAAU,WAAW,YAAY;AACpC,eAAK,UAAU;AACf,gBAAM,KAAK,QAAQ;AACnB,gBAAM,KAAK,KAAK;AAAA,QAClB,GAAG,aAAa;AAAA,MAClB,OAAO;AACL,cAAM,KAAK,QAAQ;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AACF;","names":["module"]}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { assertEx } from "@xylabs/assert";
|
|
2
|
+
import { delay } from "@xylabs/delay";
|
|
3
|
+
import { compact } from "@xylabs/lodash";
|
|
4
|
+
import { AbstractDiviner } from "@xyo-network/abstract-diviner";
|
|
5
|
+
import { asArchivistInstance } from "@xyo-network/archivist-model";
|
|
6
|
+
import { PayloadHasher } from "@xyo-network/core";
|
|
7
|
+
import { asDivinerInstance, DivinerConfigSchema } from "@xyo-network/diviner-model";
|
|
8
|
+
import { PayloadDivinerQuerySchema } from "@xyo-network/diviner-payload-model";
|
|
9
|
+
import { ImageThumbnailSchema } from "@xyo-network/image-thumbnail-payload-plugin";
|
|
10
|
+
import { ImageThumbnailDivinerConfigSchema } from "./Config";
|
|
11
|
+
class ImageThumbnailDiviner extends AbstractDiviner {
|
|
12
|
+
static configSchemas = [ImageThumbnailDivinerConfigSchema, DivinerConfigSchema];
|
|
13
|
+
_archivistInstance;
|
|
14
|
+
_initializeArchivistConnectionIfNeededPromise;
|
|
15
|
+
_map;
|
|
16
|
+
_payloadDivinerInstance;
|
|
17
|
+
_pollId;
|
|
18
|
+
// static override get configSchema() {
|
|
19
|
+
// return ImageThumbnailDivinerConfigSchema
|
|
20
|
+
// }
|
|
21
|
+
get archivist() {
|
|
22
|
+
return this.config.archivist;
|
|
23
|
+
}
|
|
24
|
+
get payloadDiviner() {
|
|
25
|
+
return this.config.payloadDiviner;
|
|
26
|
+
}
|
|
27
|
+
get payloadDivinerLimit() {
|
|
28
|
+
return this.config.payloadDivinerLimit ?? 1e4;
|
|
29
|
+
}
|
|
30
|
+
get pollFrequency() {
|
|
31
|
+
return this.config.pollFrequency;
|
|
32
|
+
}
|
|
33
|
+
//using promise as mutex
|
|
34
|
+
async getArchivistInstance() {
|
|
35
|
+
if (this._archivistInstance && !await this._archivistInstance) {
|
|
36
|
+
this._archivistInstance = void 0;
|
|
37
|
+
}
|
|
38
|
+
this._archivistInstance = this._archivistInstance ?? (async () => {
|
|
39
|
+
const module = this.archivist ? await this.resolve(this.archivist) : void 0;
|
|
40
|
+
return asArchivistInstance(module, "Provided archivist address did not resolve to an Archivist");
|
|
41
|
+
})();
|
|
42
|
+
return this._archivistInstance;
|
|
43
|
+
}
|
|
44
|
+
//using promise as mutex
|
|
45
|
+
async getPayloadDivinerInstance() {
|
|
46
|
+
const payloadDivinerAddress = this.payloadDiviner;
|
|
47
|
+
if (payloadDivinerAddress) {
|
|
48
|
+
if (this._payloadDivinerInstance && !await this._payloadDivinerInstance) {
|
|
49
|
+
this._payloadDivinerInstance = void 0;
|
|
50
|
+
}
|
|
51
|
+
this._payloadDivinerInstance = this._payloadDivinerInstance ?? (async () => {
|
|
52
|
+
const module = await this.resolve(payloadDivinerAddress);
|
|
53
|
+
return asDivinerInstance(module, "Provided payload diviner address did not resolve to a Diviner");
|
|
54
|
+
})();
|
|
55
|
+
return this._payloadDivinerInstance;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async divineHandler(payloads = []) {
|
|
59
|
+
await this.initializeArchivistConnectionIfNeeded();
|
|
60
|
+
const urls = payloads.map((urlPayload) => urlPayload.url);
|
|
61
|
+
const map = await this.getSafeMap();
|
|
62
|
+
const archivist = await this.getArchivistInstance();
|
|
63
|
+
const hashes = compact(urls.map((url) => map?.[url]));
|
|
64
|
+
return (await archivist.get(hashes)).filter((payload) => payload.schema === ImageThumbnailSchema);
|
|
65
|
+
}
|
|
66
|
+
//using promise as mutex
|
|
67
|
+
initializeArchivistConnectionIfNeeded() {
|
|
68
|
+
this._initializeArchivistConnectionIfNeededPromise = this._initializeArchivistConnectionIfNeededPromise ?? (async () => {
|
|
69
|
+
if (!this._map) {
|
|
70
|
+
await this.attachArchivistEvents();
|
|
71
|
+
console.log("initializeArchivistConnectionIfNeeded: attachArchivistEvents done");
|
|
72
|
+
await this.poll();
|
|
73
|
+
console.log("initializeArchivistConnectionIfNeeded: poll done");
|
|
74
|
+
}
|
|
75
|
+
})();
|
|
76
|
+
return this._initializeArchivistConnectionIfNeededPromise;
|
|
77
|
+
}
|
|
78
|
+
async loadMap() {
|
|
79
|
+
if (this.payloadDiviner) {
|
|
80
|
+
return await this.loadMapWithPayloadDiviner();
|
|
81
|
+
} else {
|
|
82
|
+
return await this.loadMapWithAll();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async loadMapWithAll() {
|
|
86
|
+
if (await this.started()) {
|
|
87
|
+
const archivist = await this.getArchivistInstance();
|
|
88
|
+
assertEx(archivist.all, "Archivist does not support 'all'");
|
|
89
|
+
const allPayloads = await archivist.all?.() ?? [];
|
|
90
|
+
const imagePayloadPairs = await Promise.all(
|
|
91
|
+
allPayloads.filter((payload) => payload.schema === ImageThumbnailSchema).map(async (payload) => [await PayloadHasher.hashAsync(payload), payload])
|
|
92
|
+
);
|
|
93
|
+
this._map = imagePayloadPairs.reduce((prev, [hash, payload]) => {
|
|
94
|
+
prev[payload.sourceUrl] = hash;
|
|
95
|
+
return prev;
|
|
96
|
+
}, {});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async loadMapWithPayloadDiviner() {
|
|
100
|
+
console.log("loadMapWithPayloadDiviner: started");
|
|
101
|
+
if (await this.started()) {
|
|
102
|
+
const diviner = await this.getPayloadDivinerInstance();
|
|
103
|
+
let offset = void 0;
|
|
104
|
+
let moreAvailable = true;
|
|
105
|
+
if (diviner) {
|
|
106
|
+
const newMap = {};
|
|
107
|
+
while (moreAvailable) {
|
|
108
|
+
const payloadDivinerQuery = {
|
|
109
|
+
limit: this.payloadDivinerLimit,
|
|
110
|
+
offset,
|
|
111
|
+
schema: PayloadDivinerQuerySchema,
|
|
112
|
+
schemas: [ImageThumbnailSchema]
|
|
113
|
+
};
|
|
114
|
+
const payloads = await diviner.divine([payloadDivinerQuery]);
|
|
115
|
+
offset = (offset ?? 0) + payloads.length;
|
|
116
|
+
moreAvailable = payloads.length > 0;
|
|
117
|
+
console.log(`loadMapWithPayloadDiviner.offset: ${offset}`);
|
|
118
|
+
console.log(`loadMapWithPayloadDiviner.moreAvailable: ${moreAvailable}`);
|
|
119
|
+
const imagePayloadPairs = await Promise.all(
|
|
120
|
+
payloads.filter((payload) => payload.schema === ImageThumbnailSchema).map(async (payload) => [await PayloadHasher.hashAsync(payload), payload])
|
|
121
|
+
);
|
|
122
|
+
imagePayloadPairs.forEach(([hash, payload]) => newMap[payload.sourceUrl] = hash);
|
|
123
|
+
}
|
|
124
|
+
this._map = newMap;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async stopHandler(_timeout) {
|
|
129
|
+
if (this._pollId) {
|
|
130
|
+
clearTimeout(this._pollId);
|
|
131
|
+
this._pollId = void 0;
|
|
132
|
+
}
|
|
133
|
+
return await super.stopHandler();
|
|
134
|
+
}
|
|
135
|
+
async attachArchivistEvents() {
|
|
136
|
+
const archivist = await this.getArchivistInstance();
|
|
137
|
+
const mapPromise = this.getSafeMap();
|
|
138
|
+
archivist.on("inserted", async ({ payloads }) => {
|
|
139
|
+
const map = await mapPromise;
|
|
140
|
+
const thumbnails = compact(payloads.filter((payload) => payload.schema === ImageThumbnailSchema));
|
|
141
|
+
await Promise.all(thumbnails.map(async (payload) => map[payload.sourceUrl] = await PayloadHasher.hashAsync(payload)));
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
async getSafeMap() {
|
|
145
|
+
let mapRetry = 100;
|
|
146
|
+
let map = this._map;
|
|
147
|
+
while (!map) {
|
|
148
|
+
await delay(100);
|
|
149
|
+
mapRetry = mapRetry - 1;
|
|
150
|
+
if (mapRetry === 0) {
|
|
151
|
+
throw Error("Map Not Loaded");
|
|
152
|
+
}
|
|
153
|
+
map = this._map;
|
|
154
|
+
}
|
|
155
|
+
return map;
|
|
156
|
+
}
|
|
157
|
+
async poll() {
|
|
158
|
+
if (await this.started()) {
|
|
159
|
+
const pollFrequency = this.pollFrequency;
|
|
160
|
+
if (pollFrequency) {
|
|
161
|
+
this._pollId = setTimeout(async () => {
|
|
162
|
+
this._pollId = void 0;
|
|
163
|
+
await this.loadMap();
|
|
164
|
+
await this.poll();
|
|
165
|
+
}, pollFrequency);
|
|
166
|
+
} else {
|
|
167
|
+
await this.loadMap();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
export {
|
|
173
|
+
ImageThumbnailDiviner
|
|
174
|
+
};
|
|
175
|
+
//# sourceMappingURL=Diviner.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Diviner/Diviner.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { delay } from '@xylabs/delay'\nimport { compact } from '@xylabs/lodash'\nimport { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { ArchivistInstance, asArchivistInstance } from '@xyo-network/archivist-model'\nimport { PayloadHasher } from '@xyo-network/core'\nimport { asDivinerInstance, DivinerConfigSchema, DivinerInstance } from '@xyo-network/diviner-model'\nimport { PayloadDivinerQueryPayload, PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'\nimport { ImageThumbnail, ImageThumbnailSchema } from '@xyo-network/image-thumbnail-payload-plugin'\nimport { UrlPayload } from '@xyo-network/url-payload-plugin'\n\nimport { ImageThumbnailDivinerConfigSchema } from './Config'\nimport { ImageThumbnailDivinerParams } from './Params'\n\nexport class ImageThumbnailDiviner<TParams extends ImageThumbnailDivinerParams = ImageThumbnailDivinerParams> extends AbstractDiviner<TParams> {\n static override configSchemas = [ImageThumbnailDivinerConfigSchema, DivinerConfigSchema]\n\n private _archivistInstance: Promise<ArchivistInstance> | undefined\n private _initializeArchivistConnectionIfNeededPromise: Promise<void> | undefined\n private _map: Record<string, string> | undefined\n private _payloadDivinerInstance: Promise<DivinerInstance> | undefined\n private _pollId?: string | number | NodeJS.Timeout\n\n // static override get configSchema() {\n // return ImageThumbnailDivinerConfigSchema\n // }\n\n get archivist() {\n return this.config.archivist\n }\n\n get payloadDiviner() {\n return this.config.payloadDiviner\n }\n\n get payloadDivinerLimit() {\n return this.config.payloadDivinerLimit ?? 10000\n }\n\n get pollFrequency() {\n return this.config.pollFrequency\n }\n\n //using promise as mutex\n async getArchivistInstance(): Promise<ArchivistInstance> {\n //if previously checked, but not found, clear promise\n if (this._archivistInstance && !(await this._archivistInstance)) {\n this._archivistInstance = undefined\n }\n this._archivistInstance =\n this._archivistInstance ??\n (async () => {\n const module = this.archivist ? await this.resolve(this.archivist) : undefined\n return asArchivistInstance(module, 'Provided archivist address did not resolve to an Archivist')\n })()\n return this._archivistInstance\n }\n\n //using promise as mutex\n async getPayloadDivinerInstance(): Promise<DivinerInstance | undefined> {\n const payloadDivinerAddress = this.payloadDiviner\n if (payloadDivinerAddress) {\n //if previously checked, but not found, clear promise\n if (this._payloadDivinerInstance && !(await this._payloadDivinerInstance)) {\n this._payloadDivinerInstance = undefined\n }\n this._payloadDivinerInstance =\n this._payloadDivinerInstance ??\n (async () => {\n const module = await this.resolve(payloadDivinerAddress)\n return asDivinerInstance(module, 'Provided payload diviner address did not resolve to a Diviner')\n })()\n\n return this._payloadDivinerInstance\n }\n }\n\n protected override async divineHandler(payloads: UrlPayload[] = []): Promise<ImageThumbnail[]> {\n await this.initializeArchivistConnectionIfNeeded()\n const urls = payloads.map((urlPayload) => urlPayload.url)\n const map = await this.getSafeMap()\n const archivist = await this.getArchivistInstance()\n const hashes = compact(urls.map((url) => map?.[url]))\n return (await archivist.get(hashes)).filter((payload): payload is ImageThumbnail => payload.schema === ImageThumbnailSchema)\n }\n\n //using promise as mutex\n protected initializeArchivistConnectionIfNeeded() {\n this._initializeArchivistConnectionIfNeededPromise =\n this._initializeArchivistConnectionIfNeededPromise ??\n (async () => {\n if (!this._map) {\n await this.attachArchivistEvents()\n console.log('initializeArchivistConnectionIfNeeded: attachArchivistEvents done')\n await this.poll()\n console.log('initializeArchivistConnectionIfNeeded: poll done')\n }\n })()\n return this._initializeArchivistConnectionIfNeededPromise\n }\n\n protected async loadMap() {\n if (this.payloadDiviner) {\n return await this.loadMapWithPayloadDiviner()\n } else {\n return await this.loadMapWithAll()\n }\n }\n\n protected async loadMapWithAll() {\n if (await this.started()) {\n const archivist = await this.getArchivistInstance()\n assertEx(archivist.all, \"Archivist does not support 'all'\")\n const allPayloads = (await archivist.all?.()) ?? []\n const imagePayloadPairs = await Promise.all(\n allPayloads\n .filter((payload): payload is ImageThumbnail => payload.schema === ImageThumbnailSchema)\n .map<Promise<[string, ImageThumbnail]>>(async (payload) => [await PayloadHasher.hashAsync(payload), payload]),\n )\n this._map = imagePayloadPairs.reduce<Record<string, string>>((prev, [hash, payload]) => {\n prev[payload.sourceUrl] = hash\n return prev\n }, {})\n }\n }\n\n protected async loadMapWithPayloadDiviner() {\n console.log('loadMapWithPayloadDiviner: started')\n if (await this.started()) {\n const diviner = await this.getPayloadDivinerInstance()\n let offset: number | undefined = undefined\n let moreAvailable = true\n if (diviner) {\n const newMap: Record<string, string> = {}\n while (moreAvailable) {\n const payloadDivinerQuery: PayloadDivinerQueryPayload = {\n limit: this.payloadDivinerLimit,\n offset,\n schema: PayloadDivinerQuerySchema,\n schemas: [ImageThumbnailSchema],\n }\n const payloads = await diviner.divine([payloadDivinerQuery])\n offset = (offset ?? 0) + payloads.length\n moreAvailable = payloads.length > 0\n console.log(`loadMapWithPayloadDiviner.offset: ${offset}`)\n console.log(`loadMapWithPayloadDiviner.moreAvailable: ${moreAvailable}`)\n const imagePayloadPairs = await Promise.all(\n payloads\n .filter((payload): payload is ImageThumbnail => payload.schema === ImageThumbnailSchema)\n .map<Promise<[string, ImageThumbnail]>>(async (payload) => [await PayloadHasher.hashAsync(payload), payload]),\n )\n imagePayloadPairs.forEach(([hash, payload]) => (newMap[payload.sourceUrl] = hash))\n }\n this._map = newMap\n }\n }\n }\n\n protected override async stopHandler(_timeout?: number | undefined): Promise<boolean> {\n if (this._pollId) {\n clearTimeout(this._pollId)\n this._pollId = undefined\n }\n return await super.stopHandler()\n }\n\n private async attachArchivistEvents() {\n const archivist = await this.getArchivistInstance()\n const mapPromise = this.getSafeMap()\n archivist.on('inserted', async ({ payloads }) => {\n const map = await mapPromise\n const thumbnails = compact(payloads.filter((payload): payload is ImageThumbnail => payload.schema === ImageThumbnailSchema))\n await Promise.all(thumbnails.map(async (payload) => (map[payload.sourceUrl] = await PayloadHasher.hashAsync(payload))))\n })\n }\n\n private async getSafeMap() {\n let mapRetry = 100 //10 seconds max\n let map = this._map\n while (!map) {\n await delay(100)\n mapRetry = mapRetry - 1\n if (mapRetry === 0) {\n throw Error('Map Not Loaded')\n }\n map = this._map\n }\n return map\n }\n\n private async poll() {\n if (await this.started()) {\n const pollFrequency = this.pollFrequency\n if (pollFrequency) {\n this._pollId = setTimeout(async () => {\n this._pollId = undefined\n await this.loadMap()\n await this.poll()\n }, pollFrequency)\n } else {\n await this.loadMap()\n }\n }\n }\n}\n"],"mappings":"AAAA,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAA4B,2BAA2B;AACvD,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB,2BAA4C;AACxE,SAAqC,iCAAiC;AACtE,SAAyB,4BAA4B;AAGrD,SAAS,yCAAyC;AAG3C,MAAM,8BAAyG,gBAAyB;AAAA,EAC7I,OAAgB,gBAAgB,CAAC,mCAAmC,mBAAmB;AAAA,EAE/E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA;AAAA,EAMR,IAAI,YAAY;AACd,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,iBAAiB;AACnB,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,sBAAsB;AACxB,WAAO,KAAK,OAAO,uBAAuB;AAAA,EAC5C;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA;AAAA,EAGA,MAAM,uBAAmD;AAEvD,QAAI,KAAK,sBAAsB,CAAE,MAAM,KAAK,oBAAqB;AAC/D,WAAK,qBAAqB;AAAA,IAC5B;AACA,SAAK,qBACH,KAAK,uBACJ,YAAY;AACX,YAAM,SAAS,KAAK,YAAY,MAAM,KAAK,QAAQ,KAAK,SAAS,IAAI;AACrE,aAAO,oBAAoB,QAAQ,4DAA4D;AAAA,IACjG,GAAG;AACL,WAAO,KAAK;AAAA,EACd;AAAA;AAAA,EAGA,MAAM,4BAAkE;AACtE,UAAM,wBAAwB,KAAK;AACnC,QAAI,uBAAuB;AAEzB,UAAI,KAAK,2BAA2B,CAAE,MAAM,KAAK,yBAA0B;AACzE,aAAK,0BAA0B;AAAA,MACjC;AACA,WAAK,0BACH,KAAK,4B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AEtD,MAAM,MAAM,2BAA2B,GAAG,aAAa,CAAC,eAAe,CAAC,2BAA2B,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Params.d.ts","sourceRoot":"","sources":["../../../src/Diviner/Params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAA;AAEtD,MAAM,MAAM,2BAA2B,GAAG,aAAa,CAAC,eAAe,CAAC,2BAA2B,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var Params_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(Params_exports);
|
|
17
|
+
//# sourceMappingURL=Params.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Diviner/Params.ts"],"sourcesContent":["import { DivinerParams } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema } from '@xyo-network/module'\n\nimport { ImageThumbnailDivinerConfig } from './Config'\n\nexport type ImageThumbnailDivinerParams = DivinerParams<AnyConfigSchema<ImageThumbnailDivinerConfig>>\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=Params.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Diviner/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Diviner/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var Diviner_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(Diviner_exports);
|
|
18
|
+
__reExport(Diviner_exports, require("./Config"), module.exports);
|
|
19
|
+
__reExport(Diviner_exports, require("./Diviner"), module.exports);
|
|
20
|
+
__reExport(Diviner_exports, require("./Params"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./Config"),
|
|
24
|
+
...require("./Diviner"),
|
|
25
|
+
...require("./Params")
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Diviner/index.ts"],"sourcesContent":["export * from './Config'\nexport * from './Diviner'\nexport * from './Params'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAc,qBAAd;AACA,4BAAc,sBADd;AAEA,4BAAc,qBAFd;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Diviner/index.ts"],"sourcesContent":["export * from './Config'\nexport * from './Diviner'\nexport * from './Params'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AAEjD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAa9B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AAEjD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAa9B,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Plugin_exports = {};
|
|
20
|
+
__export(Plugin_exports, {
|
|
21
|
+
ImageThumbnailPlugin: () => ImageThumbnailPlugin
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Plugin_exports);
|
|
24
|
+
var import_image_thumbnail_payload_plugin = require("@xyo-network/image-thumbnail-payload-plugin");
|
|
25
|
+
var import_payload_model = require("@xyo-network/payload-model");
|
|
26
|
+
var import_payloadset_plugin = require("@xyo-network/payloadset-plugin");
|
|
27
|
+
var import_Diviner = require("./Diviner");
|
|
28
|
+
var import_Witness = require("./Witness");
|
|
29
|
+
const ImageThumbnailPlugin = () => (0, import_payloadset_plugin.createPayloadSetDualPlugin)(
|
|
30
|
+
{ required: { [import_image_thumbnail_payload_plugin.ImageThumbnailSchema]: 1 }, schema: import_payload_model.PayloadSetSchema },
|
|
31
|
+
{
|
|
32
|
+
diviner: async (params) => {
|
|
33
|
+
const result = await import_Diviner.ImageThumbnailDiviner.create(params);
|
|
34
|
+
return result;
|
|
35
|
+
},
|
|
36
|
+
witness: async (params) => {
|
|
37
|
+
const result = await import_Witness.ImageThumbnailWitness.create(params);
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
ImageThumbnailPlugin
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=Plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Plugin.ts"],"sourcesContent":["import { ImageThumbnailSchema } from '@xyo-network/image-thumbnail-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetDualPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { ImageThumbnailDiviner } from './Diviner'\nimport { ImageThumbnailWitness } from './Witness'\n\nexport const ImageThumbnailPlugin = () =>\n createPayloadSetDualPlugin<ImageThumbnailWitness, ImageThumbnailDiviner>(\n { required: { [ImageThumbnailSchema]: 1 }, schema: PayloadSetSchema },\n {\n diviner: async (params) => {\n const result = await ImageThumbnailDiviner.create(params)\n return result\n },\n witness: async (params) => {\n const result = await ImageThumbnailWitness.create(params)\n return result\n },\n },\n )\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4CAAqC;AACrC,2BAAiC;AACjC,+BAA2C;AAE3C,qBAAsC;AACtC,qBAAsC;AAE/B,MAAM,uBAAuB,UAClC;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,0DAAoB,GAAG,EAAE,GAAG,QAAQ,sCAAiB;AAAA,EACpE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM,qCAAsB,OAAO,MAAM;AACxD,aAAO;AAAA,IACT;AAAA,IACA,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM,qCAAsB,OAAO,MAAM;AACxD,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|