@fonderie/client 0.27.0 → 0.28.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.
@@ -328,6 +328,26 @@ new BillingAdminClient(opts: IBillingAdminClientOptions): BillingAdminClient
328
328
  .walletLedger(type: SubscriberType, id: string, query?: IAdminLedgerQuery): Promise<IApiResponse<IAdminWalletLedgerPage>>
329
329
  .grant(input: IAdminGrantInput): Promise<IApiResponse<unknown>>
330
330
 
331
+ interface IAuditAdminClientOptions {
332
+ baseUrl: string;
333
+ adminToken: string;
334
+ prefix?: string;
335
+ actor?: string;
336
+ }
337
+
338
+ interface IAdminAuditQuery {
339
+ workspaceId?: string;
340
+ type?: string;
341
+ actorId?: string;
342
+ from?: Date;
343
+ to?: Date;
344
+ limit?: number;
345
+ cursor?: string;
346
+ }
347
+
348
+ new AuditAdminClient(opts: IAuditAdminClientOptions): AuditAdminClient
349
+ .listAudit(query?: IAdminAuditQuery): Promise<IApiResponse<IAuditPageResult>>
350
+
331
351
  interface ICourierAdminClientOptions {
332
352
  baseUrl: string;
333
353
  adminToken: string;
package/dist/index.cjs CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AdminClient: () => AdminClient,
24
+ AuditAdminClient: () => AuditAdminClient,
24
25
  AuditClient: () => AuditClient,
25
26
  AuthAdminClient: () => AuthAdminClient,
26
27
  AuthClient: () => AuthClient,
@@ -1897,6 +1898,38 @@ var BillingAdminClient = class {
1897
1898
  }
1898
1899
  };
1899
1900
 
1901
+ // src/modules/audit-admin.ts
1902
+ var AuditAdminClient = class {
1903
+ http;
1904
+ adminToken;
1905
+ prefix;
1906
+ actorHeaders;
1907
+ constructor(opts) {
1908
+ this.http = new HttpClient(opts.baseUrl);
1909
+ this.adminToken = opts.adminToken;
1910
+ this.prefix = (opts.prefix ?? "/_admin").replace(/\/+$/, "");
1911
+ this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
1912
+ }
1913
+ // Every workspace unless one is named. Newest first, keyset-paged.
1914
+ listAudit(query = {}) {
1915
+ const q = new URLSearchParams();
1916
+ if (query.workspaceId) q.set("workspaceId", query.workspaceId);
1917
+ if (query.type) q.set("type", query.type);
1918
+ if (query.actorId) q.set("actorId", query.actorId);
1919
+ if (query.from) q.set("from", query.from.toISOString());
1920
+ if (query.to) q.set("to", query.to.toISOString());
1921
+ if (query.limit) q.set("limit", String(query.limit));
1922
+ if (query.cursor) q.set("cursor", query.cursor);
1923
+ const qs = q.toString();
1924
+ return this.http.request({
1925
+ method: "GET",
1926
+ path: `${this.prefix}/audit${qs ? `?${qs}` : ""}`,
1927
+ token: this.adminToken,
1928
+ headers: this.actorHeaders
1929
+ });
1930
+ }
1931
+ };
1932
+
1900
1933
  // src/modules/courier-admin.ts
1901
1934
  var CourierAdminClient = class {
1902
1935
  http;
@@ -1988,6 +2021,7 @@ function isMfaRequired(result) {
1988
2021
  // Annotate the CommonJS export names for ESM import in node:
1989
2022
  0 && (module.exports = {
1990
2023
  AdminClient,
2024
+ AuditAdminClient,
1991
2025
  AuditClient,
1992
2026
  AuthAdminClient,
1993
2027
  AuthClient,