@xyo-network/xl1-protocol-sdk 3.1.0 → 3.1.1
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.
|
@@ -43,7 +43,10 @@ export interface ResolveProvidersOptions {
|
|
|
43
43
|
* Plans which providers to register for a given set of needs.
|
|
44
44
|
*
|
|
45
45
|
* 1. Fixpoint-expand monikers from selected descriptor `dependencies`.
|
|
46
|
-
* 2. Require `providerBindings[moniker].connection` for every
|
|
46
|
+
* 2. Require `providerBindings[moniker].connection` for every connection-consuming
|
|
47
|
+
* moniker. A moniker satisfied by a single wildcard candidate consumes no
|
|
48
|
+
* connection of its own (it delegates storage to its dependencies) and binds
|
|
49
|
+
* directly, with no binding required.
|
|
47
50
|
* 3. Filter candidates by bound connection type.
|
|
48
51
|
* 4. Throw when zero or multiple candidates remain.
|
|
49
52
|
* 5. Toposort selected descriptors using `dependencies`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveProviders.d.ts","sourceRoot":"","sources":["../../../src/capabilities/resolveProviders.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,qCAAqC,CAAA;AAE3F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAEvD,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAA;IAC5D,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,CAAA;IAChD,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,CAAA;CACjD;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAA;IACvC,QAA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AU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAA;IACjE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAA;CAC5F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,CAAC,eAAe,CAAC,EACnC,UAAU,EAAE,SAAS,kBAAkB,EAAE,EACzC,OAAO,GAAE,uBAA4B,GACpC,cAAc,CAsBhB"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -1520,12 +1520,28 @@ function expandBindingClosure(wanted, bindings, selectedById, candidatesByMonike
|
|
|
1520
1520
|
}
|
|
1521
1521
|
}
|
|
1522
1522
|
function bindMoniker(moniker, wanted, bindings, selectedById, candidatesByMoniker, rejected, allCandidates, options) {
|
|
1523
|
+
const group = candidatesByMoniker.get(moniker) ?? [];
|
|
1524
|
+
const winner = bindsNoConnection(group) ? group[0] : selectByConnection(moniker, group, rejected, allCandidates, options);
|
|
1525
|
+
bindings[moniker] = winner.id;
|
|
1526
|
+
selectedById.set(winner.id, winner);
|
|
1527
|
+
let grew = false;
|
|
1528
|
+
for (const dep of winner.dependencies ?? []) {
|
|
1529
|
+
if (!wanted.has(dep)) {
|
|
1530
|
+
wanted.add(dep);
|
|
1531
|
+
grew = true;
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
return grew;
|
|
1535
|
+
}
|
|
1536
|
+
function bindsNoConnection(group) {
|
|
1537
|
+
return group.length === 1 && descriptorConnectionTypes(group[0]).length === 0;
|
|
1538
|
+
}
|
|
1539
|
+
function selectByConnection(moniker, group, rejected, allCandidates, options) {
|
|
1523
1540
|
const connectionName = connectionNameForMoniker(moniker, options);
|
|
1524
1541
|
const connection = options.connections?.[connectionName];
|
|
1525
1542
|
if (!isDefined4(connection)) {
|
|
1526
1543
|
throw new UnknownConnectionError(moniker, connectionName);
|
|
1527
1544
|
}
|
|
1528
|
-
const group = candidatesByMoniker.get(moniker) ?? [];
|
|
1529
1545
|
const { filtered, rejected: connectionRejected } = filterByConnection(
|
|
1530
1546
|
group,
|
|
1531
1547
|
connection.type,
|
|
@@ -1538,17 +1554,7 @@ function bindMoniker(moniker, wanted, bindings, selectedById, candidatesByMonike
|
|
|
1538
1554
|
if (filtered.length > 1) {
|
|
1539
1555
|
throw new AmbiguousProviderError(moniker, filtered);
|
|
1540
1556
|
}
|
|
1541
|
-
|
|
1542
|
-
bindings[moniker] = winner.id;
|
|
1543
|
-
selectedById.set(winner.id, winner);
|
|
1544
|
-
let grew = false;
|
|
1545
|
-
for (const dep of winner.dependencies ?? []) {
|
|
1546
|
-
if (!wanted.has(dep)) {
|
|
1547
|
-
wanted.add(dep);
|
|
1548
|
-
grew = true;
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1551
|
-
return grew;
|
|
1557
|
+
return filtered[0];
|
|
1552
1558
|
}
|
|
1553
1559
|
function connectionNameForMoniker(moniker, options) {
|
|
1554
1560
|
const binding = options.providerBindings?.[moniker];
|