@shelby-protocol/s3-gateway 0.1.0
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/bin/entry.js +38 -0
- package/package.json +43 -0
package/bin/entry.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// src/entry.ts
|
|
2
|
+
import { serve } from "@hono/node-server";
|
|
3
|
+
|
|
4
|
+
// src/app.ts
|
|
5
|
+
import { Hono } from "hono";
|
|
6
|
+
var app = new Hono();
|
|
7
|
+
app.get("/health", (c) => c.json({ status: "ok" }));
|
|
8
|
+
|
|
9
|
+
// src/entry.ts
|
|
10
|
+
var PORT = Number(process.env.PORT) || 9e3;
|
|
11
|
+
var server = serve(
|
|
12
|
+
{
|
|
13
|
+
fetch: app.fetch,
|
|
14
|
+
port: PORT
|
|
15
|
+
},
|
|
16
|
+
(info) => {
|
|
17
|
+
console.log(`S3 Gateway is running on http://localhost:${info.port}`);
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
function gracefulShutdown(signal) {
|
|
21
|
+
console.log(`
|
|
22
|
+
Received ${signal}, shutting down gracefully...`);
|
|
23
|
+
try {
|
|
24
|
+
server.close(() => {
|
|
25
|
+
console.log("HTTP server closed");
|
|
26
|
+
process.exit(0);
|
|
27
|
+
});
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
console.error("Forced shutdown after timeout");
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}, 1e4);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error("Error during shutdown:", error);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
process.on("SIGINT", () => gracefulShutdown("SIGINT"));
|
|
38
|
+
process.on("SIGTERM", () => gracefulShutdown("SIGTERM"));
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shelby-protocol/s3-gateway",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"private": false,
|
|
6
|
+
"bin": {
|
|
7
|
+
"s3-gateway": "bin/entry.js"
|
|
8
|
+
},
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin/entry.js"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@aptos-labs/ts-sdk": "^5.1.1",
|
|
17
|
+
"@hono/node-server": "^1.14.1",
|
|
18
|
+
"dotenv": "^16.6.1",
|
|
19
|
+
"fast-xml-parser": "^5.0.9",
|
|
20
|
+
"hono": "^4.7.7",
|
|
21
|
+
"pino": "^9.7.0",
|
|
22
|
+
"pino-pretty": "^13.0.0",
|
|
23
|
+
"zod": "^3.24.3",
|
|
24
|
+
"@shelby-protocol/sdk": "0.0.8"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^20.11.17",
|
|
28
|
+
"rimraf": "^6",
|
|
29
|
+
"tsup": "^8.4.0",
|
|
30
|
+
"tsx": "^4.19.4",
|
|
31
|
+
"typescript": "^5.8.3",
|
|
32
|
+
"vitest": "^3.1.2"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"dev": "tsx watch src/entry.ts",
|
|
36
|
+
"build": "tsc --noEmit && (rimraf dist; rimraf bin; tsup)",
|
|
37
|
+
"start": "node bin/entry.js",
|
|
38
|
+
"lint": "biome check .",
|
|
39
|
+
"fmt": "biome check . --write",
|
|
40
|
+
"test": "vitest dev",
|
|
41
|
+
"test:once": "vitest run --reporter=verbose"
|
|
42
|
+
}
|
|
43
|
+
}
|