Skip to content

Commit 2587aa6

Browse files
authored
feat(shared,types,clerk-react,clerk-js): Migrate @clerk/types to @clerk/shared/types (#7022)
1 parent e653a58 commit 2587aa6

File tree

597 files changed

+3818
-2656
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

597 files changed

+3818
-2656
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
'@clerk/types': minor
3+
'@clerk/shared': minor
4+
'@clerk/astro': patch
5+
'@clerk/backend': patch
6+
'@clerk/chrome-extension': patch
7+
'@clerk/clerk-js': patch
8+
'@clerk/elements': patch
9+
'@clerk/themes': patch
10+
'@clerk/vue': patch
11+
---
12+
13+
Deprecate `@clerk/types` in favor of `@clerk/shared/types`
14+
15+
The `@clerk/types` package is now deprecated. All type definitions have been consolidated and moved to `@clerk/shared/types` to improve consistency across the Clerk ecosystem.
16+
17+
**Backward Compatibility:**
18+
19+
The `@clerk/types` package will remain available and will continue to re-export all types from `@clerk/shared/types` to ensure backward compatibility. Existing applications will continue to work without any immediate breaking changes. However, we strongly recommend migrating to `@clerk/shared/types` as new type definitions and updates will only be added to `@clerk/shared/types` starting with the next major release.
20+
21+
**Migration Steps:**
22+
23+
Please update your imports from `@clerk/types` to `@clerk/shared/types`:
24+
25+
```typescript
26+
// Before
27+
import type { ClerkResource, UserResource } from '@clerk/types';
28+
29+
// After
30+
import type { ClerkResource, UserResource } from '@clerk/shared/types';
31+
```
32+
33+
**What Changed:**
34+
35+
All type definitions including:
36+
- Resource types (User, Organization, Session, etc.)
37+
- API response types
38+
- Configuration types
39+
- Authentication types
40+
- Error types
41+
- And all other shared types
42+
43+
Have been moved from `packages/types/src` to `packages/shared/src/types` and are now exported via `@clerk/shared/types`.
44+

.github/workflows/ci.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818
jobs:
1919
# Check triggering actor permissions to prevent PRs from forks accessing secrets by default, preventing them from exfiltrating secrets for malicious purposes
2020
check-permissions:
21-
runs-on: 'blacksmith-8vcpu-ubuntu-2204'
21+
runs-on: "blacksmith-8vcpu-ubuntu-2204"
2222
defaults:
2323
run:
2424
shell: bash
@@ -48,7 +48,7 @@ jobs:
4848
needs: [check-permissions]
4949
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
5050
name: Formatting | Dedupe | Changeset
51-
runs-on: 'blacksmith-8vcpu-ubuntu-2204'
51+
runs-on: "blacksmith-8vcpu-ubuntu-2204"
5252
defaults:
5353
run:
5454
shell: bash
@@ -89,7 +89,7 @@ jobs:
8989
needs: [check-permissions]
9090
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
9191
name: Build Packages
92-
runs-on: 'blacksmith-8vcpu-ubuntu-2204'
92+
runs-on: "blacksmith-8vcpu-ubuntu-2204"
9393
permissions:
9494
contents: read
9595
defaults:
@@ -135,7 +135,7 @@ jobs:
135135
permissions:
136136
contents: read
137137
actions: write # needed for actions/upload-artifact
138-
runs-on: 'blacksmith-8vcpu-ubuntu-2204'
138+
runs-on: "blacksmith-8vcpu-ubuntu-2204"
139139
defaults:
140140
run:
141141
shell: bash
@@ -195,7 +195,7 @@ jobs:
195195
permissions:
196196
contents: read
197197
actions: write # needed for actions/upload-artifact
198-
runs-on: 'blacksmith-8vcpu-ubuntu-2204'
198+
runs-on: "blacksmith-8vcpu-ubuntu-2204"
199199
defaults:
200200
run:
201201
shell: bash
@@ -208,10 +208,8 @@ jobs:
208208
fail-fast: true
209209
matrix:
210210
include:
211-
- node-version: 18
212-
test-filter: '--filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@clerk/nextjs --filter=@clerk/clerk-react --filter=@clerk/shared --filter=@clerk/remix --filter=@clerk/tanstack-react-start --filter=@clerk/elements --filter=@clerk/vue --filter=@clerk/nuxt --filter=@clerk/clerk-expo'
213211
- node-version: 22
214-
test-filter: '**'
212+
test-filter: "**"
215213

216214
steps:
217215
- name: Checkout Repo
@@ -268,7 +266,7 @@ jobs:
268266
permissions:
269267
contents: read
270268
actions: write # needed for actions/upload-artifact
271-
runs-on: 'blacksmith-8vcpu-ubuntu-2204'
269+
runs-on: "blacksmith-8vcpu-ubuntu-2204"
272270
defaults:
273271
run:
274272
shell: bash
@@ -297,7 +295,7 @@ jobs:
297295
'machine',
298296
'custom',
299297
]
300-
test-project: ['chrome']
298+
test-project: ["chrome"]
301299
include:
302300
- test-name: 'nextjs'
303301
test-project: 'chrome'
@@ -344,7 +342,7 @@ jobs:
344342
id: task-status
345343
env:
346344
E2E_APP_CLERK_JS_DIR: ${{runner.temp}}
347-
E2E_CLERK_VERSION: 'latest'
345+
E2E_CLERK_VERSION: "latest"
348346
E2E_NEXTJS_VERSION: ${{ matrix.next-version }}
349347
E2E_PROJECT: ${{ matrix.test-project }}
350348
INTEGRATION_INSTANCE_KEYS: ${{ secrets.INTEGRATION_INSTANCE_KEYS }}
@@ -397,8 +395,8 @@ jobs:
397395
if: ${{ steps.task-status.outputs.affected == '1' }}
398396
uses: actions/github-script@v7
399397
env:
400-
INTEGRATION_CERTS: '${{secrets.INTEGRATION_CERTS}}'
401-
INTEGRATION_ROOT_CA: '${{secrets.INTEGRATION_ROOT_CA}}'
398+
INTEGRATION_CERTS: "${{secrets.INTEGRATION_CERTS}}"
399+
INTEGRATION_ROOT_CA: "${{secrets.INTEGRATION_ROOT_CA}}"
402400
with:
403401
script: |
404402
const fs = require('fs');
@@ -423,7 +421,7 @@ jobs:
423421
run: pnpm turbo test:integration:${{ matrix.test-name }} $TURBO_ARGS
424422
env:
425423
E2E_APP_CLERK_JS_DIR: ${{runner.temp}}
426-
E2E_CLERK_VERSION: 'latest'
424+
E2E_CLERK_VERSION: "latest"
427425
E2E_NEXTJS_VERSION: ${{ matrix.next-version }}
428426
E2E_PROJECT: ${{ matrix.test-project }}
429427
E2E_CLERK_ENCRYPTION_KEY: ${{ matrix.clerk-encryption-key }}
@@ -443,7 +441,7 @@ jobs:
443441
name: Publish with pkg-pr-new
444442
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
445443
needs: [check-permissions, build-packages]
446-
runs-on: 'blacksmith-8vcpu-ubuntu-2204'
444+
runs-on: "blacksmith-8vcpu-ubuntu-2204"
447445
defaults:
448446
run:
449447
shell: bash

