@xyo-network/payload-utils 5.1.22 → 5.1.23
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 +15 -12
- package/dist/browser/spec/combinationsByBoundwitness.spec.d.ts +0 -2
- package/dist/browser/spec/combinationsByBoundwitness.spec.d.ts.map +0 -1
- package/dist/browser/spec/combinationsBySchema.spec.d.ts +0 -2
- package/dist/browser/spec/combinationsBySchema.spec.d.ts.map +0 -1
- package/dist/browser/spec/intraBoundwitnessSchemaCombinations.spec.d.ts +0 -2
- package/dist/browser/spec/intraBoundwitnessSchemaCombinations.spec.d.ts.map +0 -1
- package/dist/neutral/spec/combinationsByBoundwitness.spec.d.ts +0 -2
- package/dist/neutral/spec/combinationsByBoundwitness.spec.d.ts.map +0 -1
- package/dist/neutral/spec/combinationsBySchema.spec.d.ts +0 -2
- package/dist/neutral/spec/combinationsBySchema.spec.d.ts.map +0 -1
- package/dist/neutral/spec/intraBoundwitnessSchemaCombinations.spec.d.ts +0 -2
- package/dist/neutral/spec/intraBoundwitnessSchemaCombinations.spec.d.ts.map +0 -1
- package/dist/node/spec/combinationsByBoundwitness.spec.d.ts +0 -2
- package/dist/node/spec/combinationsByBoundwitness.spec.d.ts.map +0 -1
- package/dist/node/spec/combinationsBySchema.spec.d.ts +0 -2
- package/dist/node/spec/combinationsBySchema.spec.d.ts.map +0 -1
- package/dist/node/spec/intraBoundwitnessSchemaCombinations.spec.d.ts +0 -2
- package/dist/node/spec/intraBoundwitnessSchemaCombinations.spec.d.ts.map +0 -1
- package/src/spec/combinationsByBoundwitness.spec.ts +0 -54
- package/src/spec/combinationsBySchema.spec.ts +0 -46
- package/src/spec/intraBoundwitnessSchemaCombinations.spec.ts +0 -45
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/payload-utils",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.23",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -30,24 +30,27 @@
|
|
|
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
|
-
"@xylabs/exists": "~5.0.
|
|
37
|
-
"@xylabs/hex": "~5.0.
|
|
38
|
-
"@xylabs/set": "~5.0.
|
|
39
|
-
"@xyo-network/boundwitness-model": "~5.1.
|
|
40
|
-
"@xyo-network/hash": "~5.1.
|
|
41
|
-
"@xyo-network/payload-builder": "~5.1.
|
|
42
|
-
"@xyo-network/payload-model": "~5.1.
|
|
39
|
+
"@xylabs/exists": "~5.0.33",
|
|
40
|
+
"@xylabs/hex": "~5.0.33",
|
|
41
|
+
"@xylabs/set": "~5.0.33",
|
|
42
|
+
"@xyo-network/boundwitness-model": "~5.1.23",
|
|
43
|
+
"@xyo-network/hash": "~5.1.23",
|
|
44
|
+
"@xyo-network/payload-builder": "~5.1.23",
|
|
45
|
+
"@xyo-network/payload-model": "~5.1.23"
|
|
43
46
|
},
|
|
44
47
|
"devDependencies": {
|
|
45
48
|
"@xylabs/ts-scripts-yarn3": "~7.2.8",
|
|
46
49
|
"@xylabs/tsconfig": "~7.2.8",
|
|
47
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
48
|
-
"@xyo-network/boundwitness-builder": "~5.1.
|
|
50
|
+
"@xylabs/vitest-extended": "~5.0.33",
|
|
51
|
+
"@xyo-network/boundwitness-builder": "~5.1.23",
|
|
49
52
|
"typescript": "~5.9.3",
|
|
50
|
-
"vitest": "~4.0.
|
|
53
|
+
"vitest": "~4.0.9"
|
|
51
54
|
},
|
|
52
55
|
"publishConfig": {
|
|
53
56
|
"access": "public"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"combinationsByBoundwitness.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/combinationsByBoundwitness.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"combinationsBySchema.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/combinationsBySchema.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intraBoundwitnessSchemaCombinations.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/intraBoundwitnessSchemaCombinations.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"combinationsByBoundwitness.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/combinationsByBoundwitness.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"combinationsBySchema.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/combinationsBySchema.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intraBoundwitnessSchemaCombinations.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/intraBoundwitnessSchemaCombinations.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"combinationsByBoundwitness.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/combinationsByBoundwitness.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"combinationsBySchema.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/combinationsBySchema.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intraBoundwitnessSchemaCombinations.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/intraBoundwitnessSchemaCombinations.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import '@xylabs/vitest-extended'
|
|
2
|
-
|
|
3
|
-
import { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'
|
|
4
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
5
|
-
import {
|
|
6
|
-
beforeAll,
|
|
7
|
-
describe, expect, it,
|
|
8
|
-
} from 'vitest'
|
|
9
|
-
|
|
10
|
-
import { combinationsByBoundwitness } from '../combinationsByBoundwitness.ts'
|
|
11
|
-
|
|
12
|
-
describe('combinationsByBoundwitness', () => {
|
|
13
|
-
const payloadCount = 2
|
|
14
|
-
const testMatrix: [string, string[]][] = [
|
|
15
|
-
['with single payload', ['network.xyo.temp.a']],
|
|
16
|
-
['with multiple payload', ['network.xyo.temp.a', 'network.xyo.temp.b']],
|
|
17
|
-
['with with many payloads', ['network.xyo.temp.a', 'network.xyo.temp.b', 'network.xyo.temp.c']],
|
|
18
|
-
]
|
|
19
|
-
describe.each(testMatrix)('%s', (_title, schemas) => {
|
|
20
|
-
const payloads = schemas.map((schema) => {
|
|
21
|
-
return [...Array(payloadCount).keys()].map((i) => {
|
|
22
|
-
return { i, schema }
|
|
23
|
-
})
|
|
24
|
-
})
|
|
25
|
-
const bws: BoundWitness[] = []
|
|
26
|
-
beforeAll(async () => {
|
|
27
|
-
for (const p of payloads) {
|
|
28
|
-
const bw = await (new BoundWitnessBuilder().payloads(p)).build()
|
|
29
|
-
bws.push(bw[0])
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
it('finds the distinct combinations of all payloads', async () => {
|
|
33
|
-
// All all inputs
|
|
34
|
-
const inputs = [...bws, ...payloads.flat()]
|
|
35
|
-
const result = await combinationsByBoundwitness(inputs)
|
|
36
|
-
expect(result).toBeArrayOfSize(bws.length)
|
|
37
|
-
})
|
|
38
|
-
it('filters duplicates', async () => {
|
|
39
|
-
// Add extra (duplicate) inputs
|
|
40
|
-
const inputs = [...bws, ...payloads.flat(), ...bws, ...payloads.flat()]
|
|
41
|
-
const result = await combinationsByBoundwitness(inputs)
|
|
42
|
-
expect(result).toBeArrayOfSize(bws.length)
|
|
43
|
-
})
|
|
44
|
-
it('omits sparse inputs', async () => {
|
|
45
|
-
// Remove some inputs
|
|
46
|
-
const input = payloads.flat()
|
|
47
|
-
input.pop() // Remove one payload
|
|
48
|
-
const inputs = [...bws, ...input]
|
|
49
|
-
const result = await combinationsByBoundwitness(inputs)
|
|
50
|
-
// Expect all except the one missing the payload
|
|
51
|
-
expect(result).toBeArrayOfSize(bws.length - 1)
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
})
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import '@xylabs/vitest-extended'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
describe, expect, it,
|
|
5
|
-
} from 'vitest'
|
|
6
|
-
|
|
7
|
-
import { combinationsBySchema } from '../combinationsBySchema.ts'
|
|
8
|
-
|
|
9
|
-
describe('combinationsBySchema', () => {
|
|
10
|
-
const payloadCount = 2
|
|
11
|
-
const testMatrix: [string, string[]][] = [
|
|
12
|
-
['with single schema', ['network.xyo.temp.a']],
|
|
13
|
-
['with two schemas', ['network.xyo.temp.a', 'network.xyo.temp.b']],
|
|
14
|
-
['with with many schemas', ['network.xyo.temp.a', 'network.xyo.temp.b', 'network.xyo.temp.c']],
|
|
15
|
-
]
|
|
16
|
-
describe.each(testMatrix)('%s', (_title, schemas) => {
|
|
17
|
-
const payloads = schemas.map((schema) => {
|
|
18
|
-
return [...Array(payloadCount).keys()].map((i) => {
|
|
19
|
-
return { i, schema }
|
|
20
|
-
})
|
|
21
|
-
})
|
|
22
|
-
it('finds the distinct combinations of all payloads', async () => {
|
|
23
|
-
const result = await combinationsBySchema(payloads.flat(), schemas)
|
|
24
|
-
expect(result).toBeArrayOfSize(Math.pow(payloadCount, schemas.length))
|
|
25
|
-
})
|
|
26
|
-
it('filters duplicates', async () => {
|
|
27
|
-
const result = await combinationsBySchema([...payloads.flat(), ...payloads[0]], schemas)
|
|
28
|
-
expect(result).toBeArrayOfSize(Math.pow(payloadCount, schemas.length))
|
|
29
|
-
})
|
|
30
|
-
})
|
|
31
|
-
describe.skip('with one dimension very large', () => {
|
|
32
|
-
const payloadCount = 5_000_000
|
|
33
|
-
const schemaA = 'network.xyo.temp.a'
|
|
34
|
-
const payloadsA = [...Array(payloadCount).keys()].map((i) => {
|
|
35
|
-
return { i, schema: schemaA }
|
|
36
|
-
})
|
|
37
|
-
const schemaB = 'network.xyo.temp.b'
|
|
38
|
-
const payloadsB = [{ i: 0, schema: schemaB }]
|
|
39
|
-
const payloads = [...payloadsA, ...payloadsB]
|
|
40
|
-
const schemas = [schemaA, schemaB]
|
|
41
|
-
it('finds the distinct combinations of all payloads', async () => {
|
|
42
|
-
const result = await combinationsBySchema(payloads.flat(), schemas)
|
|
43
|
-
expect(result).toBeArrayOfSize(Math.pow(payloadsA.length, payloadsB.length))
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
|
-
})
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import '@xylabs/vitest-extended'
|
|
2
|
-
|
|
3
|
-
import { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'
|
|
4
|
-
import {
|
|
5
|
-
describe, expect, it,
|
|
6
|
-
} from 'vitest'
|
|
7
|
-
|
|
8
|
-
import { intraBoundwitnessSchemaCombinations } from '../intraBoundwitnessSchemaCombinations.ts'
|
|
9
|
-
|
|
10
|
-
describe('intraBoundwitnessSchemaCombinations', () => {
|
|
11
|
-
const payloadCount = 2
|
|
12
|
-
const testMatrix: [string, string[]][] = [
|
|
13
|
-
['with single schema', ['network.xyo.temp.a']],
|
|
14
|
-
['with two schemas', ['network.xyo.temp.a', 'network.xyo.temp.b']],
|
|
15
|
-
['with with many schemas', ['network.xyo.temp.a', 'network.xyo.temp.b', 'network.xyo.temp.c']],
|
|
16
|
-
]
|
|
17
|
-
describe.each(testMatrix)('%s', (_title, schemas) => {
|
|
18
|
-
const payloads = schemas.map((schema) => {
|
|
19
|
-
return [...Array(payloadCount).keys()].map((i) => {
|
|
20
|
-
return { i, schema }
|
|
21
|
-
})
|
|
22
|
-
})
|
|
23
|
-
it('finds the distinct combinations of all payloads', async () => {
|
|
24
|
-
const [bw] = await new BoundWitnessBuilder().payloads(payloads.flat()).build()
|
|
25
|
-
const result = intraBoundwitnessSchemaCombinations(bw, schemas)
|
|
26
|
-
expect(result).toBeArrayOfSize(Math.pow(payloadCount, schemas.length))
|
|
27
|
-
})
|
|
28
|
-
})
|
|
29
|
-
describe.skip('with one dimension very large', () => {
|
|
30
|
-
const payloadCount = 5_000_000
|
|
31
|
-
const schemaA = 'network.xyo.temp.a'
|
|
32
|
-
const payloadsA = [...Array(payloadCount).keys()].map((i) => {
|
|
33
|
-
return { i, schema: schemaA }
|
|
34
|
-
})
|
|
35
|
-
const schemaB = 'network.xyo.temp.b'
|
|
36
|
-
const payloadsB = [{ i: 0, schema: schemaB }]
|
|
37
|
-
const payloads = [...payloadsA, ...payloadsB]
|
|
38
|
-
const schemas = [schemaA, schemaB]
|
|
39
|
-
it('finds the distinct combinations of all payloads', async () => {
|
|
40
|
-
const [bw] = await new BoundWitnessBuilder().payloads(payloads.flat()).build()
|
|
41
|
-
const result = intraBoundwitnessSchemaCombinations(bw, schemas)
|
|
42
|
-
expect(result).toBeArrayOfSize(Math.pow(payloadsA.length, payloadsB.length))
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
})
|