sdk-audit-server 0.8.20-alpha → 0.9.1-alpha

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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.mjs +59 -59
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "sdk-audit-server",
3
- "version": "0.8.20-alpha",
3
+ "version": "0.9.1-alpha",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "express": "^4.21.0",
7
- "@hardkas/sdk": "0.8.20-alpha"
7
+ "@hardkas/sdk": "0.9.1-alpha"
8
8
  },
9
9
  "scripts": {
10
10
  "demo": "node src/index.mjs"
package/src/index.mjs CHANGED
@@ -1,59 +1,59 @@
1
- import { Hardkas } from "@hardkas/sdk";
2
- import express from "express";
3
-
4
- async function run() {
5
- const hardkas = await Hardkas.create({
6
- network: "simulated",
7
- autoBootstrap: true,
8
- logger: console
9
- });
10
-
11
- // Sync index to ensure we have the latest artifacts
12
- console.log("Syncing query store...");
13
- await hardkas.query.sync();
14
-
15
- const app = express();
16
-
17
- app.get("/artifacts", async (req, res) => {
18
- try {
19
- const list = await hardkas.artifacts.list();
20
- res.json(list);
21
- } catch (e) {
22
- res.status(500).json({ error: e.message });
23
- }
24
- });
25
-
26
- app.get("/lineage/:id", async (req, res) => {
27
- try {
28
- const trace = await hardkas.lineage.trace(req.params.id);
29
- res.json(trace);
30
- } catch (e) {
31
- res.status(500).json({ error: e.message });
32
- }
33
- });
34
-
35
- app.get("/verify/:id", async (req, res) => {
36
- try {
37
- const result = await hardkas.artifacts.verify(req.params.id);
38
- res.json({ id: req.params.id, verified: result.ok });
39
- } catch (e) {
40
- res.status(500).json({ error: e.message });
41
- }
42
- });
43
-
44
- const server = app.listen(3000, () => {
45
- console.log("Audit server running on http://localhost:3000");
46
- console.log("Endpoints:");
47
- console.log(" - GET /artifacts");
48
- console.log(" - GET /lineage/:id");
49
- console.log(" - GET /verify/:id");
50
-
51
- // Shut down gracefully after 5 seconds since it's just a demo
52
- setTimeout(() => {
53
- console.log("Shutting down demo server...");
54
- server.close();
55
- }, 5000);
56
- });
57
- }
58
-
59
- run().catch(console.error);
1
+ import { Hardkas } from "@hardkas/sdk";
2
+ import express from "express";
3
+
4
+ async function run() {
5
+ const hardkas = await Hardkas.create({
6
+ network: "simulated",
7
+ autoBootstrap: true,
8
+ logger: console
9
+ });
10
+
11
+ // Sync index to ensure we have the latest artifacts
12
+ console.log("Syncing query store...");
13
+ await hardkas.query.sync();
14
+
15
+ const app = express();
16
+
17
+ app.get("/artifacts", async (req, res) => {
18
+ try {
19
+ const list = await hardkas.artifacts.list();
20
+ res.json(list);
21
+ } catch (e) {
22
+ res.status(500).json({ error: e.message });
23
+ }
24
+ });
25
+
26
+ app.get("/lineage/:id", async (req, res) => {
27
+ try {
28
+ const trace = await hardkas.lineage.trace(req.params.id);
29
+ res.json(trace);
30
+ } catch (e) {
31
+ res.status(500).json({ error: e.message });
32
+ }
33
+ });
34
+
35
+ app.get("/verify/:id", async (req, res) => {
36
+ try {
37
+ const result = await hardkas.artifacts.verify(req.params.id);
38
+ res.json({ id: req.params.id, verified: result.ok });
39
+ } catch (e) {
40
+ res.status(500).json({ error: e.message });
41
+ }
42
+ });
43
+
44
+ const server = app.listen(3000, () => {
45
+ console.log("Audit server running on http://localhost:3000");
46
+ console.log("Endpoints:");
47
+ console.log(" - GET /artifacts");
48
+ console.log(" - GET /lineage/:id");
49
+ console.log(" - GET /verify/:id");
50
+
51
+ // Shut down gracefully after 5 seconds since it's just a demo
52
+ setTimeout(() => {
53
+ console.log("Shutting down demo server...");
54
+ server.close();
55
+ }, 5000);
56
+ });
57
+ }
58
+
59
+ run().catch(console.error);