pmcf 1.7.0 → 1.8.0
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/package.json +1 -1
- package/src/model.mjs +44 -1
- package/types/model.d.mts +4 -0
package/package.json
CHANGED
package/src/model.mjs
CHANGED
|
@@ -103,6 +103,10 @@ export class Base {
|
|
|
103
103
|
error(...args) {
|
|
104
104
|
console.error(`${this.toString()}:`, ...args);
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
info(...args) {
|
|
108
|
+
console.info(`${this.toString()}:`, ...args);
|
|
109
|
+
}
|
|
106
110
|
|
|
107
111
|
toString() {
|
|
108
112
|
return this.typeName + ":" + (this.owner?.name || "") + "/" + this.name;
|
|
@@ -169,13 +173,52 @@ export class Owner extends Base {
|
|
|
169
173
|
}
|
|
170
174
|
|
|
171
175
|
for (const name of asArray(destinationNetworks)) {
|
|
172
|
-
|
|
176
|
+
const other = this.network(name);
|
|
177
|
+
if (other) {
|
|
178
|
+
bridge.add(other);
|
|
179
|
+
other.bridge = bridge;
|
|
180
|
+
} else {
|
|
181
|
+
bridge.add(name);
|
|
182
|
+
this.resolveLater(() => this._resolveBridges());
|
|
183
|
+
}
|
|
173
184
|
}
|
|
174
185
|
|
|
175
186
|
return bridge;
|
|
176
187
|
}
|
|
177
188
|
}
|
|
178
189
|
|
|
190
|
+
_resolveBridges() {
|
|
191
|
+
for (const bridge of this.#bridges) {
|
|
192
|
+
console.log(bridgeToJSON(bridge));
|
|
193
|
+
for (const network of bridge) {
|
|
194
|
+
if (typeof network === "string") {
|
|
195
|
+
const other = this.network(network);
|
|
196
|
+
|
|
197
|
+
if (other) {
|
|
198
|
+
bridge.delete(network);
|
|
199
|
+
bridge.add(other);
|
|
200
|
+
other.bridge = bridge;
|
|
201
|
+
console.log("RESOLVE", network, other, bridgeToJSON(bridge));
|
|
202
|
+
} else {
|
|
203
|
+
this.error(`Unresolvabale bridge network`, network);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
#resolveActions = [];
|
|
211
|
+
|
|
212
|
+
resolveLater(action) {
|
|
213
|
+
this.#resolveActions.push(action);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
resolve() {
|
|
217
|
+
for (const action of this.#resolveActions) {
|
|
218
|
+
action();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
179
222
|
addSubnet(subnet) {
|
|
180
223
|
this.#subnets.set(subnet.name, subnet);
|
|
181
224
|
}
|
package/types/model.d.mts
CHANGED
|
@@ -19,6 +19,7 @@ export class Base {
|
|
|
19
19
|
get directory(): any;
|
|
20
20
|
expand(object: any): any;
|
|
21
21
|
error(...args: any[]): void;
|
|
22
|
+
info(...args: any[]): void;
|
|
22
23
|
toString(): string;
|
|
23
24
|
get propertyNames(): string[];
|
|
24
25
|
toJSON(): {};
|
|
@@ -31,6 +32,9 @@ export class Owner extends Base {
|
|
|
31
32
|
networks(): AsyncGenerator<any, void, unknown>;
|
|
32
33
|
addNetwork(network: any): void;
|
|
33
34
|
addBridge(network: any, destinationNetworks: any): any;
|
|
35
|
+
_resolveBridges(): void;
|
|
36
|
+
resolveLater(action: any): void;
|
|
37
|
+
resolve(): void;
|
|
34
38
|
addSubnet(subnet: any): void;
|
|
35
39
|
subnet(name: any): any;
|
|
36
40
|
subnets(): MapIterator<any>;
|