@wrelik/auth 2.0.0 → 3.0.1

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.
@@ -1,27 +1,27 @@
1
1
 
2
- > @wrelik/auth@2.0.0 build /home/runner/work/wrelik-kit/wrelik-kit/packages/auth
2
+ > @wrelik/auth@3.0.1 build /Users/lee/Projects/wrelik-kit/packages/auth
3
3
  > tsup src/server/index.ts src/client/index.ts src/shared/index.ts --format cjs,esm --dts --clean
4
4
 
5
- CLI Building entry: src/client/index.ts, src/shared/index.ts, src/server/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.5.1
8
- CLI Target: es2019
9
- CLI Cleaning output folder
10
- CJS Build start
11
- ESM Build start
12
- CJS dist/client/index.js 1.62 KB
13
- CJS dist/shared/index.js 767.00 B
14
- CJS dist/server/index.js 2.70 KB
15
- CJS ⚡️ Build success in 62ms
16
- ESM dist/shared/index.mjs 0 B
17
- ESM dist/client/index.mjs 631.00 B
18
- ESM dist/server/index.mjs 1.53 KB
19
- ESM ⚡️ Build success in 65ms
20
- DTS Build start
21
- DTS ⚡️ Build success in 5529ms
22
- DTS dist/client/index.d.ts 155.00 B
23
- DTS dist/server/index.d.ts 684.00 B
24
- DTS dist/shared/index.d.ts 479.00 B
25
- DTS dist/client/index.d.mts 156.00 B
26
- DTS dist/server/index.d.mts 685.00 B
27
- DTS dist/shared/index.d.mts 479.00 B
5
+ CLI Building entry: src/shared/index.ts, src/client/index.ts, src/server/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.1
8
+ CLI Target: es2019
9
+ CLI Cleaning output folder
10
+ CJS Build start
11
+ ESM Build start
12
+ CJS dist/client/index.js 1.62 KB
13
+ CJS dist/server/index.js 2.72 KB
14
+ CJS dist/shared/index.js 767.00 B
15
+ CJS ⚡️ Build success in 201ms
16
+ ESM dist/shared/index.mjs 0 B
17
+ ESM dist/server/index.mjs 1.55 KB
18
+ ESM dist/client/index.mjs 631.00 B
19
+ ESM ⚡️ Build success in 201ms
20
+ DTS Build start
21
+ DTS ⚡️ Build success in 3429ms
22
+ DTS dist/client/index.d.ts 155.00 B
23
+ DTS dist/server/index.d.ts 701.00 B
24
+ DTS dist/shared/index.d.ts 479.00 B
25
+ DTS dist/client/index.d.mts 156.00 B
26
+ DTS dist/server/index.d.mts 702.00 B
27
+ DTS dist/shared/index.d.mts 479.00 B
@@ -0,0 +1,4 @@
1
+
2
+ > @wrelik/auth@3.0.0 lint /Users/lee/Projects/wrelik-kit/packages/auth
3
+ > eslint src/
4
+
@@ -0,0 +1,16 @@
1
+
2
+ > @wrelik/auth@3.0.0 test /Users/lee/Projects/wrelik-kit/packages/auth
3
+ > vitest run --passWithNoTests
4
+
5
+
6
+  RUN  v4.1.9 /Users/lee/Projects/wrelik-kit/packages/auth
7
+
8
+ ✓ src/client/index.contract.test.ts (1 test) 4ms
9
+ ✓ src/client/index.test.ts (2 tests) 6ms
10
+ ✓ src/server/index.test.ts (6 tests) 12ms
11
+
12
+  Test Files  3 passed (3)
13
+  Tests  9 passed (9)
14
+  Start at  15:16:09
15
+  Duration  945ms (transform 886ms, setup 0ms, import 1.12s, tests 22ms, environment 0ms)
16
+
@@ -0,0 +1,4 @@
1
+
2
+ > @wrelik/auth@3.0.0 typecheck /Users/lee/Projects/wrelik-kit/packages/auth
3
+ > tsc --noEmit
4
+
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @wrelik/auth
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 8083eb8: chore(deps): bump runtime dependencies to latest compatible versions
8
+
9
+ - `posthog-node` 5.28.11 → 5.39.4 (@wrelik/analytics)
10
+ - `@clerk/backend` 3.2.4 → 3.10.0 (@wrelik/auth)
11
+ - `resend` 6.10.0 → 6.17.1 (@wrelik/email)
12
+ - `@sentry/browser` + `@sentry/node` 10.47.0 → 10.63.0 (@wrelik/errors)
13
+ - `inngest` 4.1.2 → 4.11.0 (@wrelik/jobs)
14
+ - `@aws-sdk/client-s3` + `@aws-sdk/s3-request-presigner` 3.1023.0 → 3.1079.0 (@wrelik/storage)
15
+
16
+ No breaking changes. Workspace tooling also updated: turbo 2.10.3, typescript 6.0.3,
17
+ eslint 10.6.0, prettier 3.9.4, @changesets/cli 2.31.0, dependency-cruiser 18.0.0,
18
+ vitest 4.1.9, @types/node 26.x (all devDependencies, no changeset required).
19
+
20
+ - Updated dependencies [8083eb8]
21
+ - @wrelik/errors@2.0.2
22
+
23
+ ## 3.0.0
24
+
25
+ ### Major Changes
26
+
27
+ - 3262454: Upgrade runtime SDK and workspace tooling dependencies to latest compatible versions, including Clerk, Sentry, AWS SDK, Inngest, Resend, Upstash, Zod, TypeScript, Turbo, Vitest, TSUP, and ESLint.
28
+
29
+ Adopt root ESLint flat config and align wrapper peer ranges for updated SDK majors while preserving package export paths. Also apply a patched transitive Next.js resolution to close audit findings and keep production audit clean.
30
+
31
+ Note: Vite is pinned to the latest 7.x line for runtime compatibility in this environment; this avoids current rolldown native-binding failures seen with Vite 8 under Node 20.18.0.
32
+
33
+ Breaking change: `@wrelik/auth` and `@wrelik/clerk-next` now require `@clerk/nextjs@7.x` via updated peer ranges (`>=7 <8`). Consumers on Clerk v4-v6 must upgrade to Clerk v7 before adopting these versions.
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [3262454]
38
+ - @wrelik/errors@2.0.1
39
+
3
40
  ## 2.0.0
