@xyo-network/api 2.50.4 → 2.50.5
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/Api.js +0 -10
- package/dist/cjs/Api/Api.js.map +1 -1
- package/dist/cjs/Api/Payload/Api.js +0 -7
- package/dist/cjs/Api/Payload/Api.js.map +1 -1
- package/dist/cjs/Api/Payload/index.js +0 -1
- package/dist/cjs/Api/Payload/index.js.map +1 -1
- package/dist/cjs/Diviner/index.js +0 -3
- package/dist/cjs/Diviner/index.js.map +1 -1
- package/dist/docs.json +32027 -49625
- package/dist/esm/Api/Api.js +0 -14
- package/dist/esm/Api/Api.js.map +1 -1
- package/dist/esm/Api/Payload/Api.js +0 -10
- package/dist/esm/Api/Payload/Api.js.map +1 -1
- package/dist/esm/Api/Payload/index.js +0 -1
- package/dist/esm/Api/Payload/index.js.map +1 -1
- package/dist/esm/Diviner/index.js +0 -3
- package/dist/esm/Diviner/index.js.map +1 -1
- package/dist/types/Api/Api.d.ts +0 -6
- package/dist/types/Api/Api.d.ts.map +1 -1
- package/dist/types/Api/Payload/Api.d.ts +0 -5
- package/dist/types/Api/Payload/Api.d.ts.map +1 -1
- package/dist/types/Api/Payload/index.d.ts +0 -1
- package/dist/types/Api/Payload/index.d.ts.map +1 -1
- package/dist/types/Diviner/index.d.ts +0 -3
- package/dist/types/Diviner/index.d.ts.map +1 -1
- package/package.json +16 -16
- package/src/Api/Api.ts +0 -15
- package/src/Api/Payload/Api.ts +0 -10
- package/src/Api/Payload/index.ts +0 -1
- package/src/Diviner/index.ts +0 -3
- package/dist/cjs/Api/Addresses/Address/Api.js +0 -14
- package/dist/cjs/Api/Addresses/Address/Api.js.map +0 -1
- package/dist/cjs/Api/Addresses/Address/index.js +0 -5
- package/dist/cjs/Api/Addresses/Address/index.js.map +0 -1
- package/dist/cjs/Api/Addresses/Api.js +0 -15
- package/dist/cjs/Api/Addresses/Api.js.map +0 -1
- package/dist/cjs/Api/Addresses/index.js +0 -5
- package/dist/cjs/Api/Addresses/index.js.map +0 -1
- package/dist/cjs/Api/Payload/Schema/Api.js +0 -17
- package/dist/cjs/Api/Payload/Schema/Api.js.map +0 -1
- package/dist/cjs/Api/Payload/Schema/index.js +0 -5
- package/dist/cjs/Api/Payload/Schema/index.js.map +0 -1
- package/dist/cjs/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.js +0 -74
- package/dist/cjs/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.js.map +0 -1
- package/dist/cjs/Diviner/AddressHistoryDiviner/index.js +0 -5
- package/dist/cjs/Diviner/AddressHistoryDiviner/index.js.map +0 -1
- package/dist/cjs/Diviner/SchemaListApiDiviner/Payload.js +0 -3
- package/dist/cjs/Diviner/SchemaListApiDiviner/Payload.js.map +0 -1
- package/dist/cjs/Diviner/SchemaListApiDiviner/SchemaListApiDiviner.js +0 -53
- package/dist/cjs/Diviner/SchemaListApiDiviner/SchemaListApiDiviner.js.map +0 -1
- package/dist/cjs/Diviner/SchemaListApiDiviner/SchemaListApiDivinerConfig.js +0 -5
- package/dist/cjs/Diviner/SchemaListApiDiviner/SchemaListApiDivinerConfig.js.map +0 -1
- package/dist/cjs/Diviner/SchemaListApiDiviner/index.js +0 -7
- package/dist/cjs/Diviner/SchemaListApiDiviner/index.js.map +0 -1
- package/dist/cjs/Diviner/SchemaStatsApiDiviner/Payload.js +0 -5
- package/dist/cjs/Diviner/SchemaStatsApiDiviner/Payload.js.map +0 -1
- package/dist/cjs/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDiviner.js +0 -54
- package/dist/cjs/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDiviner.js.map +0 -1
- package/dist/cjs/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDivinerConfig.js +0 -5
- package/dist/cjs/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDivinerConfig.js.map +0 -1
- package/dist/cjs/Diviner/SchemaStatsApiDiviner/index.js +0 -7
- package/dist/cjs/Diviner/SchemaStatsApiDiviner/index.js.map +0 -1
- package/dist/esm/Api/Addresses/Address/Api.js +0 -13
- package/dist/esm/Api/Addresses/Address/Api.js.map +0 -1
- package/dist/esm/Api/Addresses/Address/index.js +0 -2
- package/dist/esm/Api/Addresses/Address/index.js.map +0 -1
- package/dist/esm/Api/Addresses/Api.js +0 -14
- package/dist/esm/Api/Addresses/Api.js.map +0 -1
- package/dist/esm/Api/Addresses/index.js +0 -2
- package/dist/esm/Api/Addresses/index.js.map +0 -1
- package/dist/esm/Api/Payload/Schema/Api.js +0 -17
- package/dist/esm/Api/Payload/Schema/Api.js.map +0 -1
- package/dist/esm/Api/Payload/Schema/index.js +0 -2
- package/dist/esm/Api/Payload/Schema/index.js.map +0 -1
- package/dist/esm/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.js +0 -61
- package/dist/esm/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.js.map +0 -1
- package/dist/esm/Diviner/AddressHistoryDiviner/index.js +0 -2
- package/dist/esm/Diviner/AddressHistoryDiviner/index.js.map +0 -1
- package/dist/esm/Diviner/SchemaListApiDiviner/Payload.js +0 -2
- package/dist/esm/Diviner/SchemaListApiDiviner/Payload.js.map +0 -1
- package/dist/esm/Diviner/SchemaListApiDiviner/SchemaListApiDiviner.js +0 -35
- package/dist/esm/Diviner/SchemaListApiDiviner/SchemaListApiDiviner.js.map +0 -1
- package/dist/esm/Diviner/SchemaListApiDiviner/SchemaListApiDivinerConfig.js +0 -2
- package/dist/esm/Diviner/SchemaListApiDiviner/SchemaListApiDivinerConfig.js.map +0 -1
- package/dist/esm/Diviner/SchemaListApiDiviner/index.js +0 -4
- package/dist/esm/Diviner/SchemaListApiDiviner/index.js.map +0 -1
- package/dist/esm/Diviner/SchemaStatsApiDiviner/Payload.js +0 -2
- package/dist/esm/Diviner/SchemaStatsApiDiviner/Payload.js.map +0 -1
- package/dist/esm/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDiviner.js +0 -36
- package/dist/esm/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDiviner.js.map +0 -1
- package/dist/esm/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDivinerConfig.js +0 -2
- package/dist/esm/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDivinerConfig.js.map +0 -1
- package/dist/esm/Diviner/SchemaStatsApiDiviner/index.js +0 -4
- package/dist/esm/Diviner/SchemaStatsApiDiviner/index.js.map +0 -1
- package/dist/types/Api/Addresses/Address/Api.d.ts +0 -11
- package/dist/types/Api/Addresses/Address/Api.d.ts.map +0 -1
- package/dist/types/Api/Addresses/Address/index.d.ts +0 -2
- package/dist/types/Api/Addresses/Address/index.d.ts.map +0 -1
- package/dist/types/Api/Addresses/Api.d.ts +0 -11
- package/dist/types/Api/Addresses/Api.d.ts.map +0 -1
- package/dist/types/Api/Addresses/index.d.ts +0 -2
- package/dist/types/Api/Addresses/index.d.ts.map +0 -1
- package/dist/types/Api/Payload/Schema/Api.d.ts +0 -12
- package/dist/types/Api/Payload/Schema/Api.d.ts.map +0 -1
- package/dist/types/Api/Payload/Schema/index.d.ts +0 -2
- package/dist/types/Api/Payload/Schema/index.d.ts.map +0 -1
- package/dist/types/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.d.ts +0 -20
- package/dist/types/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.d.ts.map +0 -1
- package/dist/types/Diviner/AddressHistoryDiviner/index.d.ts +0 -2
- package/dist/types/Diviner/AddressHistoryDiviner/index.d.ts.map +0 -1
- package/dist/types/Diviner/SchemaListApiDiviner/Payload.d.ts +0 -6
- package/dist/types/Diviner/SchemaListApiDiviner/Payload.d.ts.map +0 -1
- package/dist/types/Diviner/SchemaListApiDiviner/SchemaListApiDiviner.d.ts +0 -20
- package/dist/types/Diviner/SchemaListApiDiviner/SchemaListApiDiviner.d.ts.map +0 -1
- package/dist/types/Diviner/SchemaListApiDiviner/SchemaListApiDivinerConfig.d.ts +0 -9
- package/dist/types/Diviner/SchemaListApiDiviner/SchemaListApiDivinerConfig.d.ts.map +0 -1
- package/dist/types/Diviner/SchemaListApiDiviner/index.d.ts +0 -4
- package/dist/types/Diviner/SchemaListApiDiviner/index.d.ts.map +0 -1
- package/dist/types/Diviner/SchemaStatsApiDiviner/Payload.d.ts +0 -7
- package/dist/types/Diviner/SchemaStatsApiDiviner/Payload.d.ts.map +0 -1
- package/dist/types/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDiviner.d.ts +0 -20
- package/dist/types/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDiviner.d.ts.map +0 -1
- package/dist/types/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDivinerConfig.d.ts +0 -9
- package/dist/types/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDivinerConfig.d.ts.map +0 -1
- package/dist/types/Diviner/SchemaStatsApiDiviner/index.d.ts +0 -4
- package/dist/types/Diviner/SchemaStatsApiDiviner/index.d.ts.map +0 -1
- package/src/Api/Addresses/Address/Api.ts +0 -17
- package/src/Api/Addresses/Address/index.ts +0 -1
- package/src/Api/Addresses/Api.ts +0 -17
- package/src/Api/Addresses/index.ts +0 -1
- package/src/Api/Payload/Schema/Api.ts +0 -21
- package/src/Api/Payload/Schema/index.ts +0 -1
- package/src/Diviner/AddressHistoryDiviner/XyoRemoteAddressHistoryDiviner.ts +0 -70
- package/src/Diviner/AddressHistoryDiviner/index.ts +0 -1
- package/src/Diviner/SchemaListApiDiviner/Payload.ts +0 -9
- package/src/Diviner/SchemaListApiDiviner/SchemaListApiDiviner.ts +0 -49
- package/src/Diviner/SchemaListApiDiviner/SchemaListApiDivinerConfig.ts +0 -13
- package/src/Diviner/SchemaListApiDiviner/index.ts +0 -3
- package/src/Diviner/SchemaStatsApiDiviner/Payload.ts +0 -11
- package/src/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDiviner.ts +0 -47
- package/src/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDivinerConfig.ts +0 -13
- package/src/Diviner/SchemaStatsApiDiviner/index.ts +0 -3
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaStatsApiDivinerConfig.d.ts","sourceRoot":"","sources":["../../../../src/Diviner/SchemaStatsApiDiviner/SchemaStatsApiDivinerConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEvD,MAAM,MAAM,oCAAoC,GAAG,6CAA6C,CAAA;AAChG,eAAO,MAAM,oCAAoC,EAAE,oCAAoF,CAAA;AAEvI,MAAM,MAAM,8BAA8B,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,IAAI,aAAa,CAC3F,UAAU,EACV,CAAC,GAAG;IACF,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,oCAAoC,CAAA;CAC7C,CACF,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Diviner/SchemaStatsApiDiviner/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { XyoApiConfig } from '@xyo-network/api-models'
|
|
2
|
-
import { XyoBoundWitness } from '@xyo-network/boundwitness-model'
|
|
3
|
-
import { XyoPayload } from '@xyo-network/payload-model'
|
|
4
|
-
|
|
5
|
-
import { XyoApiSimple } from '../../../Simple'
|
|
6
|
-
|
|
7
|
-
export class XyoAddressApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<XyoPayload[], C> {
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Use module API
|
|
10
|
-
*/
|
|
11
|
-
get boundWitnesses(): XyoApiSimple<XyoBoundWitness[]> {
|
|
12
|
-
return new XyoApiSimple({
|
|
13
|
-
...this.config,
|
|
14
|
-
root: `${this.root}boundwitness/`,
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Api'
|
package/src/Api/Addresses/Api.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { XyoApiConfig } from '@xyo-network/api-models'
|
|
2
|
-
import { XyoPayloads } from '@xyo-network/payload-model'
|
|
3
|
-
|
|
4
|
-
import { XyoApiSimple } from '../../Simple'
|
|
5
|
-
import { XyoAddressApi } from './Address'
|
|
6
|
-
|
|
7
|
-
export class XyoAddressesApi<C extends XyoApiConfig = XyoApiConfig> extends XyoApiSimple<XyoPayloads, C> {
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Use module API
|
|
10
|
-
*/
|
|
11
|
-
address(address: string): XyoAddressApi {
|
|
12
|
-
return new XyoAddressApi({
|
|
13
|
-
...this.config,
|
|
14
|
-
root: `${this.root}${address}/`,
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Api'
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { XyoApiSimple } from '../../../Simple'
|
|
2
|
-
|
|
3
|
-
export interface XyoArchivistArchivePayloadSchemaStats {
|
|
4
|
-
counts: Record<string, number>
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export class XyoArchivistArchivePayloadSchemaApi extends XyoApiSimple<string[]> {
|
|
8
|
-
private _stats?: XyoApiSimple<XyoArchivistArchivePayloadSchemaStats>
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated Use module API
|
|
11
|
-
*/
|
|
12
|
-
get stats() {
|
|
13
|
-
this._stats =
|
|
14
|
-
this._stats ??
|
|
15
|
-
new XyoApiSimple<XyoArchivistArchivePayloadSchemaStats>({
|
|
16
|
-
...this.config,
|
|
17
|
-
root: `${this.root}stats/`,
|
|
18
|
-
})
|
|
19
|
-
return this._stats
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Api'
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import { XyoBoundWitness, XyoBoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
3
|
-
import { AbstractDiviner, AddressHistoryDiviner, DivinerParams, isAddressHistoryQueryPayload } from '@xyo-network/diviner'
|
|
4
|
-
import { ModuleParams } from '@xyo-network/module'
|
|
5
|
-
import { XyoPayloads } from '@xyo-network/payload-model'
|
|
6
|
-
|
|
7
|
-
import { XyoArchivistApi } from '../../Api'
|
|
8
|
-
import { RemoteDivinerError } from '../RemoteDivinerError'
|
|
9
|
-
import { XyoRemoteDivinerConfig, XyoRemoteDivinerConfigSchema } from '../XyoRemoteDivinerConfig'
|
|
10
|
-
|
|
11
|
-
export type XyoRemoteAddressHistoryDivinerParams = ModuleParams<XyoRemoteDivinerConfig> & {
|
|
12
|
-
api?: XyoArchivistApi
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/** @description Diviner Context that connects to a remote Diviner using the API */
|
|
16
|
-
export class XyoRemoteAddressHistoryDiviner extends AbstractDiviner<DivinerParams<XyoRemoteDivinerConfig>> implements AddressHistoryDiviner {
|
|
17
|
-
static override configSchema = XyoRemoteDivinerConfigSchema
|
|
18
|
-
static override targetSchema = XyoBoundWitnessSchema
|
|
19
|
-
|
|
20
|
-
protected _api?: XyoArchivistApi
|
|
21
|
-
|
|
22
|
-
protected constructor(params: XyoRemoteAddressHistoryDivinerParams) {
|
|
23
|
-
super(params)
|
|
24
|
-
this._api = params?.api
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
get api() {
|
|
28
|
-
if (this._api) {
|
|
29
|
-
return this._api
|
|
30
|
-
}
|
|
31
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
32
|
-
if (this.config?.api) {
|
|
33
|
-
this.logger?.warn('api specified in config but should be specified in params')
|
|
34
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
35
|
-
return this.config?.api
|
|
36
|
-
}
|
|
37
|
-
throw Error('No api specified')
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
static override async create(params?: XyoRemoteAddressHistoryDivinerParams) {
|
|
41
|
-
return (await super.create(params)) as XyoRemoteAddressHistoryDiviner
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
override async divine(payloads?: XyoPayloads): Promise<XyoBoundWitness[]> {
|
|
45
|
-
if (!payloads) return []
|
|
46
|
-
try {
|
|
47
|
-
const query = payloads.find(isAddressHistoryQueryPayload)
|
|
48
|
-
if (!query) return []
|
|
49
|
-
const { address, limit, offset } = query
|
|
50
|
-
const singleAddress = assertEx(Array.isArray(address) ? address[0] : address, 'At least one address required')
|
|
51
|
-
const find: { limit?: number; offset?: string } = {}
|
|
52
|
-
if (limit) find.limit = limit
|
|
53
|
-
if (offset) find.offset = `${offset}`
|
|
54
|
-
const [data, body, response] =
|
|
55
|
-
Object.keys(find).length > 0
|
|
56
|
-
? await this.api.addresses.address(singleAddress).boundWitnesses.find(find, 'tuple')
|
|
57
|
-
: await this.api.addresses.address(singleAddress).boundWitnesses.get('tuple')
|
|
58
|
-
if (response?.status >= 400) {
|
|
59
|
-
throw new RemoteDivinerError('divine', `${response.statusText} [${response.status}]`)
|
|
60
|
-
}
|
|
61
|
-
if (body?.errors?.length) {
|
|
62
|
-
throw new RemoteDivinerError('divine', body?.errors)
|
|
63
|
-
}
|
|
64
|
-
return data || []
|
|
65
|
-
} catch (ex) {
|
|
66
|
-
console.error(ex)
|
|
67
|
-
throw ex
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './XyoRemoteAddressHistoryDiviner'
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/* eslint-disable deprecation/deprecation */
|
|
2
|
-
import { assertEx } from '@xylabs/assert'
|
|
3
|
-
import { AbstractDiviner, DivinerParams } from '@xyo-network/diviner'
|
|
4
|
-
import { ModuleParams } from '@xyo-network/module'
|
|
5
|
-
import { XyoSchemaSchema } from '@xyo-network/schema-payload-plugin'
|
|
6
|
-
|
|
7
|
-
import { XyoArchivistApi } from '../../Api'
|
|
8
|
-
import { SchemaList } from './Payload'
|
|
9
|
-
import { XyoSchemaListApiDivinerConfig, XyoSchemaListApiDivinerConfigSchema } from './SchemaListApiDivinerConfig'
|
|
10
|
-
|
|
11
|
-
export type XyoSchemaListApiDivinerParams = ModuleParams<XyoSchemaListApiDivinerConfig> & { api: XyoArchivistApi }
|
|
12
|
-
|
|
13
|
-
/** @deprecated - send query to remote module instead */
|
|
14
|
-
export class SchemaListApiDiviner extends AbstractDiviner<DivinerParams<XyoSchemaListApiDivinerConfig>> {
|
|
15
|
-
static override configSchema = XyoSchemaListApiDivinerConfigSchema
|
|
16
|
-
static override targetSchema = XyoSchemaSchema
|
|
17
|
-
|
|
18
|
-
protected readonly api: XyoArchivistApi
|
|
19
|
-
|
|
20
|
-
protected constructor(params: XyoSchemaListApiDivinerParams) {
|
|
21
|
-
super(params)
|
|
22
|
-
this.api = params.api
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
get archive() {
|
|
26
|
-
return assertEx(this.config?.archive, `SchemaListApiDiviner config.archive required [${JSON.stringify(this.config, null, 2)}]`)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static override async create(params: XyoSchemaListApiDivinerParams): Promise<SchemaListApiDiviner> {
|
|
30
|
-
return (await super.create(params)) as SchemaListApiDiviner
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async divine(): Promise<SchemaList[]> {
|
|
34
|
-
const apiResult = (await this.api.archive(this.archive)?.payload.schema.get()) ?? []
|
|
35
|
-
return (
|
|
36
|
-
apiResult.map((schema) => {
|
|
37
|
-
return {
|
|
38
|
-
name: schema,
|
|
39
|
-
schema: XyoSchemaSchema,
|
|
40
|
-
}
|
|
41
|
-
}) ?? []
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
protected override async start() {
|
|
46
|
-
await super.start()
|
|
47
|
-
return this
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DivinerConfig } from '@xyo-network/diviner-model'
|
|
2
|
-
import { XyoPayload } from '@xyo-network/payload-model'
|
|
3
|
-
|
|
4
|
-
export type XyoSchemaListApiDivinerConfigSchema = 'network.xyo.diviner.schema.list.api.config'
|
|
5
|
-
export const XyoSchemaListApiDivinerConfigSchema: XyoSchemaListApiDivinerConfigSchema = 'network.xyo.diviner.schema.list.api.config'
|
|
6
|
-
|
|
7
|
-
export type XyoSchemaListApiDivinerConfig<T extends XyoPayload = XyoPayload> = DivinerConfig<
|
|
8
|
-
XyoPayload,
|
|
9
|
-
T & {
|
|
10
|
-
archive: string
|
|
11
|
-
schema: XyoSchemaListApiDivinerConfigSchema
|
|
12
|
-
}
|
|
13
|
-
>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { XyoPayload } from '@xyo-network/payload-model'
|
|
2
|
-
|
|
3
|
-
export type SchemaStatsSchema = 'network.xyo.schema.stats'
|
|
4
|
-
export const SchemaStatsSchema: SchemaStatsSchema = 'network.xyo.schema.stats'
|
|
5
|
-
|
|
6
|
-
export type SchemaStats = XyoPayload<
|
|
7
|
-
{
|
|
8
|
-
counts: Record<string, number>
|
|
9
|
-
},
|
|
10
|
-
SchemaStatsSchema
|
|
11
|
-
>
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/* eslint-disable deprecation/deprecation */
|
|
2
|
-
import { assertEx } from '@xylabs/assert'
|
|
3
|
-
import { AbstractDiviner, DivinerParams } from '@xyo-network/diviner'
|
|
4
|
-
import { ModuleParams } from '@xyo-network/module'
|
|
5
|
-
|
|
6
|
-
import { XyoArchivistApi } from '../../Api'
|
|
7
|
-
import { SchemaStats, SchemaStatsSchema } from './Payload'
|
|
8
|
-
import { XyoSchemaStatsApiDivinerConfig, XyoSchemaStatsApiDivinerConfigSchema } from './SchemaStatsApiDivinerConfig'
|
|
9
|
-
|
|
10
|
-
export type XyoSchemaStatsApiDivinerParams = ModuleParams<XyoSchemaStatsApiDivinerConfig> & { api: XyoArchivistApi }
|
|
11
|
-
|
|
12
|
-
/** @deprecated - send query to remote module instead */
|
|
13
|
-
export class SchemaStatsApiDiviner extends AbstractDiviner<DivinerParams<XyoSchemaStatsApiDivinerConfig>> {
|
|
14
|
-
static override configSchema = XyoSchemaStatsApiDivinerConfigSchema
|
|
15
|
-
static override targetSchema = SchemaStatsSchema
|
|
16
|
-
|
|
17
|
-
protected readonly api: XyoArchivistApi
|
|
18
|
-
|
|
19
|
-
protected constructor(params: XyoSchemaStatsApiDivinerParams) {
|
|
20
|
-
super(params)
|
|
21
|
-
this.api = params.api
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get archive() {
|
|
25
|
-
return assertEx(this.config?.archive, `SchemaStatsApiDiviner config.archive required [${JSON.stringify(this.config, null, 2)}]`)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static override async create(params: XyoSchemaStatsApiDivinerParams): Promise<SchemaStatsApiDiviner> {
|
|
29
|
-
return (await super.create(params)) as SchemaStatsApiDiviner
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async divine(): Promise<SchemaStats[]> {
|
|
33
|
-
const stats = await this.api.archive(this.archive).payload.schema.stats.get()
|
|
34
|
-
const result: SchemaStats[] = [
|
|
35
|
-
{
|
|
36
|
-
counts: stats?.counts ?? {},
|
|
37
|
-
schema: SchemaStatsSchema,
|
|
38
|
-
},
|
|
39
|
-
]
|
|
40
|
-
return result
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
protected override async start() {
|
|
44
|
-
await super.start()
|
|
45
|
-
return this
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DivinerConfig } from '@xyo-network/diviner-model'
|
|
2
|
-
import { XyoPayload } from '@xyo-network/payload-model'
|
|
3
|
-
|
|
4
|
-
export type XyoSchemaStatsApiDivinerConfigSchema = 'network.xyo.diviner.schema.stats.api.config'
|
|
5
|
-
export const XyoSchemaStatsApiDivinerConfigSchema: XyoSchemaStatsApiDivinerConfigSchema = 'network.xyo.diviner.schema.stats.api.config'
|
|
6
|
-
|
|
7
|
-
export type XyoSchemaStatsApiDivinerConfig<T extends XyoPayload = XyoPayload> = DivinerConfig<
|
|
8
|
-
XyoPayload,
|
|
9
|
-
T & {
|
|
10
|
-
archive: string
|
|
11
|
-
schema: XyoSchemaStatsApiDivinerConfigSchema
|
|
12
|
-
}
|
|
13
|
-
>
|