Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit 6b2d0e3

Browse files
authored
chore: format (#128)
1 parent 12a5cf1 commit 6b2d0e3

File tree

30 files changed

+539
-521
lines changed

30 files changed

+539
-521
lines changed

modules/auth/module.json

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
11
{
2-
"name": "Authentication",
3-
"description": "Authenticate users with multiple authentication methods.",
4-
"icon": "key",
5-
"tags": [
6-
"core",
7-
"auth",
8-
"user"
9-
],
10-
"authors": [
11-
"rivet-gg",
12-
"NathanFlurry"
13-
],
14-
"status": "stable",
15-
"dependencies": {
16-
"email": {},
17-
"users": {},
18-
"rate_limit": {}
19-
},
20-
"scripts": {
21-
"send_email_verification": {
22-
"name": "Send Email Verification",
23-
"description": "Send a one-time verification code to a user's email address to authenticate them.",
24-
"public": true
25-
},
26-
"complete_email_verification": {
27-
"name": "Complete Email Verification",
28-
"description": "Verify a user's email address with a one-time verification code.",
29-
"public": true
30-
}
31-
},
32-
"errors": {
33-
"provider_disabled": {
34-
"name": "Provider Disabled"
35-
},
36-
"verification_code_invalid": {
37-
"name": "Verification Code Invalid"
38-
},
39-
"verification_code_attempt_limit": {
40-
"name": "Verification Code Attempt Limit"
41-
},
42-
"verification_code_expired": {
43-
"name": "Verification Code Expired"
44-
},
45-
"verification_code_already_used": {
46-
"name": "Verification Code Already Used"
47-
},
48-
"email_already_used": {
49-
"name": "Email Already Used"
50-
}
51-
}
2+
"name": "Authentication",
3+
"description": "Authenticate users with multiple authentication methods.",
4+
"icon": "key",
5+
"tags": [
6+
"core",
7+
"auth",
8+
"user"
9+
],
10+
"authors": [
11+
"rivet-gg",
12+
"NathanFlurry"
13+
],
14+
"status": "stable",
15+
"dependencies": {
16+
"email": {},
17+
"users": {},
18+
"rate_limit": {}
19+
},
20+
"scripts": {
21+
"send_email_verification": {
22+
"name": "Send Email Verification",
23+
"description": "Send a one-time verification code to a user's email address to authenticate them.",
24+
"public": true
25+
},
26+
"complete_email_verification": {
27+
"name": "Complete Email Verification",
28+
"description": "Verify a user's email address with a one-time verification code.",
29+
"public": true
30+
}
31+
},
32+
"errors": {
33+
"provider_disabled": {
34+
"name": "Provider Disabled"
35+
},
36+
"verification_code_invalid": {
37+
"name": "Verification Code Invalid"
38+
},
39+
"verification_code_attempt_limit": {
40+
"name": "Verification Code Attempt Limit"
41+
},
42+
"verification_code_expired": {
43+
"name": "Verification Code Expired"
44+
},
45+
"verification_code_already_used": {
46+
"name": "Verification Code Already Used"
47+
},
48+
"email_already_used": {
49+
"name": "Email Already Used"
50+
}
51+
}
5252
}

modules/auth/scripts/complete_email_verification.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { assertExists } from "https://deno.land/std@0.208.0/assert/mod.ts";
2-
import {
3-
RuntimeError,
4-
ScriptContext,
5-
} from "../module.gen.ts";
2+
import { RuntimeError, ScriptContext } from "../module.gen.ts";
63
import { TokenWithSecret } from "../../tokens/utils/types.ts";
74

85
export interface Request {

modules/auth/tests/e2e.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test("e2e", async (ctx: TestContext) => {
99
const { user } = await ctx.modules.users.create({});
1010

1111
const { token: session } = await ctx.modules.users.createToken({
12-
userId: user.id
12+
userId: user.id,
1313
});
1414

1515
const fakeEmail = faker.internet.email();
@@ -18,15 +18,16 @@ test("e2e", async (ctx: TestContext) => {
1818
{
1919
const authRes = await ctx.modules.auth.sendEmailVerification({
2020
email: fakeEmail,
21-
userToken: session.token
21+
userToken: session.token,
2222
});
2323

2424
// Look up correct code
25-
const { code } = await ctx.db.emailPasswordlessVerification.findFirstOrThrow({
26-
where: {
27-
id: authRes.verification.id,
28-
},
29-
});
25+
const { code } = await ctx.db.emailPasswordlessVerification
26+
.findFirstOrThrow({
27+
where: {
28+
id: authRes.verification.id,
29+
},
30+
});
3031

3132
// Now by verifying the email, we register, and can also use
3233
// this to verify the token
@@ -37,10 +38,9 @@ test("e2e", async (ctx: TestContext) => {
3738

3839
assertEquals(verifyRes.token.type, "user");
3940

40-
4141
// Make sure we end up with the same user we started with
4242
const verifyRes2 = await ctx.modules.users.authenticateToken({
43-
userToken: verifyRes.token.token
43+
userToken: verifyRes.token.token,
4444
});
4545

4646
assertEquals(verifyRes2.userId, user.id);
@@ -50,26 +50,26 @@ test("e2e", async (ctx: TestContext) => {
5050
// but without a token, expecting the same user
5151
{
5252
const authRes = await ctx.modules.auth.sendEmailVerification({
53-
email: fakeEmail
53+
email: fakeEmail,
5454
});
5555

5656
// Look up correct code
57-
const { code: code } = await ctx.db.emailPasswordlessVerification.findFirstOrThrow({
58-
where: {
59-
id: authRes.verification.id,
60-
},
61-
});
57+
const { code: code } = await ctx.db.emailPasswordlessVerification
58+
.findFirstOrThrow({
59+
where: {
60+
id: authRes.verification.id,
61+
},
62+
});
6263

6364
const verifyRes = await ctx.modules.auth.completeEmailVerification({
6465
verificationId: authRes.verification.id,
6566
code: code,
6667
});
6768

6869
const verifyRes2 = await ctx.modules.users.authenticateToken({
69-
userToken: verifyRes.token.token
70+
userToken: verifyRes.token.token,
7071
});
7172

72-
assertEquals(verifyRes2.userId, user.id);
73+
assertEquals(verifyRes2.userId, user.id);
7374
}
7475
});
75-

modules/currency/module.json

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
{
2-
"name": "Currency",
3-
"description": "Track user balances and allow them to deposit and withdraw.",
4-
"icon": "coin",
5-
"tags": [
6-
"economy"
7-
],
8-
"authors": [
9-
"ABCxFF"
10-
],
11-
"status": "preview",
12-
"dependencies": {
13-
"rate_limit": {},
14-
"users": {}
15-
},
16-
"scripts": {
17-
"deposit": {
18-
"name": "Deposit"
19-
},
20-
"withdraw": {
21-
"name": "Withdraw"
22-
},
23-
"get_balance": {
24-
"name": "Get Balance"
25-
},
26-
"set_balance": {
27-
"name": "Set Balance"
28-
},
29-
"get_balance_by_token": {
30-
"name": "Get Balance by Token",
31-
"public": true
32-
}
33-
},
34-
"errors": {
35-
"invalid_user": {
36-
"name": "Invalid User"
37-
},
38-
"invalid_amount": {
39-
"name": "Invalid Amount"
40-
},
41-
"not_enough_funds": {
42-
"name": "Not Enough Funds"
43-
}
44-
}
45-
}
2+
"name": "Currency",
3+
"description": "Track user balances and allow them to deposit and withdraw.",
4+
"icon": "coin",
5+
"tags": [
6+
"economy"
7+
],
8+
"authors": [
9+
"ABCxFF"
10+
],
11+
"status": "preview",
12+
"dependencies": {
13+
"rate_limit": {},
14+
"users": {}
15+
},
16+
"scripts": {
17+
"deposit": {
18+
"name": "Deposit"
19+
},
20+
"withdraw": {
21+
"name": "Withdraw"
22+
},
23+
"get_balance": {
24+
"name": "Get Balance"
25+
},
26+
"set_balance": {
27+
"name": "Set Balance"
28+
},
29+
"get_balance_by_token": {
30+
"name": "Get Balance by Token",
31+
"public": true
32+
}
33+
},
34+
"errors": {
35+
"invalid_user": {
36+
"name": "Invalid User"
37+
},
38+
"invalid_amount": {
39+
"name": "Invalid Amount"
40+
},
41+
"not_enough_funds": {
42+
"name": "Not Enough Funds"
43+
}
44+
}
45+
}

modules/email/module.json

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
{
2-
"name": "Email",
3-
"description": "Send emails using multiple providers.",
4-
"icon": "envelope",
5-
"tags": [
6-
"email"
7-
],
8-
"authors": [
9-
"rivet-gg",
10-
"NathanFlurry"
11-
],
12-
"status": "stable",
13-
"scripts": {
14-
"send_email": {
15-
"name": "Send Email"
16-
}
17-
},
18-
"errors": {
19-
"email_missing_content": {
20-
"name": "Email Missing Content",
21-
"description": "Email must have `html` and/or `text`"
22-
},
23-
"sendgrid_error": {
24-
"name": "SendGrid Error"
25-
}
26-
}
27-
}
2+
"name": "Email",
3+
"description": "Send emails using multiple providers.",
4+
"icon": "envelope",
5+
"tags": [
6+
"email"
7+
],
8+
"authors": [
9+
"rivet-gg",
10+
"NathanFlurry"
11+
],
12+
"status": "stable",
13+
"scripts": {
14+
"send_email": {
15+
"name": "Send Email"
16+
}
17+
},
18+
"errors": {
19+
"email_missing_content": {
20+
"name": "Email Missing Content",
21+
"description": "Email must have `html` and/or `text`"
22+
},
23+
"sendgrid_error": {
24+
"name": "SendGrid Error"
25+
}
26+
}
27+
}

modules/email/scripts/send_email.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ export async function run(
3737
}
3838

3939
async function useSendGrid(config: ProviderSendGrid, req: Request) {
40-
const apiKeyVariable = config.apiKeyVariable ?? "SENDGRID_API_KEY";
41-
const apiKey = Deno.env.get(apiKeyVariable);
42-
assertExists(apiKey, `Missing environment variable: ${apiKeyVariable}`);
40+
const apiKeyVariable = config.apiKeyVariable ?? "SENDGRID_API_KEY";
41+
const apiKey = Deno.env.get(apiKeyVariable);
42+
assertExists(apiKey, `Missing environment variable: ${apiKeyVariable}`);
4343

4444
const content = [];
4545
if (req.text) {

0 commit comments

Comments
 (0)