@xyo-network/api 2.47.4 → 2.47.6
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/cjs/Api/Addresses/Address/Api.js.map +1 -1
- package/dist/cjs/Api/Addresses/Api.js.map +1 -1
- package/dist/cjs/Api/Api.js.map +1 -1
- package/dist/docs.json +7837 -6937
- package/dist/esm/Api/Addresses/Address/Api.js.map +1 -1
- package/dist/esm/Api/Addresses/Api.js.map +1 -1
- package/dist/esm/Api/Api.js.map +1 -1
- package/dist/types/Api/Addresses/Address/Api.d.ts +2 -2
- package/dist/types/Api/Addresses/Address/Api.d.ts.map +1 -1
- package/dist/types/Api/Addresses/Api.d.ts +2 -2
- package/dist/types/Api/Addresses/Api.d.ts.map +1 -1
- package/dist/types/Api/Api.d.ts +2 -2
- package/dist/types/Api/Api.d.ts.map +1 -1
- package/package.json +18 -19
- package/src/Api/Account/{Api.spec.ts → spec/Api.spec.ts} +3 -3
- package/src/Api/Addresses/Address/Api.spec.ts +1 -1
- package/src/Api/Addresses/Address/Api.ts +2 -2
- package/src/Api/Addresses/Address/spec/Api.spec.ts +86 -0
- package/src/Api/Addresses/Api.ts +2 -2
- package/src/Api/Addresses/spec/Api.spec.ts +38 -0
- package/src/Api/Api.ts +2 -3
- package/src/Api/spec/Api.spec.ts +23 -0
- package/src/Api/Addresses/Api.spec.ts +0 -48
- package/src/Api/Api.spec.ts +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Api.js","sourceRoot":"","sources":["../../../../../src/Api/Addresses/Address/Api.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,MAAM,OAAO,aAAqD,SAAQ,
|
|
1
|
+
{"version":3,"file":"Api.js","sourceRoot":"","sources":["../../../../../src/Api/Addresses/Address/Api.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,MAAM,OAAO,aAAqD,SAAQ,YAA6B;IACrG;;OAEG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,YAAY,CAAC;YACtB,GAAG,IAAI,CAAC,MAAM;YACd,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,eAAe;SAClC,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Api.js","sourceRoot":"","sources":["../../../../src/Api/Addresses/Api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEzC,MAAM,OAAO,eAAuD,SAAQ,
|
|
1
|
+
{"version":3,"file":"Api.js","sourceRoot":"","sources":["../../../../src/Api/Addresses/Api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEzC,MAAM,OAAO,eAAuD,SAAQ,YAA4B;IACtG;;OAEG;IACI,OAAO,CAAC,OAAe;QAC5B,OAAO,IAAI,aAAa,CAAC;YACvB,GAAG,IAAI,CAAC,MAAM;YACd,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,OAAO,GAAG;SAChC,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/dist/esm/Api/Api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Api.js","sourceRoot":"","sources":["../../../src/Api/Api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAInD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"Api.js","sourceRoot":"","sources":["../../../src/Api/Api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAInD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CACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { XyoApiConfig } from '@xyo-network/api-models';
|
|
2
2
|
import { XyoBoundWitness } from '@xyo-network/boundwitness-model';
|
|
3
|
-
import {
|
|
3
|
+
import { XyoPayload } from '@xyo-network/payload-model';
|
|
4
4
|
import { XyoApiSimple } from '../../../Simple';
|
|
5
|
-
export declare class XyoAddressApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<
|
|
5
|
+
export declare class XyoAddressApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<XyoPayload[], C> {
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Use module API
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../../../../src/Api/Addresses/Address/Api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../../../../src/Api/Addresses/Address/Api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,qBAAa,aAAa,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CAAE,SAAQ,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACrG;;OAEG;IACH,IAAW,cAAc,IAAI,YAAY,CAAC,eAAe,EAAE,CAAC,CAK3D;CACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { XyoApiConfig } from '@xyo-network/api-models';
|
|
2
|
-
import {
|
|
2
|
+
import { XyoPayloads } from '@xyo-network/payload-model';
|
|
3
3
|
import { XyoApiSimple } from '../../Simple';
|
|
4
4
|
import { XyoAddressApi } from './Address';
|
|
5
|
-
export declare class XyoAddressesApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<
|
|
5
|
+
export declare class XyoAddressesApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<XyoPayloads, C> {
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Use module API
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../../../src/Api/Addresses/Api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../../../src/Api/Addresses/Api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEzC,qBAAa,eAAe,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CAAE,SAAQ,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;IACtG;;OAEG;IACI,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa;CAM/C"}
|
package/dist/types/Api/Api.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { XyoApiConfig } from '@xyo-network/api-models';
|
|
|
2
2
|
import { XyoBoundWitness } from '@xyo-network/boundwitness-model';
|
|
3
3
|
import { DataLike } from '@xyo-network/core';
|
|
4
4
|
import { Huri } from '@xyo-network/huri';
|
|
5
|
-
import {
|
|
5
|
+
import { XyoPayloads } from '@xyo-network/payload-model';
|
|
6
6
|
import { XyoApiSimple } from '../Simple';
|
|
7
7
|
import { XyoUserApi } from '../User';
|
|
8
8
|
import { XyoAccountApi } from './Account';
|
|
@@ -10,7 +10,7 @@ import { XyoAddressesApi } from './Addresses';
|
|
|
10
10
|
import { XyoArchivistArchiveApi } from './Archive';
|
|
11
11
|
import { XyoArchivistArchivesApi } from './Archives';
|
|
12
12
|
import { XyoArchivistNodeApi } from './Node';
|
|
13
|
-
export declare class XyoArchivistApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<
|
|
13
|
+
export declare class XyoArchivistApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<XyoPayloads, C> {
|
|
14
14
|
private _addresses?;
|
|
15
15
|
private _archives?;
|
|
16
16
|
private _stats?;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../../src/Api/Api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../../src/Api/Api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAc,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AAE5C,qBAAa,eAAe,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CAAE,SAAQ,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;IACtG,OAAO,CAAC,UAAU,CAAC,CAAiB;IACpC,OAAO,CAAC,SAAS,CAAC,CAAyB;IAC3C,OAAO,CAAC,MAAM,CAAC,CAAyB;IACxC,OAAO,CAAC,KAAK,CAAC,CAAY;IAE1B;;OAEG;IACH,IAAW,SAAS,IAAI,eAAe,CAQtC;IAED,IAAW,QAAQ,IAAI,uBAAuB,CAQ7C;IAED;;OAEG;IACH,IAAW,KAAK,6GAQf;IAED,IAAW,IAAI,IAAI,UAAU,CAQ5B;IAEM,OAAO,CAAC,OAAO,EAAE,QAAQ;IAOzB,OAAO,CAAC,OAAO,SAAS;IAQxB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;;;;;IAQ/B;;;;;OAKG;IACI,IAAI,CAAC,KAAK,SAAS,eAAe,GAAG,eAAe,EAAE,GAAG,eAAe,GAAG,eAAe,EAAE,EAAE,OAAO,SAAS;CAMtH"}
|
package/package.json
CHANGED
|
@@ -11,29 +11,28 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xylabs/assert": "^2.7.1",
|
|
13
13
|
"@xylabs/delay": "^2.7.1",
|
|
14
|
-
"@xyo-network/account": "^2.47.
|
|
15
|
-
"@xyo-network/api-models": "^2.47.
|
|
16
|
-
"@xyo-network/archivist": "^2.47.
|
|
17
|
-
"@xyo-network/axios": "^2.47.
|
|
18
|
-
"@xyo-network/boundwitness-builder": "^2.47.
|
|
19
|
-
"@xyo-network/boundwitness-model": "^2.47.
|
|
20
|
-
"@xyo-network/core": "^2.47.
|
|
21
|
-
"@xyo-network/diviner": "^2.47.
|
|
22
|
-
"@xyo-network/diviner-model": "^2.47.
|
|
23
|
-
"@xyo-network/huri": "^2.47.
|
|
24
|
-
"@xyo-network/module": "^2.47.
|
|
25
|
-
"@xyo-network/
|
|
26
|
-
"@xyo-network/payload-
|
|
27
|
-
"@xyo-network/payload-
|
|
28
|
-
"@xyo-network/payload-
|
|
29
|
-
"@xyo-network/schema-payload-plugin": "^2.47.4",
|
|
14
|
+
"@xyo-network/account": "^2.47.6",
|
|
15
|
+
"@xyo-network/api-models": "^2.47.6",
|
|
16
|
+
"@xyo-network/archivist": "^2.47.6",
|
|
17
|
+
"@xyo-network/axios": "^2.47.6",
|
|
18
|
+
"@xyo-network/boundwitness-builder": "^2.47.6",
|
|
19
|
+
"@xyo-network/boundwitness-model": "^2.47.6",
|
|
20
|
+
"@xyo-network/core": "^2.47.6",
|
|
21
|
+
"@xyo-network/diviner": "^2.47.6",
|
|
22
|
+
"@xyo-network/diviner-model": "^2.47.6",
|
|
23
|
+
"@xyo-network/huri": "^2.47.6",
|
|
24
|
+
"@xyo-network/module": "^2.47.6",
|
|
25
|
+
"@xyo-network/payload-builder": "^2.47.6",
|
|
26
|
+
"@xyo-network/payload-model": "^2.47.6",
|
|
27
|
+
"@xyo-network/payload-wrapper": "^2.47.6",
|
|
28
|
+
"@xyo-network/schema-payload-plugin": "^2.47.6",
|
|
30
29
|
"lodash": "^4.17.21"
|
|
31
30
|
},
|
|
32
31
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
33
32
|
"devDependencies": {
|
|
34
33
|
"@types/lodash": "^4.14.191",
|
|
35
|
-
"@xylabs/ts-scripts-yarn3": "^2.14.
|
|
36
|
-
"@xylabs/tsconfig": "^2.14.
|
|
34
|
+
"@xylabs/ts-scripts-yarn3": "^2.14.16",
|
|
35
|
+
"@xylabs/tsconfig": "^2.14.16",
|
|
37
36
|
"typescript": "^4.9.5"
|
|
38
37
|
},
|
|
39
38
|
"browser": "dist/esm/index.js",
|
|
@@ -69,5 +68,5 @@
|
|
|
69
68
|
},
|
|
70
69
|
"sideEffects": false,
|
|
71
70
|
"types": "dist/types/index.d.ts",
|
|
72
|
-
"version": "2.47.
|
|
71
|
+
"version": "2.47.6"
|
|
73
72
|
}
|
|
@@ -2,8 +2,8 @@ import { Account } from '@xyo-network/account'
|
|
|
2
2
|
import { XyoApiConfig } from '@xyo-network/api-models'
|
|
3
3
|
import { typeOf } from '@xyo-network/typeof'
|
|
4
4
|
|
|
5
|
-
import { XyoArchivistApi } from '
|
|
6
|
-
import { XyoAccountApi } from '
|
|
5
|
+
import { XyoArchivistApi } from '../../Api'
|
|
6
|
+
import { XyoAccountApi } from '../Api'
|
|
7
7
|
|
|
8
8
|
const timeout = 20000
|
|
9
9
|
const config: XyoApiConfig = {
|
|
@@ -26,7 +26,7 @@ describe('XyoAuthApi', () => {
|
|
|
26
26
|
const account = Account.random()
|
|
27
27
|
const [data, envelope, response] = await api.account(account.addressValue.hex).challenge.post(undefined, 'tuple')
|
|
28
28
|
expect(response.status).toBe(200)
|
|
29
|
-
expect(envelope.
|
|
29
|
+
expect(envelope.errors).toBeUndefined()
|
|
30
30
|
expect(typeOf(data?.state)).toBe('string')
|
|
31
31
|
},
|
|
32
32
|
timeout,
|
|
@@ -19,7 +19,7 @@ describe('XyoAddressApi', () => {
|
|
|
19
19
|
let api: XyoAddressApi
|
|
20
20
|
let result: XyoApiResponseBody<ModuleDescription>
|
|
21
21
|
beforeAll(async () => {
|
|
22
|
-
const address = assertEx((await new XyoAddressesApi(config).get())?.children?.pop()
|
|
22
|
+
const address = assertEx((await new XyoAddressesApi(config).get())?.children?.pop())
|
|
23
23
|
api = new XyoArchivistApi(config).addresses.address(address)
|
|
24
24
|
result = await api.get()
|
|
25
25
|
expect(result).toBeObject()
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { XyoApiConfig } from '@xyo-network/api-models'
|
|
2
2
|
import { XyoBoundWitness } from '@xyo-network/boundwitness-model'
|
|
3
|
-
import {
|
|
3
|
+
import { XyoPayload } from '@xyo-network/payload-model'
|
|
4
4
|
|
|
5
5
|
import { XyoApiSimple } from '../../../Simple'
|
|
6
6
|
|
|
7
|
-
export class XyoAddressApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<
|
|
7
|
+
export class XyoAddressApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<XyoPayload[], C> {
|
|
8
8
|
/**
|
|
9
9
|
* @deprecated Use module API
|
|
10
10
|
*/
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { assertEx } from '@xylabs/assert'
|
|
2
|
+
import { Account } from '@xyo-network/account'
|
|
3
|
+
import { AddressPayload, AddressSchema } from '@xyo-network/address-payload-plugin'
|
|
4
|
+
import { XyoApiConfig, XyoApiResponseBody } from '@xyo-network/api-models'
|
|
5
|
+
import { XyoBoundWitness } from '@xyo-network/boundwitness-model'
|
|
6
|
+
import { BoundWitnessWrapper } from '@xyo-network/boundwitness-wrapper'
|
|
7
|
+
import { XyoPayload } from '@xyo-network/payload-model'
|
|
8
|
+
import { QueryPayload, QuerySchema } from '@xyo-network/query-payload-plugin'
|
|
9
|
+
|
|
10
|
+
import { XyoApiSimple } from '../../../../Simple'
|
|
11
|
+
import { XyoArchivistApi } from '../../../Api'
|
|
12
|
+
import { XyoAddressesApi } from '../../Api'
|
|
13
|
+
import { XyoAddressApi } from '../Api'
|
|
14
|
+
|
|
15
|
+
const config: XyoApiConfig = {
|
|
16
|
+
apiDomain: process.env.API_DOMAIN || 'http://localhost:8080',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
describe('XyoAddressApi', () => {
|
|
20
|
+
describe('get', () => {
|
|
21
|
+
let api: XyoAddressApi
|
|
22
|
+
let result: XyoApiResponseBody<XyoPayload[]>
|
|
23
|
+
beforeAll(async () => {
|
|
24
|
+
const payloads = await new XyoAddressesApi(config).get()
|
|
25
|
+
expect(payloads).toBeArray()
|
|
26
|
+
const addressPayload = payloads?.find((p) => p.schema === AddressSchema) as AddressPayload
|
|
27
|
+
expect(addressPayload).toBeObject()
|
|
28
|
+
const address = addressPayload.address
|
|
29
|
+
api = new XyoArchivistApi(config).addresses.address(address)
|
|
30
|
+
result = await api.get()
|
|
31
|
+
expect(result).toBeArray()
|
|
32
|
+
})
|
|
33
|
+
it('method exists', () => {
|
|
34
|
+
expect(api).toBeDefined()
|
|
35
|
+
expect(api.get).toBeFunction()
|
|
36
|
+
})
|
|
37
|
+
describe('returns module', () => {
|
|
38
|
+
it('address', () => {
|
|
39
|
+
const addressPayload = result?.find((p) => p.schema === AddressSchema) as AddressPayload
|
|
40
|
+
expect(addressPayload).toBeObject()
|
|
41
|
+
const address = addressPayload.address
|
|
42
|
+
expect(address).toBeString()
|
|
43
|
+
})
|
|
44
|
+
it('supported queries', () => {
|
|
45
|
+
const queryPayloads = result?.filter((p) => p.schema === QuerySchema) as QueryPayload[]
|
|
46
|
+
expect(queryPayloads).toBeArray()
|
|
47
|
+
expect(queryPayloads.length).toBeGreaterThan(0)
|
|
48
|
+
queryPayloads?.map((query) => {
|
|
49
|
+
expect(query.query).toBeString()
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
describe('boundWitness', () => {
|
|
55
|
+
let address: string
|
|
56
|
+
let api: XyoApiSimple<XyoBoundWitness[]>
|
|
57
|
+
let history: XyoBoundWitness[]
|
|
58
|
+
beforeAll(async () => {
|
|
59
|
+
address = new Account({ phrase: 'test' }).addressValue.hex
|
|
60
|
+
api = new XyoArchivistApi(config).addresses.address(address).boundWitnesses
|
|
61
|
+
const result = await api.get()
|
|
62
|
+
expect(result).toBeArray()
|
|
63
|
+
history = assertEx(result)
|
|
64
|
+
})
|
|
65
|
+
it('method exists', () => {
|
|
66
|
+
expect(api).toBeDefined()
|
|
67
|
+
expect(api.get).toBeFunction()
|
|
68
|
+
})
|
|
69
|
+
describe('return BoundWitnesses', () => {
|
|
70
|
+
it('from the address specified', () => {
|
|
71
|
+
history?.map((block) => expect(block.addresses).toContain(address))
|
|
72
|
+
})
|
|
73
|
+
it('in sequential order', () => {
|
|
74
|
+
verifyBlockChainHistory(history)
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const verifyBlockChainHistory = (history: XyoBoundWitness[]) => {
|
|
81
|
+
for (let i = 1; i < history.length; i++) {
|
|
82
|
+
const current = history[i - 1]
|
|
83
|
+
const previous = history[i]
|
|
84
|
+
expect(current.previous_hashes).toContain(new BoundWitnessWrapper(previous).hash)
|
|
85
|
+
}
|
|
86
|
+
}
|
package/src/Api/Addresses/Api.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { XyoApiConfig } from '@xyo-network/api-models'
|
|
2
|
-
import {
|
|
2
|
+
import { XyoPayloads } from '@xyo-network/payload-model'
|
|
3
3
|
|
|
4
4
|
import { XyoApiSimple } from '../../Simple'
|
|
5
5
|
import { XyoAddressApi } from './Address'
|
|
6
6
|
|
|
7
|
-
export class XyoAddressesApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<
|
|
7
|
+
export class XyoAddressesApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<XyoPayloads, C> {
|
|
8
8
|
/**
|
|
9
9
|
* @deprecated Use module API
|
|
10
10
|
*/
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AddressPayload, AddressSchema } from '@xyo-network/address-payload-plugin'
|
|
2
|
+
import { XyoApiConfig, XyoApiResponseBody } from '@xyo-network/api-models'
|
|
3
|
+
import { XyoPayloads } from '@xyo-network/payload-model'
|
|
4
|
+
import { QueryPayload, QuerySchema } from '@xyo-network/query-payload-plugin'
|
|
5
|
+
|
|
6
|
+
import { XyoAddressesApi } from '../Api'
|
|
7
|
+
|
|
8
|
+
const config: XyoApiConfig = {
|
|
9
|
+
apiDomain: process.env.API_DOMAIN || 'http://localhost:8080',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
describe('XyoAddressesApi', () => {
|
|
13
|
+
describe('get', () => {
|
|
14
|
+
it('method exists', () => {
|
|
15
|
+
const api = new XyoAddressesApi(config)
|
|
16
|
+
expect(api).toBeDefined()
|
|
17
|
+
expect(api.get).toBeFunction()
|
|
18
|
+
})
|
|
19
|
+
describe('returns root module discover containing', () => {
|
|
20
|
+
let api: XyoAddressesApi
|
|
21
|
+
let response: XyoApiResponseBody<XyoPayloads>
|
|
22
|
+
beforeAll(async () => {
|
|
23
|
+
api = new XyoAddressesApi(config)
|
|
24
|
+
response = await api.get()
|
|
25
|
+
})
|
|
26
|
+
it('address', () => {
|
|
27
|
+
expect(response).toBeArray()
|
|
28
|
+
const addressPayload = response?.find((p) => p.schema === AddressSchema) as AddressPayload
|
|
29
|
+
expect(addressPayload).toBeObject()
|
|
30
|
+
expect(addressPayload.address).toBeString()
|
|
31
|
+
})
|
|
32
|
+
it('supported queries', () => {
|
|
33
|
+
const queries = response?.filter((d) => d.schema === QuerySchema) as QueryPayload[]
|
|
34
|
+
expect(queries.length).toBeGreaterThan(0)
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
})
|
package/src/Api/Api.ts
CHANGED
|
@@ -3,8 +3,7 @@ import { XyoApiConfig } from '@xyo-network/api-models'
|
|
|
3
3
|
import { XyoBoundWitness } from '@xyo-network/boundwitness-model'
|
|
4
4
|
import { DataLike } from '@xyo-network/core'
|
|
5
5
|
import { Huri } from '@xyo-network/huri'
|
|
6
|
-
import {
|
|
7
|
-
import { XyoPayload } from '@xyo-network/payload-model'
|
|
6
|
+
import { XyoPayload, XyoPayloads } from '@xyo-network/payload-model'
|
|
8
7
|
|
|
9
8
|
import { XyoApiSimple } from '../Simple'
|
|
10
9
|
import { XyoUserApi } from '../User'
|
|
@@ -14,7 +13,7 @@ import { XyoArchivistArchiveApi } from './Archive'
|
|
|
14
13
|
import { XyoArchivistArchivesApi } from './Archives'
|
|
15
14
|
import { XyoArchivistNodeApi } from './Node'
|
|
16
15
|
|
|
17
|
-
export class XyoArchivistApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<
|
|
16
|
+
export class XyoArchivistApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<XyoPayloads, C> {
|
|
18
17
|
private _addresses?: XyoAddressesApi
|
|
19
18
|
private _archives?: XyoArchivistArchivesApi
|
|
20
19
|
private _stats?: XyoApiSimple<unknown[]>
|
|
@@ -0,0 +1,23 @@
|
|
|
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,48 +0,0 @@
|
|
|
1
|
-
import { XyoApiConfig, XyoApiResponseBody } from '@xyo-network/api-models'
|
|
2
|
-
import { ModuleDescription } from '@xyo-network/module-model'
|
|
3
|
-
|
|
4
|
-
import { XyoAddressesApi } from './Api'
|
|
5
|
-
|
|
6
|
-
const config: XyoApiConfig = {
|
|
7
|
-
apiDomain: process.env.API_DOMAIN || 'http://localhost:8080',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
describe('XyoAddressesApi', () => {
|
|
11
|
-
describe('get', () => {
|
|
12
|
-
it('method exists', () => {
|
|
13
|
-
const api = new XyoAddressesApi(config)
|
|
14
|
-
expect(api).toBeDefined()
|
|
15
|
-
expect(api.get).toBeFunction()
|
|
16
|
-
})
|
|
17
|
-
describe('returns modules in use on the node with their', () => {
|
|
18
|
-
let api: XyoAddressesApi
|
|
19
|
-
let result: XyoApiResponseBody<ModuleDescription[]>
|
|
20
|
-
beforeAll(async () => {
|
|
21
|
-
api = new XyoAddressesApi(config)
|
|
22
|
-
const response = await api.get()
|
|
23
|
-
expect(response).toBeObject()
|
|
24
|
-
expect(response?.children).toBeArray()
|
|
25
|
-
expect(response?.children?.length).toBeGreaterThan(0)
|
|
26
|
-
result = response?.children || []
|
|
27
|
-
})
|
|
28
|
-
it('address', () => {
|
|
29
|
-
result?.map((module) => {
|
|
30
|
-
expect(module.address).toBeString()
|
|
31
|
-
})
|
|
32
|
-
})
|
|
33
|
-
it('supported queries', () => {
|
|
34
|
-
result?.map((module) => {
|
|
35
|
-
expect(module.queries.length).toBeGreaterThan(0)
|
|
36
|
-
module.queries.map((query) => {
|
|
37
|
-
expect(query).toBeString()
|
|
38
|
-
})
|
|
39
|
-
})
|
|
40
|
-
})
|
|
41
|
-
// it.skip('mount point', () => {
|
|
42
|
-
// result?.map((module) => {
|
|
43
|
-
// expect(module?.url).toBeString
|
|
44
|
-
// })
|
|
45
|
-
// })
|
|
46
|
-
})
|
|
47
|
-
})
|
|
48
|
-
})
|
package/src/Api/Api.spec.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { getApi } from './ApiUtil.spec'
|
|
2
|
-
|
|
3
|
-
describe('XyoArchivistApi', () => {
|
|
4
|
-
describe('get', () => {
|
|
5
|
-
it('returns Node Description', async () => {
|
|
6
|
-
const api = getApi()
|
|
7
|
-
expect(api).toBeDefined()
|
|
8
|
-
const response = await api.get()
|
|
9
|
-
expect(response).toBeObject()
|
|
10
|
-
expect(response?.address).toBeString()
|
|
11
|
-
expect(response?.queries).toBeArray()
|
|
12
|
-
expect(response?.queries?.length).toBeGreaterThan(0)
|
|
13
|
-
expect(response?.children).toBeArray()
|
|
14
|
-
expect(response?.children?.length).toBeGreaterThan(0)
|
|
15
|
-
})
|
|
16
|
-
})
|
|
17
|
-
})
|