@juice-js/observability 1.1.0-alpha.23 → 1.1.0-alpha.28

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.
Files changed (50) hide show
  1. package/fesm2022/juice-js-observability-agent.page-VsTEvbSN.mjs +956 -0
  2. package/fesm2022/juice-js-observability-agent.page-VsTEvbSN.mjs.map +1 -0
  3. package/fesm2022/juice-js-observability-agents.page-C9WjP1nl.mjs +413 -0
  4. package/fesm2022/juice-js-observability-agents.page-C9WjP1nl.mjs.map +1 -0
  5. package/fesm2022/{juice-js-observability-alert.page-DOAX9WWa.mjs → juice-js-observability-alert.page-79qA1Wqg.mjs} +2 -2
  6. package/fesm2022/{juice-js-observability-alert.page-DOAX9WWa.mjs.map → juice-js-observability-alert.page-79qA1Wqg.mjs.map} +1 -1
  7. package/fesm2022/{juice-js-observability-alerts.page-DUXXBanH.mjs → juice-js-observability-alerts.page-DVqDxYSq.mjs} +2 -2
  8. package/fesm2022/{juice-js-observability-alerts.page-DUXXBanH.mjs.map → juice-js-observability-alerts.page-DVqDxYSq.mjs.map} +1 -1
  9. package/fesm2022/{juice-js-observability-incident.page-CCHEWXou.mjs → juice-js-observability-incident.page-CayeZdF_.mjs} +2 -2
  10. package/fesm2022/{juice-js-observability-incident.page-CCHEWXou.mjs.map → juice-js-observability-incident.page-CayeZdF_.mjs.map} +1 -1
  11. package/fesm2022/{juice-js-observability-incidents.page-CpNqYp2W.mjs → juice-js-observability-incidents.page-Bx7afoIh.mjs} +2 -2
  12. package/fesm2022/{juice-js-observability-incidents.page-CpNqYp2W.mjs.map → juice-js-observability-incidents.page-Bx7afoIh.mjs.map} +1 -1
  13. package/fesm2022/{juice-js-observability-load-runs.page-C2rk2bz9.mjs → juice-js-observability-load-runs.page-ByWrvCra.mjs} +2 -2
  14. package/fesm2022/{juice-js-observability-load-runs.page-C2rk2bz9.mjs.map → juice-js-observability-load-runs.page-ByWrvCra.mjs.map} +1 -1
  15. package/fesm2022/{juice-js-observability-logs.page-i76xbJLH.mjs → juice-js-observability-logs.page-DMRfXnA-.mjs} +2 -2
  16. package/fesm2022/{juice-js-observability-logs.page-i76xbJLH.mjs.map → juice-js-observability-logs.page-DMRfXnA-.mjs.map} +1 -1
  17. package/fesm2022/{juice-js-observability-metrics.page-Cq5S0yGJ.mjs → juice-js-observability-metrics.page-D3xK5mgs.mjs} +2 -2
  18. package/fesm2022/{juice-js-observability-metrics.page-Cq5S0yGJ.mjs.map → juice-js-observability-metrics.page-D3xK5mgs.mjs.map} +1 -1
  19. package/fesm2022/{juice-js-observability-notifications.page-BDqb10C6.mjs → juice-js-observability-notifications.page-BvUjV46Y.mjs} +39 -6
  20. package/fesm2022/juice-js-observability-notifications.page-BvUjV46Y.mjs.map +1 -0
  21. package/fesm2022/{juice-js-observability-overview.page-DXZl_fUh.mjs → juice-js-observability-overview.page-56xVtAo2.mjs} +2 -2
  22. package/fesm2022/{juice-js-observability-overview.page-DXZl_fUh.mjs.map → juice-js-observability-overview.page-56xVtAo2.mjs.map} +1 -1
  23. package/fesm2022/{juice-js-observability-resource.page-CauDE6kK.mjs → juice-js-observability-resource.page-CRSA-zpR.mjs} +2 -2
  24. package/fesm2022/{juice-js-observability-resource.page-CauDE6kK.mjs.map → juice-js-observability-resource.page-CRSA-zpR.mjs.map} +1 -1
  25. package/fesm2022/{juice-js-observability-resources.page-CukW8vVc.mjs → juice-js-observability-resources.page-BW7W5Wy2.mjs} +2 -2
  26. package/fesm2022/{juice-js-observability-resources.page-CukW8vVc.mjs.map → juice-js-observability-resources.page-BW7W5Wy2.mjs.map} +1 -1
  27. package/fesm2022/{juice-js-observability-rules.page-Df2uDVwz.mjs → juice-js-observability-rules.page-uKeK44Iz.mjs} +2 -2
  28. package/fesm2022/{juice-js-observability-rules.page-Df2uDVwz.mjs.map → juice-js-observability-rules.page-uKeK44Iz.mjs.map} +1 -1
  29. package/fesm2022/{juice-js-observability-service.page-BFXUe4mX.mjs → juice-js-observability-service.page-D7-Wbc5P.mjs} +2 -2
  30. package/fesm2022/{juice-js-observability-service.page-BFXUe4mX.mjs.map → juice-js-observability-service.page-D7-Wbc5P.mjs.map} +1 -1
  31. package/fesm2022/{juice-js-observability-services.page-B1huLe_a.mjs → juice-js-observability-services.page-CNarlAgr.mjs} +2 -2
  32. package/fesm2022/{juice-js-observability-services.page-B1huLe_a.mjs.map → juice-js-observability-services.page-CNarlAgr.mjs.map} +1 -1
  33. package/fesm2022/{juice-js-observability-silences.page-Cg53dJAy.mjs → juice-js-observability-silences.page-DBBZBZ0a.mjs} +2 -2
  34. package/fesm2022/{juice-js-observability-silences.page-Cg53dJAy.mjs.map → juice-js-observability-silences.page-DBBZBZ0a.mjs.map} +1 -1
  35. package/fesm2022/{juice-js-observability-telemetry-BftWSOaQ.mjs → juice-js-observability-telemetry-B98lekF2.mjs} +100 -90
  36. package/fesm2022/juice-js-observability-telemetry-B98lekF2.mjs.map +1 -0
  37. package/fesm2022/{juice-js-observability-timeline.page-CtU2EoDN.mjs → juice-js-observability-timeline.page-DhU78o_M.mjs} +2 -2
  38. package/fesm2022/{juice-js-observability-timeline.page-CtU2EoDN.mjs.map → juice-js-observability-timeline.page-DhU78o_M.mjs.map} +1 -1
  39. package/fesm2022/{juice-js-observability-topology.page-CUayiRVT.mjs → juice-js-observability-topology.page-CVdoBph4.mjs} +2 -2
  40. package/fesm2022/{juice-js-observability-topology.page-CUayiRVT.mjs.map → juice-js-observability-topology.page-CVdoBph4.mjs.map} +1 -1
  41. package/fesm2022/{juice-js-observability-trace.page-ByxGFLpE.mjs → juice-js-observability-trace.page-C-icZvAo.mjs} +2 -2
  42. package/fesm2022/{juice-js-observability-trace.page-ByxGFLpE.mjs.map → juice-js-observability-trace.page-C-icZvAo.mjs.map} +1 -1
  43. package/fesm2022/{juice-js-observability-traces.page-DXSDdeTH.mjs → juice-js-observability-traces.page-c8CoI2AY.mjs} +2 -2
  44. package/fesm2022/{juice-js-observability-traces.page-DXSDdeTH.mjs.map → juice-js-observability-traces.page-c8CoI2AY.mjs.map} +1 -1
  45. package/fesm2022/juice-js-observability.mjs +76 -22
  46. package/fesm2022/juice-js-observability.mjs.map +1 -1
  47. package/package.json +1 -1
  48. package/types/juice-js-observability.d.ts +100 -0
  49. package/fesm2022/juice-js-observability-notifications.page-BDqb10C6.mjs.map +0 -1
  50. package/fesm2022/juice-js-observability-telemetry-BftWSOaQ.mjs.map +0 -1
@@ -96,6 +96,13 @@ i0.ɵɵngDeclareClassMetadata({
96
96
  args: [{ name: "jcLink" }]
97
97
  }]
98
98
  });
99
+ function idempotencyKey() {
100
+ const b = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
101
+ b[6] = b[6] & 15 | 64;
102
+ b[8] = b[8] & 63 | 128;
103
+ const hex = Array.from(b, (x) => x.toString(16).padStart(2, "0")).join("");
104
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
105
+ }
99
106
  var ApiService = class ApiService {
100
107
  http = inject(HttpClient);
101
108
  base = `${inject(OBSERVABILITY_OPTIONS).apiBase}/api/v1`;
@@ -118,7 +125,7 @@ var ApiService = class ApiService {
118
125
  })));
119
126
  }
120
127
  once(path, body) {
121
- return this.send("POST", path, body, { "Idempotency-Key": crypto.randomUUID() });
128
+ return this.send("POST", path, body, { "Idempotency-Key": idempotencyKey() });
122
129
  }
123
130
  all(path, query = {}, maxPages = 25) {
124
131
  let pages = 0;
@@ -179,6 +186,12 @@ var ApiService = class ApiService {
179
186
  ...query
180
187
  });
181
188
  }
189
+ testChannel(id) {
190
+ return this.send("POST", `/webhooks/${id}/test`);
191
+ }
192
+ retryDelivery(channelId, deliveryId) {
193
+ return this.send("POST", `/webhooks/${channelId}/deliveries/${deliveryId}/retry`);
194
+ }
182
195
  allowlist() {
183
196
  return this.get("/webhooks/allowlist");
184
197
  }
