mindcache 3.5.2 → 3.6.0

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.d.mts CHANGED
@@ -1,8 +1,42 @@
1
- import { e as MindCacheOptions, M as MindCache } from './CloudAdapter-DK4YecbV.mjs';
2
- export { A as AccessLevel, a as CloudAdapter, c as CloudAdapterEvents, C as CloudConfig, b as ConnectionState, h as ContextRules, n as DEFAULT_KEY_ATTRIBUTES, G as GlobalListener, H as HistoryEntry, k as HistoryOptions, K as KeyAttributes, j as KeyEntry, f as KeyType, L as Listener, l as MindCacheCloudOptions, m as MindCacheIndexedDBOptions, i as STM, j as STMEntry, g as SystemTag, o as SystemTagHelpers } from './CloudAdapter-DK4YecbV.mjs';
1
+ import { e as CustomTypeDefinition, f as MindCacheOptions, M as MindCache } from './CloudAdapter-PLGvGjoA.mjs';
2
+ export { A as AccessLevel, a as CloudAdapter, c as CloudAdapterEvents, C as CloudConfig, b as ConnectionState, i as ContextRules, o as CustomTypeField, p as DEFAULT_KEY_ATTRIBUTES, G as GlobalListener, H as HistoryEntry, l as HistoryOptions, K as KeyAttributes, k as KeyEntry, g as KeyType, L as Listener, m as MindCacheCloudOptions, n as MindCacheIndexedDBOptions, j as STM, k as STMEntry, h as SystemTag, q as SystemTagHelpers } from './CloudAdapter-PLGvGjoA.mjs';
3
3
  export { IndexedDBAdapter, IndexedDBConfig } from './server.mjs';
4
4
  import 'yjs';
5
5
 
6
+ /**
7
+ * Parses markdown-based schema definitions into structured CustomTypeDefinition objects.
8
+ *
9
+ * Schema format:
10
+ * ```
11
+ * #TypeName
12
+ * * fieldName: description of the field
13
+ * * anotherField: description
14
+ * ```
15
+ */
16
+ declare class SchemaParser {
17
+ /**
18
+ * Parse a markdown schema string into a CustomTypeDefinition
19
+ * @param schema - Markdown schema string
20
+ * @returns Parsed type definition
21
+ * @throws Error if schema format is invalid
22
+ */
23
+ static parse(schema: string): CustomTypeDefinition;
24
+ /**
25
+ * Generate a markdown representation of a type definition
26
+ * Useful for including in LLM prompts
27
+ */
28
+ static toMarkdown(typeDef: CustomTypeDefinition): string;
29
+ /**
30
+ * Generate a prompt-friendly description of the type
31
+ * More verbose than toMarkdown, better for LLM guidance
32
+ */
33
+ static toPromptDescription(typeDef: CustomTypeDefinition): string;
34
+ /**
35
+ * Generate an example value structure based on the type definition
36
+ */
37
+ static generateExample(typeDef: CustomTypeDefinition): string;
38
+ }
39
+
6
40
  /**
7
41
  * MindCache OAuth Client
8
42
  *
@@ -12,16 +46,17 @@ import 'yjs';
12
46
  interface OAuthConfig {
13
47
  /** Client ID from developer portal */
14
48
  clientId: string;
49
+ /**
50
+ * MindCache API base URL - REQUIRED!
51
+ * All OAuth endpoints are derived from this.
52
+ * - Production: 'https://api.mindcache.dev'
53
+ * - Local dev: 'http://localhost:8787'
54
+ */
55
+ baseUrl: string;
15
56
  /** Redirect URI (defaults to current URL) */
16
57
  redirectUri?: string;
17
58
  /** Scopes to request (default: ['read', 'write']) */
18
59
  scopes?: string[];
19
- /** MindCache authorize URL (default: production) */
20
- authUrl?: string;
21
- /** MindCache token URL (default: production) */
22
- tokenUrl?: string;
23
- /** MindCache API URL for WebSocket token exchange (default: production) */
24
- apiUrl?: string;
25
60
  /** Use PKCE for security (default: true) */