4
41
 
5
42
  ### Major Changes
@@ -1,8 +1,12 @@
1
- import { SignedInAuthObject, SignedOutAuthObject } from '@clerk/backend';
2
1
  import { WorkflowSession } from '../shared/index.mjs';
3
2
 
4
- declare function fromClerkAuth(clerkAuth: SignedInAuthObject | SignedOutAuthObject | null): WorkflowSession;
5
- declare function getSession(): WorkflowSession;
3
+ type ClerkAuthLike = {
4
+ userId: string | null;
5
+ orgId?: string | null;
6
+ sessionClaims?: unknown;
7
+ };
8
+ declare function fromClerkAuth(clerkAuth: ClerkAuthLike | null): WorkflowSession;
9
+ declare function getSession(): Promise<WorkflowSession>;
6
10
  declare function requireUser(session: WorkflowSession | null): string;
7
11
  declare function requireTenant(session: WorkflowSession | null): string;
8
12
  declare function hasRole(session: WorkflowSession | null, role: string): boolean;
@@ -1,8 +1,12 @@
1
- import { SignedInAuthObject, SignedOutAuthObject } from '@clerk/backend';
2
1
  import { WorkflowSession } from '../shared/index.js';
3
2
 
4
- declare function fromClerkAuth(clerkAuth: SignedInAuthObject | SignedOutAuthObject | null): WorkflowSession;
5
- declare function getSession(): WorkflowSession;
3
+ type ClerkAuthLike = {
4
+ userId: string | null;
5
+ orgId?: string | null;
6
+ sessionClaims?: unknown;
7
+ };
8
+ declare function fromClerkAuth(clerkAuth: ClerkAuthLike | null): WorkflowSession;
9
+ declare function getSession(): Promise<WorkflowSession>;
6
10
  declare function requireUser(session: WorkflowSession | null): string;
