@fonderie/client 0.23.0 → 0.24.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.
@@ -262,6 +262,27 @@ new ConfigAdminClient(opts: IConfigAdminClientOptions): ConfigAdminClient
262
262
  .rollbackSecret(key: string, input: IRollbackInput, environment?: string | undefined): Promise<IApiResponse<ISecretEntry>>
263
263
  .revealSecret(key: string, environment?: string | undefined): Promise<IApiResponse<IRevealSecretResult>>
264
264
 
265
+ interface IAdminClientOptions {
266
+ baseUrl: string;
267
+ adminToken: string;
268
+ prefix?: string;
269
+ actor?: string;
270
+ }
271
+
272
+ interface IAdminLogQuery {
273
+ limit?: number;
274
+ before?: string;
275
+ }
276
+
277
+ new AdminClient(opts: IAdminClientOptions): AdminClient
278
+ .attention(): Promise<IApiResponse<IAdminAttention>>
279
+ .manifest(): Promise<IApiResponse<IAdminManifest>>
280
+ .doctor(): Promise<IApiResponse<IAdminDoctorReport>>
281
+ .config(): Promise<IApiResponse<IAdminConfigReport>>
282
+ .routes(): Promise<IApiResponse<IAdminRoutesReport>>
283
+ .tokens(): Promise<IApiResponse<IAdminTokensReport>>
284
+ .adminLog(query?: IAdminLogQuery): Promise<IApiResponse<IAdminLogPage>>
285
+
265
286
  interface ICourierAdminClientOptions {
266
287
  baseUrl: string;
267
288
  adminToken: string;
@@ -599,6 +620,122 @@ interface ICheckoutUrlResult {
599
620
  url: string;
600
621
  }
601
622
 
623
+ type AdminRouteGuard = 'admin' | 'probe' | 'app';
624
+
625
+ interface IAdminAttention {
626
+ generatedAt: string;
627
+ ok: boolean;
628
+ items: IAdminAttentionItem[];
629
+ }
630
+
631
+ interface IAdminAttentionItem {
632
+ source: string;
633
+ severity: 'error' | 'advice';
634
+ message: string;
635
+ }
636
+
637
+ interface IAdminCheckResult {
638
+ name: string;
639
+ module: string;
640
+ ok: boolean;
641
+ findings: string[];
642
+ skipped?: string;
643
+ durationMs: number;
644
+ }
645
+
646
+ interface IAdminConfigReport {
647
+ generatedAt: string;
648
+ readiness: IAdminReadiness;
649
+ modules: Array<{
650
+ name: string;
651
+ problems: IAdminReadinessProblem[];
652
+ }>;
653
+ env: Array<{
654
+ name: string;
655
+ set: boolean;
656
+ }>;
657
+ }
658
+
659
+ interface IAdminDoctorReport {
660
+ generatedAt: string;
661
+ ok: boolean;
662
+ checks: IAdminCheckResult[];
663
+ }
664
+
665
+ interface IAdminLogEntry {
666
+ id: string;
667
+ at: string;
668
+ actor: string;
669
+ method: string;
670
+ path: string;
671
+ route: string;
672
+ module: string;
673
+ status: number;
674
+ durationMs: number;
675
+ requestId: string | null;
676
+ clientIp: string | null;
677
+ }
678
+
679
+ interface IAdminLogPage {
680
+ entries: IAdminLogEntry[];
681
+ next: string | null;
682
+ }
683
+
684
+ interface IAdminManifest {
685
+ generatedAt: string;
686
+ env: string;
687
+ admin: {
688
+ version: string;
689
+ log: boolean;
690
+ };
691
+ modules: IAdminModuleEntry[];
692
+ readiness: IAdminReadiness;
693
+ routes: IAdminRouteEntry[];
694
+ }
695
+
696
+ interface IAdminModuleEntry {
697
+ name: string;
698
+ version: string | null;
699
+ readiness: IAdminReadiness;
700
+ describesAdmin: boolean;
701
+ }
702
+
703
+ interface IAdminReadiness {
704
+ ok: boolean;
705
+ problems: IAdminReadinessProblem[];
706
+ }
707
+
708
+ interface IAdminReadinessProblem {
709
+ module: string;
710
+ severity: 'error' | 'warning';
711
+ message: string;
712
+ }
713
+
714
+ interface IAdminRouteEntry {
715
+ method: string;
716
+ path: string;
717
+ module?: string;
718
+ }
719
+
720
+ interface IAdminRoutesReport {
721
+ generatedAt: string;
722
+ routes: Array<IAdminRouteEntry & {
723
+ guard: AdminRouteGuard;
724
+ }>;
725
+ }
726
+
727
+ interface IAdminTokensReport {
728
+ generatedAt: string;
729
+ admin: {
730
+ ok: boolean;
731
+ problems: IAdminReadinessProblem[];
732
+ };
733
+ legacy: Array<{
734
+ module: string;
735
+ set: boolean;
736
+ }>;
737
+ }
738
+
602
739
  interface IConfigEntry {
603
740
  key: string;
604
741
  value: unknown;
package/dist/index.cjs CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ AdminClient: () => AdminClient,
23
24
  AuditClient: () => AuditClient,
24
25
  AuthClient: () => AuthClient,
25
26
  BillingClient: () => BillingClient,
@@ -1702,6 +1703,53 @@ var ConfigAdminClient = class {
1702
1703
  }
1703
1704
  };
1704
1705
 
1706
+ // src/modules/admin.ts
1707
+ var AdminClient = class {
1708
+ http;
1709
+ adminToken;
1710
+ prefix;
1711
+ actorHeaders;
1712
+ constructor(opts) {
1713
+ this.http = new HttpClient(opts.baseUrl);
1714
+ this.adminToken = opts.adminToken;
1715
+ this.prefix = (opts.prefix ?? "/_admin").replace(/\/+$/, "");
1716
+ this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
1717
+ }
1718
+ get(suffix) {
1719
+ return this.http.request({
1720
+ method: "GET",
1721
+ path: `${this.prefix}${suffix}`,
1722
+ token: this.adminToken,
1723
+ headers: this.actorHeaders
1724
+ });
1725
+ }
1726
+ attention() {
1727
+ return this.get("");
1728
+ }
1729
+ manifest() {
1730
+ return this.get("/manifest");
1731
+ }
1732
+ doctor() {
1733
+ return this.get("/doctor");
1734
+ }
1735
+ config() {
1736
+ return this.get("/config");
1737
+ }
1738
+ routes() {
1739
+ return this.get("/routes");
1740
+ }
1741
+ tokens() {
1742
+ return this.get("/access/tokens");
1743
+ }
1744
+ adminLog(query = {}) {
1745
+ const q = new URLSearchParams();
1746
+ if (query.limit) q.set("limit", String(query.limit));
1747
+ if (query.before) q.set("before", query.before);
1748
+ const qs = q.toString();
1749
+ return this.get(`/activity/admin-log${qs ? `?${qs}` : ""}`);
1750
+ }
1751
+ };
1752
+
1705
1753
  // src/modules/courier-admin.ts
1706
1754
  var CourierAdminClient = class {
1707
1755
  http;
@@ -1772,6 +1820,7 @@ function isMfaRequired(result) {
1772
1820
  }
1773
1821
  // Annotate the CommonJS export names for ESM import in node:
1774
1822
  0 && (module.exports = {
1823
+ AdminClient,
1775
1824
  AuditClient,
1776
1825
  AuthClient,
1777
1826
  BillingClient,