26
61
  usePKCE?: boolean;
27
62
  /** Storage key prefix (default: 'mindcache_oauth') */
@@ -62,6 +97,16 @@ declare class OAuthClient {
62
97
  private tokens;
63
98
  private refreshPromise;
64
99
  constructor(config: OAuthConfig);
100
+ /** Derived auth URL */
101
+ private get authUrl();
102
+ /** Derived token URL */
103
+ private get tokenUrl();
104
+ /** Derived userinfo URL */
105
+ private get userinfoUrl();
106
+ /**
107
+ * Validate the API is reachable
108
+ */
109
+ private validateApi;
65
110
  /**
66
111
  * Check if user is authenticated
67
112
  */
@@ -112,13 +157,12 @@ declare class OAuthClient {
112
157
  private clearAuth;
113
158
  /**
114
159
  * Token provider for MindCache cloud config
115
- * This fetches a WebSocket token (short-lived) using the OAuth access token
160
+ * This fetches a WebSocket token using the OAuth access token
116
161
  * Use this with MindCacheCloudOptions.tokenProvider
117
162
  */
118
163
  tokenProvider: () => Promise<string>;
119
164
  /**
120
165
  * Get raw OAuth access token (for API calls, not WebSocket)
121
- * Use getAccessToken() for most cases
122
166
  */
123
167
  accessTokenProvider: () => Promise<string>;
124
168
  private getStorage;
@@ -164,4 +208,4 @@ declare function useMindCache(options?: MindCacheOptions): UseMindCacheResult;
164
208
 
165
209
  declare const mindcache: MindCache;
166
210
 
167
- export { MindCache, MindCacheOptions, type MindCacheUser, OAuthClient, type OAuthConfig, type OAuthTokens, type UseMindCacheResult, createOAuthClient, mindcache, useMindCache };
211
+ export { CustomTypeDefinition, MindCache, MindCacheOptions, type MindCacheUser, OAuthClient, type OAuthConfig, type OAuthTokens, SchemaParser, type UseMindCacheResult, createOAuthClient, mindcache, useMindCache };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,42 @@
1
- import { e as MindCacheOptions, M as MindCache } from './CloudAdapter-DK4YecbV.js';
2
- export { A as AccessLevel, a as CloudAdapter, c as CloudAdapterEvents, C as CloudConfig, b as ConnectionState, h as ContextRules, n as DEFAULT_KEY_ATTRIBUTES, G as GlobalListener, H as HistoryEntry, k as HistoryOptions, K as KeyAttributes, j as KeyEntry, f as KeyType, L as Listener, l as MindCacheCloudOptions, m as MindCacheIndexedDBOptions, i as STM, j as STMEntry, g as SystemTag, o as SystemTagHelpers } from './CloudAdapter-DK4YecbV.js';
1
+ import { e as CustomTypeDefinition, f as MindCacheOptions, M as MindCache } from './CloudAdapter-PLGvGjoA.js';
2
+ export { A as AccessLevel, a as CloudAdapter, c as CloudAdapterEvents, C as CloudConfig, b as ConnectionState, i as ContextRules, o as CustomTypeField, p as DEFAULT_KEY_ATTRIBUTES, G as GlobalListener, H as HistoryEntry, l as HistoryOptions, K as KeyAttributes, k as KeyEntry, g as KeyType, L as Listener, m as MindCacheCloudOptions, n as MindCacheIndexedDBOptions, j as STM, k as STMEntry, h as SystemTag, q as SystemTagHelpers } from './CloudAdapter-PLGvGjoA.js';
3
3
  export { IndexedDBAdapter, IndexedDBConfig } from './server.js';
4
4
  import 'yjs';
5
5
 
6
+ /**
7
+ * Parses markdown-based schema definitions into structured CustomTypeDefinition objects.
8
+ *
9
+ * Schema format:
10
+ * ```
11
+ * #TypeName
12
+ * * fieldName: description of the field
13
+ * * anotherField: description
14
+ * ```
15
+ */
16
+ declare class SchemaParser {
17
+ /**
18
+ * Parse a markdown schema string into a CustomTypeDefinition
19
+ * @param schema - Markdown schema string
20
+ * @returns Parsed type definition
21
+ * @throws Error if schema format is invalid
22
+ */
23
+ static parse(schema: string): CustomTypeDefinition;
24
+ /**
25
+ * Generate a markdown representation of a type definition
26
+ * Useful for including in LLM prompts
27
+ */
28
+ static toMarkdown(typeDef: CustomTypeDefinition): string;
29
+ /**
30
+ * Generate a prompt-friendly description of the type
31
+ * More verbose than toMarkdown, better for LLM guidance
32
+ */
33
+ static toPromptDescription(typeDef: CustomTypeDefinition): string;
34
+ /**
35
+ * Generate an example value structure based on the type definition
36
+ */
37
+ static generateExample(typeDef: CustomTypeDefinition): string;
38
+ }
39
+
6
40
  /**
7
41
  * MindCache OAuth Client
8
42
  *
@@ -12,16 +46,17 @@ import 'yjs';
12
46
  interface OAuthConfig {
13
47
  /** Client ID from developer portal */
14
48
  clientId: string;
49
+ /**
50
+ * MindCache API base URL - REQUIRED!
51
+ * All OAuth endpoints are derived from this.
52
+ * - Production: 'https://api.mindcache.dev'
53
+ * - Local dev: 'http://localhost:8787'
54
+ */
55
+ baseUrl: string;
15
56
  /** Redirect URI (defaults to current URL) */
16
57
  redirectUri?: string;
17
58
  /** Scopes to request (default: ['read', 'write']) */
18
59
  scopes?: string[];
19
- /** MindCache authorize URL (default: production) */
20
- authUrl?: string;
21
- /** MindCache token URL (default: production) */
22
- tokenUrl?: string;
23
- /** MindCache API URL for WebSocket token exchange (default: production) */
24
- apiUrl?: string;
25
60
  /** Use PKCE for security (default: true) */
26
61
  usePKCE?: boolean;
27
62
  /** Storage key prefix (default: 'mindcache_oauth') */
@@ -62,6 +97,16 @@ declare class OAuthClient {
62
97
  private tokens;
63
98
  private refreshPromise;
64
99
  constructor(config: OAuthConfig);
100
+ /** Derived auth URL */
101
+ private get authUrl();
102
+ /** Derived token URL */
103
+ private get tokenUrl();
104
+ /** Derived userinfo URL */
105
+ private get userinfoUrl();
106
+ /**
107
+ * Validate the API is reachable
108
+ */
109
+ private validateApi;
65
110
  /**
66
111
  * Check if user is authenticated
67
112
  */
@@ -112,13 +157,12 @@ declare class OAuthClient {
112
157
  private clearAuth;
113
158
  /**
114
159
  * Token provider for MindCache cloud config
115
- * This fetches a WebSocket token (short-lived) using the OAuth access token
160
+ * This fetches a WebSocket token using the OAuth access token
116
161
  * Use this with MindCacheCloudOptions.tokenProvider
117
162
  */
118
163
  tokenProvider: () => Promise<string>;
119
164
  /**
120
165
  * Get raw OAuth access token (for API calls, not WebSocket)
121
- * Use getAccessToken() for most cases
122
166
  */
123
167
  accessTokenProvider: () => Promise<string>;
124
168
  private getStorage;
@@ -164,4 +208,4 @@ declare function useMindCache(options?: MindCacheOptions): UseMindCacheResult;
164
208
 
165
209
  declare const mindcache: MindCache;
166
210
 
167
- export { MindCache, MindCacheOptions, type MindCacheUser, OAuthClient, type OAuthConfig, type OAuthTokens, type UseMindCacheResult, createOAuthClient, mindcache, useMindCache };
211
+ export { CustomTypeDefinition, MindCache, MindCacheOptions, type MindCacheUser, OAuthClient, type OAuthConfig, type OAuthTokens, SchemaParser, type UseMindCacheResult, createOAuthClient, mindcache, useMindCache };