@xyo-network/bridge-pub-sub 2.94.16 → 2.94.17
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/browser/AsyncQueryBus/AsyncQueryBusBase.d.cts +7 -72
- package/dist/browser/AsyncQueryBus/AsyncQueryBusBase.d.cts.map +1 -1
- package/dist/browser/AsyncQueryBus/AsyncQueryBusBase.d.mts +7 -72
- package/dist/browser/AsyncQueryBus/AsyncQueryBusBase.d.mts.map +1 -1
- package/dist/browser/AsyncQueryBus/AsyncQueryBusBase.d.ts +7 -72
- package/dist/browser/AsyncQueryBus/AsyncQueryBusBase.d.ts.map +1 -1
- package/dist/browser/index.cjs +59 -114
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +54 -109
- package/dist/browser/index.js.map +1 -1
- package/dist/node/AsyncQueryBus/AsyncQueryBusBase.d.cts +7 -72
- package/dist/node/AsyncQueryBus/AsyncQueryBusBase.d.cts.map +1 -1
- package/dist/node/AsyncQueryBus/AsyncQueryBusBase.d.mts +7 -72
- package/dist/node/AsyncQueryBus/AsyncQueryBusBase.d.mts.map +1 -1
- package/dist/node/AsyncQueryBus/AsyncQueryBusBase.d.ts +7 -72
- package/dist/node/AsyncQueryBus/AsyncQueryBusBase.d.ts.map +1 -1
- package/dist/node/index.cjs +64 -118
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +59 -113
- package/dist/node/index.js.map +1 -1
- package/package.json +18 -18
- package/src/AsyncQueryBus/AsyncQueryBusBase.ts +58 -101
package/dist/browser/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@ var AbstractModuleHost = class extends import_object.Base {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
// src/AsyncQueryBus/AsyncQueryBusClient.ts
|
|
46
|
-
var
|
|
46
|
+
var import_assert2 = require("@xylabs/assert");
|
|
47
47
|
var import_delay = require("@xylabs/delay");
|
|
48
48
|
var import_forget = require("@xylabs/forget");
|
|
49
49
|
var import_timer = require("@xylabs/timer");
|
|
@@ -53,9 +53,11 @@ var import_payload_builder = require("@xyo-network/payload-builder");
|
|
|
53
53
|
var import_lru_cache2 = require("lru-cache");
|
|
54
54
|
|
|
55
55
|
// src/AsyncQueryBus/AsyncQueryBusBase.ts
|
|
56
|
+
var import_assert = require("@xylabs/assert");
|
|
56
57
|
var import_object2 = require("@xylabs/object");
|
|
57
58
|
var import_archivist_model = require("@xyo-network/archivist-model");
|
|
58
59
|
var import_diviner_model = require("@xyo-network/diviner-model");
|
|
60
|
+
var import_module_model = require("@xyo-network/module-model");
|
|
59
61
|
var import_async_mutex = require("async-mutex");
|
|
60
62
|
var import_lru_cache = require("lru-cache");
|
|
61
63
|
var AsyncQueryBusBase = class extends import_object2.Base {
|
|
@@ -65,19 +67,13 @@ var AsyncQueryBusBase = class extends import_object2.Base {
|
|
|
65
67
|
_lastState;
|
|
66
68
|
_targetConfigs = {};
|
|
67
69
|
_targetQueries = {};
|
|
68
|
-
|
|
69
|
-
_lastQueriesDivinerAttempt;
|
|
70
|
-
_lastResponsesArchivistAttempt;
|
|
71
|
-
_lastResponsesDivinerAttempt;
|
|
70
|
+
_lastResolveAttempt = {};
|
|
72
71
|
_queriesArchivist;
|
|
73
|
-
_queriesArchivistMutex = new import_async_mutex.Mutex();
|
|
74
72
|
_queriesDiviner;
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
_reResolveDelay = 1e3 * 5;
|
|
74
|
+
_resolveMutex = new import_async_mutex.Mutex();
|
|
77
75
|
_responsesArchivist;
|
|
78
|
-
_responsesArchivistMutex = new import_async_mutex.Mutex();
|
|
79
76
|
_responsesDiviner;
|
|
80
|
-
_responsesDivinerMutex = new import_async_mutex.Mutex();
|
|
81
77
|
constructor(params) {
|
|
82
78
|
super(params);
|
|
83
79
|
}
|
|
@@ -102,92 +98,20 @@ var AsyncQueryBusBase = class extends import_object2.Base {
|
|
|
102
98
|
return this._lastState;
|
|
103
99
|
}
|
|
104
100
|
async queriesArchivist() {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return this._queriesArchivist;
|
|
108
|
-
}
|
|
109
|
-
if (Date.now() - (this._lastQueriesArchivistAttempt ?? 0) < this._reResolveDelay) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
this._lastQueriesArchivistAttempt = Date.now();
|
|
113
|
-
const resolved = await this.resolver.resolve(this.config?.intersect?.queries?.archivist);
|
|
114
|
-
if (resolved) {
|
|
115
|
-
const typedResolve = (0, import_archivist_model.asArchivistInstance)(resolved);
|
|
116
|
-
if (typedResolve) {
|
|
117
|
-
return typedResolve;
|
|
118
|
-
} else {
|
|
119
|
-
this.logger?.warn(`Unable to resolve queriesArchivist as correct type [${this.config?.intersect?.queries?.archivist}][${resolved?.constructor?.name}]: ${(0, import_object2.toJsonString)(resolved)}`);
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
this.logger?.log(`Unable to resolve queriesArchivist [${this.config?.intersect?.queries?.archivist}]`);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
101
|
+
this._queriesArchivist = this._queriesArchivist ?? await this.resolve((0, import_assert.assertEx)(this.config?.intersect?.queries?.archivist, () => "No queries Archivist defined"), import_archivist_model.isArchivistInstance);
|
|
102
|
+
return this._queriesArchivist;
|
|
125
103
|
}
|
|
126
104
|
async queriesDiviner() {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return this._queriesDiviner;
|
|
130
|
-
}
|
|
131
|
-
if (Date.now() - (this._lastQueriesDivinerAttempt ?? 0) < this._reResolveDelay) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
this._lastQueriesDivinerAttempt = Date.now();
|
|
135
|
-
const resolved = await this.resolver.resolve(this.config?.intersect?.queries?.boundWitnessDiviner);
|
|
136
|
-
if (resolved) {
|
|
137
|
-
const typedResolve = (0, import_diviner_model.asDivinerInstance)(resolved);
|
|
138
|
-
if (typedResolve) {
|
|
139
|
-
return typedResolve;
|
|
140
|
-
} else {
|
|
141
|
-
this.logger?.warn(`Unable to resolve queriesDiviner as correct type [${this.config?.intersect?.queries?.boundWitnessDiviner}][${resolved?.constructor?.name}]: ${(0, import_object2.toJsonString)(resolved)}`);
|
|
142
|
-
}
|
|
143
|
-
} else {
|
|
144
|
-
this.logger?.log(`Unable to resolve queriesDiviner [${this.config?.intersect?.queries?.boundWitnessDiviner}]`);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
105
|
+
this._queriesDiviner = this._queriesDiviner ?? await this.resolve((0, import_assert.assertEx)(this.config?.intersect?.queries?.boundWitnessDiviner, () => "No queries Diviner defined"), import_diviner_model.isDivinerInstance);
|
|
106
|
+
return this._queriesDiviner;
|
|
147
107
|
}
|
|
148
108
|
async responsesArchivist() {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return this._responsesArchivist;
|
|
152
|
-
}
|
|
153
|
-
if (Date.now() - (this._lastResponsesArchivistAttempt ?? 0) < this._reResolveDelay) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
this._lastResponsesArchivistAttempt = Date.now();
|
|
157
|
-
const resolved = await this.resolver.resolve(this.config?.intersect?.responses?.archivist);
|
|
158
|
-
if (resolved) {
|
|
159
|
-
const typedResolve = (0, import_archivist_model.asArchivistInstance)(resolved);
|
|
160
|
-
if (typedResolve) {
|
|
161
|
-
return typedResolve;
|
|
162
|
-
} else {
|
|
163
|
-
this.logger?.warn(`Unable to resolve responseArchivist as correct type [${this.config?.intersect?.responses?.archivist}][${resolved?.constructor?.name}]: ${(0, import_object2.toJsonString)(resolved)}`);
|
|
164
|
-
}
|
|
165
|
-
} else {
|
|
166
|
-
this.logger?.log(`Unable to resolve responseArchivist [${this.config?.intersect?.responses?.archivist}]`);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
109
|
+
this._responsesArchivist = this._responsesArchivist ?? await this.resolve((0, import_assert.assertEx)(this.config?.intersect?.responses?.archivist, () => "No responses Archivist defined"), import_archivist_model.isArchivistInstance);
|
|
110
|
+
return this._responsesArchivist;
|
|
169
111
|
}
|
|
170
112
|
async responsesDiviner() {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return this._responsesDiviner;
|
|
174
|
-
}
|
|
175
|
-
if (Date.now() - (this._lastResponsesDivinerAttempt ?? 0) < this._reResolveDelay) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
this._lastResponsesDivinerAttempt = Date.now();
|
|
179
|
-
const resolved = await this.resolver.resolve(this.config?.intersect?.responses?.boundWitnessDiviner);
|
|
180
|
-
if (resolved) {
|
|
181
|
-
const typedResolve = (0, import_diviner_model.asDivinerInstance)(resolved);
|
|
182
|
-
if (typedResolve) {
|
|
183
|
-
return typedResolve;
|
|
184
|
-
} else {
|
|
185
|
-
this.logger?.warn(`Unable to resolve responsesDiviner as correct type [${this.config?.intersect?.responses?.boundWitnessDiviner}][${resolved?.constructor?.name}]: ${(0, import_object2.toJsonString)(resolved)}`);
|
|
186
|
-
}
|
|
187
|
-
} else {
|
|
188
|
-
this.logger?.log(`Unable to resolve responsesDiviner [${this.config?.intersect?.responses?.boundWitnessDiviner}]`);
|
|
189
|
-
}
|
|
190
|
-
});
|
|
113
|
+
this._responsesDiviner = this._responsesDiviner ?? await this.resolve((0, import_assert.assertEx)(this.config?.intersect?.responses?.boundWitnessDiviner, () => "No responses Diviner defined"), import_diviner_model.isDivinerInstance);
|
|
114
|
+
return this._responsesDiviner;
|
|
191
115
|
}
|
|
192
116
|
/**
|
|
193
117
|
* Commit the internal state of the process. This is similar
|
|
@@ -219,6 +143,27 @@ var AsyncQueryBusBase = class extends import_object2.Base {
|
|
|
219
143
|
return state;
|
|
220
144
|
}
|
|
221
145
|
}
|
|
146
|
+
async resolve(id, typeCheck) {
|
|
147
|
+
return await this._resolveMutex.runExclusive(async () => {
|
|
148
|
+
if (this._queriesArchivist) {
|
|
149
|
+
return this._queriesArchivist;
|
|
150
|
+
}
|
|
151
|
+
if (Date.now() - (this._lastResolveAttempt[id] ?? 0) < this._reResolveDelay) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
this._lastResolveAttempt[id] = Date.now();
|
|
155
|
+
const resolved = await this.resolver.resolve(id);
|
|
156
|
+
if (resolved) {
|
|
157
|
+
if (typeCheck(resolved)) {
|
|
158
|
+
return resolved;
|
|
159
|
+
} else {
|
|
160
|
+
this.logger?.warn(`Unable to resolve responsesDiviner as correct type [${id}][${resolved?.constructor?.name}]: ${resolved.id}`);
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
this.logger?.log(`Unable to resolve queriesArchivist [${id}] [${await (0, import_module_model.traceModuleIdentifier)(this.resolver, id)}]`);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
222
167
|
};
|
|
223
168
|
|
|
224
169
|
// src/AsyncQueryBus/model/QueryStatus.ts
|
|
@@ -276,7 +221,7 @@ var AsyncQueryBusClient = class extends AsyncQueryBusBase {
|
|
|
276
221
|
...query,
|
|
277
222
|
$meta
|
|
278
223
|
});
|
|
279
|
-
const queryArchivist = (0,
|
|
224
|
+
const queryArchivist = (0, import_assert2.assertEx)(await this.queriesArchivist(), () => `Unable to contact queriesArchivist [${this.config?.intersect?.queries?.archivist}]`);
|
|
280
225
|
const routedQueryHash = (
|
|
281
226
|
// Trust the signed hash if it's there
|
|
282
227
|
routedQuery?.$hash ?? // TODO: What is the right way to find the dataHash
|
|
@@ -404,11 +349,11 @@ var AsyncQueryBusClient = class extends AsyncQueryBusBase {
|
|
|
404
349
|
|
|
405
350
|
// src/AsyncQueryBus/AsyncQueryBusHost.ts
|
|
406
351
|
var import_array = require("@xylabs/array");
|
|
407
|
-
var
|
|
352
|
+
var import_assert3 = require("@xylabs/assert");
|
|
408
353
|
var import_timer2 = require("@xylabs/timer");
|
|
409
354
|
var import_boundwitness_model2 = require("@xyo-network/boundwitness-model");
|
|
410
355
|
var import_diviner_boundwitness_model2 = require("@xyo-network/diviner-boundwitness-model");
|
|
411
|
-
var
|
|
356
|
+
var import_module_model2 = require("@xyo-network/module-model");
|
|
412
357
|
var import_payload_builder2 = require("@xyo-network/payload-builder");
|
|
413
358
|
var AsyncQueryBusHost = class extends AsyncQueryBusBase {
|
|
414
359
|
static {
|
|
@@ -431,14 +376,14 @@ var AsyncQueryBusHost = class extends AsyncQueryBusBase {
|
|
|
431
376
|
}
|
|
432
377
|
async expose(id, options) {
|
|
433
378
|
const { failOnAlreadyExposed, required = true } = options ?? {};
|
|
434
|
-
const module2 = (0,
|
|
379
|
+
const module2 = (0, import_module_model2.asModuleInstance)(await this.resolver.resolve(id, {
|
|
435
380
|
maxDepth: 10
|
|
436
381
|
}));
|
|
437
382
|
if (!module2 && required) {
|
|
438
383
|
throw new Error(`Unable to resolve module to expose [${id}]`);
|
|
439
384
|
}
|
|
440
385
|
if (module2) {
|
|
441
|
-
(0,
|
|
386
|
+
(0, import_assert3.assertEx)(!failOnAlreadyExposed || !this._exposedAddresses.has(module2.address), () => `Address already exposed: ${id} [${module2.address}]`);
|
|
442
387
|
this._exposedAddresses.add(module2.address);
|
|
443
388
|
this._exposeOptions[module2.address] = {
|
|
444
389
|
...options
|
|
@@ -452,7 +397,7 @@ var AsyncQueryBusHost = class extends AsyncQueryBusBase {
|
|
|
452
397
|
...this.config?.listeningModules ?? [],
|
|
453
398
|
...this.exposedAddresses.values()
|
|
454
399
|
];
|
|
455
|
-
const mods = await Promise.all(exposedModules.map(async (exposedModule) => (0,
|
|
400
|
+
const mods = await Promise.all(exposedModules.map(async (exposedModule) => (0, import_assert3.assertEx)((0, import_module_model2.asModuleInstance)(await this.resolver.resolve(exposedModule, {
|
|
456
401
|
maxDepth: 10
|
|
457
402
|
})), () => `Unable to resolve listeningModule [${exposedModule}]`)));
|
|
458
403
|
return mods;
|
|
@@ -472,11 +417,11 @@ var AsyncQueryBusHost = class extends AsyncQueryBusBase {
|
|
|
472
417
|
this._pollId = void 0;
|
|
473
418
|
}
|
|
474
419
|
async unexpose(id, validate = true) {
|
|
475
|
-
const module2 = (0,
|
|
420
|
+
const module2 = (0, import_module_model2.asModuleInstance)(await this.resolver.resolve(id, {
|
|
476
421
|
maxDepth: 10
|
|
477
422
|
}));
|
|
478
423
|
if (module2) {
|
|
479
|
-
(0,
|
|
424
|
+
(0, import_assert3.assertEx)(!validate || this._exposedAddresses.has(module2.address), () => `Address not exposed [${module2.address}][${module2.id}]`);
|
|
480
425
|
this._exposedAddresses.delete(module2.address);
|
|
481
426
|
delete this._exposeOptions[module2.address];
|
|
482
427
|
this.logger?.debug(`${module2.address} [${module2.id}] unexposed`);
|
|
@@ -485,8 +430,8 @@ var AsyncQueryBusHost = class extends AsyncQueryBusBase {
|
|
|
485
430
|
}
|
|
486
431
|
callLocalModule = async (localModule, query) => {
|
|
487
432
|
const localModuleName = localModule.config.name ?? localModule.address;
|
|
488
|
-
const queryArchivist = (0,
|
|
489
|
-
const responsesArchivist = (0,
|
|
433
|
+
const queryArchivist = (0, import_assert3.assertEx)(await this.queriesArchivist(), () => `Unable to contact queriesArchivist [${this.config?.intersect?.queries?.archivist}]`);
|
|
434
|
+
const responsesArchivist = (0, import_assert3.assertEx)(await this.responsesArchivist(), () => `Unable to contact responsesArchivist [${this.config?.intersect?.queries?.archivist}]`);
|
|
490
435
|
const queryDestination = query.$meta?.destination;
|
|
491
436
|
if (queryDestination && queryDestination?.includes(localModule.address)) {
|
|
492
437
|
const queryIndex = query.payload_hashes.indexOf(query.query);
|
|
@@ -505,7 +450,7 @@ var AsyncQueryBusHost = class extends AsyncQueryBusBase {
|
|
|
505
450
|
this.logger?.debug(`Issuing query ${querySchema2} (${queryHash}) addressed to module: ${localModuleName}`);
|
|
506
451
|
const response = await localModule.query(query, queryPayloads, {
|
|
507
452
|
allowedQueries: this._exposeOptions[localModule.address]?.allowedQueries,
|
|
508
|
-
schema:
|
|
453
|
+
schema: import_module_model2.ModuleConfigSchema
|
|
509
454
|
});
|
|
510
455
|
const [bw, payloads, errors] = response;
|
|
511
456
|
this.logger?.debug(`Replying to query ${queryHash} addressed to module: ${localModuleName}`);
|
|
@@ -649,18 +594,18 @@ var PubSubBridgeSchema = "network.xyo.bridge.pubsub";
|
|
|
649
594
|
var PubSubBridgeConfigSchema = `${PubSubBridgeSchema}.config`;
|
|
650
595
|
|
|
651
596
|
// src/PubSubBridge.ts
|
|
652
|
-
var
|
|
597
|
+
var import_assert5 = require("@xylabs/assert");
|
|
653
598
|
var import_exists = require("@xylabs/exists");
|
|
654
599
|
var import_abstract_bridge3 = require("@xyo-network/abstract-bridge");
|
|
655
|
-
var
|
|
600
|
+
var import_module_model4 = require("@xyo-network/module-model");
|
|
656
601
|
|
|
657
602
|
// src/PubSubBridgeModuleResolver.ts
|
|
658
|
-
var
|
|
603
|
+
var import_assert4 = require("@xylabs/assert");
|
|
659
604
|
var import_hex = require("@xylabs/hex");
|
|
660
605
|
var import_abstract_bridge2 = require("@xyo-network/abstract-bridge");
|
|
661
606
|
var import_account = require("@xyo-network/account");
|
|
662
607
|
var import_config_payload_plugin = require("@xyo-network/config-payload-plugin");
|
|
663
|
-
var
|
|
608
|
+
var import_module_model3 = require("@xyo-network/module-model");
|
|
664
609
|
var PubSubBridgeModuleResolver = class extends import_abstract_bridge2.AbstractBridgeModuleResolver {
|
|
665
610
|
static {
|
|
666
611
|
__name(this, "PubSubBridgeModuleResolver");
|
|
@@ -672,14 +617,14 @@ var PubSubBridgeModuleResolver = class extends import_abstract_bridge2.AbstractB
|
|
|
672
617
|
}
|
|
673
618
|
const idParts = id.split(":");
|
|
674
619
|
const firstPart = idParts.shift();
|
|
675
|
-
(0,
|
|
620
|
+
(0, import_assert4.assertEx)((0, import_hex.isAddress)(firstPart), () => `Invalid module address: ${firstPart}`);
|
|
676
621
|
const remainderParts = idParts.join(":");
|
|
677
622
|
const account = import_account.Account.randomSync();
|
|
678
623
|
const params = {
|
|
679
624
|
account,
|
|
680
625
|
busClient: this.params.busClient,
|
|
681
626
|
config: {
|
|
682
|
-
schema:
|
|
627
|
+
schema: import_module_model3.ModuleConfigSchema
|
|
683
628
|
},
|
|
684
629
|
host: this.params.bridge,
|
|
685
630
|
moduleAddress: firstPart
|
|
@@ -689,13 +634,13 @@ var PubSubBridgeModuleResolver = class extends import_abstract_bridge2.AbstractB
|
|
|
689
634
|
const state = await proxy.state();
|
|
690
635
|
if (state) {
|
|
691
636
|
const configSchema = state.find((payload) => payload.schema === import_config_payload_plugin.ConfigSchema)?.config;
|
|
692
|
-
const config = (0,
|
|
637
|
+
const config = (0, import_assert4.assertEx)(state.find((payload) => payload.schema === configSchema), () => "Unable to locate config");
|
|
693
638
|
proxy.setConfig(config);
|
|
694
639
|
}
|
|
695
640
|
}
|
|
696
641
|
await proxy.start?.();
|
|
697
642
|
const wrapped = (0, import_abstract_bridge2.wrapModuleWithType)(proxy, account);
|
|
698
|
-
const as = (0,
|
|
643
|
+
const as = (0, import_assert4.assertEx)((0, import_module_model3.asModuleInstance)(wrapped, {}), () => `Failed to asModuleInstance [${id}]`);
|
|
699
644
|
proxy.upResolver.add(as);
|
|
700
645
|
proxy.downResolver.add(as);
|
|
701
646
|
this.add(as);
|
|
@@ -734,7 +679,7 @@ var PubSubBridge = class extends import_abstract_bridge3.AbstractBridge {
|
|
|
734
679
|
get resolver() {
|
|
735
680
|
this._resolver = this._resolver ?? new PubSubBridgeModuleResolver({
|
|
736
681
|
bridge: this,
|
|
737
|
-
busClient: (0,
|
|
682
|
+
busClient: (0, import_assert5.assertEx)(this.busClient(), () => "busClient not configured"),
|
|
738
683
|
wrapperAccount: this.account
|
|
739
684
|
});
|
|
740
685
|
return this._resolver;
|
|
@@ -743,7 +688,7 @@ var PubSubBridge = class extends import_abstract_bridge3.AbstractBridge {
|
|
|
743
688
|
return `${this.config.name ?? moduleName}`;
|
|
744
689
|
}
|
|
745
690
|
get roots() {
|
|
746
|
-
return (0,
|
|
691
|
+
return (0, import_assert5.assertEx)(this.config.roots, () => "roots not configured");
|
|
747
692
|
}
|
|
748
693
|
async discoverRoots() {
|
|
749
694
|
const rootInstances = (await Promise.all(this.roots.map(async (root) => await this.resolver.resolve(root)))).filter(import_exists.exists);
|
|
@@ -754,7 +699,7 @@ var PubSubBridge = class extends import_abstract_bridge3.AbstractBridge {
|
|
|
754
699
|
}
|
|
755
700
|
async exposeHandler(id, options) {
|
|
756
701
|
const { maxDepth = 2, direction = "all", required = true } = options ?? {};
|
|
757
|
-
const host = (0,
|
|
702
|
+
const host = (0, import_assert5.assertEx)(this.busHost(), () => "Not configured as a host");
|
|
758
703
|
const module2 = await host.expose(id, {
|
|
759
704
|
required
|
|
760
705
|
});
|
|
@@ -787,7 +732,7 @@ var PubSubBridge = class extends import_abstract_bridge3.AbstractBridge {
|
|
|
787
732
|
}
|
|
788
733
|
async unexposeHandler(id, options) {
|
|
789
734
|
const { maxDepth = 2, direction = "all", required = true } = options ?? {};
|
|
790
|
-
const host = (0,
|
|
735
|
+
const host = (0, import_assert5.assertEx)(this.busHost(), () => "Not configured as a host");
|
|
791
736
|
const module2 = await host.unexpose(id, required);
|
|
792
737
|
if (module2) {
|
|
793
738
|
const children = maxDepth > 0 ? await module2.resolve("*", {
|
|
@@ -832,6 +777,6 @@ var PubSubBridge = class extends import_abstract_bridge3.AbstractBridge {
|
|
|
832
777
|
}
|
|
833
778
|
};
|
|
834
779
|
PubSubBridge = _ts_decorate([
|
|
835
|
-
(0,
|
|
780
|
+
(0, import_module_model4.creatableModule)()
|
|
836
781
|
], PubSubBridge);
|
|
837
782
|
//# sourceMappingURL=index.cjs.map
|