mindcache 3.5.3 → 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,23 +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
- /**
20
- * MindCache API base URL (default: 'https://api.mindcache.dev')
21
- * This is the ONLY URL you need to set! All OAuth endpoints are derived from this.
22
- * - authUrl = baseUrl + '/oauth/authorize'
23
- * - tokenUrl = baseUrl + '/oauth/token'
24
- */
25
- baseUrl?: string;
26
- /** @deprecated Use baseUrl instead. MindCache authorize URL */
27
- authUrl?: string;
28
- /** @deprecated Use baseUrl instead. MindCache token URL */
29
- tokenUrl?: string;
30
- /** @deprecated Use baseUrl instead. MindCache API URL */
31
- apiUrl?: string;
32
60
  /** Use PKCE for security (default: true) */
33
61
  usePKCE?: boolean;
34
62
  /** Storage key prefix (default: 'mindcache_oauth') */
@@ -69,8 +97,14 @@ declare class OAuthClient {
69
97
  private tokens;
70
98
  private refreshPromise;
71
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();
72
106
  /**
73
- * Validate the API is reachable and warn about common misconfigurations
107
+ * Validate the API is reachable
74
108
  */
75
109
  private validateApi;
76
110
  /**
@@ -123,13 +157,12 @@ declare class OAuthClient {
123
157
  private clearAuth;
124
158
  /**
125
159
  * Token provider for MindCache cloud config
126
- * This fetches a WebSocket token (short-lived) using the OAuth access token
160
+ * This fetches a WebSocket token using the OAuth access token
127
161
  * Use this with MindCacheCloudOptions.tokenProvider
128
162
  */
129
163
  tokenProvider: () => Promise<string>;
130
164
  /**
131
165
  * Get raw OAuth access token (for API calls, not WebSocket)
132
- * Use getAccessToken() for most cases
133
166
  */
134
167
  accessTokenProvider: () => Promise<string>;
135
168
  private getStorage;
@@ -175,4 +208,4 @@ declare function useMindCache(options?: MindCacheOptions): UseMindCacheResult;
175
208
 
176
209
  declare const mindcache: MindCache;
177
210
 
178
- 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,23 +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
- /**
20
- * MindCache API base URL (default: 'https://api.mindcache.dev')
21
- * This is the ONLY URL you need to set! All OAuth endpoints are derived from this.
22
- * - authUrl = baseUrl + '/oauth/authorize'
23
- * - tokenUrl = baseUrl + '/oauth/token'
24
- */
25
- baseUrl?: string;
26
- /** @deprecated Use baseUrl instead. MindCache authorize URL */
27
- authUrl?: string;
28
- /** @deprecated Use baseUrl instead. MindCache token URL */
29
- tokenUrl?: string;
30
- /** @deprecated Use baseUrl instead. MindCache API URL */
31
- apiUrl?: string;
32
60
  /** Use PKCE for security (default: true) */
33
61
  usePKCE?: boolean;
34
62
  /** Storage key prefix (default: 'mindcache_oauth') */
@@ -69,8 +97,14 @@ declare class OAuthClient {
69
97
  private tokens;
70
98
  private refreshPromise;
71
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();
72
106
  /**
73
- * Validate the API is reachable and warn about common misconfigurations
107
+ * Validate the API is reachable
74
108
  */
75
109
  private validateApi;
76
110
  /**
@@ -123,13 +157,12 @@ declare class OAuthClient {
123
157
  private clearAuth;
124
158
  /**
125
159
  * Token provider for MindCache cloud config
126
- * This fetches a WebSocket token (short-lived) using the OAuth access token
160
+ * This fetches a WebSocket token using the OAuth access token
127
161
  * Use this with MindCacheCloudOptions.tokenProvider
128
162
  */
129
163
  tokenProvider: () => Promise<string>;
130
164
  /**
131
165
  * Get raw OAuth access token (for API calls, not WebSocket)
132
- * Use getAccessToken() for most cases
133
166
  */
134
167
  accessTokenProvider: () => Promise<string>;
135
168
  private getStorage;
@@ -175,4 +208,4 @@ declare function useMindCache(options?: MindCacheOptions): UseMindCacheResult;
175
208
 
176
209
  declare const mindcache: MindCache;
177
210
 
178
- 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 };