@@ -236,6 +249,39 @@ var ApiService = class ApiService {
236
249
  removeIncidentAlert(id, alertId) {
237
250
  return this.send("DELETE", `/incidents/${id}/alerts/${alertId}`);
238
251
  }
252
+ agents(all = false) {
253
+ return this.get("/agents", { all: all || null });
254
+ }
255
+ agent(id) {
256
+ return this.get(`/agents/${id}`);
257
+ }
258
+ createEnrollmentToken(purpose, expiresInMinutes) {
259
+ return this.send("POST", "/agents/enrollment-tokens", {
260
+ purpose,
261
+ expiresInMinutes
262
+ });
263
+ }
264
+ revokeAgent(id, reason) {
265
+ return this.send("POST", `/agents/${id}/revocation`, { reason });
266
+ }
267
+ agentActions(id) {
268
+ return this.get(`/agents/${id}/actions`);
269
+ }
270
+ agentPackages() {
271
+ return this.get("/agents/packages");
272
+ }
273
+ issueCommand(id, action, parameters) {
274
+ return this.once(`/agents/${id}/commands`, {
275
+ action,
276
+ parameters
277
+ });
278
+ }
279
+ agentCommands(id, cursor) {
280
+ return this.get(`/agents/${id}/commands`, {
281
+ limit: 25,
282
+ cursor
283
+ });
284
+ }
239
285
  alertNotifications(id) {
240
286
  return this.get(`/alerts/${id}/notifications`);
241
287
  }
@@ -252,7 +298,7 @@ var ApiService = class ApiService {
252
298
  return this.get(`/alerts/${id}`);
253
299
  }
254
300
  acknowledge(id, comment) {
255
- return this.tenant$.pipe(switchMap((t) => this.http.post(`${this.base}/tenants/${t.id}/alerts/${id}/acknowledgement`, { comment }, { headers: { "Idempotency-Key": crypto.randomUUID() } })));
301
+ return this.tenant$.pipe(switchMap((t) => this.http.post(`${this.base}/tenants/${t.id}/alerts/${id}/acknowledgement`, { comment }, { headers: { "Idempotency-Key": idempotencyKey() } })));
256
302
  }
257
303
  traces(query) {
258
304
  return this.get("/telemetry/traces", query);
@@ -431,25 +477,27 @@ function page(path, title, load) {
431
477
  };
432
478
  }
433
479
  const OBSERVABILITY_ROUTES = [
434
- page("", "Overview", () => import("./juice-js-observability-overview.page-DXZl_fUh.mjs").then((m) => m.OverviewPage)),
435
- page("services", "Services", () => import("./juice-js-observability-services.page-B1huLe_a.mjs").then((m) => m.ServicesPage)),
436
- page("services/:id", "Service", () => import("./juice-js-observability-service.page-BFXUe4mX.mjs").then((m) => m.ServicePage)),
437
- page("traces", "Traces", () => import("./juice-js-observability-traces.page-DXSDdeTH.mjs").then((m) => m.TracesPage)),
438
- page("traces/:traceId", "Trace", () => import("./juice-js-observability-trace.page-ByxGFLpE.mjs").then((m) => m.TracePage)),
439
- page("topology", "Dependencies", () => import("./juice-js-observability-topology.page-CUayiRVT.mjs").then((m) => m.TopologyPage)),
440
- page("logs", "Logs", () => import("./juice-js-observability-logs.page-i76xbJLH.mjs").then((m) => m.LogsPage)),
441
- page("metrics", "Metrics", () => import("./juice-js-observability-metrics.page-Cq5S0yGJ.mjs").then((m) => m.MetricsPage)),
442
- page("resources", "Resources", () => import("./juice-js-observability-resources.page-CukW8vVc.mjs").then((m) => m.ResourcesPage)),
443
- page("resources/:id", "Resource", () => import("./juice-js-observability-resource.page-CauDE6kK.mjs").then((m) => m.ResourcePage)),
444
- page("alerts", "Alerts", () => import("./juice-js-observability-alerts.page-DUXXBanH.mjs").then((m) => m.AlertsPage)),
445
- page("alerts/:id", "Alert", () => import("./juice-js-observability-alert.page-DOAX9WWa.mjs").then((m) => m.AlertPage)),
446
- page("rules", "Rules", () => import("./juice-js-observability-rules.page-Df2uDVwz.mjs").then((m) => m.RulesPage)),
447
- page("notifications", "Notifications", () => import("./juice-js-observability-notifications.page-BDqb10C6.mjs").then((m) => m.NotificationsPage)),
448
- page("silences", "Silences", () => import("./juice-js-observability-silences.page-Cg53dJAy.mjs").then((m) => m.SilencesPage)),
449
- page("incidents", "Incidents", () => import("./juice-js-observability-incidents.page-CpNqYp2W.mjs").then((m) => m.IncidentsPage)),
450
- page("incidents/:id", "Incident", () => import("./juice-js-observability-incident.page-CCHEWXou.mjs").then((m) => m.IncidentPage)),
451
- page("timeline", "Timeline", () => import("./juice-js-observability-timeline.page-CtU2EoDN.mjs").then((m) => m.TimelinePage)),
452
- page("load-runs", "Load runs", () => import("./juice-js-observability-load-runs.page-C2rk2bz9.mjs").then((m) => m.LoadRunsPage))
480
+ page("", "Overview", () => import("./juice-js-observability-overview.page-56xVtAo2.mjs").then((m) => m.OverviewPage)),
481
+ page("services", "Services", () => import("./juice-js-observability-services.page-CNarlAgr.mjs").then((m) => m.ServicesPage)),
482
+ page("services/:id", "Service", () => import("./juice-js-observability-service.page-D7-Wbc5P.mjs").then((m) => m.ServicePage)),
483
+ page("traces", "Traces", () => import("./juice-js-observability-traces.page-c8CoI2AY.mjs").then((m) => m.TracesPage)),
484
+ page("traces/:traceId", "Trace", () => import("./juice-js-observability-trace.page-C-icZvAo.mjs").then((m) => m.TracePage)),
485
+ page("topology", "Dependencies", () => import("./juice-js-observability-topology.page-CVdoBph4.mjs").then((m) => m.TopologyPage)),
486
+ page("logs", "Logs", () => import("./juice-js-observability-logs.page-DMRfXnA-.mjs").then((m) => m.LogsPage)),
487
+ page("metrics", "Metrics", () => import("./juice-js-observability-metrics.page-D3xK5mgs.mjs").then((m) => m.MetricsPage)),
488
+ page("resources", "Resources", () => import("./juice-js-observability-resources.page-BW7W5Wy2.mjs").then((m) => m.ResourcesPage)),
489
+ page("resources/:id", "Resource", () => import("./juice-js-observability-resource.page-CRSA-zpR.mjs").then((m) => m.ResourcePage)),
490
+ page("alerts", "Alerts", () => import("./juice-js-observability-alerts.page-DVqDxYSq.mjs").then((m) => m.AlertsPage)),
491
+ page("alerts/:id", "Alert", () => import("./juice-js-observability-alert.page-79qA1Wqg.mjs").then((m) => m.AlertPage)),
492
+ page("rules", "Rules", () => import("./juice-js-observability-rules.page-uKeK44Iz.mjs").then((m) => m.RulesPage)),
493
+ page("notifications", "Notifications", () => import("./juice-js-observability-notifications.page-BvUjV46Y.mjs").then((m) => m.NotificationsPage)),
494
+ page("silences", "Silences", () => import("./juice-js-observability-silences.page-DBBZBZ0a.mjs").then((m) => m.SilencesPage)),
495
+ page("incidents", "Incidents", () => import("./juice-js-observability-incidents.page-Bx7afoIh.mjs").then((m) => m.IncidentsPage)),
496
+ page("incidents/:id", "Incident", () => import("./juice-js-observability-incident.page-CayeZdF_.mjs").then((m) => m.IncidentPage)),
497
+ page("agents", "Agents", () => import("./juice-js-observability-agents.page-C9WjP1nl.mjs").then((m) => m.AgentsPage)),
498
+ page("agents/:id", "Agent", () => import("./juice-js-observability-agent.page-VsTEvbSN.mjs").then((m) => m.AgentPage)),
499
+ page("timeline", "Timeline", () => import("./juice-js-observability-timeline.page-DhU78o_M.mjs").then((m) => m.TimelinePage)),
500
+ page("load-runs", "Load runs", () => import("./juice-js-observability-load-runs.page-ByWrvCra.mjs").then((m) => m.LoadRunsPage))
453
501
  ];
454
502
  function observabilityMenus(basePath = "/", order = 1) {
455
503
  const base = normalizeBasePath(basePath);
@@ -527,6 +575,12 @@ function observabilityMenus(basePath = "/", order = 1) {
527
575
  icon: "campaign",
528
576
  routerLink: link("notifications")
529
577
  },
578
+ {
579
+ id: "agents",
580
+ label: "Agents",
581
+ icon: "smart_toy",
582
+ routerLink: link("agents")
583
+ },
530
584
  {
531
585
  id: "timeline",
532
586
  label: "Timeline",
@@ -544,6 +598,6 @@ function observabilityMenus(basePath = "/", order = 1) {
544
598
  order: order + index
545
599
  }));
546
600
  }
547
- export { ApiService, ContextService, LinkPipe, MAX_SEARCH_MS, OBSERVABILITY_OPTIONS, OBSERVABILITY_ROUTES, ObservabilityLinks, RANGES, normalizeBasePath, observabilityMenus, provideJuiceObservability };
601
+ export { ApiService, ContextService, LinkPipe, MAX_SEARCH_MS, OBSERVABILITY_OPTIONS, OBSERVABILITY_ROUTES, ObservabilityLinks, RANGES, idempotencyKey, normalizeBasePath, observabilityMenus, provideJuiceObservability };
548
602
 
