@fonderie/client 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -41,6 +41,7 @@ declare class HttpClient {
41
41
  private defaultTtlMs;
42
42
  private refresh;
43
43
  constructor(baseUrl: string, deps?: IHttpDeps);
44
+ clearCache(): void;
44
45
  request<T>(opts: IRequestOptions): Promise<T>;
45
46
  private exec;
46
47
  }
@@ -134,8 +135,8 @@ interface IMeResult {
134
135
  user: IUserDTO;
135
136
  }
136
137
  interface IMfaSetupResult {
137
- secret: string;
138
- uri: string;
138
+ qr: string;
139
+ backupCodes: string[];
139
140
  }
140
141
  interface IMfaEnabledResult {
141
142
  tokens: ITokens;
@@ -488,6 +489,7 @@ interface ICustomerLabelDTO {
488
489
  }
489
490
  interface ICustomerListResult {
490
491
  customers: ICustomerDTO[];
492
+ total: number;
491
493
  }
492
494
  interface ICustomerResult {
493
495
  customer: ICustomerDTO;
package/dist/index.d.ts CHANGED
@@ -41,6 +41,7 @@ declare class HttpClient {
41
41
  private defaultTtlMs;
42
42
  private refresh;
43
43
  constructor(baseUrl: string, deps?: IHttpDeps);
44
+ clearCache(): void;
44
45
  request<T>(opts: IRequestOptions): Promise<T>;
45
46
  private exec;
46
47
  }
@@ -134,8 +135,8 @@ interface IMeResult {
134
135
  user: IUserDTO;
135
136
  }
136
137
  interface IMfaSetupResult {
137
- secret: string;
138
- uri: string;
138
+ qr: string;
139
+ backupCodes: string[];
139
140
  }
140
141
  interface IMfaEnabledResult {
141
142
  tokens: ITokens;
@@ -488,6 +489,7 @@ interface ICustomerLabelDTO {
488
489
  }
489
490
  interface ICustomerListResult {
490
491
  customers: ICustomerDTO[];
492
+ total: number;
491
493
  }
492
494
  interface ICustomerResult {
493
495
  customer: ICustomerDTO;
package/dist/index.js CHANGED
@@ -61,6 +61,11 @@ var HttpClient = class {
61
61
  cache;
62
62
  defaultTtlMs;
63
63
  refresh;
64
+ // Drop all cached responses — sign-out must not leave one session's data
65
+ // servable to the next.
66
+ clearCache() {
67
+ this.cache?.clear();
68
+ }
64
69
  async request(opts) {
65
70
  const method = opts.method.toUpperCase();
66
71
  const cache = this.cache;
@@ -208,6 +213,7 @@ var AuthClient = class {
208
213
  mfa;
209
214
  setAccessToken(token) {
210
215
  this.tokens.set(token);
216
+ if (!token) this.http.clearCache();
211
217
  }
212
218
  // ── Public ─────────────────────────────────────────────────────────────────
213
219
  register(input) {
@@ -1124,6 +1130,7 @@ var FonderieClient = class {
1124
1130
  this.audit = new AuditClient(this.http, this.tokens);
1125
1131
  this.webhooks = new WebhooksClient(this.http, this.tokens);
1126
1132
  this.customers = new CustomersClient(this.http, this.tokens);
1133
+ if (opts.workspaceId !== void 0) this.setWorkspaceId(opts.workspaceId);
1127
1134
  }
1128
1135
  // Single-flight refresh: POST /auth/refresh with the app-supplied refresh
1129
1136
  // token, store the new access token, notify the app, return it for the retry.
@@ -1169,6 +1176,8 @@ var FonderieClient = class {
1169
1176
  this.billing.setWorkspaceId(workspaceId);
1170
1177
  this.workspaces.setWorkspaceId(workspaceId);
1171
1178
  this.customers.setWorkspaceId(workspaceId);
1179
+ this.audit.setWorkspaceId(workspaceId);
1180
+ this.webhooks.setWorkspaceId(workspaceId);
1172
1181
  }
1173
1182
  // ── Generic transport ──────────────────────────────────────────────────────
1174
1183
  // A Fonderie-aware HTTP client for endpoints outside the typed modules (an