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

Commit

Permalink
chore: update imports for module.gen.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFlurry committed May 19, 2024
1 parent fb22613 commit e7c9c90
Show file tree
Hide file tree
Showing 52 changed files with 1,063 additions and 1,891 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# OpenGB
.opengb/
dist/
gen/
_gen/
*.gen.ts

# Created by https://www.toptal.com/developers/gitignore/api/deno,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=deno,macos
Expand Down
4 changes: 2 additions & 2 deletions modules/auth/scripts/auth_email_passwordless.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RuntimeError } from "../_gen/mod.ts";
import { ScriptContext } from "../_gen/scripts/auth_email_passwordless.ts";
import { RuntimeError } from "../module.gen.ts";
import { ScriptContext } from "../module.gen.ts";
import { Verification } from "../utils/types.ts";

export interface Request {
Expand Down
2 changes: 1 addition & 1 deletion modules/auth/scripts/verify_email_passwordless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { assertExists } from "https://deno.land/[email protected]/assert/mod.ts";
import {
RuntimeError,
ScriptContext,
} from "../_gen/scripts/verify_email_passwordless.ts";
} from "../module.gen.ts";
import { TokenWithSecret } from "../../tokens/utils/types.ts";

export interface Request {
Expand Down
2 changes: 1 addition & 1 deletion modules/auth/tests/e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, TestContext } from "../_gen/test.ts";
import { test, TestContext } from "../module.gen.ts";
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
import { faker } from "https://deno.land/x/[email protected]/mod.ts";

Expand Down
2 changes: 1 addition & 1 deletion modules/currency/scripts/deposit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError, ScriptContext } from "../_gen/scripts/deposit.ts";
import { RuntimeError, ScriptContext } from "../module.gen.ts";

import { getBalance } from "../utils/get_balance.ts";
import { setBalance } from "../utils/set_balance.ts";
Expand Down
2 changes: 1 addition & 1 deletion modules/currency/scripts/get_balance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/get_balance.ts";
import { ScriptContext } from "../module.gen.ts";

import { getBalance } from "../utils/get_balance.ts";

Expand Down
2 changes: 1 addition & 1 deletion modules/currency/scripts/get_balance_by_token.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/get_balance_by_token.ts";
import { ScriptContext } from "../module.gen.ts";

export interface Request {
userToken: string;
Expand Down
4 changes: 2 additions & 2 deletions modules/currency/scripts/set_balance.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RuntimeError } from "../_gen/scripts/set_balance.ts";
import { ScriptContext } from "../_gen/scripts/set_balance.ts";
import { RuntimeError } from "../module.gen.ts";
import { ScriptContext } from "../module.gen.ts";

import { setBalance } from "../utils/set_balance.ts";

Expand Down
2 changes: 1 addition & 1 deletion modules/currency/scripts/withdraw.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError, ScriptContext } from "../_gen/scripts/withdraw.ts";
import { RuntimeError, ScriptContext } from "../module.gen.ts";

import { getBalance } from "../utils/get_balance.ts";
import { setBalance } from "../utils/set_balance.ts";
Expand Down
2 changes: 1 addition & 1 deletion modules/currency/tests/e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, TestContext } from "../_gen/test.ts";
import { test, TestContext } from "../module.gen.ts";
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
import { faker } from "https://deno.land/x/[email protected]/mod.ts";

Expand Down
2 changes: 1 addition & 1 deletion modules/currency/tests/errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError, test, TestContext } from "../_gen/test.ts";
import { RuntimeError, test, TestContext } from "../module.gen.ts";
import {
assertEquals,
assertRejects,
Expand Down
2 changes: 1 addition & 1 deletion modules/currency/utils/get_balance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { prisma } from "../_gen/mod.ts";
import { prisma } from "../module.gen.ts";

type LimittedDB = Omit<
prisma.Prisma.DefaultPrismaClient,
Expand Down
2 changes: 1 addition & 1 deletion modules/currency/utils/set_balance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { prisma, RuntimeError } from "../_gen/mod.ts";
import { prisma, RuntimeError } from "../module.gen.ts";

type LimittedDB = Omit<
prisma.Prisma.DefaultPrismaClient,
Expand Down
2 changes: 1 addition & 1 deletion modules/email/scripts/send_email.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertExists } from "https://deno.land/[email protected]/assert/assert_exists.ts";
import { RuntimeError, ScriptContext } from "../_gen/scripts/send_email.ts";
import { RuntimeError, ScriptContext } from "../module.gen.ts";
import { ProviderSendGrid } from "../config.ts";
import { Email } from "../utils/types.ts";

Expand Down
2 changes: 1 addition & 1 deletion modules/friends/scripts/accept_request.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError, ScriptContext } from "../_gen/scripts/accept_request.ts";
import { RuntimeError, ScriptContext } from "../module.gen.ts";

export interface Request {
userToken: string;
Expand Down
2 changes: 1 addition & 1 deletion modules/friends/scripts/decline_request.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
RuntimeError,
ScriptContext,
} from "../_gen/scripts/decline_request.ts";
} from "../module.gen.ts";