7
11
  declare function requireTenant(session: WorkflowSession | null): string;
8
12
  declare function hasRole(session: WorkflowSession | null, role: string): boolean;
@@ -28,7 +28,7 @@ __export(server_exports, {
28
28
  requireUser: () => requireUser
29
29
  });
30
30
  module.exports = __toCommonJS(server_exports);
31
- var import_nextjs = require("@clerk/nextjs");
31
+ var import_server = require("@clerk/nextjs/server");
32
32
  var import_shared = require("@wrelik/errors/shared");
33
33
  function normalizeRoles(value) {
34
34
  if (!Array.isArray(value)) {
@@ -49,8 +49,8 @@ function fromClerkAuth(clerkAuth) {
49
49
  roles: normalizeRoles((_c = claims.publicMetadata) == null ? void 0 : _c.roles)
50
50
  };
51
51
  }
52
- function getSession() {
53
- return fromClerkAuth((0, import_nextjs.auth)());
52
+ async function getSession() {
53
+ return fromClerkAuth(await (0, import_server.auth)());
54
54
  }
55
55
  function requireUser(session) {
56
56
  if (!(session == null ? void 0 : session.userId)) {
@@ -1,6 +1,10 @@
1
1
  // src/server/index.ts
2
- import { auth } from "@clerk/nextjs";
3
- import { AuthRequiredError, PermissionDeniedError, TenantRequiredError } from "@wrelik/errors/shared";
2
+ import { auth } from "@clerk/nextjs/server";
3
+ import {
4
+ AuthRequiredError,
5
+ PermissionDeniedError,
6
+ TenantRequiredError
7
+ } from "@wrelik/errors/shared";
4
8
  function normalizeRoles(value) {
5
9
  if (!Array.isArray(value)) {
6
10
  return [];
@@ -20,8 +24,8 @@ function fromClerkAuth(clerkAuth) {
20
24
  roles: normalizeRoles((_c = claims.publicMetadata) == null ? void 0 : _c.roles)
21
25
  };
22
26
  }
23
- function getSession() {
24
- return fromClerkAuth(auth());
27
+ async function getSession() {
28
+ return fromClerkAuth(await auth());
25
29
  }
26
30
  function requireUser(session) {
27
31
  if (!(session == null ? void 0 : session.userId)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrelik/auth",
3
- "version": "2.0.0",
3
+ "version": "3.0.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -29,17 +29,21 @@
29
29
  "./package.json": "./package.json"
30
30
  },
31
31
  "dependencies": {
32
- "@clerk/backend": "^0.38.0",
33
- "@wrelik/errors": "2.0.0"
32
+ "@clerk/backend": "^3.10.0",
33
+ "@wrelik/errors": "2.0.2"
34
34
  },
35
35
  "peerDependencies": {
36
- "@clerk/nextjs": "^4.29.0"
36
+ "@clerk/nextjs": ">=7 <8"
37
37
  },
38
38
  "devDependencies": {
39
- "tsup": "^8.0.1",
40
- "vitest": "^1.2.2",
41
- "@wrelik/eslint-config": "0.1.1",
42
- "@wrelik/tsconfig": "0.1.1"
39
+ "@clerk/nextjs": "^7.5.12",
40
+ "@types/node": "^26.1.0",
41
+ "next": "15.5.14",
42
+ "tsup": "^8.5.1",
43
+ "vite": "^7.3.1",
44
+ "vitest": "^4.1.9",
45
+ "@wrelik/eslint-config": "0.1.2",
46
+ "@wrelik/tsconfig": "0.1.2"
43
47
  },
44
48
  "wrelik": {
45
49
  "runtimes": [
@@ -33,7 +33,7 @@ describe('@wrelik/auth/server', () => {
33
33
 
34
34
  it('retrieves and normalizes sessions from Clerk auth()', async () => {
35
35
  vi.resetModules();
36
- vi.doMock('@clerk/nextjs', () => ({
36
+ vi.doMock('@clerk/nextjs/server', () => ({
37
37
  auth: () => ({
38
38
  userId: 'u1',
39
39
  orgId: 'o1',
@@ -42,17 +42,17 @@ describe('@wrelik/auth/server', () => {
42
42
  }));
43
43
 
44
44
  const mod = await import('./index');
45
- expect(mod.getSession()).toEqual({ userId: 'u1', tenantId: 'o1', roles: ['admin'] });
45
+ await expect(mod.getSession()).resolves.toEqual({ userId: 'u1', tenantId: 'o1', roles: ['admin'] });
46
46
  });
47
47
 
48
48
  it('returns anonymous session when Clerk auth() is signed out', async () => {
49
49
  vi.resetModules();
50
- vi.doMock('@clerk/nextjs', () => ({
50
+ vi.doMock('@clerk/nextjs/server', () => ({
51
51
  auth: () => ({ userId: null, orgId: null, sessionClaims: {} }),
52
52
  }));
53
53
 
54
54
  const mod = await import('./index');
55
- expect(mod.getSession()).toEqual({ userId: null, tenantId: null, roles: [] });
55
+ await expect(mod.getSession()).resolves.toEqual({ userId: null, tenantId: null, roles: [] });
56
56
  });
57
57
 
58
58
  it('does not expose a root package import', () => {
@@ -1,7 +1,9 @@
1
- /* eslint-disable no-restricted-imports */
2
- import type { SignedInAuthObject, SignedOutAuthObject } from '@clerk/backend';
3
- import { auth } from '@clerk/nextjs';
4
- import { AuthRequiredError, PermissionDeniedError, TenantRequiredError } from '@wrelik/errors/shared';
1
+ import { auth } from '@clerk/nextjs/server';
2
+ import {
3
+ AuthRequiredError,
4
+ PermissionDeniedError,
5
+ TenantRequiredError,
6
+ } from '@wrelik/errors/shared';
5
7
  import type { ClerkSessionLike, WorkflowSession } from '../shared';
6
8
 
7
9
  function normalizeRoles(value: unknown): string[] {
@@ -12,13 +14,22 @@ function normalizeRoles(value: unknown): string[] {
12
14
  return value.filter((role): role is string => typeof role === 'string');
13
15
  }
14
16
 
15
- export function fromClerkAuth(clerkAuth: SignedInAuthObject | SignedOutAuthObject | null): WorkflowSession {
17
+ type ClerkAuthLike = {
18
+ userId: string | null;
19
+ orgId?: string | null;
20
+ sessionClaims?: unknown;
21
+ };
22
+
23
+ export function fromClerkAuth(
24
+ clerkAuth: ClerkAuthLike | null,
25
+ ): WorkflowSession {
16
26
  if (!clerkAuth?.userId) {
17
27
  return { userId: null, tenantId: null, roles: [] };
18
28
  }
19
29
 
20
30
  const authLike: ClerkSessionLike = clerkAuth;
21
- const claims = (authLike.sessionClaims as { publicMetadata?: { roles?: unknown } } | undefined) ?? {};
31
+ const claims =
32
+ (authLike.sessionClaims as { publicMetadata?: { roles?: unknown } } | undefined) ?? {};
22
33
 
23
34
  return {
24
35
  userId: clerkAuth.userId,
@@ -27,8 +38,8 @@ export function fromClerkAuth(clerkAuth: SignedInAuthObject | SignedOutAuthObjec
27
38
  };
28
39
  }
29
40
 
30
- export function getSession(): WorkflowSession {
31
- return fromClerkAuth(auth());
41
+ export async function getSession(): Promise<WorkflowSession> {
42
+ return fromClerkAuth(await auth());
32
43
  }
33
44
 
34
45
  export function requireUser(session: WorkflowSession | null): string {
package/tsconfig.json CHANGED
@@ -2,7 +2,9 @@
2
2
  "extends": "@wrelik/tsconfig/next.json",
3
3
  "compilerOptions": {
4
4
  "incremental": false,
5
- "outDir": "dist", "skipLibCheck": true
5
+ "outDir": "dist",
6
+ "skipLibCheck": true,
7
+ "types": ["node"]
6
8
  },
7
9
  "include": ["src"]
8
10
  }