549
603
  //# sourceMappingURL=juice-js-observability.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"juice-js-observability.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/core/options.ts","../../../../projects/juice-js/observability/src/lib/core/api.service.ts","../../../../projects/juice-js/observability/src/lib/core/context.service.ts","../../../../projects/juice-js/observability/src/lib/observability.routes.ts"],"sourcesContent":["import { EnvironmentProviders, Injectable, InjectionToken, Pipe, PipeTransform, inject, makeEnvironmentProviders } from '@angular/core';\n\n/** How the host app mounts Juice Observability. */\nexport interface ObservabilityOptions {\n /** The Juice API origin; empty when the API serves the app (same origin). */\n apiBase: string;\n /** Where the host mounts {@link OBSERVABILITY_ROUTES}: `/` for the whole app, or a path such as `/observability`. */\n basePath: string;\n /**\n * A link to the audit records of a trace, shown on the trace page: for the Juice Audit pages mounted at `/audit`,\n * `id => ['/audit/traces', id]`. A string is an external URL. Without it, no link.\n */\n auditLink?: ((traceId: string) => unknown[] | string | null) | null;\n}\n\nexport const OBSERVABILITY_OPTIONS = new InjectionToken<ObservabilityOptions>('OBSERVABILITY_OPTIONS', {\n providedIn: 'root',\n factory: () => ({ apiBase: '', basePath: '/', auditLink: null }),\n});\n\n/** Configures the pages: where the API is, where the host mounted the routes, and where a trace's audit records open. */\nexport function provideJuiceObservability(options: Partial<ObservabilityOptions> = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: OBSERVABILITY_OPTIONS,\n useValue: {\n apiBase: options.apiBase ?? '',\n basePath: options.basePath ?? '/',\n auditLink: options.auditLink ?? null,\n } satisfies ObservabilityOptions,\n },\n ]);\n}\n\n/** `/observability/` → `/observability`; `` and `/` → `/`. */\nexport function normalizeBasePath(basePath: string): string {\n const trimmed = basePath.trim().replace(/^\\/+|\\/+$/g, '');\n return trimmed ? `/${trimmed}` : '/';\n}\n\n/** Router links to the pages, under the host's mount path. */\n@Injectable({ providedIn: 'root' })\nexport class ObservabilityLinks {\n private readonly options = inject(OBSERVABILITY_OPTIONS);\n readonly base = normalizeBasePath(this.options.basePath);\n\n /** `to('services', id)` → `['/observability', 'services', id]`. */\n to(...segments: unknown[]): unknown[] { return [this.base, ...segments]; }\n\n /** The host's link to the audit records of a trace, if it gave one. */\n audit(traceId: string | null | undefined): { route: unknown[] } | { href: string } | null {\n if (!traceId || !this.options.auditLink) return null;\n const link = this.options.auditLink(traceId);\n if (!link) return null;\n return typeof link === 'string' ? { href: link } : { route: link };\n }\n}\n\n/** `['services', id] | jcLink`: the same as {@link ObservabilityLinks.to} in a template. */\n@Pipe({ name: 'jcLink' })\nexport class LinkPipe implements PipeTransform {\n private readonly links = inject(ObservabilityLinks);\n transform(segments: unknown[]): unknown[] { return this.links.to(...segments); }\n}\n","import { HttpClient, HttpParams } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { EMPTY, Observable, expand, map, reduce, shareReplay, switchMap } from 'rxjs';\nimport { OBSERVABILITY_OPTIONS } from './options';\nimport {\n AlertDetail, AlertNotifications, Alert, AllowlistEntry, Application, Channel, Delivery, EscalationPolicy, IncidentDetail, IncidentEvent, IncidentSummary, Silence, DependencyEvidence, DependencyStatsPage, DeploymentEnvironment, LoadRun, LoadRunResults, Related, Timeline, Health, LogRecord, MetricInfo, Operation,\n Page, ResourceDetail, ResourceSummary, Rule, SearchHit, Series, Capacity, ServiceStats, Tenant, TelemetryPage, Topology, Trace,\n TraceSummary,\n} from './models';\n\nexport type Query = Record<string, string | number | boolean | string[] | null | undefined>;\n\n/**\n * The Console's only backend: the Juice API (Console requirements §3). One deployment serves one tenant, the one the\n * signed-in user's token names.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApiService {\n private readonly http = inject(HttpClient);\n private readonly base = `${inject(OBSERVABILITY_OPTIONS).apiBase}/api/v1`;\n\n /** The caller's tenant, fetched once. */\n readonly tenant$: Observable<Tenant> = this.http.get<Page<Tenant>>(`${this.base}/tenants`).pipe(\n map(page => {\n if (page.items.length === 0) throw new Error('No tenant is authorized for this user.');\n return page.items[0];\n }),\n shareReplay(1),\n );\n\n private get<T>(path: string, query: Query = {}): Observable<T> {\n let params = new HttpParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === null || value === undefined || value === '') continue;\n for (const item of Array.isArray(value) ? value : [value]) params = params.append(key, String(item));\n }\n return this.tenant$.pipe(switchMap(t => this.http.get<T>(`${this.base}/tenants/${t.id}${path}`, { params })));\n }\n\n /** A change. `Idempotency-Key` on what can be retried, so a repeated click or a lost response doesn't do it twice. */\n private send<T>(method: 'POST' | 'PUT' | 'DELETE', path: string, body?: unknown, headers: Record<string, string> = {}): Observable<T> {\n return this.tenant$.pipe(switchMap(t => this.http.request<T>(method, `${this.base}/tenants/${t.id}${path}`, { body, headers })));\n }\n private once<T>(path: string, body: unknown): Observable<T> { return this.send<T>('POST', path, body, { 'Idempotency-Key': crypto.randomUUID() }); }\n\n /** Every page of a cursor-paged list (bounded: at most `maxPages` requests). */\n private all<T>(path: string, query: Query = {}, maxPages = 25): Observable<Page<T>> {\n let pages = 0;\n return this.get<Page<T>>(path, { ...query, limit: 200 }).pipe(\n expand(page => page.nextCursor && ++pages < maxPages ? this.get<Page<T>>(path, { ...query, limit: 200, cursor: page.nextCursor }) : EMPTY),\n reduce((all, page) => ({ items: [...all.items, ...page.items], nextCursor: page.nextCursor }), { items: [] as T[], nextCursor: null as string | null }),\n );\n }\n\n environments() { return this.get<Page<DeploymentEnvironment>>('/environments'); }\n applications() { return this.get<Page<Application>>('/applications', { limit: 200 }); }\n resources(type?: string) { return this.all<ResourceSummary>('/resources', { type }); }\n resource(id: string) { return this.get<ResourceDetail>(`/resources/${id}`); }\n health(query: Query) { return this.all<Health>('/health', query); }\n topology(environment?: string | null) { return this.get<Topology>('/topology', { environment }); }\n\n rules() { return this.get<Page<Rule>>('/rules', { limit: 200 }); }\n createRule(definition: unknown) { return this.send<Rule>('POST', '/rules', definition); }\n /** With the rule's etag, so a change made since it was read isn't overwritten. */\n updateRule(key: string, definition: unknown, etag: string) { return this.send<Rule>('PUT', `/rules/${key}`, definition, { 'If-Match': `\"${etag}\"` }); }\n\n channels() { return this.get<Page<Channel>>('/webhooks'); }\n createChannel(body: unknown) { return this.send<Channel>('POST', '/webhooks', body); }\n updateChannel(id: string, body: unknown) { return this.send<Channel>('PUT', `/webhooks/${id}`, body); }\n deliveries(id: string, query: Query = {}) { return this.get<Page<Delivery>>(`/webhooks/${id}/deliveries`, { limit: 50, ...query }); }\n allowlist() { return this.get<Page<AllowlistEntry>>('/webhooks/allowlist'); }\n putAllowlist(destination: string, ports: number[]) { return this.send<AllowlistEntry>('PUT', '/webhooks/allowlist', { destination, ports }); }\n removeAllowlist(destination: string) { return this.send<void>('DELETE', `/webhooks/allowlist?destination=${encodeURIComponent(destination)}`); }\n\n escalationPolicies() { return this.get<Page<EscalationPolicy>>('/escalation-policies'); }\n createEscalationPolicy(body: unknown) { return this.send<EscalationPolicy>('POST', '/escalation-policies', body); }\n updateEscalationPolicy(key: string, body: unknown) { return this.send<EscalationPolicy>('PUT', `/escalation-policies/${key}`, body); }\n\n silences(query: Query = {}) { return this.get<Page<Silence>>('/silences', { limit: 200, ...query }); }\n createSilence(body: unknown) { return this.once<Silence>('/silences', body); }\n cancelSilence(id: string) { return this.send<void>('DELETE', `/silences/${id}`); }\n\n incidents(query: Query = {}) { return this.get<Page<IncidentSummary>>('/incidents', { limit: 100, ...query }); }\n incident(id: string) { return this.get<IncidentDetail>(`/incidents/${id}`); }\n createIncident(body: unknown) { return this.once<IncidentSummary>('/incidents', body); }\n moveIncident(id: string, to: string, comment: string) { return this.once<IncidentSummary>(`/incidents/${id}/transitions`, { to, comment }); }\n addIncidentNote(id: string, text: string) { return this.once<IncidentEvent>(`/incidents/${id}/notes`, { text }); }\n removeIncidentAlert(id: string, alertId: string) { return this.send<void>('DELETE', `/incidents/${id}/alerts/${alertId}`); }\n alertNotifications(id: string) { return this.get<AlertNotifications>(`/alerts/${id}/notifications`); }\n\n /** One page of alerts, newest first; pass the previous page's `nextCursor` as `cursor` for the next. */\n alerts(query: Query) { return this.get<Page<Alert>>('/alerts', { limit: 100, ...query }); }\n /** Every alert matching the query (bounded, like the other complete lists). */\n allAlerts(query: Query) { return this.all<Alert>('/alerts', query); }\n alert(id: string) { return this.get<AlertDetail>(`/alerts/${id}`); }\n acknowledge(id: string, comment: string): Observable<Alert> {\n return this.tenant$.pipe(switchMap(t => this.http.post<Alert>(`${this.base}/tenants/${t.id}/alerts/${id}/acknowledgement`,\n { comment }, { headers: { 'Idempotency-Key': crypto.randomUUID() } })));\n }\n\n traces(query: Query) { return this.get<TelemetryPage<TraceSummary>>('/telemetry/traces', query); }\n trace(traceId: string) { return this.get<Trace>(`/telemetry/traces/${traceId}`); }\n logs(query: Query) { return this.get<TelemetryPage<LogRecord>>('/telemetry/logs', query); }\n operations(query: Query) { return this.get<TelemetryPage<Operation>>('/telemetry/operations', query); }\n metrics(query: Query) { return this.get<TelemetryPage<MetricInfo>>('/telemetry/metrics', query); }\n series(query: Query) { return this.get<Series>('/telemetry/metrics/series', query); }\n serviceStats(query: Query) { return this.get<ServiceStats>('/telemetry/service-stats', query); }\n capacity(query: Query) { return this.get<Capacity>('/telemetry/capacity', query); }\n timeline(query: Query) { return this.get<Timeline>('/timeline', query); }\n relatedToAlert(id: string) { return this.get<Related>(`/alerts/${id}/related`); }\n loadRuns(query: Query) { return this.get<Page<LoadRun>>('/load-runs', query); }\n loadRunResults(id: string) { return this.get<LoadRunResults>(`/load-runs/${id}/results`); }\n dependencyStats(query: Query) { return this.get<DependencyStatsPage>('/telemetry/dependencies', query); }\n dependency(id: string, query: Query) { return this.get<DependencyEvidence>(`/telemetry/dependencies/${id}`, query); }\n search(q: string) { return this.get<TelemetryPage<SearchHit>>('/search', { q }); }\n}\n","import { Injectable, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router';\nimport { filter, map, startWith } from 'rxjs';\n\nexport const RANGES: Record<string, number> = {\n '15m': 15 * 60_000, '1h': 3_600_000, '6h': 6 * 3_600_000, '24h': 24 * 3_600_000, '7d': 7 * 24 * 3_600_000,\n};\n\n/** Search ranges are at most 24 hours (the API's bound); series and operations take up to 7 days. */\nexport const MAX_SEARCH_MS = RANGES['24h'];\n\n/**\n * The investigation context that follows the user between pages (Console requirements §17): environment and time\n * range. It lives in the URL (`env`, and `range` or `from`/`to`), so every page is a deep link and the browser's back\n * button restores it.\n */\n@Injectable({ providedIn: 'root' })\nexport class ContextService {\n private readonly router = inject(Router);\n\n // Created on first use, after the first navigation may already have ended: start from the current URL.\n private readonly params = toSignal(this.router.events.pipe(\n filter(e => e instanceof NavigationEnd),\n startWith(null),\n map(() => this.leaf().snapshot.queryParams),\n ), { initialValue: {} as Params });\n\n readonly environment = computed(() => (this.params()['env'] as string | undefined) ?? '');\n readonly range = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? 'custom' : ((p['range'] as string | undefined) ?? '1h');\n });\n readonly absolute = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? { from: p['from'] as string, to: p['to'] as string } : null;\n });\n\n /** The window as ISO strings, evaluated now for a relative range. */\n window(maxMs?: number): { from: string; to: string } {\n const absolute = this.absolute();\n if (absolute) return absolute;\n const to = Date.now();\n const span = Math.min(RANGES[this.range()] ?? RANGES['1h'], maxMs ?? Number.MAX_SAFE_INTEGER);\n return { from: new Date(to - span).toISOString(), to: new Date(to).toISOString() };\n }\n\n /** Query parameters for a link: the context plus the target page's own. */\n keep(extra: Params = {}): Params {\n const p = this.params();\n const context: Params = {};\n for (const key of ['env', 'range', 'from', 'to']) if (p[key]) context[key] = p[key];\n return { ...context, ...extra };\n }\n\n /** Changes the context on the current page, keeping its other parameters. */\n set(change: { env?: string | null; range?: string | null; from?: string | null; to?: string | null }) {\n const queryParams: Params = { ...change };\n if (change.range) Object.assign(queryParams, { from: null, to: null });\n void this.router.navigate([], { relativeTo: this.leaf(), queryParams, queryParamsHandling: 'merge' });\n }\n\n /** A time window centred on a moment, for \"around this span\" links. */\n around(at: string, durationMs: number, paddingMs = 5 * 60_000): Params {\n const start = new Date(at).getTime();\n return this.keep({\n from: new Date(start - paddingMs).toISOString(),\n to: new Date(start + durationMs + paddingMs).toISOString(),\n range: null,\n });\n }\n\n private leaf(): ActivatedRoute {\n let route = this.router.routerState.root;\n while (route.firstChild) route = route.firstChild;\n return route;\n }\n}\n","import { Routes } from '@angular/router';\nimport { Menus } from '@juice-js/core';\nimport { normalizeBasePath } from './core/options';\n\nfunction page(path: string, title: string, load: Routes[number]['loadComponent']): Routes[number] {\n return { path, title: `${title} · Juice Observability`, loadComponent: load };\n}\n\n/**\n * The pages, investigation first (Console requirements §4): services, traces, topology, logs and metrics; alerts and\n * rules after. Detail pages are deep links (§17) and carry the environment and time range in their query parameters.\n * The host mounts them at its `basePath` (see {@link provideJuiceObservability}) and adds its own guards.\n */\nexport const OBSERVABILITY_ROUTES: Routes = [\n page('', 'Overview', () => import('./pages/overview.page').then(m => m.OverviewPage)),\n page('services', 'Services', () => import('./pages/services.page').then(m => m.ServicesPage)),\n page('services/:id', 'Service', () => import('./pages/service.page').then(m => m.ServicePage)),\n page('traces', 'Traces', () => import('./pages/traces.page').then(m => m.TracesPage)),\n page('traces/:traceId', 'Trace', () => import('./pages/trace.page').then(m => m.TracePage)),\n page('topology', 'Dependencies', () => import('./pages/topology.page').then(m => m.TopologyPage)),\n page('logs', 'Logs', () => import('./pages/logs.page').then(m => m.LogsPage)),\n page('metrics', 'Metrics', () => import('./pages/metrics.page').then(m => m.MetricsPage)),\n page('resources', 'Resources', () => import('./pages/resources.page').then(m => m.ResourcesPage)),\n page('resources/:id', 'Resource', () => import('./pages/resource.page').then(m => m.ResourcePage)),\n page('alerts', 'Alerts', () => import('./pages/alerts.page').then(m => m.AlertsPage)),\n page('alerts/:id', 'Alert', () => import('./pages/alert.page').then(m => m.AlertPage)),\n page('rules', 'Rules', () => import('./pages/rules.page').then(m => m.RulesPage)),\n page('notifications', 'Notifications', () => import('./pages/notifications.page').then(m => m.NotificationsPage)),\n page('silences', 'Silences', () => import('./pages/silences.page').then(m => m.SilencesPage)),\n page('incidents', 'Incidents', () => import('./pages/incidents.page').then(m => m.IncidentsPage)),\n page('incidents/:id', 'Incident', () => import('./pages/incident.page').then(m => m.IncidentPage)),\n page('timeline', 'Timeline', () => import('./pages/timeline.page').then(m => m.TimelinePage)),\n page('load-runs', 'Load runs', () => import('./pages/load-runs.page').then(m => m.LoadRunsPage)),\n];\n\n/** The side menu entries (juice-layout), investigation pages first, linking under `basePath`. */\nexport function observabilityMenus(basePath = '/', order = 1): Menus {\n const base = normalizeBasePath(basePath);\n const link = (path: string) => (base === '/' ? `/${path}` : path ? `${base}/${path}` : base);\n return [\n { id: 'overview', label: 'Overview', icon: 'dashboard', routerLink: link('') },\n { id: 'services', label: 'Services', icon: 'hub', routerLink: link('services') },\n { id: 'traces', label: 'Traces', icon: 'timeline', routerLink: link('traces') },\n { id: 'topology', label: 'Dependencies', icon: 'account_tree', routerLink: link('topology') },\n { id: 'logs', label: 'Logs', icon: 'notes', routerLink: link('logs') },\n { id: 'metrics', label: 'Metrics', icon: 'show_chart', routerLink: link('metrics') },\n { id: 'resources', label: 'Resources', icon: 'dns', routerLink: link('resources') },\n { id: 'alerts', label: 'Alerts', icon: 'notifications', routerLink: link('alerts') },\n { id: 'incidents', label: 'Incidents', icon: 'emergency', routerLink: link('incidents') },\n { id: 'rules', label: 'Rules', icon: 'rule', routerLink: link('rules') },\n { id: 'silences', label: 'Silences', icon: 'notifications_paused', routerLink: link('silences') },\n { id: 'notifications', label: 'Notifications', icon: 'campaign', routerLink: link('notifications') },\n { id: 'timeline', label: 'Timeline', icon: 'history', routerLink: link('timeline') },\n { id: 'load-runs', label: 'Load runs', icon: 'speed', routerLink: link('load-runs') },\n ].map((menu, index) => ({ ...menu, order: order + index }));\n}\n"],"mappings":";;;;;;AAeA,MAAa,wBAAwB,IAAI,eAAqC,yBAAyB;CACrG,YAAY;CACZ,gBAAgB;EAAE,SAAS;EAAI,UAAU;EAAK,WAAW;CAAI;AAC9D,CAAA;AAGD,SAAgB,0BAA0B,UAAyC,CAAA,GAAE;CACnF,OAAO,yBAAyB,CAC9B;EACE,SAAS;EACT,UAAU;GACR,SAAS,QAAQ,WAAW;GAC5B,UAAU,QAAQ,YAAY;GAC9B,WAA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,MAAM,WAAW;EAAE,GAAG;EAAM,OAAO,QAAQ;CAAK,EAAG;AAC5D"}
