@fonderie/client 1.0.0 → 1.1.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/README.md CHANGED
@@ -33,7 +33,7 @@ phone OTP, profile updates, and MFA setup/verify/disable, with every DTO
33
33
  (`IUserDTO`, `ITokens`, `ILoginResult`, …) exported for your own signatures.
34
34
 
35
35
  Pairs with any API built on
36
- [@fonderie/core](https://github.com/fonderiejs/sdk/tree/main/packages/core);
36
+ [@fonderie/core](https://github.com/fonderiejs/fonderie/tree/main/packages/core);
37
37
  the types stay in lockstep because both sides live in the same monorepo.
38
38
 
39
39
  ## Why this exists
@@ -41,7 +41,7 @@ the types stay in lockstep because both sides live in the same monorepo.
41
41
  You've shipped this plumbing before — auth, teams, billing, messaging —
42
42
  and the next project will ask for it again. Fonderie packages it once:
43
43
  plain TypeScript modules for
44
- [`@fonderie/core`](https://github.com/fonderiejs/sdk/tree/main/packages/core),
44
+ [`@fonderie/core`](https://github.com/fonderiejs/fonderie/tree/main/packages/core),
45
45
  PostgreSQL-backed, self-hosted, MIT. No external control plane, no
46
46
  per-seat anything. Register the modules you need; skip the ones you don't.
47
47
 
@@ -50,7 +50,7 @@ browser, Node, or edge — with request/response shapes that stay in lockstep
50
50
  with the server because both live in this monorepo.
51
51
 
52
52
  Browse the whole set at
53
- [fonderiejs/sdk](https://github.com/fonderiejs/sdk) · follow
53
+ [fonderiejs/fonderie](https://github.com/fonderiejs/fonderie) · follow
54
54
  [@fonderiejs](https://x.com/fonderiejs)
55
55
 
56
56
  ## License
@@ -688,9 +688,30 @@ interface ILoginEventDTO {
688
688
  failureReason: string | null;
689
689
  ipAddress: string | null;
690
690
  userAgent: string | null;
691
+ location: IRequestLocationDTO | null;
691
692
  createdAt: string;
692
693
  }
693
694
 
695
+ interface IRequestLocationDTO {
696
+ country?: string;
697
+ countryName?: string;
698
+ subdivision?: string;
699
+ subdivisionName?: string;
700
+ city?: string;
701
+ postalCode?: string;
702
+ continent?: string;
703
+ timeZone?: string;
704
+ latitude?: number;
705
+ longitude?: number;
706
+ accuracyRadius?: number;
707
+ isp?: string;
708
+ org?: string;
709
+ asn?: string;
710
+ mobile?: boolean;
711
+ proxy?: boolean;
712
+ hosting?: boolean;
713
+ }
714
+
694
715
  interface IAdminUserPageResult {
695
716
  users: IAdminUserDTO[];
696
717
  nextCursor: string | null;
@@ -706,6 +727,7 @@ interface ISessionDTO {
706
727
  current: boolean;
707
728
  ipAddress: string | null;
708
729
  userAgent: string | null;
730
+ location: IRequestLocationDTO | null;
709
731
  createdAt: string;
710
732
  expiresAt: string;
711
733
  }
@@ -1567,4 +1589,6 @@ interface IWorkspaceSettingsResult {
1567
1589
  type SubscriberType = 'user' | 'workspace';
1568
1590
 
1569
1591
  function isMfaRequired(result: ILoginResult | IMfaRequiredResult): result is IMfaRequiredResult
1592
+
1593
+ function describeLocation(loc: IRequestLocationDTO | null | undefined, countryName?: ((code: string) => string | undefined) | undefined): string | null
1570
1594
  ```
package/dist/index.cjs CHANGED
@@ -36,6 +36,7 @@ __export(index_exports, {
36
36
  WebhooksClient: () => WebhooksClient,
37
37
  WorkspacesClient: () => WorkspacesClient,
38
38
  createMemoryCache: () => createMemoryCache,
39
+ describeLocation: () => describeLocation,
39
40
  isMfaRequired: () => isMfaRequired
40
41
  });
41
42
  module.exports = __toCommonJS(index_exports);
@@ -2115,6 +2116,14 @@ var CourierAdminClient = class {
2115
2116
  function isMfaRequired(result) {
2116
2117
  return !("tokens" in result);
2117
2118
  }
2119
+ function describeLocation(loc, countryName) {
2120
+ if (!loc) return null;
2121
+ const country = loc.country ? countryName?.(loc.country) ?? loc.country : loc.countryName ?? void 0;
2122
+ const parts = [loc.city, loc.subdivision ?? loc.subdivisionName, country].filter(
2123
+ (p) => typeof p === "string" && p.length > 0
2124
+ );
2125
+ return parts.length > 0 ? parts.join(", ") : null;
2126
+ }
2118
2127
  // Annotate the CommonJS export names for ESM import in node:
2119
2128
  0 && (module.exports = {
2120
2129
  AdminClient,
@@ -2133,6 +2142,7 @@ function isMfaRequired(result) {
2133
2142
  WebhooksClient,
2134
2143
  WorkspacesClient,
2135
2144
  createMemoryCache,
2145
+ describeLocation,
2136
2146
  isMfaRequired
2137
2147
  });
2138
2148
  //# sourceMappingURL=index.cjs.map