@kopai/api 0.4.0 → 0.6.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/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -7,16 +7,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
20
16
  }
21
17
  return to;
22
18
  };
@@ -24,7 +20,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
20
  value: mod,
25
21
  enumerable: true
26
22
  }) : target, mod));
27
-
28
23
  //#endregion
29
24
  let _kopai_core = require("@kopai/core");
30
25
  let fastify_type_provider_zod = require("fastify-type-provider-zod");
@@ -32,7 +27,6 @@ require("fastify");
32
27
  let zod_v4 = require("zod/v4");
33
28
  let zod = require("zod");
34
29
  zod = __toESM(zod);
35
-
36
30
  //#region src/routes/errors.ts
37
31
  var ApiError = class extends Error {
38
32
  constructor(message, options) {
@@ -43,7 +37,6 @@ var ApiError = class extends Error {
43
37
  var DashboardNotFoundError = class extends ApiError {
44
38
  code = "DASHBOARD_NOT_FOUND";
45
39
  };
46
-
47
40
  //#endregion
48
41
  //#region src/routes/error-handler.ts
49
42
  function errorHandler(error, request, reply) {
@@ -81,7 +74,6 @@ function isFastifyError(error) {
81
74
  function isClientError(error) {
82
75
  return isFastifyError(error) && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500;
83
76
  }
84
-
85
77
  //#endregion
86
78
  //#region src/routes/error-schema-zod.ts
87
79
  const problemDetailsSchema = zod.default.object({
@@ -91,7 +83,6 @@ const problemDetailsSchema = zod.default.object({
91
83
  detail: zod.default.string().optional().describe("Human-readable explanation specific to this occurrence"),
92
84
  instance: zod.default.string().optional().describe("URI reference identifying this specific occurrence")
93
85
  });
94
-
95
86
  //#endregion
96
87
  //#region src/routes/traces.ts
97
88
  const tracesRoutes = async function(fastify, opts) {
@@ -139,8 +130,66 @@ const tracesRoutes = async function(fastify, opts) {
139
130
  res.send(result);
140
131
  }
141
132
  });
133
+ fastify.route({
134
+ method: "GET",
135
+ url: "/signals/services",
136
+ schema: {
137
+ description: "List distinct service names",
138
+ response: {
139
+ 200: zod_v4.z.object({ services: zod_v4.z.array(zod_v4.z.string()) }),
140
+ "4xx": problemDetailsSchema,
141
+ "5xx": problemDetailsSchema
142
+ }
143
+ },
144
+ handler: async (req, res) => {
145
+ const result = await opts.readTracesDatasource.getServices({ requestContext: req.requestContext });
146
+ res.send(result);
147
+ }
148
+ });
149
+ fastify.route({
150
+ method: "GET",
151
+ url: "/signals/traces/operations",
152
+ schema: {
153
+ description: "List distinct operations for a service",
154
+ querystring: zod_v4.z.object({ serviceName: zod_v4.z.string() }),
155
+ response: {
156
+ 200: zod_v4.z.object({ operations: zod_v4.z.array(zod_v4.z.string()) }),
157
+ "4xx": problemDetailsSchema,
158
+ "5xx": problemDetailsSchema
159
+ }
160
+ },
161
+ handler: async (req, res) => {
162
+ const result = await opts.readTracesDatasource.getOperations({
163
+ serviceName: req.query.serviceName,
164
+ requestContext: req.requestContext
165
+ });
166
+ res.send(result);
167
+ }
168
+ });
169
+ fastify.route({
170
+ method: "POST",
171
+ url: "/signals/traces/summaries",
172
+ schema: {
173
+ description: "Search trace summaries",
174
+ body: _kopai_core.dataFilterSchemas.traceSummariesFilterSchema,
175
+ response: {
176
+ 200: zod_v4.z.object({
177
+ data: zod_v4.z.array(_kopai_core.dataFilterSchemas.traceSummaryRowSchema),
178
+ nextCursor: zod_v4.z.string().nullable()
179
+ }),
180
+ "4xx": problemDetailsSchema,
181
+ "5xx": problemDetailsSchema
182
+ }
183
+ },
184
+ handler: async (req, res) => {
185
+ const result = await opts.readTracesDatasource.getTraceSummaries({
186
+ ...req.body,
187
+ requestContext: req.requestContext
188
+ });
189
+ res.send(result);
190
+ }
191
+ });
142
192
  };
143
-
144
193
  //#endregion
145
194
  //#region src/routes/logs.ts
146
195
  const logsRoutes = async function(fastify, opts) {
@@ -169,7 +218,6 @@ const logsRoutes = async function(fastify, opts) {
169
218
  }
170
219
  });
171
220
  };
172
-
173
221
  //#endregion
174
222
  //#region src/routes/metrics.ts
175
223
  const metricsRoutes = async function(fastify, opts) {
@@ -177,6 +225,10 @@ const metricsRoutes = async function(fastify, opts) {
177
225
  data: zod_v4.z.array(_kopai_core.denormalizedSignals.otelMetricsSchema),
178
226
  nextCursor: zod_v4.z.string().nullable()
179
227
  });
228
+ const aggregatedResponseSchema = zod_v4.z.object({
229
+ data: zod_v4.z.array(_kopai_core.denormalizedSignals.aggregatedMetricSchema),
230
+ nextCursor: zod_v4.z.null()
231
+ });
180
232
  fastify.route({
181
233
  method: "POST",
182
234
  url: "/signals/metrics/search",
@@ -184,16 +236,17 @@ const metricsRoutes = async function(fastify, opts) {
184
236
  description: "Search metrics matching a filter",
185
237
  body: _kopai_core.dataFilterSchemas.metricsDataFilterSchema,
186
238
  response: {
187
- 200: searchResponseSchema,
239
+ 200: zod_v4.z.union([searchResponseSchema, aggregatedResponseSchema]),
188
240
  "4xx": problemDetailsSchema,
189
241
  "5xx": problemDetailsSchema
190
242
  }
191
243
  },
192
244
  handler: async (req, res) => {
193
- const result = await opts.readMetricsDatasource.getMetrics({
245
+ const params = {
194
246
  ...req.body,
195
247
  requestContext: req.requestContext
196
- });
248
+ };
249
+ const result = req.body.aggregate ? await opts.readMetricsDatasource.getAggregatedMetrics(params) : await opts.readMetricsDatasource.getMetrics(params);
197
250
  res.send(result);
198
251
  }
199
252
  });
@@ -234,7 +287,6 @@ const discoveredMetricSchema = zod_v4.z.object({
234
287
  resourceAttributes: discoveredAttributesSchema.describe("Resource attributes aggregated across all data points.")
235
288
  });
236
289
  const metricsDiscoveryResponseSchema = zod_v4.z.object({ metrics: zod_v4.z.array(discoveredMetricSchema) });
237
-
238
290
  //#endregion
239
291
  //#region src/routes/dashboards.ts
240
292
  const dashboardsRoutes$1 = async function(fastify, opts) {
@@ -245,14 +297,8 @@ const dashboardsRoutes$1 = async function(fastify, opts) {
245
297
  description: "Get UI tree schema as markdown prompt instructions for AI agents",
246
298
  produces: ["text/markdown"],
247
299
  response: {
248
- 200: {
249
- type: "string",
250
- description: "Markdown prompt instructions"
251
- },
252
- 404: {
253
- type: "string",
254
- description: "Prompt instructions not configured"
255
- }
300
+ 200: zod_v4.z.string().describe("Markdown prompt instructions"),
301
+ 404: zod_v4.z.string().describe("Prompt instructions not configured")
256
302
  }
257
303
  },
258
304
  handler: async (_req, reply) => {
@@ -330,7 +376,6 @@ const dashboardsRoutes$1 = async function(fastify, opts) {
330
376
  }
331
377
  });
332
378
  };
333
-
334
379
  //#endregion
335
380
  //#region src/index.ts
336
381
  const signalsRoutes = async function(fastify, opts) {
@@ -350,7 +395,6 @@ const dashboardsRoutes = async function(fastify, opts) {
350
395
  promptInstructions: opts.promptInstructions
351
396
  });
352
397
  };
353
-
354
398
  //#endregion
355
399
  exports.dashboardsRoutes = dashboardsRoutes;
356
- exports.signalsRoutes = signalsRoutes;
400
+ exports.signalsRoutes = signalsRoutes;
package/dist/index.mjs CHANGED
@@ -3,7 +3,6 @@ import { serializerCompiler, validatorCompiler } from "fastify-type-provider-zod
3
3
  import "fastify";
4
4
  import { z } from "zod/v4";
5
5
  import z$1 from "zod";
6
-
7
6
  //#region src/routes/errors.ts
8
7
  var ApiError = class extends Error {
9
8
  constructor(message, options) {
@@ -14,7 +13,6 @@ var ApiError = class extends Error {
14
13
  var DashboardNotFoundError = class extends ApiError {
15
14
  code = "DASHBOARD_NOT_FOUND";
16
15
  };
17
-
18
16
  //#endregion
19
17
  //#region src/routes/error-handler.ts
20
18
  function errorHandler(error, request, reply) {
@@ -52,7 +50,6 @@ function isFastifyError(error) {
52
50
  function isClientError(error) {
53
51
  return isFastifyError(error) && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500;
54
52
  }
55
-
56
53
  //#endregion
57
54
  //#region src/routes/error-schema-zod.ts
58
55
  const problemDetailsSchema = z$1.object({
@@ -62,7 +59,6 @@ const problemDetailsSchema = z$1.object({
62
59
  detail: z$1.string().optional().describe("Human-readable explanation specific to this occurrence"),
63
60
  instance: z$1.string().optional().describe("URI reference identifying this specific occurrence")
64
61
  });
65
-
66
62
  //#endregion
67
63
  //#region src/routes/traces.ts
68
64
  const tracesRoutes = async function(fastify, opts) {
@@ -110,8 +106,66 @@ const tracesRoutes = async function(fastify, opts) {
110
106
  res.send(result);
111
107
  }
112
108
  });
109
+ fastify.route({
110
+ method: "GET",
111
+ url: "/signals/services",
112
+ schema: {
113
+ description: "List distinct service names",
114
+ response: {
115
+ 200: z.object({ services: z.array(z.string()) }),
116
+ "4xx": problemDetailsSchema,
117
+ "5xx": problemDetailsSchema
118
+ }
119
+ },
120
+ handler: async (req, res) => {
121
+ const result = await opts.readTracesDatasource.getServices({ requestContext: req.requestContext });
122
+ res.send(result);
123
+ }
124
+ });
125
+ fastify.route({
126
+ method: "GET",
127
+ url: "/signals/traces/operations",
128
+ schema: {
129
+ description: "List distinct operations for a service",
130
+ querystring: z.object({ serviceName: z.string() }),
131
+ response: {
132
+ 200: z.object({ operations: z.array(z.string()) }),
133
+ "4xx": problemDetailsSchema,
134
+ "5xx": problemDetailsSchema
135
+ }
136
+ },
137
+ handler: async (req, res) => {
138
+ const result = await opts.readTracesDatasource.getOperations({
139
+ serviceName: req.query.serviceName,
140
+ requestContext: req.requestContext
141
+ });
142
+ res.send(result);
143
+ }
144
+ });
145
+ fastify.route({
146
+ method: "POST",
147
+ url: "/signals/traces/summaries",
148
+ schema: {
149
+ description: "Search trace summaries",
150
+ body: dataFilterSchemas.traceSummariesFilterSchema,
151
+ response: {
152
+ 200: z.object({
153
+ data: z.array(dataFilterSchemas.traceSummaryRowSchema),
154
+ nextCursor: z.string().nullable()
155
+ }),
156
+ "4xx": problemDetailsSchema,
157
+ "5xx": problemDetailsSchema
158
+ }
159
+ },
160
+ handler: async (req, res) => {
161
+ const result = await opts.readTracesDatasource.getTraceSummaries({
162
+ ...req.body,
163
+ requestContext: req.requestContext
164
+ });
165
+ res.send(result);
166
+ }
167
+ });
113
168
  };
114
-
115
169
  //#endregion
116
170
  //#region src/routes/logs.ts
117
171
  const logsRoutes = async function(fastify, opts) {
@@ -140,7 +194,6 @@ const logsRoutes = async function(fastify, opts) {
140
194
  }
141
195
  });
142
196
  };
143
-
144
197
  //#endregion
145
198
  //#region src/routes/metrics.ts
146
199
  const metricsRoutes = async function(fastify, opts) {
@@ -148,6 +201,10 @@ const metricsRoutes = async function(fastify, opts) {
148
201
  data: z.array(denormalizedSignals.otelMetricsSchema),
149
202
  nextCursor: z.string().nullable()
150
203
  });
204
+ const aggregatedResponseSchema = z.object({
205
+ data: z.array(denormalizedSignals.aggregatedMetricSchema),
206
+ nextCursor: z.null()
207
+ });
151
208
  fastify.route({
152
209
  method: "POST",
153
210
  url: "/signals/metrics/search",
@@ -155,16 +212,17 @@ const metricsRoutes = async function(fastify, opts) {
155
212
  description: "Search metrics matching a filter",
156
213
  body: dataFilterSchemas.metricsDataFilterSchema,
157
214
  response: {
158
- 200: searchResponseSchema,
215
+ 200: z.union([searchResponseSchema, aggregatedResponseSchema]),
159
216
  "4xx": problemDetailsSchema,
160
217
  "5xx": problemDetailsSchema
161
218
  }
162
219
  },
163
220
  handler: async (req, res) => {
164
- const result = await opts.readMetricsDatasource.getMetrics({
221
+ const params = {
165
222
  ...req.body,
166
223
  requestContext: req.requestContext
167
- });
224
+ };
225
+ const result = req.body.aggregate ? await opts.readMetricsDatasource.getAggregatedMetrics(params) : await opts.readMetricsDatasource.getMetrics(params);
168
226
  res.send(result);
169
227
  }
170
228
  });
@@ -205,7 +263,6 @@ const discoveredMetricSchema = z.object({
205
263
  resourceAttributes: discoveredAttributesSchema.describe("Resource attributes aggregated across all data points.")
206
264
  });
207
265
  const metricsDiscoveryResponseSchema = z.object({ metrics: z.array(discoveredMetricSchema) });
208
-
209
266
  //#endregion
210
267
  //#region src/routes/dashboards.ts
211
268
  const dashboardsRoutes$1 = async function(fastify, opts) {
@@ -216,14 +273,8 @@ const dashboardsRoutes$1 = async function(fastify, opts) {
216
273
  description: "Get UI tree schema as markdown prompt instructions for AI agents",
217
274
  produces: ["text/markdown"],
218
275
  response: {
219
- 200: {
220
- type: "string",
221
- description: "Markdown prompt instructions"
222
- },
223
- 404: {
224
- type: "string",
225
- description: "Prompt instructions not configured"
226
- }
276
+ 200: z.string().describe("Markdown prompt instructions"),
277
+ 404: z.string().describe("Prompt instructions not configured")
227
278
  }
228
279
  },
229
280
  handler: async (_req, reply) => {
@@ -301,7 +352,6 @@ const dashboardsRoutes$1 = async function(fastify, opts) {
301
352
  }
302
353
  });
303
354
  };
304
-
305
355
  //#endregion
306
356
  //#region src/index.ts
307
357
  const signalsRoutes = async function(fastify, opts) {
@@ -321,7 +371,7 @@ const dashboardsRoutes = async function(fastify, opts) {
321
371
  promptInstructions: opts.promptInstructions
322
372
  });
323
373
  };
324
-
325
374
  //#endregion
326
375
  export { dashboardsRoutes, signalsRoutes };
376
+
327
377
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["z","dashboardsRoutes","_dashboardsRoutes"],"sources":["../src/routes/errors.ts","../src/routes/error-handler.ts","../src/routes/error-schema-zod.ts","../src/routes/traces.ts","../src/routes/logs.ts","../src/routes/metrics.ts","../src/routes/dashboards.ts","../src/index.ts"],"sourcesContent":["export abstract class ApiError extends Error {\n abstract readonly code: string;\n\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport abstract class SignalsApiError extends ApiError {}\n\nexport class DashboardNotFoundError extends ApiError {\n readonly code = \"DASHBOARD_NOT_FOUND\";\n}\n","import {\n type FastifyError,\n type FastifyReply,\n type FastifyRequest,\n} from \"fastify\";\nimport { ApiError, DashboardNotFoundError } from \"./errors.js\";\nimport type { ApiErrorResponse } from \"./error-schema-zod.js\";\nexport function errorHandler(\n error: FastifyError | Error | string,\n request: FastifyRequest,\n reply: FastifyReply\n) {\n if (isClientError(error)) {\n return reply.status(400).send({\n // https://datatracker.ietf.org/doc/html/rfc9457\n // HTTP/1.1 422 Unprocessable Content\n // Content-Type: application/problem+json\n // Content-Language: en\n //\n // {\n // \"type\": \"https://example.net/validation-error\",\n // \"title\": \"Your request is not valid.\",\n // \"errors\": [\n // {\n // \"detail\": \"must be a positive integer\",\n // \"pointer\": \"#/age\"\n // },\n // {\n // \"detail\": \"must be 'green', 'red' or 'blue'\",\n // \"pointer\": \"#/profile/color\"\n // }\n // ]\n // }\n type: \"https://docs.kopai.app/errors/signals-api-validation-error\", // TODO: document error\n status: 400,\n title: \"Invalid data\",\n detail: error.message,\n } satisfies ApiErrorResponse);\n }\n\n if (error instanceof DashboardNotFoundError) {\n request.log.info(error.message);\n return reply.status(404).send({\n type: \"https://docs.kopai.app/errors/dashboard-not-found\",\n status: 404,\n title: \"Dashboard not found\",\n detail: error.message,\n } satisfies ApiErrorResponse);\n }\n request.log.error(error);\n if (error instanceof ApiError) {\n return reply.status(500).send({\n type: \"https://docs.kopai.app/errors/signals-api-internal-error\", // TODO: document error\n status: 500,\n title: \"Internal server error\",\n detail: error.message,\n } satisfies ApiErrorResponse);\n }\n\n return reply.status(500).send({\n type: \"https://docs.kopai.app/errors/signals-api-internal-error\", // TODO: document error\n status: 500,\n title: \"Internal server error\",\n } satisfies ApiErrorResponse);\n}\n\nfunction isFastifyError(error: unknown): error is FastifyError {\n return (\n error instanceof Error &&\n \"code\" in error &&\n typeof (error as FastifyError).code === \"string\"\n );\n}\n\nfunction isClientError(error: unknown): error is FastifyError {\n return (\n isFastifyError(error) &&\n typeof error.statusCode === \"number\" &&\n error.statusCode >= 400 &&\n error.statusCode < 500\n );\n}\n","import z from \"zod\";\n\nexport const problemDetailsSchema = z.object({\n type: z\n .url()\n .default(\"about:blank\")\n .describe(\"URI reference identifying the problem type\"),\n status: z\n .number()\n .int()\n .min(100)\n .max(599)\n .optional()\n .describe(\"HTTP status code generated by the origin server\"),\n title: z\n .string()\n .optional()\n .describe(\"Short human-readable summary of the problem type\"),\n detail: z\n .string()\n .optional()\n .describe(\"Human-readable explanation specific to this occurrence\"),\n instance: z\n .string()\n .optional()\n .describe(\"URI reference identifying this specific occurrence\"),\n});\n\nexport type ApiErrorResponse = z.infer<typeof problemDetailsSchema>;\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport {\n dataFilterSchemas,\n denormalizedSignals,\n type datasource,\n} from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\n\nexport const tracesRoutes: FastifyPluginAsyncZod<{\n readTracesDatasource: datasource.ReadTracesDatasource;\n}> = async function (fastify, opts) {\n fastify.route({\n method: \"GET\",\n url: \"/signals/traces/:traceId\",\n schema: {\n description: \"Get all spans for a trace by traceId\",\n params: z.object({\n traceId: z.string().describe(\"A TraceId of the trace\"),\n }),\n response: {\n 200: z.array(denormalizedSignals.otelTracesSchema),\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getTraces({\n traceId: req.params.traceId,\n requestContext: req.requestContext,\n });\n res.send(result.data);\n },\n });\n\n const searchResponseSchema = z.object({\n data: z.array(denormalizedSignals.otelTracesSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/traces/search\",\n schema: {\n description: \"Search spans matching a filter\",\n body: dataFilterSchemas.tracesDataFilterSchema,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getTraces({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport {\n dataFilterSchemas,\n denormalizedSignals,\n type datasource,\n} from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\n\nexport const logsRoutes: FastifyPluginAsyncZod<{\n readLogsDatasource: datasource.ReadLogsDatasource;\n}> = async function (fastify, opts) {\n const searchResponseSchema = z.object({\n data: z.array(denormalizedSignals.otelLogsSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/logs/search\",\n schema: {\n description: \"Search logs matching a filter\",\n body: dataFilterSchemas.logsDataFilterSchema,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readLogsDatasource.getLogs({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport {\n dataFilterSchemas,\n denormalizedSignals,\n type datasource,\n} from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\n\nexport const metricsRoutes: FastifyPluginAsyncZod<{\n readMetricsDatasource: datasource.ReadMetricsDatasource;\n}> = async function (fastify, opts) {\n const searchResponseSchema = z.object({\n data: z.array(denormalizedSignals.otelMetricsSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/metrics/search\",\n schema: {\n description: \"Search metrics matching a filter\",\n body: dataFilterSchemas.metricsDataFilterSchema,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readMetricsDatasource.getMetrics({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n\n fastify.route({\n method: \"GET\",\n url: \"/signals/metrics/discover\",\n schema: {\n description: \"Discover available metrics and their attributes\",\n response: {\n 200: metricsDiscoveryResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readMetricsDatasource.discoverMetrics({\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n\nconst metricTypeSchema = z.enum([\n \"Gauge\",\n \"Sum\",\n \"Histogram\",\n \"ExponentialHistogram\",\n \"Summary\",\n]);\n\nconst discoveredAttributesSchema = z.object({\n values: z\n .record(z.string(), z.array(z.string()))\n .describe(\"Attribute key/value pairs. Max 100 values per key.\"),\n _truncated: z\n .boolean()\n .optional()\n .describe(\"True if any attribute key exceeded 100 values.\"),\n});\n\nconst discoveredMetricSchema = z.object({\n name: z.string().describe(\"Metric name from MetricName field.\"),\n type: metricTypeSchema.describe(\n \"Metric type: Gauge, Sum, Histogram, ExponentialHistogram, or Summary.\"\n ),\n unit: z.string().optional().describe(\"Metric unit from MetricUnit field.\"),\n description: z\n .string()\n .optional()\n .describe(\"Metric description from MetricDescription field.\"),\n attributes: discoveredAttributesSchema.describe(\n \"Data point attributes aggregated across all data points.\"\n ),\n resourceAttributes: discoveredAttributesSchema.describe(\n \"Resource attributes aggregated across all data points.\"\n ),\n});\n\nconst metricsDiscoveryResponseSchema = z.object({\n metrics: z.array(discoveredMetricSchema),\n});\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport { dashboardDatasource } from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\nimport { DashboardNotFoundError } from \"./errors.js\";\n\nexport const dashboardsRoutes: FastifyPluginAsyncZod<{\n dynamicDashboardDatasource: dashboardDatasource.DynamicDashboardDatasource;\n promptInstructions?: string;\n}> = async function (fastify, opts) {\n fastify.route({\n method: \"GET\",\n url: \"/dashboards/schema\",\n schema: {\n description:\n \"Get UI tree schema as markdown prompt instructions for AI agents\",\n produces: [\"text/markdown\"],\n response: {\n 200: { type: \"string\", description: \"Markdown prompt instructions\" },\n 404: {\n type: \"string\",\n description: \"Prompt instructions not configured\",\n },\n },\n },\n handler: async (_req, reply) => {\n if (!opts.promptInstructions) {\n return reply.status(404).send(\"Dashboard schema not configured\");\n }\n reply.type(\"text/markdown\").send(opts.promptInstructions);\n },\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/dashboards\",\n schema: {\n description: \"Create a dashboard containing a uiTree\",\n body: dashboardDatasource.createDashboardParams,\n response: {\n 201: dashboardDatasource.dashboardSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.dynamicDashboardDatasource.createDashboard({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.status(201).send(result);\n },\n });\n\n fastify.route({\n method: \"GET\",\n url: \"/dashboards/:dashboardId\",\n schema: {\n description: \"Get a dashboard containing a uiTree to be rendered\",\n params: z.object({\n dashboardId: z.string(),\n }),\n response: {\n 200: dashboardDatasource.dashboardSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n try {\n const result = await opts.dynamicDashboardDatasource.getDashboard({\n id: req.params.dashboardId,\n requestContext: req.requestContext,\n });\n res.send(result);\n } catch (error) {\n const msg = error instanceof Error ? error.message.toLowerCase() : \"\";\n if (msg.includes(\"not found\")) {\n throw new DashboardNotFoundError(\n `Dashboard not found: ${req.params.dashboardId}`,\n { cause: error }\n );\n }\n throw error;\n }\n },\n });\n\n const searchResponseSchema = z.object({\n data: z.array(dashboardDatasource.dashboardSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/dashboards/search\",\n schema: {\n description: \"Search dashboards matching a filter\",\n body: dashboardDatasource.searchDashboardsFilter,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.dynamicDashboardDatasource.searchDashboards({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n","import type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport { type datasource, type dashboardDatasource } from \"@kopai/core\";\n\nimport {\n serializerCompiler,\n validatorCompiler,\n} from \"fastify-type-provider-zod\";\nimport { errorHandler } from \"./routes/error-handler.js\";\nimport { tracesRoutes } from \"./routes/traces.js\";\nimport { logsRoutes } from \"./routes/logs.js\";\nimport { metricsRoutes } from \"./routes/metrics.js\";\nimport { dashboardsRoutes as _dashboardsRoutes } from \"./routes/dashboards.js\";\n\nexport const signalsRoutes: FastifyPluginAsyncZod<{\n readTelemetryDatasource: datasource.ReadTelemetryDatasource;\n}> = async function (fastify, opts) {\n fastify.setValidatorCompiler(validatorCompiler);\n fastify.setSerializerCompiler(serializerCompiler);\n fastify.setErrorHandler(errorHandler);\n\n fastify.register(tracesRoutes, {\n readTracesDatasource: opts.readTelemetryDatasource,\n });\n\n fastify.register(logsRoutes, {\n readLogsDatasource: opts.readTelemetryDatasource,\n });\n\n fastify.register(metricsRoutes, {\n readMetricsDatasource: opts.readTelemetryDatasource,\n });\n};\n\nexport const dashboardsRoutes: FastifyPluginAsyncZod<{\n dynamicDashboardDatasource: dashboardDatasource.DynamicDashboardDatasource;\n promptInstructions?: string;\n}> = async function (fastify, opts) {\n fastify.setValidatorCompiler(validatorCompiler);\n fastify.setSerializerCompiler(serializerCompiler);\n fastify.setErrorHandler(errorHandler);\n\n fastify.register(_dashboardsRoutes, {\n dynamicDashboardDatasource: opts.dynamicDashboardDatasource,\n promptInstructions: opts.promptInstructions,\n });\n};\n\ndeclare module \"fastify\" {\n interface FastifyRequest {\n requestContext?: unknown;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAsB,WAAtB,cAAuC,MAAM;CAG3C,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,SAAO,eAAe,MAAM,IAAI,OAAO,UAAU;;;AAMrD,IAAa,yBAAb,cAA4C,SAAS;CACnD,AAAS,OAAO;;;;;ACLlB,SAAgB,aACd,OACA,SACA,OACA;AACA,KAAI,cAAc,MAAM,CACtB,QAAO,MAAM,OAAO,IAAI,CAAC,KAAK;EAoB5B,MAAM;EACN,QAAQ;EACR,OAAO;EACP,QAAQ,MAAM;EACf,CAA4B;AAG/B,KAAI,iBAAiB,wBAAwB;AAC3C,UAAQ,IAAI,KAAK,MAAM,QAAQ;AAC/B,SAAO,MAAM,OAAO,IAAI,CAAC,KAAK;GAC5B,MAAM;GACN,QAAQ;GACR,OAAO;GACP,QAAQ,MAAM;GACf,CAA4B;;AAE/B,SAAQ,IAAI,MAAM,MAAM;AACxB,KAAI,iBAAiB,SACnB,QAAO,MAAM,OAAO,IAAI,CAAC,KAAK;EAC5B,MAAM;EACN,QAAQ;EACR,OAAO;EACP,QAAQ,MAAM;EACf,CAA4B;AAG/B,QAAO,MAAM,OAAO,IAAI,CAAC,KAAK;EAC5B,MAAM;EACN,QAAQ;EACR,OAAO;EACR,CAA4B;;AAG/B,SAAS,eAAe,OAAuC;AAC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gBAAgB,IAAI;IACrB,CAAC;AACF,OAAI,KAAK,OAAO;;EAEnB,CAAC;;;;;ACnGJ,MAAa,gBAER,eAAgB,SAAS,MAAM;AAClC,SAAQ,qBAAqB,kBAAkB;AAC/C,SAAQ,sBAAsB,mBAAmB;AACjD,SAAQ,gBAAgB,aAAa;AAErC,SAAQ,SAAS,cAAc,EAC7B,sBAAsB,KAAK,yBAC5B,CAAC;AAEF,SAAQ,SAAS,YAAY,EAC3B,oBAAoB,KAAK,yBAC1B,CAAC;AAEF,SAAQ,SAAS,eAAe,EAC9B,uBAAuB,KAAK,yBAC7B,CAAC;;AAGJ,MAAa,mBAGR,eAAgB,SAAS,MAAM;AAClC,SAAQ,qBAAqB,kBAAkB;AAC/C,SAAQ,sBAAsB,mBAAmB;AACjD,SAAQ,gBAAgB,aAAa;AAErC,SAAQ,SAASC,oBAAmB;EAClC,4BAA4B,KAAK;EACjC,oBAAoB,KAAK;EAC1B,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":["z","dashboardsRoutes","_dashboardsRoutes"],"sources":["../src/routes/errors.ts","../src/routes/error-handler.ts","../src/routes/error-schema-zod.ts","../src/routes/traces.ts","../src/routes/logs.ts","../src/routes/metrics.ts","../src/routes/dashboards.ts","../src/index.ts"],"sourcesContent":["export abstract class ApiError extends Error {\n abstract readonly code: string;\n\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport abstract class SignalsApiError extends ApiError {}\n\nexport class DashboardNotFoundError extends ApiError {\n readonly code = \"DASHBOARD_NOT_FOUND\";\n}\n","import {\n type FastifyError,\n type FastifyReply,\n type FastifyRequest,\n} from \"fastify\";\nimport { ApiError, DashboardNotFoundError } from \"./errors.js\";\nimport type { ApiErrorResponse } from \"./error-schema-zod.js\";\nexport function errorHandler(\n error: FastifyError | Error | string,\n request: FastifyRequest,\n reply: FastifyReply\n) {\n if (isClientError(error)) {\n return reply.status(400).send({\n // https://datatracker.ietf.org/doc/html/rfc9457\n // HTTP/1.1 422 Unprocessable Content\n // Content-Type: application/problem+json\n // Content-Language: en\n //\n // {\n // \"type\": \"https://example.net/validation-error\",\n // \"title\": \"Your request is not valid.\",\n // \"errors\": [\n // {\n // \"detail\": \"must be a positive integer\",\n // \"pointer\": \"#/age\"\n // },\n // {\n // \"detail\": \"must be 'green', 'red' or 'blue'\",\n // \"pointer\": \"#/profile/color\"\n // }\n // ]\n // }\n type: \"https://docs.kopai.app/errors/signals-api-validation-error\", // TODO: document error\n status: 400,\n title: \"Invalid data\",\n detail: error.message,\n } satisfies ApiErrorResponse);\n }\n\n if (error instanceof DashboardNotFoundError) {\n request.log.info(error.message);\n return reply.status(404).send({\n type: \"https://docs.kopai.app/errors/dashboard-not-found\",\n status: 404,\n title: \"Dashboard not found\",\n detail: error.message,\n } satisfies ApiErrorResponse);\n }\n request.log.error(error);\n if (error instanceof ApiError) {\n return reply.status(500).send({\n type: \"https://docs.kopai.app/errors/signals-api-internal-error\", // TODO: document error\n status: 500,\n title: \"Internal server error\",\n detail: error.message,\n } satisfies ApiErrorResponse);\n }\n\n return reply.status(500).send({\n type: \"https://docs.kopai.app/errors/signals-api-internal-error\", // TODO: document error\n status: 500,\n title: \"Internal server error\",\n } satisfies ApiErrorResponse);\n}\n\nfunction isFastifyError(error: unknown): error is FastifyError {\n return (\n error instanceof Error &&\n \"code\" in error &&\n typeof (error as FastifyError).code === \"string\"\n );\n}\n\nfunction isClientError(error: unknown): error is FastifyError {\n return (\n isFastifyError(error) &&\n typeof error.statusCode === \"number\" &&\n error.statusCode >= 400 &&\n error.statusCode < 500\n );\n}\n","import z from \"zod\";\n\nexport const problemDetailsSchema = z.object({\n type: z\n .url()\n .default(\"about:blank\")\n .describe(\"URI reference identifying the problem type\"),\n status: z\n .number()\n .int()\n .min(100)\n .max(599)\n .optional()\n .describe(\"HTTP status code generated by the origin server\"),\n title: z\n .string()\n .optional()\n .describe(\"Short human-readable summary of the problem type\"),\n detail: z\n .string()\n .optional()\n .describe(\"Human-readable explanation specific to this occurrence\"),\n instance: z\n .string()\n .optional()\n .describe(\"URI reference identifying this specific occurrence\"),\n});\n\nexport type ApiErrorResponse = z.infer<typeof problemDetailsSchema>;\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport {\n dataFilterSchemas,\n denormalizedSignals,\n type datasource,\n} from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\n\nexport const tracesRoutes: FastifyPluginAsyncZod<{\n readTracesDatasource: datasource.ReadTracesDatasource &\n datasource.ReadTracesMetaDatasource;\n}> = async function (fastify, opts) {\n fastify.route({\n method: \"GET\",\n url: \"/signals/traces/:traceId\",\n schema: {\n description: \"Get all spans for a trace by traceId\",\n params: z.object({\n traceId: z.string().describe(\"A TraceId of the trace\"),\n }),\n response: {\n 200: z.array(denormalizedSignals.otelTracesSchema),\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getTraces({\n traceId: req.params.traceId,\n requestContext: req.requestContext,\n });\n res.send(result.data);\n },\n });\n\n const searchResponseSchema = z.object({\n data: z.array(denormalizedSignals.otelTracesSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/traces/search\",\n schema: {\n description: \"Search spans matching a filter\",\n body: dataFilterSchemas.tracesDataFilterSchema,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getTraces({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n\n fastify.route({\n method: \"GET\",\n url: \"/signals/services\",\n schema: {\n description: \"List distinct service names\",\n response: {\n 200: z.object({ services: z.array(z.string()) }),\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getServices({\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n\n fastify.route({\n method: \"GET\",\n url: \"/signals/traces/operations\",\n schema: {\n description: \"List distinct operations for a service\",\n querystring: z.object({ serviceName: z.string() }),\n response: {\n 200: z.object({ operations: z.array(z.string()) }),\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getOperations({\n serviceName: req.query.serviceName,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/traces/summaries\",\n schema: {\n description: \"Search trace summaries\",\n body: dataFilterSchemas.traceSummariesFilterSchema,\n response: {\n 200: z.object({\n data: z.array(dataFilterSchemas.traceSummaryRowSchema),\n nextCursor: z.string().nullable(),\n }),\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readTracesDatasource.getTraceSummaries({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport {\n dataFilterSchemas,\n denormalizedSignals,\n type datasource,\n} from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\n\nexport const logsRoutes: FastifyPluginAsyncZod<{\n readLogsDatasource: datasource.ReadLogsDatasource;\n}> = async function (fastify, opts) {\n const searchResponseSchema = z.object({\n data: z.array(denormalizedSignals.otelLogsSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/logs/search\",\n schema: {\n description: \"Search logs matching a filter\",\n body: dataFilterSchemas.logsDataFilterSchema,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readLogsDatasource.getLogs({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport {\n dataFilterSchemas,\n denormalizedSignals,\n type datasource,\n} from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\n\nexport const metricsRoutes: FastifyPluginAsyncZod<{\n readMetricsDatasource: datasource.ReadMetricsDatasource;\n}> = async function (fastify, opts) {\n const searchResponseSchema = z.object({\n data: z.array(denormalizedSignals.otelMetricsSchema),\n nextCursor: z.string().nullable(),\n });\n\n const aggregatedResponseSchema = z.object({\n data: z.array(denormalizedSignals.aggregatedMetricSchema),\n nextCursor: z.null(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/signals/metrics/search\",\n schema: {\n description: \"Search metrics matching a filter\",\n body: dataFilterSchemas.metricsDataFilterSchema,\n response: {\n 200: z.union([searchResponseSchema, aggregatedResponseSchema]),\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const params = { ...req.body, requestContext: req.requestContext };\n const result = req.body.aggregate\n ? await opts.readMetricsDatasource.getAggregatedMetrics(params)\n : await opts.readMetricsDatasource.getMetrics(params);\n res.send(result);\n },\n });\n\n fastify.route({\n method: \"GET\",\n url: \"/signals/metrics/discover\",\n schema: {\n description: \"Discover available metrics and their attributes\",\n response: {\n 200: metricsDiscoveryResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.readMetricsDatasource.discoverMetrics({\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n\nconst metricTypeSchema = z.enum([\n \"Gauge\",\n \"Sum\",\n \"Histogram\",\n \"ExponentialHistogram\",\n \"Summary\",\n]);\n\nconst discoveredAttributesSchema = z.object({\n values: z\n .record(z.string(), z.array(z.string()))\n .describe(\"Attribute key/value pairs. Max 100 values per key.\"),\n _truncated: z\n .boolean()\n .optional()\n .describe(\"True if any attribute key exceeded 100 values.\"),\n});\n\nconst discoveredMetricSchema = z.object({\n name: z.string().describe(\"Metric name from MetricName field.\"),\n type: metricTypeSchema.describe(\n \"Metric type: Gauge, Sum, Histogram, ExponentialHistogram, or Summary.\"\n ),\n unit: z.string().optional().describe(\"Metric unit from MetricUnit field.\"),\n description: z\n .string()\n .optional()\n .describe(\"Metric description from MetricDescription field.\"),\n attributes: discoveredAttributesSchema.describe(\n \"Data point attributes aggregated across all data points.\"\n ),\n resourceAttributes: discoveredAttributesSchema.describe(\n \"Resource attributes aggregated across all data points.\"\n ),\n});\n\nconst metricsDiscoveryResponseSchema = z.object({\n metrics: z.array(discoveredMetricSchema),\n});\n","import { z } from \"zod/v4\";\nimport type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport { dashboardDatasource } from \"@kopai/core\";\nimport { problemDetailsSchema } from \"./error-schema-zod.js\";\nimport { DashboardNotFoundError } from \"./errors.js\";\n\nexport const dashboardsRoutes: FastifyPluginAsyncZod<{\n dynamicDashboardDatasource: dashboardDatasource.DynamicDashboardDatasource;\n promptInstructions?: string;\n}> = async function (fastify, opts) {\n fastify.route({\n method: \"GET\",\n url: \"/dashboards/schema\",\n schema: {\n description:\n \"Get UI tree schema as markdown prompt instructions for AI agents\",\n produces: [\"text/markdown\"],\n response: {\n 200: z.string().describe(\"Markdown prompt instructions\"),\n 404: z.string().describe(\"Prompt instructions not configured\"),\n },\n },\n handler: async (_req, reply) => {\n if (!opts.promptInstructions) {\n return reply.status(404).send(\"Dashboard schema not configured\");\n }\n reply.type(\"text/markdown\").send(opts.promptInstructions);\n },\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/dashboards\",\n schema: {\n description: \"Create a dashboard containing a uiTree\",\n body: dashboardDatasource.createDashboardParams,\n response: {\n 201: dashboardDatasource.dashboardSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.dynamicDashboardDatasource.createDashboard({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.status(201).send(result);\n },\n });\n\n fastify.route({\n method: \"GET\",\n url: \"/dashboards/:dashboardId\",\n schema: {\n description: \"Get a dashboard containing a uiTree to be rendered\",\n params: z.object({\n dashboardId: z.string(),\n }),\n response: {\n 200: dashboardDatasource.dashboardSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n try {\n const result = await opts.dynamicDashboardDatasource.getDashboard({\n id: req.params.dashboardId,\n requestContext: req.requestContext,\n });\n res.send(result);\n } catch (error) {\n const msg = error instanceof Error ? error.message.toLowerCase() : \"\";\n if (msg.includes(\"not found\")) {\n throw new DashboardNotFoundError(\n `Dashboard not found: ${req.params.dashboardId}`,\n { cause: error }\n );\n }\n throw error;\n }\n },\n });\n\n const searchResponseSchema = z.object({\n data: z.array(dashboardDatasource.dashboardSchema),\n nextCursor: z.string().nullable(),\n });\n\n fastify.route({\n method: \"POST\",\n url: \"/dashboards/search\",\n schema: {\n description: \"Search dashboards matching a filter\",\n body: dashboardDatasource.searchDashboardsFilter,\n response: {\n 200: searchResponseSchema,\n \"4xx\": problemDetailsSchema,\n \"5xx\": problemDetailsSchema,\n },\n },\n handler: async (req, res) => {\n const result = await opts.dynamicDashboardDatasource.searchDashboards({\n ...req.body,\n requestContext: req.requestContext,\n });\n res.send(result);\n },\n });\n};\n","import type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport { type datasource, type dashboardDatasource } from \"@kopai/core\";\n\nimport {\n serializerCompiler,\n validatorCompiler,\n} from \"fastify-type-provider-zod\";\nimport { errorHandler } from \"./routes/error-handler.js\";\nimport { tracesRoutes } from \"./routes/traces.js\";\nimport { logsRoutes } from \"./routes/logs.js\";\nimport { metricsRoutes } from \"./routes/metrics.js\";\nimport { dashboardsRoutes as _dashboardsRoutes } from \"./routes/dashboards.js\";\n\nexport const signalsRoutes: FastifyPluginAsyncZod<{\n readTelemetryDatasource: datasource.ReadTelemetryDatasource;\n}> = async function (fastify, opts) {\n fastify.setValidatorCompiler(validatorCompiler);\n fastify.setSerializerCompiler(serializerCompiler);\n fastify.setErrorHandler(errorHandler);\n\n fastify.register(tracesRoutes, {\n readTracesDatasource: opts.readTelemetryDatasource,\n });\n\n fastify.register(logsRoutes, {\n readLogsDatasource: opts.readTelemetryDatasource,\n });\n\n fastify.register(metricsRoutes, {\n readMetricsDatasource: opts.readTelemetryDatasource,\n });\n};\n\nexport const dashboardsRoutes: FastifyPluginAsyncZod<{\n dynamicDashboardDatasource: dashboardDatasource.DynamicDashboardDatasource;\n promptInstructions?: string;\n}> = async function (fastify, opts) {\n fastify.setValidatorCompiler(validatorCompiler);\n fastify.setSerializerCompiler(serializerCompiler);\n fastify.setErrorHandler(errorHandler);\n\n fastify.register(_dashboardsRoutes, {\n dynamicDashboardDatasource: opts.dynamicDashboardDatasource,\n promptInstructions: opts.promptInstructions,\n });\n};\n\ndeclare module \"fastify\" {\n interface FastifyRequest {\n requestContext?: unknown;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAsB,WAAtB,cAAuC,MAAM;CAG3C,YAAY,SAAiB,SAAwB;AACnD,QAAM,SAAS,QAAQ;AACvB,SAAO,eAAe,MAAM,IAAI,OAAO,UAAU;;;AAMrD,IAAa,yBAAb,cAA4C,SAAS;CACnD,OAAgB;;;;ACLlB,SAAgB,aACd,OACA,SACA,OACA;AACA,KAAI,cAAc,MAAM,CACtB,QAAO,MAAM,OAAO,IAAI,CAAC,KAAK;EAoB5B,MAAM;EACN,QAAQ;EACR,OAAO;EACP,QAAQ,MAAM;EACf,CAA4B;AAG/B,KAAI,iBAAiB,wBAAwB;AAC3C,UAAQ,IAAI,KAAK,MAAM,QAAQ;AAC/B,SAAO,MAAM,OAAO,IAAI,CAAC,KAAK;GAC5B,MAAM;GACN,QAAQ;GACR,OAAO;GACP,QAAQ,MAAM;GACf,CAA4B;;AAE/B,SAAQ,I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wBAAwB,IAAI,OAAO,eACnC,EAAE,OAAO,OAAO,CACjB;AAEH,UAAM;;;EAGX,CAAC;CAEF,MAAM,uBAAuB,EAAE,OAAO;EACpC,MAAM,EAAE,MAAM,oBAAoB,gBAAgB;EAClD,YAAY,EAAE,QAAQ,CAAC,UAAU;EAClC,CAAC;AAEF,SAAQ,MAAM;EACZ,QAAQ;EACR,KAAK;EACL,QAAQ;GACN,aAAa;GACb,MAAM,oBAAoB;GAC1B,UAAU;IACR,KAAK;IACL,OAAO;IACP,OAAO;IACR;GACF;EACD,SAAS,OAAO,KAAK,QAAQ;GAC3B,MAAM,SAAS,MAAM,KAAK,2BAA2B,iBAAiB;IACpE,GAAG,IAAI;IACP,gBAAgB,IAAI;IACrB,CAAC;AACF,OAAI,KAAK,OAAO;;EAEnB,CAAC;;;;AChGJ,MAAa,gBAER,eAAgB,SAAS,MAAM;AAClC,SAAQ,qBAAqB,kBAAkB;AAC/C,SAAQ,sBAAsB,mBAAmB;AACjD,SAAQ,gBAAgB,aAAa;AAErC,SAAQ,SAAS,cAAc,EAC7B,sBAAsB,KAAK,yBAC5B,CAAC;AAEF,SAAQ,SAAS,YAAY,EAC3B,oBAAoB,KAAK,yBAC1B,CAAC;AAEF,SAAQ,SAAS,eAAe,EAC9B,uBAAuB,KAAK,yBAC7B,CAAC;;AAGJ,MAAa,mBAGR,eAAgB,SAAS,MAAM;AAClC,SAAQ,qBAAqB,kBAAkB;AAC/C,SAAQ,sBAAsB,mBAAmB;AACjD,SAAQ,gBAAgB,aAAa;AAErC,SAAQ,SAASC,oBAAmB;EAClC,4BAA4B,KAAK;EACjC,oBAAoB,KAAK;EAC1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kopai/api",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Vladimir Adamic",
6
6
  "repository": {
@@ -32,12 +32,12 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "fastify-type-provider-zod": "^6.1.0",
35
- "@kopai/core": "0.7.0"
35
+ "@kopai/core": "0.9.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@fastify/swagger": "^9.7.0",
39
39
  "@fastify/swagger-ui": "^5.2.5",
40
- "tsdown": "^0.20.3",
40
+ "tsdown": "^0.21.2",
41
41
  "@kopai/tsconfig": "0.2.0"
42
42
  },
43
43
  "scripts": {