@kopai/api 0.0.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/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2025 Kopai Authors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/dist/index.cjs ADDED
@@ -0,0 +1,225 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ 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) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+ let _kopai_core = require("@kopai/core");
29
+ let fastify_type_provider_zod = require("fastify-type-provider-zod");
30
+ require("fastify");
31
+ let zod_v4 = require("zod/v4");
32
+ let zod = require("zod");
33
+ zod = __toESM(zod);
34
+
35
+ //#region src/routes/errors.ts
36
+ var SignalsApiError = class extends Error {
37
+ constructor(message, options) {
38
+ super(message, options);
39
+ Object.setPrototypeOf(this, new.target.prototype);
40
+ }
41
+ };
42
+
43
+ //#endregion
44
+ //#region src/routes/error-handler.ts
45
+ function errorHandler(error, request, reply) {
46
+ if (isClientError(error)) return reply.status(400).send({
47
+ type: "https://docs.kopai.app/errors/signals-api-validation-error",
48
+ status: 400,
49
+ title: "Invalid data",
50
+ detail: error.message
51
+ });
52
+ request.log.error(error);
53
+ if (error instanceof SignalsApiError) return reply.status(500).send({
54
+ type: "https://docs.kopai.app/errors/signals-api-internal-error",
55
+ status: 500,
56
+ title: "Internal server error",
57
+ detail: error.message
58
+ });
59
+ return reply.status(500).send({
60
+ type: "https://docs.kopai.app/errors/signals-api-internal-error",
61
+ status: 500,
62
+ title: "Internal server error"
63
+ });
64
+ }
65
+ function isFastifyError(error) {
66
+ return error instanceof Error && "code" in error && typeof error.code === "string";
67
+ }
68
+ function isClientError(error) {
69
+ return isFastifyError(error) && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500;
70
+ }
71
+
72
+ //#endregion
73
+ //#region src/routes/error-schema-zod.ts
74
+ const problemDetailsSchema = zod.default.object({
75
+ type: zod.default.url().default("about:blank").describe("URI reference identifying the problem type"),
76
+ status: zod.default.number().int().min(100).max(599).optional().describe("HTTP status code generated by the origin server"),
77
+ title: zod.default.string().optional().describe("Short human-readable summary of the problem type"),
78
+ detail: zod.default.string().optional().describe("Human-readable explanation specific to this occurrence"),
79
+ instance: zod.default.string().optional().describe("URI reference identifying this specific occurrence")
80
+ });
81
+
82
+ //#endregion
83
+ //#region src/routes/traces.ts
84
+ const tracesRoutes = async function(fastify, opts) {
85
+ fastify.route({
86
+ method: "GET",
87
+ url: "/signals/traces/:traceId",
88
+ schema: {
89
+ description: "Get all spans for a trace by traceId",
90
+ params: zod_v4.z.object({ traceId: zod_v4.z.string().describe("A TraceId of the trace") }),
91
+ response: {
92
+ 200: zod_v4.z.array(_kopai_core.denormalizedSignals.otelTracesSchema),
93
+ "4xx": problemDetailsSchema,
94
+ "5xx": problemDetailsSchema
95
+ }
96
+ },
97
+ handler: async (req, res) => {
98
+ const result = await opts.readTracesDatasource.getTraces({ traceId: req.params.traceId });
99
+ res.send(result.data);
100
+ }
101
+ });
102
+ const searchResponseSchema = zod_v4.z.object({
103
+ data: zod_v4.z.array(_kopai_core.denormalizedSignals.otelTracesSchema),
104
+ nextCursor: zod_v4.z.string().nullable()
105
+ });
106
+ fastify.route({
107
+ method: "POST",
108
+ url: "/signals/traces/search",
109
+ schema: {
110
+ description: "Search spans matching a filter",
111
+ body: _kopai_core.dataFilterSchemas.tracesDataFilterSchema,
112
+ response: {
113
+ 200: searchResponseSchema,
114
+ "4xx": problemDetailsSchema,
115
+ "5xx": problemDetailsSchema
116
+ }
117
+ },
118
+ handler: async (req, res) => {
119
+ const result = await opts.readTracesDatasource.getTraces(req.body);
120
+ res.send(result);
121
+ }
122
+ });
123
+ };
124
+
125
+ //#endregion
126
+ //#region src/routes/logs.ts
127
+ const logsRoutes = async function(fastify, opts) {
128
+ const searchResponseSchema = zod_v4.z.object({
129
+ data: zod_v4.z.array(_kopai_core.denormalizedSignals.otelLogsSchema),
130
+ nextCursor: zod_v4.z.string().nullable()
131
+ });
132
+ fastify.route({
133
+ method: "POST",
134
+ url: "/signals/logs/search",
135
+ schema: {
136
+ description: "Search logs matching a filter",
137
+ body: _kopai_core.dataFilterSchemas.logsDataFilterSchema,
138
+ response: {
139
+ 200: searchResponseSchema,
140
+ "4xx": problemDetailsSchema,
141
+ "5xx": problemDetailsSchema
142
+ }
143
+ },
144
+ handler: async (req, res) => {
145
+ const result = await opts.readLogsDatasource.getLogs(req.body);
146
+ res.send(result);
147
+ }
148
+ });
149
+ };
150
+
151
+ //#endregion
152
+ //#region src/routes/metrics.ts
153
+ const metricsRoutes = async function(fastify, opts) {
154
+ const searchResponseSchema = zod_v4.z.object({
155
+ data: zod_v4.z.array(_kopai_core.denormalizedSignals.otelMetricsSchema),
156
+ nextCursor: zod_v4.z.string().nullable()
157
+ });
158
+ fastify.route({
159
+ method: "POST",
160
+ url: "/signals/metrics/search",
161
+ schema: {
162
+ description: "Search metrics matching a filter",
163
+ body: _kopai_core.dataFilterSchemas.metricsDataFilterSchema,
164
+ response: {
165
+ 200: searchResponseSchema,
166
+ "4xx": problemDetailsSchema,
167
+ "5xx": problemDetailsSchema
168
+ }
169
+ },
170
+ handler: async (req, res) => {
171
+ const result = await opts.readMetricsDatasource.getMetrics(req.body);
172
+ res.send(result);
173
+ }
174
+ });
175
+ fastify.route({
176
+ method: "GET",
177
+ url: "/signals/metrics/discover",
178
+ schema: {
179
+ description: "Discover available metrics and their attributes",
180
+ response: {
181
+ 200: metricsDiscoveryResponseSchema,
182
+ "4xx": problemDetailsSchema,
183
+ "5xx": problemDetailsSchema
184
+ }
185
+ },
186
+ handler: async (_req, res) => {
187
+ const result = await opts.readMetricsDatasource.discoverMetrics();
188
+ res.send(result);
189
+ }
190
+ });
191
+ };
192
+ const metricTypeSchema = zod_v4.z.enum([
193
+ "Gauge",
194
+ "Sum",
195
+ "Histogram",
196
+ "ExponentialHistogram",
197
+ "Summary"
198
+ ]);
199
+ const discoveredAttributesSchema = zod_v4.z.object({
200
+ values: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.array(zod_v4.z.string())).describe("Attribute key/value pairs. Max 100 values per key."),
201
+ _truncated: zod_v4.z.boolean().optional().describe("True if any attribute key exceeded 100 values.")
202
+ });
203
+ const discoveredMetricSchema = zod_v4.z.object({
204
+ name: zod_v4.z.string().describe("Metric name from MetricName field."),
205
+ type: metricTypeSchema.describe("Metric type: Gauge, Sum, Histogram, ExponentialHistogram, or Summary."),
206
+ unit: zod_v4.z.string().optional().describe("Metric unit from MetricUnit field."),
207
+ description: zod_v4.z.string().optional().describe("Metric description from MetricDescription field."),
208
+ attributes: discoveredAttributesSchema.describe("Data point attributes aggregated across all data points."),
209
+ resourceAttributes: discoveredAttributesSchema.describe("Resource attributes aggregated across all data points.")
210
+ });
211
+ const metricsDiscoveryResponseSchema = zod_v4.z.object({ metrics: zod_v4.z.array(discoveredMetricSchema) });
212
+
213
+ //#endregion
214
+ //#region src/index.ts
215
+ const signalsRoutes = async function(fastify, opts) {
216
+ fastify.setValidatorCompiler(fastify_type_provider_zod.validatorCompiler);
217
+ fastify.setSerializerCompiler(fastify_type_provider_zod.serializerCompiler);
218
+ fastify.setErrorHandler(errorHandler);
219
+ fastify.register(tracesRoutes, { readTracesDatasource: opts.readTelemetryDatasource });
220
+ fastify.register(logsRoutes, { readLogsDatasource: opts.readTelemetryDatasource });
221
+ fastify.register(metricsRoutes, { readMetricsDatasource: opts.readTelemetryDatasource });
222
+ };
223
+
224
+ //#endregion
225
+ exports.signalsRoutes = signalsRoutes;
@@ -0,0 +1,10 @@
1
+ import { FastifyPluginAsyncZod } from "fastify-type-provider-zod";
2
+ import { datasource } from "@kopai/core";
3
+
4
+ //#region src/index.d.ts
5
+ declare const signalsRoutes: FastifyPluginAsyncZod<{
6
+ readTelemetryDatasource: datasource.ReadTelemetryDatasource;
7
+ }>;
8
+ //#endregion
9
+ export { signalsRoutes };
10
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;cAWa,aAAA,EAAe,qBAAA;EAC1B,uBAAA,EAAyB,UAAA,CAAW,uBAAA;AAAA"}
@@ -0,0 +1,10 @@
1
+ import { datasource } from "@kopai/core";
2
+ import { FastifyPluginAsyncZod } from "fastify-type-provider-zod";
3
+
4
+ //#region src/index.d.ts
5
+ declare const signalsRoutes: FastifyPluginAsyncZod<{
6
+ readTelemetryDatasource: datasource.ReadTelemetryDatasource;
7
+ }>;
8
+ //#endregion
9
+ export { signalsRoutes };
10
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;cAWa,aAAA,EAAe,qBAAA;EAC1B,uBAAA,EAAyB,UAAA,CAAW,uBAAA;AAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,198 @@
1
+ import { dataFilterSchemas, denormalizedSignals } from "@kopai/core";
2
+ import { serializerCompiler, validatorCompiler } from "fastify-type-provider-zod";
3
+ import "fastify";
4
+ import { z } from "zod/v4";
5
+ import z$1 from "zod";
6
+
7
+ //#region src/routes/errors.ts
8
+ var SignalsApiError = class extends Error {
9
+ constructor(message, options) {
10
+ super(message, options);
11
+ Object.setPrototypeOf(this, new.target.prototype);
12
+ }
13
+ };
14
+
15
+ //#endregion
16
+ //#region src/routes/error-handler.ts
17
+ function errorHandler(error, request, reply) {
18
+ if (isClientError(error)) return reply.status(400).send({
19
+ type: "https://docs.kopai.app/errors/signals-api-validation-error",
20
+ status: 400,
21
+ title: "Invalid data",
22
+ detail: error.message
23
+ });
24
+ request.log.error(error);
25
+ if (error instanceof SignalsApiError) return reply.status(500).send({
26
+ type: "https://docs.kopai.app/errors/signals-api-internal-error",
27
+ status: 500,
28
+ title: "Internal server error",
29
+ detail: error.message
30
+ });
31
+ return reply.status(500).send({
32
+ type: "https://docs.kopai.app/errors/signals-api-internal-error",
33
+ status: 500,
34
+ title: "Internal server error"
35
+ });
36
+ }
37
+ function isFastifyError(error) {
38
+ return error instanceof Error && "code" in error && typeof error.code === "string";
39
+ }
40
+ function isClientError(error) {
41
+ return isFastifyError(error) && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500;
42
+ }
43
+
44
+ //#endregion
45
+ //#region src/routes/error-schema-zod.ts
46
+ const problemDetailsSchema = z$1.object({
47
+ type: z$1.url().default("about:blank").describe("URI reference identifying the problem type"),
48
+ status: z$1.number().int().min(100).max(599).optional().describe("HTTP status code generated by the origin server"),
49
+ title: z$1.string().optional().describe("Short human-readable summary of the problem type"),
50
+ detail: z$1.string().optional().describe("Human-readable explanation specific to this occurrence"),
51
+ instance: z$1.string().optional().describe("URI reference identifying this specific occurrence")
52
+ });
53
+
54
+ //#endregion
55
+ //#region src/routes/traces.ts
56
+ const tracesRoutes = async function(fastify, opts) {
57
+ fastify.route({
58
+ method: "GET",
59
+ url: "/signals/traces/:traceId",
60
+ schema: {
61
+ description: "Get all spans for a trace by traceId",
62
+ params: z.object({ traceId: z.string().describe("A TraceId of the trace") }),
63
+ response: {
64
+ 200: z.array(denormalizedSignals.otelTracesSchema),
65
+ "4xx": problemDetailsSchema,
66
+ "5xx": problemDetailsSchema
67
+ }
68
+ },
69
+ handler: async (req, res) => {
70
+ const result = await opts.readTracesDatasource.getTraces({ traceId: req.params.traceId });
71
+ res.send(result.data);
72
+ }
73
+ });
74
+ const searchResponseSchema = z.object({
75
+ data: z.array(denormalizedSignals.otelTracesSchema),
76
+ nextCursor: z.string().nullable()
77
+ });
78
+ fastify.route({
79
+ method: "POST",
80
+ url: "/signals/traces/search",
81
+ schema: {
82
+ description: "Search spans matching a filter",
83
+ body: dataFilterSchemas.tracesDataFilterSchema,
84
+ response: {
85
+ 200: searchResponseSchema,
86
+ "4xx": problemDetailsSchema,
87
+ "5xx": problemDetailsSchema
88
+ }
89
+ },
90
+ handler: async (req, res) => {
91
+ const result = await opts.readTracesDatasource.getTraces(req.body);
92
+ res.send(result);
93
+ }
94
+ });
95
+ };
96
+
97
+ //#endregion
98
+ //#region src/routes/logs.ts
99
+ const logsRoutes = async function(fastify, opts) {
100
+ const searchResponseSchema = z.object({
101
+ data: z.array(denormalizedSignals.otelLogsSchema),
102
+ nextCursor: z.string().nullable()
103
+ });
104
+ fastify.route({
105
+ method: "POST",
106
+ url: "/signals/logs/search",
107
+ schema: {
108
+ description: "Search logs matching a filter",
109
+ body: dataFilterSchemas.logsDataFilterSchema,
110
+ response: {
111
+ 200: searchResponseSchema,
112
+ "4xx": problemDetailsSchema,
113
+ "5xx": problemDetailsSchema
114
+ }
115
+ },
116
+ handler: async (req, res) => {
117
+ const result = await opts.readLogsDatasource.getLogs(req.body);
118
+ res.send(result);
119
+ }
120
+ });
121
+ };
122
+
123
+ //#endregion
124
+ //#region src/routes/metrics.ts
125
+ const metricsRoutes = async function(fastify, opts) {
126
+ const searchResponseSchema = z.object({
127
+ data: z.array(denormalizedSignals.otelMetricsSchema),
128
+ nextCursor: z.string().nullable()
129
+ });
130
+ fastify.route({
131
+ method: "POST",
132
+ url: "/signals/metrics/search",
133
+ schema: {
134
+ description: "Search metrics matching a filter",
135
+ body: dataFilterSchemas.metricsDataFilterSchema,
136
+ response: {
137
+ 200: searchResponseSchema,
138
+ "4xx": problemDetailsSchema,
139
+ "5xx": problemDetailsSchema
140
+ }
141
+ },
142
+ handler: async (req, res) => {
143
+ const result = await opts.readMetricsDatasource.getMetrics(req.body);
144
+ res.send(result);
145
+ }
146
+ });
147
+ fastify.route({
148
+ method: "GET",
149
+ url: "/signals/metrics/discover",
150
+ schema: {
151
+ description: "Discover available metrics and their attributes",
152
+ response: {
153
+ 200: metricsDiscoveryResponseSchema,
154
+ "4xx": problemDetailsSchema,
155
+ "5xx": problemDetailsSchema
156
+ }
157
+ },
158
+ handler: async (_req, res) => {
159
+ const result = await opts.readMetricsDatasource.discoverMetrics();
160
+ res.send(result);
161
+ }
162
+ });
163
+ };
164
+ const metricTypeSchema = z.enum([
165
+ "Gauge",
166
+ "Sum",
167
+ "Histogram",
168
+ "ExponentialHistogram",
169
+ "Summary"
170
+ ]);
171
+ const discoveredAttributesSchema = z.object({
172
+ values: z.record(z.string(), z.array(z.string())).describe("Attribute key/value pairs. Max 100 values per key."),
173
+ _truncated: z.boolean().optional().describe("True if any attribute key exceeded 100 values.")
174
+ });
175
+ const discoveredMetricSchema = z.object({
176
+ name: z.string().describe("Metric name from MetricName field."),
177
+ type: metricTypeSchema.describe("Metric type: Gauge, Sum, Histogram, ExponentialHistogram, or Summary."),
178
+ unit: z.string().optional().describe("Metric unit from MetricUnit field."),
179
+ description: z.string().optional().describe("Metric description from MetricDescription field."),
180
+ attributes: discoveredAttributesSchema.describe("Data point attributes aggregated across all data points."),
181
+ resourceAttributes: discoveredAttributesSchema.describe("Resource attributes aggregated across all data points.")
182
+ });
183
+ const metricsDiscoveryResponseSchema = z.object({ metrics: z.array(discoveredMetricSchema) });
184
+
185
+ //#endregion
186
+ //#region src/index.ts
187
+ const signalsRoutes = async function(fastify, opts) {
188
+ fastify.setValidatorCompiler(validatorCompiler);
189
+ fastify.setSerializerCompiler(serializerCompiler);
190
+ fastify.setErrorHandler(errorHandler);
191
+ fastify.register(tracesRoutes, { readTracesDatasource: opts.readTelemetryDatasource });
192
+ fastify.register(logsRoutes, { readLogsDatasource: opts.readTelemetryDatasource });
193
+ fastify.register(metricsRoutes, { readMetricsDatasource: opts.readTelemetryDatasource });
194
+ };
195
+
196
+ //#endregion
197
+ export { signalsRoutes };
198
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["z"],"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/index.ts"],"sourcesContent":["export abstract class SignalsApiError 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","import {\n type FastifyError,\n type FastifyReply,\n type FastifyRequest,\n} from \"fastify\";\nimport { SignalsApiError } from \"./errors.js\";\nimport type { SignalsApiErrorResponse } 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 SignalsApiErrorResponse);\n }\n\n request.log.error(error);\n if (error instanceof SignalsApiError) {\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 SignalsApiErrorResponse);\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 SignalsApiErrorResponse);\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 SignalsApiErrorResponse = 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 });\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(req.body);\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(req.body);\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(req.body);\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 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 type { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\";\nimport { type datasource } from \"@kopai/core\";\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\";\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"],"mappings":"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"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@kopai/api",
3
+ "version": "0.0.0",
4
+ "license": "Apache-2.0",
5
+ "author": "Vladimir Adamic",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/kopai-app/kopai-mono.git",
9
+ "directory": "packages/api"
10
+ },
11
+ "homepage": "https://github.com/kopai-app/kopai-mono/tree/main/packages/api#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/kopai-app/kopai-mono/issues"
14
+ },
15
+ "type": "module",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.mjs",
20
+ "require": "./dist/index.cjs"
21
+ }
22
+ },
23
+ "main": "./dist/index.cjs",
24
+ "module": "./dist/index.mjs",
25
+ "types": "./dist/index.d.ts",
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "peerDependencies": {
30
+ "fastify": "^5.0.0",
31
+ "zod": "^4.0.0"
32
+ },
33
+ "dependencies": {
34
+ "fastify-type-provider-zod": "^6.1.0",
35
+ "@kopai/core": "0.0.0"
36
+ },
37
+ "devDependencies": {
38
+ "@fastify/swagger": "^9.6.1",
39
+ "@fastify/swagger-ui": "^5.2.4",
40
+ "tsdown": "^0.20.1",
41
+ "@kopai/tsconfig": "0.0.0"
42
+ },
43
+ "scripts": {
44
+ "build": "tsdown",
45
+ "dev": "tsdown --watch",
46
+ "lint": "eslint src",
47
+ "type-check": "tsc --noEmit",
48
+ "test": "vitest run"
49
+ }
50
+ }