@xyo-network/diviner-forecasting-memory 7.2.3 → 7.3.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/neutral/index.d.ts +1 -1
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +2 -88
- package/dist/neutral/index.mjs.map +3 -3
- package/package.json +9 -15
- package/dist/neutral/MemoryForecastingDiviner.d.ts +0 -22
- package/dist/neutral/MemoryForecastingDiviner.d.ts.map +0 -1
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from '@xyo-network/diviner-forecasting/memory';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,yCAAyC,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,89 +1,3 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
|
|
3
|
-
import { AbstractForecastingDiviner } from "@xyo-network/diviner-forecasting-abstract";
|
|
4
|
-
import {
|
|
5
|
-
arimaForecastingMethod,
|
|
6
|
-
seasonalArimaForecastingMethod
|
|
7
|
-
} from "@xyo-network/diviner-forecasting-method-arima";
|
|
8
|
-
import { ForecastingDivinerConfigSchema } from "@xyo-network/diviner-forecasting-model";
|
|
9
|
-
import { asArchivistInstance } from "@xyo-network/sdk/archivist-model";
|
|
10
|
-
import { BoundWitnessDivinerQuerySchema } from "@xyo-network/sdk/diviner-boundwitness/model";
|
|
11
|
-
import { asDivinerInstance } from "@xyo-network/sdk/diviner-model";
|
|
12
|
-
import { JSONPath } from "jsonpath-plus";
|
|
13
|
-
var getJsonPathTransformer = (pathExpression) => {
|
|
14
|
-
return (x) => {
|
|
15
|
-
const ret = JSONPath({ path: pathExpression, json: x })[0];
|
|
16
|
-
if (typeof ret === "number") return ret;
|
|
17
|
-
throw new Error("Parsed invalid payload value");
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
var defaultBatchLimit = 1e3;
|
|
21
|
-
var defaultMaxTrainingLength = 1e4;
|
|
22
|
-
var MemoryForecastingDiviner = class _MemoryForecastingDiviner extends AbstractForecastingDiviner {
|
|
23
|
-
static configSchemas = [...super.configSchemas, ForecastingDivinerConfigSchema];
|
|
24
|
-
static defaultConfigSchema = ForecastingDivinerConfigSchema;
|
|
25
|
-
static forecastingMethodDict = {
|
|
26
|
-
arimaForecasting: arimaForecastingMethod,
|
|
27
|
-
seasonalArimaForecasting: seasonalArimaForecastingMethod
|
|
28
|
-
};
|
|
29
|
-
get boundWitnessDiviner() {
|
|
30
|
-
return assertEx(this.config.boundWitnessDiviner, () => "No boundWitnessDiviner configured");
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* The max number of records to search during the batch query
|
|
34
|
-
*/
|
|
35
|
-
get batchLimit() {
|
|
36
|
-
return this.config.batchLimit ?? defaultBatchLimit;
|
|
37
|
-
}
|
|
38
|
-
get forecastingMethod() {
|
|
39
|
-
const forecastingMethodName = assertEx(this.config.forecastingMethod, () => "Missing forecastingMethod in config");
|
|
40
|
-
const forecastingMethod = _MemoryForecastingDiviner.forecastingMethodDict[forecastingMethodName];
|
|
41
|
-
if (forecastingMethod) return forecastingMethod;
|
|
42
|
-
throw new Error(`Unsupported forecasting method: ${forecastingMethodName}`);
|
|
43
|
-
}
|
|
44
|
-
get maxTrainingLength() {
|
|
45
|
-
return this.config.maxTrainingLength ?? defaultMaxTrainingLength;
|
|
46
|
-
}
|
|
47
|
-
get transformer() {
|
|
48
|
-
const pathExpression = assertEx(this.config.jsonPathExpression, () => "Missing jsonPathExpression in config");
|
|
49
|
-
return getJsonPathTransformer(pathExpression);
|
|
50
|
-
}
|
|
51
|
-
async getPayloadsInWindow(_startTimestamp, _stopTimestamp) {
|
|
52
|
-
const addresses = this.config.witnessAddresses;
|
|
53
|
-
const payload_schemas = [assertEx(this.config.witnessSchema, () => "Missing witnessSchema in config")];
|
|
54
|
-
const payloads = [];
|
|
55
|
-
const archivist = asArchivistInstance(await this.archivistInstance(), () => "Unable to resolve archivist", { required: true });
|
|
56
|
-
const bwDiviner = asDivinerInstance(
|
|
57
|
-
await this.resolve(this.boundWitnessDiviner),
|
|
58
|
-
"Unable to resolve boundWitnessDiviner"
|
|
59
|
-
);
|
|
60
|
-
const limit = this.batchLimit;
|
|
61
|
-
const witnessSchema = assertEx(this.config.witnessSchema, () => "Missing witnessSchema in config");
|
|
62
|
-
let more = true;
|
|
63
|
-
while (more || payloads.length < this.maxTrainingLength) {
|
|
64
|
-
const query = {
|
|
65
|
-
addresses,
|
|
66
|
-
limit,
|
|
67
|
-
payload_schemas,
|
|
68
|
-
schema: BoundWitnessDivinerQuerySchema
|
|
69
|
-
};
|
|
70
|
-
const boundWitnesses = (await bwDiviner.divine([query])).filter(
|
|
71
|
-
// TODO; Replace with sequence
|
|
72
|
-
// bw => bw.$timestamp && bw.$timestamp >= startTimestamp && bw.$timestamp <= stopTimestamp,
|
|
73
|
-
(_) => true
|
|
74
|
-
);
|
|
75
|
-
if (boundWitnesses.length === 0) break;
|
|
76
|
-
more = boundWitnesses.length === limit;
|
|
77
|
-
const hashes = boundWitnesses.map((bw) => bw.payload_hashes[bw.payload_schemas.indexOf(witnessSchema)]).filter(exists);
|
|
78
|
-
if (hashes.length > 0) {
|
|
79
|
-
const batchPayloads = (await archivist.get(hashes)).filter(exists);
|
|
80
|
-
payloads.push(...batchPayloads);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return payloads;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
export {
|
|
87
|
-
MemoryForecastingDiviner
|
|
88
|
-
};
|
|
1
|
+
// src/index.ts
|
|
2
|
+
export * from "@xyo-network/diviner-forecasting/memory";
|
|
89
3
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";AACA,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["// Compatibility shim: this package re-exports from @xyo-network/diviner-forecasting/memory.\nexport * from '@xyo-network/diviner-forecasting/memory'\n"],
|
|
5
|
+
"mappings": ";AACA,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/diviner-forecasting-memory",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -34,30 +34,24 @@
|
|
|
34
34
|
"README.md"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@xyo-network/
|
|
38
|
-
"jsonpath-plus": "~10.4.0",
|
|
39
|
-
"@xyo-network/diviner-forecasting-abstract": "~7.2.3",
|
|
40
|
-
"@xyo-network/diviner-forecasting-model": "~7.2.3",
|
|
41
|
-
"@xyo-network/diviner-forecasting-method-arima": "~7.2.3",
|
|
42
|
-
"@xyo-network/sdk": "~7.2.3"
|
|
37
|
+
"@xyo-network/diviner-forecasting": "~7.3.0"
|
|
43
38
|
},
|
|
44
39
|
"devDependencies": {
|
|
45
|
-
"@ariestools/sdk": "~8.1.
|
|
46
|
-
"@ariestools/toolchain": "~
|
|
47
|
-
"@ariestools/tsconfig": "~
|
|
40
|
+
"@ariestools/sdk": "~8.1.9",
|
|
41
|
+
"@ariestools/toolchain": "~9.1.1",
|
|
42
|
+
"@ariestools/tsconfig": "~9.1.1",
|
|
48
43
|
"@opentelemetry/api": "~1.9.1",
|
|
49
|
-
"
|
|
44
|
+
"@xyo-network/sdk-protocol": "~7.3.1",
|
|
45
|
+
"eslint": "~10.9.0",
|
|
50
46
|
"eslint-import-resolver-typescript": "~4.4.5",
|
|
51
47
|
"typescript": "~6.0.3",
|
|
52
48
|
"zod": "~4.4.3"
|
|
53
49
|
},
|
|
54
|
-
"peerDependencies": {
|
|
55
|
-
"@ariestools/sdk": "^8.1"
|
|
56
|
-
},
|
|
57
50
|
"engines": {
|
|
58
51
|
"node": "^24"
|
|
59
52
|
},
|
|
60
53
|
"publishConfig": {
|
|
61
54
|
"access": "public"
|
|
62
|
-
}
|
|
55
|
+
},
|
|
56
|
+
"deprecated": "Use @xyo-network/diviner-forecasting/memory instead. This package is a compatibility shim only and will not receive further updates."
|
|
63
57
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ForecastingDivinerParams } from '@xyo-network/diviner-forecasting-abstract';
|
|
2
|
-
import { AbstractForecastingDiviner } from '@xyo-network/diviner-forecasting-abstract';
|
|
3
|
-
import type { arimaForecastingName, seasonalArimaForecastingName } from '@xyo-network/diviner-forecasting-method-arima';
|
|
4
|
-
import type { ForecastingMethod, PayloadValueTransformer } from '@xyo-network/diviner-forecasting-model';
|
|
5
|
-
import type { ModuleIdentifier } from '@xyo-network/sdk/module-model';
|
|
6
|
-
import type { Payload, Schema } from '@xyo-network/sdk-protocol';
|
|
7
|
-
export type SupportedForecastingType = typeof arimaForecastingName | typeof seasonalArimaForecastingName;
|
|
8
|
-
export declare class MemoryForecastingDiviner<TParams extends ForecastingDivinerParams = ForecastingDivinerParams> extends AbstractForecastingDiviner<TParams> {
|
|
9
|
-
static readonly configSchemas: Schema[];
|
|
10
|
-
static readonly defaultConfigSchema: Schema;
|
|
11
|
-
protected static readonly forecastingMethodDict: Record<SupportedForecastingType, ForecastingMethod>;
|
|
12
|
-
get boundWitnessDiviner(): ModuleIdentifier;
|
|
13
|
-
/**
|
|
14
|
-
* The max number of records to search during the batch query
|
|
15
|
-
*/
|
|
16
|
-
protected get batchLimit(): number;
|
|
17
|
-
protected get forecastingMethod(): ForecastingMethod;
|
|
18
|
-
protected get maxTrainingLength(): number;
|
|
19
|
-
protected get transformer(): PayloadValueTransformer;
|
|
20
|
-
protected getPayloadsInWindow(_startTimestamp: number, _stopTimestamp: number): Promise<Payload[]>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=MemoryForecastingDiviner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryForecastingDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryForecastingDiviner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAA;AACzF,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAA;AACtF,OAAO,KAAK,EACV,oBAAoB,EACpB,4BAA4B,EAC7B,MAAM,+CAA+C,CAAA;AAKtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAOxG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AACrE,OAAO,KAAK,EACI,OAAO,EAAE,MAAM,EAC9B,MAAM,2BAA2B,CAAA;AAGlC,MAAM,MAAM,wBAAwB,GAAG,OAAO,oBAAoB,GAAG,OAAO,4BAA4B,CAAA;AAcxG,qBAAa,wBAAwB,CACnC,OAAO,SAAS,wBAAwB,GAAG,wBAAwB,CACnE,SAAQ,0BAA0B,CAAC,OAAO,CAAC;IAC3C,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA2D;IAC3G,gBAAyB,mBAAmB,EAAE,MAAM,CAAiC;IAErF,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC,wBAAwB,EAAE,iBAAiB,CAAC,CAGnG;IAED,IAAI,mBAAmB,IAAI,gBAAgB,CAE1C;IAED;;OAEG;IACH,SAAS,KAAK,UAAU,IAAI,MAAM,CAEjC;IAED,cAAuB,iBAAiB,IAAI,iBAAiB,CAK5D;IAED,SAAS,KAAK,iBAAiB,IAAI,MAAM,CAExC;IAED,cAAuB,WAAW,IAAI,uBAAuB,CAG5D;cAEwB,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAmDlH"}
|