@danielsimonjr/memory-mcp 12.2.3 → 12.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.
Files changed (158) hide show
  1. package/README.md +88 -102
  2. package/dist/index.js +6 -0
  3. package/dist/server/toolDefinitions.d.ts.map +1 -1
  4. package/dist/server/toolDefinitions.js +745 -3
  5. package/dist/server/toolHandlers.d.ts +1 -9
  6. package/dist/server/toolHandlers.d.ts.map +1 -1
  7. package/dist/server/toolHandlers.js +859 -11
  8. package/package.json +9 -6
  9. package/dist/core/EntityManager.d.ts +0 -263
  10. package/dist/core/EntityManager.d.ts.map +0 -1
  11. package/dist/core/EntityManager.js +0 -478
  12. package/dist/core/GraphStorage.d.ts +0 -344
  13. package/dist/core/GraphStorage.d.ts.map +0 -1
  14. package/dist/core/GraphStorage.js +0 -708
  15. package/dist/core/GraphTraversal.d.ts +0 -136
  16. package/dist/core/GraphTraversal.d.ts.map +0 -1
  17. package/dist/core/GraphTraversal.js +0 -556
  18. package/dist/core/HierarchyManager.d.ts +0 -111
  19. package/dist/core/HierarchyManager.d.ts.map +0 -1
  20. package/dist/core/HierarchyManager.js +0 -224
  21. package/dist/core/ManagerContext.d.ts +0 -72
  22. package/dist/core/ManagerContext.d.ts.map +0 -1
  23. package/dist/core/ManagerContext.js +0 -118
  24. package/dist/core/ObservationManager.d.ts +0 -85
  25. package/dist/core/ObservationManager.d.ts.map +0 -1
  26. package/dist/core/ObservationManager.js +0 -123
  27. package/dist/core/RelationManager.d.ts +0 -131
  28. package/dist/core/RelationManager.d.ts.map +0 -1
  29. package/dist/core/RelationManager.js +0 -210
  30. package/dist/core/SQLiteStorage.d.ts +0 -354
  31. package/dist/core/SQLiteStorage.d.ts.map +0 -1
  32. package/dist/core/SQLiteStorage.js +0 -917
  33. package/dist/core/StorageFactory.d.ts +0 -45
  34. package/dist/core/StorageFactory.d.ts.map +0 -1
  35. package/dist/core/StorageFactory.js +0 -64
  36. package/dist/core/TransactionManager.d.ts +0 -259
  37. package/dist/core/TransactionManager.d.ts.map +0 -1
  38. package/dist/core/TransactionManager.js +0 -392
  39. package/dist/core/index.d.ts +0 -16
  40. package/dist/core/index.d.ts.map +0 -1
  41. package/dist/core/index.js +0 -17
  42. package/dist/features/AnalyticsManager.d.ts +0 -44
  43. package/dist/features/AnalyticsManager.d.ts.map +0 -1
  44. package/dist/features/AnalyticsManager.js +0 -223
  45. package/dist/features/ArchiveManager.d.ts +0 -121
  46. package/dist/features/ArchiveManager.d.ts.map +0 -1
  47. package/dist/features/ArchiveManager.js +0 -240
  48. package/dist/features/CompressionManager.d.ts +0 -109
  49. package/dist/features/CompressionManager.d.ts.map +0 -1
  50. package/dist/features/CompressionManager.js +0 -404
  51. package/dist/features/IOManager.d.ts +0 -221
  52. package/dist/features/IOManager.d.ts.map +0 -1
  53. package/dist/features/IOManager.js +0 -997
  54. package/dist/features/StreamingExporter.d.ts +0 -105
  55. package/dist/features/StreamingExporter.d.ts.map +0 -1
  56. package/dist/features/StreamingExporter.js +0 -150
  57. package/dist/features/TagManager.d.ts +0 -147
  58. package/dist/features/TagManager.d.ts.map +0 -1
  59. package/dist/features/TagManager.js +0 -210
  60. package/dist/features/index.d.ts +0 -12
  61. package/dist/features/index.d.ts.map +0 -1
  62. package/dist/features/index.js +0 -11
  63. package/dist/search/BasicSearch.d.ts +0 -51
  64. package/dist/search/BasicSearch.d.ts.map +0 -1
  65. package/dist/search/BasicSearch.js +0 -137
  66. package/dist/search/BooleanSearch.d.ts +0 -98
  67. package/dist/search/BooleanSearch.d.ts.map +0 -1
  68. package/dist/search/BooleanSearch.js +0 -430
  69. package/dist/search/EmbeddingService.d.ts +0 -178
  70. package/dist/search/EmbeddingService.d.ts.map +0 -1
  71. package/dist/search/EmbeddingService.js +0 -358
  72. package/dist/search/FuzzySearch.d.ts +0 -118
  73. package/dist/search/FuzzySearch.d.ts.map +0 -1
  74. package/dist/search/FuzzySearch.js +0 -312
  75. package/dist/search/RankedSearch.d.ts +0 -71
  76. package/dist/search/RankedSearch.d.ts.map +0 -1
  77. package/dist/search/RankedSearch.js +0 -238
  78. package/dist/search/SavedSearchManager.d.ts +0 -79
  79. package/dist/search/SavedSearchManager.d.ts.map +0 -1
  80. package/dist/search/SavedSearchManager.js +0 -145
  81. package/dist/search/SearchFilterChain.d.ts +0 -120
  82. package/dist/search/SearchFilterChain.d.ts.map +0 -1
  83. package/dist/search/SearchFilterChain.js +0 -185
  84. package/dist/search/SearchManager.d.ts +0 -285
  85. package/dist/search/SearchManager.d.ts.map +0 -1
  86. package/dist/search/SearchManager.js +0 -338
  87. package/dist/search/SearchSuggestions.d.ts +0 -27
  88. package/dist/search/SearchSuggestions.d.ts.map +0 -1
  89. package/dist/search/SearchSuggestions.js +0 -57
  90. package/dist/search/SemanticSearch.d.ts +0 -146
  91. package/dist/search/SemanticSearch.d.ts.map +0 -1
  92. package/dist/search/SemanticSearch.js +0 -313
  93. package/dist/search/TFIDFIndexManager.d.ts +0 -63
  94. package/dist/search/TFIDFIndexManager.d.ts.map +0 -1
  95. package/dist/search/TFIDFIndexManager.js +0 -215
  96. package/dist/search/VectorStore.d.ts +0 -235
  97. package/dist/search/VectorStore.d.ts.map +0 -1
  98. package/dist/search/VectorStore.js +0 -311
  99. package/dist/search/index.d.ts +0 -18
  100. package/dist/search/index.d.ts.map +0 -1
  101. package/dist/search/index.js +0 -21
  102. package/dist/types/index.d.ts +0 -13
  103. package/dist/types/index.d.ts.map +0 -1
  104. package/dist/types/index.js +0 -12
  105. package/dist/types/types.d.ts +0 -1234
  106. package/dist/types/types.d.ts.map +0 -1
  107. package/dist/types/types.js +0 -9
  108. package/dist/utils/compressedCache.d.ts +0 -192
  109. package/dist/utils/compressedCache.d.ts.map +0 -1
  110. package/dist/utils/compressedCache.js +0 -309
  111. package/dist/utils/compressionUtil.d.ts +0 -214
  112. package/dist/utils/compressionUtil.d.ts.map +0 -1
  113. package/dist/utils/compressionUtil.js +0 -247
  114. package/dist/utils/constants.d.ts +0 -245
  115. package/dist/utils/constants.d.ts.map +0 -1
  116. package/dist/utils/constants.js +0 -252
  117. package/dist/utils/entityUtils.d.ts +0 -321
  118. package/dist/utils/entityUtils.d.ts.map +0 -1
  119. package/dist/utils/entityUtils.js +0 -538
  120. package/dist/utils/errors.d.ts +0 -77
  121. package/dist/utils/errors.d.ts.map +0 -1
  122. package/dist/utils/errors.js +0 -121
  123. package/dist/utils/formatters.d.ts +0 -145
  124. package/dist/utils/formatters.d.ts.map +0 -1
  125. package/dist/utils/formatters.js +0 -132
  126. package/dist/utils/index.d.ts +0 -22
  127. package/dist/utils/index.d.ts.map +0 -1
  128. package/dist/utils/index.js +0 -75
  129. package/dist/utils/indexes.d.ts +0 -270
  130. package/dist/utils/indexes.d.ts.map +0 -1
  131. package/dist/utils/indexes.js +0 -526
  132. package/dist/utils/logger.d.ts +0 -24
  133. package/dist/utils/logger.d.ts.map +0 -1
  134. package/dist/utils/logger.js +0 -33
  135. package/dist/utils/parallelUtils.d.ts +0 -72
  136. package/dist/utils/parallelUtils.d.ts.map +0 -1
  137. package/dist/utils/parallelUtils.js +0 -169
  138. package/dist/utils/schemas.d.ts +0 -374
  139. package/dist/utils/schemas.d.ts.map +0 -1
  140. package/dist/utils/schemas.js +0 -484
  141. package/dist/utils/searchAlgorithms.d.ts +0 -99
  142. package/dist/utils/searchAlgorithms.d.ts.map +0 -1
  143. package/dist/utils/searchAlgorithms.js +0 -167
  144. package/dist/utils/searchCache.d.ts +0 -108
  145. package/dist/utils/searchCache.d.ts.map +0 -1
  146. package/dist/utils/searchCache.js +0 -209
  147. package/dist/utils/taskScheduler.d.ts +0 -290
  148. package/dist/utils/taskScheduler.d.ts.map +0 -1
  149. package/dist/utils/taskScheduler.js +0 -466
  150. package/dist/workers/WorkerPool.d.ts +0 -81
  151. package/dist/workers/WorkerPool.d.ts.map +0 -1
  152. package/dist/workers/WorkerPool.js +0 -121
  153. package/dist/workers/index.d.ts +0 -12
  154. package/dist/workers/index.d.ts.map +0 -1
  155. package/dist/workers/index.js +0 -9
  156. package/dist/workers/levenshteinWorker.d.ts +0 -60
  157. package/dist/workers/levenshteinWorker.d.ts.map +0 -1
  158. package/dist/workers/levenshteinWorker.js +0 -98
