@xyo-network/location-certainty-plugin 5.1.2 → 5.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/location-certainty-plugin",
3
- "version": "5.1.2",
3
+ "version": "5.1.4",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -30,27 +30,30 @@
30
30
  "types": "dist/neutral/index.d.ts",
31
31
  "files": [
32
32
  "dist",
33
- "src"
33
+ "src",
34
+ "!**/*.bench.*",
35
+ "!**/*.spec.*",
36
+ "!**/*.test.*"
34
37
  ],
35
38
  "dependencies": {
36
- "@xyo-network/diviner-abstract": "~5.1.2",
37
- "@xyo-network/diviner-model": "~5.1.2",
38
- "@xyo-network/elevation-plugin": "~5.1.2",
39
- "@xyo-network/location-certainty-payload-plugin": "~5.1.2",
40
- "@xyo-network/location-payload-plugin": "~5.1.2",
41
- "@xyo-network/module-model": "~5.1.2",
42
- "@xyo-network/payload-builder": "~5.1.2",
43
- "@xyo-network/payload-model": "~5.1.2",
44
- "@xyo-network/payloadset-plugin": "~5.1.2"
39
+ "@xyo-network/diviner-abstract": "~5.1.23",
40
+ "@xyo-network/diviner-model": "~5.1.23",
41
+ "@xyo-network/elevation-plugin": "~5.1.4",
42
+ "@xyo-network/location-certainty-payload-plugin": "~5.1.4",
43
+ "@xyo-network/location-payload-plugin": "~5.1.4",
44
+ "@xyo-network/module-model": "~5.1.23",
45
+ "@xyo-network/payload-builder": "~5.1.23",
46
+ "@xyo-network/payload-model": "~5.1.23",
47
+ "@xyo-network/payloadset-plugin": "~5.1.23"
45
48
  },
