@xyo-network/bridge-module-resolver 2.64.7 → 2.64.8
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/ProxyModule.js +24 -1
- package/dist/cjs/ProxyModule.js.map +1 -1
- package/dist/docs.json +509 -363
- package/dist/esm/ProxyModule.js +21 -1
- package/dist/esm/ProxyModule.js.map +1 -1
- package/dist/types/ProxyModule.d.ts +4 -2
- package/dist/types/ProxyModule.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/ProxyModule.ts +30 -2
package/dist/esm/ProxyModule.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert';
|
|
2
|
+
import { AddressSchema } from '@xyo-network/address-payload-plugin';
|
|
2
3
|
import { BaseEmitter, CompositeModuleResolver, } from '@xyo-network/module';
|
|
4
|
+
import compact from 'lodash/compact';
|
|
3
5
|
export const ProxyModuleConfigSchema = 'network.xyo.module.proxy.config';
|
|
4
6
|
export class ProxyModule extends BaseEmitter {
|
|
5
7
|
upResolver = new CompositeModuleResolver();
|
|
@@ -24,13 +26,31 @@ export class ProxyModule extends BaseEmitter {
|
|
|
24
26
|
addressPreviousHash() {
|
|
25
27
|
throw Error('Not Implemented');
|
|
26
28
|
}
|
|
29
|
+
async describe() {
|
|
30
|
+
const description = {
|
|
31
|
+
address: this.address,
|
|
32
|
+
queries: this.queries,
|
|
33
|
+
};
|
|
34
|
+
if (this.config.name) {
|
|
35
|
+
description.name = this.config.name;
|
|
36
|
+
}
|
|
37
|
+
const discover = await this.discover();
|
|
38
|
+
description.children = compact(discover?.map((payload) => {
|
|
39
|
+
const address = payload.schema === AddressSchema ? payload.address : undefined;
|
|
40
|
+
return address != this.address ? address : undefined;
|
|
41
|
+
}) ?? []);
|
|
42
|
+
return description;
|
|
43
|
+
}
|
|
27
44
|
discover() {
|
|
28
|
-
|
|
45
|
+
return this.bridge.targetDiscover();
|
|
29
46
|
}
|
|
30
47
|
manifest() {
|
|
31
48
|
const name = assertEx(this.config.name, 'Calling manifest on un-named module is not supported');
|
|
32
49
|
return { config: { name, ...this.config } };
|
|
33
50
|
}
|
|
51
|
+
previousHash() {
|
|
52
|
+
throw Error('Not Implemented');
|
|
53
|
+
}
|
|
34
54
|
async query(query, payloads) {
|
|
35
55
|
const result = assertEx(await this.bridge.targetQuery(this.address, query, payloads), 'Remote Query Failed');
|
|
36
56
|
await this.emit('moduleQueried', { module: this, payloads, query, result });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProxyModule.js","sourceRoot":"","sources":["../../src/ProxyModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"ProxyModule.js","sourceRoot":"","sources":["../../src/ProxyModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAkB,aAAa,EAAE,MAAM,qCAAqC,CAAA;AAGnF,OAAO,EAEL,WAAW,EACX,uBAAuB,GASxB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,OAAO,MAAM,gBAAgB,CAAA;AAGpC,MAAM,CAAC,MAAM,uBAAuB,GAA4B,iCAAiC,CAAA;AAYjG,MAAM,OAAO,WAAY,SAAQ,WAA+C;IACrE,UAAU,GAAG,IAAI,uBAAuB,EAAE,CAAA;IAEnD,YAAY,MAAyB;QACnC,KAAK,CAAC,MAAM,CAAC,CAAA;IACf,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAA;IAC1C,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;IAC3B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IA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G,IAAI,CAAC,MAAM,EAAE,EAAE,CAAA;IAC7C,CAAC;IAED,YAAY;QACV,MAAM,KAAK,CAAC,iBAAiB,CAAC,CAAA;IAChC,CAAC;IAED,KAAK,CAAC,KAAK,CAAkD,KAAQ,EAAE,QAAoB;QACzF,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,qBAAqB,CAAC,CAAA;QAC5G,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;QAC3E,OAAO,MAAM,CAAA;IACf,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,KAAwB,EAAE,QAAoB,EAAE,WAA0B;QACxF,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;IACtF,CAAC;IAED,uGAAuG;IACvG,KAAK,CAAC,OAAO,CAAC,MAAqB;QACjC,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC9D,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BridgeModule } from '@xyo-network/bridge-model';
|
|
2
2
|
import { ModuleManifest } from '@xyo-network/manifest-model';
|
|
3
|
-
import { AddressPreviousHashPayload, BaseEmitter, CompositeModuleResolver, Module, ModuleConfig, ModuleEventData, ModuleFilter, ModuleParams, ModuleQueryResult, QueryBoundWitness } from '@xyo-network/module';
|
|
3
|
+
import { AddressPreviousHashPayload, BaseEmitter, CompositeModuleResolver, Module, ModuleConfig, ModuleDescription, ModuleEventData, ModuleFilter, ModuleParams, ModuleQueryResult, QueryBoundWitness } from '@xyo-network/module';
|
|
4
4
|
import { Payload } from '@xyo-network/payload-model';
|
|
5
5
|
import { Promisable } from '@xyo-network/promise';
|
|
6
6
|
export type ProxyModuleConfigSchema = 'network.xyo.module.proxy.config';
|
|
@@ -56,8 +56,10 @@ export declare class ProxyModule extends BaseEmitter<ProxyModuleParams, ModuleEv
|
|
|
56
56
|
get downResolver(): import("@xyo-network/module").ModuleResolver;
|
|
57
57
|
get queries(): string[];
|
|
58
58
|
addressPreviousHash(): Promise<AddressPreviousHashPayload>;
|
|
59
|
-
|
|
59
|
+
describe(): Promise<ModuleDescription>;
|
|
60
|
+
discover(): Promisable<Payload[]>;
|
|
60
61
|
manifest(): Promisable<ModuleManifest>;
|
|
62
|
+
previousHash(): Promise<string | undefined>;
|
|
61
63
|
query<T extends QueryBoundWitness = QueryBoundWitness>(query: T, payloads?: Payload[]): Promise<ModuleQueryResult>;
|
|
62
64
|
queryable(query: QueryBoundWitness, payloads?: Payload[], queryConfig?: ModuleConfig): Promise<boolean>;
|
|
63
65
|
resolve(filter?: ModuleFilter): Promise<Module[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProxyModule.d.ts","sourceRoot":"","sources":["../../src/ProxyModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProxyModule.d.ts","sourceRoot":"","sources":["../../src/ProxyModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EACL,0BAA0B,EAC1B,WAAW,EACX,uBAAuB,EACvB,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAs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AAC,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAGxD"}
|
package/package.json
CHANGED
|
@@ -11,24 +11,24 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@xylabs/assert": "^2.9.3",
|
|
14
|
-
"@xyo-network/account-model": "^2.64.
|
|
15
|
-
"@xyo-network/address-payload-plugin": "^2.64.
|
|
16
|
-
"@xyo-network/archivist-model": "^2.64.
|
|
17
|
-
"@xyo-network/archivist-wrapper": "^2.64.
|
|
18
|
-
"@xyo-network/bridge-model": "^2.64.
|
|
19
|
-
"@xyo-network/diviner-model": "^2.64.
|
|
20
|
-
"@xyo-network/diviner-wrapper": "^2.64.
|
|
21
|
-
"@xyo-network/error": "^2.64.
|
|
22
|
-
"@xyo-network/manifest-model": "^2.64.
|
|
23
|
-
"@xyo-network/module": "^2.64.
|
|
24
|
-
"@xyo-network/module-model": "^2.64.
|
|
25
|
-
"@xyo-network/node-model": "^2.64.
|
|
26
|
-
"@xyo-network/node-wrapper": "^2.64.
|
|
27
|
-
"@xyo-network/payload-model": "^2.64.
|
|
28
|
-
"@xyo-network/promise": "^2.64.
|
|
29
|
-
"@xyo-network/sentinel": "^2.64.
|
|
30
|
-
"@xyo-network/witness-model": "^2.64.
|
|
31
|
-
"@xyo-network/witness-wrapper": "^2.64.
|
|
14
|
+
"@xyo-network/account-model": "^2.64.8",
|
|
15
|
+
"@xyo-network/address-payload-plugin": "^2.64.8",
|
|
16
|
+
"@xyo-network/archivist-model": "^2.64.8",
|
|
17
|
+
"@xyo-network/archivist-wrapper": "^2.64.8",
|
|
18
|
+
"@xyo-network/bridge-model": "^2.64.8",
|
|
19
|
+
"@xyo-network/diviner-model": "^2.64.8",
|
|
20
|
+
"@xyo-network/diviner-wrapper": "^2.64.8",
|
|
21
|
+
"@xyo-network/error": "^2.64.8",
|
|
22
|
+
"@xyo-network/manifest-model": "^2.64.8",
|
|
23
|
+
"@xyo-network/module": "^2.64.8",
|
|
24
|
+
"@xyo-network/module-model": "^2.64.8",
|
|
25
|
+
"@xyo-network/node-model": "^2.64.8",
|
|
26
|
+
"@xyo-network/node-wrapper": "^2.64.8",
|
|
27
|
+
"@xyo-network/payload-model": "^2.64.8",
|
|
28
|
+
"@xyo-network/promise": "^2.64.8",
|
|
29
|
+
"@xyo-network/sentinel": "^2.64.8",
|
|
30
|
+
"@xyo-network/witness-model": "^2.64.8",
|
|
31
|
+
"@xyo-network/witness-wrapper": "^2.64.8",
|
|
32
32
|
"lodash": "^4.17.21"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
},
|
|
70
70
|
"sideEffects": false,
|
|
71
71
|
"types": "dist/types/index.d.ts",
|
|
72
|
-
"version": "2.64.
|
|
72
|
+
"version": "2.64.8"
|
|
73
73
|
}
|
package/src/ProxyModule.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
|
+
import { AddressPayload, AddressSchema } from '@xyo-network/address-payload-plugin'
|
|
2
3
|
import { BridgeModule } from '@xyo-network/bridge-model'
|
|
3
4
|
import { ModuleManifest } from '@xyo-network/manifest-model'
|
|
4
5
|
import {
|
|
@@ -7,6 +8,7 @@ import {
|
|
|
7
8
|
CompositeModuleResolver,
|
|
8
9
|
Module,
|
|
9
10
|
ModuleConfig,
|
|
11
|
+
ModuleDescription,
|
|
10
12
|
ModuleEventData,
|
|
11
13
|
ModuleFilter,
|
|
12
14
|
ModuleParams,
|
|
@@ -15,6 +17,7 @@ import {
|
|
|
15
17
|
} from '@xyo-network/module'
|
|
16
18
|
import { Payload } from '@xyo-network/payload-model'
|
|
17
19
|
import { Promisable } from '@xyo-network/promise'
|
|
20
|
+
import compact from 'lodash/compact'
|
|
18
21
|
|
|
19
22
|
export type ProxyModuleConfigSchema = 'network.xyo.module.proxy.config'
|
|
20
23
|
export const ProxyModuleConfigSchema: ProxyModuleConfigSchema = 'network.xyo.module.proxy.config'
|
|
@@ -60,8 +63,29 @@ export class ProxyModule extends BaseEmitter<ProxyModuleParams, ModuleEventData>
|
|
|
60
63
|
throw Error('Not Implemented')
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
async describe(): Promise<ModuleDescription> {
|
|
67
|
+
const description: ModuleDescription = {
|
|
68
|
+
address: this.address,
|
|
69
|
+
queries: this.queries,
|
|
70
|
+
}
|
|
71
|
+
if (this.config.name) {
|
|
72
|
+
description.name = this.config.name
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const discover = await this.discover()
|
|
76
|
+
|
|
77
|
+
description.children = compact(
|
|
78
|
+
discover?.map((payload) => {
|
|
79
|
+
const address = payload.schema === AddressSchema ? (payload as AddressPayload).address : undefined
|
|
80
|
+
return address != this.address ? address : undefined
|
|
81
|
+
}) ?? [],
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
return description
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
discover(): Promisable<Payload[]> {
|
|
88
|
+
return this.bridge.targetDiscover()
|
|
65
89
|
}
|
|
66
90
|
|
|
67
91
|
manifest(): Promisable<ModuleManifest> {
|
|
@@ -69,6 +93,10 @@ export class ProxyModule extends BaseEmitter<ProxyModuleParams, ModuleEventData>
|
|
|
69
93
|
return { config: { name, ...this.config } }
|
|
70
94
|
}
|
|
71
95
|
|
|
96
|
+
previousHash(): Promise<string | undefined> {
|
|
97
|
+
throw Error('Not Implemented')
|
|
98
|
+
}
|
|
99
|
+
|
|
72
100
|
async query<T extends QueryBoundWitness = QueryBoundWitness>(query: T, payloads?: Payload[]): Promise<ModuleQueryResult> {
|
|
73
101
|
const result = assertEx(await this.bridge.targetQuery(this.address, query, payloads), 'Remote Query Failed')
|
|
74
102
|
await this.emit('moduleQueried', { module: this, payloads, query, result })
|