@axiom-lattice/core 2.1.29 → 2.1.30

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/index.mjs CHANGED
@@ -5756,6 +5756,122 @@ var InMemoryMetricsServerConfigStore = class {
5756
5756
  }
5757
5757
  };
5758
5758
 
5759
+ // src/store_lattice/InMemoryMcpServerConfigStore.ts
5760
+ var InMemoryMcpServerConfigStore = class {
5761
+ constructor() {
5762
+ this.configs = /* @__PURE__ */ new Map();
5763
+ }
5764
+ /**
5765
+ * Get composite key for storage
5766
+ */
5767
+ getKey(tenantId, id) {
5768
+ return `${tenantId}:${id}`;
5769
+ }
5770
+ /**
5771
+ * Get all MCP server configurations for a tenant
5772
+ */
5773
+ async getAllConfigs(tenantId) {
5774
+ return Array.from(this.configs.values()).filter(
5775
+ (config) => config.tenantId === tenantId
5776
+ );
5777
+ }
5778
+ /**
5779
+ * Get all MCP server configurations across all tenants
5780
+ */
5781
+ async getAllConfigsWithoutTenant() {
5782
+ return Array.from(this.configs.values());
5783
+ }
5784
+ /**
5785
+ * Get MCP server configuration by ID
5786
+ */
5787
+ async getConfigById(tenantId, id) {
5788
+ const key = this.getKey(tenantId, id);
5789
+ return this.configs.get(key) || null;
5790
+ }
5791
+ /**
5792
+ * Get MCP server configuration by business key
5793
+ */
5794
+ async getConfigByKey(tenantId, key) {
5795
+ const configs = await this.getAllConfigs(tenantId);
5796
+ return configs.find((config) => config.key === key) || null;
5797
+ }
5798
+ /**
5799
+ * Create a new MCP server configuration
5800
+ */
5801
+ async createConfig(tenantId, id, data) {
5802
+ const now = /* @__PURE__ */ new Date();
5803
+ const entry = {
5804
+ id,
5805
+ tenantId,
5806
+ key: data.key,
5807
+ config: data.config,
5808
+ selectedTools: data.selectedTools || [],
5809
+ isEnvEncrypted: false,
5810
+ status: "disconnected",
5811
+ name: data.name,
5812
+ description: data.description,
5813
+ createdAt: now,
5814
+ updatedAt: now
5815
+ };
5816
+ const storageKey = this.getKey(tenantId, id);
5817
+ this.configs.set(storageKey, entry);
5818
+ return entry;
5819
+ }
5820
+ /**
5821
+ * Update an existing MCP server configuration
5822
+ */
5823
+ async updateConfig(tenantId, id, updates) {
5824
+ const key = this.getKey(tenantId, id);
5825
+ const existing = this.configs.get(key);
5826
+ if (!existing) {
5827
+ return null;
5828
+ }
5829
+ const updated = {
5830
+ ...existing,
5831
+ ...updates,
5832
+ config: updates.config ? { ...existing.config, ...updates.config } : existing.config,
5833
+ key: updates.key || existing.key,
5834
+ name: updates.name !== void 0 ? updates.name : existing.name,
5835
+ description: updates.description !== void 0 ? updates.description : existing.description,
5836
+ selectedTools: updates.selectedTools !== void 0 ? updates.selectedTools : existing.selectedTools,
5837
+ status: updates.status !== void 0 ? updates.status : existing.status,
5838
+ updatedAt: /* @__PURE__ */ new Date()
5839
+ };
5840
+ this.configs.set(key, updated);
5841
+ return updated;
5842
+ }
5843
+ /**
5844
+ * Delete a MCP server configuration by ID
5845
+ */
5846
+ async deleteConfig(tenantId, id) {
5847
+ const key = this.getKey(tenantId, id);
5848
+ return this.configs.delete(key);
5849
+ }
5850
+ /**
5851
+ * Check if configuration exists
5852
+ */
5853
+ async hasConfig(tenantId, id) {
5854
+ const key = this.getKey(tenantId, id);
5855
+ return this.configs.has(key);
5856
+ }
5857
+ /**
5858
+ * Clear all configurations (useful for testing)
5859
+ */
5860
+ clear() {
5861
+ this.configs.clear();
5862
+ }
5863
+ /**
5864
+ * Clear configurations for a specific tenant
5865
+ */
5866
+ clearByTenant(tenantId) {
5867
+ for (const key of this.configs.keys()) {
5868
+ if (key.startsWith(`${tenantId}:`)) {
5869
+ this.configs.delete(key);
5870
+ }
5871
+ }
5872
+ }
5873
+ };
5874
+
5759
5875
  // src/store_lattice/InMemoryUserStore.ts
5760
5876
  var InMemoryUserStore = class {
5761
5877
  constructor() {
@@ -6061,6 +6177,7 @@ var defaultWorkspaceStore = new InMemoryWorkspaceStore();
6061
6177
  var defaultProjectStore = new InMemoryProjectStore();
6062
6178
  var defaultDatabaseConfigStore = new InMemoryDatabaseConfigStore();
6063
6179
  var defaultMetricsServerConfigStore = new InMemoryMetricsServerConfigStore();
6180
+ var defaultMcpServerConfigStore = new InMemoryMcpServerConfigStore();
6064
6181
  storeLatticeManager.registerLattice("default", "thread", defaultThreadStore);
6065
6182
  storeLatticeManager.registerLattice(
6066
6183
  "default",
@@ -6072,6 +6189,7 @@ storeLatticeManager.registerLattice("default", "workspace", defaultWorkspaceStor
6072
6189
  storeLatticeManager.registerLattice("default", "project", defaultProjectStore);
6073
6190
  storeLatticeManager.registerLattice("default", "database", defaultDatabaseConfigStore);
6074
6191
  storeLatticeManager.registerLattice("default", "metrics", defaultMetricsServerConfigStore);
6192
+ storeLatticeManager.registerLattice("default", "mcp", defaultMcpServerConfigStore);
6075
6193
  var defaultUserStore = new InMemoryUserStore();
6076
6194
  var defaultTenantStore = new InMemoryTenantStore();
6077
6195
  var defaultUserTenantLinkStore = new InMemoryUserTenantLinkStore();