Skip to content

Commit 276ef8e

Browse files
committed
chore(repo): Reformat packages with latest prettier config
1 parent eba2f1b commit 276ef8e

File tree

402 files changed

+2401
-4416
lines changed

Some content is hidden

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

402 files changed

+2401
-4416
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ For package specific details on installation, architecture and usage usage, you
4040
- [`@clerk/backend-core`](./packages/backend-core): Functionalities regarded as "core" for Clerk to operate with. _Authentication resolution, API Resources etc._
4141
- [`@clerk/edge`](./packages/edge): Top level SDK for edge environments containing all required helpers and middleware.
4242
- [`@clerk/clerk-sdk-node`](./packages/sdk-node): SDK for native Node.js environment and frameworks.
43-
- [`@clerk/nextjs`](./packages/nextjs): Clerk package for Next.js.
43+
- [`@clerk/nextjs`](./packages/nextjs): Clerk package for Next.js.
4444
- [`@clerk/clerk-js`](./packages/clerk-js): Core JavaScript implementation used by Clerk in the browser.
4545
- [`@clerk/clerk-react`](./packages/react) Clerk package for React applications.
4646
- [`@clerk/clerk-expo`](./packages/expo) Clerk package for the Expo universal app framework.

commitlint.config.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ module.exports = {
88
'subject-case': [2, 'always', ['sentence-case']],
99
'body-max-line-length': [1, 'always', '150'],
1010
'scope-empty': [2, 'never'],
11-
'scope-enum': async (ctx) => [
12-
2,
13-
'always',
14-
[...(await getPackages(ctx)), 'repo', 'release'],
15-
],
11+
'scope-enum': async ctx => [2, 'always', [...(await getPackages(ctx)), 'repo', 'release']],
1612
},
1713
};

docs/PUBLISH.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
_Version updates and publishing is managed using Lerna._
44

55
## TLDR
6+
67
1. `npm run bump`
78
2. `npm run release`
89

@@ -13,11 +14,12 @@ After all the features have been merged and we want to create a new release, we
1314
This script will use `lerna version` to check which packages need to be updated and in what way based on the updates since the previous release.
1415

1516
The command will guide you through the version changes that are detected and will:
17+
1618
- Bump the package versions.
1719
- Run the `version` hook updating the version info files.
1820
- Create new tags and a "release" commit.
1921
- Push the commit and tags to the origin.
2022

21-
After that is done, and all seems valid, you can run `npm run release` which will go through the publish process of the packages included in the release commit.
23+
After that is done, and all seems valid, you can run `npm run release` which will go through the publish process of the packages included in the release commit.
2224