1
+ {"version":3,"file":"juice-js-observability.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/core/options.ts","../../../../projects/juice-js/observability/src/lib/core/api.service.ts","../../../../projects/juice-js/observability/src/lib/core/context.service.ts","../../../../projects/juice-js/observability/src/lib/observability.routes.ts"],"sourcesContent":["import { EnvironmentProviders, Injectable, InjectionToken, Pipe, PipeTransform, inject, makeEnvironmentProviders } from '@angular/core';\n\n/** How the host app mounts Juice Observability. */\nexport interface ObservabilityOptions {\n /** The Juice API origin; empty when the API serves the app (same origin). */\n apiBase: string;\n /** Where the host mounts {@link OBSERVABILITY_ROUTES}: `/` for the whole app, or a path such as `/observability`. */\n basePath: string;\n /**\n * A link to the audit records of a trace, shown on the trace page: for the Juice Audit pages mounted at `/audit`,\n * `id => ['/audit/traces', id]`. A string is an external URL. Without it, no link.\n */\n auditLink?: ((traceId: string) => unknown[] | string | null) | null;\n}\n\nexport const OBSERVABILITY_OPTIONS = new InjectionToken<ObservabilityOptions>('OBSERVABILITY_OPTIONS', {\n providedIn: 'root',\n factory: () => ({ apiBase: '', basePath: '/', auditLink: null }),\n});\n\n/** Configures the pages: where the API is, where the host mounted the routes, and where a trace's audit records open. */\nexport function provideJuiceObservability(options: Partial<ObservabilityOptions> = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: OBSERVABILITY_OPTIONS,\n useValue: {\n apiBase: options.apiBase ?? '',\n basePath: options.basePath ?? '/',\n auditLink: options.auditLink ?? null,\n } satisfies ObservabilityOptions,\n },\n ]);\n}\n\n/** `/observability/` → `/observability`; `` and `/` → `/`. */\nexport function normalizeBasePath(basePath: string): string {\n const trimmed = basePath.trim().replace(/^\\/+|\\/+$/g, '');\n return trimmed ? `/${trimmed}` : '/';\n}\n\n/** Router links to the pages, under the host's mount path. */\n@Injectable({ providedIn: 'root' })\nexport class ObservabilityLinks {\n private readonly options = inject(OBSERVABILITY_OPTIONS);\n readonly base = normalizeBasePath(this.options.basePath);\n\n /** `to('services', id)` → `['/observability', 'services', id]`. */\n to(...segments: unknown[]): unknown[] { return [this.base, ...segments]; }\n\n /** The host's link to the audit records of a trace, if it gave one. */\n audit(traceId: string | null | undefined): { route: unknown[] } | { href: string } | null {\n if (!traceId || !this.options.auditLink) return null;\n const link = this.options.auditLink(traceId);\n if (!link) return null;\n return typeof link === 'string' ? { href: link } : { route: link };\n }\n}\n\n/** `['services', id] | jcLink`: the same as {@link ObservabilityLinks.to} in a template. */\n@Pipe({ name: 'jcLink' })\nexport class LinkPipe implements PipeTransform {\n private readonly links = inject(ObservabilityLinks);\n transform(segments: unknown[]): unknown[] { return this.links.to(...segments); }\n}\n","import { HttpClient, HttpParams } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { EMPTY, Observable, expand, map, reduce, shareReplay, switchMap } from 'rxjs';\nimport { OBSERVABILITY_OPTIONS } from './options';\nimport {\n Agent, AgentActions, AgentCommand, AgentPackage, EnrollmentToken, AlertDetail, AlertNotifications, Alert, AllowlistEntry, Application, Channel, ChannelTestResult, Delivery, EscalationPolicy, IncidentDetail, IncidentEvent, IncidentSummary, Silence, DependencyEvidence, DependencyStatsPage, DeploymentEnvironment, LoadRun, LoadRunResults, Related, Timeline, Health, LogRecord, MetricInfo, Operation,\n Page, ResourceDetail, ResourceSummary, Rule, SearchHit, Series, Capacity, ServiceStats, Tenant, TelemetryPage, Topology, Trace,\n TraceSummary,\n} from './models';\n\n/**\n * A random UUID v4 for `Idempotency-Key`. Not `crypto.randomUUID()`: browsers offer it only in a secure context (HTTPS or localhost), so it\n * throws on a Console opened over plain HTTP at the machine's address, as the local stack is. `getRandomValues` works everywhere.\n */\nexport function idempotencyKey(): string {\n const b = crypto.getRandomValues(new Uint8Array(16));\n b[6] = (b[6] & 0x0f) | 0x40;\n b[8] = (b[8] & 0x3f) | 0x80;\n const hex = Array.from(b, x => x.toString(16).padStart(2, '0')).join('');\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n\nexport type Query =Record<string, string | number | boolean | string[] | null | undefined>;\n\n/**\n * The Console's only backend: the Juice API (Console requirements §3). One deployment serves one tenant, the one the\n * signed-in user's token names.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApiService {\n private readonly http = inject(HttpClient);\n private readonly base = `${inject(OBSERVABILITY_OPTIONS).apiBase}/api/v1`;\n\n /** The caller's tenant, fetched once. */\n readonly tenant$: Observable<Tenant> = this.http.get<Page<Tenant>>(`${this.base}/tenants`).pipe(\n map(page => {\n if (page.items.length === 0) throw new Error('No tenant is authorized for this user.');\n return page.items[0];\n }),\n shareReplay(1),\n );\n\n private get<T>(path: string, query: Query = {}): Observable<T> {\n let params = new HttpParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === null || value === undefined || value === '') continue;\n for (const item of Array.isArray(value) ? value : [value]) params = params.append(key, String(item));\n }\n return this.tenant$.pipe(switchMap(t => this.http.get<T>(`${this.base}/tenants/${t.id}${path}`, { params })));\n }\n\n /** A change. `Idempotency-Key` on what can be retried, so a repeated click or a lost response doesn't do it twice. */\n private send<T>(method: 'POST' | 'PUT' | 'DELETE', path: string, body?: unknown, headers: Record<string, string> = {}): Observable<T> {\n return this.tenant$.pipe(switchMap(t => this.http.request<T>(method, `${this.base}/tenants/${t.id}${path}`, { body, headers })));\n }\n private once<T>(path: string, body: unknown): Observable<T> { return this.send<T>('POST', path, body, { 'Idempotency-Key': idempotencyKey() }); }\n\n /** Every page of a cursor-paged list (bounded: at most `maxPages` requests). */\n private all<T>(path: string, query: Query = {}, maxPages = 25): Observable<Page<T>> {\n let pages = 0;\n return this.get<Page<T>>(path, { ...query, limit: 200 }).pipe(\n expand(page => page.nextCursor && ++pages < maxPages ? this.get<Page<T>>(path, { ...query, limit: 200, cursor: page.nextCursor }) : EMPTY),\n reduce((all, page) => ({ items: [...all.items, ...page.items], nextCursor: page.nextCursor }), { items: [] as T[], nextCursor: null as string | null }),\n );\n }\n\n environments() { return this.get<Page<DeploymentEnvironment>>('/environments'); }\n applications() { return this.get<Page<Application>>('/applications', { limit: 200 }); }\n resources(type?: string) { return this.all<ResourceSummary>('/resources', { type }); }\n resource(id: string) { return this.get<ResourceDetail>(`/resources/${id}`); }\n health(query: Query) { return this.all<Health>('/health', query); }\n topology(environment?: string | null) { return this.get<Topology>('/topology', { environment }); }\n\n rules() { return this.get<Page<Rule>>('/rules', { limit: 200 }); }\n createRule(definition: unknown) { return this.send<Rule>('POST', '/rules', definition); }\n /** With the rule's etag, so a change made since it was read isn't overwritten. */\n updateRule(key: string, definition: unknown, etag: string) { return this.send<Rule>('PUT', `/rules/${key}`, definition, { 'If-Match': `\"${etag}\"` }); }\n\n channels() { return this.get<Page<Channel>>('/webhooks'); }\n createChannel(body: unknown) { return this.send<Channel>('POST', '/webhooks', body); }\n updateChannel(id: string, body: unknown) { return this.send<Channel>('PUT', `/webhooks/${id}`, body); }\n deliveries(id: string, query: Query = {}) { return this.get<Page<Delivery>>(`/webhooks/${id}/deliveries`, { limit: 50, ...query }); }\n testChannel(id: string) { return this.send<ChannelTestResult>('POST', `/webhooks/${id}/test`); }\n retryDelivery(channelId: string, deliveryId: string) { return this.send<Delivery>('POST', `/webhooks/${channelId}/deliveries/${deliveryId}/retry`); }\n allowlist() { return this.get<Page<AllowlistEntry>>('/webhooks/allowlist'); }\n putAllowlist(destination: string, ports: number[]) { return this.send<AllowlistEntry>('PUT', '/webhooks/allowlist', { destination, ports }); }\n removeAllowlist(destination: string) { return this.send<void>('DELETE', `/webhooks/allowlist?destination=${encodeURIComponent(destination)}`); }\n\n escalationPolicies() { return this.get<Page<EscalationPolicy>>('/escalation-policies'); }\n createEscalationPolicy(body: unknown) { return this.send<EscalationPolicy>('POST', '/escalation-policies', body); }\n updateEscalationPolicy(key: string, body: unknown) { return this.send<EscalationPolicy>('PUT', `/escalation-policies/${key}`, body); }\n\n silences(query: Query = {}) { return this.get<Page<Silence>>('/silences', { limit: 200, ...query }); }\n createSilence(body: unknown) { return this.once<Silence>('/silences', body); }\n cancelSilence(id: string) { return this.send<void>('DELETE', `/silences/${id}`); }\n\n incidents(query: Query = {}) { return this.get<Page<IncidentSummary>>('/incidents', { limit: 100, ...query }); }\n incident(id: string) { return this.get<IncidentDetail>(`/incidents/${id}`); }\n createIncident(body: unknown) { return this.once<IncidentSummary>('/incidents', body); }\n moveIncident(id: string, to: string, comment: string) { return this.once<IncidentSummary>(`/incidents/${id}/transitions`, { to, comment }); }\n addIncidentNote(id: string, text: string) { return this.once<IncidentEvent>(`/incidents/${id}/notes`, { text }); }\n removeIncidentAlert(id: string, alertId: string) { return this.send<void>('DELETE', `/incidents/${id}/alerts/${alertId}`); }\n /** Active agents, or with `all` the revoked ones too (at most 500). */\n agents(all = false) { return this.get<Page<Agent>>('/agents', { all: all || null }); }\n agent(id: string) { return this.get<Agent>(`/agents/${id}`); }\n createEnrollmentToken(purpose: string, expiresInMinutes: number) { return this.send<EnrollmentToken>('POST', '/agents/enrollment-tokens', { purpose, expiresInMinutes }); }\n revokeAgent(id: string, reason: string) { return this.send<Agent>('POST', `/agents/${id}/revocation`, { reason }); }\n /** What the agent reported it can run, custom actions included, with what its host permits; the built-ins if it never reported. */\n agentActions(id: string) { return this.get<AgentActions>(`/agents/${id}/actions`); }\n agentPackages() { return this.get<Page<AgentPackage>>('/agents/packages'); }\n /** Idempotent: a repeated click or a lost response signs one command, not two. */\n issueCommand(id: string, action: string, parameters: Record<string, unknown>) { return this.once<AgentCommand>(`/agents/${id}/commands`, { action, parameters }); }\n agentCommands(id: string, cursor?: string | null) { return this.get<Page<AgentCommand>>(`/agents/${id}/commands`, { limit: 25, cursor }); }\n\n alertNotifications(id: string) { return this.get<AlertNotifications>(`/alerts/${id}/notifications`); }\n\n /** One page of alerts, newest first; pass the previous page's `nextCursor` as `cursor` for the next. */\n alerts(query: Query) { return this.get<Page<Alert>>('/alerts', { limit: 100, ...query }); }\n /** Every alert matching the query (bounded, like the other complete lists). */\n allAlerts(query: Query) { return this.all<Alert>('/alerts', query); }\n alert(id: string) { return this.get<AlertDetail>(`/alerts/${id}`); }\n acknowledge(id: string, comment: string): Observable<Alert> {\n return this.tenant$.pipe(switchMap(t => this.http.post<Alert>(`${this.base}/tenants/${t.id}/alerts/${id}/acknowledgement`,\n { comment }, { headers: { 'Idempotency-Key': idempotencyKey() } })));\n }\n\n traces(query: Query) { return this.get<TelemetryPage<TraceSummary>>('/telemetry/traces', query); }\n trace(traceId: string) { return this.get<Trace>(`/telemetry/traces/${traceId}`); }\n logs(query: Query) { return this.get<TelemetryPage<LogRecord>>('/telemetry/logs', query); }\n operations(query: Query) { return this.get<TelemetryPage<Operation>>('/telemetry/operations', query); }\n metrics(query: Query) { return this.get<TelemetryPage<MetricInfo>>('/telemetry/metrics', query); }\n series(query: Query) { return this.get<Series>('/telemetry/metrics/series', query); }\n serviceStats(query: Query) { return this.get<ServiceStats>('/telemetry/service-stats', query); }\n capacity(query: Query) { return this.get<Capacity>('/telemetry/capacity', query); }\n timeline(query: Query) { return this.get<Timeline>('/timeline', query); }\n relatedToAlert(id: string) { return this.get<Related>(`/alerts/${id}/related`); }\n loadRuns(query: Query) { return this.get<Page<LoadRun>>('/load-runs', query); }\n loadRunResults(id: string) { return this.get<LoadRunResults>(`/load-runs/${id}/results`); }\n dependencyStats(query: Query) { return this.get<DependencyStatsPage>('/telemetry/dependencies', query); }\n dependency(id: string, query: Query) { return this.get<DependencyEvidence>(`/telemetry/dependencies/${id}`, query); }\n search(q: string) { return this.get<TelemetryPage<SearchHit>>('/search', { q }); }\n}\n","import { Injectable, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router';\nimport { filter, map, startWith } from 'rxjs';\n\nexport const RANGES: Record<string, number> = {\n '15m': 15 * 60_000, '1h': 3_600_000, '6h': 6 * 3_600_000, '24h': 24 * 3_600_000, '7d': 7 * 24 * 3_600_000,\n};\n\n/** Search ranges are at most 24 hours (the API's bound); series and operations take up to 7 days. */\nexport const MAX_SEARCH_MS = RANGES['24h'];\n\n/**\n * The investigation context that follows the user between pages (Console requirements §17): environment and time\n * range. It lives in the URL (`env`, and `range` or `from`/`to`), so every page is a deep link and the browser's back\n * button restores it.\n */\n@Injectable({ providedIn: 'root' })\nexport class ContextService {\n private readonly router = inject(Router);\n\n // Created on first use, after the first navigation may already have ended: start from the current URL.\n private readonly params = toSignal(this.router.events.pipe(\n filter(e => e instanceof NavigationEnd),\n startWith(null),\n map(() => this.leaf().snapshot.queryParams),\n ), { initialValue: {} as Params });\n\n readonly environment = computed(() => (this.params()['env'] as string | undefined) ?? '');\n readonly range = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? 'custom' : ((p['range'] as string | undefined) ?? '1h');\n });\n readonly absolute = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? { from: p['from'] as string, to: p['to'] as string } : null;\n });\n\n /** The window as ISO strings, evaluated now for a relative range. */\n window(maxMs?: number): { from: string; to: string } {\n const absolute = this.absolute();\n if (absolute) return absolute;\n const to = Date.now();\n const span = Math.min(RANGES[this.range()] ?? RANGES['1h'], maxMs ?? Number.MAX_SAFE_INTEGER);\n return { from: new Date(to - span).toISOString(), to: new Date(to).toISOString() };\n }\n\n /** Query parameters for a link: the context plus the target page's own. */\n keep(extra: Params = {}): Params {\n const p = this.params();\n const context: Params = {};\n for (const key of ['env', 'range', 'from', 'to']) if (p[key]) context[key] = p[key];\n return { ...context, ...extra };\n }\n\n /** Changes the context on the current page, keeping its other parameters. */\n set(change: { env?: string | null; range?: string | null; from?: string | null; to?: string | null }) {\n const queryParams: Params = { ...change };\n if (change.range) Object.assign(queryParams, { from: null, to: null });\n void this.router.navigate([], { relativeTo: this.leaf(), queryParams, queryParamsHandling: 'merge' });\n }\n\n /** A time window centred on a moment, for \"around this span\" links. */\n around(at: string, durationMs: number, paddingMs = 5 * 60_000): Params {\n const start = new Date(at).getTime();\n return this.keep({\n from: new Date(start - paddingMs).toISOString(),\n to: new Date(start + durationMs + paddingMs).toISOString(),\n range: null,\n });\n }\n\n private leaf(): ActivatedRoute {\n let route = this.router.routerState.root;\n while (route.firstChild) route = route.firstChild;\n return route;\n }\n}\n","import { Routes } from '@angular/router';\nimport { Menus } from '@juice-js/core';\nimport { normalizeBasePath } from './core/options';\n\nfunction page(path: string, title: string, load: Routes[number]['loadComponent']): Routes[number] {\n return { path, title: `${title} · Juice Observability`, loadComponent: load };\n}\n\n/**\n * The pages, investigation first (Console requirements §4): services, traces, topology, logs and metrics; alerts and\n * rules after. Detail pages are deep links (§17) and carry the environment and time range in their query parameters.\n * The host mounts them at its `basePath` (see {@link provideJuiceObservability}) and adds its own guards.\n */\nexport const OBSERVABILITY_ROUTES: Routes = [\n page('', 'Overview', () => import('./pages/overview.page').then(m => m.OverviewPage)),\n page('services', 'Services', () => import('./pages/services.page').then(m => m.ServicesPage)),\n page('services/:id', 'Service', () => import('./pages/service.page').then(m => m.ServicePage)),\n page('traces', 'Traces', () => import('./pages/traces.page').then(m => m.TracesPage)),\n page('traces/:traceId', 'Trace', () => import('./pages/trace.page').then(m => m.TracePage)),\n page('topology', 'Dependencies', () => import('./pages/topology.page').then(m => m.TopologyPage)),\n page('logs', 'Logs', () => import('./pages/logs.page').then(m => m.LogsPage)),\n page('metrics', 'Metrics', () => import('./pages/metrics.page').then(m => m.MetricsPage)),\n page('resources', 'Resources', () => import('./pages/resources.page').then(m => m.ResourcesPage)),\n page('resources/:id', 'Resource', () => import('./pages/resource.page').then(m => m.ResourcePage)),\n page('alerts', 'Alerts', () => import('./pages/alerts.page').then(m => m.AlertsPage)),\n page('alerts/:id', 'Alert', () => import('./pages/alert.page').then(m => m.AlertPage)),\n page('rules', 'Rules', () => import('./pages/rules.page').then(m => m.RulesPage)),\n page('notifications', 'Notifications', () => import('./pages/notifications.page').then(m => m.NotificationsPage)),\n page('silences', 'Silences', () => import('./pages/silences.page').then(m => m.SilencesPage)),\n page('incidents', 'Incidents', () => import('./pages/incidents.page').then(m => m.IncidentsPage)),\n page('incidents/:id', 'Incident', () => import('./pages/incident.page').then(m => m.IncidentPage)),\n page('agents', 'Agents', () => import('./pages/agents.page').then(m => m.AgentsPage)),\n page('agents/:id', 'Agent', () => import('./pages/agent.page').then(m => m.AgentPage)),\n page('timeline', 'Timeline', () => import('./pages/timeline.page').then(m => m.TimelinePage)),\n page('load-runs', 'Load runs', () => import('./pages/load-runs.page').then(m => m.LoadRunsPage)),\n];\n\n/** The side menu entries (juice-layout), investigation pages first, linking under `basePath`. */\nexport function observabilityMenus(basePath = '/', order = 1): Menus {\n const base = normalizeBasePath(basePath);\n const link = (path: string) => (base === '/' ? `/${path}` : path ? `${base}/${path}` : base);\n return [\n { id: 'overview', label: 'Overview', icon: 'dashboard', routerLink: link('') },\n { id: 'services', label: 'Services', icon: 'hub', routerLink: link('services') },\n { id: 'traces', label: 'Traces', icon: 'timeline', routerLink: link('traces') },\n { id: 'topology', label: 'Dependencies', icon: 'account_tree', routerLink: link('topology') },\n { id: 'logs', label: 'Logs', icon: 'notes', routerLink: link('logs') },\n { id: 'metrics', label: 'Metrics', icon: 'show_chart', routerLink: link('metrics') },\n { id: 'resources', label: 'Resources', icon: 'dns', routerLink: link('resources') },\n { id: 'alerts', label: 'Alerts', icon: 'notifications', routerLink: link('alerts') },\n { id: 'incidents', label: 'Incidents', icon: 'emergency', routerLink: link('incidents') },\n { id: 'rules', label: 'Rules', icon: 'rule', routerLink: link('rules') },\n { id: 'silences', label: 'Silences', icon: 'notifications_paused', routerLink: link('silences') },\n { id: 'notifications', label: 'Notifications', icon: 'campaign', routerLink: link('notifications') },\n { id: 'agents', label: 'Agents', icon: 'smart_toy', routerLink: link('agents') },\n { id: 'timeline', label: 'Timeline', icon: 'history', routerLink: link('timeline') },\n { id: 'load-runs', label: 'Load runs', icon: 'speed', routerLink: link('load-runs') },\n ].map((menu, index) => ({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AC;EACjF;GAAE,IAAI;GAAU,OAAO;GAAU,MAAM;GAAiB,YAAY,KAAK,QAAQ;EAAC;EAClF;GAAE,IAAI;GAAa,OAAO;GAAa,MAAM;GAAa,YAAY,KAAK,WAAW;EAAC;EACvF;GAAE,IAAI;GAAS,OAAO;GAAS,MAAM;GAAQ,YAAY,KAAK,OAAO;EAAC;EACtE;GAAE,IAAI;GAAY,OAAO;GAAY,MAAM;GAAwB,YAAY,KAAK,UAAU;EAAC;EAC/F;GAAE,IAAI;GAAiB,OAAO;GAAiB,MAAM;GAAY,YAAY,KAAK,eAAe;EAAC;EAClG;GAAE,IAAI;GAAU,OAAO;GAAU,MAAM;GAAa,YAAY,KAAK,QAAQ;EAAC;EAC9E;GAAE,IAAI;GAAY,OAAO;GAAY,MAAM;GAAW,YAAY,KAAK,UAAU;EAAC;EAClF;GAAE,IAAI;GAAa,OAAO;GAAa,MAAM;GAAS,YAAY,KAAK,WAAW;EAAC;CACpF,CAAA,CAAC,KAAK,MAAM,WAAW;EAAE,GAAG;EAAM,OAAO,QAAQ;CAAK,EAAG;AAC5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juice-js/observability",
3
- "version": "1.1.0-alpha.23",
3
+ "version": "1.1.0-alpha.28",
4
4
  "description": "Juice Observability pages (services, traces, topology, logs, metrics, resources, alerts, rules) for an Angular app on juice-layout",
5
5
  "author": "jack@creatorflow.io",
6
6
  "license": "MIT",
@@ -220,6 +220,80 @@ export interface DeliveryAttempt {
220
220
  error: string | null;
221
221
  durationMs: number;
222
222
  }
223
+ /** A Juice Agent. `online` means it called in within the last 2 minutes; a revoked agent is never online. */
224
+ export interface Agent {
225
+ id: string;
226
+ hostname: string;
227
+ operatingSystem: string;
228
+ version: string;
229
+ status: string;
230
+ resourceId: string | null;
231
+ online: boolean;
232
+ lastSeenAt: string | null;
233
+ certificateNotAfter: string;
234
+ enrolledBy: string;
235
+ enrolledAt: string;
236
+ revokedAt: string | null;
237
+ revokedBy: string | null;
238
+ revokeReason: string | null;
239
+ }
240
+ /** The token is in this response only: the platform keeps its hash. */
241
+ export interface EnrollmentToken {
242
+ id: string;
243
+ token: string;
244
+ purpose: string | null;
245
+ expiresAt: string;
246
+ }
247
+ /** One parameter of an action, with its bounds (already narrowed to the host's where the agent reported them). */
248
+ export interface ActionParameter {
249
+ name: string;
250
+ type: 'string' | 'integer' | 'boolean';
251
+ required: boolean;
252
+ description: string | null;
253
+ minimum: number | null;
254
+ maximum: number | null;
255
+ maxLength: number | null;
256
+ pattern: string | null;
257
+ allowed: string[] | null;
258
+ default: string | null;
259
+ }
260
+ /** An action an agent can be asked for. `permitted` is null when the agent doesn't report what its host allows (an older agent). */
261
+ export interface AgentAction {
262
+ name: string;
263
+ description: string;
264
+ changing: boolean;
265
+ custom: boolean;
266
+ parameters: ActionParameter[];
267
+ permitted: boolean | null;
268
+ limits: string[];
269
+ }
270
+ export interface AgentActions {
271
+ reportedAt: string | null;
272
+ items: AgentAction[];
273
+ }
274
+ export interface AgentPackage {
275
+ version: string;
276
+ sha256: string;
277
+ size: number;
278
+ signedBy: string;
279
+ addedAt: string;
280
+ }
281
+ export interface AgentCommand {
282
+ id: string;
283
+ agentId: string;
284
+ action: string;
285
+ parameters: Record<string, unknown>;
286
+ state: string;
287
+ issuedBy: string;
288
+ issuedAt: string;
289
+ expiresAt: string;
290
+ deliveredAt: string | null;
291
+ deliveryCount: number;
292
+ completedAt: string | null;
293
+ reason: string | null;
294
+ result: Record<string, unknown> | null;
295
+ durationMs: number | null;
296
+ }
223
297
  export interface Delivery {
224
298
  id: string;
225
299
  alertId: string;
@@ -237,6 +311,14 @@ export interface Delivery {
237
311
  groupedInto: string | null;
238
312
  escalationStep: number;
239
313
  }
314
+ /** What a test send did; id is the webhook-id it carried. */
315
+ export interface ChannelTestResult {
316
+ id: string;
317
+ delivered: boolean;
318
+ statusCode: number | null;
319
+ error: string | null;
320
+ durationMs: number;
321
+ }
240
322
  export interface AllowlistEntry {
241
323
  destination: string;
242
324
  ports: number[];
@@ -575,6 +657,11 @@ export interface SearchHit {
575
657
  title: string;
576
658
  traceId: string | null;
577
659
  }
660
+ /**
661
+ * A random UUID v4 for `Idempotency-Key`. Not `crypto.randomUUID()`: browsers offer it only in a secure context (HTTPS or localhost), so it
662
+ * throws on a Console opened over plain HTTP at the machine's address, as the local stack is. `getRandomValues` works everywhere.
663
+ */
664
+ export declare function idempotencyKey(): string;
578
665
  export type Query = Record<string, string | number | boolean | string[] | null | undefined>;
579
666
  /**
580
667
  * The Console's only backend: the Juice API (Console requirements §3). One deployment serves one tenant, the one the
@@ -605,6 +692,8 @@ export declare class ApiService {
605
692
  createChannel(body: unknown): Observable<Channel>;
606
693
  updateChannel(id: string, body: unknown): Observable<Channel>;
607
694
  deliveries(id: string, query?: Query): Observable<Page<Delivery>>;
695
+ testChannel(id: string): Observable<ChannelTestResult>;
696
+ retryDelivery(channelId: string, deliveryId: string): Observable<Delivery>;
608
697
  allowlist(): Observable<Page<AllowlistEntry>>;
609
698
  putAllowlist(destination: string, ports: number[]): Observable<AllowlistEntry>;
610
699
  removeAllowlist(destination: string): Observable<void>;
@@ -620,6 +709,17 @@ export declare class ApiService {
620
709
  moveIncident(id: string, to: string, comment: string): Observable<IncidentSummary>;
621
710
  addIncidentNote(id: string, text: string): Observable<IncidentEvent>;
622
711
  removeIncidentAlert(id: string, alertId: string): Observable<void>;
712
+ /** Active agents, or with `all` the revoked ones too (at most 500). */
713
+ agents(all?: boolean): Observable<Page<Agent>>;
714
+ agent(id: string): Observable<Agent>;
715
+ createEnrollmentToken(purpose: string, expiresInMinutes: number): Observable<EnrollmentToken>;
716
+ revokeAgent(id: string, reason: string): Observable<Agent>;
717
+ /** What the agent reported it can run, custom actions included, with what its host permits; the built-ins if it never reported. */
718
+ agentActions(id: string): Observable<AgentActions>;
719
+ agentPackages(): Observable<Page<AgentPackage>>;
720
+ /** Idempotent: a repeated click or a lost response signs one command, not two. */
721
+ issueCommand(id: string, action: string, parameters: Record<string, unknown>): Observable<AgentCommand>;
722
+ agentCommands(id: string, cursor?: string | null): Observable<Page<AgentCommand>>;
623
723
  alertNotifications(id: string): Observable<AlertNotifications>;
624
724
  /** One page of alerts, newest first; pass the previous page's `nextCursor` as `cursor` for the next. */
625
725
  alerts(query: Query): Observable<Page<Alert>>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"juice-js-observability-notifications.page-BDqb10C6.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/notifications.page.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { DatePipe } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MatSelectModule } from '@angular/material/select';\nimport { Observable, forkJoin, map } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { Channel, EscalationPolicy, EscalationStep } from '../core/models';\nimport { apiResource } from '../shared/resource';\nimport { problemText } from '../shared/telemetry';\nimport { ContextBar } from '../shared/ui';\n\nconst list = (text: string) => text.split(',').map(s => s.trim()).filter(Boolean);\n\ninterface ChannelForm {\n id: string | null; key: string; kind: string; url: string; secretRef: string; recipients: string; ruleKeys: string; environments: string; minimumSeverity: string; groupWindowSeconds: number; firing: boolean; resolved: boolean; enabled: boolean;\n}\n\ninterface PolicyForm { editing: boolean; key: string; name: string; ruleKeys: string; environments: string; minimumSeverity: string; stopOnAcknowledge: boolean; enabled: boolean; steps: string; }\n\nconst NEW_CHANNEL: ChannelForm = { id: null, key: '', kind: 'Slack', url: '', secretRef: '', recipients: '', ruleKeys: '', environments: '', minimumSeverity: 'Info', groupWindowSeconds: 0, firing: true, resolved: true, enabled: true };\nconst NEW_POLICY: PolicyForm = { editing: false, key: '', name: '', ruleKeys: '', environments: '', minimumSeverity: 'Critical', stopOnAcknowledge: true, enabled: true, steps: '' };\n\n/**\n * Where notifications go: channels with their failures and history, the private destinations they may reach, and who is told as an alert stays open. Changing any of these\n * needs the admin role. A channel's address and secret are never shown: only the name of where the secret is, to admins.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [DatePipe, FormsModule, MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, MatSelectModule, ContextBar],\n template: `\n <jc-context-bar><h1>Notifications</h1></jc-context-bar>\n @if (data.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (data.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n\n <section class=\"jc-card\">\n <h2>Channels <button mat-button type=\"button\" data-testid=\"channel-new\" (click)=\"channel.set(newChannel())\">New channel</button></h2>\n @if (channel(); as f) {\n <form class=\"jc-form\" data-testid=\"channel-form\" (ngSubmit)=\"saveChannel(f)\">\n @if (!f.id) {\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Key</mat-label><input matInput name=\"key\" [(ngModel)]=\"f.key\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Kind</mat-label>\n <mat-select name=\"kind\" [(ngModel)]=\"f.kind\"><mat-option value=\"Slack\">Slack</mat-option><mat-option value=\"Teams\">Teams</mat-option><mat-option value=\"Email\">Email</mat-option><mat-option value=\"Webhook\">Signed webhook</mat-option></mat-select>\n </mat-form-field>\n }\n @if (f.kind === 'Webhook') { <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>{{ f.id ? 'New URL (keeps the current one if empty)' : 'URL' }}</mat-label><input matInput name=\"url\" [(ngModel)]=\"f.url\"></mat-form-field> }\n @if (f.kind === 'Email') { <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Recipients, comma separated</mat-label><input matInput name=\"recipients\" [(ngModel)]=\"f.recipients\"></mat-form-field> }\n @else {\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>{{ f.kind === 'Webhook' ? 'Signing secret reference' : 'Reference to the channel URL' }}</mat-label><input matInput name=\"secretRef\" [(ngModel)]=\"f.secretRef\" placeholder=\"env:JUICE_WEBHOOK_OPS\"></mat-form-field>\n <p class=\"jc-muted jc-small jc-form-actions\">{{ f.kind === 'Webhook' ? 'The name of where the signing secret is, set on the host.' : 'A Slack or Teams URL is itself a credential, so it stays on the host: this is the name of where it is.' }} Not the secret itself.</p>\n }\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Only these rules</mat-label><input matInput name=\"ruleKeys\" [(ngModel)]=\"f.ruleKeys\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Only these environments</mat-label><input matInput name=\"environments\" [(ngModel)]=\"f.environments\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Severity at least</mat-label>\n <mat-select name=\"minimumSeverity\" [(ngModel)]=\"f.minimumSeverity\"><mat-option value=\"Info\">Info</mat-option><mat-option value=\"Warning\">Warning</mat-option><mat-option value=\"Critical\">Critical</mat-option></mat-select>\n </mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Group for (s)</mat-label><input matInput type=\"number\" min=\"0\" max=\"3600\" name=\"group\" [(ngModel)]=\"f.groupWindowSeconds\"></mat-form-field>\n <mat-checkbox name=\"firing\" [(ngModel)]=\"f.firing\">Firing</mat-checkbox>\n <mat-checkbox name=\"resolved\" [(ngModel)]=\"f.resolved\">Resolved</mat-checkbox>\n <mat-checkbox name=\"enabled\" [(ngModel)]=\"f.enabled\">Enabled</mat-checkbox>\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"channel-save\" [disabled]=\"saving()\">Save</button>\n <button mat-button type=\"button\" (click)=\"channel.set(null)\">Cancel</button>\n @if (channelError()) { <span class=\"jc-error\" data-testid=\"channel-error\">{{ channelError() }}</span> }\n </div>\n </form>\n }\n <table class=\"jc-table\" data-testid=\"channels\">\n <thead><tr><th>Channel</th><th>Kind</th><th>Destination</th><th>Takes</th><th>Failed (24 h)</th><th>Waiting</th><th></th></tr></thead>\n <tbody>\n @for (c of channels(); track c.id) {\n <tr [class.jc-muted]=\"!c.enabled\">\n <td><strong>{{ c.key }}</strong><div class=\"jc-muted jc-small\">@if (!c.enabled) { disabled · }@if (c.managedBy === 'config') { from the webhooks file }</div></td>\n <td>{{ c.kind }}</td>\n <td>{{ c.destination }}</td>\n <td class=\"jc-small\">{{ c.minimumSeverity }} and above@if (c.environments.length) { · {{ c.environments.join(', ') }} }@if (c.ruleKeys.length) { · {{ c.ruleKeys.join(', ') }} }@if (c.groupWindowSeconds) { · grouped {{ c.groupWindowSeconds }} s }</td>\n <td [class.jc-bad]=\"c.recentFailures > 0\">{{ c.recentFailures }}</td>\n <td>{{ c.waiting }}</td>\n <td class=\"jc-row-actions\">\n <button mat-button type=\"button\" [attr.data-testid]=\"'channel-history-' + c.key\" (click)=\"history.set(history() === c.id ? null : c.id)\">History</button>\n @if (c.managedBy !== 'config') { <button mat-button type=\"button\" [attr.data-testid]=\"'channel-edit-' + c.key\" (click)=\"editChannel(c)\">Change</button> }\n </td>\n </tr>\n } @empty { <tr><td colspan=\"7\" class=\"jc-muted\">No channels: alerts fire, but nobody is told.</td></tr> }\n </tbody>\n </table>\n @if (history()) {\n <h3>Delivery history</h3>\n @if (deliveries.error()) { <p class=\"jc-error\">{{ deliveriesError() }}</p> }\n <table class=\"jc-table\" data-testid=\"channel-history\">\n <thead><tr><th>Created</th><th>Event</th><th>Status</th><th>Attempts</th><th>Last result</th></tr></thead>\n <tbody>\n @for (d of deliveries.value()?.items ?? []; track d.id) {\n <tr>\n <td class=\"jc-nowrap\">{{ d.createdAt | date: 'MMM d, HH:mm:ss' }}</td>\n <td>{{ d.event }}@if (d.escalationStep) { step {{ d.escalationStep }} }</td>\n <td [class.jc-bad]=\"d.status === 'Failed'\">{{ d.status }}</td>\n <td>{{ d.attempts }}</td>\n <td class=\"jc-small\">{{ d.lastError ?? (d.lastStatusCode ? 'HTTP ' + d.lastStatusCode : '') }}</td>\n </tr>\n } @empty { <tr><td colspan=\"5\" class=\"jc-muted\">Nothing sent yet.</td></tr> }\n </tbody>\n </table>\n }\n </section>\n\n <section class=\"jc-card\">\n <h2>Escalation <button mat-button type=\"button\" data-testid=\"policy-new\" (click)=\"policy.set(newPolicy())\">New policy</button></h2>\n @if (policy(); as f) {\n <form class=\"jc-form\" data-testid=\"policy-form\" (ngSubmit)=\"savePolicy(f)\">\n @if (!f.editing) { <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Key</mat-label><input matInput name=\"key\" [(ngModel)]=\"f.key\" required></mat-form-field> }\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Name</mat-label><input matInput name=\"name\" [(ngModel)]=\"f.name\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Steps, one a line</mat-label><textarea matInput name=\"steps\" rows=\"3\" [(ngModel)]=\"f.steps\" placeholder=\"5: oncall-slack&#10;15: pager, lead-email\"></textarea></mat-form-field>\n <p class=\"jc-muted jc-small jc-form-actions\">Minutes after firing, then the channels to tell if the alert is still open.</p>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Only these rules</mat-label><input matInput name=\"ruleKeys\" [(ngModel)]=\"f.ruleKeys\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Only these environments</mat-label><input matInput name=\"environments\" [(ngModel)]=\"f.environments\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Severity at least</mat-label>\n <mat-select name=\"minimumSeverity\" [(ngModel)]=\"f.minimumSeverity\"><mat-option value=\"Info\">Info</mat-option><mat-option value=\"Warning\">Warning</mat-option><mat-option value=\"Critical\">Critical</mat-option></mat-select>\n </mat-form-field>\n <mat-checkbox name=\"stop\" [(ngModel)]=\"f.stopOnAcknowledge\">Stop when acknowledged</mat-checkbox>\n <mat-checkbox name=\"policyEnabled\" [(ngModel)]=\"f.enabled\">Enabled</mat-checkbox>\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"policy-save\" [disabled]=\"saving()\">Save</button>\n <button mat-button type=\"button\" (click)=\"policy.set(null)\">Cancel</button>\n @if (policyError()) { <span class=\"jc-error\" data-testid=\"policy-error\">{{ policyError() }}</span> }\n </div>\n </form>\n }\n <table class=\"jc-table\" data-testid=\"policies\">\n <thead><tr><th>Policy</th><th>Steps</th><th>Applies to</th><th>Stops when</th><th></th></tr></thead>\n <tbody>\n @for (p of policies(); track p.id) {\n <tr [class.jc-muted]=\"!p.enabled\">\n <td><strong>{{ p.name }}</strong><div class=\"jc-muted jc-small\">{{ p.key }}@if (!p.enabled) { · disabled }</div></td>\n <td class=\"jc-small\">@for (s of p.steps; track s.afterMinutes) { <div>{{ s.afterMinutes }} min: {{ s.endpointKeys.join(', ') }}</div> }</td>\n <td class=\"jc-small\">{{ p.minimumSeverity }} and above@if (p.environments.length) { · {{ p.environments.join(', ') }} }@if (p.ruleKeys.length) { · {{ p.ruleKeys.join(', ') }} }</td>\n <td class=\"jc-small\">{{ p.stopOnAcknowledge ? 'Acknowledged or resolved' : 'Resolved' }}</td>\n <td class=\"jc-row-actions\"><button mat-button type=\"button\" (click)=\"editPolicy(p)\">Change</button></td>\n </tr>\n } @empty { <tr><td colspan=\"5\" class=\"jc-muted\">No policies: a firing alert notifies once.</td></tr> }\n </tbody>\n </table>\n </section>\n\n <section class=\"jc-card\">\n <h2>Private destinations</h2>\n <p class=\"jc-muted jc-small\">A channel may reach a private address only if it's listed here. Loopback, link-local and cloud metadata addresses are never reachable.</p>\n <form class=\"jc-form\" (ngSubmit)=\"addAllowed()\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>CIDR or host name</mat-label><input matInput name=\"destination\" data-testid=\"allow-destination\" [(ngModel)]=\"destination\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-md\"><mat-label>Ports (443 if empty)</mat-label><input matInput name=\"ports\" data-testid=\"allow-ports\" [(ngModel)]=\"ports\"></mat-form-field>\n <button mat-stroked-button type=\"submit\" data-testid=\"allow-add\" [disabled]=\"saving()\">Allow</button>\n @if (allowError()) { <span class=\"jc-error\" data-testid=\"allow-error\">{{ allowError() }}</span> }\n </form>\n <table class=\"jc-table\" data-testid=\"allowlist\">\n <tbody>\n @for (a of allowed(); track a.destination) {\n <tr>\n <td><strong>{{ a.destination }}</strong> @if (a.managedBy === 'config') { <span class=\"jc-muted jc-small\">from the webhooks file</span> }</td>\n <td>{{ a.ports.length ? a.ports.join(', ') : '443' }}</td>\n <td class=\"jc-row-actions\">@if (a.managedBy !== 'config') { <button mat-button type=\"button\" (click)=\"removeAllowed(a.destination)\">Remove</button> }</td>\n </tr>\n } @empty { <tr><td class=\"jc-muted\">None: channels reach public addresses only.</td></tr> }\n </tbody>\n </table>\n </section>`,\n})\nexport class NotificationsPage {\n private readonly api = inject(ApiService);\n protected readonly channel = signal<ChannelForm | null>(null);\n protected readonly policy = signal<PolicyForm | null>(null);\n protected readonly history = signal<string | null>(null);\n protected readonly saving = signal(false);\n protected readonly channelError = signal('');\n protected readonly policyError = signal('');\n protected readonly allowError = signal('');\n protected destination = '';\n protected ports = '';\n\n protected readonly data = apiResource({\n stream: () => forkJoin({\n channels: this.api.channels().pipe(map(p => p.items)),\n policies: this.api.escalationPolicies().pipe(map(p => p.items)),\n allowlist: this.api.allowlist().pipe(map(p => p.items)),\n }),\n });\n protected readonly error = computed(() => problemText(this.data.error()));\n protected readonly channels = computed(() => this.data.value()?.channels ?? []);\n protected readonly policies = computed(() => this.data.value()?.policies ?? []);\n protected readonly allowed = computed(() => this.data.value()?.allowlist ?? []);\n protected readonly deliveries = apiResource({ params: () => this.history() ?? undefined, stream: ({ params }) => this.api.deliveries(params) });\n protected readonly deliveriesError = computed(() => problemText(this.deliveries.error()));\n\n protected newChannel(): ChannelForm { this.channelError.set(''); return { ...NEW_CHANNEL }; }\n protected newPolicy(): PolicyForm { this.policyError.set(''); return { ...NEW_POLICY }; }\n\n protected editChannel(c: Channel) {\n this.channelError.set('');\n this.channel.set({\n id: c.id, key: c.key, kind: c.kind, url: '', secretRef: c.secretRef ?? '', recipients: (c.recipients ?? []).join(', '), ruleKeys: c.ruleKeys.join(', '), environments: c.environments.join(', '),\n minimumSeverity: c.minimumSeverity, groupWindowSeconds: c.groupWindowSeconds, firing: c.events.includes('alert.firing'), resolved: c.events.includes('alert.resolved'), enabled: c.enabled,\n });\n }\n\n private run<T>(request: Observable<T>, error: (message: string) => void, done: () => void) {\n this.saving.set(true);\n error('');\n request.subscribe({\n next: () => { this.saving.set(false); done(); this.data.reload(); },\n error: e => { this.saving.set(false); error((e as { status?: number }).status === 403 ? 'This needs the admin role.' : problemText(e)); },\n });\n }\n\n protected saveChannel(f: ChannelForm) {\n const events = [f.firing ? 'alert.firing' : '', f.resolved ? 'alert.resolved' : ''].filter(Boolean);\n const body = {\n key: f.key, kind: f.kind, url: f.kind === 'Webhook' && f.url.trim() ? f.url.trim() : undefined, secretRef: f.kind === 'Email' ? undefined : f.secretRef.trim(), recipients: f.kind === 'Email' ? list(f.recipients) : undefined,\n events, ruleKeys: list(f.ruleKeys), environments: list(f.environments).map(e => e.toLowerCase()), minimumSeverity: f.minimumSeverity, groupWindowSeconds: f.groupWindowSeconds || 0, enabled: f.enabled,\n };\n this.run(f.id ? this.api.updateChannel(f.id, body) : this.api.createChannel(body), m => this.channelError.set(m), () => this.channel.set(null));\n }\n\n protected editPolicy(p: EscalationPolicy) {\n this.policyError.set('');\n this.policy.set({\n editing: true, key: p.key, name: p.name, ruleKeys: p.ruleKeys.join(', '), environments: p.environments.join(', '), minimumSeverity: p.minimumSeverity, stopOnAcknowledge: p.stopOnAcknowledge, enabled: p.enabled,\n steps: p.steps.map(s => `${s.afterMinutes}: ${s.endpointKeys.join(', ')}`).join('\\n'),\n });\n }\n\n /** `5: oncall, pager` per line. A line that doesn't read goes to the server as no channels, which says what's wrong. */\n private parseSteps(text: string): EscalationStep[] {\n return text.split('\\n').map(l => l.trim()).filter(Boolean).map(line => {\n const [minutes, ...rest] = line.split(':');\n return { afterMinutes: Number(minutes.trim()), endpointKeys: list(rest.join(':')) };\n });\n }\n\n protected savePolicy(f: PolicyForm) {\n const body = {\n key: f.key, name: f.name, enabled: f.enabled, ruleKeys: list(f.ruleKeys), environments: list(f.environments).map(e => e.toLowerCase()), minimumSeverity: f.minimumSeverity,\n stopOnAcknowledge: f.stopOnAcknowledge, steps: this.parseSteps(f.steps),\n };\n this.run(f.editing ? this.api.updateEscalationPolicy(f.key, body) : this.api.createEscalationPolicy(body), m => this.policyError.set(m), () => this.policy.set(null));\n }\n\n protected addAllowed() {\n this.run(this.api.putAllowlist(this.destination.trim(), list(this.ports).map(Number)), m => this.allowError.set(m), () => { this.destination = ''; this.ports = ''; });\n }\n\n protected removeAllowed(destination: string) {\n this.run(this.api.removeAllowlist(destination), m => this.allowError.set(m), () => undefined);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBA,MAAM,QAAQ,SAAiB,KAAK,MAAM,GAAG,CAAC,CAAC,KAAI,MAAK,EAAE,KAAI,CAAE,CAAC,CAAC,OAAO,OAAO;AAQhF,MAAM,cAA2B;CAAE,IAAI;CAAM,KAAK;CAAI,MAAM;CAAS,KAAK;CAAI,WAAW;CAAI,YAAY;CAAI,UAAU;CAAI,cAAc;CAAI,iBAAiB;CAAQ,oBAAoB;CAAG,QAAQ;CAAM,UAAU;CAAM,SAAS;AAAI;AACxO,MAAM,aAAyB;CAAE,SAAS;CAAO,KAAK;CAAI,MAAM;CAAI,UAAU;CAAI,cAAc;CAAI,iBAAiB;CAAY,mBAAmB;CAAM,SAAS;CAAM,OAAO;AAA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