@fonderie/client 0.6.0 → 0.8.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/brain/signatures.md +7 -1
- package/dist/index.cjs +18 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/brain/signatures.md
CHANGED
|
@@ -123,7 +123,7 @@ new AuthClient(http: HttpClient, tokens: TokenStore): AuthClient
|
|
|
123
123
|
.mfa: MfaClient
|
|
124
124
|
.setAccessToken(token: string | undefined): void
|
|
125
125
|
.register(input: IRegisterInput): Promise<IApiResponse<IRegisterResult>>
|
|
126
|
-
.login(input: ILoginInput): Promise<IApiResponse<ILoginResult>>
|
|
126
|
+
.login(input: ILoginInput): Promise<IApiResponse<ILoginResult | IMfaRequiredResult>>
|
|
127
127
|
.refreshTokens(refreshToken?: string | undefined): Promise<IApiResponse<IRefreshResult>>
|
|
128
128
|
.forgotPassword(email: string): Promise<IApiResponse<undefined>>
|
|
129
129
|
.resetPassword(input: IResetPasswordInput): Promise<IApiResponse<undefined>>
|
|
@@ -729,6 +729,10 @@ interface IMfaEnabledResult {
|
|
|
729
729
|
user: IUserDTO;
|
|
730
730
|
}
|
|
731
731
|
|
|
732
|
+
interface IMfaRequiredResult {
|
|
733
|
+
mfaToken: string;
|
|
734
|
+
}
|
|
735
|
+
|
|
732
736
|
interface IMfaSetupResult {
|
|
733
737
|
secret: string;
|
|
734
738
|
uri: string;
|
|
@@ -1010,4 +1014,6 @@ interface IWorkspaceSettingsResult {
|
|
|
1010
1014
|
}
|
|
1011
1015
|
|
|
1012
1016
|
type SubscriberType = 'user' | 'workspace';
|
|
1017
|
+
|
|
1018
|
+
function isMfaRequired(result: ILoginResult | IMfaRequiredResult): result is IMfaRequiredResult
|
|
1013
1019
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,8 @@ __export(index_exports, {
|
|
|
30
30
|
FonderieClient: () => FonderieClient,
|
|
31
31
|
WebhooksClient: () => WebhooksClient,
|
|
32
32
|
WorkspacesClient: () => WorkspacesClient,
|
|
33
|
-
createMemoryCache: () => createMemoryCache
|
|
33
|
+
createMemoryCache: () => createMemoryCache,
|
|
34
|
+
isMfaRequired: () => isMfaRequired
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(index_exports);
|
|
36
37
|
|
|
@@ -97,6 +98,11 @@ var HttpClient = class {
|
|
|
97
98
|
cache;
|
|
98
99
|
defaultTtlMs;
|
|
99
100
|
refresh;
|
|
101
|
+
// Drop all cached responses — sign-out must not leave one session's data
|
|
102
|
+
// servable to the next.
|
|
103
|
+
clearCache() {
|
|
104
|
+
this.cache?.clear();
|
|
105
|
+
}
|
|
100
106
|
async request(opts) {
|
|
101
107
|
const method = opts.method.toUpperCase();
|
|
102
108
|
const cache = this.cache;
|
|
@@ -244,6 +250,7 @@ var AuthClient = class {
|
|
|
244
250
|
mfa;
|
|
245
251
|
setAccessToken(token) {
|
|
246
252
|
this.tokens.set(token);
|
|
253
|
+
if (!token) this.http.clearCache();
|
|
247
254
|
}
|
|
248
255
|
// ── Public ─────────────────────────────────────────────────────────────────
|
|
249
256
|
register(input) {
|
|
@@ -1160,6 +1167,7 @@ var FonderieClient = class {
|
|
|
1160
1167
|
this.audit = new AuditClient(this.http, this.tokens);
|
|
1161
1168
|
this.webhooks = new WebhooksClient(this.http, this.tokens);
|
|
1162
1169
|
this.customers = new CustomersClient(this.http, this.tokens);
|
|
1170
|
+
if (opts.workspaceId !== void 0) this.setWorkspaceId(opts.workspaceId);
|
|
1163
1171
|
}
|
|
1164
1172
|
// Single-flight refresh: POST /auth/refresh with the app-supplied refresh
|
|
1165
1173
|
// token, store the new access token, notify the app, return it for the retry.
|
|
@@ -1205,6 +1213,8 @@ var FonderieClient = class {
|
|
|
1205
1213
|
this.billing.setWorkspaceId(workspaceId);
|
|
1206
1214
|
this.workspaces.setWorkspaceId(workspaceId);
|
|
1207
1215
|
this.customers.setWorkspaceId(workspaceId);
|
|
1216
|
+
this.audit.setWorkspaceId(workspaceId);
|
|
1217
|
+
this.webhooks.setWorkspaceId(workspaceId);
|
|
1208
1218
|
}
|
|
1209
1219
|
// ── Generic transport ──────────────────────────────────────────────────────
|
|
1210
1220
|
// A Fonderie-aware HTTP client for endpoints outside the typed modules (an
|
|
@@ -1416,6 +1426,11 @@ var CourierAdminClient = class {
|
|
|
1416
1426
|
});
|
|
1417
1427
|
}
|
|
1418
1428
|
};
|
|
1429
|
+
|
|
1430
|
+
// src/types.ts
|
|
1431
|
+
function isMfaRequired(result) {
|
|
1432
|
+
return !("tokens" in result);
|
|
1433
|
+
}
|
|
1419
1434
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1420
1435
|
0 && (module.exports = {
|
|
1421
1436
|
AuditClient,
|
|
@@ -1428,6 +1443,7 @@ var CourierAdminClient = class {
|
|
|
1428
1443
|
FonderieClient,
|
|
1429
1444
|
WebhooksClient,
|
|
1430
1445
|
WorkspacesClient,
|
|
1431
|
-
createMemoryCache
|
|
1446
|
+
createMemoryCache,
|
|
1447
|
+
isMfaRequired
|
|
1432
1448
|
});
|
|
1433
1449
|
//# sourceMappingURL=index.cjs.map
|