.typedoc/__tests__/file-structure.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ describe('Typedoc output', () => {
3636
"clerk-react",
3737
"nextjs",
3838
"shared",
39-
"types",
4039
]
4140
`);
4241
});

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export default tseslint.config([
120120
'packages/backend/src/runtime/**/*',
121121
'packages/clerk-js/rspack.config.js',
122122
'packages/shared/src/compiled/path-to-regexp/index.js',
123+
'packages/shared/tsdown.config.mjs',
123124
],
124125
},
125126
{

integration/templates/expo-web/metro.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ const getClerkExpoPath = () => {
1919
return clerkExpoPath.replace('file:', '');
2020
}
2121

22+
if (clerkExpoPath?.startsWith('link:')) {
23+
return clerkExpoPath.replace('link:', '');
24+
}
25+
2226
return undefined;
2327
};
2428

integration/tests/custom-flows/sign-in.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { expect, test } from '@playwright/test';
21
import { parsePublishableKey } from '@clerk/shared/keys';
32
import { clerkSetup } from '@clerk/testing/playwright';
3+
import { expect, test } from '@playwright/test';
44

55
import type { Application } from '../../models/application';
66
import { appConfigs } from '../../presets';
7-
import { createTestUtils, FakeUser } from '../../testUtils';
7+
import type { FakeUser } from '../../testUtils';
8+
import { createTestUtils } from '../../testUtils';
89

910
test.describe('Custom Flows Sign In @custom', () => {
1011
test.describe.configure({ mode: 'parallel' });

integration/tests/custom-flows/sign-up.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { expect, test } from '@playwright/test';
21
import { parsePublishableKey } from '@clerk/shared/keys';
32
import { clerkSetup } from '@clerk/testing/playwright';
3+
import { expect, test } from '@playwright/test';
44

55
import type { Application } from '../../models/application';
66
import { appConfigs } from '../../presets';
7-
import { createTestUtils, FakeUser } from '../../testUtils';
7+
import type { FakeUser } from '../../testUtils';
8+
import { createTestUtils } from '../../testUtils';
89

910
test.describe('Custom Flows Sign Up @custom', () => {
1011
test.describe.configure({ mode: 'parallel' });

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,11 @@
134134
"react": "catalog:react",
135135
"react-dom": "catalog:react",
136136
"rimraf": "6.0.1",
137+
"rolldown": "catalog:repo",
137138
"statuses": "^1.5.0",
138139
"tree-kill": "^1.2.2",
139140
"ts-jest": "29.2.5",
141+
"tsdown": "catalog:repo",
140142
"tsup": "catalog:repo",
141143
"turbo": "^2.5.4",
142144
"typedoc": "0.28.5",
@@ -162,10 +164,9 @@
162164
],
163165
"overrides": {
164166
"jest": "29.7.0",
165-
"jest-snapshot-prettier": "npm:prettier@^3.5.3"
166-
},
167-
"patchedDependencies": {
168-
167+
"jest-snapshot-prettier": "npm:prettier@^3.5.3",
168+
"react": "catalog:react",
169+
"react-dom": "catalog:react"
169170
}
170171
}
171172
}

packages/agent-toolkit/src/langchain/adapter.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import type { SdkAdapter } from '../lib/types';
88
* For more details, take a look at the LangChain docs https://js.langchain.com/docs/how_to/custom_tools
99
*/
1010
export const adapter: SdkAdapter<StructuredTool> = (clerkClient, context, clerkTool) => {
11-
return tool(clerkTool.bindExecute(clerkClient, context), {
11+
const executeFn = clerkTool.bindExecute(clerkClient, context as any) as any;
12+
const toolConfig = {
1213
name: clerkTool.name,
1314
description: clerkTool.description,
1415
schema: clerkTool.parameters,
15-
});
16+
} as any;
17+
return tool(executeFn, toolConfig) as StructuredTool;
1618
};

packages/astro/src/stores/external.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { deriveState } from '@clerk/shared/deriveState';
22
import { eventMethodCalled } from '@clerk/shared/telemetry';
3+
import type { SignedInSessionResource } from '@clerk/types';
34
import { batched, computed, onMount, type Store } from 'nanostores';
45

56
import { $clerk, $csrState, $initialState } from './internal';
@@ -51,7 +52,7 @@ export const $userStore = computed([$authStore], auth => auth.user);
5152
* @example
5253
* $sessionStore.subscribe((session) => console.log(session.id))
5354
*/
54-
export const $sessionStore = computed([$authStore], auth => auth.session);
55+
export const $sessionStore = computed([$authStore], auth => auth.session as SignedInSessionResource | null | undefined);
5556

5657
/**
5758
* A client side store that is populated after clerk-js has loaded.

0 commit comments

Comments
 (0)