@xyo-network/location-certainty-plugin 2.75.14 → 2.75.15

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.
Files changed (37) hide show
  1. package/dist/browser/Diviner/Diviner.cjs.map +1 -1
  2. package/dist/browser/Diviner/Diviner.d.cts +1 -1
  3. package/dist/browser/Diviner/Diviner.d.cts.map +1 -1
  4. package/dist/browser/Diviner/Diviner.d.mts +1 -1
  5. package/dist/browser/Diviner/Diviner.d.mts.map +1 -1
  6. package/dist/browser/Diviner/Diviner.d.ts +1 -1
  7. package/dist/browser/Diviner/Diviner.d.ts.map +1 -1
  8. package/dist/browser/Diviner/Diviner.js.map +1 -1
  9. package/dist/browser/Diviner/index.cjs.map +1 -1
  10. package/dist/browser/Diviner/index.js.map +1 -1
  11. package/dist/browser/Plugin.cjs.map +1 -1
  12. package/dist/browser/Plugin.d.cts +2 -2
  13. package/dist/browser/Plugin.d.mts +2 -2
  14. package/dist/browser/Plugin.d.ts +2 -2
  15. package/dist/browser/Plugin.js.map +1 -1
  16. package/dist/browser/index.cjs.map +1 -1
  17. package/dist/browser/index.js.map +1 -1
  18. package/dist/docs.json +794 -397
  19. package/dist/node/Diviner/Diviner.d.cts +1 -1
  20. package/dist/node/Diviner/Diviner.d.cts.map +1 -1
  21. package/dist/node/Diviner/Diviner.d.mts +1 -1
  22. package/dist/node/Diviner/Diviner.d.mts.map +1 -1
  23. package/dist/node/Diviner/Diviner.d.ts +1 -1
  24. package/dist/node/Diviner/Diviner.d.ts.map +1 -1
  25. package/dist/node/Diviner/Diviner.js.map +1 -1
  26. package/dist/node/Diviner/Diviner.mjs.map +1 -1
  27. package/dist/node/Diviner/index.js.map +1 -1
  28. package/dist/node/Diviner/index.mjs.map +1 -1
  29. package/dist/node/Plugin.d.cts +2 -2
  30. package/dist/node/Plugin.d.mts +2 -2
  31. package/dist/node/Plugin.d.ts +2 -2
  32. package/dist/node/Plugin.js.map +1 -1
  33. package/dist/node/Plugin.mjs.map +1 -1
  34. package/dist/node/index.js.map +1 -1
  35. package/dist/node/index.mjs.map +1 -1
  36. package/package.json +13 -12
  37. package/src/Diviner/Diviner.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  import { AbstractDiviner } from '@xyo-network/abstract-diviner';
2
2
  import { DivinerModule, DivinerParams } from '@xyo-network/diviner-model';
3
- import { AnyConfigSchema } from '@xyo-network/module';
3
+ import { AnyConfigSchema } from '@xyo-network/module-model';
4
4
  import { Payload } from '@xyo-network/payload-model';
5
5
  import { LocationCertaintyDivinerConfig } from './Config';
6
6
  export type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>;
