@agimon-ai/po-log 0.0.0-alpha.151 → 0.0.0-alpha.153

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.
@@ -1041,7 +1041,7 @@ function isMetricsPeriod(value) {
1041
1041
  * This is the one file the routes, the Hono app and the browser all read, so a
1042
1042
  * path cannot move on one side alone.
1043
1043
  */
1044
- var apiRoutes_default = (0, _agimon_ai_po_core_web.defineApiRoutes)({
1044
+ const routes = (0, _agimon_ai_po_core_web.defineApiRoutes)({
1045
1045
  metrics: {
1046
1046
  method: "GET",
1047
1047
  path: "/metrics",
@@ -1235,7 +1235,7 @@ function createLogHubApi(options = {}) {
1235
1235
  const issues = options.issues ?? createIssuesSource(identity);
1236
1236
  const fetchImpl = options.fetchImpl ?? globalThis.fetch;
1237
1237
  const sinkEndpoint = options.sinkEndpoint ?? (() => require_metricsSource.resolveMetricsEndpoint(identity));
1238
- app.get(apiRoutes_default.metrics.path, async (context) => {
1238
+ app.get(routes.metrics.path, async (context) => {
1239
1239
  const requestedDimension = context.req.query(METRICS_QUERY_PARAMS.dimension) ?? DEFAULT_DIMENSION;
1240
1240
  const requestedPeriod = context.req.query(METRICS_QUERY_PARAMS.period) ?? DEFAULT_PERIOD;
1241
1241
  if (!isMetricsDimension(requestedDimension)) return context.json({ error: `Unknown dimension '${requestedDimension}'.` }, 400);
@@ -1271,7 +1271,7 @@ function createLogHubApi(options = {}) {
1271
1271
  * folding it into every report would make the whole page as slow as its
1272
1272
  * slowest transport.
1273
1273
  */
1274
- app.get(apiRoutes_default.issues.path, async (context) => {
1274
+ app.get(routes.issues.path, async (context) => {
1275
1275
  const focus = context.req.query(METRICS_QUERY_PARAMS.focus);
1276
1276
  const startTime = context.req.query("startTime");
1277
1277
  const endTime = context.req.query("endTime");
@@ -1293,7 +1293,7 @@ function createLogHubApi(options = {}) {
1293
1293
  return context.json(unavailable);
1294
1294
  }
1295
1295
  });
1296
- app.get(apiRoutes_default.usage.path, async (context) => {
1296
+ app.get(routes.usage.path, async (context) => {
1297
1297
  try {
1298
1298
  const rows = await options.usage?.()?.read() ?? [];
1299
1299
  return context.json({ rows });
@@ -1306,7 +1306,7 @@ function createLogHubApi(options = {}) {
1306
1306
  * redacts and rate-limits OTLP itself, so this only bounds the size and
1307
1307
  * forwards; it never parses or rewrites records.
1308
1308
  */
1309
- app.post(apiRoutes_default.ingestLogs.path, async (context) => {
1309
+ app.post(routes.ingestLogs.path, async (context) => {
1310
1310
  if (Number(context.req.header("content-length") ?? 0) > MAX_INGEST_BYTES) return context.json({ error: "Log batch is too large." }, 413);
1311
1311
  const body = await context.req.text();
1312
1312
  if (new TextEncoder().encode(body).byteLength > MAX_INGEST_BYTES) return context.json({ error: "Log batch is too large." }, 413);