mindcache 3.4.4 → 3.5.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.
@@ -111,8 +111,8 @@ declare const SystemTagHelpers: {
111
111
  * Cloud configuration options for MindCache constructor
112
112
  */
113
113
  interface MindCacheCloudOptions {
114
- /** Instance ID to connect to */
115
- instanceId: string;
114
+ /** Instance ID to connect to (not needed for OAuth - auto-provisioned) */
115
+ instanceId?: string;
116
116
  /** Project ID (optional, defaults to 'default') */
117
117
  projectId?: string;
118
118
  /** API endpoint to fetch WS token (recommended for browser) */
@@ -123,6 +123,20 @@ interface MindCacheCloudOptions {
123
123
  apiKey?: string;
124
124
  /** WebSocket base URL (defaults to production) */
125
125
  baseUrl?: string;
126
+ /**
127
+ * OAuth configuration for browser apps using "Sign in with MindCache"
128
+ * When set, user authentication and instance provisioning is automatic
129
+ */
130
+ oauth?: {
131
+ /** Client ID from MindCache developer portal */
132
+ clientId: string;
133
+ /** Redirect URI for OAuth callback (defaults to current URL) */
134
+ redirectUri?: string;
135
+ /** Scopes to request (default: ['read', 'write']) */
136
+ scopes?: string[];
137
+ /** Auto-redirect to login if not authenticated (default: false) */
138
+ autoLogin?: boolean;
139
+ };
126
140
  }
127
141
  interface MindCacheIndexedDBOptions {
128
142
  /** Database name (defaults to 'mindcache_db') */
@@ -111,8 +111,8 @@ declare const SystemTagHelpers: {
111
111
  * Cloud configuration options for MindCache constructor
112
112
  */
113
113
  interface MindCacheCloudOptions {
114
- /** Instance ID to connect to */
115
- instanceId: string;
114
+ /** Instance ID to connect to (not needed for OAuth - auto-provisioned) */
115
+ instanceId?: string;
116
116
  /** Project ID (optional, defaults to 'default') */
117
117
  projectId?: string;
118
118
  /** API endpoint to fetch WS token (recommended for browser) */
@@ -123,6 +123,20 @@ interface MindCacheCloudOptions {
123
123
  apiKey?: string;
124
124
  /** WebSocket base URL (defaults to production) */
125
125
  baseUrl?: string;
126
+ /**
127
+ * OAuth configuration for browser apps using "Sign in with MindCache"
128
+ * When set, user authentication and instance provisioning is automatic
129
+ */
130
+ oauth?: {
131
+ /** Client ID from MindCache developer portal */
132
+ clientId: string;
133
+ /** Redirect URI for OAuth callback (defaults to current URL) */
134
+ redirectUri?: string;
135
+ /** Scopes to request (default: ['read', 'write']) */
136
+ scopes?: string[];
137
+ /** Auto-redirect to login if not authenticated (default: false) */
138
+ autoLogin?: boolean;
139
+ };
126
140
  }
127
141
  interface MindCacheIndexedDBOptions {
128
142
  /** Database name (defaults to 'mindcache_db') */
@@ -1,5 +1,5 @@
1
- import { M as MindCache, C as CloudConfig, a as CloudAdapter } from '../CloudAdapter-DOvDQswy.mjs';
2
- export { d as ClearOperation, c as CloudAdapterEvents, b as ConnectionState, D as DeleteOperation, O as Operation, S as SetOperation } from '../CloudAdapter-DOvDQswy.mjs';
1
+ import { M as MindCache, C as CloudConfig, a as CloudAdapter } from '../CloudAdapter-CM7nyJaG.mjs';
2
+ export { d as ClearOperation, c as CloudAdapterEvents, b as ConnectionState, D as DeleteOperation, O as Operation, S as SetOperation } from '../CloudAdapter-CM7nyJaG.mjs';
3
3
  import 'yjs';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { M as MindCache, C as CloudConfig, a as CloudAdapter } from '../CloudAdapter-DOvDQswy.js';
2
- export { d as ClearOperation, c as CloudAdapterEvents, b as ConnectionState, D as DeleteOperation, O as Operation, S as SetOperation } from '../CloudAdapter-DOvDQswy.js';
1
+ import { M as MindCache, C as CloudConfig, a as CloudAdapter } from '../CloudAdapter-CM7nyJaG.js';
2
+ export { d as ClearOperation, c as CloudAdapterEvents, b as ConnectionState, D as DeleteOperation, O as Operation, S as SetOperation } from '../CloudAdapter-CM7nyJaG.js';
3
3
  import 'yjs';
4
4
 
5
5
  /**
@@ -394,10 +394,12 @@ var init_CloudAdapter = __esm({
394
394
  try {
395
395
  if (typeof event.data === "string") {
396
396
  const msg = JSON.parse(event.data);
397
+ console.log("\u2601\uFE0F CloudAdapter: Received JSON message:", msg.type, msg);
397
398
  if (msg.type === "auth_success") {
398
399
  this._state = "connected";
399
400
  this.reconnectAttempts = 0;
400
401
  this.emit("connected");
402
+ console.log("\u2601\uFE0F Connected to MindCache cloud");
401
403
  } else if (msg.type === "auth_error" || msg.type === "error") {
402
404
  this._state = "error";
403
405
  this.emit("error", new Error(msg.error));
@@ -405,6 +407,7 @@ var init_CloudAdapter = __esm({
405
407
  console.debug("MindCache Cloud: Received message type:", msg.type, msg);
406
408
  }
407
409
  } else {
410
+ console.log("\u2601\uFE0F CloudAdapter: Received binary message, length:", event.data.byteLength);
408
411
  const encoder = encoding__namespace.createEncoder();
409
412
  const decoder = decoding__namespace.createDecoder(new Uint8Array(event.data));
410
413
  if (this.mindcache) {
@@ -415,6 +418,7 @@ var init_CloudAdapter = __esm({
415
418
  if (!this._synced && (messageType === 1 || messageType === 2)) {
416
419
  this._synced = true;
417
420
  this.emit("synced");
421
+ console.log("\u2601\uFE0F Synced with cloud");
418
422
  }
419
423
  }
420
424
  }