@xyo-network/url-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/Plugin.d.mts.map +1 -0
- package/dist/node/Plugin.d.ts.map +1 -0
- package/dist/node/Plugin.js +41 -0
- package/dist/node/Plugin.js.map +1 -0
- package/dist/node/Plugin.mjs +17 -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 +49 -0
- package/dist/node/Witness/Witness.js.map +1 -0
- package/dist/node/Witness/Witness.mjs +25 -0
- package/dist/node/Witness/Witness.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 +34 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/index.mjs +8 -0
- package/dist/node/index.mjs.map +1 -0
- package/dist/node/util/hashFile.d.mts.map +1 -0
- package/dist/node/util/hashFile.d.ts.map +1 -0
- package/dist/node/util/hashFile.js +58 -0
- package/dist/node/util/hashFile.js.map +1 -0
- package/dist/node/util/hashFile.mjs +24 -0
- package/dist/node/util/hashFile.mjs.map +1 -0
- package/dist/node/util/hashHttpUrl.d.mts.map +1 -0
- package/dist/node/util/hashHttpUrl.d.ts.map +1 -0
- package/dist/node/util/hashHttpUrl.js +58 -0
- package/dist/node/util/hashHttpUrl.js.map +1 -0
- package/dist/node/util/hashHttpUrl.mjs +24 -0
- package/dist/node/util/hashHttpUrl.mjs.map +1 -0
- package/dist/node/util/hashUrl.d.mts.map +1 -0
- package/dist/node/util/hashUrl.d.ts.map +1 -0
- package/dist/node/util/hashUrl.js +42 -0
- package/dist/node/util/hashUrl.js.map +1 -0
- package/dist/node/util/hashUrl.mjs +18 -0
- package/dist/node/util/hashUrl.mjs.map +1 -0
- package/dist/node/util/index.d.mts.map +1 -0
- package/dist/node/util/index.d.ts.map +1 -0
- package/dist/node/util/index.js +23 -0
- package/dist/node/util/index.js.map +1 -0
- package/dist/node/util/index.mjs +2 -0
- package/dist/node/util/index.mjs.map +1 -0
- package/package.json +28 -27
- package/src/util/hashHttpUrl.ts +1 -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/index.d.mts.map +0 -1
- package/dist/Witness/index.d.ts.map +0 -1
- package/dist/docs.json +0 -22503
- package/dist/index.d.mts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -149
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -110
- package/dist/index.mjs.map +0 -1
- package/dist/util/hashFile.d.mts.map +0 -1
- package/dist/util/hashFile.d.ts.map +0 -1
- package/dist/util/hashHttpUrl.d.mts.map +0 -1
- package/dist/util/hashHttpUrl.d.ts.map +0 -1
- package/dist/util/hashUrl.d.mts.map +0 -1
- package/dist/util/hashUrl.d.ts.map +0 -1
- package/dist/util/index.d.mts.map +0 -1
- package/dist/util/index.d.ts.map +0 -1
- /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}/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
- /package/dist/{util → node/util}/hashFile.d.mts +0 -0
- /package/dist/{util → node/util}/hashFile.d.ts +0 -0
- /package/dist/{util → node/util}/hashHttpUrl.d.mts +0 -0
- /package/dist/{util → node/util}/hashHttpUrl.d.ts +0 -0
- /package/dist/{util → node/util}/hashUrl.d.mts +0 -0
- /package/dist/{util → node/util}/hashUrl.d.ts +0 -0
- /package/dist/{util → node/util}/index.d.mts +0 -0
- /package/dist/{util → node/util}/index.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASnB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASnB,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
UrlPlugin: () => UrlPlugin
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Plugin_exports);
|
|
24
|
+
var import_payload_model = require("@xyo-network/payload-model");
|
|
25
|
+
var import_payloadset_plugin = require("@xyo-network/payloadset-plugin");
|
|
26
|
+
var import_url_payload_plugin = require("@xyo-network/url-payload-plugin");
|
|
27
|
+
var import_Witness = require("./Witness");
|
|
28
|
+
const UrlPlugin = () => (0, import_payloadset_plugin.createPayloadSetWitnessPlugin)(
|
|
29
|
+
{ required: { [import_url_payload_plugin.UrlSchema]: 1 }, schema: import_payload_model.PayloadSetSchema },
|
|
30
|
+
{
|
|
31
|
+
witness: async (params) => {
|
|
32
|
+
const result = await import_Witness.UrlWitness.create(params);
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
UrlPlugin
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=Plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Plugin.ts"],"sourcesContent":["import { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\nimport { UrlSchema } from '@xyo-network/url-payload-plugin'\n\nimport { UrlWitness } from './Witness'\n\nexport const UrlPlugin = () =>\n createPayloadSetWitnessPlugin<UrlWitness>(\n { required: { [UrlSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n const result = await UrlWitness.create(params)\n return result\n },\n },\n )\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAiC;AACjC,+BAA8C;AAC9C,gCAA0B;AAE1B,qBAA2B;AAEpB,MAAM,YAAY,UACvB;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,mCAAS,GAAG,EAAE,GAAG,QAAQ,sCAAiB;AAAA,EACzD;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM,0BAAW,OAAO,MAAM;AAC7C,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PayloadSetSchema } from "@xyo-network/payload-model";
|
|
2
|
+
import { createPayloadSetWitnessPlugin } from "@xyo-network/payloadset-plugin";
|
|
3
|
+
import { UrlSchema } from "@xyo-network/url-payload-plugin";
|
|
4
|
+
import { UrlWitness } from "./Witness";
|
|
5
|
+
const UrlPlugin = () => createPayloadSetWitnessPlugin(
|
|
6
|
+
{ required: { [UrlSchema]: 1 }, schema: PayloadSetSchema },
|
|
7
|
+
{
|
|
8
|
+
witness: async (params) => {
|
|
9
|
+
const result = await UrlWitness.create(params);
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
export {
|
|
15
|
+
UrlPlugin
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=Plugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Plugin.ts"],"sourcesContent":["import { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\nimport { UrlSchema } from '@xyo-network/url-payload-plugin'\n\nimport { UrlWitness } from './Witness'\n\nexport const UrlPlugin = () =>\n createPayloadSetWitnessPlugin<UrlWitness>(\n { required: { [UrlSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n const result = await UrlWitness.create(params)\n return result\n },\n },\n )\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;AAC9C,SAAS,iBAAiB;AAE1B,SAAS,kBAAkB;AAEpB,MAAM,YAAY,MACvB;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,SAAS,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACzD;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM,WAAW,OAAO,MAAM;AAC7C,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../../src/Witness/Config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,eAAO,MAAM,sBAAsB,kCAAyC,CAAA;AAC5E,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAA;AAElE,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;IAC3C,MAAM,EAAE,sBAAsB,CAAA;IAC9B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../../src/Witness/Config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,eAAO,MAAM,sBAAsB,kCAAyC,CAAA;AAC5E,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAA;AAElE,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;IAC3C,MAAM,EAAE,sBAAsB,CAAA;IAC9B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB,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
|
+
UrlWitnessConfigSchema: () => UrlWitnessConfigSchema
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Config_exports);
|
|
24
|
+
var import_url_payload_plugin = require("@xyo-network/url-payload-plugin");
|
|
25
|
+
const UrlWitnessConfigSchema = `${import_url_payload_plugin.UrlSchema}.witness.config`;
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
UrlWitnessConfigSchema
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=Config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Witness/Config.ts"],"sourcesContent":["import { UrlSchema } from '@xyo-network/url-payload-plugin'\nimport { WitnessConfig } from '@xyo-network/witness'\n\nexport const UrlWitnessConfigSchema = `${UrlSchema}.witness.config` as const\nexport type UrlWitnessConfigSchema = typeof UrlWitnessConfigSchema\n\nexport type UrlWitnessConfig = WitnessConfig<{\n schema: UrlWitnessConfigSchema\n urls?: string[]\n}>\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA0B;AAGnB,MAAM,yBAAyB,GAAG,mCAAS;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Witness/Config.ts"],"sourcesContent":["import { UrlSchema } from '@xyo-network/url-payload-plugin'\nimport { WitnessConfig } from '@xyo-network/witness'\n\nexport const UrlWitnessConfigSchema = `${UrlSchema}.witness.config` as const\nexport type UrlWitnessConfigSchema = typeof UrlWitnessConfigSchema\n\nexport type UrlWitnessConfig = WitnessConfig<{\n schema: UrlWitnessConfigSchema\n urls?: string[]\n}>\n"],"mappings":"AAAA,SAAS,iBAAiB;AAGnB,MAAM,yBAAyB,GAAG,SAAS;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Params.d.ts","sourceRoot":"","sources":["../../../src/Witness/Params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE3C,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Params.d.ts","sourceRoot":"","sources":["../../../src/Witness/Params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE3C,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,eAAe,CAAC,gBAAgB,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/Witness/Params.ts"],"sourcesContent":["import { AnyConfigSchema } from '@xyo-network/module'\nimport { WitnessParams } from '@xyo-network/witness'\n\nimport { UrlWitnessConfig } from './Config'\n\nexport type UrlWitnessParams = WitnessParams<AnyConfigSchema<UrlWitnessConfig>>\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":"Witness.d.ts","sourceRoot":"","sources":["../../../src/Witness/Witness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAItD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE3C,qBAAa,UAAU,CAAC,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,CAAE,SAAQ,eAAe,CAAC,OAAO,CAAC;IAC3G,OAAgB,aAAa,qCAA2B;IAExD,IAAI,IAAI,yBAEP;cAEwB,cAAc,CAAC,QAAQ,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAiBtF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../../src/Witness/Witness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAItD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE3C,qBAAa,UAAU,CAAC,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,CAAE,SAAQ,eAAe,CAAC,OAAO,CAAC;IAC3G,OAAgB,aAAa,qCAA2B;IAExD,IAAI,IAAI,yBAEP;cAEwB,cAAc,CAAC,QAAQ,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAiBtF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 Witness_exports = {};
|
|
20
|
+
__export(Witness_exports, {
|
|
21
|
+
UrlWitness: () => UrlWitness
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Witness_exports);
|
|
24
|
+
var import_url_payload_plugin = require("@xyo-network/url-payload-plugin");
|
|
25
|
+
var import_witness = require("@xyo-network/witness");
|
|
26
|
+
var import_util = require("../util");
|
|
27
|
+
var import_Config = require("./Config");
|
|
28
|
+
class UrlWitness extends import_witness.AbstractWitness {
|
|
29
|
+
static configSchemas = [import_Config.UrlWitnessConfigSchema];
|
|
30
|
+
get urls() {
|
|
31
|
+
return this.config?.urls;
|
|
32
|
+
}
|
|
33
|
+
async observeHandler(payloads = []) {
|
|
34
|
+
const urls = this.urls?.map((url) => ({ schema: import_url_payload_plugin.UrlSchema, url })) ?? payloads.filter((p) => p.schema === import_url_payload_plugin.UrlSchema).map((p) => {
|
|
35
|
+
return { schema: import_url_payload_plugin.UrlSchema, url: p.url };
|
|
36
|
+
});
|
|
37
|
+
const hashed = await Promise.all(
|
|
38
|
+
urls.map(async (url) => {
|
|
39
|
+
return { ...url, hash: await (0, import_util.hashUrl)(url.url) };
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
return hashed;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
UrlWitness
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=Witness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Witness/Witness.ts"],"sourcesContent":["import { Payload } from '@xyo-network/payload-model'\nimport { UrlPayload, UrlSchema } from '@xyo-network/url-payload-plugin'\nimport { AbstractWitness } from '@xyo-network/witness'\n\nimport { hashUrl } from '../util'\nimport { UrlWitnessConfigSchema } from './Config'\nimport { UrlWitnessParams } from './Params'\n\nexport class UrlWitness<TParams extends UrlWitnessParams = UrlWitnessParams> extends AbstractWitness<TParams> {\n static override configSchemas = [UrlWitnessConfigSchema]\n\n get urls() {\n return this.config?.urls\n }\n\n protected override async observeHandler(payloads: Payload[] = []): Promise<Payload[]> {\n const urls: UrlPayload[] =\n this.urls?.map((url) => ({ schema: UrlSchema, url })) ??\n payloads\n .filter((p): p is UrlPayload => p.schema === UrlSchema)\n .map((p) => {\n return { schema: UrlSchema, url: p.url }\n })\n const hashed = await Promise.all(\n urls.map(async (url) => {\n // TODO: Different schema for hashed url\n return { ...url, hash: await hashUrl(url.url) }\n }),\n )\n // TODO: Handle partial success\n return hashed\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gCAAsC;AACtC,qBAAgC;AAEhC,kBAAwB;AACxB,oBAAuC;AAGhC,MAAM,mBAAwE,+BAAyB;AAAA,EAC5G,OAAgB,gBAAgB,CAAC,oCAAsB;AAAA,EAEvD,IAAI,OAAO;AACT,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,MAAyB,eAAe,WAAsB,CAAC,GAAuB;AACpF,UAAM,OACJ,KAAK,MAAM,IAAI,CAAC,SAAS,EAAE,QAAQ,qCAAW,IAAI,EAAE,KACpD,SACG,OAAO,CAAC,MAAuB,EAAE,WAAW,mCAAS,EACrD,IAAI,CAAC,MAAM;AACV,aAAO,EAAE,QAAQ,qCAAW,KAAK,EAAE,IAAI;AAAA,IACzC,CAAC;AACL,UAAM,SAAS,MAAM,QAAQ;AAAA,MAC3B,KAAK,IAAI,OAAO,QAAQ;AAEtB,eAAO,EAAE,GAAG,KAAK,MAAM,UAAM,qBAAQ,IAAI,GAAG,EAAE;AAAA,MAChD,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { UrlSchema } from "@xyo-network/url-payload-plugin";
|
|
2
|
+
import { AbstractWitness } from "@xyo-network/witness";
|
|
3
|
+
import { hashUrl } from "../util";
|
|
4
|
+
import { UrlWitnessConfigSchema } from "./Config";
|
|
5
|
+
class UrlWitness extends AbstractWitness {
|
|
6
|
+
static configSchemas = [UrlWitnessConfigSchema];
|
|
7
|
+
get urls() {
|
|
8
|
+
return this.config?.urls;
|
|
9
|
+
}
|
|
10
|
+
async observeHandler(payloads = []) {
|
|
11
|
+
const urls = this.urls?.map((url) => ({ schema: UrlSchema, url })) ?? payloads.filter((p) => p.schema === UrlSchema).map((p) => {
|
|
12
|
+
return { schema: UrlSchema, url: p.url };
|
|
13
|
+
});
|
|
14
|
+
const hashed = await Promise.all(
|
|
15
|
+
urls.map(async (url) => {
|
|
16
|
+
return { ...url, hash: await hashUrl(url.url) };
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
return hashed;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
UrlWitness
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=Witness.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Witness/Witness.ts"],"sourcesContent":["import { Payload } from '@xyo-network/payload-model'\nimport { UrlPayload, UrlSchema } from '@xyo-network/url-payload-plugin'\nimport { AbstractWitness } from '@xyo-network/witness'\n\nimport { hashUrl } from '../util'\nimport { UrlWitnessConfigSchema } from './Config'\nimport { UrlWitnessParams } from './Params'\n\nexport class UrlWitness<TParams extends UrlWitnessParams = UrlWitnessParams> extends AbstractWitness<TParams> {\n static override configSchemas = [UrlWitnessConfigSchema]\n\n get urls() {\n return this.config?.urls\n }\n\n protected override async observeHandler(payloads: Payload[] = []): Promise<Payload[]> {\n const urls: UrlPayload[] =\n this.urls?.map((url) => ({ schema: UrlSchema, url })) ??\n payloads\n .filter((p): p is UrlPayload => p.schema === UrlSchema)\n .map((p) => {\n return { schema: UrlSchema, url: p.url }\n })\n const hashed = await Promise.all(\n urls.map(async (url) => {\n // TODO: Different schema for hashed url\n return { ...url, hash: await hashUrl(url.url) }\n }),\n )\n // TODO: Handle partial success\n return hashed\n }\n}\n"],"mappings":"AACA,SAAqB,iBAAiB;AACtC,SAAS,uBAAuB;AAEhC,SAAS,eAAe;AACxB,SAAS,8BAA8B;AAGhC,MAAM,mBAAwE,gBAAyB;AAAA,EAC5G,OAAgB,gBAAgB,CAAC,sBAAsB;AAAA,EAEvD,IAAI,OAAO;AACT,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,MAAyB,eAAe,WAAsB,CAAC,GAAuB;AACpF,UAAM,OACJ,KAAK,MAAM,IAAI,CAAC,SAAS,EAAE,QAAQ,WAAW,IAAI,EAAE,KACpD,SACG,OAAO,CAAC,MAAuB,EAAE,WAAW,SAAS,EACrD,IAAI,CAAC,MAAM;AACV,aAAO,EAAE,QAAQ,WAAW,KAAK,EAAE,IAAI;AAAA,IACzC,CAAC;AACL,UAAM,SAAS,MAAM,QAAQ;AAAA,MAC3B,KAAK,IAAI,OAAO,QAAQ;AAEtB,eAAO,EAAE,GAAG,KAAK,MAAM,MAAM,QAAQ,IAAI,GAAG,EAAE;AAAA,MAChD,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Witness/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Witness/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,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 Witness_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(Witness_exports);
|
|
18
|
+
__reExport(Witness_exports, require("./Config"), module.exports);
|
|
19
|
+
__reExport(Witness_exports, require("./Params"), module.exports);
|
|
20
|
+
__reExport(Witness_exports, require("./Witness"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./Config"),
|
|
24
|
+
...require("./Params"),
|
|
25
|
+
...require("./Witness")
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Witness/index.ts"],"sourcesContent":["export * from './Config'\nexport * from './Params'\nexport * from './Witness'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAc,qBAAd;AACA,4BAAc,qBADd;AAEA,4BAAc,sBAFd;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Witness/index.ts"],"sourcesContent":["export * from './Config'\nexport * from './Params'\nexport * from './Witness'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEpC,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,CAAA;AAGpB,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEpC,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,CAAA;AAGpB,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var src_exports = {};
|
|
21
|
+
__export(src_exports, {
|
|
22
|
+
UrlPlugin: () => import_Plugin.UrlPlugin,
|
|
23
|
+
default: () => src_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(src_exports);
|
|
26
|
+
var import_Plugin = require("./Plugin");
|
|
27
|
+
__reExport(src_exports, require("./Witness"), module.exports);
|
|
28
|
+
var src_default = import_Plugin.UrlPlugin;
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
UrlPlugin,
|
|
32
|
+
...require("./Witness")
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { UrlPlugin } from './Plugin'\n\nexport * from './Witness'\n\nexport { UrlPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default UrlPlugin\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0B;AAE1B,wBAAc,sBAFd;AAOA,IAAO,cAAQ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { UrlPlugin } from './Plugin'\n\nexport * from './Witness'\n\nexport { UrlPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default UrlPlugin\n"],"mappings":"AAAA,SAAS,iBAAiB;AAE1B,cAAc;AAKd,IAAO,cAAQ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashFile.d.ts","sourceRoot":"","sources":["../../../src/util/hashFile.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,QAAS,MAAM,KAAG,QAAQ,MAAM,CAgBpD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashFile.d.ts","sourceRoot":"","sources":["../../../src/util/hashFile.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,QAAS,MAAM,KAAG,QAAQ,MAAM,CAgBpD,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var hashFile_exports = {};
|
|
30
|
+
__export(hashFile_exports, {
|
|
31
|
+
hashFile: () => hashFile
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(hashFile_exports);
|
|
34
|
+
var import_crypto = __toESM(require("crypto"));
|
|
35
|
+
var import_fs = require("fs");
|
|
36
|
+
var import_url = require("url");
|
|
37
|
+
const hashFile = (url) => {
|
|
38
|
+
const path = url.startsWith("file://") ? (0, import_url.fileURLToPath)(url) : url;
|
|
39
|
+
const ret = new Promise((resolve, reject) => {
|
|
40
|
+
const hash = import_crypto.default.createHash("sha256");
|
|
41
|
+
const stream = (0, import_fs.createReadStream)(path);
|
|
42
|
+
stream.on("data", (data) => {
|
|
43
|
+
hash.update(data);
|
|
44
|
+
});
|
|
45
|
+
stream.on("end", () => {
|
|
46
|
+
resolve(hash.digest("hex"));
|
|
47
|
+
});
|
|
48
|
+
stream.on("error", (err) => {
|
|
49
|
+
reject(err);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
return ret;
|
|
53
|
+
};
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
hashFile
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=hashFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/util/hashFile.ts"],"sourcesContent":["import Crypto from 'crypto'\nimport { createReadStream } from 'fs'\nimport { fileURLToPath } from 'url'\n\nexport const hashFile = (url: string): Promise<string> => {\n const path = url.startsWith('file://') ? fileURLToPath(url) : url\n const ret = new Promise<string>((resolve, reject) => {\n const hash = Crypto.createHash('sha256')\n const stream = createReadStream(path)\n stream.on('data', (data) => {\n hash.update(data)\n })\n stream.on('end', () => {\n resolve(hash.digest('hex'))\n })\n stream.on('error', (err) => {\n reject(err)\n })\n })\n return ret\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,gBAAiC;AACjC,iBAA8B;AAEvB,MAAM,WAAW,CAAC,QAAiC;AACxD,QAAM,OAAO,IAAI,WAAW,SAAS,QAAI,0BAAc,GAAG,IAAI;AAC9D,QAAM,MAAM,IAAI,QAAgB,CAAC,SAAS,WAAW;AACnD,UAAM,OAAO,cAAAA,QAAO,WAAW,QAAQ;AACvC,UAAM,aAAS,4BAAiB,IAAI;AACpC,WAAO,GAAG,QAAQ,CAAC,SAAS;AAC1B,WAAK,OAAO,IAAI;AAAA,IAClB,CAAC;AACD,WAAO,GAAG,OAAO,MAAM;AACrB,cAAQ,KAAK,OAAO,KAAK,CAAC;AAAA,IAC5B,CAAC;AACD,WAAO,GAAG,SAAS,CAAC,QAAQ;AAC1B,aAAO,GAAG;AAAA,IACZ,CAAC;AAAA,EACH,CAAC;AACD,SAAO;AACT;","names":["Crypto"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Crypto from "crypto";
|
|
2
|
+
import { createReadStream } from "fs";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
const hashFile = (url) => {
|
|
5
|
+
const path = url.startsWith("file://") ? fileURLToPath(url) : url;
|
|
6
|
+
const ret = new Promise((resolve, reject) => {
|
|
7
|
+
const hash = Crypto.createHash("sha256");
|
|
8
|
+
const stream = createReadStream(path);
|
|
9
|
+
stream.on("data", (data) => {
|
|
10
|
+
hash.update(data);
|
|
11
|
+
});
|
|
12
|
+
stream.on("end", () => {
|
|
13
|
+
resolve(hash.digest("hex"));
|
|
14
|
+
});
|
|
15
|
+
stream.on("error", (err) => {
|
|
16
|
+
reject(err);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
return ret;
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
hashFile
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=hashFile.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/util/hashFile.ts"],"sourcesContent":["import Crypto from 'crypto'\nimport { createReadStream } from 'fs'\nimport { fileURLToPath } from 'url'\n\nexport const hashFile = (url: string): Promise<string> => {\n const path = url.startsWith('file://') ? fileURLToPath(url) : url\n const ret = new Promise<string>((resolve, reject) => {\n const hash = Crypto.createHash('sha256')\n const stream = createReadStream(path)\n stream.on('data', (data) => {\n hash.update(data)\n })\n stream.on('end', () => {\n resolve(hash.digest('hex'))\n })\n stream.on('error', (err) => {\n reject(err)\n })\n })\n return ret\n}\n"],"mappings":"AAAA,OAAO,YAAY;AACnB,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAEvB,MAAM,WAAW,CAAC,QAAiC;AACxD,QAAM,OAAO,IAAI,WAAW,SAAS,IAAI,cAAc,GAAG,IAAI;AAC9D,QAAM,MAAM,IAAI,QAAgB,CAAC,SAAS,WAAW;AACnD,UAAM,OAAO,OAAO,WAAW,QAAQ;AACvC,UAAM,SAAS,iBAAiB,IAAI;AACpC,WAAO,GAAG,QAAQ,CAAC,SAAS;AAC1B,WAAK,OAAO,IAAI;AAAA,IAClB,CAAC;AACD,WAAO,GAAG,OAAO,MAAM;AACrB,cAAQ,KAAK,OAAO,KAAK,CAAC;AAAA,IAC5B,CAAC;AACD,WAAO,GAAG,SAAS,CAAC,QAAQ;AAC1B,aAAO,GAAG;AAAA,IACZ,CAAC;AAAA,EACH,CAAC;AACD,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashHttpUrl.d.ts","sourceRoot":"","sources":["../../../src/util/hashHttpUrl.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,QAAQ,MAAM,CAkBvD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashHttpUrl.d.ts","sourceRoot":"","sources":["../../../src/util/hashHttpUrl.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,QAAQ,MAAM,CAkBvD,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var hashHttpUrl_exports = {};
|
|
30
|
+
__export(hashHttpUrl_exports, {
|
|
31
|
+
hashHttpUrl: () => hashHttpUrl
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(hashHttpUrl_exports);
|
|
34
|
+
var import_crypto = require("@xylabs/crypto");
|
|
35
|
+
var import_http = __toESM(require("http"));
|
|
36
|
+
var import_https = __toESM(require("https"));
|
|
37
|
+
const hashHttpUrl = (url) => {
|
|
38
|
+
const ret = new Promise((resolve, reject) => {
|
|
39
|
+
const hash = import_crypto.Crypto.createHash("sha256");
|
|
40
|
+
const lib = url.startsWith("https") ? import_https.default : import_http.default;
|
|
41
|
+
lib.get(url, (res) => {
|
|
42
|
+
res.on("data", (data) => {
|
|
43
|
+
hash.update(data);
|
|
44
|
+
});
|
|
45
|
+
res.on("end", () => {
|
|
46
|
+
resolve(hash.digest("hex"));
|
|
47
|
+
});
|
|
48
|
+
}).on("error", (err) => {
|
|
49
|
+
reject(err);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
return ret;
|
|
53
|
+
};
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
hashHttpUrl
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=hashHttpUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/util/hashHttpUrl.ts"],"sourcesContent":["import { Crypto } from '@xylabs/crypto'\nimport http from 'http'\nimport https from 'https'\n\nexport const hashHttpUrl = (url: string): Promise<string> => {\n const ret = new Promise<string>((resolve, reject) => {\n const hash = Crypto.createHash('sha256')\n const lib = url.startsWith('https') ? https : http\n lib\n .get(url, (res) => {\n res.on('data', (data) => {\n hash.update(data)\n })\n res.on('end', () => {\n resolve(hash.digest('hex'))\n })\n })\n .on('error', (err) => {\n reject(err)\n })\n })\n return ret\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AACvB,kBAAiB;AACjB,mBAAkB;AAEX,MAAM,cAAc,CAAC,QAAiC;AAC3D,QAAM,MAAM,IAAI,QAAgB,CAAC,SAAS,WAAW;AACnD,UAAM,OAAO,qBAAO,WAAW,QAAQ;AACvC,UAAM,MAAM,IAAI,WAAW,OAAO,IAAI,aAAAA,UAAQ,YAAAC;AAC9C,QACG,IAAI,KAAK,CAAC,QAAQ;AACjB,UAAI,GAAG,QAAQ,CAAC,SAAS;AACvB,aAAK,OAAO,IAAI;AAAA,MAClB,CAAC;AACD,UAAI,GAAG,OAAO,MAAM;AAClB,gBAAQ,KAAK,OAAO,KAAK,CAAC;AAAA,MAC5B,CAAC;AAAA,IACH,CAAC,EACA,GAAG,SAAS,CAAC,QAAQ;AACpB,aAAO,GAAG;AAAA,IACZ,CAAC;AAAA,EACL,CAAC;AACD,SAAO;AACT;","names":["https","http"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Crypto } from "@xylabs/crypto";
|
|
2
|
+
import http from "http";
|
|
3
|
+
import https from "https";
|
|
4
|
+
const hashHttpUrl = (url) => {
|
|
5
|
+
const ret = new Promise((resolve, reject) => {
|
|
6
|
+
const hash = Crypto.createHash("sha256");
|
|
7
|
+
const lib = url.startsWith("https") ? https : http;
|
|
8
|
+
lib.get(url, (res) => {
|
|
9
|
+
res.on("data", (data) => {
|
|
10
|
+
hash.update(data);
|
|
11
|
+
});
|
|
12
|
+
res.on("end", () => {
|
|
13
|
+
resolve(hash.digest("hex"));
|
|
14
|
+
});
|
|
15
|
+
}).on("error", (err) => {
|
|
16
|
+
reject(err);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
return ret;
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
hashHttpUrl
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=hashHttpUrl.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/util/hashHttpUrl.ts"],"sourcesContent":["import { Crypto } from '@xylabs/crypto'\nimport http from 'http'\nimport https from 'https'\n\nexport const hashHttpUrl = (url: string): Promise<string> => {\n const ret = new Promise<string>((resolve, reject) => {\n const hash = Crypto.createHash('sha256')\n const lib = url.startsWith('https') ? https : http\n lib\n .get(url, (res) => {\n res.on('data', (data) => {\n hash.update(data)\n })\n res.on('end', () => {\n resolve(hash.digest('hex'))\n })\n })\n .on('error', (err) => {\n reject(err)\n })\n })\n return ret\n}\n"],"mappings":"AAAA,SAAS,cAAc;AACvB,OAAO,UAAU;AACjB,OAAO,WAAW;AAEX,MAAM,cAAc,CAAC,QAAiC;AAC3D,QAAM,MAAM,IAAI,QAAgB,CAAC,SAAS,WAAW;AACnD,UAAM,OAAO,OAAO,WAAW,QAAQ;AACvC,UAAM,MAAM,IAAI,WAAW,OAAO,IAAI,QAAQ;AAC9C,QACG,IAAI,KAAK,CAAC,QAAQ;AACjB,UAAI,GAAG,QAAQ,CAAC,SAAS;AACvB,aAAK,OAAO,IAAI;AAAA,MAClB,CAAC;AACD,UAAI,GAAG,OAAO,MAAM;AAClB,gBAAQ,KAAK,OAAO,KAAK,CAAC;AAAA,MAC5B,CAAC;AAAA,IACH,CAAC,EACA,GAAG,SAAS,CAAC,QAAQ;AACpB,aAAO,GAAG;AAAA,IACZ,CAAC;AAAA,EACL,CAAC;AACD,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashUrl.d.ts","sourceRoot":"","sources":["../../../src/util/hashUrl.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,QAAS,MAAM,KAAG,QAAQ,MAAM,CAWnD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashUrl.d.ts","sourceRoot":"","sources":["../../../src/util/hashUrl.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,QAAS,MAAM,KAAG,QAAQ,MAAM,CAWnD,CAAA"}
|