@plures/pluresdb 1.6.10 → 2.9.6

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 (126) hide show
  1. package/README.md +97 -289
  2. package/crates/README.md +99 -0
  3. package/crates/pluresdb-node/README.md +181 -0
  4. package/crates/pluresdb-node/index.d.ts +0 -0
  5. package/crates/pluresdb-node/index.js +265 -0
  6. package/crates/pluresdb-node/package.json +35 -0
  7. package/dist/napi/index.js +60 -0
  8. package/embedded.d.ts +1 -0
  9. package/embedded.js +46 -0
  10. package/package.json +20 -9
  11. package/dist/.tsbuildinfo +0 -1
  12. package/dist/better-sqlite3-shared.d.ts +0 -12
  13. package/dist/better-sqlite3-shared.d.ts.map +0 -1
  14. package/dist/better-sqlite3-shared.js +0 -143
  15. package/dist/better-sqlite3-shared.js.map +0 -1
  16. package/dist/better-sqlite3.d.ts +0 -4
  17. package/dist/better-sqlite3.d.ts.map +0 -1
  18. package/dist/better-sqlite3.js +0 -8
  19. package/dist/better-sqlite3.js.map +0 -1
  20. package/dist/cli.d.ts +0 -7
  21. package/dist/cli.d.ts.map +0 -1
  22. package/dist/cli.js.map +0 -1
  23. package/dist/local-first/unified-api.d.ts +0 -110
  24. package/dist/local-first/unified-api.d.ts.map +0 -1
  25. package/dist/local-first/unified-api.js +0 -348
  26. package/dist/local-first/unified-api.js.map +0 -1
  27. package/dist/node-index.d.ts +0 -150
  28. package/dist/node-index.d.ts.map +0 -1
  29. package/dist/node-index.js +0 -668
  30. package/dist/node-index.js.map +0 -1
  31. package/dist/node-wrapper.d.ts +0 -44
  32. package/dist/node-wrapper.d.ts.map +0 -1
  33. package/dist/node-wrapper.js +0 -296
  34. package/dist/node-wrapper.js.map +0 -1
  35. package/dist/types/index.d.ts +0 -28
  36. package/dist/types/index.d.ts.map +0 -1
  37. package/dist/types/index.js +0 -3
  38. package/dist/types/index.js.map +0 -1
  39. package/dist/types/node-types.d.ts +0 -71
  40. package/dist/types/node-types.d.ts.map +0 -1
  41. package/dist/types/node-types.js +0 -6
  42. package/dist/types/node-types.js.map +0 -1
  43. package/dist/util/debug.d.ts +0 -3
  44. package/dist/util/debug.d.ts.map +0 -1
  45. package/dist/util/debug.js +0 -34
  46. package/dist/util/debug.js.map +0 -1
  47. package/dist/vscode/extension.d.ts +0 -81
  48. package/dist/vscode/extension.d.ts.map +0 -1
  49. package/dist/vscode/extension.js +0 -309
  50. package/dist/vscode/extension.js.map +0 -1
  51. package/examples/basic-usage.d.ts +0 -2
  52. package/examples/basic-usage.d.ts.map +0 -1
  53. package/examples/basic-usage.js +0 -26
  54. package/examples/basic-usage.js.map +0 -1
  55. package/examples/basic-usage.ts +0 -29
  56. package/examples/browser-demo/README.md +0 -204
  57. package/examples/browser-demo/index.html +0 -466
  58. package/examples/browser-wasm-integration.md +0 -411
  59. package/examples/ipc-demo/README.md +0 -127
  60. package/examples/local-first-usage.ts +0 -138
  61. package/examples/native-ipc-integration.md +0 -526
  62. package/examples/tauri-demo/README.md +0 -240
  63. package/examples/tauri-integration.md +0 -260
  64. package/examples/vscode-extension-example/README.md +0 -95
  65. package/examples/vscode-extension-example/package.json +0 -49
  66. package/examples/vscode-extension-example/src/extension.ts +0 -172
  67. package/examples/vscode-extension-example/tsconfig.json +0 -12
  68. package/examples/vscode-extension-integration.d.ts +0 -31
  69. package/examples/vscode-extension-integration.d.ts.map +0 -1
  70. package/examples/vscode-extension-integration.js +0 -319
  71. package/examples/vscode-extension-integration.js.map +0 -1
  72. package/examples/vscode-extension-integration.ts +0 -41
  73. package/legacy/benchmarks/memory-benchmarks.ts +0 -350
  74. package/legacy/benchmarks/run-benchmarks.ts +0 -315
  75. package/legacy/better-sqlite3-shared.ts +0 -157
  76. package/legacy/better-sqlite3.ts +0 -4
  77. package/legacy/cli.ts +0 -241
  78. package/legacy/config.ts +0 -50
  79. package/legacy/core/crdt.ts +0 -107
  80. package/legacy/core/database.ts +0 -529
  81. package/legacy/healthcheck.ts +0 -162
  82. package/legacy/http/api-server.ts +0 -569
  83. package/legacy/index.ts +0 -31
  84. package/legacy/local-first/unified-api.ts +0 -449
  85. package/legacy/logic/rules.ts +0 -46
  86. package/legacy/main.rs +0 -3
  87. package/legacy/main.ts +0 -197
  88. package/legacy/network/websocket-server.ts +0 -115
  89. package/legacy/node-index.ts +0 -827
  90. package/legacy/node-wrapper.ts +0 -329
  91. package/legacy/plugins/README.md +0 -181
  92. package/legacy/plugins/example-embedding-plugin.ts +0 -56
  93. package/legacy/plugins/plugin-system.ts +0 -315
  94. package/legacy/sqlite-compat.ts +0 -633
  95. package/legacy/sqlite3-compat.ts +0 -55
  96. package/legacy/storage/kv-storage.ts +0 -73
  97. package/legacy/tests/core.test.ts +0 -305
  98. package/legacy/tests/fixtures/performance-data.json +0 -71
  99. package/legacy/tests/fixtures/test-data.json +0 -129
  100. package/legacy/tests/integration/api-server.test.ts +0 -334
  101. package/legacy/tests/integration/mesh-network.test.ts +0 -303
  102. package/legacy/tests/logic.test.ts +0 -34
  103. package/legacy/tests/performance/load.test.ts +0 -290
  104. package/legacy/tests/security/input-validation.test.ts +0 -286
  105. package/legacy/tests/unit/core.test.ts +0 -226
  106. package/legacy/tests/unit/local-first-api.test.ts +0 -65
  107. package/legacy/tests/unit/plugin-system.test.ts +0 -388
  108. package/legacy/tests/unit/subscriptions.test.ts +0 -135
  109. package/legacy/tests/unit/vector-search.test.ts +0 -173
  110. package/legacy/tests/vscode_extension_test.ts +0 -281
  111. package/legacy/types/index.ts +0 -32
  112. package/legacy/types/node-types.ts +0 -80
  113. package/legacy/util/debug.ts +0 -27
  114. package/legacy/vector/index.ts +0 -59
  115. package/legacy/vscode/extension.ts +0 -387
  116. package/scripts/compiled-crud-verify.ts +0 -30
  117. package/scripts/dogfood.ts +0 -297
  118. package/scripts/postinstall.js +0 -156
  119. package/scripts/publish-crates.sh +0 -95
  120. package/scripts/release-check.js +0 -224
  121. package/scripts/run-tests.ts +0 -178
  122. package/scripts/setup-libclang.ps1 +0 -209
  123. package/scripts/update-changelog.js +0 -214
  124. package/scripts/validate-npm-publish.js +0 -228
  125. package/web/README.md +0 -27
  126. package/web/svelte/package.json +0 -31
