mindcache 3.5.1 → 3.5.2

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.
@@ -183,6 +183,7 @@ var init_CloudAdapter = __esm({
183
183
  if (!config.baseUrl) {
184
184
  throw new Error("MindCache Cloud: baseUrl is required. Please provide the cloud API URL in your configuration.");
185
185
  }
186
+ this.validateConfig(config);
186
187
  this.setupNetworkDetection();
187
188
  }
188
189
  ws = null;
@@ -198,6 +199,43 @@ var init_CloudAdapter = __esm({
198
199
  handleOnline = null;
199
200
  handleOffline = null;
200
201
  _synced = false;
202
+ /**
203
+ * Validate configuration and warn about common mistakes
204
+ */
205
+ validateConfig(config) {
206
+ const baseUrl = config.baseUrl;
207
+ if (!baseUrl) {
208
+ return;
209
+ }
210
+ console.log("\u2601\uFE0F MindCache Cloud Config:", {
211
+ baseUrl,
212
+ instanceId: config.instanceId,
213
+ hasTokenProvider: !!config.tokenProvider,
214
+ hasApiKey: !!config.apiKey
215
+ });
216
+ try {
217
+ const url = new URL(baseUrl);
218
+ if (url.hostname === "mindcache.dev") {
219
+ console.error(
220
+ '\u26A0\uFE0F MindCache Cloud WARNING: baseUrl is set to "mindcache.dev" but the API is at "api.mindcache.dev".\n Current: ' + baseUrl + "\n Expected: https://api.mindcache.dev\n This will cause WebSocket connection failures (404 errors)."
221
+ );
222
+ }
223
+ if (url.protocol === "ws:" || url.protocol === "wss:") {
224
+ console.warn(
225
+ "\u26A0\uFE0F MindCache Cloud: baseUrl uses WebSocket protocol (" + url.protocol + "). Consider using http:// or https:// - CloudAdapter will handle the WebSocket upgrade automatically."
226
+ );
227
+ }
228
+ if (url.hostname === "localhost" && url.port !== "8787" && url.port !== "3000") {
229
+ console.warn(
230
+ "\u26A0\uFE0F MindCache Cloud: localhost URL detected with non-standard port " + url.port + ". Default MindCache dev server runs on port 8787."
231
+ );
232
+ }
233
+ const wsUrl = baseUrl.replace("https://", "wss://").replace("http://", "ws://");
234
+ console.log("\u2601\uFE0F WebSocket will connect to:", wsUrl + "/sync/" + config.instanceId);
235
+ } catch (e) {
236
+ console.error("\u26A0\uFE0F MindCache Cloud: Invalid baseUrl format:", baseUrl);
237
+ }
238
+ }
201
239
  /** Browser network status - instantly updated via navigator.onLine */
202
240
  get isOnline() {
203
241
  return this._isOnline;