@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.
- package/README.md +97 -289
- package/crates/README.md +99 -0
- package/crates/pluresdb-node/README.md +181 -0
- package/crates/pluresdb-node/index.d.ts +0 -0
- package/crates/pluresdb-node/index.js +265 -0
- package/crates/pluresdb-node/package.json +35 -0
- package/dist/napi/index.js +60 -0
- package/embedded.d.ts +1 -0
- package/embedded.js +46 -0
- package/package.json +20 -9
- package/dist/.tsbuildinfo +0 -1
- package/dist/better-sqlite3-shared.d.ts +0 -12
- package/dist/better-sqlite3-shared.d.ts.map +0 -1
- package/dist/better-sqlite3-shared.js +0 -143
- package/dist/better-sqlite3-shared.js.map +0 -1
- package/dist/better-sqlite3.d.ts +0 -4
- package/dist/better-sqlite3.d.ts.map +0 -1
- package/dist/better-sqlite3.js +0 -8
- package/dist/better-sqlite3.js.map +0 -1
- package/dist/cli.d.ts +0 -7
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/local-first/unified-api.d.ts +0 -110
- package/dist/local-first/unified-api.d.ts.map +0 -1
- package/dist/local-first/unified-api.js +0 -348
- package/dist/local-first/unified-api.js.map +0 -1
- package/dist/node-index.d.ts +0 -150
- package/dist/node-index.d.ts.map +0 -1
- package/dist/node-index.js +0 -668
- package/dist/node-index.js.map +0 -1
- package/dist/node-wrapper.d.ts +0 -44
- package/dist/node-wrapper.d.ts.map +0 -1
- package/dist/node-wrapper.js +0 -296
- package/dist/node-wrapper.js.map +0 -1
- package/dist/types/index.d.ts +0 -28
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/types/node-types.d.ts +0 -71
- package/dist/types/node-types.d.ts.map +0 -1
- package/dist/types/node-types.js +0 -6
- package/dist/types/node-types.js.map +0 -1
- package/dist/util/debug.d.ts +0 -3
- package/dist/util/debug.d.ts.map +0 -1
- package/dist/util/debug.js +0 -34
- package/dist/util/debug.js.map +0 -1
- package/dist/vscode/extension.d.ts +0 -81
- package/dist/vscode/extension.d.ts.map +0 -1
- package/dist/vscode/extension.js +0 -309
- package/dist/vscode/extension.js.map +0 -1
- package/examples/basic-usage.d.ts +0 -2
- package/examples/basic-usage.d.ts.map +0 -1
- package/examples/basic-usage.js +0 -26
- package/examples/basic-usage.js.map +0 -1
- package/examples/basic-usage.ts +0 -29
- package/examples/browser-demo/README.md +0 -204
- package/examples/browser-demo/index.html +0 -466
- package/examples/browser-wasm-integration.md +0 -411
- package/examples/ipc-demo/README.md +0 -127
- package/examples/local-first-usage.ts +0 -138
- package/examples/native-ipc-integration.md +0 -526
- package/examples/tauri-demo/README.md +0 -240
- package/examples/tauri-integration.md +0 -260
- package/examples/vscode-extension-example/README.md +0 -95
- package/examples/vscode-extension-example/package.json +0 -49
- package/examples/vscode-extension-example/src/extension.ts +0 -172
- package/examples/vscode-extension-example/tsconfig.json +0 -12
- package/examples/vscode-extension-integration.d.ts +0 -31
- package/examples/vscode-extension-integration.d.ts.map +0 -1
- package/examples/vscode-extension-integration.js +0 -319
- package/examples/vscode-extension-integration.js.map +0 -1
- package/examples/vscode-extension-integration.ts +0 -41
- package/legacy/benchmarks/memory-benchmarks.ts +0 -350
- package/legacy/benchmarks/run-benchmarks.ts +0 -315
- package/legacy/better-sqlite3-shared.ts +0 -157
- package/legacy/better-sqlite3.ts +0 -4
- package/legacy/cli.ts +0 -241
- package/legacy/config.ts +0 -50
- package/legacy/core/crdt.ts +0 -107
- package/legacy/core/database.ts +0 -529
- package/legacy/healthcheck.ts +0 -162
- package/legacy/http/api-server.ts +0 -569
- package/legacy/index.ts +0 -31
- package/legacy/local-first/unified-api.ts +0 -449
- package/legacy/logic/rules.ts +0 -46
- package/legacy/main.rs +0 -3
- package/legacy/main.ts +0 -197
- package/legacy/network/websocket-server.ts +0 -115
- package/legacy/node-index.ts +0 -827
- package/legacy/node-wrapper.ts +0 -329
- package/legacy/plugins/README.md +0 -181
- package/legacy/plugins/example-embedding-plugin.ts +0 -56
- package/legacy/plugins/plugin-system.ts +0 -315
- package/legacy/sqlite-compat.ts +0 -633
- package/legacy/sqlite3-compat.ts +0 -55
- package/legacy/storage/kv-storage.ts +0 -73
- package/legacy/tests/core.test.ts +0 -305
- package/legacy/tests/fixtures/performance-data.json +0 -71
- package/legacy/tests/fixtures/test-data.json +0 -129
- package/legacy/tests/integration/api-server.test.ts +0 -334
- package/legacy/tests/integration/mesh-network.test.ts +0 -303
- package/legacy/tests/logic.test.ts +0 -34
- package/legacy/tests/performance/load.test.ts +0 -290
- package/legacy/tests/security/input-validation.test.ts +0 -286
- package/legacy/tests/unit/core.test.ts +0 -226
- package/legacy/tests/unit/local-first-api.test.ts +0 -65
- package/legacy/tests/unit/plugin-system.test.ts +0 -388
- package/legacy/tests/unit/subscriptions.test.ts +0 -135
- package/legacy/tests/unit/vector-search.test.ts +0 -173
- package/legacy/tests/vscode_extension_test.ts +0 -281
- package/legacy/types/index.ts +0 -32
- package/legacy/types/node-types.ts +0 -80
- package/legacy/util/debug.ts +0 -27
- package/legacy/vector/index.ts +0 -59
- package/legacy/vscode/extension.ts +0 -387
- package/scripts/compiled-crud-verify.ts +0 -30
- package/scripts/dogfood.ts +0 -297
- package/scripts/postinstall.js +0 -156
- package/scripts/publish-crates.sh +0 -95
- package/scripts/release-check.js +0 -224
- package/scripts/run-tests.ts +0 -178
- package/scripts/setup-libclang.ps1 +0 -209
- package/scripts/update-changelog.js +0 -214
- package/scripts/validate-npm-publish.js +0 -228
- package/web/README.md +0 -27
- package/web/svelte/package.json +0 -31
package/scripts/dogfood.ts
DELETED
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S deno run -A --unstable-kv
|
|
2
|
-
|
|
3
|
-
import { GunDB } from "../legacy/core/database.ts";
|
|
4
|
-
import { startApiServer } from "../legacy/http/api-server.ts";
|
|
5
|
-
|
|
6
|
-
declare const Deno: any;
|
|
7
|
-
|
|
8
|
-
interface StepResult {
|
|
9
|
-
name: string;
|
|
10
|
-
ok: boolean;
|
|
11
|
-
details?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async function main() {
|
|
15
|
-
const results: StepResult[] = [];
|
|
16
|
-
const kvDir = await Deno.makeTempDir({ prefix: "pluresdb-dogfood-" });
|
|
17
|
-
const kvPath = `${kvDir}/kv`;
|
|
18
|
-
const wsPort = 4600 + Math.floor(Math.random() * 5000);
|
|
19
|
-
const apiPort = wsPort + 1;
|
|
20
|
-
const apiUrl = `http://localhost:${apiPort}`;
|
|
21
|
-
|
|
22
|
-
const db = new GunDB();
|
|
23
|
-
await db.ready(kvPath);
|
|
24
|
-
db.serve({ port: wsPort });
|
|
25
|
-
const api = startApiServer({ port: apiPort, db });
|
|
26
|
-
|
|
27
|
-
const cleanupTasks: Array<() => Promise<void> | void> = [
|
|
28
|
-
async () => {
|
|
29
|
-
try {
|
|
30
|
-
api.close();
|
|
31
|
-
} catch (_) {
|
|
32
|
-
/* ignore */
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
async () => {
|
|
36
|
-
try {
|
|
37
|
-
await db.close();
|
|
38
|
-
} catch (_) {
|
|
39
|
-
/* ignore */
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
async () => {
|
|
43
|
-
try {
|
|
44
|
-
await Deno.remove(kvDir, { recursive: true });
|
|
45
|
-
} catch (_) {
|
|
46
|
-
/* ignore */
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
const finalize = async () => {
|
|
52
|
-
for (const task of cleanupTasks) {
|
|
53
|
-
await Promise.resolve(task());
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const assert = (cond: boolean, message: string) => {
|
|
58
|
-
if (!cond) {
|
|
59
|
-
throw new Error(message);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const record = (name: string, ok: boolean, details?: string) => {
|
|
64
|
-
const entry: StepResult = { name, ok, details };
|
|
65
|
-
results.push(entry);
|
|
66
|
-
const icon = ok ? "✅" : "❌";
|
|
67
|
-
console.log(`${icon} ${name}${details ? ` — ${details}` : ""}`);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
console.log("🚀 Starting PluresDB dogfooding run");
|
|
72
|
-
console.log(`🗂️ KV path: ${kvPath}`);
|
|
73
|
-
console.log(`🔌 Mesh port: ${wsPort}`);
|
|
74
|
-
console.log(`🌐 API port: ${apiPort}`);
|
|
75
|
-
|
|
76
|
-
await waitFor(
|
|
77
|
-
async () => {
|
|
78
|
-
try {
|
|
79
|
-
const res = await fetch(`${apiUrl}/api/list`);
|
|
80
|
-
return res.ok;
|
|
81
|
-
} catch (_) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
{ timeoutMs: 10_000, intervalMs: 250 },
|
|
86
|
-
);
|
|
87
|
-
record("Server readiness", true);
|
|
88
|
-
|
|
89
|
-
const nodeId = "dogfood:api";
|
|
90
|
-
const initialPayload = {
|
|
91
|
-
type: "DogfoodTest",
|
|
92
|
-
text: "Hello from the dogfooding script",
|
|
93
|
-
vector: Array.from({ length: 4 }, (_, i) => i + 1),
|
|
94
|
-
};
|
|
95
|
-
const putRes = await fetch(`${apiUrl}/api/put`, {
|
|
96
|
-
method: "POST",
|
|
97
|
-
headers: { "content-type": "application/json" },
|
|
98
|
-
body: JSON.stringify({ id: nodeId, data: initialPayload }),
|
|
99
|
-
});
|
|
100
|
-
assert(putRes.ok, `API put failed (${putRes.status})`);
|
|
101
|
-
record("API put", true);
|
|
102
|
-
|
|
103
|
-
const getRes = await fetch(
|
|
104
|
-
`${apiUrl}/api/get?id=${encodeURIComponent(nodeId)}`,
|
|
105
|
-
);
|
|
106
|
-
assert(getRes.ok, "API get failed");
|
|
107
|
-
const getJson = await getRes.json();
|
|
108
|
-
assert(getJson.text === initialPayload.text, "Unexpected API get payload");
|
|
109
|
-
record("API get", true);
|
|
110
|
-
|
|
111
|
-
const listRes = await fetch(`${apiUrl}/api/list`);
|
|
112
|
-
assert(listRes.ok, "API list failed");
|
|
113
|
-
const listJson = await listRes.json();
|
|
114
|
-
assert(
|
|
115
|
-
Array.isArray(listJson) && listJson.some((n: any) => n.id === nodeId),
|
|
116
|
-
"Node missing from API list",
|
|
117
|
-
);
|
|
118
|
-
record("API list", true);
|
|
119
|
-
|
|
120
|
-
const searchRes = await fetch(
|
|
121
|
-
`${apiUrl}/api/search?q=${encodeURIComponent("dogfood script test")}&k=5`,
|
|
122
|
-
);
|
|
123
|
-
assert(searchRes.ok, "API search failed");
|
|
124
|
-
const searchJson = await searchRes.json();
|
|
125
|
-
assert(
|
|
126
|
-
Array.isArray(searchJson) && searchJson.length > 0,
|
|
127
|
-
"Vector search returned no results",
|
|
128
|
-
);
|
|
129
|
-
record("API vector search", true);
|
|
130
|
-
|
|
131
|
-
const updatePayload = {
|
|
132
|
-
type: "DogfoodTest",
|
|
133
|
-
text: "Hello from the updated dogfooding script",
|
|
134
|
-
};
|
|
135
|
-
const putUpdate = await fetch(`${apiUrl}/api/put`, {
|
|
136
|
-
method: "POST",
|
|
137
|
-
headers: { "content-type": "application/json" },
|
|
138
|
-
body: JSON.stringify({ id: nodeId, data: updatePayload }),
|
|
139
|
-
});
|
|
140
|
-
assert(putUpdate.ok, "API put update failed");
|
|
141
|
-
record("API update", true);
|
|
142
|
-
|
|
143
|
-
const historyRes = await fetch(
|
|
144
|
-
`${apiUrl}/api/history?id=${encodeURIComponent(nodeId)}`,
|
|
145
|
-
);
|
|
146
|
-
assert(historyRes.ok, "API history failed");
|
|
147
|
-
const historyJson = await historyRes.json();
|
|
148
|
-
assert(
|
|
149
|
-
Array.isArray(historyJson) && historyJson.length >= 2,
|
|
150
|
-
"API history missing versions",
|
|
151
|
-
);
|
|
152
|
-
record("API history", true, `${historyJson.length} versions`);
|
|
153
|
-
|
|
154
|
-
const restoreTimestamp = historyJson.at(-1)?.timestamp ??
|
|
155
|
-
historyJson[historyJson.length - 1]?.timestamp;
|
|
156
|
-
assert(
|
|
157
|
-
typeof restoreTimestamp === "number",
|
|
158
|
-
"Failed to locate restore timestamp",
|
|
159
|
-
);
|
|
160
|
-
const restoreRes = await fetch(
|
|
161
|
-
`${apiUrl}/api/restore?id=${
|
|
162
|
-
encodeURIComponent(nodeId)
|
|
163
|
-
}×tamp=${restoreTimestamp}`,
|
|
164
|
-
);
|
|
165
|
-
assert(restoreRes.ok, "API restore failed");
|
|
166
|
-
record("API restore", true);
|
|
167
|
-
|
|
168
|
-
const restored = await (
|
|
169
|
-
await fetch(`${apiUrl}/api/get?id=${encodeURIComponent(nodeId)}`)
|
|
170
|
-
).json();
|
|
171
|
-
assert(
|
|
172
|
-
restored.text === initialPayload.text,
|
|
173
|
-
"Restore did not revert payload",
|
|
174
|
-
);
|
|
175
|
-
record("API post-restore verification", true);
|
|
176
|
-
|
|
177
|
-
const instancesRes = await fetch(
|
|
178
|
-
`${apiUrl}/api/instances?type=${encodeURIComponent("DogfoodTest")}`,
|
|
179
|
-
);
|
|
180
|
-
assert(instancesRes.ok, "API instances failed");
|
|
181
|
-
const instancesJson = await instancesRes.json();
|
|
182
|
-
assert(
|
|
183
|
-
Array.isArray(instancesJson) &&
|
|
184
|
-
instancesJson.some((n: any) => n.id === nodeId),
|
|
185
|
-
"Instances endpoint missing node",
|
|
186
|
-
);
|
|
187
|
-
record("API type instances", true);
|
|
188
|
-
|
|
189
|
-
const webRes = await fetch(`${apiUrl}/`);
|
|
190
|
-
assert(webRes.ok, "Web UI endpoint failed");
|
|
191
|
-
const webHtml = await webRes.text();
|
|
192
|
-
record("Web UI fetch", true, `${webHtml.length} chars`);
|
|
193
|
-
|
|
194
|
-
const cliId = "dogfood:cli";
|
|
195
|
-
const cliPut = await runCli([
|
|
196
|
-
"put",
|
|
197
|
-
cliId,
|
|
198
|
-
JSON.stringify({ type: "DogfoodTest", text: "CLI write" }),
|
|
199
|
-
"--kv",
|
|
200
|
-
kvPath,
|
|
201
|
-
]);
|
|
202
|
-
assert(cliPut.code === 0, `CLI put failed: ${cliPut.stderr}`);
|
|
203
|
-
record("CLI put", true);
|
|
204
|
-
|
|
205
|
-
const cliGet = await runCli(["get", cliId, "--kv", kvPath]);
|
|
206
|
-
assert(cliGet.code === 0, `CLI get failed: ${cliGet.stderr}`);
|
|
207
|
-
const cliGetJson = JSON.parse(cliGet.stdout.trim() || "null");
|
|
208
|
-
assert(cliGetJson?.text === "CLI write", "CLI get returned wrong payload");
|
|
209
|
-
record("CLI get", true);
|
|
210
|
-
|
|
211
|
-
const cliList = await runCli(["list", "--kv", kvPath]);
|
|
212
|
-
assert(cliList.code === 0, `CLI list failed: ${cliList.stderr}`);
|
|
213
|
-
const cliListJson = JSON.parse(cliList.stdout.trim() || "[]");
|
|
214
|
-
assert(
|
|
215
|
-
Array.isArray(cliListJson) && cliListJson.length >= 2,
|
|
216
|
-
"CLI list missing entries",
|
|
217
|
-
);
|
|
218
|
-
record("CLI list", true);
|
|
219
|
-
|
|
220
|
-
const cliSearch = await runCli([
|
|
221
|
-
"vsearch",
|
|
222
|
-
"dogfooding",
|
|
223
|
-
"5",
|
|
224
|
-
"--kv",
|
|
225
|
-
kvPath,
|
|
226
|
-
]);
|
|
227
|
-
assert(cliSearch.code === 0, `CLI vsearch failed: ${cliSearch.stderr}`);
|
|
228
|
-
const cliSearchJson = JSON.parse(cliSearch.stdout.trim() || "[]");
|
|
229
|
-
assert(
|
|
230
|
-
Array.isArray(cliSearchJson) && cliSearchJson.length > 0,
|
|
231
|
-
"CLI vsearch returned no results",
|
|
232
|
-
);
|
|
233
|
-
record("CLI vector search", true);
|
|
234
|
-
|
|
235
|
-
console.log("\n🎉 Dogfooding run succeeded!");
|
|
236
|
-
} catch (error) {
|
|
237
|
-
record(
|
|
238
|
-
"Dogfooding run",
|
|
239
|
-
false,
|
|
240
|
-
error instanceof Error ? error.message : String(error),
|
|
241
|
-
);
|
|
242
|
-
await finalize();
|
|
243
|
-
console.log("\n❌ Dogfooding run failed");
|
|
244
|
-
console.log(error);
|
|
245
|
-
Deno.exit(1);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
await finalize();
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
async function runCli(args: string[]) {
|
|
252
|
-
const command = new Deno.Command("deno", {
|
|
253
|
-
args: [
|
|
254
|
-
"run",
|
|
255
|
-
"-A",
|
|
256
|
-
"--unstable-kv",
|
|
257
|
-
"--no-lock",
|
|
258
|
-
"legacy/main.ts",
|
|
259
|
-
...args,
|
|
260
|
-
],
|
|
261
|
-
stdout: "piped",
|
|
262
|
-
stderr: "piped",
|
|
263
|
-
});
|
|
264
|
-
const { code, stdout, stderr } = await command.output();
|
|
265
|
-
return {
|
|
266
|
-
code,
|
|
267
|
-
stdout: new TextDecoder().decode(stdout),
|
|
268
|
-
stderr: new TextDecoder().decode(stderr),
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
async function waitFor(
|
|
273
|
-
fn: () => Promise<boolean>,
|
|
274
|
-
opts: { timeoutMs: number; intervalMs: number },
|
|
275
|
-
) {
|
|
276
|
-
const deadline = Date.now() + opts.timeoutMs;
|
|
277
|
-
while (Date.now() < deadline) {
|
|
278
|
-
if (await fn()) return;
|
|
279
|
-
await sleep(opts.intervalMs);
|
|
280
|
-
}
|
|
281
|
-
throw new Error("Timed out waiting for condition");
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function sleep(ms: number): Promise<void>;
|
|
285
|
-
function sleep<T>(ms: number, value: T): Promise<T>;
|
|
286
|
-
function sleep(ms: number, value?: unknown) {
|
|
287
|
-
return new Promise((resolve) => {
|
|
288
|
-
const timer = setTimeout(() => {
|
|
289
|
-
clearTimeout(timer);
|
|
290
|
-
resolve(value);
|
|
291
|
-
}, ms);
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
if ((import.meta as any).main) {
|
|
296
|
-
await main();
|
|
297
|
-
}
|
package/scripts/postinstall.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Post-install script for PluresDB npm package
|
|
3
|
-
* This script ensures Deno is available and sets up the environment
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const { spawn, exec } = require("child_process");
|
|
7
|
-
const fs = require("fs");
|
|
8
|
-
const path = require("path");
|
|
9
|
-
const os = require("os");
|
|
10
|
-
|
|
11
|
-
const DENO_VERSION = "1.40.0";
|
|
12
|
-
|
|
13
|
-
function log(message) {
|
|
14
|
-
console.log(`[pluresdb] ${message}`);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function logError(message) {
|
|
18
|
-
console.error(`[pluresdb] ERROR: ${message}`);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function isDenoInstalled() {
|
|
22
|
-
return new Promise((resolve) => {
|
|
23
|
-
exec("deno --version", (error) => {
|
|
24
|
-
resolve(!error);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function installDeno() {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
const platform = os.platform();
|
|
32
|
-
const arch = os.arch();
|
|
33
|
-
|
|
34
|
-
log("Installing Deno...");
|
|
35
|
-
|
|
36
|
-
let installCommand;
|
|
37
|
-
|
|
38
|
-
if (platform === "win32") {
|
|
39
|
-
// Windows - use PowerShell
|
|
40
|
-
installCommand =
|
|
41
|
-
`powershell -c "iwr https://deno.land/install.ps1 -useb | iex"`;
|
|
42
|
-
} else if (platform === "darwin") {
|
|
43
|
-
// macOS - use Homebrew or curl
|
|
44
|
-
installCommand = "curl -fsSL https://deno.land/install.sh | sh";
|
|
45
|
-
} else {
|
|
46
|
-
// Linux - use curl
|
|
47
|
-
installCommand = "curl -fsSL https://deno.land/install.sh | sh";
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
exec(installCommand, (error, stdout, stderr) => {
|
|
51
|
-
if (error) {
|
|
52
|
-
logError(`Failed to install Deno: ${error.message}`);
|
|
53
|
-
logError("Please install Deno manually from https://deno.land/");
|
|
54
|
-
reject(error);
|
|
55
|
-
} else {
|
|
56
|
-
log("Deno installed successfully");
|
|
57
|
-
resolve();
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function createStartScript() {
|
|
64
|
-
const scriptContent = `#!/bin/bash
|
|
65
|
-
# PluresDB start script
|
|
66
|
-
export DENO_INSTALL="$HOME/.deno"
|
|
67
|
-
export PATH="$DENO_INSTALL/bin:$PATH"
|
|
68
|
-
|
|
69
|
-
# Start PluresDB
|
|
70
|
-
deno run -A "${path.join(__dirname, "../src/main.ts")}" serve "$@"
|
|
71
|
-
`;
|
|
72
|
-
|
|
73
|
-
const scriptPath = path.join(__dirname, "../bin/pluresdb.sh");
|
|
74
|
-
const scriptDir = path.dirname(scriptPath);
|
|
75
|
-
|
|
76
|
-
if (!fs.existsSync(scriptDir)) {
|
|
77
|
-
fs.mkdirSync(scriptDir, { recursive: true });
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
fs.writeFileSync(scriptPath, scriptContent);
|
|
81
|
-
fs.chmodSync(scriptPath, "755");
|
|
82
|
-
|
|
83
|
-
log("Created start script");
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function createWindowsStartScript() {
|
|
87
|
-
const scriptContent = `@echo off
|
|
88
|
-
REM PluresDB start script for Windows
|
|
89
|
-
set DENO_INSTALL=%USERPROFILE%\\.deno
|
|
90
|
-
set PATH=%DENO_INSTALL%\\bin;%PATH%
|
|
91
|
-
|
|
92
|
-
REM Start PluresDB
|
|
93
|
-
deno run -A "${path.join(__dirname, "../src/main.ts")}" serve %*
|
|
94
|
-
`;
|
|
95
|
-
|
|
96
|
-
const scriptPath = path.join(__dirname, "../bin/pluresdb.bat");
|
|
97
|
-
const scriptDir = path.dirname(scriptPath);
|
|
98
|
-
|
|
99
|
-
if (!fs.existsSync(scriptDir)) {
|
|
100
|
-
fs.mkdirSync(scriptDir, { recursive: true });
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
fs.writeFileSync(scriptPath, scriptContent);
|
|
104
|
-
|
|
105
|
-
log("Created Windows start script");
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
async function main() {
|
|
109
|
-
try {
|
|
110
|
-
log("Setting up PluresDB...");
|
|
111
|
-
|
|
112
|
-
// Check if Deno is installed
|
|
113
|
-
const denoInstalled = await isDenoInstalled();
|
|
114
|
-
|
|
115
|
-
if (!denoInstalled) {
|
|
116
|
-
log("Deno not found, attempting to install...");
|
|
117
|
-
try {
|
|
118
|
-
await installDeno();
|
|
119
|
-
} catch {
|
|
120
|
-
logError("Failed to install Deno automatically");
|
|
121
|
-
logError("Please install Deno manually:");
|
|
122
|
-
logError(" Windows: iwr https://deno.land/install.ps1 -useb | iex");
|
|
123
|
-
logError(" macOS/Linux: curl -fsSL https://deno.land/install.sh | sh");
|
|
124
|
-
logError(" Or visit: https://deno.land/");
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
log("Deno is already installed");
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Create start scripts
|
|
132
|
-
createStartScript();
|
|
133
|
-
if (os.platform() === "win32") {
|
|
134
|
-
createWindowsStartScript();
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Create data directory
|
|
138
|
-
const dataDir = path.join(os.homedir(), ".pluresdb");
|
|
139
|
-
if (!fs.existsSync(dataDir)) {
|
|
140
|
-
fs.mkdirSync(dataDir, { recursive: true });
|
|
141
|
-
log(`Created data directory: ${dataDir}`);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
log("Setup complete!");
|
|
145
|
-
log("Usage:");
|
|
146
|
-
log(" npx pluresdb serve");
|
|
147
|
-
log(" or");
|
|
148
|
-
log(" node node_modules/pluresdb/dist/cli.js serve");
|
|
149
|
-
} catch (error) {
|
|
150
|
-
logError(`Setup failed: ${error.message}`);
|
|
151
|
-
Deno.exit(1);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Run the setup
|
|
156
|
-
main();
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Publish all PluresDB crates to crates.io
|
|
3
|
-
# Usage: ./scripts/publish-crates.sh
|
|
4
|
-
|
|
5
|
-
set -e
|
|
6
|
-
|
|
7
|
-
echo "=========================================="
|
|
8
|
-
echo "Publishing PluresDB Crates to crates.io"
|
|
9
|
-
echo "=========================================="
|
|
10
|
-
echo ""
|
|
11
|
-
|
|
12
|
-
# Check if logged in
|
|
13
|
-
if ! cargo login --check 2>/dev/null; then
|
|
14
|
-
echo "Error: Not logged in to crates.io"
|
|
15
|
-
echo "Run: cargo login <your-api-token>"
|
|
16
|
-
exit 1
|
|
17
|
-
fi
|
|
18
|
-
|
|
19
|
-
# Colors for output
|
|
20
|
-
GREEN='\033[0;32m'
|
|
21
|
-
YELLOW='\033[1;33m'
|
|
22
|
-
RED='\033[0;31m'
|
|
23
|
-
NC='\033[0m' # No Color
|
|
24
|
-
|
|
25
|
-
# Function to publish a crate
|
|
26
|
-
publish_crate() {
|
|
27
|
-
local crate_name=$1
|
|
28
|
-
local crate_path=$2
|
|
29
|
-
|
|
30
|
-
echo -e "${YELLOW}Publishing ${crate_name}...${NC}"
|
|
31
|
-
cd "$crate_path"
|
|
32
|
-
|
|
33
|
-
# Verify it builds
|
|
34
|
-
echo " Building..."
|
|
35
|
-
if ! cargo build --release > /dev/null 2>&1; then
|
|
36
|
-
echo -e "${RED} ✗ Build failed${NC}"
|
|
37
|
-
return 1
|
|
38
|
-
fi
|
|
39
|
-
|
|
40
|
-
# Run tests
|
|
41
|
-
echo " Running tests..."
|
|
42
|
-
if ! cargo test > /dev/null 2>&1; then
|
|
43
|
-
echo -e "${RED} ✗ Tests failed${NC}"
|
|
44
|
-
return 1
|
|
45
|
-
fi
|
|
46
|
-
|
|
47
|
-
# Check package
|
|
48
|
-
echo " Checking package..."
|
|
49
|
-
if ! cargo package > /dev/null 2>&1; then
|
|
50
|
-
echo -e "${RED} ✗ Package check failed${NC}"
|
|
51
|
-
return 1
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
# Publish
|
|
55
|
-
echo " Publishing to crates.io..."
|
|
56
|
-
if cargo publish; then
|
|
57
|
-
echo -e "${GREEN} ✓ ${crate_name} published successfully${NC}"
|
|
58
|
-
cd - > /dev/null
|
|
59
|
-
return 0
|
|
60
|
-
else
|
|
61
|
-
echo -e "${RED} ✗ Publishing failed${NC}"
|
|
62
|
-
cd - > /dev/null
|
|
63
|
-
return 1
|
|
64
|
-
fi
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
# Publish in dependency order
|
|
68
|
-
echo "Publishing crates in dependency order..."
|
|
69
|
-
echo ""
|
|
70
|
-
|
|
71
|
-
# Note: pluresdb-core and pluresdb-sync are already published
|
|
72
|
-
# Uncomment if you need to republish them:
|
|
73
|
-
# publish_crate "pluresdb-core" "crates/pluresdb-core"
|
|
74
|
-
# publish_crate "pluresdb-sync" "crates/pluresdb-sync"
|
|
75
|
-
|
|
76
|
-
# Publish storage (depends on core)
|
|
77
|
-
publish_crate "pluresdb-storage" "crates/pluresdb-storage"
|
|
78
|
-
echo ""
|
|
79
|
-
|
|
80
|
-
# Publish unified main crate (depends on core, storage, sync)
|
|
81
|
-
publish_crate "pluresdb" "crates/pluresdb"
|
|
82
|
-
echo ""
|
|
83
|
-
|
|
84
|
-
# Publish CLI (depends on core, storage, sync)
|
|
85
|
-
publish_crate "pluresdb-cli" "crates/pluresdb-cli"
|
|
86
|
-
echo ""
|
|
87
|
-
|
|
88
|
-
echo "=========================================="
|
|
89
|
-
echo -e "${GREEN}All crates published successfully!${NC}"
|
|
90
|
-
echo "=========================================="
|
|
91
|
-
echo ""
|
|
92
|
-
echo "Note: pluresdb-node and pluresdb-deno are published separately:"
|
|
93
|
-
echo " - pluresdb-node: npm publish (in crates/pluresdb-node)"
|
|
94
|
-
echo " - pluresdb-deno: deno publish (in crates/pluresdb-deno)"
|
|
95
|
-
|