@@ -1,315 +0,0 @@
1
- /**
2
- * PluresDB Plugin System
3
- *
4
- * Provides extension points for customizing PluresDB behavior:
5
- * - Custom embedding providers
6
- * - Custom UI panels
7
- * - Query transformers
8
- * - Data validators
9
- */
10
-
11
- export interface EmbeddingProvider {
12
- name: string;
13
- /**
14
- * Generate embeddings for text content
15
- * @param text - Text to embed
16
- * @returns Promise resolving to embedding vector
17
- */
18
- embed(text: string): Promise<number[]>;
19
- /**
20
- * Dimensionality of embeddings produced by this provider
21
- */
22
- dimensions: number;
23
- }
24
-
25
- export interface UIPanel {
26
- /**
27
- * Unique identifier for the panel
28
- */
29
- id: string;
30
- /**
31
- * Display name for the panel tab
32
- */
33
- name: string;
34
- /**
35
- * Icon name or emoji
36
- */
37
- icon?: string;
38
- /**
39
- * Svelte component to render
40
- * Note: In production, use a proper Svelte component type
41
- */
42
- component: unknown;
43
- /**
44
- * Position in tab list (lower numbers appear first)
45
- */
46
- order?: number;
47
- }
48
-
49
- export interface QueryTransformer<TQuery = Record<string, unknown>> {
50
- /**
51
- * Unique identifier for the transformer
52
- */
53
- id: string;
54
- /**
55
- * Transform a query before execution
56
- * @param query - Original query
57
- * @returns Transformed query
58
- */
59
- transform(query: TQuery): Promise<TQuery>;
60
- }
61
-
62
- export interface DataValidator {
63
- /**
64
- * Unique identifier for the validator
65
- */
66
- id: string;
67
- /**
68
- * Validate data before storage
69
- * @param data - Data to validate
70
- * @returns Validation result with errors if any
71
- */
72
- validate(data: Record<string, unknown>): Promise<{
73
- valid: boolean;
74
- errors?: string[];
75
- }>;
76
- }
77
-
78
- export interface Plugin {
79
- /**
80
- * Unique identifier for the plugin
81
- */
82
- id: string;
83
- /**
84
- * Plugin name
85
- */
86
- name: string;
87
- /**
88
- * Plugin version
89
- */
90
- version: string;
91
- /**
92
- * Plugin description
93
- */
94
- description?: string;
95
- /**
96
- * Embedding providers contributed by this plugin
97
- */
98
- embeddingProviders?: EmbeddingProvider[];
99
- /**
100
- * UI panels contributed by this plugin
101
- */
102
- uiPanels?: UIPanel[];
103
- /**
104
- * Query transformers contributed by this plugin
105
- */
106
- queryTransformers?: QueryTransformer[];
107
- /**
108
- * Data validators contributed by this plugin
109
- */
110
- dataValidators?: DataValidator[];
111
- /**
112
- * Initialize the plugin
113
- */
114
- init?(): Promise<void>;
115
- /**
116
- * Cleanup the plugin
117
- */
118
- destroy?(): Promise<void>;
119
- }
120
-
121
- class PluginManager {
122
- private plugins: Map<string, Plugin> = new Map();
123
- private embeddingProviders: Map<string, EmbeddingProvider> = new Map();
124
- private uiPanels: Map<string, UIPanel> = new Map();
125
- private queryTransformers: Map<string, QueryTransformer> = new Map();
126
- private dataValidators: Map<string, DataValidator> = new Map();
127
-
128
- /**
129
- * Register a plugin
130
- */
131
- async register(plugin: Plugin): Promise<void> {
132
- if (this.plugins.has(plugin.id)) {
133
- throw new Error(`Plugin ${plugin.id} is already registered`);
134
- }
135
-
136
- // Register embedding providers
137
- if (plugin.embeddingProviders) {
138
- for (const provider of plugin.embeddingProviders) {
139
- this.embeddingProviders.set(provider.name, provider);
140
- }
141
- }
142
-
143
- // Register UI panels
144
- if (plugin.uiPanels) {
145
- for (const panel of plugin.uiPanels) {
146
- this.uiPanels.set(panel.id, panel);
147
- }
148
- }
149
-
150
- // Register query transformers
151
- if (plugin.queryTransformers) {
152
- for (const transformer of plugin.queryTransformers) {
153
- this.queryTransformers.set(transformer.id, transformer);
154
- }
155
- }
156
-
157
- // Register data validators
158
- if (plugin.dataValidators) {
159
- for (const validator of plugin.dataValidators) {
160
- this.dataValidators.set(validator.id, validator);
161
- }
162
- }
163
-
164
- // Initialize plugin
165
- if (plugin.init) {
166
- await plugin.init();
167
- }
168
-
169
- this.plugins.set(plugin.id, plugin);
170
- }
171
-
172
- /**
173
- * Unregister a plugin
174
- */
175
- async unregister(pluginId: string): Promise<void> {
176
- const plugin = this.plugins.get(pluginId);
177
- if (!plugin) {
178
- return;
179
- }
180
-
181
- // Cleanup plugin
182
- if (plugin.destroy) {
183
- await plugin.destroy();
184
- }
185
-
186
- // Remove embedding providers
187
- if (plugin.embeddingProviders) {
188
- for (const provider of plugin.embeddingProviders) {
189
- this.embeddingProviders.delete(provider.name);
190
- }
191
- }
192
-
193
- // Remove UI panels
194
- if (plugin.uiPanels) {
195
- for (const panel of plugin.uiPanels) {
196
- this.uiPanels.delete(panel.id);
197
- }
198
- }
199
-
200
- // Remove query transformers
201
- if (plugin.queryTransformers) {
202
- for (const transformer of plugin.queryTransformers) {
203
- this.queryTransformers.delete(transformer.id);
204
- }
205
- }
206
-
207
- // Remove data validators
208
- if (plugin.dataValidators) {
209
- for (const validator of plugin.dataValidators) {
210
- this.dataValidators.delete(validator.id);
211
- }
212
- }
213
-
214
- this.plugins.delete(pluginId);
215
- }
216
-
217
- /**
218
- * Get all registered plugins
219
- */
220
- getPlugins(): Plugin[] {
221
- return Array.from(this.plugins.values());
222
- }
223
-
224
- /**
225
- * Get embedding provider by name
226
- */
227
- getEmbeddingProvider(name: string): EmbeddingProvider | undefined {
228
- return this.embeddingProviders.get(name);
229
- }
230
-
231
- /**
232
- * Get all embedding providers
233
- */
234
- getEmbeddingProviders(): EmbeddingProvider[] {
235
- return Array.from(this.embeddingProviders.values());
236
- }
237
-
238
- /**
239
- * Get UI panel by ID
240
- */
241
- getUIPanel(id: string): UIPanel | undefined {
242
- return this.uiPanels.get(id);
243
- }
244
-
245
- /**
246
- * Get all UI panels sorted by order
247
- */
248
- getUIPanels(): UIPanel[] {
249
- return Array.from(this.uiPanels.values()).sort(
250
- (a, b) => (a.order ?? 999) - (b.order ?? 999)
251
- );
252
- }
253
-
254
- /**
255
- * Get query transformer by ID
256
- */
257
- getQueryTransformer(id: string): QueryTransformer | undefined {
258
- return this.queryTransformers.get(id);
259
- }
260
-
261
- /**
262
- * Get all query transformers
263
- */
264
- getQueryTransformers(): QueryTransformer[] {
265
- return Array.from(this.queryTransformers.values());
266
- }
267
-
268
- /**
269
- * Get data validator by ID
270
- */
271
- getDataValidator(id: string): DataValidator | undefined {
272
- return this.dataValidators.get(id);
273
- }
274
-
275
- /**
276
- * Get all data validators
277
- */
278
- getDataValidators(): DataValidator[] {
279
- return Array.from(this.dataValidators.values());
280
- }
281
-
282
- /**
283
- * Apply all query transformers to a query
284
- */
285
- async transformQuery<T = Record<string, unknown>>(query: T): Promise<T> {
286
- let transformed = query;
287
- for (const transformer of this.queryTransformers.values()) {
288
- transformed = await transformer.transform(transformed as any) as T;
289
- }
290
- return transformed;
291
- }
292
-
293
- /**
294
- * Validate data using all validators
295
- */
296
- async validateData(data: Record<string, unknown>): Promise<{
297
- valid: boolean;
298
- errors: string[];
299
- }> {
300
- const errors: string[] = [];
301
- for (const validator of this.dataValidators.values()) {
302
- const result = await validator.validate(data);
303
- if (!result.valid && result.errors) {
304
- errors.push(...result.errors);
305
- }
306
- }
307
- return {
308
- valid: errors.length === 0,
309
- errors,
310
- };
311
- }
312
- }
313
-
314
- // Global plugin manager instance
315
- export const pluginManager = new PluginManager();