23-
\*For more info you can check the [lerna version](https://github.com/lerna/lerna/tree/main/commands/version) and [lerna publish](https://github.com/lerna/lerna/tree/main/commands/publish) documentation.
25+
\*For more info you can check the [lerna version](https://github.com/lerna/lerna/tree/main/commands/version) and [lerna publish](https://github.com/lerna/lerna/tree/main/commands/publish) documentation.

lerna.json

+14-24
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
11
{
2-
"version": "independent",
3-
"packages": [
4-
"packages/*"
5-
],
6-
"command": {
7-
"version": {
8-
"message": "chore(release): Publish",
9-
"allowBranch": [
10-
"main",
11-
"next",
12-
"staging"
13-
],
14-
"conventionalCommits": true
15-
},
16-
"publish": {
17-
"allowBranch": [
18-
"main",
19-
"next",
20-
"staging"
21-
]
22-
}
2+
"version": "independent",
3+
"packages": ["packages/*"],
4+
"command": {
5+
"version": {
6+
"message": "chore(release): Publish",
7+
"allowBranch": ["main", "next", "staging"],
8+
"conventionalCommits": true
239
},
24-
"changelogPreset": {
25-
"name": "conventionalcommits"
10+
"publish": {
11+
"allowBranch": ["main", "next", "staging"]
2612
}
27-
}
13+
},
14+
"changelogPreset": {
15+
"name": "conventionalcommits"
16+
}
17+
}

packages/backend-core/API.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ Allowlist operations are exposed by the `allowlistIdentifiers` sub-api (`clerkAP
4646
Retrieves the list of allowlist identifiers.
4747

4848
```ts
49-
const allowlistIdentifiers =
50-
await clerkAPI.allowlistIdentifiers.getAllowlistIdentifierList();
49+
const allowlistIdentifiers = await clerkAPI.allowlistIdentifiers.getAllowlistIdentifierList();
5150
```
5251

5352
#### createAllowlistIdentifier(params)
@@ -63,11 +62,10 @@ Accepts an `identifier` parameter, which can be:
6362
You can also control if you want to notify the owner of the `identifier`, by setting the `notify` property to `true`. The `notify` property is not available for wildcard identifiers.
6463

6564
```ts
66-
const allowlistIdentifier =
67-
await clerkAPI.allowlistIdentifiers.createAllowlistIdentifier({
68-
identifier: 'test@example.com',
69-
notify: false,
70-
});
65+
const allowlistIdentifier = await clerkAPI.allowlistIdentifiers.createAllowlistIdentifier({
66+
identifier: 'test@example.com',
67+
notify: false,
68+
});
7169
```
7270

7371
#### deleteAllowlistIdentifier(allowlistIdentifierId)

packages/backend-core/README.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,7 @@ const importKey = async (jwk: JsonWebKey, algorithm: Algorithm) => {
5858
// ...
5959
};
6060

61-
const verifySignature = async (
62-
algorithm: Algorithm,
63-
key: CryptoKey,
64-
signature: Uint8Array,
65-
data: Uint8Array,
66-
) => {
61+
const verifySignature = async (algorithm: Algorithm, key: CryptoKey, signature: Uint8Array, data: Uint8Array) => {
6762
// ...
6863
};
6964

packages/backend-core/jest.config.cjs

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
module.exports = {
2-
roots: ['<rootDir>/src'],
3-
testMatch: ['**/?(*.)+(spec|test).+(ts|tsx|js)'],
4-
transform: {
5-
'^.+\\.ts$': 'ts-jest',
6-
},
7-
setupFiles: ['<rootDir>/jest/setupEnvVars.js'],
8-
collectCoverage: true,
9-
};
10-
2+
roots: ['<rootDir>/src'],
3+
testMatch: ['**/?(*.)+(spec|test).+(ts|tsx|js)'],
4+
transform: {
5+
'^.+\\.ts$': 'ts-jest',
6+
},
7+
setupFiles: ['<rootDir>/jest/setupEnvVars.js'],
8+
collectCoverage: true,
9+
};

packages/backend-core/src/Base.ts

+5-21
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import { JWT, JWTPayload } from './util/types';
99

1010
export const API_KEY = process.env.CLERK_API_KEY || '';
1111

12-
type ImportKeyFunction = (
13-
...args: any[]
14-
) => Promise<CryptoKey | PeculiarCryptoKey>;
12+
type ImportKeyFunction = (...args: any[]) => Promise<CryptoKey | PeculiarCryptoKey>;
1513
type LoadCryptoKeyFunction = (token: string) => Promise<CryptoKey>;
1614
type DecodeBase64Function = (base64Encoded: string) => string;
1715
type VerifySignatureFunction = (...args: any[]) => Promise<boolean>;
@@ -107,9 +105,7 @@ export class Base {
107105
*/
108106
verifySessionToken = async (
109107
token: string,
110-
{
111-
authorizedParties,
112-
}: VerifySessionTokenOptions = verifySessionTokenDefaultOptions,
108+
{ authorizedParties }: VerifySessionTokenOptions = verifySessionTokenDefaultOptions,
113109
): Promise<JWTPayload> => {
114110
// Try to load the PK from supplied function and
115111
// if there is no custom load function
@@ -172,9 +168,7 @@ export class Base {
172168
const [rawHeader, rawPayload, rawSignature] = tokenParts;
173169
const header = JSON.parse(this.decodeBase64Function(rawHeader));
174170
const payload = JSON.parse(this.decodeBase64Function(rawPayload));
175-
const signature = this.decodeBase64Function(
176-
rawSignature.replace(/_/g, '/').replace(/-/g, '+'),
177-
);
171+
const signature = this.decodeBase64Function(rawSignature.replace(/_/g, '/').replace(/-/g, '+'));
178172
return {
179173
header,
180174
payload,
@@ -188,12 +182,7 @@ export class Base {
188182
const data = encoder.encode([rawHeader, rawPayload].join('.'));
189183
const signature = parse(rawSignature);
190184

191-
const isVerified = await this.verifySignatureFunction(
192-
'RSASSA-PKCS1-v1_5',
193-
key,
194-
signature,
195-
data,
196-
);
185+
const isVerified = await this.verifySignatureFunction('RSASSA-PKCS1-v1_5', key, signature, data);
197186
if (!isVerified) {
198187
throw new Error('Failed to verify token');
199188
}
@@ -345,12 +334,7 @@ export class Base {
345334
}
346335
}
347336

348-
if (
349-
cookieToken &&
350-
clientUat &&
351-
sessionClaims?.iat &&
352-
sessionClaims.iat >= Number(clientUat)
353-
) {
337+
if (cookieToken && clientUat && sessionClaims?.iat && sessionClaims.iat >= Number(clientUat)) {
354338
return {
355339
status: AuthStatus.SignedIn,
356340
session: {

packages/backend-core/src/__tests__/TestBackendAPI.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { ClerkBackendAPI } from '../api/ClerkBackendAPI';
44

55
const defaultApiKey = process.env.CLERK_API_KEY || '';
66
const defaultApiVersion = process.env.CLERK_API_VERSION || 'v1';
7-
const defaultServerApiUrl =
8-
process.env.CLERK_API_URL || 'https://api.clerk.dev';
7+
const defaultServerApiUrl = process.env.CLERK_API_URL || 'https://api.clerk.dev';
98

109
export const TestBackendAPIClient = new ClerkBackendAPI({
1110
apiKey: defaultApiKey,
@@ -14,10 +13,7 @@ export const TestBackendAPIClient = new ClerkBackendAPI({
1413
libName: 'test',
1514
libVersion: '0.0.1',
1615
packageRepo: 'test',
17-
fetcher: async (
18-
url,
19-
{ method, authorization, contentType, userAgent, body }
20-
) => {
16+
fetcher: async (url, { method, authorization, contentType, userAgent, body }) => {
2117
return (
2218
await fetch(url, {
2319
method,

packages/backend-core/src/__tests__/apis/AllowlistIdentifierApi.test.ts

+14-25
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,9 @@ import { TestBackendAPIClient } from '../TestBackendAPI';
66
test('getAllowlistIdentifierList() returns a list of allowlist identifiers', async () => {
77
nock('https://api.clerk.dev')
88
.get('/v1/allowlist_identifiers')
9-
.replyWithFile(
10-
200,
11-
__dirname + '/responses/getAllowlistIdentifierList.json',
12-
{}
13-
);
9+
.replyWithFile(200, __dirname + '/responses/getAllowlistIdentifierList.json', {});
1410

15-
const allowlistIdentifierList =
16-
await TestBackendAPIClient.allowlistIdentifiers.getAllowlistIdentifierList();
11+
const allowlistIdentifierList = await TestBackendAPIClient.allowlistIdentifiers.getAllowlistIdentifierList();
1712
expect(allowlistIdentifierList).toBeInstanceOf(Array);
1813
expect(allowlistIdentifierList.length).toEqual(1);
1914
expect(allowlistIdentifierList[0]).toBeInstanceOf(AllowlistIdentifier);
@@ -35,22 +30,21 @@ test('createAllowlistIdentifier() creates an allowlist identifier', async () =>
3530
JSON.stringify({
3631
identifier,
3732
notify: false,
38-
})
33+
}),
3934
)
4035
.reply(200, resJSON);
4136

42-
const allowlistIdentifier =
43-
await TestBackendAPIClient.allowlistIdentifiers.createAllowlistIdentifier({
44-
identifier,
45-
notify: false,
46-
});
37+
const allowlistIdentifier = await TestBackendAPIClient.allowlistIdentifiers.createAllowlistIdentifier({
38+
identifier,
39+
notify: false,
40+
});
4741
expect(allowlistIdentifier).toEqual(
4842
new AllowlistIdentifier({
4943
id: resJSON.id,
5044
identifier,
5145
createdAt: resJSON.created_at,
5246
updatedAt: resJSON.updated_at,
53-
})
47+
}),
5448
);
5549
});
5650

@@ -64,26 +58,21 @@ test('deleteAllowlistIdentifier() deletes an allowlist identifier', async () =>
6458
updated_at: 1611948436,
6559
};
6660

67-
nock('https://api.clerk.dev')
68-
.delete(`/v1/allowlist_identifiers/${id}`)
69-
.reply(200, resJSON);
61+
nock('https://api.clerk.dev').delete(`/v1/allowlist_identifiers/${id}`).reply(200, resJSON);
7062

71-
const allowlistIdentifier =
72-
await TestBackendAPIClient.allowlistIdentifiers.deleteAllowlistIdentifier(
73-
id
74-
);
63+
const allowlistIdentifier = await TestBackendAPIClient.allowlistIdentifiers.deleteAllowlistIdentifier(id);
7564
expect(allowlistIdentifier).toEqual(
7665
new AllowlistIdentifier({
7766
id,
7867
identifier: resJSON.identifier,
7968
createdAt: resJSON.created_at,
8069
updatedAt: resJSON.updated_at,
81-
})
70+
}),
8271
);
8372
});
8473

8574
test('deleteAllowlistIdentifier() throws an error without allowlist identifier ID', async () => {
86-
await expect(
87-
TestBackendAPIClient.allowlistIdentifiers.deleteAllowlistIdentifier('')
88-
).rejects.toThrow('A valid ID is required.');
75+
await expect(TestBackendAPIClient.allowlistIdentifiers.deleteAllowlistIdentifier('')).rejects.toThrow(
76+
'A valid ID is required.',
77+
);
8978
});

packages/backend-core/src/__tests__/apis/ClientApi.test.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,13 @@ test('getClient() returns a single client', async () => {
8989
'Content-Type': 'application/x-www-form-urlencoded',
9090
});
9191

92-
const client = await TestBackendAPIClient.clients.getClient(
93-
expected.id as string
94-
);
92+
const client = await TestBackendAPIClient.clients.getClient(expected.id as string);
9593

9694
expect(client).toEqual(expected);
9795
});
9896

9997
test('getClient() throws an error without client ID', async () => {
100-
await expect(TestBackendAPIClient.clients.getClient('')).rejects.toThrow(
101-
'A valid ID is required.'
102-
);
98+
await expect(TestBackendAPIClient.clients.getClient('')).rejects.toThrow('A valid ID is required.');
10399
});
104100

105101
test('verifyClient() returns a client if verified', async () => {

packages/backend-core/src/__tests__/apis/EmailApi.test.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ test('createEmail() sends an email', async () => {
88
const fromEmailName = 'accounting';
99
const emailAddressId = 'idn_whatever';
1010
const subject = 'Your account is in good standing!';
11-
const body =
12-
'Click <a href="https://www.knowyourmeme.com/">here</a> to see your most recent transactions.';
11+
const body = 'Click <a href="https://www.knowyourmeme.com/">here</a> to see your most recent transactions.';
1312

1413
nock('https://api.clerk.dev')
1514
.post(
@@ -19,7 +18,7 @@ test('createEmail() sends an email', async () => {
1918
emailAddressId,
2019
subject,
2120
body,
22-
})
21+
}),
2322
)
2423
.replyWithFile(200, __dirname + '/responses/createEmail.json', {
2524
'Content-Type': 'application/x-www-form-urlencoded',

packages/backend-core/src/__tests__/apis/InvitationApi.test.ts

+4-11
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ test('getInvitationList() returns a list of invitations', async () => {
88
.get('/v1/invitations')
99
.replyWithFile(200, __dirname + '/responses/getInvitationList.json', {});
1010

11-
const invitationList =
12-
await TestBackendAPIClient.invitations.getInvitationList();
11+
const invitationList = await TestBackendAPIClient.invitations.getInvitationList();
1312
expect(invitationList).toBeInstanceOf(Array);
1413
expect(invitationList.length).toEqual(1);
1514
expect(invitationList[0]).toBeInstanceOf(Invitation);
@@ -122,13 +121,9 @@ test('revokeInvitation() revokes an invitation', async () => {
122121
updated_at: 1611948436,
123122
};
124123

125-
nock('https://api.clerk.dev')
126-
.post(`/v1/invitations/${id}/revoke`)
127-
.reply(200, resJSON);
124+
nock('https://api.clerk.dev').post(`/v1/invitations/${id}/revoke`).reply(200, resJSON);
128125

129-
const invitation = await TestBackendAPIClient.invitations.revokeInvitation(
130-
id,
131-
);
126+
const invitation = await TestBackendAPIClient.invitations.revokeInvitation(id);
132127
expect(invitation).toEqual(
133128
new Invitation({
134129
id,
@@ -140,7 +135,5 @@ test('revokeInvitation() revokes an invitation', async () => {
140135
});
141136

142137
test('revokeInvitation() throws an error without invitation ID', async () => {
143-
await expect(
144-
TestBackendAPIClient.invitations.revokeInvitation(''),
145-
).rejects.toThrow('A valid ID is required.');
138+
await expect(TestBackendAPIClient.invitations.revokeInvitation('')).rejects.toThrow('A valid ID is required.');
146139
});

packages/backend-core/src/__tests__/apis/OrganizationApi.test.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ test('createOrganization() creates an organization', async () => {
2121
})
2222
.reply(200, resJSON);
2323

24-
const organization =
25-
await TestBackendAPIClient.organizations.createOrganization({
26-
name,
27-
createdBy,
28-
});
24+
const organization = await TestBackendAPIClient.organizations.createOrganization({
25+
name,
26+
createdBy,
27+
});
2928
expect(organization).toEqual(
3029
new Organization({
3130
id: resJSON.id,

0 commit comments

Comments
 (0)