Skip to content

Commit

Permalink
squash!
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Jan 1, 2024
1 parent f5a5476 commit 87dda06
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 191 deletions.
8 changes: 4 additions & 4 deletions Source/Variable/Worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class JSONResponse extends Response {
headers: {
"content-type": "application/json;charset=UTF-8",
},
},
}
) {
super(JSON.stringify(body), init);
}
Expand Down Expand Up @@ -47,7 +47,7 @@ class JSONResponse extends Response {
default:
return new JSONResponse(
{ error: "Unknown Type" },
{ status: 400 },
{ status: 400 }
);
}
}
Expand All @@ -62,7 +62,7 @@ class JSONResponse extends Response {
export default {
async fetch(
request: Request,
{ DISCORD_PUBLIC_KEY } = Environment.parse(process.env),
{ DISCORD_PUBLIC_KEY } = Environment.parse(process.env)
) {
if (request.method === "POST") {
const isValidRequest = (
Expand All @@ -71,7 +71,7 @@ export default {
await request.clone().arrayBuffer(),
request["headers"].get("x-signature-ed25519") ?? "",
request["headers"].get("x-signature-timestamp") ?? "",
DISCORD_PUBLIC_KEY,
DISCORD_PUBLIC_KEY
);

if (!isValidRequest) {
Expand Down
44 changes: 19 additions & 25 deletions Target/Type/Environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,22 @@
export type Type = Zod.infer<typeof Environment>;
export type { Type as default };
import type Zod from "zod";
export declare const Environment: Zod.ZodObject<
{
DISCORD_APPLICATION_ID: Zod.ZodDefault<Zod.ZodOptional<Zod.ZodString>>;
DISCORD_CLIENT_ID: Zod.ZodDefault<Zod.ZodOptional<Zod.ZodString>>;
DISCORD_CLIENT_SECRET: Zod.ZodDefault<Zod.ZodOptional<Zod.ZodString>>;
DISCORD_PUBLIC_KEY: Zod.ZodDefault<Zod.ZodOptional<Zod.ZodString>>;
DISCORD_TOKENS: Zod.ZodDefault<Zod.ZodOptional<Zod.ZodString>>;
},
"strip",
Zod.ZodTypeAny,
{
DISCORD_APPLICATION_ID: string;
DISCORD_CLIENT_ID: string;
DISCORD_CLIENT_SECRET: string;
DISCORD_PUBLIC_KEY: string;
DISCORD_TOKENS: string;
},
{
DISCORD_APPLICATION_ID?: string | undefined;
DISCORD_CLIENT_ID?: string | undefined;
DISCORD_CLIENT_SECRET?: string | undefined;
DISCORD_PUBLIC_KEY?: string | undefined;
DISCORD_TOKENS?: string | undefined;
}
>;
export declare const Environment: Zod.ZodObject<{
DISCORD_APPLICATION_ID: Zod.ZodDefault<Zod.ZodOptional<Zod.ZodString>>;
DISCORD_CLIENT_ID: Zod.ZodDefault<Zod.ZodOptional<Zod.ZodString>>;
DISCORD_CLIENT_SECRET: Zod.ZodDefault<Zod.ZodOptional<Zod.ZodString>>;
DISCORD_PUBLIC_KEY: Zod.ZodDefault<Zod.ZodOptional<Zod.ZodString>>;
DISCORD_TOKENS: Zod.ZodDefault<Zod.ZodOptional<Zod.ZodString>>;
}, "strip", Zod.ZodTypeAny, {
DISCORD_APPLICATION_ID: string;
DISCORD_CLIENT_ID: string;
DISCORD_CLIENT_SECRET: string;
DISCORD_PUBLIC_KEY: string;
DISCORD_TOKENS: string;
}, {
DISCORD_APPLICATION_ID?: string | undefined;
DISCORD_CLIENT_ID?: string | undefined;
DISCORD_CLIENT_SECRET?: string | undefined;
DISCORD_PUBLIC_KEY?: string | undefined;
DISCORD_TOKENS?: string | undefined;
}>;
3 changes: 1 addition & 2 deletions Target/Type/Environment.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
const { default: t } = await import("../Variable/Environment.js");
export { t as Environment };
const{default:t}=await import("../Variable/Environment.js");export{t as Environment};
74 changes: 27 additions & 47 deletions Target/Variable/Environment.d.ts
Original file line number Diff line number Diff line change
@@ -1,48 +1,28 @@
export declare const string: (
params?:
| ({
errorMap?: import("zod").ZodErrorMap | undefined;
invalid_type_error?: string | undefined;
required_error?: string | undefined;
description?: string | undefined;
} & {
coerce?: true | undefined;
})
| undefined,
) => import("zod").ZodString;
declare const _default: import("zod").ZodObject<
{
DISCORD_APPLICATION_ID: import("zod").ZodDefault<
import("zod").ZodOptional<import("zod").ZodString>
>;
DISCORD_CLIENT_ID: import("zod").ZodDefault<
import("zod").ZodOptional<import("zod").ZodString>
>;
DISCORD_CLIENT_SECRET: import("zod").ZodDefault<
import("zod").ZodOptional<import("zod").ZodString>
>;
DISCORD_PUBLIC_KEY: import("zod").ZodDefault<
import("zod").ZodOptional<import("zod").ZodString>
>;
DISCORD_TOKENS: import("zod").ZodDefault<
import("zod").ZodOptional<import("zod").ZodString>
>;
},
"strip",
import("zod").ZodTypeAny,
{
DISCORD_APPLICATION_ID: string;
DISCORD_CLIENT_ID: string;
DISCORD_CLIENT_SECRET: string;
DISCORD_PUBLIC_KEY: string;
DISCORD_TOKENS: string;
},
{
DISCORD_APPLICATION_ID?: string | undefined;
DISCORD_CLIENT_ID?: string | undefined;
DISCORD_CLIENT_SECRET?: string | undefined;
DISCORD_PUBLIC_KEY?: string | undefined;
DISCORD_TOKENS?: string | undefined;
}
>;
export declare const string: (params?: ({
errorMap?: import("zod").ZodErrorMap | undefined;
invalid_type_error?: string | undefined;
required_error?: string | undefined;
description?: string | undefined;
} & {
coerce?: true | undefined;
}) | undefined) => import("zod").ZodString;
declare const _default: import("zod").ZodObject<{
DISCORD_APPLICATION_ID: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
DISCORD_CLIENT_ID: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
DISCORD_CLIENT_SECRET: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
DISCORD_PUBLIC_KEY: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
DISCORD_TOKENS: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
}, "strip", import("zod").ZodTypeAny, {
DISCORD_APPLICATION_ID: string;
DISCORD_CLIENT_ID: string;
DISCORD_CLIENT_SECRET: string;
DISCORD_PUBLIC_KEY: string;
DISCORD_TOKENS: string;
}, {
DISCORD_APPLICATION_ID?: string | undefined;
DISCORD_CLIENT_ID?: string | undefined;
DISCORD_CLIENT_SECRET?: string | undefined;
DISCORD_PUBLIC_KEY?: string | undefined;
DISCORD_TOKENS?: string | undefined;
}>;
export default _default;
11 changes: 1 addition & 10 deletions Target/Variable/Environment.js

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

73 changes: 26 additions & 47 deletions Target/Variable/Worker.d.ts
Original file line number Diff line number Diff line change
@@ -1,52 +1,31 @@
declare const _default: {
fetch(
request: Request,
{
DISCORD_PUBLIC_KEY,
}?: {
DISCORD_APPLICATION_ID: string;
DISCORD_CLIENT_ID: string;
DISCORD_CLIENT_SECRET: string;
DISCORD_PUBLIC_KEY: string;
DISCORD_TOKENS: string;
},
): Promise<any>;
fetch(request: Request, { DISCORD_PUBLIC_KEY }?: {
DISCORD_APPLICATION_ID: string;
DISCORD_CLIENT_ID: string;
DISCORD_CLIENT_SECRET: string;
DISCORD_PUBLIC_KEY: string;
DISCORD_TOKENS: string;
}): Promise<any>;
};
export default _default;
import type { Request } from "@cloudflare/workers-types";
export declare const Environment: import("zod").ZodObject<
{
DISCORD_APPLICATION_ID: import("zod").ZodDefault<
import("zod").ZodOptional<import("zod").ZodString>
>;
DISCORD_CLIENT_ID: import("zod").ZodDefault<
import("zod").ZodOptional<import("zod").ZodString>
>;
DISCORD_CLIENT_SECRET: import("zod").ZodDefault<
import("zod").ZodOptional<import("zod").ZodString>
>;
DISCORD_PUBLIC_KEY: import("zod").ZodDefault<
import("zod").ZodOptional<import("zod").ZodString>
>;
DISCORD_TOKENS: import("zod").ZodDefault<
import("zod").ZodOptional<import("zod").ZodString>
>;
},
"strip",
import("zod").ZodTypeAny,
{
DISCORD_APPLICATION_ID: string;
DISCORD_CLIENT_ID: string;
DISCORD_CLIENT_SECRET: string;
DISCORD_PUBLIC_KEY: string;
DISCORD_TOKENS: string;
},
{
DISCORD_APPLICATION_ID?: string | undefined;
DISCORD_CLIENT_ID?: string | undefined;
DISCORD_CLIENT_SECRET?: string | undefined;
DISCORD_PUBLIC_KEY?: string | undefined;
DISCORD_TOKENS?: string | undefined;
}
>;
export declare const Environment: import("zod").ZodObject<{
DISCORD_APPLICATION_ID: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
DISCORD_CLIENT_ID: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
DISCORD_CLIENT_SECRET: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
DISCORD_PUBLIC_KEY: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
DISCORD_TOKENS: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
}, "strip", import("zod").ZodTypeAny, {
DISCORD_APPLICATION_ID: string;
DISCORD_CLIENT_ID: string;
DISCORD_CLIENT_SECRET: string;
DISCORD_PUBLIC_KEY: string;
DISCORD_TOKENS: string;
}, {
DISCORD_APPLICATION_ID?: string | undefined;
DISCORD_CLIENT_ID?: string | undefined;
DISCORD_CLIENT_SECRET?: string | undefined;
DISCORD_PUBLIC_KEY?: string | undefined;
DISCORD_TOKENS?: string | undefined;
}>;
export declare const Response: typeof import("@cloudflare/workers-types").Response;
57 changes: 1 addition & 56 deletions Target/Variable/Worker.js

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

0 comments on commit 87dda06

Please sign in to comment.