@@ -1 +1 @@
1
- {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/Diviner/Diviner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAKzE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,8BAA8B,EAAwC,MAAM,UAAU,CAAA;AAE/F,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC,eAAe,CAAC,8BAA8B,CAAC,CAAC,CAAA;AAE3G,qBAAa,wBAAwB,CAAC,MAAM,SAAS,8BAA8B,GAAG,8BAA8B,CAClH,SAAQ,eAAe,CAAC,MAAM,CAC9B,YAAW,aAAa;IAExB,OAAgB,aAAa,oDAAyC;IACtE,OAAgB,YAAY,mCAA0B;IAGtD,OAAO,CAAC,MAAM,CAAC,aAAa;IAqB5B,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAkBpC,wHAAwH;cAC/F,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CA4BjF"}
1
+ {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/Diviner/Diviner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAKzE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,8BAA8B,EAAwC,MAAM,UAAU,CAAA;AAE/F,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC,eAAe,CAAC,8BAA8B,CAAC,CAAC,CAAA;AAE3G,qBAAa,wBAAwB,CAAC,MAAM,SAAS,8BAA8B,GAAG,8BAA8B,CAClH,SAAQ,eAAe,CAAC,MAAM,CAC9B,YAAW,aAAa;IAExB,OAAgB,aAAa,oDAAyC;IACtE,OAAgB,YAAY,mCAA0B;IAGtD,OAAO,CAAC,MAAM,CAAC,aAAa;IAqB5B,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAkBpC,wHAAwH;cAC/F,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CA4BjF"}
@@ -1,6 +1,6 @@
1
1
  import { AbstractDiviner } from '@xyo-network/abstract-diviner';
2
2
  import { DivinerModule, DivinerParams } from '@xyo-network/diviner-model';
3
- import { AnyConfigSchema } from '@xyo-network/module';
3
+ import { AnyConfigSchema } from '@xyo-network/module-model';
4
4
  import { Payload } from '@xyo-network/payload-model';
5
5
  import { LocationCertaintyDivinerConfig } from './Config';
6
6
  export type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>;
@@ -1 +1 @@
1
- {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/Diviner/Diviner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,E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W,aAAa;IAExB,OAAgB,aAAa,oDAAyC;IACtE,OAAgB,YAAY,mCAA0B;IAGtD,OAAO,CAAC,MAAM,CAAC,aAAa;IAqB5B,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAkBpC,wHAAwH;cAC/F,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CA4BjF"}
@@ -1,6 +1,6 @@
1
1
  import { AbstractDiviner } from '@xyo-network/abstract-diviner';
2
2
  import { DivinerModule, DivinerParams } from '@xyo-network/diviner-model';
3
- import { AnyConfigSchema } from '@xyo-network/module';
3
+ import { AnyConfigSchema } from '@xyo-network/module-model';
4
4
  import { Payload } from '@xyo-network/payload-model';
5
5
  import { LocationCertaintyDivinerConfig } from './Config';
6
6
  export type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>;
@@ -1 +1 @@
1
- {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/Diviner/Diviner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAKzE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,8BAA8B,EAAwC,MAAM,UAAU,CAAA;AAE/F,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC,eAAe,CAAC,8BAA8B,CAAC,CAAC,CAAA;AAE3G,qBAAa,wBAAwB,CAAC,MAAM,SAAS,8BAA8B,GAAG,8BAA8B,CAClH,SAAQ,eAAe,CAAC,MAAM,CAC9B,YAAW,aAAa;IAExB,OAAgB,aAAa,oDAAyC;IACtE,OAAgB,YAAY,mCAA0B;IAGtD,OAAO,CAAC,MAAM,CAAC,aAAa;IAqB5B,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAkBpC,wHAAwH;cAC/F,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CA4BjF"}
1
+ {"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/Diviner/Diviner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAKzE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,8BAA8B,EAAwC,MAAM,UAAU,CAAA;AAE/F,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC,eAAe,CAAC,8BAA8B,CAAC,CAAC,CAAA;AAE3G,qBAAa,wBAAwB,CAAC,MAAM,SAAS,8BAA8B,GAAG,8BAA8B,CAClH,SAAQ,eAAe,CAAC,MAAM,CAC9B,YAAW,aAAa;IAExB,OAAgB,aAAa,oDAAyC;IACtE,OAAgB,YAAY,mCAA0B;IAGtD,OAAO,CAAC,MAAM,CAAC,aAAa;IAqB5B,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAkBpC,wHAAwH;cAC/F,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CA4BjF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Diviner/Diviner.ts","../../../src/Diviner/Config.ts"],"sourcesContent":["import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAgC;AAGhC,8BAA+D;AAC/D,+CAA8F;AAC9F,qCAAgD;AAEhD,6BAA+B;;;ACFxB,IAAM,uCAA6E;;;ADSnF,IAAM,2BAAN,MAAM,kCACH,wCAEV;AAAA,EACE,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EACrE,OAAgB,eAAe;AAAA;AAAA,EAG/B,OAAe,cAAc,WAA0D;AACrF,WAAO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CAAiB,OAAO;AAAA,QACrD,SAAS,KAAK;AAAA,QACd,QAAQ;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AACD,YAAM,aAAc,MAAM,iBAAiB,QAAQ;AAEnD,YAAM,aAAa,0BAAyB,sBAAsB,YAAY,SAAS;AAEvF,YAAM,SAAS,IAAI,sCAAyC,EAAE,QAAQ,iEAAwB,CAAC,EAC5F,OAAO;AAAA,QACN,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,QACpE,WAAW,0BAAyB,cAAc,WAAW,SAAS;AAAA,QACtE,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,MACtE,CAAC,EACA,MAAM;AAET,iBAAK,WAAL,mBAAa,IAAI;AACjB,aAAO,CAAC,MAAM;AAAA,IAChB;AACA,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/Diviner/Diviner.ts","../../../src/Diviner/Config.ts"],"sourcesContent":["import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAgC;AAGhC,8BAA+D;AAC/D,+CAA8F;AAC9F,qCAAgD;AAEhD,6BAA+B;;;ACFxB,IAAM,uCAA6E;;;ADSnF,IAAM,2BAAN,MAAM,kCACH,wCAEV;AAAA,EACE,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EACrE,OAAgB,eAAe;AAAA;AAAA,EAG/B,OAAe,cAAc,WAA0D;AACrF,WAAO;AAAA,MACL,KAAK,UAAU,OAAe,CAAC,MAAM,UAAU;AAC7C,eAAO,UAAU,OAAQ,QAAQ,OAAO,QAAQ,OAAQ;AAAA,MAC1D,GAAG,SAAS;AAAA,MACZ,OAAO,MAAM;AACX,cAAM,SAAS,UAAU;AAAA,UACvB,CAAC,MAAM,UAAU;AACf,mBAAO,UAAU,OAAO,CAAC,QAAQ,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI;AAAA,UAC3D;AAAA,UACA,CAAC,GAAG,CAAC;AAAA,QACP;AACA,eAAO,OAAO,CAAC,IAAI,OAAO,CAAC;AAAA,MAC7B,GAAG;AAA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;AAAA,MACtE,CAAC,EACA,MAAM;AAET,iBAAK,WAAL,mBAAa,IAAI;AACjB,aAAO,CAAC,MAAM;AAAA,IAChB;AACA,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Diviner/Diviner.ts","../../../src/Diviner/Config.ts"],"sourcesContent":["import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n"],"mappings":";AAAA,SAAS,uBAAuB;AAGhC,SAAS,kBAAkB,oCAAoC;AAC/D,SAA+D,+BAA+B;AAC9F,SAA0B,sBAAsB;AAEhD,SAAS,sBAAsB;;;ACFxB,IAAM,uCAA6E;;;ADSnF,IAAM,2BAAN,MAAM,kCACH,gBAEV;AAAA,EACE,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EACrE,OAAgB,eAAe;AAAA;AAAA,EAG/B,OAAe,cAAc,WAA0D;AACrF,WAAO;AAAA,MACL,KAAK,UAAU,OAAe,CAAC,MAAM,UAAU;AAC7C,eAAO,UAAU,OAAQ,QAAQ,OAAO,QAAQ,OAAQ;AAAA,MAC1D,GAAG,SAAS;AAAA,MACZ,OAAO,MAAM;AACX,cAAM,SAAS,UAAU;AAAA,UACvB,CAAC,MAAM,UAAU;AACf,mBAAO,UAAU,OAAO,CAAC,QAAQ,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI;AAAA,UAC3D;AAAA,UACA,CAAC,GAAG,CAAC;AAAA,QACP;AACA,eAAO,OAAO,CAAC,IAAI,OAAO,CAAC;AAAA,MAC7B,GAAG;AAAA,MACH,KAAK,UAAU,OAAe,CAAC,MAAM,UAAU;AAC7C,eAAO,UAAU,OAAQ,QAAQ,OAAO,QAAQ,OAAQ;AAAA,MAC1D,GAAG,QAAQ;AAAA,IACb;AAAA,EACF;AAAA;AAAA,EAGA,OAAe,sBAAsB,YAAgC,WAA8B;AACjG,UAAM,aAAa,WAAW;AAAA,MAC5B,CAAC,MAAM,MAAM,UAAU;AACrB,cAAM,YAAY,KAAK;AACvB,YAAI,cAAc,UAAa,cAAc,MAAM;AACjD,gBAAM,MAAM,mBAAmB;AAAA,QACjC;AACA,cAAM,WAAW,UAAU,KAAK,EAAE;AAClC,aAAK,SAAS,KAAK,YAAY,IAAI;AACnC,aAAK,UAAU,KAAK,SAAS;AAC7B,aAAK,SAAS,KAAK,aAAa,UAAa,aAAa,OAAO,WAAW,YAAY,IAAI;AAC5F,eAAO;AAAA,MACT;AAAA,MACA,EAAE,UAAU,CAAC,GAAG,WAAW,CAAC,GAAG,UAAU,CAAC,EAAE;AAAA,IAC9C;AACA,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,MAAyB,cAAc,UAA0C;AA9DnF;AA+DI,UAAM,YAAY,qCAAU,OAAwB,CAAC,aAAwC,mCAAS,YAAW;AAEjH,QAAI,cAAa,uCAAW,UAAS,GAAG;AACtC,YAAM,mBAAmB,MAAM,iBAAiB,OAAO;AAAA,QACrD,SAAS,KAAK;AAAA,QACd,QAAQ;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AACD,YAAM,aAAc,MAAM,iBAAiB,QAAQ;AAEnD,YAAM,aAAa,0BAAyB,sBAAsB,YAAY,SAAS;AAEvF,YAAM,SAAS,IAAI,eAAyC,EAAE,QAAQ,wBAAwB,CAAC,EAC5F,OAAO;AAAA,QACN,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,QACpE,WAAW,0BAAyB,cAAc,WAAW,SAAS;AAAA,QACtE,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,MACtE,CAAC,EACA,MAAM;AAET,iBAAK,WAAL,mBAAa,IAAI;AACjB,aAAO,CAAC,MAAM;AAAA,IAChB;AACA,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/Diviner/Diviner.ts","../../../src/Diviner/Config.ts"],"sourcesContent":["import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n"],"mappings":";AAAA,SAAS,uBAAuB;AAGhC,SAAS,kBAAkB,oCAAoC;AAC/D,SAA+D,+BAA+B;AAC9F,SAA0B,sBAAsB;AAEhD,SAAS,sBAAsB;;;ACFxB,IAAM,uCAA6E;;;ADSnF,IAAM,2BAAN,MAAM,kCACH,gBAEV;AAAA,EACE,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EACrE,OAAgB,eAAe;AAAA;AAAA,EAG/B,OAAe,cAAc,WAA0D;AACrF,WAAO;A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AiB,OAAO;AAAA,QACrD,SAAS,KAAK;AAAA,QACd,QAAQ;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AACD,YAAM,aAAc,MAAM,iBAAiB,QAAQ;AAEnD,YAAM,aAAa,0BAAyB,sBAAsB,YAAY,SAAS;AAEvF,YAAM,SAAS,IAAI,eAAyC,EAAE,QAAQ,wBAAwB,CAAC,EAC5F,OAAO;AAAA,QACN,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,QACpE,WAAW,0BAAyB,cAAc,WAAW,SAAS;AAAA,QACtE,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,MACtE,CAAC,EACA,MAAM;AAET,iBAAK,WAAL,mBAAa,IAAI;AACjB,aAAO,CAAC,MAAM;AAAA,IAChB;AACA,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Diviner/index.ts","../../../src/Diviner/Config.ts","../../../src/Diviner/Diviner.ts"],"sourcesContent":["export * from './Config'\nexport * from './Diviner'\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAM,uCAA6E;;;ACL1F,8BAAgC;AAGhC,8BAA+D;AAC/D,+CAA8F;AAC9F,qCAAgD;AAEhD,6BAA+B;AAOxB,IAAM,2BAAN,MAAM,kCACH,wCAEV;AAAA,EACE,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EACrE,OAAgB,eAAe;AAAA;AAAA,EAG/B,OAAe,cAAc,WAA0D;AACrF,WAAO;AAAA,MACL,KAAK,UAAU,OAAe,CAAC,MAAM,UAAU;AAC7C,eAAO,UAAU,OAAQ,QAAQ,OAAO,QAAQ,OAAQ;AAAA,MAC1D,GAAG,SAAS;AAAA,MACZ,OAAO,MAAM;AACX,cAAM,SAAS,UAAU;AAAA,UACvB,CAAC,MAAM,UAAU;AACf,mBAAO,UAAU,OAAO,CAAC,QAAQ,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI;AAAA,UAC3D;AAAA,UACA,CAAC,GAAG,CAAC;AAAA,QACP;AACA,e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,WAAW,SAAS;AAAA,QACtE,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,MACtE,CAAC,EACA,MAAM;AAET,iBAAK,WAAL,mBAAa,IAAI;AACjB,aAAO,CAAC,MAAM;AAAA,IAChB;AACA,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/Diviner/index.ts","../../../src/Diviner/Config.ts","../../../src/Diviner/Diviner.ts"],"sourcesContent":["export * from './Config'\nexport * from './Diviner'\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAM,uCAA6E;;;ACL1F,8BAAgC;AAGhC,8BAA+D;AAC/D,+CAA8F;AAC9F,qCAAgD;AAEhD,6BAA+B;AAOxB,IAAM,2BAAN,MAAM,kCACH,wCAEV;AAAA,EACE,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EACrE,OAAgB,eAAe;AAAA;AAAA,EAG/B,OAAe,cAAc,WAA0D;AACrF,WAAO;AAAA,MACL,KAAK,UAAU,OAAe,CAAC,MAAM,UAAU;AAC7C,eAAO,UAAU,OAAQ,QAAQ,OAAO,QAAQ,OAAQ;AAAA,MAC1D,GAAG,SAAS;AAAA,MACZ,OAAO,MAAM;AACX,cAAM,SAAS,UAAU;AAAA,UACvB,CAAC,MAAM,UAAU;AACf,mBAAO,UAAU,OAAO,CAAC,QAAQ,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI;AAAA,UAC3D;AAAA,UACA,CAAC,GAAG,CAAC;AAAA,QACP;AACA,eAAO,OAAO,CAAC,IAAI,OAAO,CAAC;AAAA,MAC7B,GAAG;AAAA,MACH,KAAK,UAAU,OAAe,CAAC,MAAM,UAAU;AAC7C,eAAO,UAAU,OAAQ,QAAQ,OAAO,QAAQ,OAAQ;AAAA,MAC1D,GAAG,QAAQ;AAAA,IACb;AAAA,EACF;AAAA;AAAA,EAGA,OAAe,sBAAsB,YAAgC,WAA8B;AACjG,UAAM,aAAa,WAAW;AAAA,MAC5B,CAAC,MAAM,MAAM,UAAU;AACrB,cAAM,YAAY,KAAK;AACvB,YAAI,cAAc,UAAa,cAAc,MAAM;AACjD,gBAAM,MAAM,mBAAmB;AAAA,QACjC;AACA,cAAM,WAAW,UAAU,KAAK,EAAE;AAClC,aAAK,SAAS,KAAK,YAAY,IAAI;AACnC,aAAK,UAAU,KAAK,SAAS;AAC7B,aAAK,SAAS,KAAK,aAAa,UAAa,aAAa,OAAO,WAAW,YAAY,IAAI;AAC5F,eAAO;AAAA,MACT;AAAA,MACA,EAAE,UAAU,CAAC,GAAG,WAAW,CAAC,GAAG,UAAU,CAAC,EAAE;AAAA,IAC9C;AACA,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,MAAyB,cAAc,UAA0C;AA9DnF;AA+DI,UAAM,YAAY,qCAAU,OAAwB,CAAC,aAAwC,mCAAS,YAAW;AAEjH,QAAI,cAAa,uCAAW,UAAS,GAAG;AACtC,YAAM,mBAAmB,MAAM,yCAAiB,OAAO;AAAA,QACrD,SAAS,KAAK;AAAA,QACd,QAAQ;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AACD,YAAM,aAAc,MAAM,iBAAiB,QAAQ;AAEnD,YAAM,aAAa,0BAAyB,sBAAsB,YAAY,SAAS;AAEvF,YAAM,SAAS,IAAI,sCAAyC,EAAE,QAAQ,iEAAwB,CAAC,EAC5F,OAAO;AAAA,QACN,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,QACpE,WAAW,0BAAyB,cAAc,WAAW,SAAS;AAAA,QACtE,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,MACtE,CAAC,EACA,MAAM;AAET,iBAAK,WAAL,mBAAa,IAAI;AACjB,aAAO,CAAC,MAAM;AAAA,IAChB;AACA,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Diviner/Config.ts","../../../src/Diviner/Diviner.ts"],"sourcesContent":["import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n"],"mappings":";AAKO,IAAM,uCAA6E;;;ACL1F,SAAS,uBAAuB;AAGhC,SAAS,kBAAkB,oCAAoC;AAC/D,SAA+D,+BAA+B;AAC9F,SAA0B,sBAAsB;AAEhD,SAAS,sBAAsB;AAOxB,IAAM,2BAAN,MAAM,kCACH,gBAEV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AM,YAAY,qCAAU,OAAwB,CAAC,aAAwC,mCAAS,YAAW;AAEjH,QAAI,cAAa,uCAAW,UAAS,GAAG;AACtC,YAAM,mBAAmB,MAAM,iBAAiB,OAAO;AAAA,QACrD,SAAS,KAAK;AAAA,QACd,QAAQ;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AACD,YAAM,aAAc,MAAM,iBAAiB,QAAQ;AAEnD,YAAM,aAAa,0BAAyB,sBAAsB,YAAY,SAAS;AAEvF,YAAM,SAAS,IAAI,eAAyC,EAAE,QAAQ,wBAAwB,CAAC,EAC5F,OAAO;AAAA,QACN,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,QACpE,WAAW,0BAAyB,cAAc,WAAW,SAAS;AAAA,QACtE,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,MACtE,CAAC,EACA,MAAM;AAET,iBAAK,WAAL,mBAAa,IAAI;AACjB,aAAO,CAAC,MAAM;AAAA,IAChB;AACA,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/Diviner/Config.ts","../../../src/Diviner/Diviner.ts"],"sourcesContent":["import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n"],"mappings":";AAKO,IAAM,uCAA6E;;;ACL1F,SAAS,uBAAuB;AAGhC,SAAS,kBAAkB,oCAAoC;AAC/D,SAA+D,+BAA+B;AAC9F,SAA0B,sBAAsB;AAEhD,SAAS,sBAAsB;AAOxB,IAAM,2BAAN,MAAM,kCACH,gBAEV;AAAA,EACE,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EACrE,OAAgB,eAAe;AAAA;AAAA,EAG/B,OAAe,cAAc,WAA0D;AACrF,WAAO;AAAA,MACL,KAAK,UAAU,OAAe,CAAC,MAAM,UAAU;AAC7C,eAAO,UAAU,OAAQ,QAAQ,OAAO,QAAQ,OAAQ;AAAA,MAC1D,GAAG,SAAS;AAAA,MACZ,OAAO,MAAM;AACX,cAAM,SAAS,UAAU;AAAA,UACvB,CAAC,MAAM,UAAU;AACf,mBAAO,UAAU,OAAO,CAAC,QAAQ,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI;AAAA,UAC3D;AA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AW,QAAQ;AAAA,QACpE,WAAW,0BAAyB,cAAc,WAAW,SAAS;AAAA,QACtE,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,MACtE,CAAC,EACA,MAAM;AAET,iBAAK,WAAL,mBAAa,IAAI;AACjB,aAAO,CAAC,MAAM;AAAA,IAChB;AACA,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
@@ -17,7 +17,7 @@ export declare const LocationCertaintyPlugin: () => import("@xyo-network/payload
17
17
  readonly sign?: boolean | undefined;
18
18
  readonly storeQueries?: boolean | undefined;
19
19
  readonly timestamp?: boolean | undefined;
20
- } & Omit<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
20
+ } & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
21
21
  accountDerivationPath?: string | undefined;
