@xyo-network/api 2.47.8 → 2.47.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs.json +5788 -7256
- package/package.json +18 -18
- package/src/Api/Account/spec/Api.spec.ts +0 -58
- package/src/Api/Addresses/Address/spec/Api.spec.ts +0 -86
- package/src/Api/Addresses/spec/Api.spec.ts +0 -38
- package/src/Api/ApiUtil.spec.ts +0 -61
- package/src/Api/Archive/Api.spec.ts +0 -22
- package/src/Api/Archive/Schema/Api.spec.ts +0 -24
- package/src/Api/Archive/Schemas/Api.spec.ts +0 -24
- package/src/Api/Archive/Settings/Key/spec/Api.spec.ts +0 -39
- package/src/Api/Archives/Api.spec.ts +0 -12
- package/src/Api/Block/Api.spec.ts +0 -57
- package/src/Api/Node/Api.spec.ts +0 -146
- package/src/Api/Payload/Api.spec.ts +0 -34
- package/src/Api/Payload/Schema/Api.spec.ts +0 -61
- package/src/Api/spec/Api.spec.ts +0 -23
- package/src/Archivist/XyoRemoteArchivist.spec.ts +0 -55
- package/src/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.spec.ts +0 -81
- package/src/Diviner/ArchiveListApiDiviner/ArchiveListApiDiviner.spec.ts +0 -18
- package/src/Diviner/LocationDiviner/spec/LocationDivinerApi.spec.ts +0 -89
- package/src/Diviner/SchemaListApiDiviner/SchemaListApiDiviner.spec.ts +0 -22
- package/src/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDiviner.spec.ts +0 -19
- package/src/User/Api.spec.ts +0 -31
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { XyoApiConfig } from '@xyo-network/api-models'
|
|
2
|
-
import { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'
|
|
3
|
-
import { XyoSchemaPayload, XyoSchemaSchema } from '@xyo-network/schema-payload-plugin'
|
|
4
|
-
|
|
5
|
-
import { XyoArchivistApi } from '../../Api'
|
|
6
|
-
import { getNewArchive, getSchemaName } from '../../ApiUtil.spec'
|
|
7
|
-
|
|
8
|
-
const config: XyoApiConfig = {
|
|
9
|
-
apiDomain: process.env.API_DOMAIN || 'http://localhost:8080',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const payload: XyoSchemaPayload = {
|
|
13
|
-
definition: {
|
|
14
|
-
$id: '',
|
|
15
|
-
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
16
|
-
schema: getSchemaName(),
|
|
17
|
-
},
|
|
18
|
-
schema: XyoSchemaSchema,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
describe('XyoArchivistArchiveSchemaApi', () => {
|
|
22
|
-
const api = new XyoArchivistApi(config)
|
|
23
|
-
let archive = ''
|
|
24
|
-
beforeAll(async () => {
|
|
25
|
-
archive = await getNewArchive(api)
|
|
26
|
-
const [boundWitness] = new BoundWitnessBuilder({ inlinePayloads: true }).payload(payload).build()
|
|
27
|
-
await api.archives.archive(archive).block.post([boundWitness])
|
|
28
|
-
})
|
|
29
|
-
describe('get', () => {
|
|
30
|
-
it('calculates the correct path', () => {
|
|
31
|
-
const api = new XyoArchivistApi(config)
|
|
32
|
-
const path = api.archive(archive).payload.schema.config.root
|
|
33
|
-
expect(path).toBe(`/archive/${archive}/payload/schema/`)
|
|
34
|
-
})
|
|
35
|
-
it('lists the schema in the archive', async () => {
|
|
36
|
-
const api = new XyoArchivistApi(config)
|
|
37
|
-
const response = await api.archive(archive).payload.schema.get()
|
|
38
|
-
expect(response).toBeTruthy()
|
|
39
|
-
expect(Array.isArray(response)).toBe(true)
|
|
40
|
-
expect(response?.length).toBe(1)
|
|
41
|
-
expect(response?.[0]).toBe(payload.schema)
|
|
42
|
-
})
|
|
43
|
-
})
|
|
44
|
-
describe('stats', () => {
|
|
45
|
-
it('calculates the correct path', () => {
|
|
46
|
-
const api = new XyoArchivistApi(config)
|
|
47
|
-
const path = api.archive(archive).payload.schema.stats.config.root
|
|
48
|
-
expect(path).toBe(`/archive/${archive}/payload/schema/stats/`)
|
|
49
|
-
})
|
|
50
|
-
it('lists the stats for the payloads by schema in the archive', async () => {
|
|
51
|
-
const api = new XyoArchivistApi(config)
|
|
52
|
-
const response = await api.archive(archive).payload.schema.stats.get()
|
|
53
|
-
expect(response).toBeTruthy()
|
|
54
|
-
expect(response?.counts).toBeTruthy()
|
|
55
|
-
const schemas = Object.keys(response?.counts || {})
|
|
56
|
-
expect(schemas.length).toBe(1)
|
|
57
|
-
expect(schemas?.[0]).toBe(payload.schema)
|
|
58
|
-
expect(response?.counts[payload.schema]).toBe(1)
|
|
59
|
-
})
|
|
60
|
-
})
|
|
61
|
-
})
|
package/src/Api/spec/Api.spec.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { AddressPayload, AddressSchema } from '@xyo-network/address-payload-plugin'
|
|
2
|
-
import { QueryPayload, QuerySchema } from '@xyo-network/query-payload-plugin'
|
|
3
|
-
|
|
4
|
-
import { getApi } from '../ApiUtil.spec'
|
|
5
|
-
|
|
6
|
-
describe('XyoArchivistApi', () => {
|
|
7
|
-
describe('get', () => {
|
|
8
|
-
it('returns Node Discover', async () => {
|
|
9
|
-
const api = getApi()
|
|
10
|
-
expect(api).toBeDefined()
|
|
11
|
-
const response = await api.get()
|
|
12
|
-
expect(response).toBeArray()
|
|
13
|
-
|
|
14
|
-
expect(response).toBeArray()
|
|
15
|
-
const addressPayload = response?.find((p) => p.schema === AddressSchema) as AddressPayload
|
|
16
|
-
expect(addressPayload).toBeObject()
|
|
17
|
-
expect(addressPayload.address).toBeString()
|
|
18
|
-
|
|
19
|
-
const queries = response?.filter((d) => d.schema === QuerySchema) as QueryPayload[]
|
|
20
|
-
expect(queries.length).toBeGreaterThan(0)
|
|
21
|
-
})
|
|
22
|
-
})
|
|
23
|
-
})
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { XyoApiConfig } from '@xyo-network/api-models'
|
|
2
|
-
import { ArchivistWrapper } from '@xyo-network/archivist-wrapper'
|
|
3
|
-
import { XyoBoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
4
|
-
import { PayloadWrapper } from '@xyo-network/payload-wrapper'
|
|
5
|
-
import { IdSchema } from '@xyo-network/plugins'
|
|
6
|
-
|
|
7
|
-
import { XyoArchivistApi } from '../Api'
|
|
8
|
-
import { XyoRemoteArchivist } from './XyoRemoteArchivist'
|
|
9
|
-
import { XyoRemoteArchivistConfigSchema } from './XyoRemoteArchivistConfig'
|
|
10
|
-
|
|
11
|
-
const configData: XyoApiConfig = {
|
|
12
|
-
apiDomain: process.env.API_DOMAIN || 'http://locahost:8080',
|
|
13
|
-
onError: (error) => error,
|
|
14
|
-
onFailure: (response) => response,
|
|
15
|
-
onSuccess: (response) => response,
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const payload = {
|
|
19
|
-
salt: `${Math.random() * 10000}`,
|
|
20
|
-
schema: IdSchema,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
describe('XyoRemoteArchivist', () => {
|
|
24
|
-
let archivist: XyoRemoteArchivist
|
|
25
|
-
let wrapper: ArchivistWrapper
|
|
26
|
-
|
|
27
|
-
beforeEach(async () => {
|
|
28
|
-
const api = new XyoArchivistApi(configData)
|
|
29
|
-
archivist = await XyoRemoteArchivist.create({ config: { api, schema: XyoRemoteArchivistConfigSchema } })
|
|
30
|
-
wrapper = new ArchivistWrapper(archivist)
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
it('get return payloads', async () => {
|
|
34
|
-
const result = (await archivist.insert([payload])).pop()
|
|
35
|
-
expect(result?.payload_hashes.length).toBe(1)
|
|
36
|
-
const getResult = await archivist.get([new PayloadWrapper(payload).hash])
|
|
37
|
-
expect(getResult.length).toBe(1)
|
|
38
|
-
expect(getResult[0]?.schema).toBe(payload.schema)
|
|
39
|
-
|
|
40
|
-
const findResult = await wrapper.find()
|
|
41
|
-
expect(findResult.length).toBe(20)
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it('get returns boundwitness', async () => {
|
|
45
|
-
const payload = {
|
|
46
|
-
payload_hashes: ['123456'],
|
|
47
|
-
payload_schemas: [IdSchema],
|
|
48
|
-
schema: XyoBoundWitnessSchema,
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
await archivist.insert([payload])
|
|
52
|
-
const getResult = await archivist.get([new PayloadWrapper(payload).hash])
|
|
53
|
-
expect(getResult?.[0].schema).toBe(XyoBoundWitnessSchema)
|
|
54
|
-
})
|
|
55
|
-
})
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { Account } from '@xyo-network/account'
|
|
2
|
-
import { XyoApiConfig } from '@xyo-network/api-models'
|
|
3
|
-
import { XyoBoundWitness, XyoBoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
4
|
-
import { BoundWitnessWrapper } from '@xyo-network/boundwitness-wrapper'
|
|
5
|
-
import { AddressHistoryQueryPayload, AddressHistoryQuerySchema, DivinerWrapper } from '@xyo-network/diviner'
|
|
6
|
-
import { XyoPayloadBuilder } from '@xyo-network/payload-builder'
|
|
7
|
-
|
|
8
|
-
import { XyoArchivistApi } from '../../Api'
|
|
9
|
-
import { XyoRemoteDivinerConfigSchema } from '../XyoRemoteDivinerConfig'
|
|
10
|
-
import { XyoRemoteAddressHistoryDiviner } from './XyoRemoteAddressHistoryDiviner'
|
|
11
|
-
|
|
12
|
-
const configData: XyoApiConfig = {
|
|
13
|
-
apiDomain: process.env.API_DOMAIN || 'http://locahost:8080',
|
|
14
|
-
onError: (error) => error,
|
|
15
|
-
onFailure: (response) => response,
|
|
16
|
-
onSuccess: (response) => response,
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
describe('XyoRemoteAddressHistoryDiviner', () => {
|
|
20
|
-
const address = new Account({ phrase: 'test' }).addressValue.hex
|
|
21
|
-
const api = new XyoArchivistApi(configData)
|
|
22
|
-
let diviner: XyoRemoteAddressHistoryDiviner
|
|
23
|
-
beforeAll(async () => {
|
|
24
|
-
diviner = await XyoRemoteAddressHistoryDiviner.create({ config: { api, schema: XyoRemoteDivinerConfigSchema } })
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
describe('with valid address returns', () => {
|
|
28
|
-
let result: XyoBoundWitness[]
|
|
29
|
-
beforeAll(async () => {
|
|
30
|
-
const source = new XyoPayloadBuilder<AddressHistoryQueryPayload>({ schema: AddressHistoryQuerySchema }).fields({ address }).build()
|
|
31
|
-
result = (await new DivinerWrapper(diviner).divine([source])) as XyoBoundWitness[]
|
|
32
|
-
expect(result.length).toBeGreaterThan(0)
|
|
33
|
-
})
|
|
34
|
-
it('array of Bound Witnesses', () => {
|
|
35
|
-
result.map((bw) => {
|
|
36
|
-
expect(bw.schema).toBe(XyoBoundWitnessSchema)
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
it('from address', () => {
|
|
40
|
-
expect(result.length).toBeGreaterThan(0)
|
|
41
|
-
result.map((bw) => {
|
|
42
|
-
expect(bw.addresses).toContain(address)
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
|
-
describe('with hash offset returns', () => {
|
|
47
|
-
let result: XyoBoundWitness[]
|
|
48
|
-
let hash: string
|
|
49
|
-
beforeAll(async () => {
|
|
50
|
-
let source = new XyoPayloadBuilder<AddressHistoryQueryPayload>({ schema: AddressHistoryQuerySchema }).fields({ address }).build()
|
|
51
|
-
result = (await new DivinerWrapper(diviner).divine([source])) as XyoBoundWitness[]
|
|
52
|
-
expect(result.length).toBeGreaterThan(0)
|
|
53
|
-
hash = new BoundWitnessWrapper(result?.[0]).hash
|
|
54
|
-
source = new XyoPayloadBuilder<AddressHistoryQueryPayload>({ schema: AddressHistoryQuerySchema }).fields({ address, offset: hash }).build()
|
|
55
|
-
result = (await new DivinerWrapper(diviner).divine([source])) as XyoBoundWitness[]
|
|
56
|
-
expect(result.length).toBeGreaterThan(0)
|
|
57
|
-
})
|
|
58
|
-
it('results starting at hash', () => {
|
|
59
|
-
expect(new BoundWitnessWrapper(result?.[0]).hash).toBe(hash)
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
describe('with limit returns', () => {
|
|
63
|
-
const limit = 1
|
|
64
|
-
let result: XyoBoundWitness[]
|
|
65
|
-
beforeAll(async () => {
|
|
66
|
-
const source = new XyoPayloadBuilder<AddressHistoryQueryPayload>({ schema: AddressHistoryQuerySchema }).fields({ address, limit }).build()
|
|
67
|
-
result = (await new DivinerWrapper(diviner).divine([source])) as XyoBoundWitness[]
|
|
68
|
-
expect(result.length).toBeGreaterThan(0)
|
|
69
|
-
})
|
|
70
|
-
it('number of results specified by the limit', () => {
|
|
71
|
-
expect(result.length).toBe(limit)
|
|
72
|
-
})
|
|
73
|
-
})
|
|
74
|
-
describe('with non-existent address', () => {
|
|
75
|
-
it('returns empty array', async () => {
|
|
76
|
-
const source = new XyoPayloadBuilder<AddressHistoryQueryPayload>({ schema: AddressHistoryQuerySchema }).fields({ address: 'foo' }).build()
|
|
77
|
-
const result = await new DivinerWrapper(diviner).divine([source])
|
|
78
|
-
expect(result.length).toBe(0)
|
|
79
|
-
})
|
|
80
|
-
})
|
|
81
|
-
})
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { XyoApiConfig } from '@xyo-network/api-models'
|
|
2
|
-
|
|
3
|
-
import { XyoArchivistApi } from '../../Api'
|
|
4
|
-
import { ArchiveListApiDiviner } from './ArchiveListApiDiviner'
|
|
5
|
-
import { XyoArchiveListApiDivinerConfigSchema, XyoArchiveSchema } from './ArchiveListApiDivinerConfig'
|
|
6
|
-
|
|
7
|
-
const configData: XyoApiConfig = {
|
|
8
|
-
apiDomain: process.env.API_DOMAIN || 'http://locahost:8080',
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
test('ArchiveListApiDiviner', async () => {
|
|
12
|
-
const api = new XyoArchivistApi(configData)
|
|
13
|
-
const diviner = await ArchiveListApiDiviner.create({ api, config: { schema: XyoArchiveListApiDivinerConfigSchema } })
|
|
14
|
-
expect(diviner).toBeDefined()
|
|
15
|
-
const result = await diviner.divine()
|
|
16
|
-
expect(result.length).toBeGreaterThan(0)
|
|
17
|
-
expect(result[0].schema).toBe(XyoArchiveSchema)
|
|
18
|
-
})
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { XyoApiConfig } from '@xyo-network/api-models'
|
|
2
|
-
|
|
3
|
-
import { ApiConfig } from '../ApiConfig'
|
|
4
|
-
import { XyoLocationDivinerApi } from '../LocationDivinerApi'
|
|
5
|
-
import {
|
|
6
|
-
LocationHeatmapQueryCreationRequest,
|
|
7
|
-
locationHeatmapQuerySchema,
|
|
8
|
-
LocationTimeRangeQueryCreationRequest,
|
|
9
|
-
LocationTimeRangeQuerySchema,
|
|
10
|
-
} from '../Queries'
|
|
11
|
-
import { LocationWitnessSchema } from '../Witnesses'
|
|
12
|
-
|
|
13
|
-
const getLocationApiConfig = (): ApiConfig => {
|
|
14
|
-
return {
|
|
15
|
-
apiDomain: process.env.LOCATION_API_DOMAIN || 'http://localhost:8082',
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const getArchiveConfig = (): XyoApiConfig => {
|
|
20
|
-
const apiDomain = process.env.API_DOMAIN || 'http://localhost:8080'
|
|
21
|
-
return { apiDomain }
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const getDefaultStartStopTime = () => {
|
|
25
|
-
const startTime = new Date(0).toISOString()
|
|
26
|
-
const stopTime = new Date().toISOString()
|
|
27
|
-
return { startTime, stopTime }
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const getLocationTimeRangeQueryCreationRequest = (): LocationTimeRangeQueryCreationRequest => {
|
|
31
|
-
const query = { schema: LocationWitnessSchema, ...getDefaultStartStopTime() }
|
|
32
|
-
const sourceArchivist = { ...getArchiveConfig() }
|
|
33
|
-
const resultArchivist = { ...getArchiveConfig() }
|
|
34
|
-
return {
|
|
35
|
-
query,
|
|
36
|
-
resultArchive: 'temp',
|
|
37
|
-
resultArchivist,
|
|
38
|
-
schema: LocationTimeRangeQuerySchema,
|
|
39
|
-
sourceArchive: 'temp',
|
|
40
|
-
sourceArchivist,
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const getLocationHeatmapQueryCreationRequest = (): LocationHeatmapQueryCreationRequest => {
|
|
45
|
-
const query = { schema: LocationWitnessSchema, ...getDefaultStartStopTime() }
|
|
46
|
-
const sourceArchivist = { ...getArchiveConfig() }
|
|
47
|
-
const resultArchivist = { ...getArchiveConfig() }
|
|
48
|
-
return {
|
|
49
|
-
query,
|
|
50
|
-
resultArchive: 'temp',
|
|
51
|
-
resultArchivist,
|
|
52
|
-
schema: locationHeatmapQuerySchema,
|
|
53
|
-
sourceArchive: 'temp',
|
|
54
|
-
sourceArchivist,
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const describeSkipIfNoDiviner = process.env.LOCATION_API_DOMAIN ? describe : describe.skip
|
|
59
|
-
|
|
60
|
-
describeSkipIfNoDiviner('XyoLocationDivinerApi', () => {
|
|
61
|
-
describe('constructor', () => {
|
|
62
|
-
it('returns a new XyoLocationDivinerApi', () => {
|
|
63
|
-
const api = new XyoLocationDivinerApi(getLocationApiConfig())
|
|
64
|
-
expect(api).toBeDefined()
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
describe('postLocationQuery', () => {
|
|
68
|
-
it('posts a location heatmap query', async () => {
|
|
69
|
-
const api = new XyoLocationDivinerApi(getLocationApiConfig())
|
|
70
|
-
const locationQuery = await api.postLocationQuery(getLocationHeatmapQueryCreationRequest())
|
|
71
|
-
const response = await api.getLocationQuery(locationQuery.hash)
|
|
72
|
-
expect(response.queryHash).toBe(locationQuery.hash)
|
|
73
|
-
})
|
|
74
|
-
it('posts a location time range query', async () => {
|
|
75
|
-
const api = new XyoLocationDivinerApi(getLocationApiConfig())
|
|
76
|
-
const locationQuery = await api.postLocationQuery(getLocationTimeRangeQueryCreationRequest())
|
|
77
|
-
const response = await api.getLocationQuery(locationQuery.hash)
|
|
78
|
-
expect(response.queryHash).toBe(locationQuery.hash)
|
|
79
|
-
})
|
|
80
|
-
})
|
|
81
|
-
describe('getLocationQuery', function () {
|
|
82
|
-
it('gets the status of a previously posted location query', async () => {
|
|
83
|
-
const api = new XyoLocationDivinerApi(getLocationApiConfig())
|
|
84
|
-
const locationQuery = await api.postLocationQuery(getLocationTimeRangeQueryCreationRequest())
|
|
85
|
-
const response = await api.getLocationQuery(locationQuery.hash)
|
|
86
|
-
expect(response.queryHash).toBe(locationQuery.hash)
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
})
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/* eslint-disable deprecation/deprecation */
|
|
2
|
-
/* eslint-disable import/no-deprecated */
|
|
3
|
-
import { XyoApiConfig } from '@xyo-network/api-models'
|
|
4
|
-
|
|
5
|
-
import { XyoArchivistApi } from '../../Api'
|
|
6
|
-
import { SchemaListApiDiviner } from './SchemaListApiDiviner'
|
|
7
|
-
import { XyoSchemaListApiDivinerConfigSchema } from './SchemaListApiDivinerConfig'
|
|
8
|
-
|
|
9
|
-
const configData: XyoApiConfig = {
|
|
10
|
-
apiDomain: process.env.API_DOMAIN || 'http://locahost:8080',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
test('SchemaListApiDiviner', async () => {
|
|
14
|
-
const api = new XyoArchivistApi(configData)
|
|
15
|
-
const diviner = await SchemaListApiDiviner.create({
|
|
16
|
-
api,
|
|
17
|
-
config: { archive: 'temp', schema: XyoSchemaListApiDivinerConfigSchema },
|
|
18
|
-
})
|
|
19
|
-
expect(diviner).toBeDefined()
|
|
20
|
-
const result = await diviner.divine()
|
|
21
|
-
expect(result.length).toBeGreaterThan(0)
|
|
22
|
-
})
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/* eslint-disable deprecation/deprecation */
|
|
2
|
-
/* eslint-disable import/no-deprecated */
|
|
3
|
-
import { XyoApiConfig } from '@xyo-network/api-models'
|
|
4
|
-
|
|
5
|
-
import { XyoArchivistApi } from '../../Api'
|
|
6
|
-
import { SchemaStatsApiDiviner } from './SchemaStatsApiDiviner'
|
|
7
|
-
import { XyoSchemaStatsApiDivinerConfigSchema } from './SchemaStatsApiDivinerConfig'
|
|
8
|
-
|
|
9
|
-
const configData: XyoApiConfig = {
|
|
10
|
-
apiDomain: process.env.API_DOMAIN || 'http://locahost:8080',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
test('SchemaStatsApiDiviner', async () => {
|
|
14
|
-
const api = new XyoArchivistApi(configData)
|
|
15
|
-
const diviner = await SchemaStatsApiDiviner.create({ api, config: { archive: 'temp', schema: XyoSchemaStatsApiDivinerConfigSchema } })
|
|
16
|
-
expect(diviner).toBeDefined()
|
|
17
|
-
const result = await diviner.divine()
|
|
18
|
-
expect(result.length).toBeGreaterThan(0)
|
|
19
|
-
})
|
package/src/User/Api.spec.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { XyoApiConfig } from '@xyo-network/api-models'
|
|
2
|
-
import { typeOf } from '@xyo-network/typeof'
|
|
3
|
-
|
|
4
|
-
import { XyoArchivistApi } from '../Api'
|
|
5
|
-
import { XyoUserApi } from './Api'
|
|
6
|
-
|
|
7
|
-
const timeout = 20000
|
|
8
|
-
const config: XyoApiConfig = {
|
|
9
|
-
apiDomain: process.env.API_DOMAIN || 'http://localhost:8080',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
describe('XyoAuthApi', () => {
|
|
13
|
-
describe('get', () => {
|
|
14
|
-
it('returns a new XyoAuthApi', () => {
|
|
15
|
-
const api = new XyoUserApi(config)
|
|
16
|
-
expect(api).toBeDefined()
|
|
17
|
-
})
|
|
18
|
-
})
|
|
19
|
-
describe('walletChallenge', function () {
|
|
20
|
-
it(
|
|
21
|
-
'returns a nonce',
|
|
22
|
-
async () => {
|
|
23
|
-
const api = new XyoArchivistApi(config)
|
|
24
|
-
const response = await api.account('0xfEf40940e776A3686Cb29eC712d60859EA9f99F7').challenge.post()
|
|
25
|
-
expect(response?.state).toBeDefined()
|
|
26
|
-
expect(typeOf(response?.state)).toBe('string')
|
|
27
|
-
},
|
|
28
|
-
timeout,
|
|
29
|
-
)
|
|
30
|
-
})
|
|
31
|
-
})
|