@xyo-network/bridge-module-resolver 2.66.9 → 2.67.0-rc.2
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/ModuleResolver.js +9 -5
- package/dist/cjs/ModuleResolver.js.map +1 -1
- package/dist/cjs/ProxyModule.js +12 -6
- package/dist/cjs/ProxyModule.js.map +1 -1
- package/dist/esm/ModuleResolver.js +11 -7
- package/dist/esm/ModuleResolver.js.map +1 -1
- package/dist/esm/ProxyModule.js +13 -6
- package/dist/esm/ProxyModule.js.map +1 -1
- package/dist/types/ModuleResolver.d.ts +1 -0
- package/dist/types/ModuleResolver.d.ts.map +1 -1
- package/dist/types/ProxyModule.d.ts +51 -43
- package/dist/types/ProxyModule.d.ts.map +1 -1
- package/package.json +23 -22
- package/src/ModuleResolver.ts +16 -9
- package/src/ProxyModule.ts +21 -13
- package/dist/docs.json +0 -11211
package/src/ProxyModule.ts
CHANGED
|
@@ -2,17 +2,17 @@ import { assertEx } from '@xylabs/assert'
|
|
|
2
2
|
import { AddressPayload, AddressSchema } from '@xyo-network/address-payload-plugin'
|
|
3
3
|
import { QueryBoundWitness } from '@xyo-network/boundwitness-builder'
|
|
4
4
|
import { BridgeModule } from '@xyo-network/bridge-model'
|
|
5
|
-
import {
|
|
5
|
+
import { ManifestPayloadSchema, ModuleManifestPayload } from '@xyo-network/manifest-model'
|
|
6
6
|
import {
|
|
7
7
|
AddressPreviousHashPayload,
|
|
8
8
|
BaseEmitter,
|
|
9
9
|
CompositeModuleResolver,
|
|
10
|
-
Module,
|
|
11
10
|
ModuleConfig,
|
|
12
11
|
ModuleDescription,
|
|
13
12
|
ModuleEventData,
|
|
14
13
|
ModuleFilter,
|
|
15
14
|
ModuleFilterOptions,
|
|
15
|
+
ModuleInstance,
|
|
16
16
|
ModuleParams,
|
|
17
17
|
ModuleQueryResult,
|
|
18
18
|
} from '@xyo-network/module'
|
|
@@ -33,23 +33,24 @@ export type ProxyModuleParams = ModuleParams<
|
|
|
33
33
|
}
|
|
34
34
|
>
|
|
35
35
|
|
|
36
|
-
export class ProxyModule extends BaseEmitter<
|
|
36
|
+
export class ProxyModule extends BaseEmitter<ModuleParams, ModuleEventData> implements ModuleInstance<ModuleParams, ModuleEventData> {
|
|
37
37
|
readonly upResolver = new CompositeModuleResolver()
|
|
38
38
|
|
|
39
|
-
constructor(
|
|
40
|
-
super(
|
|
39
|
+
constructor(public proxyParams: ProxyModuleParams) {
|
|
40
|
+
super({ config: proxyParams.bridge.targetConfig(proxyParams.address) })
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
get address() {
|
|
44
|
-
return this.
|
|
44
|
+
return this.proxyParams.address.toLowerCase()
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
get bridge() {
|
|
48
|
-
return this.
|
|
48
|
+
return this.proxyParams.bridge
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
get config(): ModuleConfig {
|
|
52
|
-
|
|
52
|
+
const config = this.bridge.targetConfig(this.address)
|
|
53
|
+
return config
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
get downResolver() {
|
|
@@ -89,9 +90,13 @@ export class ProxyModule extends BaseEmitter<ProxyModuleParams, ModuleEventData>
|
|
|
89
90
|
return this.bridge.targetDiscover()
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
manifest(): Promisable<
|
|
93
|
+
manifest(): Promisable<ModuleManifestPayload> {
|
|
93
94
|
const name = this.config.name ?? 'Anonymous'
|
|
94
|
-
return { config: { name, ...this.config } }
|
|
95
|
+
return { config: { name, ...this.config }, schema: ManifestPayloadSchema }
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
moduleAddress(): Promise<AddressPreviousHashPayload[]> {
|
|
99
|
+
throw Error('Not Implemented')
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
previousHash(): Promise<string | undefined> {
|
|
@@ -109,9 +114,12 @@ export class ProxyModule extends BaseEmitter<ProxyModuleParams, ModuleEventData>
|
|
|
109
114
|
}
|
|
110
115
|
|
|
111
116
|
/* Resolves a filter from the perspective of the module, including through the parent/gateway module */
|
|
112
|
-
resolve(filter?: ModuleFilter, options?: ModuleFilterOptions): Promise<
|
|
113
|
-
resolve(nameOrAddress: string, options?: ModuleFilterOptions): Promise<
|
|
114
|
-
async resolve(
|
|
117
|
+
resolve(filter?: ModuleFilter, options?: ModuleFilterOptions): Promise<ModuleInstance[]>
|
|
118
|
+
resolve(nameOrAddress: string, options?: ModuleFilterOptions): Promise<ModuleInstance | undefined>
|
|
119
|
+
async resolve(
|
|
120
|
+
nameOrAddressOrFilter?: ModuleFilter | string,
|
|
121
|
+
options?: ModuleFilterOptions,
|
|
122
|
+
): Promise<ModuleInstance | ModuleInstance[] | undefined> {
|
|
115
123
|
if (typeof nameOrAddressOrFilter === 'string') {
|
|
116
124
|
return await this.bridge.targetResolve(this.address, nameOrAddressOrFilter, options)
|
|
117
125
|
} else {
|