22
22
  readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
23
23
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
@@ -33,7 +33,7 @@ export declare const LocationCertaintyPlugin: () => import("@xyo-network/payload
33
33
  readonly sign?: boolean | undefined;
34
34
  readonly storeQueries?: boolean | undefined;
35
35
  readonly timestamp?: boolean | undefined;
36
- } & {
36
+ } & import("@xyo-network/module-model").ArchivingModuleConfig & {
37
37
  schema: "network.xyo.location.elevation.diviner.config";
38
38
  } & Omit<{
39
39
  schema: string;
@@ -17,7 +17,7 @@ export declare const LocationCertaintyPlugin: () => import("@xyo-network/payload
17
17
  readonly sign?: boolean | undefined;
18
18
  readonly storeQueries?: boolean | undefined;
19
19
  readonly timestamp?: boolean | undefined;
20
- } & Omit<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
20
+ } & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
21
21
  accountDerivationPath?: string | undefined;
22
22
  readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
23
23
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
@@ -33,7 +33,7 @@ export declare const LocationCertaintyPlugin: () => import("@xyo-network/payload
33
33
  readonly sign?: boolean | undefined;
34
34
  readonly storeQueries?: boolean | undefined;
35
35
  readonly timestamp?: boolean | undefined;
36
- } & {
36
+ } & import("@xyo-network/module-model").ArchivingModuleConfig & {
37
37
  schema: "network.xyo.location.elevation.diviner.config";
38
38
  } & Omit<{
39
39
  schema: string;
@@ -17,7 +17,7 @@ export declare const LocationCertaintyPlugin: () => import("@xyo-network/payload
17
17
  readonly sign?: boolean | undefined;
18
18
  readonly storeQueries?: boolean | undefined;
19
19
  readonly timestamp?: boolean | undefined;
20
- } & Omit<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
20
+ } & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
21
21
  accountDerivationPath?: string | undefined;
