@kopai/app 0.13.2 → 0.14.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/dist/cli.cjs +5 -11
- package/dist/cli.mjs +3 -7
- package/dist/cli.mjs.map +1 -1
- package/dist/client/client/.vite/manifest.json +2 -2
- package/dist/client/client/assets/index-CAx44wZh.css +2 -0
- package/dist/client/client/assets/index-DxpYPShU.js +89 -0
- package/dist/client/client/index.html +2 -2
- package/dist/{config-CJN47Wnk.mjs → config-Cx5QQs70.mjs} +4 -6
- package/dist/{config-CJN47Wnk.mjs.map → config-Cx5QQs70.mjs.map} +1 -1
- package/dist/{config-CMlIhysM.cjs → config-KcIyRQ0l.cjs} +19 -27
- package/dist/index.cjs +3 -4
- package/dist/index.mjs +2 -3
- package/dist/{server-ohEBbu4C.cjs → server-C94SGXdN.cjs} +7 -9
- package/dist/{server-CkUYVGfE.mjs → server-K-NclWLG.mjs} +8 -9
- package/dist/server-K-NclWLG.mjs.map +1 -0
- package/package.json +11 -11
- package/dist/client/client/assets/index-Bi30UJkM.js +0 -91
- package/dist/client/client/assets/index-DWxQizg_.css +0 -1
- package/dist/server-CkUYVGfE.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-DxpYPShU.js"></script>
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CAx44wZh.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="root"></div>
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
-
|
|
3
2
|
//#region src/config.ts
|
|
4
3
|
const DEFAULT_PORT = 8e3;
|
|
5
|
-
const
|
|
4
|
+
const env = z.object({
|
|
6
5
|
NODE_ENV: z.string().optional(),
|
|
7
6
|
HOST: z.string().optional(),
|
|
8
7
|
SQLITE_DB_FILE_PATH: z.string().default(":memory:"),
|
|
9
8
|
PORT: z.string().optional().transform((val) => val ? parseInt(val, 10) : DEFAULT_PORT)
|
|
10
|
-
});
|
|
11
|
-
const env = envSchema.parse(process.env);
|
|
12
|
-
|
|
9
|
+
}).parse(process.env);
|
|
13
10
|
//#endregion
|
|
14
11
|
export { env as t };
|
|
15
|
-
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=config-Cx5QQs70.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-
|
|
1
|
+
{"version":3,"file":"config-Cx5QQs70.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import z from \"zod\";\n\nconst DEFAULT_PORT = 8000;\n\nconst envSchema = z.object({\n NODE_ENV: z.string().optional(),\n HOST: z.string().optional(),\n SQLITE_DB_FILE_PATH: z.string().default(\":memory:\"),\n PORT: z\n .string()\n .optional()\n .transform((val) => (val ? parseInt(val, 10) : DEFAULT_PORT)),\n});\n\nexport const env = envSchema.parse(process.env);\n"],"mappings":";;AAEA,MAAM,eAAe;AAYrB,MAAa,MAVK,EAAE,OAAO;CACzB,UAAU,EAAE,QAAQ,CAAC,UAAU;CAC/B,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,qBAAqB,EAAE,QAAQ,CAAC,QAAQ,WAAW;CACnD,MAAM,EACH,QAAQ,CACR,UAAU,CACV,WAAW,QAAS,MAAM,SAAS,KAAK,GAAG,GAAG,aAAc;CAChE,CAAC,CAE2B,MAAM,QAAQ,IAAI"}
|
|
@@ -6,16 +6,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
19
15
|
}
|
|
20
16
|
return to;
|
|
21
17
|
};
|
|
@@ -23,31 +19,27 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
19
|
value: mod,
|
|
24
20
|
enumerable: true
|
|
25
21
|
}) : target, mod));
|
|
26
|
-
|
|
27
22
|
//#endregion
|
|
28
23
|
let zod = require("zod");
|
|
29
24
|
zod = __toESM(zod);
|
|
30
|
-
|
|
31
25
|
//#region src/config.ts
|
|
32
26
|
const DEFAULT_PORT = 8e3;
|
|
33
|
-
const
|
|
27
|
+
const env = zod.default.object({
|
|
34
28
|
NODE_ENV: zod.default.string().optional(),
|
|
35
29
|
HOST: zod.default.string().optional(),
|
|
36
30
|
SQLITE_DB_FILE_PATH: zod.default.string().default(":memory:"),
|
|
37
31
|
PORT: zod.default.string().optional().transform((val) => val ? parseInt(val, 10) : DEFAULT_PORT)
|
|
38
|
-
});
|
|
39
|
-
const env = envSchema.parse(process.env);
|
|
40
|
-
|
|
32
|
+
}).parse(process.env);
|
|
41
33
|
//#endregion
|
|
42
|
-
Object.defineProperty(exports,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
Object.defineProperty(exports, "__toESM", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function() {
|
|
37
|
+
return __toESM;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "env", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function() {
|
|
43
|
+
return env;
|
|
44
|
+
}
|
|
47
45
|
});
|
|
48
|
-
Object.defineProperty(exports, 'env', {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return env;
|
|
52
|
-
}
|
|
53
|
-
});
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
2
|
-
const require_config = require(
|
|
3
|
-
|
|
4
|
-
exports.env = require_config.env;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_config = require("./config-KcIyRQ0l.cjs");
|
|
3
|
+
exports.env = require_config.env;
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { t as env } from "./config-
|
|
2
|
-
|
|
3
|
-
export { env };
|
|
1
|
+
import { t as env } from "./config-Cx5QQs70.mjs";
|
|
2
|
+
export { env };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_config = require(
|
|
2
|
-
const require_cli = require(
|
|
1
|
+
const require_config = require("./config-KcIyRQ0l.cjs");
|
|
2
|
+
const require_cli = require("./cli.cjs");
|
|
3
3
|
let node_module = require("node:module");
|
|
4
4
|
let fastify = require("fastify");
|
|
5
5
|
fastify = require_config.__toESM(fastify);
|
|
@@ -20,7 +20,6 @@ let node_url = require("node:url");
|
|
|
20
20
|
let _fastify_vite = require("@fastify/vite");
|
|
21
21
|
_fastify_vite = require_config.__toESM(_fastify_vite);
|
|
22
22
|
let node_os = require("node:os");
|
|
23
|
-
|
|
24
23
|
//#region src/routes/index.ts
|
|
25
24
|
const promptInstructions = (0, _kopai_ui.generatePromptInstructions)(_kopai_ui.observabilityCatalog, (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("@kopai/ui/package.json").version);
|
|
26
25
|
const apiRoutes = async function(fastify, opts) {
|
|
@@ -30,13 +29,14 @@ const apiRoutes = async function(fastify, opts) {
|
|
|
30
29
|
promptInstructions
|
|
31
30
|
});
|
|
32
31
|
};
|
|
33
|
-
|
|
34
32
|
//#endregion
|
|
35
33
|
//#region src/collector/index.ts
|
|
36
34
|
const otelCollectorRoutes = async function(fastify, opts) {
|
|
37
|
-
fastify.register(_kopai_collector.collectorRoutes,
|
|
35
|
+
fastify.register(_kopai_collector.collectorRoutes, {
|
|
36
|
+
...opts,
|
|
37
|
+
ingestionMetricsDatasource: opts.telemetryDatasource
|
|
38
|
+
});
|
|
38
39
|
};
|
|
39
|
-
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/startup-banner.ts
|
|
42
42
|
const isTTY = process.stdout.isTTY;
|
|
@@ -90,7 +90,6 @@ function printStartupBanner({ host, port, collectorPort, version }) {
|
|
|
90
90
|
lines.push("");
|
|
91
91
|
console.log(lines.join("\n"));
|
|
92
92
|
}
|
|
93
|
-
|
|
94
93
|
//#endregion
|
|
95
94
|
//#region src/server.ts
|
|
96
95
|
const __dirname$1 = (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
@@ -222,5 +221,4 @@ run().catch((err) => {
|
|
|
222
221
|
sqliteDatabase?.close();
|
|
223
222
|
await apiServer.close();
|
|
224
223
|
});
|
|
225
|
-
|
|
226
|
-
//#endregion
|
|
224
|
+
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as env } from "./config-
|
|
1
|
+
import { t as env } from "./config-Cx5QQs70.mjs";
|
|
2
2
|
import { t as version } from "./cli.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import fastify from "fastify";
|
|
@@ -15,7 +15,6 @@ import { dirname, resolve } from "node:path";
|
|
|
15
15
|
import { fileURLToPath } from "node:url";
|
|
16
16
|
import FastifyVite from "@fastify/vite";
|
|
17
17
|
import { networkInterfaces } from "node:os";
|
|
18
|
-
|
|
19
18
|
//#region src/routes/index.ts
|
|
20
19
|
const promptInstructions = generatePromptInstructions(observabilityCatalog, createRequire(import.meta.url)("@kopai/ui/package.json").version);
|
|
21
20
|
const apiRoutes = async function(fastify, opts) {
|
|
@@ -25,13 +24,14 @@ const apiRoutes = async function(fastify, opts) {
|
|
|
25
24
|
promptInstructions
|
|
26
25
|
});
|
|
27
26
|
};
|
|
28
|
-
|
|
29
27
|
//#endregion
|
|
30
28
|
//#region src/collector/index.ts
|
|
31
29
|
const otelCollectorRoutes = async function(fastify, opts) {
|
|
32
|
-
fastify.register(collectorRoutes,
|
|
30
|
+
fastify.register(collectorRoutes, {
|
|
31
|
+
...opts,
|
|
32
|
+
ingestionMetricsDatasource: opts.telemetryDatasource
|
|
33
|
+
});
|
|
33
34
|
};
|
|
34
|
-
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/startup-banner.ts
|
|
37
37
|
const isTTY = process.stdout.isTTY;
|
|
@@ -85,7 +85,6 @@ function printStartupBanner({ host, port, collectorPort, version }) {
|
|
|
85
85
|
lines.push("");
|
|
86
86
|
console.log(lines.join("\n"));
|
|
87
87
|
}
|
|
88
|
-
|
|
89
88
|
//#endregion
|
|
90
89
|
//#region src/server.ts
|
|
91
90
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -217,7 +216,7 @@ closeWithGrace(async ({ signal, err }) => {
|
|
|
217
216
|
sqliteDatabase?.close();
|
|
218
217
|
await apiServer.close();
|
|
219
218
|
});
|
|
220
|
-
|
|
221
219
|
//#endregion
|
|
222
|
-
export {
|
|
223
|
-
|
|
220
|
+
export {};
|
|
221
|
+
|
|
222
|
+
//# sourceMappingURL=server-K-NclWLG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-K-NclWLG.mjs","names":[],"sources":["../src/routes/index.ts","../src/collector/index.ts","../src/startup-banner.ts","../src/server.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport { signalsRoutes, dashboardsRoutes } from \"@kopai/api\";\nimport { type datasource, type dashboardDatasource } from \"@kopai/core\";\nimport { generatePromptInstructions, observabilityCatalog } from \"@kopai/ui\";\n\nconst require = createRequire(import.meta.url);\nconst uiPkg = require(\"@kopai/ui/package.json\");\n\nconst promptInstructions = generatePromptInstructions(\n observabilityCatalog,\n uiPkg.version\n);\n\nexport const apiRoutes: FastifyPluginAsyncZod<{\n readTelemetryDatasource: datasource.ReadTelemetryDatasource;\n dynamicDashboardDatasource: dashboardDatasource.DynamicDashboardDatasource;\n}> = async function (fastify, opts) {\n fastify.register(signalsRoutes, {\n readTelemetryDatasource: opts.readTelemetryDatasource,\n });\n fastify.register(dashboardsRoutes, {\n dynamicDashboardDatasource: opts.dynamicDashboardDatasource,\n promptInstructions,\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, {\n ...opts,\n ingestionMetricsDatasource: opts.telemetryDatasource,\n });\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 DashboardDbDatasource,\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\nfunction hasComponentSchemas(\n doc: unknown\n): doc is { components: { schemas: Record<string, object> } } {\n return (\n typeof doc === \"object\" &&\n doc !== null &&\n \"components\" in doc &&\n typeof doc.components === \"object\" &&\n doc.components !== null &&\n \"schemas\" in doc.components &&\n typeof doc.components.schemas === \"object\" &&\n doc.components.schemas !== null\n );\n}\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: (input) => {\n const result = jsonSchemaTransformObject(input);\n // Fix: z.lazy() recursive schemas generate $ref to schema0\n // but fastify-type-provider-zod doesn't define it in components.\n // Inject the missing schema definition and rename schema0 → AttributeValue.\n const raw = JSON.stringify(result);\n const renamed = raw.replaceAll(\n \"#/components/schemas/schema0\",\n \"#/components/schemas/AttributeValue\"\n );\n const patched: unknown = JSON.parse(renamed);\n if (\n hasComponentSchemas(patched) &&\n !patched.components.schemas.AttributeValue\n ) {\n patched.components.schemas.AttributeValue = {\n anyOf: [\n { type: \"string\" },\n { type: \"number\" },\n { type: \"boolean\" },\n {\n type: \"array\",\n items: { $ref: \"#/components/schemas/AttributeValue\" },\n },\n {\n type: \"object\",\n additionalProperties: {\n $ref: \"#/components/schemas/AttributeValue\",\n },\n },\n ],\n };\n }\n return patched as ReturnType<typeof jsonSchemaTransformObject>;\n },\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);\nconst dashboardDatasource = new DashboardDbDatasource(sqliteDatabase);\n\napiServer.after(() => {\n apiServer.register(apiRoutes, {\n readTelemetryDatasource: telemetryDatasource,\n dynamicDashboardDatasource: dashboardDatasource,\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":";;;;;;;;;;;;;;;;;;AASA,MAAM,qBAAqB,2BACzB,sBAJc,cAAc,OAAO,KAAK,IAAI,CACxB,yBAAyB,CAIvC,QACP;AAED,MAAa,YAGR,eAAgB,SAAS,MAAM;AAClC,SAAQ,SAAS,eAAe,EAC9B,yBAAyB,KAAK,yBAC/B,CAAC;AACF,SAAQ,SAAS,kBAAkB;EACjC,4BAA4B,KAAK;EACjC;EACD,CAAC;;;;ACpBJ,MA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,OAAO;EAAE;EAAM;EAAM,CAAC;AACtC,OAAM,gBAAgB,OAAO;EAAE,MAAM;EAAe;EAAM,CAAC;AAE3D,oBAAmB;EAAE;EAAM;EAAM;EAAe;EAAS,CAAC;AAE1D,WAAU,IAAI,QAAQ;AACtB,iBAAgB,IAAI,QAAQ;;AAG9B,KAAK,CAAC,OAAO,QAAQ;AACnB,SAAQ,MAAM,IAAI;AAClB,SAAQ,KAAK,EAAE;EACf;AAEF,eAAe,OAAO,EAAE,QAAQ,UAAU;AACxC,KAAI,KAAK;AACP,kBAAgB,IAAI,MAClB,EAAE,KAAK,EACP,2CACD;AACD,YAAU,IAAI,MAAM,EAAE,KAAK,EAAE,gCAAgC;QACxD;AACL,kBAAgB,IAAI,KAClB,mBAAmB,OAAO,iCAC3B;AACD,YAAU,IAAI,KAAK,mBAAmB,OAAO,sBAAsB;;AAGrE,OAAM,gBAAgB,OAAO;AAC7B,iBAAgB,OAAO;AACvB,OAAM,UAAU,OAAO;EACvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kopai/app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Local OpenTelemetry backend for testing instrumentation - no Docker, no config, just npx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opentelemetry",
|
|
@@ -51,27 +51,27 @@
|
|
|
51
51
|
"@fastify/swagger": "^9.7.0",
|
|
52
52
|
"@fastify/swagger-ui": "^5.2.5",
|
|
53
53
|
"close-with-grace": "^2.5.0",
|
|
54
|
-
"fastify": "^5.
|
|
54
|
+
"fastify": "^5.8.2",
|
|
55
55
|
"fastify-type-provider-zod": "^6.1.0",
|
|
56
56
|
"zod": "^4.3.6",
|
|
57
|
-
"@kopai/api": "0.
|
|
58
|
-
"@kopai/collector": "0.
|
|
59
|
-
"@kopai/core": "0.
|
|
60
|
-
"@kopai/sqlite-datasource": "0.
|
|
61
|
-
"@kopai/ui": "0.
|
|
57
|
+
"@kopai/api": "0.6.0",
|
|
58
|
+
"@kopai/collector": "0.7.0",
|
|
59
|
+
"@kopai/core": "0.9.0",
|
|
60
|
+
"@kopai/sqlite-datasource": "0.11.0",
|
|
61
|
+
"@kopai/ui": "0.10.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@types/react": "^19.2.14",
|
|
65
65
|
"@types/react-dom": "^19.1.0",
|
|
66
|
-
"@vitejs/plugin-react": "^
|
|
66
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
67
67
|
"@tailwindcss/postcss": "^4.2.1",
|
|
68
|
-
"postcss": "^8.5.
|
|
68
|
+
"postcss": "^8.5.8",
|
|
69
69
|
"react": "^19.2.4",
|
|
70
70
|
"react-dom": "^19.2.4",
|
|
71
71
|
"tailwindcss": "^4.2.1",
|
|
72
|
-
"tsdown": "^0.
|
|
72
|
+
"tsdown": "^0.21.2",
|
|
73
73
|
"typescript": "^5.9.3",
|
|
74
|
-
"vite": "^
|
|
74
|
+
"vite": "^8.0.0",
|
|
75
75
|
"@kopai/tsconfig": "0.2.0"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|