mindcache 3.5.0 → 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.
- package/dist/{CloudAdapter-CM7nyJaG.d.mts → CloudAdapter-DK4YecbV.d.mts} +4 -0
- package/dist/{CloudAdapter-CM7nyJaG.d.ts → CloudAdapter-DK4YecbV.d.ts} +4 -0
- package/dist/cloud/index.d.mts +2 -2
- package/dist/cloud/index.d.ts +2 -2
- package/dist/cloud/index.js +42 -0
- package/dist/cloud/index.js.map +1 -1
- package/dist/cloud/index.mjs +42 -0
- package/dist/cloud/index.mjs.map +1 -1
- package/dist/index.d.mts +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.js +75 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -3
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +42 -0
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +42 -0
- package/dist/server.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -592,6 +592,10 @@ declare class CloudAdapter {
|
|
|
592
592
|
private handleOffline;
|
|
593
593
|
private _synced;
|
|
594
594
|
constructor(config: CloudConfig);
|
|
595
|
+
/**
|
|
596
|
+
* Validate configuration and warn about common mistakes
|
|
597
|
+
*/
|
|
598
|
+
private validateConfig;
|
|
595
599
|
/** Browser network status - instantly updated via navigator.onLine */
|
|
596
600
|
get isOnline(): boolean;
|
|
597
601
|
private setupNetworkDetection;
|
|
@@ -592,6 +592,10 @@ declare class CloudAdapter {
|
|
|
592
592
|
private handleOffline;
|
|
593
593
|
private _synced;
|
|
594
594
|
constructor(config: CloudConfig);
|
|
595
|
+
/**
|
|
596
|
+
* Validate configuration and warn about common mistakes
|
|
597
|
+
*/
|
|
598
|
+
private validateConfig;
|
|
595
599
|
/** Browser network status - instantly updated via navigator.onLine */
|
|
596
600
|
get isOnline(): boolean;
|
|
597
601
|
private setupNetworkDetection;
|
package/dist/cloud/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MindCache, C as CloudConfig, a as CloudAdapter } from '../CloudAdapter-
|
|
2
|
-
export { d as ClearOperation, c as CloudAdapterEvents, b as ConnectionState, D as DeleteOperation, O as Operation, S as SetOperation } from '../CloudAdapter-
|
|
1
|
+
import { M as MindCache, C as CloudConfig, a as CloudAdapter } from '../CloudAdapter-DK4YecbV.mjs';
|
|
2
|
+
export { d as ClearOperation, c as CloudAdapterEvents, b as ConnectionState, D as DeleteOperation, O as Operation, S as SetOperation } from '../CloudAdapter-DK4YecbV.mjs';
|
|
3
3
|
import 'yjs';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/cloud/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MindCache, C as CloudConfig, a as CloudAdapter } from '../CloudAdapter-
|
|
2
|
-
export { d as ClearOperation, c as CloudAdapterEvents, b as ConnectionState, D as DeleteOperation, O as Operation, S as SetOperation } from '../CloudAdapter-
|
|
1
|
+
import { M as MindCache, C as CloudConfig, a as CloudAdapter } from '../CloudAdapter-DK4YecbV.js';
|
|
2
|
+
export { d as ClearOperation, c as CloudAdapterEvents, b as ConnectionState, D as DeleteOperation, O as Operation, S as SetOperation } from '../CloudAdapter-DK4YecbV.js';
|
|
3
3
|
import 'yjs';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/cloud/index.js
CHANGED
|
@@ -211,6 +211,7 @@ var init_CloudAdapter = __esm({
|
|
|
211
211
|
if (!config.baseUrl) {
|
|
212
212
|
throw new Error("MindCache Cloud: baseUrl is required. Please provide the cloud API URL in your configuration.");
|
|
213
213
|
}
|
|
214
|
+
this.validateConfig(config);
|
|
214
215
|
this.setupNetworkDetection();
|
|
215
216
|
}
|
|
216
217
|
ws = null;
|
|
@@ -226,6 +227,43 @@ var init_CloudAdapter = __esm({
|
|
|
226
227
|
handleOnline = null;
|
|
227
228
|
handleOffline = null;
|
|
228
229
|
_synced = false;
|
|
230
|
+
/**
|
|
231
|
+
* Validate configuration and warn about common mistakes
|
|
232
|
+
*/
|
|
233
|
+
validateConfig(config) {
|
|
234
|
+
const baseUrl = config.baseUrl;
|
|
235
|
+
if (!baseUrl) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
console.log("\u2601\uFE0F MindCache Cloud Config:", {
|
|
239
|
+
baseUrl,
|
|
240
|
+
instanceId: config.instanceId,
|
|
241
|
+
hasTokenProvider: !!config.tokenProvider,
|
|
242
|
+
hasApiKey: !!config.apiKey
|
|
243
|
+
});
|
|
244
|
+
try {
|
|
245
|
+
const url = new URL(baseUrl);
|
|
246
|
+
if (url.hostname === "mindcache.dev") {
|
|
247
|
+
console.error(
|
|
248
|
+
'\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)."
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
if (url.protocol === "ws:" || url.protocol === "wss:") {
|
|
252
|
+
console.warn(
|
|
253
|
+
"\u26A0\uFE0F MindCache Cloud: baseUrl uses WebSocket protocol (" + url.protocol + "). Consider using http:// or https:// - CloudAdapter will handle the WebSocket upgrade automatically."
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
if (url.hostname === "localhost" && url.port !== "8787" && url.port !== "3000") {
|
|
257
|
+
console.warn(
|
|
258
|
+
"\u26A0\uFE0F MindCache Cloud: localhost URL detected with non-standard port " + url.port + ". Default MindCache dev server runs on port 8787."
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
const wsUrl = baseUrl.replace("https://", "wss://").replace("http://", "ws://");
|
|
262
|
+
console.log("\u2601\uFE0F WebSocket will connect to:", wsUrl + "/sync/" + config.instanceId);
|
|
263
|
+
} catch (e) {
|
|
264
|
+
console.error("\u26A0\uFE0F MindCache Cloud: Invalid baseUrl format:", baseUrl);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
229
267
|
/** Browser network status - instantly updated via navigator.onLine */
|
|
230
268
|
get isOnline() {
|
|
231
269
|
return this._isOnline;
|
|
@@ -394,10 +432,12 @@ var init_CloudAdapter = __esm({
|
|
|
394
432
|
try {
|
|
395
433
|
if (typeof event.data === "string") {
|
|
396
434
|
const msg = JSON.parse(event.data);
|
|
435
|
+
console.log("\u2601\uFE0F CloudAdapter: Received JSON message:", msg.type, msg);
|
|
397
436
|
if (msg.type === "auth_success") {
|
|
398
437
|
this._state = "connected";
|
|
399
438
|
this.reconnectAttempts = 0;
|
|
400
439
|
this.emit("connected");
|
|
440
|
+
console.log("\u2601\uFE0F Connected to MindCache cloud");
|
|
401
441
|
} else if (msg.type === "auth_error" || msg.type === "error") {
|
|
402
442
|
this._state = "error";
|
|
403
443
|
this.emit("error", new Error(msg.error));
|
|
@@ -405,6 +445,7 @@ var init_CloudAdapter = __esm({
|
|
|
405
445
|
console.debug("MindCache Cloud: Received message type:", msg.type, msg);
|
|
406
446
|
}
|
|
407
447
|
} else {
|
|
448
|
+
console.log("\u2601\uFE0F CloudAdapter: Received binary message, length:", event.data.byteLength);
|
|
408
449
|
const encoder = encoding__namespace.createEncoder();
|
|
409
450
|
const decoder = decoding__namespace.createDecoder(new Uint8Array(event.data));
|
|
410
451
|
if (this.mindcache) {
|
|
@@ -415,6 +456,7 @@ var init_CloudAdapter = __esm({
|
|
|
415
456
|
if (!this._synced && (messageType === 1 || messageType === 2)) {
|
|
416
457
|
this._synced = true;
|
|
417
458
|
this.emit("synced");
|
|
459
|
+
console.log("\u2601\uFE0F Synced with cloud");
|
|
418
460
|
}
|
|
419
461
|
}
|
|
420
462
|
}
|