export interface Request {
userToken: string;
Expand Down
2 changes: 1 addition & 1 deletion modules/friends/scripts/list_friends.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/list_friends.ts";
import { ScriptContext } from "../module.gen.ts";
import { Friend, friendFromRow } from "../utils/types.ts";

export interface Request {
Expand Down
2 changes: 1 addition & 1 deletion modules/friends/scripts/list_incoming_friend_requests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/list_incoming_friend_requests.ts";
import { ScriptContext } from "../module.gen.ts";
import { FriendRequest, friendRequestFromRow } from "../utils/types.ts";

export interface Request {
Expand Down
2 changes: 1 addition & 1 deletion modules/friends/scripts/list_outgoing_friend_requests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/list_outgoing_friend_requests.ts";
import { ScriptContext } from "../module.gen.ts";
import { FriendRequest, friendRequestFromRow } from "../utils/types.ts";

export interface Request {
Expand Down
2 changes: 1 addition & 1 deletion modules/friends/scripts/remove_friend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError, ScriptContext } from "../_gen/scripts/remove_friend.ts";
import { RuntimeError, ScriptContext } from "../module.gen.ts";

export interface Request {
userToken: string;
Expand Down
2 changes: 1 addition & 1 deletion modules/friends/scripts/send_request.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError, ScriptContext } from "../_gen/scripts/send_request.ts";
import { RuntimeError, ScriptContext } from "../module.gen.ts";
import { FriendRequest, friendRequestFromRow } from "../utils/types.ts";

export interface Request {
Expand Down
2 changes: 1 addition & 1 deletion modules/friends/tests/e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, TestContext } from "../_gen/test.ts";
import { test, TestContext } from "../module.gen.ts";
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
import { faker } from "https://deno.land/x/[email protected]/mod.ts";

Expand Down
2 changes: 1 addition & 1 deletion modules/friends/utils/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { prisma } from "../_gen/mod.ts";
import { prisma } from "../module.gen.ts";

export interface Friend {
userIdA: string;
Expand Down
2 changes: 1 addition & 1 deletion modules/rate_limit/scripts/throttle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError, ScriptContext } from "../_gen/scripts/throttle.ts";
import { RuntimeError, ScriptContext } from "../module.gen.ts";

export interface Request {
/**
Expand Down
2 changes: 1 addition & 1 deletion modules/rate_limit/scripts/throttle_public.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/throttle_public.ts";
import { ScriptContext } from "../module.gen.ts";

export interface Request {
/**
Expand Down
2 changes: 1 addition & 1 deletion modules/rate_limit/tests/e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError, test, TestContext } from "../_gen/test.ts";
import { RuntimeError, test, TestContext } from "../module.gen.ts";
import {
assertEquals,
assertRejects,
Expand Down
2 changes: 1 addition & 1 deletion modules/tokens/scripts/create.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/create.ts";
import { ScriptContext } from "../module.gen.ts";
import { TokenWithSecret } from "../utils/types.ts";
import { tokenFromRow } from "../utils/types.ts";

Expand Down
2 changes: 1 addition & 1 deletion modules/tokens/scripts/extend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/extend.ts";
import { ScriptContext } from "../module.gen.ts";
import { TokenWithSecret, tokenFromRow } from "../utils/types.ts";

export interface Request {
Expand Down
2 changes: 1 addition & 1 deletion modules/tokens/scripts/get.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/get.ts";
import { ScriptContext } from "../module.gen.ts";
import { Token } from "../utils/types.ts";
import { tokenFromRow } from "../utils/types.ts";

Expand Down
2 changes: 1 addition & 1 deletion modules/tokens/scripts/get_by_token.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/get_by_token.ts";
import { ScriptContext } from "../module.gen.ts";
import { Token, tokenFromRow } from "../utils/types.ts";

export interface Request {
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 "../_gen/scripts/revoke.ts";
import { Prisma, ScriptContext } from "../module.gen.ts";

export interface Request {
tokenIds: string[];
Expand Down
2 changes: 1 addition & 1 deletion modules/tokens/scripts/validate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError, ScriptContext } from "../_gen/scripts/validate.ts";
import { RuntimeError, ScriptContext } from "../module.gen.ts";
import { Token } from "../utils/types.ts";

export interface Request {
Expand Down
2 changes: 1 addition & 1 deletion modules/tokens/tests/e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, TestContext } from "../_gen/test.ts";
import { test, TestContext } from "../module.gen.ts";
import {
assertEquals,
assertExists,
Expand Down
2 changes: 1 addition & 1 deletion modules/tokens/tests/validate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError, test, TestContext } from "../_gen/test.ts";
import { RuntimeError, test, TestContext } from "../module.gen.ts";
import {
assertEquals,
assertRejects,
Expand Down
2 changes: 1 addition & 1 deletion modules/tokens/utils/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { prisma } from "../_gen/mod.ts";
import { prisma } from "../module.gen.ts";

export interface Token {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/scripts/complete.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError, ScriptContext } from "../_gen/scripts/complete.ts";
import { RuntimeError, ScriptContext } from "../module.gen.ts";
import {
completeMultipartUpload,
getMultipartUploadParts,
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/scripts/delete.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError, ScriptContext } from "../_gen/scripts/delete.ts";
import { RuntimeError, ScriptContext } from "../module.gen.ts";
import { getKey } from "../utils/types.ts";
import { deleteKeys } from "../utils/bucket.ts";
import { getConfig } from "../utils/config_defaults.ts";
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/scripts/get.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/get.ts";
import { ScriptContext } from "../module.gen.ts";
import { getConfig } from "../utils/config_defaults.ts";
import {
prismaToOutput,
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/scripts/get_public_file_urls.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/get_public_file_urls.ts";
import { ScriptContext } from "../module.gen.ts";
import { getKey, UploadFile } from "../utils/types.ts";
import { getPresignedGetUrl } from "../utils/bucket.ts";
import { getConfig } from "../utils/config_defaults.ts";
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/scripts/list_for_user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/list_for_user.ts";
import { ScriptContext } from "../module.gen.ts";
import { getConfig } from "../utils/config_defaults.ts";

export interface Request {
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/scripts/prepare.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError, ScriptContext } from "../_gen/scripts/prepare.ts";
import { RuntimeError, ScriptContext } from "../module.gen.ts";
import { PresignedUpload, prismaToOutput, UploadFile } from "../utils/types.ts";
import {
getPresignedMultipartUploadUrls,
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/tests/e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, TestContext } from "../_gen/test.ts";
import { test, TestContext } from "../module.gen.ts";
import {
assert,
assertEquals,
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/tests/multipart.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, TestContext } from "../_gen/test.ts";
import { test, TestContext } from "../module.gen.ts";
import {
assert,
assertEquals,
Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/utils/config_defaults.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError } from "../_gen/mod.ts";
import { RuntimeError } from "../module.gen.ts";
import { Config } from "../config.ts";
import { getS3EnvConfig } from "./env.ts";

Expand Down
2 changes: 1 addition & 1 deletion modules/uploads/utils/data_size.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuntimeError } from "../_gen/mod.ts";
import { RuntimeError } from "../module.gen.ts";

type Units = "b" | "kb" | "mb" | "gb" | "tb" | "kib" | "mib" | "gib" | "tib";

Expand Down
30 changes: 23 additions & 7 deletions modules/uploads/utils/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
import {
Files as PrismaFiles,
Upload as _PrismaUpload,
} from "../_gen/prisma/default.d.ts";
interface _PrismaUpload {
id: string;
userId: string | null;
bucket: string;
contentLength: bigint;
createdAt: Date;
updatedAt: Date;
completedAt: Date | null;
deletedAt: Date | null;
files: PrismaFile[];
}


interface PrismaFile {
multipartUploadId: string | null;
path: string;
mime: string | null;
contentLength: bigint;
}


interface PrismaUpload extends Omit<_PrismaUpload, "deletedAt"> {
files: PrismaFiles[];
files: PrismaFile[];
}

export interface Upload {
Expand All @@ -14,7 +30,7 @@ export interface Upload {
bucket: string;
contentLength: string;

files: UploadFile[];
files?: UploadFile[];

createdAt: string;
updatedAt: string;
Expand Down Expand Up @@ -74,7 +90,7 @@ export function prismaToOutput(
export function prismaToOutputWithFiles(upload: PrismaUpload): Upload {
return {
...prismaToOutput(upload),
files: upload.files?.map((file) => ({
files: upload.files.map((file) => ({
path: file.path,
mime: file.mime,
contentLength: file.contentLength.toString(),
Expand Down
4 changes: 2 additions & 2 deletions modules/users/scripts/authenticate_user.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RuntimeError } from "../_gen/mod.ts";
import { ScriptContext } from "../_gen/scripts/authenticate_user.ts";
import { RuntimeError } from "../module.gen.ts";
import { ScriptContext } from "../module.gen.ts";

export interface Request {
userToken: string;
Expand Down
2 changes: 1 addition & 1 deletion modules/users/scripts/create_user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/create_user.ts";
import { ScriptContext } from "../module.gen.ts";
import { User } from "../utils/types.ts";

export interface Request {
Expand Down
2 changes: 1 addition & 1 deletion modules/users/scripts/create_user_token.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TokenWithSecret } from "../../tokens/utils/types.ts";
import { ScriptContext } from "../_gen/scripts/create_user_token.ts";
import { ScriptContext } from "../module.gen.ts";

export interface Request {
userId: string;
Expand Down
2 changes: 1 addition & 1 deletion modules/users/scripts/get_user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptContext } from "../_gen/scripts/get_user.ts";
import { ScriptContext } from "../module.gen.ts";
import { User } from "../utils/types.ts";

export interface Request {
Expand Down
2 changes: 1 addition & 1 deletion modules/users/tests/e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, TestContext } from "../_gen/test.ts";
import { test, TestContext } from "../module.gen.ts";
import { faker } from "https://deno.land/x/[email protected]/mod.ts";
import { assertEquals } from "https://deno.land/[email protected]/assert/assert_equals.ts";
import { assertExists } from "https://deno.land/[email protected]/assert/assert_exists.ts";
Expand Down
Loading

0 comments on commit e7c9c90

Please sign in to comment.