@jgb-solutions/kit 0.4.0 → 0.4.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to `@jgb-solutions/kit`. Versions follow semver.
4
4
 
5
+ ## 0.4.2
6
+
7
+ - Dependency update: `jose` 6.2.18 to 6.2.19 (patch).
8
+
9
+ ## 0.4.1
10
+
11
+ - `toAuthUser` adds `createdAt` (ISO 8601) when the session's user has it, for a "Member since" line on account screens. Better Auth sends a `Date` on the server and a string once serialized; both are accepted, and an invalid or missing value leaves `createdAt` out. `AuthUser.createdAt` is optional, so code that builds an `AuthUser` by hand keeps compiling.
12
+
5
13
  ## 0.4.0
6
14
 
7
15
  - `@jgb-solutions/kit/i18n`: four languages (`en`, `fr`, `es`, `ht`) with one set of rules, for websites and Expo apps. No dependencies. Locale paths (English unprefixed; `/fr`, `/es`, `/ht`): `localeFromPath`, `stripLocale`, `localizedPath`, `alternates` (hreflang with x-default). Negotiation: `negotiate` (Accept-Language with q-values) and `suggestLocale` for a "view this page in X?" bar, with `LOCALE_COOKIE` remembering the choice (no automatic redirects). Messages: typed nested catalogs (`Catalog`, `defineCatalog`, `MessageKey`, `Params`), `createTranslator` with `{placeholders}`, plurals through `Intl.PluralRules`, fallback to English and then to the key, and `checkCatalog` for tests.
@@ -72,6 +72,8 @@ export type AuthUser<Role extends string = string> = {
72
72
  email: string | null;
73
73
  image: string | null;
74
74
  role: Role;
75
+ /** When the account was created (ISO 8601), for "Member since"; absent when the session doesn't say. */
76
+ createdAt?: string;
75
77
  };
76
78
  /**
77
79
  * A profile picture's address at the size shown (twice that, for sharp screens), or '' when it can't
package/dist/auth.d.ts CHANGED
@@ -242,6 +242,8 @@ export type SessionUser = {
242
242
  displayUsername?: string | null | undefined;
243
243
  role?: string | null | undefined;
244
244
  banned?: boolean | null | undefined;
245
+ /** Better Auth's `createdAt`: a Date on the server, an ISO string once serialized. */
246
+ createdAt?: Date | string | null | undefined;
245
247
  };
246
248
  /** The signed-in person from a session's user, or null for none or a suspended account. */
247
249
  export declare function toAuthUser<Role extends string>(user: SessionUser | null | undefined, roleOf: (stored: string | null | undefined) => Role): AuthUser<Role> | null;
package/dist/auth.js CHANGED
@@ -241,6 +241,12 @@ function asPublicRequest(request, siteUrl) {
241
241
  url.protocol = site.protocol;
242
242
  return new Request(url, request);
243
243
  }
244
+ function createdIso(value) {
245
+ if (value === null || value === undefined)
246
+ return null;
247
+ const date = value instanceof Date ? value : new Date(value);
248
+ return Number.isNaN(date.getTime()) ? null : date.toISOString();
249
+ }
244
250
  function toAuthUser(user, roleOf) {
245
251
  if (!user || user.banned)
246
252
  return null;
@@ -250,9 +256,11 @@ function toAuthUser(user, roleOf) {
250
256
  name: user.name,
251
257
  email: isPlaceholderEmail(user.email) ? null : user.email,
252
258
  image: user.image ?? null,
253
- role: roleOf(user.role)
259
+ role: roleOf(user.role),
260
+ ...withCreatedAt(createdIso(user.createdAt))
254
261
  };
255
262
  }
263
+ var withCreatedAt = (createdAt) => createdAt ? { createdAt } : {};
256
264
  function standardAuthOptions(input) {
257
265
  const { settings } = input;
258
266
  const fromRequest = input.passkeyOrigin === "request";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jgb-solutions/kit",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "One package for JGB Solutions apps, in tree-shakable namespaces: Cloudflare Access, Better Auth (kit/access, kit/auth\u2026) and the admin panel kit (kit/admin, React 19). An app bundles only the subpaths it imports.",
5
5
  "license": "MIT",
6
6
  "author": "JGB Solutions",
@@ -94,7 +94,7 @@
94
94
  "screenshots": "bun --bun playwright test e2e/screenshots.spec.ts"
95
95
  },
96
96
  "dependencies": {
97
- "jose": "6.2.18"
97
+ "jose": "6.2.19"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "better-auth": ">=1.7.22 <2",
@@ -121,14 +121,14 @@
121
121
  }
122
122
  },
123
123
  "devDependencies": {
124
- "@axe-core/playwright": "4.14.0",
125
- "@better-auth/passkey": "1.7.27",
126
- "@orpc/server": "2.0.0-beta.52",
127
- "@playwright/test": "1.64.1",
124
+ "@axe-core/playwright": "4.14.1",
125
+ "@better-auth/passkey": "1.7.29",
126
+ "@orpc/server": "2.0.0-beta.53",
127
+ "@playwright/test": "1.65.1",
128
128
  "@types/bun": "1.4.5",
129
- "@types/react": "19.3.0",
129
+ "@types/react": "19.3.3",
130
130
  "@types/react-dom": "19.3.0",
131
- "better-auth": "1.7.27",
131
+ "better-auth": "1.7.29",
132
132
  "react": "19.3.1",
133
133
  "react-dom": "19.3.1",
134
134
  "typescript": "6.0.3"