46
49
  "devDependencies": {
47
- "@xylabs/ts-scripts-yarn3": "~7.1.7",
48
- "@xylabs/tsconfig": "~7.1.7",
49
- "@xylabs/vitest-extended": "~5.0.11",
50
- "@xyo-network/archivist-abstract": "~5.1.2",
51
- "@xyo-network/archivist-memory": "~5.1.2",
52
- "@xyo-network/elevation-payload-plugin": "~5.1.2",
53
- "@xyo-network/module-resolver": "~5.1.2",
50
+ "@xylabs/ts-scripts-yarn3": "~7.2.8",
51
+ "@xylabs/tsconfig": "~7.2.8",
52
+ "@xylabs/vitest-extended": "~5.0.33",
53
+ "@xyo-network/archivist-abstract": "~5.1.23",
54
+ "@xyo-network/archivist-memory": "~5.1.23",
55
+ "@xyo-network/elevation-payload-plugin": "~5.1.4",
56
+ "@xyo-network/module-resolver": "~5.1.23",
54
57
  "fast-text-encoding": "~1.0.6",
55
58
  "typescript": "~5.9.2",
56
59
  "vitest": "~3.2.4"
@@ -1,2 +0,0 @@
1
- import '@xylabs/vitest-extended';
2
- //# sourceMappingURL=Diviner.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Diviner.spec.d.ts","sourceRoot":"","sources":["../../../../src/Diviner/spec/Diviner.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -1,3 +0,0 @@
1
- import 'fast-text-encoding';
2
- import '@xylabs/vitest-extended';
3
- //# sourceMappingURL=Plugin.dom.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Plugin.dom.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Plugin.dom.spec.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,yBAAyB,CAAA"}
@@ -1,143 +0,0 @@
1
- import '@xylabs/vitest-extended'
2
-
3
- import type { AbstractArchivist } from '@xyo-network/archivist-abstract'
4
- import { MemoryArchivist } from '@xyo-network/archivist-memory'
5
- import type { LocationCertaintyPayload } from '@xyo-network/location-certainty-payload-plugin'
6
- import { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'
7
- import type { LocationPayload } from '@xyo-network/location-payload-plugin'
8
- import { LocationSchema } from '@xyo-network/location-payload-plugin'
9
- import { CompositeModuleResolver } from '@xyo-network/module-resolver'
10
- import {
11
- beforeEach,
12
- describe, expect, it,
13
- } from 'vitest'
14
-
15
- import { LocationCertaintyDivinerConfigSchema } from '../Config.ts'
16
- import { LocationCertaintyDiviner } from '../Diviner.ts'
17
-
18
- const sample1: LocationPayload[] = [
19
- {
20
- altitude: -5,
21
- latitude: 32.716_64,
22
- longitude: -117.120_33,
23
- schema: LocationSchema,
24
- },
25
- {
26
- altitude: -9,
27
- latitude: 32.7174,
28
- longitude: -117.116_74,
29
- schema: LocationSchema,
30
- },
31
- {
32
- altitude: -11,
33
- latitude: 32.717_88,
34
- longitude: -117.113_77,
35
- schema: LocationSchema,
36
- },
37
- ]
38
-
39
- const sample2: LocationPayload[] = [
40
- {
41
- altitude: 50,
42
- latitude: 32.716_64,
43
- longitude: -117.120_33,
44
- schema: LocationSchema,
45
- },
46
- {
47
- altitude: 53,
48
- latitude: 32.7174,
49
- longitude: -117.116_74,
50
- schema: LocationSchema,
51
- },
52
- {
53
- altitude: 55,
54
- latitude: 32.717_88,
55
- longitude: -117.113_77,
56
- schema: LocationSchema,
57
- },
58
- ]
59
-
60
- const sample3: LocationPayload[] = [
61
- {
62
- altitude: 151,
63
- latitude: 32.716_64,
64
- longitude: -117.120_33,
65
- schema: LocationSchema,
66
- },
67
- {
68
- altitude: 163,
69
- latitude: 32.7174,
70
- longitude: -117.116_74,
71
- schema: LocationSchema,
72
- },
73
- {
74
- altitude: 168,
75
- latitude: 32.717_88,
76
- longitude: -117.113_77,
77
- schema: LocationSchema,
78
- },
79
- ]
80
-
81
- describe.skip('MongoDBLocationCertaintyDiviner', () => {
82
- let payloadsArchivist: AbstractArchivist
83
- let sut: LocationCertaintyDiviner
84
- beforeEach(async () => {
85
- payloadsArchivist = await MemoryArchivist.create({ account: 'random' })
86
- const params = {
87
- config: {
88
- schema: LocationCertaintyDivinerConfigSchema,
89
- targetSchema: LocationCertaintySchema,
90
- },
91
- resolver: new CompositeModuleResolver({ root: sut }).add(payloadsArchivist),
92
- }
93
- sut = (await LocationCertaintyDiviner.create(params)) as LocationCertaintyDiviner
94
- })
95
- describe('divine', () => {
96
- describe('with valid query', () => {
97
- it('divines', async () => {
98
- const noLocations: LocationPayload[] = []
99
- const noLocationsResult = await sut.divine(noLocations)
100
- expect(noLocationsResult).toBeArrayOfSize(0)
101
- const locations: LocationPayload[] = [
102
- {
103
- altitude: 5, quadkey: '0203', schema: LocationSchema,
104
- },
105
- {
106
- altitude: 300, quadkey: '0102', schema: LocationSchema,
107
- },
108
- ]
109
- const locationsResult = await sut.divine(locations)
110
- expect(locationsResult).toBeArrayOfSize(1)
111
- const actual = locationsResult[0] as LocationCertaintyPayload
112
- expect(actual).toBeObject()
113
- expect(actual.schema).toBe(LocationCertaintySchema)
114
-
115
- const locationsResult1 = (await sut.divine(sample1)) as LocationCertaintyPayload[]
116
- const locationsResult2 = (await sut.divine(sample2)) as LocationCertaintyPayload[]
117
- const locationsResult3 = (await sut.divine(sample3)) as LocationCertaintyPayload[]
118
- for (let r of [locationsResult1, locationsResult2, locationsResult3]) {
119
- validateLocationResult(r)
120
- }
121
- })
122
- })
123
- })
124
- })
125
-
126
- const validateLocationResult = (results: LocationCertaintyPayload[]) => {
127
- expect(results).toBeArrayOfSize(1)
128
- const [result] = results
129
- expect(result).toBeObject()
130
- expect(result.schema).toBe(LocationCertaintySchema)
131
- expect(result.altitude).toBeObject()
132
- expect(result.altitude.max).toBeNumber()
133
- expect(result.altitude.mean).toBeNumber()
134
- expect(result.altitude.min).toBeNumber()
135
- expect(result.elevation).toBeObject()
136
- expect(result.elevation.max).toBeNumber()
137
- expect(result.elevation.mean).toBeNumber()
138
- expect(result.elevation.min).toBeNumber()
139
- expect(result.variance).toBeObject()
140
- expect(result.variance.max).toBeNumber()
141
- expect(result.variance.mean).toBeNumber()
142
- expect(result.variance.min).toBeNumber()
143
- }
@@ -1,23 +0,0 @@
1
- // Polyfill TextDecoder
2
- import 'fast-text-encoding'
3
- import '@xylabs/vitest-extended'
4
-
5
- import { LocationCertaintySchema } from '@xyo-network/location-certainty-payload-plugin'
6
- import { PayloadSetPluginResolver } from '@xyo-network/payloadset-plugin'
7
- import {
8
- describe, expect,
9
- test,
10
- } from 'vitest'
11
-
12
- import { LocationCertaintyDivinerConfigSchema } from '../Diviner/index.ts'
13
- import { LocationCertaintyPlugin } from '../Plugin.ts'
14
-
15
- describe('LocationCertaintyPlugin', () => {
16
- test('Add to Resolver', async () => {
17
- const plugin = LocationCertaintyPlugin()
18
- const resolver = await new PayloadSetPluginResolver()
19
- .register(plugin, { config: { schema: LocationCertaintyDivinerConfigSchema, targetSchema: LocationCertaintySchema } })
20
- expect(await resolver.resolve(plugin.set)).toBeObject()
21
- expect(await resolver.diviner(plugin.set)).toBeObject()
22
- })
23
- })