@xyo-network/diviner-forecasting-memory 2.72.9 → 2.73.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/{types/MemoryForecastingDiviner.d.ts → index.d.mts} +6 -4
- package/dist/index.d.ts +20 -0
- package/dist/index.js +103 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +79 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +38 -25
- package/tsup.config.ts +16 -0
- package/dist/cjs/MemoryForecastingDiviner.js +0 -89
- package/dist/cjs/MemoryForecastingDiviner.js.map +0 -1
- package/dist/cjs/index.js +0 -5
- package/dist/cjs/index.js.map +0 -1
- package/dist/docs.json +0 -20231
- package/dist/esm/MemoryForecastingDiviner.js +0 -79
- package/dist/esm/MemoryForecastingDiviner.js.map +0 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +0 -1
- package/dist/types/MemoryForecastingDiviner.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.d.ts.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ForecastingDivinerParams, AbstractForecastingDiviner } from '@xyo-network/diviner-forecasting-abstract';
|
|
2
2
|
import { arimaForecastingName, seasonalArimaForecastingName } from '@xyo-network/diviner-forecasting-method-arima';
|
|
3
3
|
import { ForecastingMethod, PayloadValueTransformer } from '@xyo-network/diviner-forecasting-model';
|
|
4
4
|
import { Payload } from '@xyo-network/payload-model';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
type SupportedForecastingType = typeof arimaForecastingName | typeof seasonalArimaForecastingName;
|
|
7
|
+
declare class MemoryForecastingDiviner<TParams extends ForecastingDivinerParams = ForecastingDivinerParams> extends AbstractForecastingDiviner<TParams> {
|
|
7
8
|
static configSchemas: "network.xyo.diviner.forecasting.config"[];
|
|
8
9
|
protected static readonly forecastingMethodDict: Record<SupportedForecastingType, ForecastingMethod>;
|
|
9
10
|
/**
|
|
@@ -15,4 +16,5 @@ export declare class MemoryForecastingDiviner<TParams extends ForecastingDiviner
|
|
|
15
16
|
protected get transformer(): PayloadValueTransformer;
|
|
16
17
|
protected getPayloadsInWindow(startTimestamp: number, stopTimestamp: number): Promise<Payload[]>;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
|
|
20
|
+
export { MemoryForecastingDiviner, SupportedForecastingType };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ForecastingDivinerParams, AbstractForecastingDiviner } from '@xyo-network/diviner-forecasting-abstract';
|
|
2
|
+
import { arimaForecastingName, seasonalArimaForecastingName } from '@xyo-network/diviner-forecasting-method-arima';
|
|
3
|
+
import { ForecastingMethod, PayloadValueTransformer } from '@xyo-network/diviner-forecasting-model';
|
|
4
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
5
|
+
|
|
6
|
+
type SupportedForecastingType = typeof arimaForecastingName | typeof seasonalArimaForecastingName;
|
|
7
|
+
declare class MemoryForecastingDiviner<TParams extends ForecastingDivinerParams = ForecastingDivinerParams> extends AbstractForecastingDiviner<TParams> {
|
|
8
|
+
static configSchemas: "network.xyo.diviner.forecasting.config"[];
|
|
9
|
+
protected static readonly forecastingMethodDict: Record<SupportedForecastingType, ForecastingMethod>;
|
|
10
|
+
/**
|
|
11
|
+
* The max number of records to search during the batch query
|
|
12
|
+
*/
|
|
13
|
+
protected readonly batchLimit = 1000;
|
|
14
|
+
protected readonly maxTrainingLength = 10000;
|
|
15
|
+
protected get forecastingMethod(): ForecastingMethod;
|
|
16
|
+
protected get transformer(): PayloadValueTransformer;
|
|
17
|
+
protected getPayloadsInWindow(startTimestamp: number, stopTimestamp: number): Promise<Payload[]>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { MemoryForecastingDiviner, SupportedForecastingType };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
MemoryForecastingDiviner: () => MemoryForecastingDiviner
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(src_exports);
|
|
26
|
+
|
|
27
|
+
// src/MemoryForecastingDiviner.ts
|
|
28
|
+
var import_assert = require("@xylabs/assert");
|
|
29
|
+
var import_exists = require("@xylabs/exists");
|
|
30
|
+
var import_archivist_model = require("@xyo-network/archivist-model");
|
|
31
|
+
var import_diviner_boundwitness_model = require("@xyo-network/diviner-boundwitness-model");
|
|
32
|
+
var import_diviner_forecasting_abstract = require("@xyo-network/diviner-forecasting-abstract");
|
|
33
|
+
var import_diviner_forecasting_method_arima = require("@xyo-network/diviner-forecasting-method-arima");
|
|
34
|
+
var import_diviner_forecasting_model = require("@xyo-network/diviner-forecasting-model");
|
|
35
|
+
var import_diviner_model = require("@xyo-network/diviner-model");
|
|
36
|
+
var import_jsonpath = require("jsonpath");
|
|
37
|
+
var getJsonPathTransformer = (pathExpression) => {
|
|
38
|
+
const transformer = (x) => {
|
|
39
|
+
const ret = (0, import_jsonpath.value)(x, pathExpression);
|
|
40
|
+
if (typeof ret === "number")
|
|
41
|
+
return ret;
|
|
42
|
+
throw new Error("Parsed invalid payload value");
|
|
43
|
+
};
|
|
44
|
+
return transformer;
|
|
45
|
+
};
|
|
46
|
+
var MemoryForecastingDiviner = class _MemoryForecastingDiviner extends import_diviner_forecasting_abstract.AbstractForecastingDiviner {
|
|
47
|
+
static configSchemas = [import_diviner_forecasting_model.ForecastingDivinerConfigSchema];
|
|
48
|
+
static forecastingMethodDict = {
|
|
49
|
+
arimaForecasting: import_diviner_forecasting_method_arima.arimaForecastingMethod,
|
|
50
|
+
seasonalArimaForecasting: import_diviner_forecasting_method_arima.seasonalArimaForecastingMethod
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* The max number of records to search during the batch query
|
|
54
|
+
*/
|
|
55
|
+
batchLimit = 1e3;
|
|
56
|
+
// TODO: Inject via config
|
|
57
|
+
maxTrainingLength = 1e4;
|
|
58
|
+
get forecastingMethod() {
|
|
59
|
+
const forecastingMethodName = (0, import_assert.assertEx)(this.config.forecastingMethod, "Missing forecastingMethod in config");
|
|
60
|
+
const forecastingMethod = _MemoryForecastingDiviner.forecastingMethodDict[forecastingMethodName];
|
|
61
|
+
if (forecastingMethod)
|
|
62
|
+
return forecastingMethod;
|
|
63
|
+
throw new Error(`Unsupported forecasting method: ${forecastingMethodName}`);
|
|
64
|
+
}
|
|
65
|
+
get transformer() {
|
|
66
|
+
const pathExpression = (0, import_assert.assertEx)(this.config.jsonPathExpression, "Missing jsonPathExpression in config");
|
|
67
|
+
return getJsonPathTransformer(pathExpression);
|
|
68
|
+
}
|
|
69
|
+
async getPayloadsInWindow(startTimestamp, stopTimestamp) {
|
|
70
|
+
const addresses = this.config.witnessAddresses;
|
|
71
|
+
const payload_schemas = [(0, import_assert.assertEx)(this.config.witnessSchema, "Missing witnessSchema in config")];
|
|
72
|
+
const payloads = [];
|
|
73
|
+
const archivist = (0, import_archivist_model.asArchivistInstance)(await this.readArchivist(), "Unable to resolve archivist");
|
|
74
|
+
const bwDiviner = (0, import_diviner_model.asDivinerInstance)((await this.resolve(this.config.boundWitnessDiviner)).pop(), "Unable to resolve boundWitnessDiviner");
|
|
75
|
+
const limit = this.batchLimit;
|
|
76
|
+
const witnessSchema = (0, import_assert.assertEx)(this.config.witnessSchema, "Missing witnessSchema in config");
|
|
77
|
+
let timestamp = stopTimestamp;
|
|
78
|
+
let more = true;
|
|
79
|
+
while (more || payloads.length < this.maxTrainingLength) {
|
|
80
|
+
const query = { addresses, limit, payload_schemas, schema: import_diviner_boundwitness_model.BoundWitnessDivinerQuerySchema, timestamp };
|
|
81
|
+
const boundWitnesses = (await bwDiviner.divine([query])).filter(
|
|
82
|
+
(bw) => bw.timestamp && bw.timestamp >= startTimestamp && bw.timestamp <= stopTimestamp
|
|
83
|
+
);
|
|
84
|
+
if (boundWitnesses.length === 0)
|
|
85
|
+
break;
|
|
86
|
+
timestamp = boundWitnesses.map((bw) => bw.timestamp).filter(import_exists.exists).reduce((a, b) => Math.min(a, b), Number.MAX_SAFE_INTEGER);
|
|
87
|
+
if (timestamp === Number.MAX_SAFE_INTEGER)
|
|
88
|
+
break;
|
|
89
|
+
more = boundWitnesses.length === limit;
|
|
90
|
+
const hashes = boundWitnesses.map((bw) => bw.payload_hashes[bw.payload_schemas.findIndex((s) => s === witnessSchema)]).filter(import_exists.exists);
|
|
91
|
+
if (hashes.length !== 0) {
|
|
92
|
+
const batchPayloads = (await archivist.get(hashes)).filter(import_exists.exists);
|
|
93
|
+
payloads.push(...batchPayloads);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return payloads;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
100
|
+
0 && (module.exports = {
|
|
101
|
+
MemoryForecastingDiviner
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/MemoryForecastingDiviner.ts"],"sourcesContent":["export * from './MemoryForecastingDiviner'\n","import { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDivinerQueryPayload, BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport { AbstractForecastingDiviner, ForecastingDivinerParams } from '@xyo-network/diviner-forecasting-abstract'\nimport {\n arimaForecastingMethod,\n arimaForecastingName,\n seasonalArimaForecastingMethod,\n seasonalArimaForecastingName,\n} from '@xyo-network/diviner-forecasting-method-arima'\nimport { ForecastingDivinerConfigSchema, ForecastingMethod, PayloadValueTransformer } from '@xyo-network/diviner-forecasting-model'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport { Payload } from '@xyo-network/payload-model'\nimport { value } from 'jsonpath'\n\nexport type SupportedForecastingType = typeof arimaForecastingName | typeof seasonalArimaForecastingName\n\nconst getJsonPathTransformer = (pathExpression: string): PayloadValueTransformer => {\n const transformer = (x: Payload): number => {\n const ret = value(x, pathExpression)\n if (typeof ret === 'number') return ret\n throw new Error('Parsed invalid payload value')\n }\n return transformer\n}\n\nexport class MemoryForecastingDiviner<\n TParams extends ForecastingDivinerParams = ForecastingDivinerParams,\n> extends AbstractForecastingDiviner<TParams> {\n static override configSchemas = [ForecastingDivinerConfigSchema]\n\n protected static readonly forecastingMethodDict: Record<SupportedForecastingType, ForecastingMethod> = {\n arimaForecasting: arimaForecastingMethod,\n seasonalArimaForecasting: seasonalArimaForecastingMethod,\n }\n\n /**\n * The max number of records to search during the batch query\n */\n protected readonly batchLimit = 1_000\n\n // TODO: Inject via config\n protected readonly maxTrainingLength = 10_000\n\n protected override get forecastingMethod(): ForecastingMethod {\n const forecastingMethodName = assertEx(this.config.forecastingMethod, 'Missing forecastingMethod in config') as SupportedForecastingType\n const forecastingMethod = MemoryForecastingDiviner.forecastingMethodDict[forecastingMethodName]\n if (forecastingMethod) return forecastingMethod\n throw new Error(`Unsupported forecasting method: ${forecastingMethodName}`)\n }\n\n protected override get transformer(): PayloadValueTransformer {\n const pathExpression = assertEx(this.config.jsonPathExpression, 'Missing jsonPathExpression in config')\n return getJsonPathTransformer(pathExpression)\n }\n\n protected override async getPayloadsInWindow(startTimestamp: number, stopTimestamp: number): Promise<Payload[]> {\n const addresses = this.config.witnessAddresses\n const payload_schemas = [assertEx(this.config.witnessSchema, 'Missing witnessSchema in config')]\n const payloads: Payload[] = []\n const archivist = asArchivistInstance(await this.readArchivist(), 'Unable to resolve archivist')\n const bwDiviner = asDivinerInstance((await this.resolve(this.config.boundWitnessDiviner)).pop(), 'Unable to resolve boundWitnessDiviner')\n const limit = this.batchLimit\n const witnessSchema = assertEx(this.config.witnessSchema, 'Missing witnessSchema in config')\n let timestamp = stopTimestamp\n let more = true\n\n // TODO: Window size vs sample size\n // Loop until there are no more BWs to process or we've got enough payloads to satisfy the training window\n while (more || payloads.length < this.maxTrainingLength) {\n const query: BoundWitnessDivinerQueryPayload = { addresses, limit, payload_schemas, schema: BoundWitnessDivinerQuerySchema, timestamp }\n const boundWitnesses = ((await bwDiviner.divine([query])) as BoundWitness[]).filter(\n (bw) => bw.timestamp && bw.timestamp >= startTimestamp && bw.timestamp <= stopTimestamp,\n )\n if (boundWitnesses.length === 0) break\n\n // Update the timestamp value for the next batch\n timestamp = boundWitnesses\n .map((bw) => bw.timestamp)\n .filter(exists)\n .reduce((a, b) => Math.min(a, b), Number.MAX_SAFE_INTEGER)\n if (timestamp === Number.MAX_SAFE_INTEGER) break\n\n // Set the more flag to false if there are fewer documents returned than the batch size\n more = boundWitnesses.length === limit\n\n // Get the corresponding payload hashes from the BWs\n const hashes = boundWitnesses.map((bw) => bw.payload_hashes[bw.payload_schemas.findIndex((s) => s === witnessSchema)]).filter(exists)\n\n // Get the payloads corresponding to the BW hashes from the archivist\n if (hashes.length !== 0) {\n const batchPayloads = (await archivist.get(hashes)).filter(exists)\n payloads.push(...batchPayloads)\n }\n }\n return payloads\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyB;AACzB,oBAAuB;AACvB,6BAAoC;AAEpC,wCAAgF;AAChF,0CAAqE;AACrE,8CAKO;AACP,uCAA2F;AAC3F,2BAAkC;AAElC,sBAAsB;AAItB,IAAM,yBAAyB,CAAC,mBAAoD;AAClF,QAAM,cAAc,CAAC,MAAuB;AAC1C,UAAM,UAAM,uBAAM,GAAG,cAAc;AACnC,QAAI,OAAO,QAAQ;AAAU,aAAO;AACpC,UAAM,IAAI,MAAM,8BAA8B;AAAA,EAChD;AACA,SAAO;AACT;AAEO,IAAM,2BAAN,MAAM,kCAEH,+DAAoC;AAAA,EAC5C,OAAgB,gBAAgB,CAAC,+DAA8B;AAAA,EAE/D,OAA0B,wBAA6E;AAAA,IACrG,kBAAkB;AAAA,IAClB,0BAA0B;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA,EAKmB,aAAa;AAAA;AAAA,EAGb,oBAAoB;AAAA,EAEvC,IAAuB,oBAAuC;AAC5D,UAAM,4BAAwB,wBAAS,KAAK,OAAO,mBAAmB,qCAAqC;AAC3G,UAAM,oBAAoB,0BAAyB,sBAAsB,qBAAqB;AAC9F,QAAI;AAAmB,aAAO;AAC9B,UAAM,IAAI,MAAM,mCAAmC,qBAAqB,EAAE;AAAA,EAC5E;AAAA,EAEA,IAAuB,cAAuC;AAC5D,UAAM,qBAAiB,wBAAS,KAAK,OAAO,oBAAoB,sCAAsC;AACtG,WAAO,uBAAuB,cAAc;AAAA,EAC9C;AAAA,EAEA,MAAyB,oBAAoB,gBAAwB,eAA2C;AAC9G,UAAM,YAAY,KAAK,OAAO;AAC9B,UAAM,kBAAkB,KA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2
|
+
import { assertEx } from "@xylabs/assert";
|
|
3
|
+
import { exists } from "@xylabs/exists";
|
|
4
|
+
import { asArchivistInstance } from "@xyo-network/archivist-model";
|
|
5
|
+
import { BoundWitnessDivinerQuerySchema } from "@xyo-network/diviner-boundwitness-model";
|
|
6
|
+
import { AbstractForecastingDiviner } from "@xyo-network/diviner-forecasting-abstract";
|
|
7
|
+
import {
|
|
8
|
+
arimaForecastingMethod,
|
|
9
|
+
seasonalArimaForecastingMethod
|
|
10
|
+
} from "@xyo-network/diviner-forecasting-method-arima";
|
|
11
|
+
import { ForecastingDivinerConfigSchema } from "@xyo-network/diviner-forecasting-model";
|
|
12
|
+
import { asDivinerInstance } from "@xyo-network/diviner-model";
|
|
13
|
+
import { value } from "jsonpath";
|
|
14
|
+
var getJsonPathTransformer = (pathExpression) => {
|
|
15
|
+
const transformer = (x) => {
|
|
16
|
+
const ret = value(x, pathExpression);
|
|
17
|
+
if (typeof ret === "number")
|
|
18
|
+
return ret;
|
|
19
|
+
throw new Error("Parsed invalid payload value");
|
|
20
|
+
};
|
|
21
|
+
return transformer;
|
|
22
|
+
};
|
|
23
|
+
var MemoryForecastingDiviner = class _MemoryForecastingDiviner extends AbstractForecastingDiviner {
|
|
24
|
+
static configSchemas = [ForecastingDivinerConfigSchema];
|
|
25
|
+
static forecastingMethodDict = {
|
|
26
|
+
arimaForecasting: arimaForecastingMethod,
|
|
27
|
+
seasonalArimaForecasting: seasonalArimaForecastingMethod
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The max number of records to search during the batch query
|
|
31
|
+
*/
|
|
32
|
+
batchLimit = 1e3;
|
|
33
|
+
// TODO: Inject via config
|
|
34
|
+
maxTrainingLength = 1e4;
|
|
35
|
+
get forecastingMethod() {
|
|
36
|
+
const forecastingMethodName = assertEx(this.config.forecastingMethod, "Missing forecastingMethod in config");
|
|
37
|
+
const forecastingMethod = _MemoryForecastingDiviner.forecastingMethodDict[forecastingMethodName];
|
|
38
|
+
if (forecastingMethod)
|
|
39
|
+
return forecastingMethod;
|
|
40
|
+
throw new Error(`Unsupported forecasting method: ${forecastingMethodName}`);
|
|
41
|
+
}
|
|
42
|
+
get transformer() {
|
|
43
|
+
const pathExpression = assertEx(this.config.jsonPathExpression, "Missing jsonPathExpression in config");
|
|
44
|
+
return getJsonPathTransformer(pathExpression);
|
|
45
|
+
}
|
|
46
|
+
async getPayloadsInWindow(startTimestamp, stopTimestamp) {
|
|
47
|
+
const addresses = this.config.witnessAddresses;
|
|
48
|
+
const payload_schemas = [assertEx(this.config.witnessSchema, "Missing witnessSchema in config")];
|
|
49
|
+
const payloads = [];
|
|
50
|
+
const archivist = asArchivistInstance(await this.readArchivist(), "Unable to resolve archivist");
|
|
51
|
+
const bwDiviner = asDivinerInstance((await this.resolve(this.config.boundWitnessDiviner)).pop(), "Unable to resolve boundWitnessDiviner");
|
|
52
|
+
const limit = this.batchLimit;
|
|
53
|
+
const witnessSchema = assertEx(this.config.witnessSchema, "Missing witnessSchema in config");
|
|
54
|
+
let timestamp = stopTimestamp;
|
|
55
|
+
let more = true;
|
|
56
|
+
while (more || payloads.length < this.maxTrainingLength) {
|
|
57
|
+
const query = { addresses, limit, payload_schemas, schema: BoundWitnessDivinerQuerySchema, timestamp };
|
|
58
|
+
const boundWitnesses = (await bwDiviner.divine([query])).filter(
|
|
59
|
+
(bw) => bw.timestamp && bw.timestamp >= startTimestamp && bw.timestamp <= stopTimestamp
|
|
60
|
+
);
|
|
61
|
+
if (boundWitnesses.length === 0)
|
|
62
|
+
break;
|
|
63
|
+
timestamp = boundWitnesses.map((bw) => bw.timestamp).filter(exists).reduce((a, b) => Math.min(a, b), Number.MAX_SAFE_INTEGER);
|
|
64
|
+
if (timestamp === Number.MAX_SAFE_INTEGER)
|
|
65
|
+
break;
|
|
66
|
+
more = boundWitnesses.length === limit;
|
|
67
|
+
const hashes = boundWitnesses.map((bw) => bw.payload_hashes[bw.payload_schemas.findIndex((s) => s === witnessSchema)]).filter(exists);
|
|
68
|
+
if (hashes.length !== 0) {
|
|
69
|
+
const batchPayloads = (await archivist.get(hashes)).filter(exists);
|
|
70
|
+
payloads.push(...batchPayloads);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return payloads;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
MemoryForecastingDiviner
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/MemoryForecastingDiviner.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { asArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessDivinerQueryPayload, BoundWitnessDivinerQuerySchema } from '@xyo-network/diviner-boundwitness-model'\nimport { AbstractForecastingDiviner, ForecastingDivinerParams } from '@xyo-network/diviner-forecasting-abstract'\nimport {\n arimaForecastingMethod,\n arimaForecastingName,\n seasonalArimaForecastingMethod,\n seasonalArimaForecastingName,\n} from '@xyo-network/diviner-forecasting-method-arima'\nimport { ForecastingDivinerConfigSchema, ForecastingMethod, PayloadValueTransformer } from '@xyo-network/diviner-forecasting-model'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport { Payload } from '@xyo-network/payload-model'\nimport { value } from 'jsonpath'\n\nexport type SupportedForecastingType = typeof arimaForecastingName | typeof seasonalArimaForecastingName\n\nconst getJsonPathTransformer = (pathExpression: string): PayloadValueTransformer => {\n const transformer = (x: Payload): number => {\n const ret = value(x, pathExpression)\n if (typeof ret === 'number') return ret\n throw new Error('Parsed invalid payload value')\n }\n return transformer\n}\n\nexport class MemoryForecastingDiviner<\n TParams extends ForecastingDivinerParams = ForecastingDivinerParams,\n> extends AbstractForecastingDiviner<TParams> {\n static override configSchemas = [ForecastingDivinerConfigSchema]\n\n protected static readonly forecastingMethodDict: Record<SupportedForecastingType, ForecastingMethod> = {\n arimaForecasting: arimaForecastingMethod,\n seasonalArimaForecasting: seasonalArimaForecastingMethod,\n }\n\n /**\n * The max number of records to search during the batch query\n */\n protected readonly batchLimit = 1_000\n\n // TODO: Inject via config\n protected readonly maxTrainingLength = 10_000\n\n protected override get forecastingMethod(): ForecastingMethod {\n const forecastingMethodName = assertEx(this.config.forecastingMethod, 'Missing forecastingMethod in config') as SupportedForecastingType\n const forecastingMethod = MemoryForecastingDiviner.forecastingMethodDict[forecastingMethodName]\n if (forecastingMethod) return forecastingMethod\n throw new Error(`Unsupported forecasting method: ${forecastingMethodName}`)\n }\n\n protected override get transformer(): PayloadValueTransformer {\n const pathExpression = assertEx(this.config.jsonPathExpression, 'Missing jsonPathExpression in config')\n return getJsonPathTransformer(pathExpression)\n }\n\n protected override async getPayloadsInWindow(startTimestamp: number, stopTimestamp: number): Promise<Payload[]> {\n const addresses = this.config.witnessAddresses\n const payload_schemas = [assertEx(this.config.witnessSchema, 'Missing witnessSchema in config')]\n const payloads: Payload[] = []\n const archivist = asArchivistInstance(await this.readArchivist(), 'Unable to resolve archivist')\n const bwDiviner = asDivinerInstance((await this.resolve(this.config.boundWitnessDiviner)).pop(), 'Unable to resolve boundWitnessDiviner')\n const limit = this.batchLimit\n const witnessSchema = assertEx(this.config.witnessSchema, 'Missing witnessSchema in config')\n let timestamp = stopTimestamp\n let more = true\n\n // TODO: Window size vs sample size\n // Loop until there are no more BWs to process or we've got enough payloads to satisfy the training window\n while (more || payloads.length < this.maxTrainingLength) {\n const query: BoundWitnessDivinerQueryPayload = { addresses, limit, payload_schemas, schema: BoundWitnessDivinerQuerySchema, timestamp }\n const boundWitnesses = ((await bwDiviner.divine([query])) as BoundWitness[]).filter(\n (bw) => bw.timestamp && bw.timestamp >= startTimestamp && bw.timestamp <= stopTimestamp,\n )\n if (boundWitnesses.length === 0) break\n\n // Update the timestamp value for the next batch\n timestamp = boundWitnesses\n .map((bw) => bw.timestamp)\n .filter(exists)\n .reduce((a, b) => Math.min(a, b), Number.MAX_SAFE_INTEGER)\n if (timestamp === Number.MAX_SAFE_INTEGER) break\n\n // Set the more flag to false if there are fewer documents returned than the batch size\n more = boundWitnesses.length === limit\n\n // Get the corresponding payload hashes from the BWs\n const hashes = boundWitnesses.map((bw) => bw.payload_hashes[bw.payload_schemas.findIndex((s) => s === witnessSchema)]).filter(exists)\n\n // Get the payloads corresponding to the BW hashes from the archivist\n if (hashes.length !== 0) {\n const batchPayloads = (await archivist.get(hashes)).filter(exists)\n payloads.push(...batchPayloads)\n }\n }\n return payloads\n }\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,2BAA2B;AAEpC,SAA0C,sCAAsC;AAChF,SAAS,kCAA4D;AACrE;AAAA,EACE;AAAA,EAEA;AAAA,OAEK;AACP,SAAS,sCAAkF;AAC3F,SAAS,yBAAyB;AAElC,SAAS,aAAa;AAItB,IAAM,yBAAyB,CAAC,mBAAoD;AAClF,QAAM,cAAc,CAAC,MAAuB;AAC1C,UAAM,MAAM,MAAM,GAAG,cAAc;AACnC,QAAI,OAAO,QAAQ;AAAU,aAAO;AACpC,UAAM,IAAI,MAAM,8BAA8B;AAAA,EAChD;AACA,SAAO;AACT;AAEO,IAAM,2BAAN,MAAM,kCAEH,2BAAoC;AAAA,EAC5C,OAAgB,gBAAgB,CAAC,8BAA8B;AAAA,EAE/D,OAA0B,wBAA6E;AAAA,IACrG,kBAAkB;AAAA,IAClB,0BAA0B;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA,EAKmB,aAAa;AAAA;AAAA,EAGb,oBAAoB;AAAA,EAEvC,IAAuB,oBAAuC;AAC5D,UAAM,wBAAwB,SAAS,KAAK,OAAO,mBAAmB,qCAAqC;AAC3G,UAAM,oBAAoB,0BAAyB,sBAAsB,qBAAqB;AAC9F,QAAI;AAAmB,aAAO;AAC9B,UAAM,IAAI,MAAM,mCAAmC,qBAAqB,EAAE;AAAA,EAC5E;AAAA,EAEA,IAAuB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M,GAAG,OAAO,MAAM;AACjE,iBAAS,KAAK,GAAG,aAAa;AAAA,MAChC;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -10,46 +10,60 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xylabs/assert": "^2.
|
|
14
|
-
"@xylabs/exists": "^2.
|
|
15
|
-
"@xyo-network/archivist-model": "~2.
|
|
16
|
-
"@xyo-network/boundwitness-model": "~2.
|
|
17
|
-
"@xyo-network/diviner-boundwitness-model": "~2.
|
|
18
|
-
"@xyo-network/diviner-forecasting-abstract": "~2.
|
|
19
|
-
"@xyo-network/diviner-forecasting-method-arima": "~2.
|
|
20
|
-
"@xyo-network/diviner-forecasting-model": "~2.
|
|
21
|
-
"@xyo-network/diviner-model": "~2.
|
|
22
|
-
"@xyo-network/payload-model": "~2.
|
|
13
|
+
"@xylabs/assert": "^2.10.7",
|
|
14
|
+
"@xylabs/exists": "^2.10.7",
|
|
15
|
+
"@xyo-network/archivist-model": "~2.73.0",
|
|
16
|
+
"@xyo-network/boundwitness-model": "~2.73.0",
|
|
17
|
+
"@xyo-network/diviner-boundwitness-model": "~2.73.0",
|
|
18
|
+
"@xyo-network/diviner-forecasting-abstract": "~2.73.0",
|
|
19
|
+
"@xyo-network/diviner-forecasting-method-arima": "~2.73.0",
|
|
20
|
+
"@xyo-network/diviner-forecasting-model": "~2.73.0",
|
|
21
|
+
"@xyo-network/diviner-model": "~2.73.0",
|
|
22
|
+
"@xyo-network/payload-model": "~2.73.0",
|
|
23
23
|
"jsonpath": "^1.1.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/jsonpath": "^0.2.0",
|
|
27
|
-
"@xylabs/ts-scripts-yarn3": "^2.19.
|
|
28
|
-
"@xylabs/tsconfig": "^2.19.
|
|
27
|
+
"@xylabs/ts-scripts-yarn3": "^2.19.5",
|
|
28
|
+
"@xylabs/tsconfig": "^2.19.5",
|
|
29
|
+
"publint": "^0.2.2",
|
|
30
|
+
"tsup": "^7.2.0",
|
|
29
31
|
"typescript": "^5.2.2"
|
|
30
32
|
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"package-compile": "tsup && publint",
|
|
35
|
+
"package-recompile": "tsup && publint"
|
|
36
|
+
},
|
|
31
37
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
32
|
-
"browser": "dist/esm/index.js",
|
|
33
38
|
"docs": "dist/docs.json",
|
|
39
|
+
"types": "dist/index.d.ts",
|
|
34
40
|
"exports": {
|
|
35
41
|
".": {
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
},
|
|
40
|
-
"browser": {
|
|
41
|
-
"import": "./dist/esm/index.js",
|
|
42
|
-
"require": "./dist/cjs/index.js"
|
|
42
|
+
"require": {
|
|
43
|
+
"types": "./dist/index.d.ts",
|
|
44
|
+
"default": "./dist/index.js"
|
|
43
45
|
},
|
|
44
|
-
"
|
|
46
|
+
"import": {
|
|
47
|
+
"types": "./dist/index.d.mts",
|
|
48
|
+
"default": "./dist/index.mjs"
|
|
49
|
+
}
|
|
45
50
|
},
|
|
46
51
|
"./dist/docs.json": {
|
|
47
52
|
"default": "./dist/docs.json"
|
|
48
53
|
},
|
|
54
|
+
"./cjs": {
|
|
55
|
+
"default": "./dist/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./docs": {
|
|
58
|
+
"default": "./dist/docs.json"
|
|
59
|
+
},
|
|
60
|
+
"./esm": {
|
|
61
|
+
"default": "./dist/index.mjs"
|
|
62
|
+
},
|
|
49
63
|
"./package.json": "./package.json"
|
|
50
64
|
},
|
|
51
|
-
"main": "dist/
|
|
52
|
-
"module": "dist/
|
|
65
|
+
"main": "dist/index.js",
|
|
66
|
+
"module": "dist/index.mjs",
|
|
53
67
|
"homepage": "https://xyo.network",
|
|
54
68
|
"license": "LGPL-3.0",
|
|
55
69
|
"publishConfig": {
|
|
@@ -60,6 +74,5 @@
|
|
|
60
74
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
61
75
|
},
|
|
62
76
|
"sideEffects": false,
|
|
63
|
-
"
|
|
64
|
-
"version": "2.72.9"
|
|
77
|
+
"version": "2.73.0"
|
|
65
78
|
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup'
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line import/no-default-export
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
bundle: true,
|
|
6
|
+
cjsInterop: true,
|
|
7
|
+
clean: true,
|
|
8
|
+
dts: {
|
|
9
|
+
entry: ['src/index.ts'],
|
|
10
|
+
},
|
|
11
|
+
entry: ['src/index.ts'],
|
|
12
|
+
format: ['cjs', 'esm'],
|
|
13
|
+
sourcemap: true,
|
|
14
|
+
splitting: false,
|
|
15
|
+
tsconfig: 'tsconfig.json',
|
|
16
|
+
})
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MemoryForecastingDiviner = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const assert_1 = require("@xylabs/assert");
|
|
6
|
-
const exists_1 = require("@xylabs/exists");
|
|
7
|
-
const archivist_model_1 = require("@xyo-network/archivist-model");
|
|
8
|
-
const diviner_boundwitness_model_1 = require("@xyo-network/diviner-boundwitness-model");
|
|
9
|
-
const diviner_forecasting_abstract_1 = require("@xyo-network/diviner-forecasting-abstract");
|
|
10
|
-
const diviner_forecasting_method_arima_1 = require("@xyo-network/diviner-forecasting-method-arima");
|
|
11
|
-
const diviner_forecasting_model_1 = require("@xyo-network/diviner-forecasting-model");
|
|
12
|
-
const diviner_model_1 = require("@xyo-network/diviner-model");
|
|
13
|
-
const jsonpath_1 = require("jsonpath");
|
|
14
|
-
const getJsonPathTransformer = (pathExpression) => {
|
|
15
|
-
const transformer = (x) => {
|
|
16
|
-
const ret = (0, jsonpath_1.value)(x, pathExpression);
|
|
17
|
-
if (typeof ret === 'number')
|
|
18
|
-
return ret;
|
|
19
|
-
throw new Error('Parsed invalid payload value');
|
|
20
|
-
};
|
|
21
|
-
return transformer;
|
|
22
|
-
};
|
|
23
|
-
class MemoryForecastingDiviner extends diviner_forecasting_abstract_1.AbstractForecastingDiviner {
|
|
24
|
-
constructor() {
|
|
25
|
-
super(...arguments);
|
|
26
|
-
/**
|
|
27
|
-
* The max number of records to search during the batch query
|
|
28
|
-
*/
|
|
29
|
-
this.batchLimit = 1000;
|
|
30
|
-
// TODO: Inject via config
|
|
31
|
-
this.maxTrainingLength = 10000;
|
|
32
|
-
}
|
|
33
|
-
get forecastingMethod() {
|
|
34
|
-
const forecastingMethodName = (0, assert_1.assertEx)(this.config.forecastingMethod, 'Missing forecastingMethod in config');
|
|
35
|
-
const forecastingMethod = MemoryForecastingDiviner.forecastingMethodDict[forecastingMethodName];
|
|
36
|
-
if (forecastingMethod)
|
|
37
|
-
return forecastingMethod;
|
|
38
|
-
throw new Error(`Unsupported forecasting method: ${forecastingMethodName}`);
|
|
39
|
-
}
|
|
40
|
-
get transformer() {
|
|
41
|
-
const pathExpression = (0, assert_1.assertEx)(this.config.jsonPathExpression, 'Missing jsonPathExpression in config');
|
|
42
|
-
return getJsonPathTransformer(pathExpression);
|
|
43
|
-
}
|
|
44
|
-
getPayloadsInWindow(startTimestamp, stopTimestamp) {
|
|
45
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const addresses = this.config.witnessAddresses;
|
|
47
|
-
const payload_schemas = [(0, assert_1.assertEx)(this.config.witnessSchema, 'Missing witnessSchema in config')];
|
|
48
|
-
const payloads = [];
|
|
49
|
-
const archivist = (0, archivist_model_1.asArchivistInstance)(yield this.readArchivist(), 'Unable to resolve archivist');
|
|
50
|
-
const bwDiviner = (0, diviner_model_1.asDivinerInstance)((yield this.resolve(this.config.boundWitnessDiviner)).pop(), 'Unable to resolve boundWitnessDiviner');
|
|
51
|
-
const limit = this.batchLimit;
|
|
52
|
-
const witnessSchema = (0, assert_1.assertEx)(this.config.witnessSchema, 'Missing witnessSchema in config');
|
|
53
|
-
let timestamp = stopTimestamp;
|
|
54
|
-
let more = true;
|
|
55
|
-
// TODO: Window size vs sample size
|
|
56
|
-
// Loop until there are no more BWs to process or we've got enough payloads to satisfy the training window
|
|
57
|
-
while (more || payloads.length < this.maxTrainingLength) {
|
|
58
|
-
const query = { addresses, limit, payload_schemas, schema: diviner_boundwitness_model_1.BoundWitnessDivinerQuerySchema, timestamp };
|
|
59
|
-
const boundWitnesses = (yield bwDiviner.divine([query])).filter((bw) => bw.timestamp && bw.timestamp >= startTimestamp && bw.timestamp <= stopTimestamp);
|
|
60
|
-
if (boundWitnesses.length === 0)
|
|
61
|
-
break;
|
|
62
|
-
// Update the timestamp value for the next batch
|
|
63
|
-
timestamp = boundWitnesses
|
|
64
|
-
.map((bw) => bw.timestamp)
|
|
65
|
-
.filter(exists_1.exists)
|
|
66
|
-
.reduce((a, b) => Math.min(a, b), Number.MAX_SAFE_INTEGER);
|
|
67
|
-
if (timestamp === Number.MAX_SAFE_INTEGER)
|
|
68
|
-
break;
|
|
69
|
-
// Set the more flag to false if there are fewer documents returned than the batch size
|
|
70
|
-
more = boundWitnesses.length === limit;
|
|
71
|
-
// Get the corresponding payload hashes from the BWs
|
|
72
|
-
const hashes = boundWitnesses.map((bw) => bw.payload_hashes[bw.payload_schemas.findIndex((s) => s === witnessSchema)]).filter(exists_1.exists);
|
|
73
|
-
// Get the payloads corresponding to the BW hashes from the archivist
|
|
74
|
-
if (hashes.length !== 0) {
|
|
75
|
-
const batchPayloads = (yield archivist.get(hashes)).filter(exists_1.exists);
|
|
76
|
-
payloads.push(...batchPayloads);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return payloads;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.MemoryForecastingDiviner = MemoryForecastingDiviner;
|
|
84
|
-
MemoryForecastingDiviner.configSchemas = [diviner_forecasting_model_1.ForecastingDivinerConfigSchema];
|
|
85
|
-
MemoryForecastingDiviner.forecastingMethodDict = {
|
|
86
|
-
arimaForecasting: diviner_forecasting_method_arima_1.arimaForecastingMethod,
|
|
87
|
-
seasonalArimaForecasting: diviner_forecasting_method_arima_1.seasonalArimaForecastingMethod,
|
|
88
|
-
};
|
|
89
|
-
//# sourceMappingURL=MemoryForecastingDiviner.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryForecastingDiviner.js","sourceRoot":"","sources":["../../src/MemoryForecastingDiviner.ts"],"names":[],"mappings":";;;;AAAA,2CAAyC;AACzC,2CAAuC;AACvC,kEAAkE;AAElE,wFAAyH;AACzH,4FAAgH;AAChH,oGAKsD;AACtD,sFAAmI;AACnI,8DAA8D;AAE9D,uCAAgC;AAIhC,MAAM,sBAAsB,GAAG,CAAC,cAAsB,EAA2B,EAAE;IACjF,MAAM,WAAW,GAAG,CAAC,CAAU,EAAU,EAAE;QACzC,MAAM,GAAG,GAAG,IAAA,gBAAK,EAAC,CAAC,EAAE,cAAc,CAAC,CAAA;QACpC,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,OAAO,GAAG,CAAA;QACvC,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;IACjD,CAAC,CAAA;IACD,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAED,MAAa,wBAEX,SAAQ,yDAAmC;IAF7C;;QAUE;;WAEG;QACgB,eAAU,GAAG,IAAK,CAAA;QAErC,0BAA0B;QACP,sBAAiB,GAAG,KAAM,CAAA;IAuD/C,CAAC;IArDC,IAAuB,iBAAiB;QACtC,MAAM,qBAAqB,GAAG,IAAA,iBAAQ,EAAC,IAAI,CAAC,MAAM,CAAC,iBAAi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,MAAM,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,eAAM,CAAC,CAAA;oBAClE,QAAQ,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAA;iBAChC;aACF;YACD,OAAO,QAAQ,CAAA;QACjB,CAAC;KAAA;;AAtEH,4DAuEC;AApEiB,sCAAa,GAAG,CAAC,0DAA8B,CAAC,AAAnC,CAAmC;AAEtC,8CAAqB,GAAwD;IACrG,gBAAgB,EAAE,yDAAsB;IACxC,wBAAwB,EAAE,iEAA8B;CACzD,AAH8C,CAG9C"}
|
package/dist/cjs/index.js
DELETED
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,qEAA0C"}
|