@xyo-network/bridge-wrapper 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/BridgeWrapper.js +8 -6
- package/dist/cjs/BridgeWrapper.js.map +1 -1
- package/dist/esm/BridgeWrapper.js +8 -6
- package/dist/esm/BridgeWrapper.js.map +1 -1
- package/dist/types/BridgeWrapper.d.ts +51 -43
- package/dist/types/BridgeWrapper.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/BridgeWrapper.ts +24 -12
- package/dist/docs.json +0 -16930
|
@@ -4,7 +4,6 @@ exports.BridgeWrapper = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const bridge_model_1 = require("@xyo-network/bridge-model");
|
|
6
6
|
const module_1 = require("@xyo-network/module");
|
|
7
|
-
const payload_wrapper_1 = require("@xyo-network/payload-wrapper");
|
|
8
7
|
(0, module_1.constructableModuleWrapper)();
|
|
9
8
|
class BridgeWrapper extends module_1.ModuleWrapper {
|
|
10
9
|
get targetDownResolver() {
|
|
@@ -12,24 +11,27 @@ class BridgeWrapper extends module_1.ModuleWrapper {
|
|
|
12
11
|
}
|
|
13
12
|
connect(uri) {
|
|
14
13
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
const queryPayload =
|
|
14
|
+
const queryPayload = { schema: bridge_model_1.BridgeConnectQuerySchema, uri };
|
|
16
15
|
yield this.sendQuery(queryPayload);
|
|
17
16
|
return true;
|
|
18
17
|
});
|
|
19
18
|
}
|
|
20
19
|
disconnect(uri) {
|
|
21
20
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const queryPayload =
|
|
21
|
+
const queryPayload = { schema: bridge_model_1.BridgeDisconnectQuerySchema, uri };
|
|
23
22
|
yield this.sendQuery(queryPayload);
|
|
24
23
|
return true;
|
|
25
24
|
});
|
|
26
25
|
}
|
|
26
|
+
getRootAddress() {
|
|
27
|
+
throw new Error('Method not implemented.');
|
|
28
|
+
}
|
|
27
29
|
targetConfig(address) {
|
|
28
30
|
return this.module.targetConfig(address);
|
|
29
31
|
}
|
|
30
32
|
targetDiscover(address) {
|
|
31
33
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const queryPayload =
|
|
34
|
+
const queryPayload = { schema: module_1.ModuleDiscoverQuerySchema };
|
|
33
35
|
return yield this.sendTargetQuery(address, queryPayload);
|
|
34
36
|
});
|
|
35
37
|
}
|
|
@@ -46,9 +48,9 @@ class BridgeWrapper extends module_1.ModuleWrapper {
|
|
|
46
48
|
return yield this.module.targetQueryable(address, query, payloads, queryConfig);
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
|
-
targetResolve(address,
|
|
51
|
+
targetResolve(address, nameOrAddressOrFilter, options) {
|
|
50
52
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
return yield this.module.targetResolve(address,
|
|
53
|
+
return yield this.module.targetResolve(address, nameOrAddressOrFilter, options);
|
|
52
54
|
});
|
|
53
55
|
}
|
|
54
56
|
sendTargetQuery(address, queryPayload, payloads) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BridgeWrapper.js","sourceRoot":"","sources":["../../src/BridgeWrapper.ts"],"names":[],"mappings":";;;;AACA,
|
|
1
|
+
{"version":3,"file":"BridgeWrapper.js","sourceRoot":"","sources":["../../src/BridgeWrapper.ts"],"names":[],"mappings":";;;;AACA,4DAQkC;AAClC,gDAU4B;AAI5B,IAAA,mCAA0B,GAAE,CAAA;AAC5B,MAAa,aACX,SAAQ,sBAA6B;IAMrC,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAA;IACvC,CAAC;IAEK,OAAO,CAAC,GAAY;;YACxB,MAAM,YAAY,GAAgB,EAAE,MAAM,EAAE,uCAAwB,EAAE,GAAG,EAAE,CAAA;YAC3E,MAAM,IAAI,CAAC,SAA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CAAC,CAAA;QACjF,CAAC;KAAA;IAEe,eAAe,CAAkB,OAAe,EAAE,YAAe,EAAE,QAAoB;;YACrG,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;YAC1D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YACzE,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;YACrC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAA;QAClB,CAAC;KAAA;;AA/DH,sCAgEC;AA5DiB,mCAAqB,GAAG,+BAAgB,CAAA;AACxC,iCAAmB,GAAG,6BAAc,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BridgeConnectQuerySchema, BridgeDisconnectQuerySchema, isBridgeInstance, isBridgeModule, } from '@xyo-network/bridge-model';
|
|
2
2
|
import { constructableModuleWrapper, ModuleDiscoverQuerySchema, ModuleWrapper, } from '@xyo-network/module';
|
|
3
|
-
import { PayloadWrapper } from '@xyo-network/payload-wrapper';
|
|
4
3
|
constructableModuleWrapper();
|
|
5
4
|
export class BridgeWrapper extends ModuleWrapper {
|
|
6
5
|
static instanceIdentityCheck = isBridgeInstance;
|
|
@@ -9,20 +8,23 @@ export class BridgeWrapper extends ModuleWrapper {
|
|
|
9
8
|
return this.module.targetDownResolver;
|
|
10
9
|
}
|
|
11
10
|
async connect(uri) {
|
|
12
|
-
const queryPayload =
|
|
11
|
+
const queryPayload = { schema: BridgeConnectQuerySchema, uri };
|
|
13
12
|
await this.sendQuery(queryPayload);
|
|
14
13
|
return true;
|
|
15
14
|
}
|
|
16
15
|
async disconnect(uri) {
|
|
17
|
-
const queryPayload =
|
|
16
|
+
const queryPayload = { schema: BridgeDisconnectQuerySchema, uri };
|
|
18
17
|
await this.sendQuery(queryPayload);
|
|
19
18
|
return true;
|
|
20
19
|
}
|
|
20
|
+
getRootAddress() {
|
|
21
|
+
throw new Error('Method not implemented.');
|
|
22
|
+
}
|
|
21
23
|
targetConfig(address) {
|
|
22
24
|
return this.module.targetConfig(address);
|
|
23
25
|
}
|
|
24
26
|
async targetDiscover(address) {
|
|
25
|
-
const queryPayload =
|
|
27
|
+
const queryPayload = { schema: ModuleDiscoverQuerySchema };
|
|
26
28
|
return await this.sendTargetQuery(address, queryPayload);
|
|
27
29
|
}
|
|
28
30
|
targetQueries(address) {
|
|
@@ -34,8 +36,8 @@ export class BridgeWrapper extends ModuleWrapper {
|
|
|
34
36
|
async targetQueryable(address, query, payloads, queryConfig) {
|
|
35
37
|
return await this.module.targetQueryable(address, query, payloads, queryConfig);
|
|
36
38
|
}
|
|
37
|
-
async targetResolve(address,
|
|
38
|
-
return await this.module.targetResolve(address,
|
|
39
|
+
async targetResolve(address, nameOrAddressOrFilter, options) {
|
|
40
|
+
return await this.module.targetResolve(address, nameOrAddressOrFilter, options);
|
|
39
41
|
}
|
|
40
42
|
async sendTargetQuery(address, queryPayload, payloads) {
|
|
41
43
|
const query = await this.bindQuery(queryPayload, payloads);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BridgeWrapper.js","sourceRoot":"","sources":["../../src/BridgeWrapper.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,2BAA2B,
|
|
1
|
+
{"version":3,"file":"BridgeWrapper.js","sourceRoot":"","sources":["../../src/BridgeWrapper.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAI3B,gBAAgB,EAChB,cAAc,GACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,0BAA0B,EAG1B,yBAAyB,EAKzB,aAAa,GACd,MAAM,qBAAqB,CAAA;AAI5B,0BAA0B,EAAE,CAAA;AAC5B,MAAM,OAAO,aACX,SAAQ,aAA6B;IAGrC,MAAM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AC,OAAe,EAAE,KAAwB,EAAE,QAAoB,EAAE,WAA0B;QAC/G,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;IACjF,CAAC;IAID,KAAK,CAAC,aAAa,CACjB,OAAe,EACf,qBAA6C,EAC7C,OAA6B;QAE7B,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAA;IACjF,CAAC;IAES,KAAK,CAAC,eAAe,CAAkB,OAAe,EAAE,YAAe,EAAE,QAAoB;QACrG,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;QAC1D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QACzE,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QACrC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAA;IAClB,CAAC"}
|
|
@@ -1,55 +1,63 @@
|
|
|
1
1
|
import { QueryBoundWitness } from '@xyo-network/boundwitness-builder';
|
|
2
|
-
import { BridgeModule } from '@xyo-network/bridge-model';
|
|
3
|
-
import { ModuleConfig, ModuleFilter, ModuleQueryResult, ModuleWrapper } from '@xyo-network/module';
|
|
2
|
+
import { BridgeInstance, BridgeModule } from '@xyo-network/bridge-model';
|
|
3
|
+
import { ModuleConfig, ModuleFilter, ModuleFilterOptions, ModuleInstance, ModuleQueryResult, ModuleWrapper } from '@xyo-network/module';
|
|
4
4
|
import { Payload, Query } from '@xyo-network/payload-model';
|
|
5
|
-
import {
|
|
6
|
-
export declare class BridgeWrapper extends ModuleWrapper<
|
|
7
|
-
static instanceIdentityCheck: import("@xyo-network/
|
|
8
|
-
static moduleIdentityCheck: import("@xyo-network/module").ModuleTypeCheck<BridgeModule<import("@xyo-network/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
schema
|
|
41
|
-
|
|
42
|
-
schema
|
|
43
|
-
|
|
5
|
+
import { Promisable } from '@xyo-network/promise';
|
|
6
|
+
export declare class BridgeWrapper<TWrappedModule extends BridgeModule = BridgeModule> extends ModuleWrapper<TWrappedModule> implements BridgeInstance<TWrappedModule['params']> {
|
|
7
|
+
static instanceIdentityCheck: import("@xyo-network/object-identity").ObjectTypeCheck<BridgeInstance>;
|
|
8
|
+
static moduleIdentityCheck: import("@xyo-network/module").ModuleTypeCheck<BridgeModule<import("@xyo-network/core").BaseParamsFields & {
|
|
9
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
10
|
+
accountDerivationPath?: string | undefined;
|
|
11
|
+
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
12
|
+
readonly archivist?: import("@xyo-network/module").ArchivistModuleConfig | undefined;
|
|
13
|
+
readonly name?: string | undefined;
|
|
14
|
+
readonly paging?: Record<string, {
|
|
15
|
+
size?: number | undefined;
|
|
16
|
+
}> | undefined;
|
|
17
|
+
readonly schema: string;
|
|
18
|
+
readonly security?: {
|
|
19
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
20
|
+
readonly allowed?: Record<string, (string | import("@xyo-network/module").CosigningAddressSet)[]> | undefined;
|
|
21
|
+
readonly disallowed?: Record<string, string[]> | undefined;
|
|
22
|
+
} | undefined;
|
|
23
|
+
readonly storeQueries?: boolean | undefined;
|
|
24
|
+
} & Omit<Omit<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
25
|
+
readonly archivist?: import("@xyo-network/module").ArchivistModuleConfig | undefined;
|
|
26
|
+
readonly name?: string | undefined;
|
|
27
|
+
readonly paging?: Record<string, {
|
|
28
|
+
size?: number | undefined;
|
|
29
|
+
}> | undefined;
|
|
30
|
+
readonly schema: "network.xyo.bridge.config";
|
|
31
|
+
readonly security?: {
|
|
32
|
+
readonly allowAnonymous?: boolean | undefined;
|
|
33
|
+
readonly allowed?: Record<string, (string | import("@xyo-network/module").CosigningAddressSet)[]> | undefined;
|
|
34
|
+
readonly disallowed?: Record<string, string[]> | undefined;
|
|
35
|
+
} | undefined;
|
|
36
|
+
readonly storeQueries?: boolean | undefined;
|
|
37
|
+
} & Omit<{
|
|
38
|
+
discoverCache?: true | import("@xyo-network/bridge-model").CacheConfig | undefined;
|
|
39
|
+
schema: "network.xyo.bridge.config";
|
|
40
|
+
}, "schema"> & {
|
|
41
|
+
schema: "network.xyo.bridge.config";
|
|
42
|
+
}, "schema"> & {
|
|
43
|
+
schema: string;
|
|
44
|
+
}, "schema"> & {
|
|
45
|
+
schema: string;
|
|
46
|
+
};
|
|
47
|
+
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
48
|
+
wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
|
|
49
|
+
}, import("@xyo-network/module").ModuleEventData>>;
|
|
44
50
|
get targetDownResolver(): (address?: string | undefined) => import("@xyo-network/module").ModuleResolver;
|
|
45
51
|
connect(uri?: string): Promise<boolean>;
|
|
46
52
|
disconnect(uri?: string): Promise<boolean>;
|
|
53
|
+
getRootAddress(): Promisable<string>;
|
|
47
54
|
targetConfig(address: string): ModuleConfig;
|
|
48
55
|
targetDiscover(address: string): Promise<Payload[]>;
|
|
49
56
|
targetQueries(address: string): string[];
|
|
50
57
|
targetQuery<T extends QueryBoundWitness = QueryBoundWitness>(address: string, query: T, payloads?: Payload[]): Promise<ModuleQueryResult>;
|
|
51
58
|
targetQueryable(address: string, query: QueryBoundWitness, payloads?: Payload[], queryConfig?: ModuleConfig): Promise<boolean>;
|
|
52
|
-
targetResolve(address: string, filter?: ModuleFilter): Promise<
|
|
53
|
-
|
|
59
|
+
targetResolve(address: string, filter?: ModuleFilter, options?: ModuleFilterOptions): Promise<ModuleInstance[]>;
|
|
60
|
+
targetResolve(address: string, nameOrAddress: string, options?: ModuleFilterOptions): Promise<ModuleInstance | undefined>;
|
|
61
|
+
protected sendTargetQuery<T extends Query>(address: string, queryPayload: T, payloads?: Payload[]): Promise<Payload[]>;
|
|
54
62
|
}
|
|
55
63
|
//# sourceMappingURL=BridgeWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BridgeWrapper.d.ts","sourceRoot":"","sources":["../../src/BridgeWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAGL,YAAY,EAIb,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAEL,YAAY,EAGZ,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACd,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"BridgeWrapper.d.ts","sourceRoot":"","sources":["../../src/BridgeWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAGL,cAAc,EACd,YAAY,EAIb,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAEL,YAAY,EAGZ,YAAY,EACZ,mBAAmB,E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,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAC/G,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;cAS/G,eAAe,CAAC,CAAC,SAAS,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAM7H"}
|
package/package.json
CHANGED
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xyo-network/boundwitness-builder": "~2.
|
|
14
|
-
"@xyo-network/bridge-model": "~2.
|
|
15
|
-
"@xyo-network/module": "~2.
|
|
16
|
-
"@xyo-network/payload-model": "~2.
|
|
17
|
-
"@xyo-network/
|
|
13
|
+
"@xyo-network/boundwitness-builder": "~2.67.0-rc.2",
|
|
14
|
+
"@xyo-network/bridge-model": "~2.67.0-rc.2",
|
|
15
|
+
"@xyo-network/module": "~2.67.0-rc.2",
|
|
16
|
+
"@xyo-network/payload-model": "~2.67.0-rc.2",
|
|
17
|
+
"@xyo-network/promise": "~2.67.0-rc.2"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@xylabs/ts-scripts-yarn3": "^2.
|
|
21
|
-
"@xylabs/tsconfig": "^2.
|
|
20
|
+
"@xylabs/ts-scripts-yarn3": "^2.19.0",
|
|
21
|
+
"@xylabs/tsconfig": "^2.19.0",
|
|
22
22
|
"typescript": "^5.1.6"
|
|
23
23
|
},
|
|
24
24
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
@@ -54,5 +54,6 @@
|
|
|
54
54
|
},
|
|
55
55
|
"sideEffects": false,
|
|
56
56
|
"types": "dist/types/index.d.ts",
|
|
57
|
-
"version": "2.
|
|
57
|
+
"version": "2.67.0-rc.2",
|
|
58
|
+
"stableVersion": "2.66.9"
|
|
58
59
|
}
|
package/src/BridgeWrapper.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { QueryBoundWitness } from '@xyo-network/boundwitness-builder'
|
|
|
2
2
|
import {
|
|
3
3
|
BridgeConnectQuerySchema,
|
|
4
4
|
BridgeDisconnectQuerySchema,
|
|
5
|
+
BridgeInstance,
|
|
5
6
|
BridgeModule,
|
|
6
7
|
BridgeQuery,
|
|
7
8
|
isBridgeInstance,
|
|
@@ -13,14 +14,19 @@ import {
|
|
|
13
14
|
ModuleDiscoverQuery,
|
|
14
15
|
ModuleDiscoverQuerySchema,
|
|
15
16
|
ModuleFilter,
|
|
17
|
+
ModuleFilterOptions,
|
|
18
|
+
ModuleInstance,
|
|
16
19
|
ModuleQueryResult,
|
|
17
20
|
ModuleWrapper,
|
|
18
21
|
} from '@xyo-network/module'
|
|
19
22
|
import { Payload, Query } from '@xyo-network/payload-model'
|
|
20
|
-
import {
|
|
23
|
+
import { Promisable } from '@xyo-network/promise'
|
|
21
24
|
|
|
22
25
|
constructableModuleWrapper()
|
|
23
|
-
export class BridgeWrapper extends
|
|
26
|
+
export class BridgeWrapper<TWrappedModule extends BridgeModule = BridgeModule>
|
|
27
|
+
extends ModuleWrapper<TWrappedModule>
|
|
28
|
+
implements BridgeInstance<TWrappedModule['params']>
|
|
29
|
+
{
|
|
24
30
|
static override instanceIdentityCheck = isBridgeInstance
|
|
25
31
|
static override moduleIdentityCheck = isBridgeModule
|
|
26
32
|
|
|
@@ -29,23 +35,27 @@ export class BridgeWrapper extends ModuleWrapper<BridgeModule> {
|
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
async connect(uri?: string): Promise<boolean> {
|
|
32
|
-
const queryPayload =
|
|
38
|
+
const queryPayload: BridgeQuery = { schema: BridgeConnectQuerySchema, uri }
|
|
33
39
|
await this.sendQuery(queryPayload)
|
|
34
40
|
return true
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
async disconnect(uri?: string): Promise<boolean> {
|
|
38
|
-
const queryPayload =
|
|
44
|
+
const queryPayload: BridgeQuery = { schema: BridgeDisconnectQuerySchema, uri }
|
|
39
45
|
await this.sendQuery(queryPayload)
|
|
40
46
|
return true
|
|
41
47
|
}
|
|
42
48
|
|
|
49
|
+
getRootAddress(): Promisable<string> {
|
|
50
|
+
throw new Error('Method not implemented.')
|
|
51
|
+
}
|
|
52
|
+
|
|
43
53
|
targetConfig(address: string): ModuleConfig {
|
|
44
54
|
return this.module.targetConfig(address)
|
|
45
55
|
}
|
|
46
56
|
|
|
47
57
|
async targetDiscover(address: string): Promise<Payload[]> {
|
|
48
|
-
const queryPayload =
|
|
58
|
+
const queryPayload: ModuleDiscoverQuery = { schema: ModuleDiscoverQuerySchema }
|
|
49
59
|
return await this.sendTargetQuery(address, queryPayload)
|
|
50
60
|
}
|
|
51
61
|
|
|
@@ -61,15 +71,17 @@ export class BridgeWrapper extends ModuleWrapper<BridgeModule> {
|
|
|
61
71
|
return await this.module.targetQueryable(address, query, payloads, queryConfig)
|
|
62
72
|
}
|
|
63
73
|
|
|
64
|
-
async targetResolve(address: string, filter?: ModuleFilter)
|
|
65
|
-
|
|
74
|
+
async targetResolve(address: string, filter?: ModuleFilter, options?: ModuleFilterOptions): Promise<ModuleInstance[]>
|
|
75
|
+
async targetResolve(address: string, nameOrAddress: string, options?: ModuleFilterOptions): Promise<ModuleInstance | undefined>
|
|
76
|
+
async targetResolve(
|
|
77
|
+
address: string,
|
|
78
|
+
nameOrAddressOrFilter?: ModuleFilter | string,
|
|
79
|
+
options?: ModuleFilterOptions,
|
|
80
|
+
): Promise<Promisable<ModuleInstance | ModuleInstance[] | undefined>> {
|
|
81
|
+
return await this.module.targetResolve(address, nameOrAddressOrFilter, options)
|
|
66
82
|
}
|
|
67
83
|
|
|
68
|
-
protected async sendTargetQuery<T extends Query
|
|
69
|
-
address: string,
|
|
70
|
-
queryPayload: T,
|
|
71
|
-
payloads?: Payload[],
|
|
72
|
-
): Promise<Payload[]> {
|
|
84
|
+
protected async sendTargetQuery<T extends Query>(address: string, queryPayload: T, payloads?: Payload[]): Promise<Payload[]> {
|
|
73
85
|
const query = await this.bindQuery(queryPayload, payloads)
|
|
74
86
|
const result = await this.module.targetQuery(address, query[0], query[1])
|
|
75
87
|
await this.throwErrors(query, result)
|