@xyo-network/diviner-forecasting-memory 2.106.0 → 2.107.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/browser/MemoryForecastingDiviner.d.cts +24 -27
- package/dist/browser/MemoryForecastingDiviner.d.cts.map +1 -1
- package/dist/browser/MemoryForecastingDiviner.d.mts +24 -27
- package/dist/browser/MemoryForecastingDiviner.d.mts.map +1 -1
- package/dist/browser/MemoryForecastingDiviner.d.ts +24 -27
- package/dist/browser/MemoryForecastingDiviner.d.ts.map +1 -1
- package/dist/browser/index.cjs +1 -123
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +1 -92
- package/dist/browser/index.js.map +1 -1
- package/dist/neutral/MemoryForecastingDiviner.d.cts +24 -27
- package/dist/neutral/MemoryForecastingDiviner.d.cts.map +1 -1
- package/dist/neutral/MemoryForecastingDiviner.d.mts +24 -27
- package/dist/neutral/MemoryForecastingDiviner.d.mts.map +1 -1
- package/dist/neutral/MemoryForecastingDiviner.d.ts +24 -27
- package/dist/neutral/MemoryForecastingDiviner.d.ts.map +1 -1
- package/dist/neutral/index.cjs +1 -123
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.js +1 -92
- package/dist/neutral/index.js.map +1 -1
- package/dist/node/MemoryForecastingDiviner.d.cts +24 -27
- package/dist/node/MemoryForecastingDiviner.d.cts.map +1 -1
- package/dist/node/MemoryForecastingDiviner.d.mts +24 -27
- package/dist/node/MemoryForecastingDiviner.d.mts.map +1 -1
- package/dist/node/MemoryForecastingDiviner.d.ts +24 -27
- package/dist/node/MemoryForecastingDiviner.d.ts.map +1 -1
- package/dist/node/index.cjs +1 -130
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +1 -96
- package/dist/node/index.js.map +1 -1
- package/package.json +12 -12
package/dist/neutral/index.js
CHANGED
|
@@ -1,93 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// src/MemoryForecastingDiviner.ts
|
|
5
|
-
import { assertEx } from "@xylabs/assert";
|
|
6
|
-
import { exists } from "@xylabs/exists";
|
|
7
|
-
import { asArchivistInstance } from "@xyo-network/archivist-model";
|
|
8
|
-
import { BoundWitnessDivinerQuerySchema } from "@xyo-network/diviner-boundwitness-model";
|
|
9
|
-
import { AbstractForecastingDiviner } from "@xyo-network/diviner-forecasting-abstract";
|
|
10
|
-
import { arimaForecastingMethod, seasonalArimaForecastingMethod } 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 jsonpath from "jsonpath";
|
|
14
|
-
var getJsonPathTransformer = /* @__PURE__ */ __name((pathExpression) => {
|
|
15
|
-
const transformer = /* @__PURE__ */ __name((x) => {
|
|
16
|
-
const ret = jsonpath.value(x, pathExpression);
|
|
17
|
-
if (typeof ret === "number") return ret;
|
|
18
|
-
throw new Error("Parsed invalid payload value");
|
|
19
|
-
}, "transformer");
|
|
20
|
-
return transformer;
|
|
21
|
-
}, "getJsonPathTransformer");
|
|
22
|
-
var MemoryForecastingDiviner = class _MemoryForecastingDiviner extends AbstractForecastingDiviner {
|
|
23
|
-
static {
|
|
24
|
-
__name(this, "MemoryForecastingDiviner");
|
|
25
|
-
}
|
|
26
|
-
static configSchemas = [
|
|
27
|
-
...super.configSchemas,
|
|
28
|
-
ForecastingDivinerConfigSchema
|
|
29
|
-
];
|
|
30
|
-
static defaultConfigSchema = ForecastingDivinerConfigSchema;
|
|
31
|
-
static forecastingMethodDict = {
|
|
32
|
-
arimaForecasting: arimaForecastingMethod,
|
|
33
|
-
seasonalArimaForecasting: seasonalArimaForecastingMethod
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* The max number of records to search during the batch query
|
|
37
|
-
*/
|
|
38
|
-
batchLimit = 1e3;
|
|
39
|
-
// TODO: Inject via config
|
|
40
|
-
maxTrainingLength = 1e4;
|
|
41
|
-
get boundWitnessDiviner() {
|
|
42
|
-
return assertEx(this.config.boundWitnessDiviner, () => "No boundWitnessDiviner configured");
|
|
43
|
-
}
|
|
44
|
-
get forecastingMethod() {
|
|
45
|
-
const forecastingMethodName = assertEx(this.config.forecastingMethod, () => "Missing forecastingMethod in config");
|
|
46
|
-
const forecastingMethod = _MemoryForecastingDiviner.forecastingMethodDict[forecastingMethodName];
|
|
47
|
-
if (forecastingMethod) return forecastingMethod;
|
|
48
|
-
throw new Error(`Unsupported forecasting method: ${forecastingMethodName}`);
|
|
49
|
-
}
|
|
50
|
-
get transformer() {
|
|
51
|
-
const pathExpression = assertEx(this.config.jsonPathExpression, () => "Missing jsonPathExpression in config");
|
|
52
|
-
return getJsonPathTransformer(pathExpression);
|
|
53
|
-
}
|
|
54
|
-
async getPayloadsInWindow(startTimestamp, stopTimestamp) {
|
|
55
|
-
const addresses = this.config.witnessAddresses;
|
|
56
|
-
const payload_schemas = [
|
|
57
|
-
assertEx(this.config.witnessSchema, () => "Missing witnessSchema in config")
|
|
58
|
-
];
|
|
59
|
-
const payloads = [];
|
|
60
|
-
const archivist = asArchivistInstance(await this.archivistInstance(), () => "Unable to resolve archivist");
|
|
61
|
-
const bwDiviner = asDivinerInstance((await this.resolve(this.boundWitnessDiviner)).pop(), "Unable to resolve boundWitnessDiviner");
|
|
62
|
-
const limit = this.batchLimit;
|
|
63
|
-
const witnessSchema = assertEx(this.config.witnessSchema, () => "Missing witnessSchema in config");
|
|
64
|
-
let timestamp = stopTimestamp;
|
|
65
|
-
let more = true;
|
|
66
|
-
while (more || payloads.length < this.maxTrainingLength) {
|
|
67
|
-
const query = {
|
|
68
|
-
addresses,
|
|
69
|
-
limit,
|
|
70
|
-
payload_schemas,
|
|
71
|
-
schema: BoundWitnessDivinerQuerySchema,
|
|
72
|
-
timestamp
|
|
73
|
-
};
|
|
74
|
-
const boundWitnesses = (await bwDiviner.divine([
|
|
75
|
-
query
|
|
76
|
-
])).filter((bw) => bw.timestamp && bw.timestamp >= startTimestamp && bw.timestamp <= stopTimestamp);
|
|
77
|
-
if (boundWitnesses.length === 0) break;
|
|
78
|
-
timestamp = boundWitnesses.map((bw) => bw.timestamp).filter(exists).reduce((a, b) => Math.min(a, b), Number.MAX_SAFE_INTEGER);
|
|
79
|
-
if (timestamp === Number.MAX_SAFE_INTEGER) break;
|
|
80
|
-
more = boundWitnesses.length === limit;
|
|
81
|
-
const hashes = boundWitnesses.map((bw) => bw.payload_hashes[bw.payload_schemas.indexOf(witnessSchema)]).filter(exists);
|
|
82
|
-
if (hashes.length > 0) {
|
|
83
|
-
const batchPayloads = (await archivist.get(hashes)).filter(exists);
|
|
84
|
-
payloads.push(...batchPayloads);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return payloads;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
export {
|
|
91
|
-
MemoryForecastingDiviner
|
|
92
|
-
};
|
|
1
|
+
var S=Object.defineProperty;var a=(e,i)=>S(e,"name",{value:i,configurable:!0});import{assertEx as n}from"@xylabs/assert";import{exists as m}from"@xylabs/exists";import{asArchivistInstance as x}from"@xyo-network/archivist-model";import{BoundWitnessDivinerQuerySchema as D}from"@xyo-network/diviner-boundwitness-model";import{AbstractForecastingDiviner as y}from"@xyo-network/diviner-forecasting-abstract";import{arimaForecastingMethod as A,seasonalArimaForecastingMethod as W}from"@xyo-network/diviner-forecasting-method-arima";import{ForecastingDivinerConfigSchema as p}from"@xyo-network/diviner-forecasting-model";import{asDivinerInstance as F}from"@xyo-network/diviner-model";import _ from"jsonpath";var I=a(e=>a(s=>{let o=_.value(s,e);if(typeof o=="number")return o;throw new Error("Parsed invalid payload value")},"transformer"),"getJsonPathTransformer"),l=class e extends y{static{a(this,"MemoryForecastingDiviner")}static configSchemas=[...super.configSchemas,p];static defaultConfigSchema=p;static forecastingMethodDict={arimaForecasting:A,seasonalArimaForecasting:W};batchLimit=1e3;maxTrainingLength=1e4;get boundWitnessDiviner(){return n(this.config.boundWitnessDiviner,()=>"No boundWitnessDiviner configured")}get forecastingMethod(){let i=n(this.config.forecastingMethod,()=>"Missing forecastingMethod in config"),s=e.forecastingMethodDict[i];if(s)return s;throw new Error(`Unsupported forecasting method: ${i}`)}get transformer(){let i=n(this.config.jsonPathExpression,()=>"Missing jsonPathExpression in config");return I(i)}async getPayloadsInWindow(i,s){let o=this.config.witnessAddresses,u=[n(this.config.witnessSchema,()=>"Missing witnessSchema in config")],c=[],v=x(await this.archivistInstance(),()=>"Unable to resolve archivist"),b=F((await this.resolve(this.boundWitnessDiviner)).pop(),"Unable to resolve boundWitnessDiviner"),f=this.batchLimit,M=n(this.config.witnessSchema,()=>"Missing witnessSchema in config"),h=s,g=!0;for(;g||c.length<this.maxTrainingLength;){let w={addresses:o,limit:f,payload_schemas:u,schema:D,timestamp:h},r=(await b.divine([w])).filter(t=>t.timestamp&&t.timestamp>=i&&t.timestamp<=s);if(r.length===0||(h=r.map(t=>t.timestamp).filter(m).reduce((t,E)=>Math.min(t,E),Number.MAX_SAFE_INTEGER),h===Number.MAX_SAFE_INTEGER))break;g=r.length===f;let d=r.map(t=>t.payload_hashes[t.payload_schemas.indexOf(M)]).filter(m);if(d.length>0){let t=(await v.get(d)).filter(m);c.push(...t)}}return c}};export{l as MemoryForecastingDiviner};
|
|
93
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +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 { BoundWitnessDivinerParams, 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, DivinerInstance } from '@xyo-network/diviner-model'\nimport { Payload, Schema } from '@xyo-network/payload-model'\nimport jsonpath 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 = jsonpath.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 readonly configSchemas: Schema[] = [...super.configSchemas, ForecastingDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = 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 = 1000\n\n // TODO: Inject via config\n protected readonly maxTrainingLength = 10_000\n\n get boundWitnessDiviner() {\n return assertEx(this.config.boundWitnessDiviner, () => 'No boundWitnessDiviner configured')\n }\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.archivistInstance(), () => 'Unable to resolve archivist')\n const bwDiviner = asDivinerInstance(\n (await this.resolve(this.boundWitnessDiviner)).pop(),\n 'Unable to resolve boundWitnessDiviner',\n ) as DivinerInstance<BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload, BoundWitness>\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])).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 // eslint-disable-next-line unicorn/no-array-reduce\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.indexOf(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":"
|
|
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 { BoundWitnessDivinerParams, 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, DivinerInstance } from '@xyo-network/diviner-model'\nimport { Payload, Schema } from '@xyo-network/payload-model'\nimport jsonpath 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 = jsonpath.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 readonly configSchemas: Schema[] = [...super.configSchemas, ForecastingDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = 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 = 1000\n\n // TODO: Inject via config\n protected readonly maxTrainingLength = 10_000\n\n get boundWitnessDiviner() {\n return assertEx(this.config.boundWitnessDiviner, () => 'No boundWitnessDiviner configured')\n }\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.archivistInstance(), () => 'Unable to resolve archivist')\n const bwDiviner = asDivinerInstance(\n (await this.resolve(this.boundWitnessDiviner)).pop(),\n 'Unable to resolve boundWitnessDiviner',\n ) as DivinerInstance<BoundWitnessDivinerParams, BoundWitnessDivinerQueryPayload, BoundWitness>\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])).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 // eslint-disable-next-line unicorn/no-array-reduce\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.indexOf(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":"+EAAA,OAASA,YAAAA,MAAgB,iBACzB,OAASC,UAAAA,MAAc,iBACvB,OAASC,uBAAAA,MAA2B,+BAEpC,OAAqEC,kCAAAA,MAAsC,0CAC3G,OAASC,8BAAAA,MAA4D,4CACrE,OACEC,0BAAAA,EAEAC,kCAAAA,MAEK,gDACP,OAASC,kCAAAA,MAAkF,yCAC3F,OAASC,qBAAAA,MAA0C,6BAEnD,OAAOC,MAAc,WAIrB,IAAMC,EAAyBC,EAACC,GACVD,EAACE,GAAAA,CACnB,IAAMC,EAAMC,EAASC,MAAMH,EAAGD,CAAAA,EAC9B,GAAI,OAAOE,GAAQ,SAAU,OAAOA,EACpC,MAAM,IAAIG,MAAM,8BAAA,CAClB,EAJoB,eADS,0BASlBC,EAAN,MAAMA,UAEHC,CAAAA,CA9BV,MA8BUA,CAAAA,EAAAA,iCACR,OAAyBC,cAA0B,IAAI,MAAMA,cAAeC,GAC5E,OAAyBC,oBAA8BD,EAEvD,OAA0BE,sBAA6E,CACrGC,iBAAkBC,EAClBC,yBAA0BC,CAC5B,EAKmBC,WAAa,IAGbC,kBAAoB,IAEvC,IAAIC,qBAAsB,CACxB,OAAOC,EAAS,KAAKC,OAAOF,oBAAqB,IAAM,mCAAA,CACzD,CAEA,IAAuBG,mBAAuC,CAC5D,IAAMC,EAAwBH,EAAS,KAAKC,OAAOC,kBAAmB,IAAM,qCAAA,EACtEA,EAAoBf,EAAyBK,sBAAsBW,CAAAA,EACzE,GAAID,EAAmB,OAAOA,EAC9B,MAAM,IAAIhB,MAAM,mCAAmCiB,CAAAA,EAAuB,CAC5E,CAEA,IAAuBC,aAAuC,CAC5D,IAAMvB,EAAiBmB,EAAS,KAAKC,OAAOI,mBAAoB,IAAM,sCAAA,EACtE,OAAO1B,EAAuBE,CAAAA,CAChC,CAEA,MAAyByB,oBAAoBC,EAAwBC,EAA2C,CAC9G,IAAMC,EAAY,KAAKR,OAAOS,iBACxBC,EAAkB,CAACX,EAAS,KAAKC,OAAOW,cAAe,IAAM,iCAAA,GAC7DC,EAAsB,CAAA,EACtBC,EAAYC,EAAoB,MAAM,KAAKC,kBAAiB,EAAI,IAAM,6BAAA,EACtEC,EAAYC,GACf,MAAM,KAAKC,QAAQ,KAAKpB,mBAAmB,GAAGqB,IAAG,EAClD,uCAAA,EAEIC,EAAQ,KAAKxB,WACbe,EAAgBZ,EAAS,KAAKC,OAAOW,cAAe,IAAM,iCAAA,EAC5DU,EAAYd,EACZe,EAAO,GAIX,KAAOA,GAAQV,EAASW,OAAS,KAAK1B,mBAAmB,CACvD,IAAM2B,EAAyC,CAAEhB,UAAAA,EAAWY,MAAAA,EAAOV,gBAAAA,EAAiBe,OAAQC,EAAgCL,UAAAA,CAAU,EAChIM,GAAkB,MAAMX,EAAUY,OAAO,CAACJ,EAAM,GAAGK,OACtDC,GAAOA,EAAGT,WAAaS,EAAGT,WAAaf,GAAkBwB,EAAGT,WAAad,CAAAA,EAU5E,GARIoB,EAAeJ,SAAW,IAG9BF,EAAYM,EACTI,IAAKD,GAAOA,EAAGT,SAAS,EACxBQ,OAAOG,CAAAA,EAEPC,OAAO,CAACC,EAAGC,IAAMC,KAAKC,IAAIH,EAAGC,CAAAA,EAAIG,OAAOC,gBAAgB,EACvDlB,IAAciB,OAAOC,kBAAkB,MAG3CjB,EAAOK,EAAeJ,SAAWH,EAGjC,IAAMoB,EAASb,EAAeI,IAAKD,GAAOA,EAAGW,eAAeX,EAAGpB,gBAAgBgC,QAAQ/B,CAAAA,CAAAA,CAAe,EAAEkB,OAAOG,CAAAA,EAG/G,GAAIQ,EAAOjB,OAAS,EAAG,CACrB,IAAMoB,GAAiB,MAAM9B,EAAU+B,IAAIJ,CAAAA,GAASX,OAAOG,CAAAA,EAC3DpB,EAASiC,KAAI,GAAIF,CAAAA,CACnB,CACF,CACA,OAAO/B,CACT,CACF","names":["assertEx","exists","asArchivistInstance","BoundWitnessDivinerQuerySchema","AbstractForecastingDiviner","arimaForecastingMethod","seasonalArimaForecastingMethod","ForecastingDivinerConfigSchema","asDivinerInstance","jsonpath","getJsonPathTransformer","__name","pathExpression","x","ret","jsonpath","value","Error","MemoryForecastingDiviner","AbstractForecastingDiviner","configSchemas","ForecastingDivinerConfigSchema","defaultConfigSchema","forecastingMethodDict","arimaForecasting","arimaForecastingMethod","seasonalArimaForecasting","seasonalArimaForecastingMethod","batchLimit","maxTrainingLength","boundWitnessDiviner","assertEx","config","forecastingMethod","forecastingMethodName","transformer","jsonPathExpression","getPayloadsInWindow","startTimestamp","stopTimestamp","addresses","witnessAddresses","payload_schemas","witnessSchema","payloads","archivist","asArchivistInstance","archivistInstance","bwDiviner","asDivinerInstance","resolve","pop","limit","timestamp","more","length","query","schema","BoundWitnessDivinerQuerySchema","boundWitnesses","divine","filter","bw","map","exists","reduce","a","b","Math","min","Number","MAX_SAFE_INTEGER","hashes","payload_hashes","indexOf","batchPayloads","get","push"]}
|
|
@@ -7,59 +7,56 @@ export declare class MemoryForecastingDiviner<TParams extends ForecastingDiviner
|
|
|
7
7
|
static readonly configSchemas: Schema[];
|
|
8
8
|
static readonly defaultConfigSchema: Schema;
|
|
9
9
|
protected static readonly forecastingMethodDict: Record<SupportedForecastingType, ForecastingMethod>;
|
|
10
|
-
/**
|
|
11
|
-
* The max number of records to search during the batch query
|
|
12
|
-
*/
|
|
13
10
|
protected readonly batchLimit = 1000;
|
|
14
11
|
protected readonly maxTrainingLength = 10000;
|
|
15
12
|
get boundWitnessDiviner(): import("@xyo-network/module-model").ObjectFilterOptions<import("@xyo-network/module-model").ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
16
|
-
account?: import("@xyo-network/account-model").AccountInstance | "random"
|
|
17
|
-
addToResolvers?: boolean
|
|
18
|
-
additionalSigners?: import("@xyo-network/account-model").AccountInstance[]
|
|
19
|
-
allowNameResolution?: boolean
|
|
13
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
14
|
+
addToResolvers?: boolean;
|
|
15
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
16
|
+
allowNameResolution?: boolean;
|
|
20
17
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
21
18
|
schema: "network.xyo.module.config";
|
|
22
19
|
}, "schema"> & {
|
|
23
20
|
schema: string;
|
|
24
21
|
};
|
|
25
|
-
ephemeralQueryAccountEnabled?: boolean
|
|
26
|
-
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[]
|
|
22
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
23
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
27
24
|
}, import("@xyo-network/module-model").ModuleEventData<object>>> | import("@xyo-network/module-model").AddressObjectFilter<import("@xyo-network/module-model").ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
28
|
-
account?: import("@xyo-network/account-model").AccountInstance | "random"
|
|
29
|
-
addToResolvers?: boolean
|
|
30
|
-
additionalSigners?: import("@xyo-network/account-model").AccountInstance[]
|
|
31
|
-
allowNameResolution?: boolean
|
|
25
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
26
|
+
addToResolvers?: boolean;
|
|
27
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
28
|
+
allowNameResolution?: boolean;
|
|
32
29
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
33
30
|
schema: "network.xyo.module.config";
|
|
34
31
|
}, "schema"> & {
|
|
35
32
|
schema: string;
|
|
36
33
|
};
|
|
37
|
-
ephemeralQueryAccountEnabled?: boolean
|
|
38
|
-
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[]
|
|
34
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
35
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
39
36
|
}, import("@xyo-network/module-model").ModuleEventData<object>>> | import("@xyo-network/module-model").NameObjectFilter<import("@xyo-network/module-model").ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
40
|
-
account?: import("@xyo-network/account-model").AccountInstance | "random"
|
|
41
|
-
addToResolvers?: boolean
|
|
42
|
-
additionalSigners?: import("@xyo-network/account-model").AccountInstance[]
|
|
43
|
-
allowNameResolution?: boolean
|
|
37
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
38
|
+
addToResolvers?: boolean;
|
|
39
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
40
|
+
allowNameResolution?: boolean;
|
|
44
41
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
45
42
|
schema: "network.xyo.module.config";
|
|
46
43
|
}, "schema"> & {
|
|
47
44
|
schema: string;
|
|
48
45
|
};
|
|
49
|
-
ephemeralQueryAccountEnabled?: boolean
|
|
50
|
-
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[]
|
|
46
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
47
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
51
48
|
}, import("@xyo-network/module-model").ModuleEventData<object>>> | import("@xyo-network/module-model").QueryObjectFilter<import("@xyo-network/module-model").ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
52
|
-
account?: import("@xyo-network/account-model").AccountInstance | "random"
|
|
53
|
-
addToResolvers?: boolean
|
|
54
|
-
additionalSigners?: import("@xyo-network/account-model").AccountInstance[]
|
|
55
|
-
allowNameResolution?: boolean
|
|
49
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
50
|
+
addToResolvers?: boolean;
|
|
51
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
52
|
+
allowNameResolution?: boolean;
|
|
56
53
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
57
54
|
schema: "network.xyo.module.config";
|
|
58
55
|
}, "schema"> & {
|
|
59
56
|
schema: string;
|
|
60
57
|
};
|
|
61
|
-
ephemeralQueryAccountEnabled?: boolean
|
|
62
|
-
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[]
|
|
58
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
59
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
63
60
|
}, import("@xyo-network/module-model").ModuleEventData<object>>>;
|
|
64
61
|
protected get forecastingMethod(): ForecastingMethod;
|
|
65
62
|
protected get transformer(): PayloadValueTransformer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryForecastingDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryForecastingDiviner.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAA;AAChH,OAAO,EAEL,oBAAoB,EAEpB,4BAA4B,EAC7B,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAAkC,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAEnI,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAG5D,MAAM,MAAM,wBAAwB,GAAG,OAAO,oBAAoB,GAAG,OAAO,4BAA4B,CAAA;AAWxG,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;
|
|
1
|
+
{"version":3,"file":"MemoryForecastingDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryForecastingDiviner.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAA;AAChH,OAAO,EAEL,oBAAoB,EAEpB,4BAA4B,EAC7B,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAAkC,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAEnI,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAG5D,MAAM,MAAM,wBAAwB,GAAG,OAAO,oBAAoB,GAAG,OAAO,4BAA4B,CAAA;AAWxG,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;IAKD,SAAS,CAAC,QAAQ,CAAC,UAAU,QAAO;IAGpC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,SAAS;IAE7C,IAAI,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEAEtB;IAED,cAAuB,iBAAiB,IAAI,iBAAiB,CAK5D;IAED,cAAuB,WAAW,IAAI,uBAAuB,CAG5D;cAEwB,mBAAmB,CAAC,cAAc,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CA6ChH"}
|
|
@@ -7,59 +7,56 @@ export declare class MemoryForecastingDiviner<TParams extends ForecastingDiviner
|
|
|
7
7
|
static readonly configSchemas: Schema[];
|
|
8
8
|
static readonly defaultConfigSchema: Schema;
|
|
9
9
|
protected static readonly forecastingMethodDict: Record<SupportedForecastingType, ForecastingMethod>;
|
|
10
|
-
/**
|
|
11
|
-
* The max number of records to search during the batch query
|
|
12
|
-
*/
|
|
13
10
|
protected readonly batchLimit = 1000;
|
|
14
11
|
protected readonly maxTrainingLength = 10000;
|
|
15
12
|
get boundWitnessDiviner(): import("@xyo-network/module-model").ObjectFilterOptions<import("@xyo-network/module-model").ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
16
|
-
account?: import("@xyo-network/account-model").AccountInstance | "random"
|
|
17
|
-
addToResolvers?: boolean
|
|
18
|
-
additionalSigners?: import("@xyo-network/account-model").AccountInstance[]
|
|
19
|
-
allowNameResolution?: boolean
|
|
13
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
14
|
+
addToResolvers?: boolean;
|
|
15
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
16
|
+
allowNameResolution?: boolean;
|
|
20
17
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
21
18
|
schema: "network.xyo.module.config";
|
|
22
19
|
}, "schema"> & {
|
|
23
20
|
schema: string;
|
|
24
21
|
};
|
|
25
|
-
ephemeralQueryAccountEnabled?: boolean
|
|
26
|
-
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[]
|
|
22
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
23
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
27
24
|
}, import("@xyo-network/module-model").ModuleEventData<object>>> | import("@xyo-network/module-model").AddressObjectFilter<import("@xyo-network/module-model").ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
28
|
-
account?: import("@xyo-network/account-model").AccountInstance | "random"
|
|
29
|
-
addToResolvers?: boolean
|
|
30
|
-
additionalSigners?: import("@xyo-network/account-model").AccountInstance[]
|
|
31
|
-
allowNameResolution?: boolean
|
|
25
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
26
|
+
addToResolvers?: boolean;
|
|
27
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
28
|
+
allowNameResolution?: boolean;
|
|
32
29
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
33
30
|
schema: "network.xyo.module.config";
|
|
34
31
|
}, "schema"> & {
|
|
35
32
|
schema: string;
|
|
36
33
|
};
|
|
37
|
-
ephemeralQueryAccountEnabled?: boolean
|
|
38
|
-
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[]
|
|
34
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
35
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
39
36
|
}, import("@xyo-network/module-model").ModuleEventData<object>>> | import("@xyo-network/module-model").NameObjectFilter<import("@xyo-network/module-model").ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
40
|
-
account?: import("@xyo-network/account-model").AccountInstance | "random"
|
|
41
|
-
addToResolvers?: boolean
|
|
42
|
-
additionalSigners?: import("@xyo-network/account-model").AccountInstance[]
|
|
43
|
-
allowNameResolution?: boolean
|
|
37
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
38
|
+
addToResolvers?: boolean;
|
|
39
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
40
|
+
allowNameResolution?: boolean;
|
|
44
41
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
45
42
|
schema: "network.xyo.module.config";
|
|
46
43
|
}, "schema"> & {
|
|
47
44
|
schema: string;
|
|
48
45
|
};
|
|
49
|
-
ephemeralQueryAccountEnabled?: boolean
|
|
50
|
-
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[]
|
|
46
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
47
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
51
48
|
}, import("@xyo-network/module-model").ModuleEventData<object>>> | import("@xyo-network/module-model").QueryObjectFilter<import("@xyo-network/module-model").ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
52
|
-
account?: import("@xyo-network/account-model").AccountInstance | "random"
|
|
53
|
-
addToResolvers?: boolean
|
|
54
|
-
additionalSigners?: import("@xyo-network/account-model").AccountInstance[]
|
|
55
|
-
allowNameResolution?: boolean
|
|
49
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
50
|
+
addToResolvers?: boolean;
|
|
51
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
52
|
+
allowNameResolution?: boolean;
|
|
56
53
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
57
54
|
schema: "network.xyo.module.config";
|
|
58
55
|
}, "schema"> & {
|
|
59
56
|
schema: string;
|
|
60
57
|
};
|
|
61
|
-
ephemeralQueryAccountEnabled?: boolean
|
|
62
|
-
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[]
|
|
58
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
59
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
63
60
|
}, import("@xyo-network/module-model").ModuleEventData<object>>>;
|
|
64
61
|
protected get forecastingMethod(): ForecastingMethod;
|
|
65
62
|
protected get transformer(): PayloadValueTransformer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryForecastingDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryForecastingDiviner.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAA;AAChH,OAAO,EAEL,oBAAoB,EAEpB,4BAA4B,EAC7B,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAAkC,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAEnI,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAG5D,MAAM,MAAM,wBAAwB,GAAG,OAAO,oBAAoB,GAAG,OAAO,4BAA4B,CAAA;AAWxG,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;
|
|
1
|
+
{"version":3,"file":"MemoryForecastingDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryForecastingDiviner.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAA;AAChH,OAAO,EAEL,oBAAoB,EAEpB,4BAA4B,EAC7B,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAAkC,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAEnI,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAG5D,MAAM,MAAM,wBAAwB,GAAG,OAAO,oBAAoB,GAAG,OAAO,4BAA4B,CAAA;AAWxG,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;IAKD,SAAS,CAAC,QAAQ,CAAC,UAAU,QAAO;IAGpC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,SAAS;IAE7C,IAAI,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEAEtB;IAED,cAAuB,iBAAiB,IAAI,iBAAiB,CAK5D;IAED,cAAuB,WAAW,IAAI,uBAAuB,CAG5D;cAEwB,mBAAmB,CAAC,cAAc,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CA6ChH"}
|
|
@@ -7,59 +7,56 @@ export declare class MemoryForecastingDiviner<TParams extends ForecastingDiviner
|
|
|
7
7
|
static readonly configSchemas: Schema[];
|
|
8
8
|
static readonly defaultConfigSchema: Schema;
|
|
9
9
|
protected static readonly forecastingMethodDict: Record<SupportedForecastingType, ForecastingMethod>;
|
|
10
|
-
/**
|
|
11
|
-
* The max number of records to search during the batch query
|
|
12
|
-
*/
|
|
13
10
|
protected readonly batchLimit = 1000;
|
|
14
11
|
protected readonly maxTrainingLength = 10000;
|
|
15
12
|
get boundWitnessDiviner(): import("@xyo-network/module-model").ObjectFilterOptions<import("@xyo-network/module-model").ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
16
|
-
account?: import("@xyo-network/account-model").AccountInstance | "random"
|
|
17
|
-
addToResolvers?: boolean
|
|
18
|
-
additionalSigners?: import("@xyo-network/account-model").AccountInstance[]
|
|
19
|
-
allowNameResolution?: boolean
|
|
13
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
14
|
+
addToResolvers?: boolean;
|
|
15
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
16
|
+
allowNameResolution?: boolean;
|
|
20
17
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
21
18
|
schema: "network.xyo.module.config";
|
|
22
19
|
}, "schema"> & {
|
|
23
20
|
schema: string;
|
|
24
21
|
};
|
|
25
|
-
ephemeralQueryAccountEnabled?: boolean
|
|
26
|
-
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[]
|
|
22
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
23
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
27
24
|
}, import("@xyo-network/module-model").ModuleEventData<object>>> | import("@xyo-network/module-model").AddressObjectFilter<import("@xyo-network/module-model").ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
28
|
-
account?: import("@xyo-network/account-model").AccountInstance | "random"
|
|
29
|
-
addToResolvers?: boolean
|
|
30
|
-
additionalSigners?: import("@xyo-network/account-model").AccountInstance[]
|
|
31
|
-
allowNameResolution?: boolean
|
|
25
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
26
|
+
addToResolvers?: boolean;
|
|
27
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
28
|
+
allowNameResolution?: boolean;
|
|
32
29
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
33
30
|
schema: "network.xyo.module.config";
|
|
34
31
|
}, "schema"> & {
|
|
35
32
|
schema: string;
|
|
36
33
|
};
|
|
37
|
-
ephemeralQueryAccountEnabled?: boolean
|
|
38
|
-
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[]
|
|
34
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
35
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
39
36
|
}, import("@xyo-network/module-model").ModuleEventData<object>>> | import("@xyo-network/module-model").NameObjectFilter<import("@xyo-network/module-model").ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
40
|
-
account?: import("@xyo-network/account-model").AccountInstance | "random"
|
|
41
|
-
addToResolvers?: boolean
|
|
42
|
-
additionalSigners?: import("@xyo-network/account-model").AccountInstance[]
|
|
43
|
-
allowNameResolution?: boolean
|
|
37
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
38
|
+
addToResolvers?: boolean;
|
|
39
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
40
|
+
allowNameResolution?: boolean;
|
|
44
41
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
45
42
|
schema: "network.xyo.module.config";
|
|
46
43
|
}, "schema"> & {
|
|
47
44
|
schema: string;
|
|
48
45
|
};
|
|
49
|
-
ephemeralQueryAccountEnabled?: boolean
|
|
50
|
-
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[]
|
|
46
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
47
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
51
48
|
}, import("@xyo-network/module-model").ModuleEventData<object>>> | import("@xyo-network/module-model").QueryObjectFilter<import("@xyo-network/module-model").ModuleInstance<import("@xylabs/object").BaseParamsFields & {
|
|
52
|
-
account?: import("@xyo-network/account-model").AccountInstance | "random"
|
|
53
|
-
addToResolvers?: boolean
|
|
54
|
-
additionalSigners?: import("@xyo-network/account-model").AccountInstance[]
|
|
55
|
-
allowNameResolution?: boolean
|
|
49
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
50
|
+
addToResolvers?: boolean;
|
|
51
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
52
|
+
allowNameResolution?: boolean;
|
|
56
53
|
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
57
54
|
schema: "network.xyo.module.config";
|
|
58
55
|
}, "schema"> & {
|
|
59
56
|
schema: string;
|
|
60
57
|
};
|
|
61
|
-
ephemeralQueryAccountEnabled?: boolean
|
|
62
|
-
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[]
|
|
58
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
59
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
63
60
|
}, import("@xyo-network/module-model").ModuleEventData<object>>>;
|
|
64
61
|
protected get forecastingMethod(): ForecastingMethod;
|
|
65
62
|
protected get transformer(): PayloadValueTransformer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryForecastingDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryForecastingDiviner.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAA;AAChH,OAAO,EAEL,oBAAoB,EAEpB,4BAA4B,EAC7B,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAAkC,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAEnI,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAG5D,MAAM,MAAM,wBAAwB,GAAG,OAAO,oBAAoB,GAAG,OAAO,4BAA4B,CAAA;AAWxG,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;
|
|
1
|
+
{"version":3,"file":"MemoryForecastingDiviner.d.ts","sourceRoot":"","sources":["../../src/MemoryForecastingDiviner.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAA;AAChH,OAAO,EAEL,oBAAoB,EAEpB,4BAA4B,EAC7B,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAAkC,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAEnI,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAG5D,MAAM,MAAM,wBAAwB,GAAG,OAAO,oBAAoB,GAAG,OAAO,4BAA4B,CAAA;AAWxG,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;IAKD,SAAS,CAAC,QAAQ,CAAC,UAAU,QAAO;IAGpC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,SAAS;IAE7C,IAAI,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEAEtB;IAED,cAAuB,iBAAiB,IAAI,iBAAiB,CAK5D;IAED,cAAuB,WAAW,IAAI,uBAAuB,CAG5D;cAEwB,mBAAmB,CAAC,cAAc,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CA6ChH"}
|
package/dist/node/index.cjs
CHANGED
|
@@ -1,131 +1,2 @@
|
|
|
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 __reflectGet = Reflect.get;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
11
|
-
var __export = (target, all) => {
|
|
12
|
-
for (var name in all)
|
|
13
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
-
};
|
|
15
|
-
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
-
for (let key of __getOwnPropNames(from))
|
|
18
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
-
}
|
|
21
|
-
return to;
|
|
22
|
-
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
-
mod
|
|
30
|
-
));
|
|
31
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
33
|
-
var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
|
|
34
|
-
|
|
35
|
-
// src/index.ts
|
|
36
|
-
var src_exports = {};
|
|
37
|
-
__export(src_exports, {
|
|
38
|
-
MemoryForecastingDiviner: () => MemoryForecastingDiviner
|
|
39
|
-
});
|
|
40
|
-
module.exports = __toCommonJS(src_exports);
|
|
41
|
-
|
|
42
|
-
// src/MemoryForecastingDiviner.ts
|
|
43
|
-
var import_assert = require("@xylabs/assert");
|
|
44
|
-
var import_exists = require("@xylabs/exists");
|
|
45
|
-
var import_archivist_model = require("@xyo-network/archivist-model");
|
|
46
|
-
var import_diviner_boundwitness_model = require("@xyo-network/diviner-boundwitness-model");
|
|
47
|
-
var import_diviner_forecasting_abstract = require("@xyo-network/diviner-forecasting-abstract");
|
|
48
|
-
var import_diviner_forecasting_method_arima = require("@xyo-network/diviner-forecasting-method-arima");
|
|
49
|
-
var import_diviner_forecasting_model = require("@xyo-network/diviner-forecasting-model");
|
|
50
|
-
var import_diviner_model = require("@xyo-network/diviner-model");
|
|
51
|
-
var import_jsonpath = __toESM(require("jsonpath"), 1);
|
|
52
|
-
var getJsonPathTransformer = /* @__PURE__ */ __name((pathExpression) => {
|
|
53
|
-
const transformer = /* @__PURE__ */ __name((x) => {
|
|
54
|
-
const ret = import_jsonpath.default.value(x, pathExpression);
|
|
55
|
-
if (typeof ret === "number") return ret;
|
|
56
|
-
throw new Error("Parsed invalid payload value");
|
|
57
|
-
}, "transformer");
|
|
58
|
-
return transformer;
|
|
59
|
-
}, "getJsonPathTransformer");
|
|
60
|
-
var _MemoryForecastingDiviner = class _MemoryForecastingDiviner extends import_diviner_forecasting_abstract.AbstractForecastingDiviner {
|
|
61
|
-
/**
|
|
62
|
-
* The max number of records to search during the batch query
|
|
63
|
-
*/
|
|
64
|
-
batchLimit = 1e3;
|
|
65
|
-
// TODO: Inject via config
|
|
66
|
-
maxTrainingLength = 1e4;
|
|
67
|
-
get boundWitnessDiviner() {
|
|
68
|
-
return (0, import_assert.assertEx)(this.config.boundWitnessDiviner, () => "No boundWitnessDiviner configured");
|
|
69
|
-
}
|
|
70
|
-
get forecastingMethod() {
|
|
71
|
-
const forecastingMethodName = (0, import_assert.assertEx)(this.config.forecastingMethod, () => "Missing forecastingMethod in config");
|
|
72
|
-
const forecastingMethod = _MemoryForecastingDiviner.forecastingMethodDict[forecastingMethodName];
|
|
73
|
-
if (forecastingMethod) return forecastingMethod;
|
|
74
|
-
throw new Error(`Unsupported forecasting method: ${forecastingMethodName}`);
|
|
75
|
-
}
|
|
76
|
-
get transformer() {
|
|
77
|
-
const pathExpression = (0, import_assert.assertEx)(this.config.jsonPathExpression, () => "Missing jsonPathExpression in config");
|
|
78
|
-
return getJsonPathTransformer(pathExpression);
|
|
79
|
-
}
|
|
80
|
-
async getPayloadsInWindow(startTimestamp, stopTimestamp) {
|
|
81
|
-
const addresses = this.config.witnessAddresses;
|
|
82
|
-
const payload_schemas = [
|
|
83
|
-
(0, import_assert.assertEx)(this.config.witnessSchema, () => "Missing witnessSchema in config")
|
|
84
|
-
];
|
|
85
|
-
const payloads = [];
|
|
86
|
-
const archivist = (0, import_archivist_model.asArchivistInstance)(await this.archivistInstance(), () => "Unable to resolve archivist");
|
|
87
|
-
const bwDiviner = (0, import_diviner_model.asDivinerInstance)((await this.resolve(this.boundWitnessDiviner)).pop(), "Unable to resolve boundWitnessDiviner");
|
|
88
|
-
const limit = this.batchLimit;
|
|
89
|
-
const witnessSchema = (0, import_assert.assertEx)(this.config.witnessSchema, () => "Missing witnessSchema in config");
|
|
90
|
-
let timestamp = stopTimestamp;
|
|
91
|
-
let more = true;
|
|
92
|
-
while (more || payloads.length < this.maxTrainingLength) {
|
|
93
|
-
const query = {
|
|
94
|
-
addresses,
|
|
95
|
-
limit,
|
|
96
|
-
payload_schemas,
|
|
97
|
-
schema: import_diviner_boundwitness_model.BoundWitnessDivinerQuerySchema,
|
|
98
|
-
timestamp
|
|
99
|
-
};
|
|
100
|
-
const boundWitnesses = (await bwDiviner.divine([
|
|
101
|
-
query
|
|
102
|
-
])).filter((bw) => bw.timestamp && bw.timestamp >= startTimestamp && bw.timestamp <= stopTimestamp);
|
|
103
|
-
if (boundWitnesses.length === 0) break;
|
|
104
|
-
timestamp = boundWitnesses.map((bw) => bw.timestamp).filter(import_exists.exists).reduce((a, b) => Math.min(a, b), Number.MAX_SAFE_INTEGER);
|
|
105
|
-
if (timestamp === Number.MAX_SAFE_INTEGER) break;
|
|
106
|
-
more = boundWitnesses.length === limit;
|
|
107
|
-
const hashes = boundWitnesses.map((bw) => bw.payload_hashes[bw.payload_schemas.indexOf(witnessSchema)]).filter(import_exists.exists);
|
|
108
|
-
if (hashes.length > 0) {
|
|
109
|
-
const batchPayloads = (await archivist.get(hashes)).filter(import_exists.exists);
|
|
110
|
-
payloads.push(...batchPayloads);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return payloads;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
__name(_MemoryForecastingDiviner, "MemoryForecastingDiviner");
|
|
117
|
-
__publicField(_MemoryForecastingDiviner, "configSchemas", [
|
|
118
|
-
...__superGet(_MemoryForecastingDiviner, _MemoryForecastingDiviner, "configSchemas"),
|
|
119
|
-
import_diviner_forecasting_model.ForecastingDivinerConfigSchema
|
|
120
|
-
]);
|
|
121
|
-
__publicField(_MemoryForecastingDiviner, "defaultConfigSchema", import_diviner_forecasting_model.ForecastingDivinerConfigSchema);
|
|
122
|
-
__publicField(_MemoryForecastingDiviner, "forecastingMethodDict", {
|
|
123
|
-
arimaForecasting: import_diviner_forecasting_method_arima.arimaForecastingMethod,
|
|
124
|
-
seasonalArimaForecasting: import_diviner_forecasting_method_arima.seasonalArimaForecastingMethod
|
|
125
|
-
});
|
|
126
|
-
var MemoryForecastingDiviner = _MemoryForecastingDiviner;
|
|
127
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
128
|
-
0 && (module.exports = {
|
|
129
|
-
MemoryForecastingDiviner
|
|
130
|
-
});
|
|
1
|
+
"use strict";var U=Object.create;var r=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var R=Reflect.get;var X=(s,t,i)=>t in s?r(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i;var m=(s,t)=>r(s,"name",{value:t,configurable:!0});var q=(s,t)=>{for(var i in t)r(s,i,{get:t[i],enumerable:!0})},x=(s,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of C(t))!G.call(s,a)&&a!==i&&r(s,a,{get:()=>t[a],enumerable:!(o=k(t,a))||o.enumerable});return s};var B=(s,t,i)=>(i=s!=null?U(S(s)):{},x(t||!s||!s.__esModule?r(i,"default",{value:s,enumerable:!0}):i,s)),F=s=>x(r({},"__esModule",{value:!0}),s);var f=(s,t,i)=>X(s,typeof t!="symbol"?t+"":t,i);var A=(s,t,i)=>R(S(s),i,t);var O={};q(O,{MemoryForecastingDiviner:()=>b});module.exports=F(O);var c=require("@xylabs/assert"),g=require("@xylabs/exists"),M=require("@xyo-network/archivist-model"),W=require("@xyo-network/diviner-boundwitness-model"),I=require("@xyo-network/diviner-forecasting-abstract"),d=require("@xyo-network/diviner-forecasting-method-arima"),u=require("@xyo-network/diviner-forecasting-model"),N=require("@xyo-network/diviner-model"),P=B(require("jsonpath"),1);var J=m(s=>m(i=>{let o=P.default.value(i,s);if(typeof o=="number")return o;throw new Error("Parsed invalid payload value")},"transformer"),"getJsonPathTransformer"),n=class n extends I.AbstractForecastingDiviner{batchLimit=1e3;maxTrainingLength=1e4;get boundWitnessDiviner(){return(0,c.assertEx)(this.config.boundWitnessDiviner,()=>"No boundWitnessDiviner configured")}get forecastingMethod(){let t=(0,c.assertEx)(this.config.forecastingMethod,()=>"Missing forecastingMethod in config"),i=n.forecastingMethodDict[t];if(i)return i;throw new Error(`Unsupported forecasting method: ${t}`)}get transformer(){let t=(0,c.assertEx)(this.config.jsonPathExpression,()=>"Missing jsonPathExpression in config");return J(t)}async getPayloadsInWindow(t,i){let o=this.config.witnessAddresses,a=[(0,c.assertEx)(this.config.witnessSchema,()=>"Missing witnessSchema in config")],p=[],D=(0,M.asArchivistInstance)(await this.archivistInstance(),()=>"Unable to resolve archivist"),y=(0,N.asDivinerInstance)((await this.resolve(this.boundWitnessDiviner)).pop(),"Unable to resolve boundWitnessDiviner"),v=this.batchLimit,L=(0,c.assertEx)(this.config.witnessSchema,()=>"Missing witnessSchema in config"),l=i,w=!0;for(;w||p.length<this.maxTrainingLength;){let T={addresses:o,limit:v,payload_schemas:a,schema:W.BoundWitnessDivinerQuerySchema,timestamp:l},h=(await y.divine([T])).filter(e=>e.timestamp&&e.timestamp>=t&&e.timestamp<=i);if(h.length===0||(l=h.map(e=>e.timestamp).filter(g.exists).reduce((e,j)=>Math.min(e,j),Number.MAX_SAFE_INTEGER),l===Number.MAX_SAFE_INTEGER))break;w=h.length===v;let E=h.map(e=>e.payload_hashes[e.payload_schemas.indexOf(L)]).filter(g.exists);if(E.length>0){let e=(await D.get(E)).filter(g.exists);p.push(...e)}}return p}};m(n,"MemoryForecastingDiviner"),f(n,"configSchemas",[...A(n,n,"configSchemas"),u.ForecastingDivinerConfigSchema]),f(n,"defaultConfigSchema",u.ForecastingDivinerConfigSchema),f(n,"forecastingMethodDict",{arimaForecasting:d.arimaForecastingMethod,seasonalArimaForecasting:d.seasonalArimaForecastingMethod});var b=n;0&&(module.exports={MemoryForecastingDiviner});
|
|
131
2
|
//# sourceMappingURL=index.cjs.map
|