@kopai/app 0.9.0 → 0.11.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/README.md +2 -0
- package/dist/cli.cjs +6 -1
- package/dist/cli.mjs +6 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/client/client/.vite/manifest.json +2 -2
- package/dist/client/client/assets/index-Cbcxtqpr.css +1 -0
- package/dist/client/client/assets/index-DRUTfSnp.js +56 -0
- package/dist/client/client/index.html +2 -2
- package/dist/{server-DTDkwqCT.cjs → server-C0Z3uYgw.cjs} +75 -27
- package/dist/{server-YFpVoJ3q.mjs → server-DOf6Bn7W.mjs} +76 -28
- package/dist/server-DOf6Bn7W.mjs.map +1 -0
- package/package.json +8 -8
- package/dist/client/client/assets/index-5oZTtMlU.js +0 -96
- package/dist/client/client/assets/index-C5X3Abtu.css +0 -1
- package/dist/server-YFpVoJ3q.mjs.map +0 -1
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
type="image/svg+xml"
|
|
10
10
|
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Crect width='32' height='32' rx='4' fill='%230a0a0a'/%3E%3Ctext x='3' y='22' font-family='ui-monospace,monospace' font-size='16' font-weight='400' fill='%23fafafa'%3Ek%3E%3C/text%3E%3C/svg%3E"
|
|
11
11
|
/>
|
|
12
|
-
<script type="module" crossorigin src="/assets/index-
|
|
13
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
12
|
+
<script type="module" crossorigin src="/assets/index-DRUTfSnp.js"></script>
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Cbcxtqpr.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="root"></div>
|
|
@@ -17,6 +17,7 @@ let node_path = require("node:path");
|
|
|
17
17
|
let node_url = require("node:url");
|
|
18
18
|
let _fastify_vite = require("@fastify/vite");
|
|
19
19
|
_fastify_vite = require_config.__toESM(_fastify_vite);
|
|
20
|
+
let node_os = require("node:os");
|
|
20
21
|
|
|
21
22
|
//#region src/routes/index.ts
|
|
22
23
|
const apiRoutes = async function(fastify, opts) {
|
|
@@ -29,10 +30,64 @@ const otelCollectorRoutes = async function(fastify, opts) {
|
|
|
29
30
|
fastify.register(_kopai_collector.collectorRoutes, opts);
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/startup-banner.ts
|
|
35
|
+
const isTTY = process.stdout.isTTY;
|
|
36
|
+
const bold = isTTY ? "\x1B[1m" : "";
|
|
37
|
+
const dim = isTTY ? "\x1B[2m" : "";
|
|
38
|
+
const green = isTTY ? "\x1B[32m" : "";
|
|
39
|
+
const cyan = isTTY ? "\x1B[36m" : "";
|
|
40
|
+
const reset = isTTY ? "\x1B[0m" : "";
|
|
41
|
+
function getNetworkAddress() {
|
|
42
|
+
const nets = (0, node_os.networkInterfaces)();
|
|
43
|
+
for (const interfaces of Object.values(nets)) {
|
|
44
|
+
if (!interfaces) continue;
|
|
45
|
+
for (const net of interfaces) if (net.family === "IPv4" && !net.internal) return net.address;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function printStartupBanner({ host, port, collectorPort, version }) {
|
|
49
|
+
const localHost = host === "0.0.0.0" || host === "::" ? "localhost" : host;
|
|
50
|
+
const networkAddress = getNetworkAddress();
|
|
51
|
+
const lines = [
|
|
52
|
+
"",
|
|
53
|
+
` ${bold}${green}|--k> @kopai/app${reset} ${dim}v${version}${reset}`,
|
|
54
|
+
""
|
|
55
|
+
];
|
|
56
|
+
const rows = [
|
|
57
|
+
[
|
|
58
|
+
"Dashboard",
|
|
59
|
+
`http://${localHost}:${port}`,
|
|
60
|
+
""
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
"API Docs",
|
|
64
|
+
`http://${localHost}:${port}/documentation`,
|
|
65
|
+
"/documentation"
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
"Collector",
|
|
69
|
+
`http://${localHost}:${collectorPort}`,
|
|
70
|
+
""
|
|
71
|
+
]
|
|
72
|
+
];
|
|
73
|
+
const maxLocalLen = Math.max(...rows.map(([, url]) => url.length));
|
|
74
|
+
for (const [label, localUrl, path] of rows) {
|
|
75
|
+
const padded = localUrl.padEnd(maxLocalLen);
|
|
76
|
+
let line = ` ${green}▸${reset} ${bold}${label.padEnd(16)}${reset}${cyan}${padded}${reset}`;
|
|
77
|
+
if (networkAddress) {
|
|
78
|
+
const netUrl = `http://${networkAddress}:${label === "Collector" ? collectorPort : port}${path}`;
|
|
79
|
+
line += ` ${dim}${cyan}${netUrl}${reset}`;
|
|
80
|
+
}
|
|
81
|
+
lines.push(line);
|
|
82
|
+
}
|
|
83
|
+
lines.push("");
|
|
84
|
+
console.log(lines.join("\n"));
|
|
85
|
+
}
|
|
86
|
+
|
|
32
87
|
//#endregion
|
|
33
88
|
//#region src/server.ts
|
|
34
89
|
const __dirname$1 = (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
35
|
-
const apiServer = (0, fastify.default)({ logger:
|
|
90
|
+
const apiServer = (0, fastify.default)({ logger: { level: "warn" } });
|
|
36
91
|
apiServer.setValidatorCompiler(fastify_type_provider_zod.validatorCompiler);
|
|
37
92
|
apiServer.setSerializerCompiler(fastify_type_provider_zod.serializerCompiler);
|
|
38
93
|
const uiRoutes = ["/", "/*"];
|
|
@@ -90,46 +145,39 @@ apiServer.after(() => {
|
|
|
90
145
|
await fastify$2.vite.ready();
|
|
91
146
|
});
|
|
92
147
|
});
|
|
93
|
-
const collectorServer = (0, fastify.default)({ logger:
|
|
148
|
+
const collectorServer = (0, fastify.default)({ logger: { level: "warn" } });
|
|
94
149
|
collectorServer.setValidatorCompiler(fastify_type_provider_zod.validatorCompiler);
|
|
95
150
|
collectorServer.setSerializerCompiler(fastify_type_provider_zod.serializerCompiler);
|
|
96
151
|
collectorServer.after(() => {
|
|
97
152
|
collectorServer.register(otelCollectorRoutes, { telemetryDatasource });
|
|
98
153
|
});
|
|
99
154
|
async function run() {
|
|
100
|
-
console.log(`|--k> @kopai/app v${require_cli.version}\n\n`);
|
|
101
155
|
await apiServer.ready();
|
|
156
|
+
await collectorServer.ready();
|
|
102
157
|
const host = require_config.env.HOST || "localhost";
|
|
103
158
|
const port = require_config.env.PORT;
|
|
104
|
-
const
|
|
105
|
-
apiServer.listen({
|
|
159
|
+
const collectorPort = 4318;
|
|
160
|
+
await apiServer.listen({
|
|
106
161
|
port,
|
|
107
|
-
host
|
|
108
|
-
listenTextResolver(address) {
|
|
109
|
-
return `API server listening at ${address}`;
|
|
110
|
-
}
|
|
111
|
-
}, (err, address) => {
|
|
112
|
-
if (err) {
|
|
113
|
-
console.error(err);
|
|
114
|
-
process.exit(1);
|
|
115
|
-
}
|
|
116
|
-
apiServer.log.info(`API server documentation available at ${address}/documentation`);
|
|
162
|
+
host
|
|
117
163
|
});
|
|
118
|
-
await collectorServer.
|
|
119
|
-
|
|
120
|
-
|
|
164
|
+
await collectorServer.listen({
|
|
165
|
+
port: collectorPort,
|
|
166
|
+
host
|
|
167
|
+
});
|
|
168
|
+
printStartupBanner({
|
|
121
169
|
host,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}, (err) => {
|
|
126
|
-
if (err) {
|
|
127
|
-
console.error(err);
|
|
128
|
-
process.exit(1);
|
|
129
|
-
}
|
|
170
|
+
port,
|
|
171
|
+
collectorPort,
|
|
172
|
+
version: require_cli.version
|
|
130
173
|
});
|
|
174
|
+
apiServer.log.level = "info";
|
|
175
|
+
collectorServer.log.level = "info";
|
|
131
176
|
}
|
|
132
|
-
run()
|
|
177
|
+
run().catch((err) => {
|
|
178
|
+
console.error(err);
|
|
179
|
+
process.exit(1);
|
|
180
|
+
});
|
|
133
181
|
(0, close_with_grace.default)(async ({ signal, err }) => {
|
|
134
182
|
if (err) {
|
|
135
183
|
collectorServer.log.fatal({ err }, "Closing OTEL collector server with error");
|
|
@@ -12,6 +12,7 @@ import { createOptimizedDatasource, initializeDatabase } from "@kopai/sqlite-dat
|
|
|
12
12
|
import { dirname, resolve } from "node:path";
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
14
|
import FastifyVite from "@fastify/vite";
|
|
15
|
+
import { networkInterfaces } from "node:os";
|
|
15
16
|
|
|
16
17
|
//#region src/routes/index.ts
|
|
17
18
|
const apiRoutes = async function(fastify, opts) {
|
|
@@ -24,10 +25,64 @@ const otelCollectorRoutes = async function(fastify, opts) {
|
|
|
24
25
|
fastify.register(collectorRoutes, opts);
|
|
25
26
|
};
|
|
26
27
|
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/startup-banner.ts
|
|
30
|
+
const isTTY = process.stdout.isTTY;
|
|
31
|
+
const bold = isTTY ? "\x1B[1m" : "";
|
|
32
|
+
const dim = isTTY ? "\x1B[2m" : "";
|
|
33
|
+
const green = isTTY ? "\x1B[32m" : "";
|
|
34
|
+
const cyan = isTTY ? "\x1B[36m" : "";
|
|
35
|
+
const reset = isTTY ? "\x1B[0m" : "";
|
|
36
|
+
function getNetworkAddress() {
|
|
37
|
+
const nets = networkInterfaces();
|
|
38
|
+
for (const interfaces of Object.values(nets)) {
|
|
39
|
+
if (!interfaces) continue;
|
|
40
|
+
for (const net of interfaces) if (net.family === "IPv4" && !net.internal) return net.address;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function printStartupBanner({ host, port, collectorPort, version }) {
|
|
44
|
+
const localHost = host === "0.0.0.0" || host === "::" ? "localhost" : host;
|
|
45
|
+
const networkAddress = getNetworkAddress();
|
|
46
|
+
const lines = [
|
|
47
|
+
"",
|
|
48
|
+
` ${bold}${green}|--k> @kopai/app${reset} ${dim}v${version}${reset}`,
|
|
49
|
+
""
|
|
50
|
+
];
|
|
51
|
+
const rows = [
|
|
52
|
+
[
|
|
53
|
+
"Dashboard",
|
|
54
|
+
`http://${localHost}:${port}`,
|
|
55
|
+
""
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
"API Docs",
|
|
59
|
+
`http://${localHost}:${port}/documentation`,
|
|
60
|
+
"/documentation"
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
"Collector",
|
|
64
|
+
`http://${localHost}:${collectorPort}`,
|
|
65
|
+
""
|
|
66
|
+
]
|
|
67
|
+
];
|
|
68
|
+
const maxLocalLen = Math.max(...rows.map(([, url]) => url.length));
|
|
69
|
+
for (const [label, localUrl, path] of rows) {
|
|
70
|
+
const padded = localUrl.padEnd(maxLocalLen);
|
|
71
|
+
let line = ` ${green}▸${reset} ${bold}${label.padEnd(16)}${reset}${cyan}${padded}${reset}`;
|
|
72
|
+
if (networkAddress) {
|
|
73
|
+
const netUrl = `http://${networkAddress}:${label === "Collector" ? collectorPort : port}${path}`;
|
|
74
|
+
line += ` ${dim}${cyan}${netUrl}${reset}`;
|
|
75
|
+
}
|
|
76
|
+
lines.push(line);
|
|
77
|
+
}
|
|
78
|
+
lines.push("");
|
|
79
|
+
console.log(lines.join("\n"));
|
|
80
|
+
}
|
|
81
|
+
|
|
27
82
|
//#endregion
|
|
28
83
|
//#region src/server.ts
|
|
29
84
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
30
|
-
const apiServer = fastify({ logger:
|
|
85
|
+
const apiServer = fastify({ logger: { level: "warn" } });
|
|
31
86
|
apiServer.setValidatorCompiler(validatorCompiler);
|
|
32
87
|
apiServer.setSerializerCompiler(serializerCompiler);
|
|
33
88
|
const uiRoutes = ["/", "/*"];
|
|
@@ -85,46 +140,39 @@ apiServer.after(() => {
|
|
|
85
140
|
await fastify.vite.ready();
|
|
86
141
|
});
|
|
87
142
|
});
|
|
88
|
-
const collectorServer = fastify({ logger:
|
|
143
|
+
const collectorServer = fastify({ logger: { level: "warn" } });
|
|
89
144
|
collectorServer.setValidatorCompiler(validatorCompiler);
|
|
90
145
|
collectorServer.setSerializerCompiler(serializerCompiler);
|
|
91
146
|
collectorServer.after(() => {
|
|
92
147
|
collectorServer.register(otelCollectorRoutes, { telemetryDatasource });
|
|
93
148
|
});
|
|
94
149
|
async function run() {
|
|
95
|
-
console.log(`|--k> @kopai/app v${version}\n\n`);
|
|
96
150
|
await apiServer.ready();
|
|
151
|
+
await collectorServer.ready();
|
|
97
152
|
const host = env.HOST || "localhost";
|
|
98
153
|
const port = env.PORT;
|
|
99
|
-
const
|
|
100
|
-
apiServer.listen({
|
|
154
|
+
const collectorPort = 4318;
|
|
155
|
+
await apiServer.listen({
|
|
101
156
|
port,
|
|
102
|
-
host
|
|
103
|
-
listenTextResolver(address) {
|
|
104
|
-
return `API server listening at ${address}`;
|
|
105
|
-
}
|
|
106
|
-
}, (err, address) => {
|
|
107
|
-
if (err) {
|
|
108
|
-
console.error(err);
|
|
109
|
-
process.exit(1);
|
|
110
|
-
}
|
|
111
|
-
apiServer.log.info(`API server documentation available at ${address}/documentation`);
|
|
157
|
+
host
|
|
112
158
|
});
|
|
113
|
-
await collectorServer.
|
|
114
|
-
|
|
115
|
-
|
|
159
|
+
await collectorServer.listen({
|
|
160
|
+
port: collectorPort,
|
|
161
|
+
host
|
|
162
|
+
});
|
|
163
|
+
printStartupBanner({
|
|
116
164
|
host,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}, (err) => {
|
|
121
|
-
if (err) {
|
|
122
|
-
console.error(err);
|
|
123
|
-
process.exit(1);
|
|
124
|
-
}
|
|
165
|
+
port,
|
|
166
|
+
collectorPort,
|
|
167
|
+
version
|
|
125
168
|
});
|
|
169
|
+
apiServer.log.level = "info";
|
|
170
|
+
collectorServer.log.level = "info";
|
|
126
171
|
}
|
|
127
|
-
run()
|
|
172
|
+
run().catch((err) => {
|
|
173
|
+
console.error(err);
|
|
174
|
+
process.exit(1);
|
|
175
|
+
});
|
|
128
176
|
closeWithGrace(async ({ signal, err }) => {
|
|
129
177
|
if (err) {
|
|
130
178
|
collectorServer.log.fatal({ err }, "Closing OTEL collector server with error");
|
|
@@ -140,4 +188,4 @@ closeWithGrace(async ({ signal, err }) => {
|
|
|
140
188
|
|
|
141
189
|
//#endregion
|
|
142
190
|
export { };
|
|
143
|
-
//# sourceMappingURL=server-
|
|
191
|
+
//# sourceMappingURL=server-DOf6Bn7W.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-DOf6Bn7W.mjs","names":[],"sources":["../src/routes/index.ts","../src/collector/index.ts","../src/startup-banner.ts","../src/server.ts"],"sourcesContent":["import type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport { signalsRoutes } from \"@kopai/api\";\nimport { type datasource } from \"@kopai/core\";\n\nexport const apiRoutes: FastifyPluginAsyncZod<{\n readTelemetryDatasource: datasource.ReadTelemetryDatasource;\n}> = async function (fastify, opts) {\n fastify.register(signalsRoutes, {\n readTelemetryDatasource: opts.readTelemetryDatasource,\n });\n};\n","import type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport { collectorRoutes } from \"@kopai/collector\";\nimport type { datasource } from \"@kopai/core\";\n\nexport const otelCollectorRoutes: FastifyPluginAsyncZod<{\n telemetryDatasource: datasource.WriteTelemetryDatasource;\n}> = async function (fastify, opts) {\n fastify.register(collectorRoutes, opts);\n};\n","import { networkInterfaces } from \"node:os\";\n\nconst isTTY = process.stdout.isTTY;\nconst bold = isTTY ? \"\\x1b[1m\" : \"\";\nconst dim = isTTY ? \"\\x1b[2m\" : \"\";\nconst green = isTTY ? \"\\x1b[32m\" : \"\";\nconst cyan = isTTY ? \"\\x1b[36m\" : \"\";\nconst reset = isTTY ? \"\\x1b[0m\" : \"\";\n\nfunction getNetworkAddress(): string | undefined {\n const nets = networkInterfaces();\n for (const interfaces of Object.values(nets)) {\n if (!interfaces) continue;\n for (const net of interfaces) {\n if (net.family === \"IPv4\" && !net.internal) {\n return net.address;\n }\n }\n }\n return undefined;\n}\n\nexport function printStartupBanner({\n host,\n port,\n collectorPort,\n version,\n}: {\n host: string;\n port: number;\n collectorPort: number;\n version: string;\n}) {\n const localHost = host === \"0.0.0.0\" || host === \"::\" ? \"localhost\" : host;\n const networkAddress = getNetworkAddress();\n\n const lines: string[] = [\n \"\",\n ` ${bold}${green}|--k> @kopai/app${reset} ${dim}v${version}${reset}`,\n \"\",\n ];\n\n const rows: [string, string, string][] = [\n [\"Dashboard\", `http://${localHost}:${port}`, \"\"],\n [\"API Docs\", `http://${localHost}:${port}/documentation`, \"/documentation\"],\n [\"Collector\", `http://${localHost}:${collectorPort}`, \"\"],\n ];\n\n const maxLocalLen = Math.max(...rows.map(([, url]) => url.length));\n\n for (const [label, localUrl, path] of rows) {\n const padded = localUrl.padEnd(maxLocalLen);\n let line = ` ${green}▸${reset} ${bold}${label.padEnd(16)}${reset}${cyan}${padded}${reset}`;\n if (networkAddress) {\n const netPort = label === \"Collector\" ? collectorPort : port;\n const netUrl = `http://${networkAddress}:${netPort}${path}`;\n line += ` ${dim}${cyan}${netUrl}${reset}`;\n }\n lines.push(line);\n }\n\n lines.push(\"\");\n console.log(lines.join(\"\\n\"));\n}\n","import fastify from \"fastify\";\nimport {\n jsonSchemaTransformObject,\n jsonSchemaTransform,\n serializerCompiler,\n validatorCompiler,\n} from \"fastify-type-provider-zod\";\nimport fastifySwagger from \"@fastify/swagger\";\nimport fastifySwaggerUI from \"@fastify/swagger-ui\";\nimport closeWithGrace from \"close-with-grace\";\n\nimport { env } from \"./config.js\";\nimport { version } from \"./version.js\";\nimport { apiRoutes } from \"./routes/index.js\";\nimport { otelCollectorRoutes } from \"./collector/index.js\";\nimport {\n initializeDatabase,\n createOptimizedDatasource,\n} from \"@kopai/sqlite-datasource\";\nimport { resolve, dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport FastifyVite from \"@fastify/vite\";\nimport { printStartupBanner } from \"./startup-banner.js\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst apiServer = fastify({\n logger: { level: \"warn\" },\n});\n\n// Add schema validator and serializer\napiServer.setValidatorCompiler(validatorCompiler);\napiServer.setSerializerCompiler(serializerCompiler);\n\nconst uiRoutes = [\"/\", \"/*\"];\napiServer.register(fastifySwagger, {\n openapi: {\n info: {\n title: \"Kopai App\",\n description: \"Kopai App documentation\",\n version,\n },\n servers: [],\n },\n transform: ({ schema, url, ...rest }) => {\n if (uiRoutes.includes(url)) return { schema: { hide: true }, url };\n return jsonSchemaTransform({ schema, url, ...rest });\n },\n transformObject: jsonSchemaTransformObject,\n});\n\napiServer.register(fastifySwaggerUI, {\n routePrefix: \"/documentation\",\n logo: {\n type: \"image/svg+xml\",\n content: Buffer.from(\n \"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNjAgNDAiIGZpbGw9Im5vbmUiPjx0ZXh0IHg9IjAiIHk9IjI4IiBmb250LWZhbWlseT0idWktbW9ub3NwYWNlLCBtb25vc3BhY2UiIGZvbnQtc2l6ZT0iMjAiIGZvbnQtd2VpZ2h0PSI0MDAiIGZpbGw9IiNmYWZhZmEiPnwtLWsmZ3Q7IGtvcGFpPC90ZXh0Pjwvc3ZnPg==\",\n \"base64\"\n ),\n href: \"/documentation\",\n target: \"_blank\",\n },\n theme: {\n favicon: [\n {\n filename: \"favicon.svg\",\n rel: \"icon\",\n sizes: \"32x32\",\n type: \"image/svg+xml\",\n content: Buffer.from(\n \"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSI+PHJlY3Qgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiByeD0iNCIgZmlsbD0iIzBhMGEwYSIvPjx0ZXh0IHg9IjMiIHk9IjIyIiBmb250LWZhbWlseT0idWktbW9ub3NwYWNlLCBtb25vc3BhY2UiIGZvbnQtc2l6ZT0iMTYiIGZvbnQtd2VpZ2h0PSI0MDAiIGZpbGw9IiNmYWZhZmEiPmsmZ3Q7PC90ZXh0Pjwvc3ZnPg==\",\n \"base64\"\n ),\n },\n ],\n },\n});\n\nconst sqliteDatabase = initializeDatabase(env.SQLITE_DB_FILE_PATH);\nconst telemetryDatasource = createOptimizedDatasource(sqliteDatabase);\n\napiServer.after(() => {\n apiServer.register(apiRoutes, {\n readTelemetryDatasource: telemetryDatasource,\n });\n apiServer.register(async (fastify) => {\n await fastify.register(FastifyVite, {\n root: resolve(__dirname, \"..\"),\n distDir: \"dist\",\n dev: false,\n spa: true,\n });\n fastify.get(\"/\", (_req, reply) => reply.html());\n fastify.get(\"/*\", (_req, reply) => reply.html());\n await fastify.vite.ready();\n });\n});\n\nconst collectorServer = fastify({\n logger: { level: \"warn\" },\n});\n\ncollectorServer.setValidatorCompiler(validatorCompiler);\ncollectorServer.setSerializerCompiler(serializerCompiler);\n\ncollectorServer.after(() => {\n collectorServer.register(otelCollectorRoutes, {\n telemetryDatasource,\n });\n});\n\nasync function run() {\n await apiServer.ready();\n await collectorServer.ready();\n\n const host = env.HOST || \"localhost\";\n const port = env.PORT;\n const collectorPort = 4318;\n\n await apiServer.listen({ port, host });\n await collectorServer.listen({ port: collectorPort, host });\n\n printStartupBanner({ host, port, collectorPort, version });\n\n apiServer.log.level = \"info\";\n collectorServer.log.level = \"info\";\n}\n\nrun().catch((err) => {\n console.error(err);\n process.exit(1);\n});\n\ncloseWithGrace(async ({ signal, err }) => {\n if (err) {\n collectorServer.log.fatal(\n { err },\n \"Closing OTEL collector server with error\"\n );\n apiServer.log.fatal({ err }, \"Closing API server with error\");\n } else {\n collectorServer.log.info(\n `Received signal ${signal}, closing OTEL collector server`\n );\n apiServer.log.info(`Received signal ${signal}, closing API server`);\n }\n\n await collectorServer.close();\n sqliteDatabase?.close();\n await apiServer.close();\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAIA,MAAa,YAER,eAAgB,SAAS,MAAM;AAClC,SAAQ,SAAS,eAAe,EAC9B,yBAAyB,KAAK,yBAC/B,CAAC;;;;;ACLJ,MAAa,s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version": "0.11.0",
|
|
4
4
|
"description": "Local OpenTelemetry backend for testing instrumentation - no Docker, no config, just npx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opentelemetry",
|
|
@@ -55,23 +55,23 @@
|
|
|
55
55
|
"fastify-type-provider-zod": "^6.1.0",
|
|
56
56
|
"zod": "^4.3.6",
|
|
57
57
|
"@kopai/api": "0.2.3",
|
|
58
|
-
"@kopai/collector": "0.
|
|
58
|
+
"@kopai/collector": "0.5.0",
|
|
59
59
|
"@kopai/core": "0.5.0",
|
|
60
60
|
"@kopai/sqlite-datasource": "0.6.0",
|
|
61
|
-
"@kopai/ui": "0.
|
|
61
|
+
"@kopai/ui": "0.3.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@types/react": "^19.2.
|
|
64
|
+
"@types/react": "^19.2.14",
|
|
65
65
|
"@types/react-dom": "^19.1.0",
|
|
66
|
-
"@vitejs/plugin-react": "^
|
|
67
|
-
"
|
|
66
|
+
"@vitejs/plugin-react": "^5.1.4",
|
|
67
|
+
"@tailwindcss/postcss": "^4.1.18",
|
|
68
68
|
"postcss": "^8.5.3",
|
|
69
69
|
"react": "^19.2.4",
|
|
70
70
|
"react-dom": "^19.2.4",
|
|
71
|
-
"tailwindcss": "^
|
|
71
|
+
"tailwindcss": "^4.1.18",
|
|
72
72
|
"tsdown": "^0.20.3",
|
|
73
73
|
"typescript": "^5.9.3",
|
|
74
|
-
"vite": "^
|
|
74
|
+
"vite": "^7.3.1",
|
|
75
75
|
"@kopai/tsconfig": "0.2.0"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|