@xyo-network/xl1-protocol-sdk 3.0.5 → 3.0.6
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/neutral/Archivists/MemoryArchivistFactory.d.ts +5 -2
- package/dist/neutral/Archivists/MemoryArchivistFactory.d.ts.map +1 -1
- package/dist/neutral/Archivists/archivistFactoryRegistry.d.ts +9 -0
- package/dist/neutral/Archivists/archivistFactoryRegistry.d.ts.map +1 -0
- package/dist/neutral/Archivists/connectArchivist.d.ts +4 -4
- package/dist/neutral/Archivists/connectArchivist.d.ts.map +1 -1
- package/dist/neutral/Archivists/index.d.ts +1 -0
- package/dist/neutral/Archivists/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +40 -26
- package/dist/neutral/index.mjs.map +4 -4
- package/dist/neutral/test/index.mjs +26 -19
- package/dist/neutral/test/index.mjs.map +4 -4
- package/package.json +6 -6
|
@@ -845,7 +845,7 @@ var buildProviderFactory = (provider, defaultParams, labels) => {
|
|
|
845
845
|
};
|
|
846
846
|
return factory;
|
|
847
847
|
};
|
|
848
|
-
var registerCreatableProviderFactory = (
|
|
848
|
+
var registerCreatableProviderFactory = (registry2, factory, labels, primary = false) => {
|
|
849
849
|
const primaryMonikers = primary !== true && isTruthy(primary) ? Array.isArray(primary) ? primary : [primary] : [];
|
|
850
850
|
for (const primaryMoniker of primaryMonikers) {
|
|
851
851
|
if (!factory.monikers.includes(primaryMoniker)) {
|
|
@@ -869,10 +869,10 @@ var registerCreatableProviderFactory = (registry, factory, labels, primary = fal
|
|
|
869
869
|
throw new Error(`Invalid primary value: ${String(primary)}`);
|
|
870
870
|
};
|
|
871
871
|
const factoryClone = buildProviderFactory(factory, factory.defaultParams, labels);
|
|
872
|
-
|
|
872
|
+
registry2[factoryClone.defaultMoniker] = [factoryClone, ...registry2[factoryClone.defaultMoniker] ?? []];
|
|
873
873
|
for (const moniker of factoryClone.monikers) {
|
|
874
874
|
if (moniker === factoryClone.defaultMoniker) continue;
|
|
875
|
-
|
|
875
|
+
registry2[moniker] = isPrimaryForMoniker(moniker) ? [factoryClone, ...registry2[moniker] ?? []] : [...registry2[moniker] ?? [], factoryClone];
|
|
876
876
|
}
|
|
877
877
|
};
|
|
878
878
|
|
|
@@ -890,8 +890,8 @@ var ProviderFactoryLocator = class _ProviderFactoryLocator {
|
|
|
890
890
|
_frozen = false;
|
|
891
891
|
_parent;
|
|
892
892
|
_validateDepsOnRegister;
|
|
893
|
-
constructor(context,
|
|
894
|
-
this._registry =
|
|
893
|
+
constructor(context, registry2 = {}, validateDepsOnRegister = false) {
|
|
894
|
+
this._registry = registry2;
|
|
895
895
|
this._context = { ...context, locator: this };
|
|
896
896
|
this._parent = context.locator;
|
|
897
897
|
this._validateDepsOnRegister = validateDepsOnRegister;
|
|
@@ -936,16 +936,16 @@ var ProviderFactoryLocator = class _ProviderFactoryLocator {
|
|
|
936
936
|
);
|
|
937
937
|
}
|
|
938
938
|
merge(locator) {
|
|
939
|
-
const
|
|
939
|
+
const registry2 = { ...this.registry };
|
|
940
940
|
for (const moniker in locator.registry) {
|
|
941
|
-
const existing =
|
|
941
|
+
const existing = registry2[moniker];
|
|
942
942
|
if (existing === void 0) {
|
|
943
|
-
|
|
943
|
+
registry2[moniker] = locator.registry[moniker];
|
|
944
944
|
} else {
|
|
945
945
|
existing.push(...locator.registry[moniker] ?? []);
|
|
946
946
|
}
|
|
947
947
|
}
|
|
948
|
-
return new _ProviderFactoryLocator(this.context,
|
|
948
|
+
return new _ProviderFactoryLocator(this.context, registry2);
|
|
949
949
|
}
|
|
950
950
|
/**
|
|
951
951
|
* Registers a single module factory (with optional tags) with the locator
|
|
@@ -1813,9 +1813,6 @@ var ArchivistInstanceCache = class {
|
|
|
1813
1813
|
}
|
|
1814
1814
|
};
|
|
1815
1815
|
|
|
1816
|
-
// src/Archivists/archivistRoles.ts
|
|
1817
|
-
var CHAIN_ARCHIVIST_ROLE = "chain";
|
|
1818
|
-
|
|
1819
1816
|
// src/Archivists/MemoryArchivistFactory.ts
|
|
1820
1817
|
import { MemoryArchivist as MemoryArchivist2 } from "@xyo-network/sdk-js";
|
|
1821
1818
|
var MemoryArchivistFactory = class _MemoryArchivistFactory {
|
|
@@ -1836,16 +1833,26 @@ var MemoryArchivistFactory = class _MemoryArchivistFactory {
|
|
|
1836
1833
|
}
|
|
1837
1834
|
};
|
|
1838
1835
|
|
|
1836
|
+
// src/Archivists/archivistFactoryRegistry.ts
|
|
1837
|
+
var registry = /* @__PURE__ */ new Map();
|
|
1838
|
+
function registerArchivistFactory(type, factory) {
|
|
1839
|
+
registry.set(type, factory);
|
|
1840
|
+
}
|
|
1841
|
+
function getArchivistFactory(type) {
|
|
1842
|
+
return registry.get(type);
|
|
1843
|
+
}
|
|
1844
|
+
registerArchivistFactory("memory", MemoryArchivistFactory);
|
|
1845
|
+
|
|
1846
|
+
// src/Archivists/archivistRoles.ts
|
|
1847
|
+
var CHAIN_ARCHIVIST_ROLE = "chain";
|
|
1848
|
+
|
|
1839
1849
|
// src/Archivists/connectArchivist.ts
|
|
1840
1850
|
async function connectArchivist(binding, options) {
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
}
|
|
1845
|
-
default: {
|
|
1846
|
-
throw new Error(`connectArchivist: connection type '${binding.config.type}' is not self-provisioned \u2014 inject the archivist instead`);
|
|
1847
|
-
}
|
|
1851
|
+
const factory = getArchivistFactory(binding.config.type);
|
|
1852
|
+
if (factory === void 0) {
|
|
1853
|
+
throw new Error(`connectArchivist: no archivist factory registered for connection type '${binding.config.type}'`);
|
|
1848
1854
|
}
|
|
1855
|
+
return await factory.connect(binding.name, binding.config, options);
|
|
1849
1856
|
}
|
|
1850
1857
|
|
|
1851
1858
|
// src/utils/HydratedCache.ts
|