@plures/pluresdb 1.6.10 → 2.9.7

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 (93) 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/.tsbuildinfo +1 -1
  8. package/dist/napi/index.d.ts +38 -0
  9. package/dist/napi/index.d.ts.map +1 -0
  10. package/dist/napi/index.js +60 -0
  11. package/dist/napi/index.js.map +1 -0
  12. package/dist/node-index.d.ts +32 -0
  13. package/dist/node-index.d.ts.map +1 -1
  14. package/dist/node-index.js +52 -0
  15. package/dist/node-index.js.map +1 -1
  16. package/embedded.d.ts +1 -0
  17. package/embedded.js +46 -0
  18. package/package.json +21 -8
  19. package/examples/basic-usage.d.ts +0 -2
  20. package/examples/basic-usage.d.ts.map +0 -1
  21. package/examples/basic-usage.js +0 -26
  22. package/examples/basic-usage.js.map +0 -1
  23. package/examples/basic-usage.ts +0 -29
  24. package/examples/browser-demo/README.md +0 -204
  25. package/examples/browser-demo/index.html +0 -466
  26. package/examples/browser-wasm-integration.md +0 -411
  27. package/examples/ipc-demo/README.md +0 -127
  28. package/examples/local-first-usage.ts +0 -138
  29. package/examples/native-ipc-integration.md +0 -526
  30. package/examples/tauri-demo/README.md +0 -240
  31. package/examples/tauri-integration.md +0 -260
  32. package/examples/vscode-extension-example/README.md +0 -95
  33. package/examples/vscode-extension-example/package.json +0 -49
  34. package/examples/vscode-extension-example/src/extension.ts +0 -172
  35. package/examples/vscode-extension-example/tsconfig.json +0 -12
  36. package/examples/vscode-extension-integration.d.ts +0 -31
  37. package/examples/vscode-extension-integration.d.ts.map +0 -1
  38. package/examples/vscode-extension-integration.js +0 -319
  39. package/examples/vscode-extension-integration.js.map +0 -1
  40. package/examples/vscode-extension-integration.ts +0 -41
  41. package/legacy/benchmarks/memory-benchmarks.ts +0 -350
  42. package/legacy/benchmarks/run-benchmarks.ts +0 -315
  43. package/legacy/better-sqlite3-shared.ts +0 -157
  44. package/legacy/better-sqlite3.ts +0 -4
  45. package/legacy/cli.ts +0 -241
  46. package/legacy/config.ts +0 -50
  47. package/legacy/core/crdt.ts +0 -107
  48. package/legacy/core/database.ts +0 -529
  49. package/legacy/healthcheck.ts +0 -162
  50. package/legacy/http/api-server.ts +0 -569
  51. package/legacy/index.ts +0 -31
  52. package/legacy/local-first/unified-api.ts +0 -449
  53. package/legacy/logic/rules.ts +0 -46
  54. package/legacy/main.rs +0 -3
  55. package/legacy/main.ts +0 -197
  56. package/legacy/network/websocket-server.ts +0 -115
  57. package/legacy/node-index.ts +0 -827
  58. package/legacy/node-wrapper.ts +0 -329
  59. package/legacy/plugins/README.md +0 -181
  60. package/legacy/plugins/example-embedding-plugin.ts +0 -56
  61. package/legacy/plugins/plugin-system.ts +0 -315
  62. package/legacy/sqlite-compat.ts +0 -633
  63. package/legacy/sqlite3-compat.ts +0 -55
  64. package/legacy/storage/kv-storage.ts +0 -73
  65. package/legacy/tests/core.test.ts +0 -305
  66. package/legacy/tests/fixtures/performance-data.json +0 -71
  67. package/legacy/tests/fixtures/test-data.json +0 -129
  68. package/legacy/tests/integration/api-server.test.ts +0 -334
  69. package/legacy/tests/integration/mesh-network.test.ts +0 -303
  70. package/legacy/tests/logic.test.ts +0 -34
  71. package/legacy/tests/performance/load.test.ts +0 -290
  72. package/legacy/tests/security/input-validation.test.ts +0 -286
  73. package/legacy/tests/unit/core.test.ts +0 -226
  74. package/legacy/tests/unit/local-first-api.test.ts +0 -65
  75. package/legacy/tests/unit/plugin-system.test.ts +0 -388
  76. package/legacy/tests/unit/subscriptions.test.ts +0 -135
  77. package/legacy/tests/unit/vector-search.test.ts +0 -173
  78. package/legacy/tests/vscode_extension_test.ts +0 -281
  79. package/legacy/types/index.ts +0 -32
  80. package/legacy/types/node-types.ts +0 -80
  81. package/legacy/util/debug.ts +0 -27
  82. package/legacy/vector/index.ts +0 -59
  83. package/legacy/vscode/extension.ts +0 -387
  84. package/scripts/compiled-crud-verify.ts +0 -30
  85. package/scripts/dogfood.ts +0 -297
  86. package/scripts/publish-crates.sh +0 -95
  87. package/scripts/release-check.js +0 -224
  88. package/scripts/run-tests.ts +0 -178
  89. package/scripts/setup-libclang.ps1 +0 -209
  90. package/scripts/update-changelog.js +0 -214
  91. package/scripts/validate-npm-publish.js +0 -228
  92. package/web/README.md +0 -27
  93. 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();