@@ -1,169 +0,0 @@
1
- /**
2
- * Parallel Utilities
3
- *
4
- * Utilities for parallel array operations using workerpool.
5
- * Phase 8 Sprint 3: Parallel array operations for improved performance.
6
- *
7
- * @module utils/parallelUtils
8
- */
9
- import workerpool from '@danielsimonjr/workerpool/modern';
10
- /**
11
- * Default chunk size for parallel operations.
12
- * Can be overridden per operation.
13
- */
14
- const DEFAULT_CHUNK_SIZE = 100;
15
- /**
16
- * Minimum array size to activate parallel processing.
17
- * For smaller arrays, single-threaded is more efficient due to worker overhead.
18
- */
19
- const MIN_PARALLEL_SIZE = 200;
20
- /**
21
- * Shared worker pool instance for all parallel utilities.
22
- * Initialized lazily on first use.
23
- */
24
- let sharedPool = null;
25
- /**
26
- * Get or create the shared worker pool.
27
- * Uses inline worker execution (no separate worker file needed).
28
- *
29
- * @returns Worker pool instance
30
- */
31
- function getPool() {
32
- if (!sharedPool) {
33
- sharedPool = workerpool.pool({
34
- maxWorkers: Math.max(1, workerpool.cpus - 1),
35
- workerType: 'thread',
36
- });
37
- }
38
- return sharedPool;
39
- }
40
- /**
41
- * Shutdown the shared worker pool and clean up resources.
42
- * Should be called when parallel utilities are no longer needed.
43
- */
44
- export async function shutdownParallelUtils() {
45
- if (sharedPool) {
46
- await sharedPool.terminate();
47
- sharedPool = null;
48
- }
49
- }
50
- /**
51
- * Map items in parallel using workerpool.
52
- *
53
- * Splits the array into chunks and processes each chunk in a worker thread.
54
- * Falls back to single-threaded for small arrays (< MIN_PARALLEL_SIZE).
55
- *
56
- * **Note:** The mapping function must be serializable (no closures, external variables).
57
- * Due to ESM/worker thread compatibility issues, this may fall back to single-threaded
58
- * execution in some environments (e.g., vitest test runner).
59
- *
60
- * @template T - Input item type
61
- * @template R - Output item type
62
- * @param items - Array of items to map
63
- * @param fn - Mapping function (must be serializable)
64
- * @param chunkSize - Optional chunk size (default: DEFAULT_CHUNK_SIZE)
65
- * @returns Promise resolving to array of mapped results
66
- *
67
- * @example
68
- * ```typescript
69
- * // Map numbers to their squares
70
- * const numbers = [1, 2, 3, 4, 5];
71
- * const squared = await parallelMap(numbers, (n: number) => n * n);
72
- * // Result: [1, 4, 9, 16, 25]
73
- * ```
74
- */
75
- export async function parallelMap(items, fn, chunkSize = DEFAULT_CHUNK_SIZE) {
76
- // Fall back to single-threaded for small arrays
77
- if (items.length < MIN_PARALLEL_SIZE) {
78
- return items.map(fn);
79
- }
80
- try {
81
- const pool = getPool();
82
- // Split items into chunks
83
- const chunks = [];
84
- for (let i = 0; i < items.length; i += chunkSize) {
85
- chunks.push(items.slice(i, i + chunkSize));
86
- }
87
- // Convert function to string for serialization
88
- const fnString = fn.toString();
89
- // Process chunks in parallel using inline function execution
90
- const results = await Promise.all(chunks.map(chunk => pool.exec((chunkData, fnStr) => {
91
- // Reconstruct function from string
92
- // eslint-disable-next-line no-new-func
93
- const mapFn = new Function('return ' + fnStr)();
94
- return chunkData.map(mapFn);
95
- }, [chunk, fnString])));
96
- // Flatten results
97
- return results.flat();
98
- }
99
- catch (error) {
100
- // Fall back to single-threaded if worker execution fails
101
- // (e.g., in test environments with ESM/worker compatibility issues)
102
- return items.map(fn);
103
- }
104
- }
105
- /**
106
- * Filter items in parallel using workerpool.
107
- *
108
- * Splits the array into chunks and processes each chunk in a worker thread.
109
- * Falls back to single-threaded for small arrays (< MIN_PARALLEL_SIZE).
110
- *
111
- * **Note:** The predicate function must be serializable (no closures, external variables).
112
- * Due to ESM/worker thread compatibility issues, this may fall back to single-threaded
113
- * execution in some environments (e.g., vitest test runner).
114
- *
115
- * @template T - Item type
116
- * @param items - Array of items to filter
117
- * @param predicate - Filter predicate (must be serializable)
118
- * @param chunkSize - Optional chunk size (default: DEFAULT_CHUNK_SIZE)
119
- * @returns Promise resolving to filtered array
120
- *
121
- * @example
122
- * ```typescript
123
- * // Filter even numbers
124
- * const numbers = [1, 2, 3, 4, 5, 6];
125
- * const evens = await parallelFilter(numbers, (n: number) => n % 2 === 0);
126
- * // Result: [2, 4, 6]
127
- * ```
128
- */
129
- export async function parallelFilter(items, predicate, chunkSize = DEFAULT_CHUNK_SIZE) {
130
- // Fall back to single-threaded for small arrays
131
- if (items.length < MIN_PARALLEL_SIZE) {
132
- return items.filter(predicate);
133
- }
134
- try {
135
- const pool = getPool();
136
- // Split items into chunks
137
- const chunks = [];
138
- for (let i = 0; i < items.length; i += chunkSize) {
139
- chunks.push(items.slice(i, i + chunkSize));
140
- }
141
- // Convert function to string for serialization
142
- const predicateString = predicate.toString();
143
- // Process chunks in parallel using inline function execution
144
- const results = await Promise.all(chunks.map(chunk => pool.exec((chunkData, predicateStr) => {
145
- // Reconstruct function from string
146
- // eslint-disable-next-line no-new-func
147
- const filterFn = new Function('return ' + predicateStr)();
148
- return chunkData.filter(filterFn);
149
- }, [chunk, predicateString])));
150
- // Flatten results
151
- return results.flat();
152
- }
153
- catch (error) {
154
- // Fall back to single-threaded if worker execution fails
155
- // (e.g., in test environments with ESM/worker compatibility issues)
156
- return items.filter(predicate);
157
- }
158
- }
159
- /**
160
- * Get statistics about the worker pool.
161
- *
162
- * @returns Pool statistics or null if pool is not initialized
163
- */
164
- export function getPoolStats() {
165
- if (!sharedPool) {
166
- return null;
167
- }
168
- return sharedPool.stats();
169
- }
@@ -1,374 +0,0 @@
1
- /**
2
- * Validation Schemas and Helpers
3
- *
4
- * Consolidated module for Zod schemas and validation utilities.
5
- * Provides runtime type safety and data validation.
6
- *
7
- * @module utils/schemas
8
- */
9
- import { z, type ZodSchema, type ZodError } from 'zod';
10
- /**
11
- * Complete Entity schema with all fields.
12
- * Used for validating full entity objects including timestamps.
13
- */
14
- export declare const EntitySchema: z.ZodObject<{
15
- name: z.ZodString;
16
- entityType: z.ZodString;
17
- observations: z.ZodArray<z.ZodString>;
18
- createdAt: z.ZodOptional<z.ZodString>;
19
- lastModified: z.ZodOptional<z.ZodString>;
20
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
- importance: z.ZodOptional<z.ZodNumber>;
22
- parentId: z.ZodOptional<z.ZodString>;
23
- }, z.core.$strict>;
24
- /**
25
- * Entity creation input schema.
26
- * Used for validating user input when creating new entities.
27
- * Timestamps are optional and will be auto-generated if not provided.
28
- */
29
- export declare const CreateEntitySchema: z.ZodObject<{
30
- name: z.ZodString;
31
- entityType: z.ZodString;
32
- observations: z.ZodArray<z.ZodString>;
33
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
34
- importance: z.ZodOptional<z.ZodNumber>;
35
- parentId: z.ZodOptional<z.ZodString>;
36
- createdAt: z.ZodOptional<z.ZodString>;
37
- lastModified: z.ZodOptional<z.ZodString>;
38
- }, z.core.$strip>;
39
- /**
40
- * Entity update input schema.
41
- * All fields are optional for partial updates.
42
- * Name cannot be updated (it's the unique identifier).
43
- */
44
- export declare const UpdateEntitySchema: z.ZodObject<{
45
- entityType: z.ZodOptional<z.ZodString>;
46
- observations: z.ZodOptional<z.ZodArray<z.ZodString>>;
47
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
- importance: z.ZodOptional<z.ZodNumber>;
49
- parentId: z.ZodOptional<z.ZodString>;
50
- }, z.core.$strip>;
51
- /**
52
- * Complete Relation schema with all fields.
53
- * Used for validating full relation objects including timestamps.
54
- */
55
- export declare const RelationSchema: z.ZodObject<{
56
- from: z.ZodString;
57
- to: z.ZodString;
58
- relationType: z.ZodString;
59
- createdAt: z.ZodOptional<z.ZodString>;
60
- lastModified: z.ZodOptional<z.ZodString>;
61
- }, z.core.$strict>;
62
- /**
63
- * Relation creation input schema.
64
- * Used for validating user input when creating new relations.
65
- * Timestamps are optional and will be auto-generated if not provided.
66
- */
67
- export declare const CreateRelationSchema: z.ZodObject<{
68
- from: z.ZodString;
69
- to: z.ZodString;
70
- relationType: z.ZodString;
71
- createdAt: z.ZodOptional<z.ZodString>;
72
- lastModified: z.ZodOptional<z.ZodString>;
73
- }, z.core.$strip>;
74
- /**
75
- * Search query validation.
76
- * Validates text search queries with reasonable length constraints.
77
- */
78
- export declare const SearchQuerySchema: z.ZodString;
79
- /**
80
- * Date range validation for search filters.
81
- */
82
- export declare const DateRangeSchema: z.ZodObject<{
83
- start: z.ZodString;
84
- end: z.ZodString;
85
- }, z.core.$strip>;
86
- /**
87
- * Tag alias validation for TagManager.
88
- */
89
- export declare const TagAliasSchema: z.ZodObject<{
90
- canonical: z.ZodString;
91
- aliases: z.ZodArray<z.ZodString>;
92
- }, z.core.$strip>;
93
- /**
94
- * Export format validation.
95
- */
96
- export declare const ExportFormatSchema: z.ZodEnum<{
97
- json: "json";
98
- graphml: "graphml";
99
- csv: "csv";
100
- }>;
101
- /**
102
- * Batch entity creation validation.
103
- * Validates array of entities with maximum constraints.
104
- * Empty arrays are allowed (no-op).
105
- */
106
- export declare const BatchCreateEntitiesSchema: z.ZodArray<z.ZodObject<{
107
- name: z.ZodString;
108
- entityType: z.ZodString;
109
- observations: z.ZodArray<z.ZodString>;
110
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
111
- importance: z.ZodOptional<z.ZodNumber>;
112
- parentId: z.ZodOptional<z.ZodString>;
113
- createdAt: z.ZodOptional<z.ZodString>;
114
- lastModified: z.ZodOptional<z.ZodString>;
115
- }, z.core.$strip>>;
116
- /**
117
- * Batch relation creation validation.
118
- * Validates array of relations with maximum constraints.
119
- * Empty arrays are allowed (no-op).
120
- */
121
- export declare const BatchCreateRelationsSchema: z.ZodArray<z.ZodObject<{
122
- from: z.ZodString;
123
- to: z.ZodString;
124
- relationType: z.ZodString;
125
- createdAt: z.ZodOptional<z.ZodString>;
126
- lastModified: z.ZodOptional<z.ZodString>;
127
- }, z.core.$strip>>;
128
- /**
129
- * Entity name array validation for batch deletion.
130
- */
131
- export declare const EntityNamesSchema: z.ZodArray<z.ZodString>;
132
- /**
133
- * Relation array validation for batch deletion.
134
- */
135
- export declare const DeleteRelationsSchema: z.ZodArray<z.ZodObject<{
136
- from: z.ZodString;
137
- to: z.ZodString;
138
- relationType: z.ZodString;
139
- createdAt: z.ZodOptional<z.ZodString>;
140
- lastModified: z.ZodOptional<z.ZodString>;
141
- }, z.core.$strip>>;
142
- /**
143
- * Single observation input for add operations.
144
- * Empty contents array is allowed (no-op).
145
- */
146
- export declare const AddObservationInputSchema: z.ZodObject<{
147
- entityName: z.ZodString;
148
- contents: z.ZodArray<z.ZodString>;
149
- }, z.core.$strip>;
150
- /**
151
- * Batch observation addition validation.
152
- * Empty array is allowed (no-op).
153
- */
154
- export declare const AddObservationsInputSchema: z.ZodArray<z.ZodObject<{
155
- entityName: z.ZodString;
156
- contents: z.ZodArray<z.ZodString>;
157
- }, z.core.$strip>>;
158
- /**
159
- * Single observation deletion input.
160
- * Empty observations array is allowed (no-op).
161
- * Non-existent entities are silently skipped by the manager.
162
- */
163
- export declare const DeleteObservationInputSchema: z.ZodObject<{
164
- entityName: z.ZodString;
165
- observations: z.ZodArray<z.ZodString>;
166
- }, z.core.$strip>;
167
- /**
168
- * Batch observation deletion validation.
169
- * Empty array is allowed (no-op).
170
- */
171
- export declare const DeleteObservationsInputSchema: z.ZodArray<z.ZodObject<{
172
- entityName: z.ZodString;
173
- observations: z.ZodArray<z.ZodString>;
174
- }, z.core.$strip>>;
175
- /**
176
- * Archive criteria validation.
177
- * All fields are optional - the manager handles the case when no criteria provided.
178
- */
179
- export declare const ArchiveCriteriaSchema: z.ZodObject<{
180
- olderThan: z.ZodOptional<z.ZodString>;
181
- importanceLessThan: z.ZodOptional<z.ZodNumber>;
182
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
183
- }, z.core.$strip>;
184
- /**
185
- * Saved search creation input validation.
186
- */
187
- export declare const SavedSearchInputSchema: z.ZodObject<{
188
- name: z.ZodString;
189
- description: z.ZodOptional<z.ZodString>;
190
- query: z.ZodString;
191
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
192
- minImportance: z.ZodOptional<z.ZodNumber>;
193
- maxImportance: z.ZodOptional<z.ZodNumber>;
194
- entityType: z.ZodOptional<z.ZodString>;
195
- }, z.core.$strip>;
196
- /**
197
- * Saved search update validation.
198
- * All fields are optional for partial updates.
199
- */
200
- export declare const SavedSearchUpdateSchema: z.ZodObject<{
201
- description: z.ZodOptional<z.ZodString>;
202
- query: z.ZodOptional<z.ZodString>;
203
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
204
- minImportance: z.ZodOptional<z.ZodNumber>;
205
- maxImportance: z.ZodOptional<z.ZodNumber>;
206
- entityType: z.ZodOptional<z.ZodString>;
207
- }, z.core.$strip>;
208
- /**
209
- * Import format validation.
210
- */
211
- export declare const ImportFormatSchema: z.ZodEnum<{
212
- json: "json";
213
- graphml: "graphml";
214
- csv: "csv";
215
- }>;
216
- /**
217
- * Export format validation (includes all output formats).
218
- */
219
- export declare const ExtendedExportFormatSchema: z.ZodEnum<{
220
- json: "json";
221
- graphml: "graphml";
222
- csv: "csv";
223
- gexf: "gexf";
224
- dot: "dot";
225
- markdown: "markdown";
226
- mermaid: "mermaid";
227
- }>;
228
- /**
229
- * Merge strategy validation for imports.
230
- */
231
- export declare const MergeStrategySchema: z.ZodEnum<{
232
- replace: "replace";
233
- skip: "skip";
234
- merge: "merge";
235
- fail: "fail";
236
- }>;
237
- /**
238
- * Export filter validation.
239
- */
240
- export declare const ExportFilterSchema: z.ZodObject<{
241
- startDate: z.ZodOptional<z.ZodString>;
242
- endDate: z.ZodOptional<z.ZodString>;
243
- entityType: z.ZodOptional<z.ZodString>;
244
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
245
- }, z.core.$strip>;
246
- /**
247
- * Tags array validation (optional, for search filters).
248
- */
249
- export declare const OptionalTagsSchema: z.ZodOptional<z.ZodArray<z.ZodString>>;
250
- /**
251
- * Optional entity names array validation.
252
- */
253
- export declare const OptionalEntityNamesSchema: z.ZodOptional<z.ZodArray<z.ZodString>>;
254
- export type EntityInput = z.infer<typeof EntitySchema>;
255
- export type CreateEntityInput = z.infer<typeof CreateEntitySchema>;
256
- export type UpdateEntityInput = z.infer<typeof UpdateEntitySchema>;
257
- export type RelationInput = z.infer<typeof RelationSchema>;
258
- export type CreateRelationInput = z.infer<typeof CreateRelationSchema>;
259
- export type SearchQuery = z.infer<typeof SearchQuerySchema>;
260
- export type DateRange = z.infer<typeof DateRangeSchema>;
261
- export type TagAlias = z.infer<typeof TagAliasSchema>;
262
- export type ExportFormat = z.infer<typeof ExportFormatSchema>;
263
- export type AddObservationInput = z.infer<typeof AddObservationInputSchema>;
264
- export type DeleteObservationInput = z.infer<typeof DeleteObservationInputSchema>;
265
- export type ArchiveCriteriaInput = z.infer<typeof ArchiveCriteriaSchema>;
266
- export type SavedSearchInput = z.infer<typeof SavedSearchInputSchema>;
267
- export type SavedSearchUpdateInput = z.infer<typeof SavedSearchUpdateSchema>;
268
- export type ImportFormat = z.infer<typeof ImportFormatSchema>;
269
- export type ExtendedExportFormat = z.infer<typeof ExtendedExportFormatSchema>;
270
- export type MergeStrategy = z.infer<typeof MergeStrategySchema>;
271
- export type ExportFilterInput = z.infer<typeof ExportFilterSchema>;
272
- /**
273
- * Validation result with status and error messages.
274
- */
275
- export interface ValidationResult {
276
- valid: boolean;
277
- errors: string[];
278
- }
279
- /**
280
- * Formats Zod errors into human-readable strings.
281
- *
282
- * @param error - Zod error object
283
- * @returns Array of formatted error messages
284
- */
285
- export declare function formatZodErrors(error: ZodError): string[];
286
- /**
287
- * Validates data against a Zod schema and returns the typed result.
288
- * Throws ValidationError with formatted error messages on failure.
289
- *
290
- * @param data - The data to validate
291
- * @param schema - The Zod schema to validate against
292
- * @param errorMessage - Custom error message prefix (default: 'Validation failed')
293
- * @returns The validated and typed data
294
- * @throws ValidationError if validation fails
295
- *
296
- * @example
297
- * ```typescript
298
- * const entities = validateWithSchema(
299
- * input,
300
- * BatchCreateEntitiesSchema,
301
- * 'Invalid entity data'
302
- * );
303
- * ```
304
- */
305
- export declare function validateWithSchema<T>(data: unknown, schema: ZodSchema<T>, errorMessage?: string): T;
306
- /**
307
- * Validates data and returns a result object instead of throwing.
308
- * Useful when you want to handle validation errors gracefully.
309
- *
310
- * @param data - The data to validate
311
- * @param schema - The Zod schema to validate against
312
- * @returns Result object with success status and either data or errors
313
- *
314
- * @example
315
- * ```typescript
316
- * const result = validateSafe(input, EntitySchema);
317
- * if (result.success) {
318
- * console.log(result.data);
319
- * } else {
320
- * console.error(result.errors);
321
- * }
322
- * ```
323
- */
324
- export declare function validateSafe<T>(data: unknown, schema: ZodSchema<T>): {
325
- success: true;
326
- data: T;
327
- } | {
328
- success: false;
329
- errors: string[];
330
- };
331
- /**
332
- * Validates an array of items against a schema.
333
- * Returns detailed information about which items failed validation.
334
- *
335
- * @param items - Array of items to validate
336
- * @param schema - Zod schema for individual items
337
- * @param errorMessage - Custom error message prefix
338
- * @returns Array of validated items
339
- * @throws ValidationError if any item fails validation
340
- */
341
- export declare function validateArrayWithSchema<T>(items: unknown[], schema: ZodSchema<T>, errorMessage?: string): T[];
342
- /**
343
- * Validate an entity object.
344
- *
345
- * Checks required fields and data types.
346
- *
347
- * @param entity - Entity to validate (unknown type for runtime validation)
348
- * @returns Validation result
349
- */
350
- export declare function validateEntity(entity: unknown): ValidationResult;
351
- /**
352
- * Validate a relation object.
353
- *
354
- * Checks required fields and data types.
355
- *
356
- * @param relation - Relation to validate (unknown type for runtime validation)
357
- * @returns Validation result
358
- */
359
- export declare function validateRelation(relation: unknown): ValidationResult;
360
- /**
361
- * Validate importance level (must be 0-10).
362
- *
363
- * @param importance - Importance value to validate
364
- * @returns True if valid
365
- */
366
- export declare function validateImportance(importance: number): boolean;
367
- /**
368
- * Validate an array of tags.
369
- *
370
- * @param tags - Tags array to validate (unknown type for runtime validation)
371
- * @returns Validation result
372
- */
373
- export declare function validateTags(tags: unknown): ValidationResult;
374
- //# sourceMappingURL=schemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.d.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