Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions deno.json

This file was deleted.

46 changes: 46 additions & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"tasks": {
// Format
"format": "deno fmt modules/",
"format:check": "deno fmt --check modules/",

// Check
"check": "deno check modules/**/*.ts",

// Lint
"lint": "deno lint modules/",
"lint:fix": "deno lint --fix modules/"
},
"lint": {
"include": ["src/"],
"exclude": ["tests/"],
"rules": {
"exclude": ["no-empty-interface", "no-explicit-any", "require-await"]
}
},
"fmt": {
"useTabs": true
},
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"useUnknownInCatchVariables": true,
"alwaysStrict": true,
// "noUnusedLocals": true,
// "noUnusedParameters": true,
// "exactOptionalPropertyTypes": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
// "noPropertyAccessFromIndexSignature": true,
"allowUnusedLabels": true,
"allowUnreachableCode": true,
"noImplicitAny": true
}
}
4 changes: 1 addition & 3 deletions modules/email/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ export interface Config {

export type Provider = { test: ProviderTest } | { sendGrid: ProviderSendGrid };

export interface ProviderTest {
// No configuration
}
export type ProviderTest = Record<never, never>;

export interface ProviderSendGrid {
apiKeyVariable?: string;
Expand Down
3 changes: 1 addition & 2 deletions modules/email/scripts/send_email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export interface Request {
text?: string;
}

export interface Response {
}
export type Response = Record<never, never>;

export async function run(
ctx: ScriptContext,
Expand Down
4 changes: 2 additions & 2 deletions modules/friends/scripts/accept_request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export async function run(
}

// Sort the user IDs to ensure consistency
const [userIdA, userIdB] = [
const userIds = [
friendRequest.senderUserId,
friendRequest.targetUserId,
].sort();
Expand All @@ -70,7 +70,7 @@ export async function run(
data: {
acceptedAt: new Date(),
friend: {
create: { userIdA, userIdB },
create: { userIdA: userIds[0]!, userIdB: userIds[1]! },
},
},
});
Expand Down
8 changes: 5 additions & 3 deletions modules/friends/scripts/remove_friend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export async function run(
});

// Sort the user IDs to ensure consistency
const [userIdA, userIdB] = [userId, req.targetUserId].sort();
const userIds = [userId, req.targetUserId].sort();

const updated = await ctx.db.friend.update({
where: {
userIdA_userIdB: { userIdA, userIdB },
userIdA_userIdB: { userIdA: userIds[0]!, userIdB: userIds[1]! },
removedAt: null,
},
data: {
Expand All @@ -31,7 +31,9 @@ export async function run(
select: { userIdA: true, userIdB: true },
});
if (!updated) {
throw new RuntimeError("FRIEND_NOT_FOUND", { meta: { userIdA, userIdB } });
throw new RuntimeError("FRIEND_NOT_FOUND", {
meta: { userIdA: userIds[0], userIdB: userIds[1] },
});
}

return {};
Expand Down
2 changes: 1 addition & 1 deletion modules/tokens/scripts/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function generateToken(type: string): string {
// Map to characters
let output = "";
for (let i = 0; i < buf.length; i++) {
output += CHARACTERS[buf[i] % CHARACTERS.length];
output += CHARACTERS[buf[i]! % CHARACTERS.length];
}

return `${type}_${output}`;
Expand Down
2 changes: 1 addition & 1 deletion modules/tokens/scripts/revoke.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Prisma, ScriptContext } from "../module.gen.ts";
import { ScriptContext } from "../module.gen.ts";

export interface Request {
tokenIds: string[];
Expand Down
2 changes: 1 addition & 1 deletion modules/tokens/tests/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test("e2e", async (ctx: TestContext) => {
const getAfterRevoke = await ctx.modules.tokens.fetch({
tokenIds: [token.id],
});
assertExists(getAfterRevoke.tokens[0].revokedAt);
assertExists(getAfterRevoke.tokens[0]!.revokedAt);

const revokeTwiceRes = await ctx.modules.tokens.revoke({
tokenIds: [token.id],
Expand Down
5 changes: 3 additions & 2 deletions modules/uploads/tests/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test("e2e", async (ctx: TestContext) => {

// Upload the data using the presigned URL(s) returned
const uploadPutReq = await fetch(
presigned.files[0].presignedChunks[0].url,
presigned.files[0]!.presignedChunks[0]!.url,
{
method: "PUT",
body: fileData,
Expand Down Expand Up @@ -77,10 +77,11 @@ test("e2e", async (ctx: TestContext) => {
assertEquals(completed, retrieved);

// Get presigned URLs to download the files from
const { files: [{ url: fileDownloadUrl }] } = await ctx.modules.uploads
const { files } = await ctx.modules.uploads
.getPublicFileUrls({
files: [{ uploadId: completed.id, path: path }],
});
const fileDownloadUrl = files[0]!.url;

// Download the files, and make sure the data matches
const fileDownloadReq = await fetch(fileDownloadUrl);
Expand Down
6 changes: 3 additions & 3 deletions modules/uploads/tests/multipart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ test("multipart uploads", async (ctx: TestContext) => {
},
],
});

const { files: [{ presignedChunks }] } = presigned;
const presignedChunks = presigned.files[0]!.presignedChunks;

for (const chunk of presignedChunks) {
// Upload the data using the presigned URL(s) returned
Expand Down Expand Up @@ -94,10 +93,11 @@ test("multipart uploads", async (ctx: TestContext) => {
assertEquals(completed, retrieved);

// Get presigned URLs to download the files from
const { files: [{ url: fileDownloadUrl }] } = await ctx.modules.uploads
const { files } = await ctx.modules.uploads
.getPublicFileUrls({
files: [{ uploadId: completed.id, path: path }],
});
const fileDownloadUrl = files[0]!.url;

// Download the files, and make sure the data matches
const fileDownloadReq = await fetch(fileDownloadUrl);
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/utils/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export async function keyExists(
await client.send(command);
return true;
} catch (error) {
if (error.name === "NotFound") {
if (error instanceof Error && error.name === "NotFound") {
return false;
}
throw error;
Expand Down
20 changes: 0 additions & 20 deletions tests/basic/deno.json

This file was deleted.

14 changes: 13 additions & 1 deletion tests/basic/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.