22
22
  readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
23
23
  readonly labels?: import("@xyo-network/module-model").Labels | undefined;
@@ -33,7 +33,7 @@ export declare const LocationCertaintyPlugin: () => import("@xyo-network/payload
33
33
  readonly sign?: boolean | undefined;
34
34
  readonly storeQueries?: boolean | undefined;
35
35
  readonly timestamp?: boolean | undefined;
36
- } & {
36
+ } & import("@xyo-network/module-model").ArchivingModuleConfig & {
37
37
  schema: "network.xyo.location.elevation.diviner.config";
38
38
  } & Omit<{
39
39
  schema: string;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Plugin.ts","../../src/Diviner/Config.ts","../../src/Diviner/Diviner.ts"],"sourcesContent":["import { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetDivinerPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { LocationCertaintyDiviner } from './Diviner'\n\nexport const LocationCertaintyPlugin = () =>\n createPayloadSetDivinerPlugin<LocationCertaintyDiviner>(\n { required: { [LocationCertaintySchema]: 1 }, schema: PayloadSetSchema },\n {\n diviner: async (params) => {\n return (await LocationCertaintyDiviner.create(params)) as LocationCertaintyDiviner\n },\n },\n )\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,4CAAwC;AACxC,2BAAiC;AACjC,+BAA8C;;;ACGvC,IAAM,uCAA6E;;;ACL1F,8BAAgC;AAGhC,8BAA+D;AAC/D,+CAA8F;AAC9F,qCAAgD;AAEhD,6BAA+B;AAOxB,IAAM,2BAAN,MAAM,kCACH,wCAEV;AAAA,EACE,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EACrE,OAAgB,eAAe;AAAA;AAAA,EAG/B,OAAe,cAAc,WAA0D;AACrF,WAAO;AAAA,MACL,KAAK,UAAU,OAAe,CAAC,MAAM,UAAU;AAC7C,eAAO,UAAU,OAAQ,QAAQ,OAAO,QAAQ,OAAQ;AAAA,MAC1D,GAAG,SAAS;AAAA,MACZ,OAAO,MAAM;AACX,cAAM,SAAS,UAAU;AAAA,UACvB,CAAC,MAAM,UAAU;AACf,mBAAO,UAAU,OAAO,CAAC,QAAQ,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI;AAAA,UAC3D;AAAA,UACA,CAAC,GAAG,CAAC;AAAA,QACP;AACA,eAAO,OAAO,CAAC,IAAI,OAAO,CAAC;AAAA,MAC7B,GAAG;AAAA,MACH,KAAK,UAAU,OAAe,CAAC,MAAM,UAAU;AAC7C,eAAO,UAAU,OAAQ,QAAQ,OAAO,QAAQ,OAAQ;AAAA,MAC1D,GAAG,QAAQ;AAAA,IACb;AAAA,EACF;AAAA;AAAA,EAGA,OAAe,sBAAsB,YAAgC,WAA8B;AACjG,UAAM,aAAa,WAAW;AAAA,MAC5B,CAAC,MAAM,MAAM,UAAU;AACrB,cAAM,YAAY,KAAK;AACvB,YAAI,cAAc,UAAa,cAAc,MAAM;AACjD,gBAAM,M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;AAAA,EACF;AACF;","names":["import_location_certainty_payload_plugin"]}
1
+ {"version":3,"sources":["../../src/Plugin.ts","../../src/Diviner/Config.ts","../../src/Diviner/Diviner.ts"],"sourcesContent":["import { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetDivinerPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { LocationCertaintyDiviner } from './Diviner'\n\nexport const LocationCertaintyPlugin = () =>\n createPayloadSetDivinerPlugin<LocationCertaintyDiviner>(\n { required: { [LocationCertaintySchema]: 1 }, schema: PayloadSetSchema },\n {\n diviner: async (params) => {\n return (await LocationCertaintyDiviner.create(params)) as LocationCertaintyDiviner\n },\n },\n )\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,4CAAwC;AACxC,2BAAiC;AACjC,+BAA8C;;;ACGvC,IAAM,uCAA6E;;;ACL1F,8BAAgC;AAGhC,8BAA+D;AAC/D,+CAA8F;AAC9F,qCAAgD;AAEhD,6BAA+B;AAOxB,IAAM,2BAAN,MAAM,kCACH,wCAEV;AAAA,EACE,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EACrE,OAAgB,eAAe;AAAA;AAAA,EAG/B,OAAe,cAAc,WAA0D;AACrF,WAAO;AAAA,MACL,KAAK,UAAU,OAAe,CAAC,MAAM,UAAU;AAC7C,eAAO,UAAU,OAAQ,QAAQ,OAAO,QAAQ,OAAQ;AAAA,MAC1D,GAAG,SAAS;AAAA,MACZ,OAAO,MAAM;AACX,cAAM,SAAS,UAAU;AAAA,UACvB,CAAC,MAAM,UAAU;AACf,mBAAO,UAAU,OAAO,CAAC,QAAQ,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI;AAAA,UAC3D;AAAA,UACA,CAAC,GAAG,CAAC;AAAA,QACP;AACA,eAAO,OAAO,CAAC,IAAI,OAAO,CAAC;AAAA,MAC7B,GAAG;AAAA,MACH,KAAK,UAAU,OAAe,CAAC,MAAM,UAAU;AAC7C,eAAO,UAAU,OAAQ,QAAQ,OAAO,QAAQ,OAAQ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B;AACA,WAAO,CAAC;AAAA,EACV;AACF;;;AFpFO,IAAM,0BAA0B,UACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,iEAAuB,GAAG,EAAE,GAAG,QAAQ,sCAAiB;AAAA,EACvE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAQ,MAAM,yBAAyB,OAAO,MAAM;AAAA,IACtD;AAAA,EACF;AACF;","names":["import_location_certainty_payload_plugin"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Plugin.ts","../../src/Diviner/Config.ts","../../src/Diviner/Diviner.ts"],"sourcesContent":["import { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetDivinerPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { LocationCertaintyDiviner } from './Diviner'\n\nexport const LocationCertaintyPlugin = () =>\n createPayloadSetDivinerPlugin<LocationCertaintyDiviner>(\n { required: { [LocationCertaintySchema]: 1 }, schema: PayloadSetSchema },\n {\n diviner: async (params) => {\n return (await LocationCertaintyDiviner.create(params)) as LocationCertaintyDiviner\n },\n },\n )\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n"],"mappings":";AAAA,SAAS,2BAAAA,gCAA+B;AACxC,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACGvC,IAAM,uCAA6E;;;ACL1F,SAAS,uBAAuB;AAGhC,SAAS,kBAAkB,oCAAoC;AAC/D,SAA+D,+BAA+B;AAC9F,SAA0B,sBAAsB;AAEhD,SAAS,sBAAsB;AAOxB,IAAM,2BAAN,MAAM,kCACH,gBAEV;AAAA,EACE,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EACrE,OAAgB,eAAe;AAAA;AAAA,EAG/B,OAAe,cAAc,WAA0D;AACrF,WAAO;AAAA,MACL,KAAK,UAAU,OAAe,CAAC,MAAM,UAAU;AAC7C,eAAO,UAAU,OAAQ,QAAQ,OAAO,QAAQ,OAAQ;AAAA,MAC1D,GAAG,SAAS;AAAA,MACZ,OAAO,MAAM;AACX,cAAM,SAAS,UAAU;AAAA,UACvB,CAAC,MAAM,UAAU;AACf,mBAAO,UAAU,OAAO,CAAC,QAAQ,KAAK,CA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B,CAAC,EAC5F,OAAO;AAAA,QACN,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,QACpE,WAAW,0BAAyB,cAAc,WAAW,SAAS;AAAA,QACtE,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,MACtE,CAAC,EACA,MAAM;AAET,iBAAK,WAAL,mBAAa,IAAI;AACjB,aAAO,CAAC,MAAM;AAAA,IAChB;AACA,WAAO,CAAC;AAAA,EACV;AACF;;;AFpFO,IAAM,0BAA0B,MACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAACC,wBAAuB,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACvE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAQ,MAAM,yBAAyB,OAAO,MAAM;AAAA,IACtD;AAAA,EACF;AACF;","names":["LocationCertaintySchema","LocationCertaintySchema"]}
1
+ {"version":3,"sources":["../../src/Plugin.ts","../../src/Diviner/Config.ts","../../src/Diviner/Diviner.ts"],"sourcesContent":["import { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetDivinerPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { LocationCertaintyDiviner } from './Diviner'\n\nexport const LocationCertaintyPlugin = () =>\n createPayloadSetDivinerPlugin<LocationCertaintyDiviner>(\n { required: { [LocationCertaintySchema]: 1 }, schema: PayloadSetSchema },\n {\n diviner: async (params) => {\n return (await LocationCertaintyDiviner.create(params)) as LocationCertaintyDiviner\n },\n },\n )\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n"],"mappings":";AAAA,SAAS,2BAAAA,gCAA+B;AACxC,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACGvC,IAAM,uCAA6E;;;ACL1F,SAAS,uBAAuB;AAGhC,SAAS,kBAAkB,oCAAoC;AAC/D,SAA+D,+BAA+B;AAC9F,SAA0B,sBAAsB;AAEhD,SAAS,sBAAsB;AAOxB,IAAM,2BAAN,MAAM,kCACH,gBAEV;AAAA,EACE,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EACrE,OAAgB,eAAe;AAAA;AAAA,EAG/B,OAAe,cAAc,WAA0D;AACrF,WAAO;A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AiB,OAAO;AAAA,QACrD,SAAS,KAAK;AAAA,QACd,QAAQ;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AACD,YAAM,aAAc,MAAM,iBAAiB,QAAQ;AAEnD,YAAM,aAAa,0BAAyB,sBAAsB,YAAY,SAAS;AAEvF,YAAM,SAAS,IAAI,eAAyC,EAAE,QAAQ,wBAAwB,CAAC,EAC5F,OAAO;AAAA,QACN,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,QACpE,WAAW,0BAAyB,cAAc,WAAW,SAAS;AAAA,QACtE,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,MACtE,CAAC,EACA,MAAM;AAET,iBAAK,WAAL,mBAAa,IAAI;AACjB,aAAO,CAAC,MAAM;AAAA,IAChB;AACA,WAAO,CAAC;AAAA,EACV;AACF;;;AFpFO,IAAM,0BAA0B,MACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAACC,wBAAuB,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACvE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAQ,MAAM,yBAAyB,OAAO,MAAM;AAAA,IACtD;AAAA,EACF;AACF;","names":["LocationCertaintySchema","LocationCertaintySchema"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/Plugin.ts","../../src/Diviner/Config.ts","../../src/Diviner/Diviner.ts"],"sourcesContent":["import { LocationCertaintyPlugin } from './Plugin'\n\nexport * from './Diviner'\n\nexport { LocationCertaintyPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default LocationCertaintyPlugin\n","import { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetDivinerPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { LocationCertaintyDiviner } from './Diviner'\n\nexport const LocationCertaintyPlugin = () =>\n createPayloadSetDivinerPlugin<LocationCertaintyDiviner>(\n { required: { [LocationCertaintySchema]: 1 }, schema: PayloadSetSchema },\n {\n diviner: async (params) => {\n return (await LocationCertaintyDiviner.create(params)) as LocationCertaintyDiviner\n },\n },\n )\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\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Plugin.ts","../../src/Diviner/Config.ts","../../src/Diviner/Diviner.ts"],"sourcesContent":["import { LocationCertaintyPlugin } from './Plugin'\n\nexport * from './Diviner'\n\nexport { LocationCertaintyPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default LocationCertaintyPlugin\n","import { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetDivinerPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { LocationCertaintyDiviner } from './Diviner'\n\nexport const LocationCertaintyPlugin = () =>\n createPayloadSetDivinerPlugin<LocationCertaintyDiviner>(\n { required: { [LocationCertaintySchema]: 1 }, schema: PayloadSetSchema },\n {\n diviner: async (params) => {\n return (await LocationCertaintyDiviner.create(params)) as LocationCertaintyDiviner\n },\n },\n )\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,4CAAwC;AACxC,2BAAiC;AACjC,+BAA8C;;;ACGvC,IAAM,uCAA6E;;;ACL1F,8BAAgC;AAGhC,8BAA+D;AAC/D,+CAA8F;AAC9F,qCAAgD;AAEhD,6BAA+B;AAOxB,IAAM,2BAAN,MAAM,kCACH,wCAEV;AAAA,EACE,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EACrE,OAAgB,eAAe;AAAA;AAAA,EAG/B,OAAe,cAAc,WAA0D;AACrF,WAAO;AAAA,MACL,KAAK,UAAU,OAAe,CAAC,MAAM,UAAU;AAC7C,eAAO,UAAU,OAAQ,QAAQ,OAAO,QAAQ,OAAQ;AAAA,MAC1D,GAAG,SAAS;AAAA,MACZ,OAAO,MAAM;AACX,cAAM,SAAS,UAAU;AAAA,UACvB,CAAC,MAAM,UAAU;AACf,mBAAO,UAAU,OAAO,CAAC,QAAQ,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI;AAAA,UAC3D;AAAA,UACA,CAAC,GAAG,CAAC;AAAA,QACP;AACA,eAAO,OAAO,CAAC,IAAI,OAAO,CAAC;AAAA,MAC7B,GAAG;AAAA,MACH,KAAK,UAAU,OAA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,MAAM;AAET,iBAAK,WAAL,mBAAa,IAAI;AACjB,aAAO,CAAC,MAAM;AAAA,IAChB;AACA,WAAO,CAAC;AAAA,EACV;AACF;;;AFpFO,IAAM,0BAA0B,UACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,iEAAuB,GAAG,EAAE,GAAG,QAAQ,sCAAiB;AAAA,EACvE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAQ,MAAM,yBAAyB,OAAO,MAAM;AAAA,IACtD;AAAA,EACF;AACF;;;ADPF,IAAO,cAAQ;","names":["import_location_certainty_payload_plugin"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Plugin.ts","../../src/Diviner/Config.ts","../../src/Diviner/Diviner.ts","../../src/index.ts"],"sourcesContent":["import { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetDivinerPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { LocationCertaintyDiviner } from './Diviner'\n\nexport const LocationCertaintyPlugin = () =>\n createPayloadSetDivinerPlugin<LocationCertaintyDiviner>(\n { required: { [LocationCertaintySchema]: 1 }, schema: PayloadSetSchema },\n {\n diviner: async (params) => {\n return (await LocationCertaintyDiviner.create(params)) as LocationCertaintyDiviner\n },\n },\n )\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n","import { LocationCertaintyPlugin } from './Plugin'\n\nexport * from './Diviner'\n\nexport { LocationCertaintyPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default LocationCertaintyPlugin\n"],"mappings":";AAAA,SAAS,2BAAAA,gCAA+B;AACxC,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACGvC,IAAM,uCAA6E;;;ACL1F,SAAS,uBAAuB;AAGhC,SAAS,kBAAkB,oCAAoC;AAC/D,SAA+D,+BAA+B;AAC9F,SAA0B,sBAAsB;AAEhD,SAAS,sBAAsB;AAOxB,IAAM,2BAAN,MAAM,kCACH,gBAEV;AAAA,EACE,OAAgB,gBAAgB,CAAC,oCAAoC;AAAA,EACrE,OAAgB,eAAe;AAAA;AAAA,EAG/B,OAAe,cAAc,WAA0D;AACrF,WAAO;AAAA,MACL,KAAK,UAAU,OAA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AS,KAAK;AAAA,QACd,QAAQ;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AACD,YAAM,aAAc,MAAM,iBAAiB,QAAQ;AAEnD,YAAM,aAAa,0BAAyB,sBAAsB,YAAY,SAAS;AAEvF,YAAM,SAAS,IAAI,eAAyC,EAAE,QAAQ,wBAAwB,CAAC,EAC5F,OAAO;AAAA,QACN,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,QACpE,WAAW,0BAAyB,cAAc,WAAW,SAAS;AAAA,QACtE,UAAU,0BAAyB,cAAc,WAAW,QAAQ;AAAA,MACtE,CAAC,EACA,MAAM;AAET,iBAAK,WAAL,mBAAa,IAAI;AACjB,aAAO,CAAC,MAAM;AAAA,IAChB;AACA,WAAO,CAAC;AAAA,EACV;AACF;;;AFpFO,IAAM,0BAA0B,MACrC;AAAA,EACE,EAAE,UAAU,EAAE,CAACC,wBAAuB,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACvE;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAQ,MAAM,yBAAyB,OAAO,MAAM;AAAA,IACtD;AAAA,EACF;AACF;;;AGPF,IAAO,cAAQ;","names":["LocationCertaintySchema","LocationCertaintySchema"]}
1
+ {"version":3,"sources":["../../src/Plugin.ts","../../src/Diviner/Config.ts","../../src/Diviner/Diviner.ts","../../src/index.ts"],"sourcesContent":["import { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetDivinerPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { LocationCertaintyDiviner } from './Diviner'\n\nexport const LocationCertaintyPlugin = () =>\n createPayloadSetDivinerPlugin<LocationCertaintyDiviner>(\n { required: { [LocationCertaintySchema]: 1 }, schema: PayloadSetSchema },\n {\n diviner: async (params) => {\n return (await LocationCertaintyDiviner.create(params)) as LocationCertaintyDiviner\n },\n },\n )\n","import { DivinerConfig } from '@xyo-network/diviner-model'\nimport { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\nexport const LocationCertaintyDivinerConfigSchema: LocationCertaintyDivinerConfigSchema = 'network.xyo.location.elevation.diviner.config'\n\nexport type LocationCertaintyDivinerConfig<TConfig extends Payload = Payload> = DivinerConfig<\n TConfig & {\n schema: LocationCertaintyDivinerConfigSchema\n targetSchema?: LocationCertaintySchema\n }\n>\n","import { AbstractDiviner } from '@xyo-network/abstract-diviner'\nimport { DivinerModule, DivinerParams } from '@xyo-network/diviner-model'\nimport { ElevationPayload } from '@xyo-network/elevation-payload-plugin'\nimport { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'\nimport { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'\nimport { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { LocationCertaintyDivinerConfig, LocationCertaintyDivinerConfigSchema } from './Config'\n\nexport type LocationCertaintyDivinerParams = DivinerParams<AnyConfigSchema<LocationCertaintyDivinerConfig>>\n\nexport class LocationCertaintyDiviner<TParam extends LocationCertaintyDivinerParams = LocationCertaintyDivinerParams>\n extends AbstractDiviner<TParam>\n implements DivinerModule\n{\n static override configSchemas = [LocationCertaintyDivinerConfigSchema]\n static override targetSchema = LocationCertaintySchema\n\n /* Given an array of numbers, find the min/max/mean */\n private static calcHeuristic(heuristic: (number | null)[]): LocationCertaintyHeuristic {\n return {\n max: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value > prev ? value : prev) : prev\n }, -Infinity),\n mean: (() => {\n const values = heuristic.reduce<number[]>(\n (prev, value) => {\n return value !== null ? [value + prev[0], prev[1] + 1] : prev\n },\n [0, 0],\n )\n return values[0] / values[1]\n })(),\n min: heuristic.reduce<number>((prev, value) => {\n return value !== null ? (value < prev ? value : prev) : prev\n }, Infinity),\n }\n }\n\n /* Given elevation and location payloads, generate heuristic arrays */\n private static locationsToHeuristics(elevations: ElevationPayload[], locations: LocationPayload[]) {\n const heuristics = elevations.reduce<{ altitude: (number | null)[]; elevation: number[]; variance: (number | null)[] }>(\n (prev, elev, index) => {\n const elevation = elev.elevation\n if (elevation === undefined || elevation === null) {\n throw Error('Invalid Elevation')\n }\n const altitude = locations[index].altitude\n prev.altitude.push(altitude ?? null)\n prev.elevation.push(elevation)\n prev.variance.push(altitude !== undefined && altitude !== null ? altitude - elevation : null)\n return prev\n },\n { altitude: [], elevation: [], variance: [] },\n )\n return heuristics\n }\n\n /** @description Given a set of locations, get the expected elevations (witness if needed), and return score/variance */\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const locations = payloads?.filter<LocationPayload>((payload): payload is LocationPayload => payload?.schema === LocationSchema)\n // If this is a query we support\n if (locations && locations?.length > 0) {\n const elevationWitness = await ElevationWitness.create({\n account: this.account,\n config: {\n locations,\n schema: ElevationWitnessConfigSchema,\n },\n })\n const elevations = (await elevationWitness.observe()) as ElevationPayload[]\n\n const heuristics = LocationCertaintyDiviner.locationsToHeuristics(elevations, locations)\n\n const result = new PayloadBuilder<LocationCertaintyPayload>({ schema: LocationCertaintySchema })\n .fields({\n altitude: LocationCertaintyDiviner.calcHeuristic(heuristics.altitude),\n elevation: LocationCertaintyDiviner.calcHeuristic(heuristics.elevation),\n variance: LocationCertaintyDiviner.calcHeuristic(heuristics.variance),\n })\n .build()\n\n this.logger?.log('LocationCertaintyDiviner.Divine: Processed query')\n return [result]\n }\n return []\n }\n}\n","import { LocationCertaintyPlugin } from './Plugin'\n\nexport * from './Diviner'\n\nexport { LocationCertaintyPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default LocationCertaintyPlugin\n"],"mappings":";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racleNetwork/sdk-xyo-client-js/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xyo-network/abstract-diviner": "~2.75.14",
14
- "@xyo-network/diviner-model": "~2.75.14",
15
- "@xyo-network/elevation-payload-plugin": "~2.75.14",
16
- "@xyo-network/elevation-plugin": "~2.75.14",
17
- "@xyo-network/location-certainty-payload-plugin": "~2.75.14",
18
- "@xyo-network/location-payload-plugin": "~2.75.14",
19
- "@xyo-network/module": "~2.75.14",
20
- "@xyo-network/payload-builder": "~2.75.14",
21
- "@xyo-network/payload-model": "~2.75.14",
22
- "@xyo-network/payloadset-plugin": "~2.75.14"
13
+ "@xyo-network/abstract-diviner": "~2.75.15",
14
+ "@xyo-network/diviner-model": "~2.75.15",
15
+ "@xyo-network/elevation-payload-plugin": "~2.75.15",
16
+ "@xyo-network/elevation-plugin": "~2.75.15",
17
+ "@xyo-network/location-certainty-payload-plugin": "~2.75.15",
18
+ "@xyo-network/location-payload-plugin": "~2.75.15",
19
+ "@xyo-network/module-model": "~2.75.15",
20
+ "@xyo-network/payload-builder": "~2.75.15",
21
+ "@xyo-network/payload-model": "~2.75.15",
22
+ "@xyo-network/payloadset-plugin": "~2.75.15"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@xylabs/ts-scripts-yarn3": "^3.0.88",
26
26
  "@xylabs/tsconfig": "^3.0.88",
27
- "@xyo-network/archivist": "~2.75.14",
27
+ "@xyo-network/archivist": "~2.75.15",
28
+ "@xyo-network/module-resolver": "~2.75.15",
28
29
  "typescript": "^5.2.2"
29
30
  },
30
31
  "description": "Primary SDK for using XYO Protocol 2.0",
@@ -70,5 +71,5 @@
70
71
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
71
72
  },
72
73
  "sideEffects": false,
73
- "version": "2.75.14"
74
+ "version": "2.75.15"
74
75
  }
@@ -4,7 +4,7 @@ import { ElevationPayload } from '@xyo-network/elevation-payload-plugin'
4
4
  import { ElevationWitness, ElevationWitnessConfigSchema } from '@xyo-network/elevation-plugin'
5
5
  import { LocationCertaintyHeuristic, LocationCertaintyPayload, LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'
6
6
  import { LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'
7
- import { AnyConfigSchema } from '@xyo-network/module'
7
+ import { AnyConfigSchema } from '@xyo-network/module-model'
8
8
  import { PayloadBuilder } from '@xyo-network/payload-builder'
9
9
  import { Payload } from '@xyo-network/payload-model'
10
10