Compare commits
29
Commits
main
...
ab0cb58196
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab0cb58196 | ||
|
|
09ac3bfd93 | ||
|
|
3ef0c9e88f | ||
|
|
0576421368 | ||
|
|
0501e63dc7 | ||
|
|
9bf60b7c8b | ||
|
|
7afde2c323 | ||
|
|
e497982222 | ||
|
|
09e7a9c0fd | ||
|
|
144777e125 | ||
|
|
ffde056ab0 | ||
|
|
a7fa12fefb | ||
|
|
7f791babd4 | ||
|
|
db206bafa3 | ||
|
|
91f682ec71 | ||
|
|
930bd61e62 | ||
|
|
b66980c0fb | ||
|
|
5101bd3259 | ||
|
|
0e3107623e | ||
|
|
0d9b8fb4fa | ||
|
|
d2c31ba9fa | ||
|
|
bbbf2d0538 | ||
|
|
4ba65d935b | ||
|
|
3c0233f087 | ||
|
|
ae2ba4d317 | ||
|
|
dc7ebd6873 | ||
|
|
f593aabd25 | ||
|
|
ea256f33ea | ||
|
|
912b36cbc7 |
@@ -19,3 +19,4 @@ advisor and code reviewer, not an implementer:
|
|||||||
- Only give a code review when explicitly asked (e.g. "review this",
|
- Only give a code review when explicitly asked (e.g. "review this",
|
||||||
`/code-review`, `/security-review`) — don't volunteer review commentary
|
`/code-review`, `/security-review`) — don't volunteer review commentary
|
||||||
on code you see in passing.
|
on code you see in passing.
|
||||||
|
- Reduce comment usage as much as possible unless the code is particularly confusing and needs an explanation
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Local test media for seed scripts
|
||||||
|
src/scripts/test-verification-media
|
||||||
@@ -31,11 +31,10 @@
|
|||||||
"elysia": "^1.4.30",
|
"elysia": "^1.4.30",
|
||||||
"kysely": "^0.29.6",
|
"kysely": "^0.29.6",
|
||||||
"ml-levenberg-marquardt": "^5.1.0",
|
"ml-levenberg-marquardt": "^5.1.0",
|
||||||
"pg": "^8.23.0",
|
"pg": "^8.23.1",
|
||||||
"zipcodes-us": "^1.1.3"
|
"zipcodes-us": "^1.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"kysely-codegen": "^0.20.0",
|
"kysely-codegen": "^0.20.0"
|
||||||
"pino-pretty": "^13.1.3"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,144 @@
|
|||||||
|
import Elysia, { NotFoundError, t } from "elysia";
|
||||||
|
import { ActivityPerformanceSchema, PlayerSchema } from "@blade-and-brawn/domain";
|
||||||
|
import { authPlugin } from "../plugins/auth";
|
||||||
|
import { s } from "../services";
|
||||||
|
import { VerificationsService, VerificationStatusSchema } from "../services/verifications";
|
||||||
|
import { ConflictError } from "../util/error";
|
||||||
|
import { AccountIdSchema, BigIntIdSchema } from "../util/models";
|
||||||
|
import { r2 } from "../util/r2";
|
||||||
|
|
||||||
|
const AccountsController = new Elysia({ prefix: "/accounts" })
|
||||||
|
.use(authPlugin)
|
||||||
|
.group("/:id", (app) => app
|
||||||
|
.get("/", async ({ params: { id } }) => {
|
||||||
|
const account = await s.Accounts.get(id);
|
||||||
|
if (!account) throw new NotFoundError("Account not found");
|
||||||
|
return account;
|
||||||
|
}, {
|
||||||
|
authAdmin: true,
|
||||||
|
params: t.Object({ id: AccountIdSchema })
|
||||||
|
})
|
||||||
|
// TODO: for added security, could enforce bot or admin only access
|
||||||
|
.get("/stats", async ({ params: { id } }) => {
|
||||||
|
const stats = await s.Accounts.stats(id);
|
||||||
|
if (!stats) throw new NotFoundError("Account stats not found");
|
||||||
|
return stats;
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: AccountIdSchema })
|
||||||
|
})
|
||||||
|
// TODO: for added security, MUST enforce bot or admin only access
|
||||||
|
.get("/verifications", async ({ query, params: { id } }) => {
|
||||||
|
return await s.Verifications.list({
|
||||||
|
filter: { status: query.status, accountId: id },
|
||||||
|
limit: query.limit,
|
||||||
|
offset: query.offset,
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: AccountIdSchema }),
|
||||||
|
query: t.Object({
|
||||||
|
status: t.Optional(VerificationStatusSchema),
|
||||||
|
limit: t.Optional(t.Numeric()),
|
||||||
|
offset: t.Optional(t.Numeric()),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.group("/me", { auth: true }, (app) => app
|
||||||
|
.get("/stats", async ({ accountId }) => {
|
||||||
|
const stats = await s.Accounts.stats(accountId);
|
||||||
|
if (!stats) throw new NotFoundError("Account stats not found");
|
||||||
|
return stats;
|
||||||
|
})
|
||||||
|
.group("/assessments", (app) => app
|
||||||
|
.post("/", async ({ body: { player, activityPerformances }, accountId }) => {
|
||||||
|
return await s.Assessments.create(player, activityPerformances, accountId);
|
||||||
|
}, {
|
||||||
|
body: t.Object({
|
||||||
|
player: PlayerSchema,
|
||||||
|
activityPerformances: t.Array(ActivityPerformanceSchema)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// TODO: handle @ formatted accountIds
|
||||||
|
.get("/", async ({ accountId }) => {
|
||||||
|
return await s.Assessments.list({ filter: { accountId } });
|
||||||
|
})
|
||||||
|
.delete("/:id", async ({ params: { id }, accountId }) => {
|
||||||
|
const deleted = await s.Assessments.delete(id, accountId);
|
||||||
|
if (!deleted) throw new NotFoundError("Assessment not found");
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: BigIntIdSchema })
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.group("/verifications", (app) => app
|
||||||
|
.get("/", async ({ query, accountId }) => {
|
||||||
|
return await s.Verifications.list({
|
||||||
|
filter: { status: query.status, accountId },
|
||||||
|
limit: query.limit,
|
||||||
|
offset: query.offset,
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
query: t.Object({
|
||||||
|
status: t.Optional(VerificationStatusSchema),
|
||||||
|
limit: t.Optional(t.Numeric()),
|
||||||
|
offset: t.Optional(t.Numeric()),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post("/", async ({ body: { assessmentId }, accountId }) => {
|
||||||
|
const assessment = await s.Assessments.get(assessmentId, accountId);
|
||||||
|
if (!assessment) throw new NotFoundError("Assessment not found");
|
||||||
|
|
||||||
|
// TODO: only allow a single active non-completed verification at a time
|
||||||
|
|
||||||
|
const created = await s.Verifications.create(assessmentId);
|
||||||
|
if (!created) throw new ConflictError("This assessment already has a verification");
|
||||||
|
|
||||||
|
return {
|
||||||
|
...created,
|
||||||
|
uploadUrls: VerificationsService.presignMediaUploads(r2.verificationMedia, assessmentId)
|
||||||
|
};
|
||||||
|
}, {
|
||||||
|
body: t.Object({
|
||||||
|
assessmentId: BigIntIdSchema
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.group("/:id", (app) => app
|
||||||
|
.post("/reopen", async ({ params: { id }, accountId }) => {
|
||||||
|
const verification = await s.Verifications.get(id, accountId);
|
||||||
|
if (!verification) throw new NotFoundError("Verification not found");
|
||||||
|
|
||||||
|
const reopened = await s.Verifications.reopen(id);
|
||||||
|
if (!reopened) throw new ConflictError(`Cannot reopen a ${verification.status} verification`);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...reopened,
|
||||||
|
uploadUrls: VerificationsService.presignMediaUploads(r2.verificationMedia, verification.assessment_id)
|
||||||
|
};
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: BigIntIdSchema })
|
||||||
|
})
|
||||||
|
.post("/submit", async ({ params: { id }, accountId }) => {
|
||||||
|
const verification = await s.Verifications.get(id, accountId);
|
||||||
|
if (!verification) throw new NotFoundError("Verification not found");
|
||||||
|
|
||||||
|
if (verification.status === "draft") {
|
||||||
|
const { contents } = await r2.verificationMedia.list({ prefix: `${verification.assessment_id}/`, maxKeys: 1 });
|
||||||
|
if (!contents?.length) throw new ConflictError("No media uploaded");
|
||||||
|
}
|
||||||
|
|
||||||
|
const submitted = await s.Verifications.submit(id);
|
||||||
|
if (submitted) {
|
||||||
|
// TODO: trigger discord webhook here
|
||||||
|
return submitted;
|
||||||
|
}
|
||||||
|
|
||||||
|
const current = await s.Verifications.get(id, accountId);
|
||||||
|
if (!current) throw new NotFoundError("Verification not found");
|
||||||
|
if (current.status === "submitted") return { id: current.id, status: current.status };
|
||||||
|
throw new ConflictError(`Cannot submit a ${current.status} verification`);
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: BigIntIdSchema })
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
export default AccountsController;
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import Elysia, { NotFoundError, t } from "elysia";
|
||||||
|
import { ActivityPerformanceSchema, PlayerSchema } from "@blade-and-brawn/domain";
|
||||||
|
import { authPlugin } from "../plugins/auth";
|
||||||
|
import { s } from "../services";
|
||||||
|
import { AccountIdSchema, BigIntIdSchema } from "../util/models";
|
||||||
|
|
||||||
|
const AssessmentsController = new Elysia({ prefix: "/assessments" })
|
||||||
|
.use(authPlugin)
|
||||||
|
.guard({ authAdmin: true })
|
||||||
|
.post("/", async ({ body: { player, activityPerformances, accountId } }) => {
|
||||||
|
const account = await s.Accounts.get(accountId);
|
||||||
|
if (!account) throw new NotFoundError("Account not found");
|
||||||
|
return await s.Assessments.create(player, activityPerformances, account.id);
|
||||||
|
}, {
|
||||||
|
body: t.Object({
|
||||||
|
player: PlayerSchema,
|
||||||
|
activityPerformances: t.Array(ActivityPerformanceSchema),
|
||||||
|
accountId: AccountIdSchema,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.put("/:id", async ({ body: { player, activityPerformances }, params: { id } }) => {
|
||||||
|
const updated = await s.Assessments.update(id, player, activityPerformances);
|
||||||
|
if (!updated) throw new NotFoundError("Assessment not found");
|
||||||
|
return updated;
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: BigIntIdSchema }),
|
||||||
|
body: t.Object({
|
||||||
|
player: PlayerSchema,
|
||||||
|
activityPerformances: t.Array(ActivityPerformanceSchema),
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
export default AssessmentsController;
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
import Elysia, { redirect, t } from "elysia";
|
||||||
|
import { Value } from "@sinclair/typebox/value";
|
||||||
|
import { randomUUIDv7 } from "bun";
|
||||||
|
import { authPlugin } from "../plugins/auth";
|
||||||
|
import { s } from "../services";
|
||||||
|
import type { AccountRole } from "../services/accounts";
|
||||||
|
import { DUMMY_PASSWORD_HASH } from "../util/crypto";
|
||||||
|
import { env } from "../util/env";
|
||||||
|
import { BadGatewayError, BadRequestError, UnauthorizedError } from "../util/error";
|
||||||
|
|
||||||
|
const JWT_EXP = "1d";
|
||||||
|
const JWT_EXP_SECONDS = 60 * 60 * 24; // keep in sync with JWT_EXP; used for cookie maxAge
|
||||||
|
|
||||||
|
const AuthController = new Elysia({ prefix: "/auth" })
|
||||||
|
.use(authPlugin)
|
||||||
|
.guard({
|
||||||
|
cookie: t.Cookie({
|
||||||
|
auth: t.Optional(t.String()),
|
||||||
|
authDiscord: t.Optional(t.String())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.post("/login", async ({ jwt, body: { password, email }, cookie: { auth } }) => {
|
||||||
|
const account = await s.Accounts.getByEmail(email);
|
||||||
|
const password_match = await Bun.password.verify(password, account?.password_hash ?? DUMMY_PASSWORD_HASH);
|
||||||
|
if (!account?.password_hash || !password_match) throw new UnauthorizedError("Invalid credentials");
|
||||||
|
|
||||||
|
auth.set({
|
||||||
|
value: await jwt.sign({ role: account.role, sessionId: randomUUIDv7(), accountId: account.id, exp: JWT_EXP }),
|
||||||
|
path: "/",
|
||||||
|
maxAge: JWT_EXP_SECONDS,
|
||||||
|
sameSite: env.NODE_ENV === "production" ? "lax" : "none",
|
||||||
|
httpOnly: true,
|
||||||
|
secure: true,
|
||||||
|
domain: env.NODE_ENV === "production" ?
|
||||||
|
".bladeandbrawn.com" :
|
||||||
|
undefined
|
||||||
|
});
|
||||||
|
}, { body: t.Object({ email: t.String(), password: t.String() }) })
|
||||||
|
|
||||||
|
.group("/discord", (app) => app
|
||||||
|
.get("/login", async ({ cookie: { authDiscord } }) => {
|
||||||
|
const state = crypto.randomUUID();
|
||||||
|
|
||||||
|
authDiscord.set({
|
||||||
|
value: state,
|
||||||
|
path: "/",
|
||||||
|
maxAge: 60 * 10, // 10 min
|
||||||
|
sameSite: "lax",
|
||||||
|
httpOnly: true,
|
||||||
|
secure: env.NODE_ENV === "production"
|
||||||
|
});
|
||||||
|
|
||||||
|
const url = new URL("https://discord.com/api/oauth2/authorize");
|
||||||
|
url.searchParams.set("client_id", env.BOT_CLIENT_ID);
|
||||||
|
url.searchParams.set("redirect_uri", env.BOT_REDIRECT_URL);
|
||||||
|
url.searchParams.set("response_type", "code");
|
||||||
|
url.searchParams.set("scope", "identify email");
|
||||||
|
url.searchParams.set("state", state);
|
||||||
|
|
||||||
|
return redirect(url.toString(), 302);
|
||||||
|
})
|
||||||
|
.get("/callback", async ({ query, cookie: { authDiscord, auth }, jwt }) => {
|
||||||
|
if (query.error) throw new BadRequestError(query.error_description ? `${query.error}: ${query.error_description}` : query.error);
|
||||||
|
|
||||||
|
// Validate input
|
||||||
|
if (!query.state) throw new BadRequestError("No Discord OAuth2 state query parameter provided");
|
||||||
|
if (query.state !== authDiscord.value) throw new BadRequestError("Invalid Discord OAuth state");
|
||||||
|
|
||||||
|
// Retrieve access token from discord
|
||||||
|
const tokenRes = await fetch("https://discord.com/api/oauth2/token", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
},
|
||||||
|
body: new URLSearchParams({
|
||||||
|
client_id: env.BOT_CLIENT_ID,
|
||||||
|
client_secret: env.BOT_CLIENT_SECRET,
|
||||||
|
grant_type: "authorization_code",
|
||||||
|
code: query.code ?? "",
|
||||||
|
redirect_uri: env.BOT_REDIRECT_URL
|
||||||
|
}).toString()
|
||||||
|
});
|
||||||
|
if (!tokenRes.ok) {
|
||||||
|
const errorBody = await tokenRes.json().catch(() => null);
|
||||||
|
throw new BadGatewayError(errorBody ? JSON.stringify(errorBody) : "Discord token exchange failed");
|
||||||
|
}
|
||||||
|
const tokenResPayload = await tokenRes.json();
|
||||||
|
Value.Assert(t.Object({ access_token: t.String() }), tokenResPayload);
|
||||||
|
|
||||||
|
// Retrieve user's discord identity
|
||||||
|
const identityRes = await fetch("https://discord.com/api/users/@me", {
|
||||||
|
headers: { "Authorization": `Bearer ${tokenResPayload.access_token}` }
|
||||||
|
});
|
||||||
|
if (!identityRes.ok) {
|
||||||
|
const errorBody = await identityRes.json().catch(() => null);
|
||||||
|
throw new BadGatewayError(errorBody ? JSON.stringify(errorBody) : "Failed to fetch Discord identity");
|
||||||
|
}
|
||||||
|
const discordIdentity = await identityRes.json();
|
||||||
|
Value.Assert(t.Object({ id: t.String(), email: t.Optional(t.Nullable(t.String())), username: t.String(), verified: t.Boolean() }), discordIdentity);
|
||||||
|
|
||||||
|
// Get account or create if it dosent exist
|
||||||
|
let account = await s.Accounts.get(`@${discordIdentity.id}`);
|
||||||
|
if (!account) {
|
||||||
|
// only accept VERIFIED emails not already used by another account
|
||||||
|
const email = discordIdentity.verified && discordIdentity.email ? discordIdentity.email : undefined;
|
||||||
|
const emailTaken = email !== undefined && !!(await s.Accounts.getByEmail(email));
|
||||||
|
account = await s.Accounts.create(
|
||||||
|
discordIdentity.id,
|
||||||
|
emailTaken ? undefined : email,
|
||||||
|
discordIdentity.username
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup and sign auth cookie
|
||||||
|
auth.set({
|
||||||
|
value: await jwt.sign({ role: account.role, sessionId: randomUUIDv7(), accountId: account.id, exp: JWT_EXP }),
|
||||||
|
path: "/",
|
||||||
|
maxAge: JWT_EXP_SECONDS,
|
||||||
|
sameSite: env.NODE_ENV === "production" ? "lax" : "none",
|
||||||
|
httpOnly: true,
|
||||||
|
secure: true,
|
||||||
|
domain: env.NODE_ENV === "production" ?
|
||||||
|
".bladeandbrawn.com" :
|
||||||
|
undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
return redirect(env.BOT_LOGIN_REDIRECT_URL, 302);
|
||||||
|
}, {
|
||||||
|
query: t.Object({
|
||||||
|
code: t.Optional(t.String()),
|
||||||
|
state: t.Optional(t.String()),
|
||||||
|
error: t.Optional(t.String()),
|
||||||
|
error_description: t.Optional(t.String()),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
export default AuthController;
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import Elysia, { t } from "elysia";
|
||||||
|
import { ActivityPerformanceSchema, PlayerSchema } from "@blade-and-brawn/domain";
|
||||||
|
import { BigIntIdSchema } from "../util/models";
|
||||||
|
import { authPlugin } from "../plugins/auth";
|
||||||
|
import { s } from "../services";
|
||||||
|
|
||||||
|
const CalculatorController = new Elysia({ prefix: "/calculator" })
|
||||||
|
.use(authPlugin)
|
||||||
|
// Non-authenticated
|
||||||
|
.post("/calculate", async ({ body }) => {
|
||||||
|
return { levels: await s.Calculator.calculate(body.player, body.activityPerformances) };
|
||||||
|
}, {
|
||||||
|
body: t.Object({
|
||||||
|
player: PlayerSchema,
|
||||||
|
activityPerformances: t.Array(ActivityPerformanceSchema)
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
.group("/standards/config", { authAdmin: true }, (app) => app
|
||||||
|
.get("/", async () => {
|
||||||
|
return await s.Calculator.Standards.Config.get();
|
||||||
|
})
|
||||||
|
.post("/switch", async ({ body: { standardsConfigId } }) => {
|
||||||
|
await s.Calculator.Standards.Config.switch(standardsConfigId);
|
||||||
|
}, {
|
||||||
|
body: t.Object({ standardsConfigId: BigIntIdSchema })
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
export default CalculatorController;
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
import Elysia, { NotFoundError, t } from "elysia";
|
||||||
|
import { authPlugin } from "../plugins/auth";
|
||||||
|
import { s } from "../services";
|
||||||
|
import { WOrderStatusSchema } from "../services/commerce";
|
||||||
|
import { ConflictError } from "../util/error";
|
||||||
|
|
||||||
|
const CommerceController = new Elysia({ prefix: "/commerce" })
|
||||||
|
.use(authPlugin)
|
||||||
|
.group("/products", { authAdmin: true }, (app) => app
|
||||||
|
.get("/", async ({ query }) => {
|
||||||
|
const [pProducts, wProducts] = await Promise.all([
|
||||||
|
s.Commerce.Printful.Products.list({
|
||||||
|
limit: query.limit,
|
||||||
|
offset: query.offset,
|
||||||
|
}),
|
||||||
|
s.Commerce.Webflow.Products.list({ forceAll: true }),
|
||||||
|
]);
|
||||||
|
const wProductIds = new Set(wProducts.map((wProduct) => wProduct.product.id));
|
||||||
|
return pProducts.map((pProduct) => {
|
||||||
|
const wProductId = pProduct.external_id.split("-")[0];
|
||||||
|
return { pProduct, isSynced: wProductId ? wProductIds.has(wProductId) : false };
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
query: t.Object({
|
||||||
|
limit: t.Optional(t.Numeric({ maximum: 100 })),
|
||||||
|
offset: t.Optional(t.Numeric()),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.group("/sync", (app) => app
|
||||||
|
// Sync status
|
||||||
|
.get("/", async ({ sessionId }) => {
|
||||||
|
const latestSyncState = await s.Commerce.Apparel.Syncs.getLatestSyncState(sessionId);
|
||||||
|
if (!latestSyncState) throw new NotFoundError("No product sync found for the provided session");
|
||||||
|
return latestSyncState;
|
||||||
|
})
|
||||||
|
// Run sync
|
||||||
|
.post("/:pProductId?", async ({ params: { pProductId }, sessionId }) => {
|
||||||
|
await s.Commerce.Apparel.Syncs.Queue.enqueue({
|
||||||
|
type: "apparel_sync_update",
|
||||||
|
source: "portal",
|
||||||
|
payload: {
|
||||||
|
session: { id: sessionId, name: "Portal" },
|
||||||
|
filter: {
|
||||||
|
pProductIds: pProductId ? [pProductId] : undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, { params: t.Object({ pProductId: t.Optional(t.Numeric()) }) }),
|
||||||
|
)
|
||||||
|
.get("/:pProductId", async ({ params: { pProductId } }) => {
|
||||||
|
const pProduct = await s.Commerce.Printful.Products.get(pProductId);
|
||||||
|
if (!pProduct) throw new NotFoundError("Missing printful product");
|
||||||
|
|
||||||
|
const wProductId = pProduct.sync_product.external_id.split("-")[0];
|
||||||
|
if (!wProductId) throw new NotFoundError("Missing webflow product ID");
|
||||||
|
|
||||||
|
const wProduct = await s.Commerce.Webflow.Products.get(wProductId);
|
||||||
|
|
||||||
|
return { pProduct, wProduct };
|
||||||
|
}, {
|
||||||
|
params: t.Object({ pProductId: t.Numeric() })
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.group("/orders", { authAdmin: true }, (app) => app
|
||||||
|
.get("/", async ({ query }) => {
|
||||||
|
const [wOrders, pOrders] = await Promise.all([
|
||||||
|
s.Commerce.Webflow.Orders.list({
|
||||||
|
status: query.status,
|
||||||
|
limit: query.limit,
|
||||||
|
offset: query.offset,
|
||||||
|
}),
|
||||||
|
s.Commerce.Printful.Orders.list({ forceAll: true }),
|
||||||
|
]);
|
||||||
|
const pOrderExternalIds = new Set(pOrders.map((pOrder) => pOrder.external_id));
|
||||||
|
return wOrders.map((wOrder) => ({
|
||||||
|
wOrder,
|
||||||
|
isSynced: pOrderExternalIds.has(wOrder.orderId),
|
||||||
|
}));
|
||||||
|
}, {
|
||||||
|
query: t.Object({
|
||||||
|
status: t.Optional(WOrderStatusSchema),
|
||||||
|
limit: t.Optional(t.Numeric({ maximum: 100 })),
|
||||||
|
offset: t.Optional(t.Numeric()),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.get("/:wOrderId", async ({ params: { wOrderId } }) => {
|
||||||
|
const wOrder = await s.Commerce.Webflow.Orders.get(wOrderId);
|
||||||
|
if (!wOrder) throw new NotFoundError("Missing webflow order");
|
||||||
|
|
||||||
|
const pOrder = await s.Commerce.Printful.Orders.get(`@${wOrder.orderId}`);
|
||||||
|
|
||||||
|
return { wOrder, pOrder };
|
||||||
|
}, { params: t.Object({ wOrderId: t.String() }) })
|
||||||
|
.post("/sync/:wOrderId", async ({ params: { wOrderId } }) => {
|
||||||
|
const wOrder = await s.Commerce.Webflow.Orders.get(wOrderId);
|
||||||
|
if (!wOrder) throw new NotFoundError("Missing webflow order");
|
||||||
|
|
||||||
|
const pOrder = await s.Commerce.Printful.Orders.get(`@${wOrder.orderId}`);
|
||||||
|
if (pOrder) throw new ConflictError("Cannot sync an already synced webflow order");
|
||||||
|
|
||||||
|
await s.Commerce.Apparel.Orders.Queue.enqueue({
|
||||||
|
type: "apparel_order_create",
|
||||||
|
source: "portal",
|
||||||
|
payload: { wOrder }
|
||||||
|
});
|
||||||
|
|
||||||
|
}, { params: t.Object({ wOrderId: t.String() }) })
|
||||||
|
);
|
||||||
|
|
||||||
|
export default CommerceController;
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import Elysia, { NotFoundError, t } from "elysia";
|
||||||
|
import { authPlugin } from "../plugins/auth";
|
||||||
|
import { queues, s } from "../services";
|
||||||
|
import { EventsService, EventStatusSchema } from "../services/events";
|
||||||
|
import { BigIntIdSchema } from "../util/models";
|
||||||
|
|
||||||
|
const EventsController = new Elysia({ prefix: "/events" })
|
||||||
|
.use(authPlugin)
|
||||||
|
.guard({ authAdmin: true })
|
||||||
|
.get("/", async ({ query }) => {
|
||||||
|
const events = await s.Events.list({
|
||||||
|
filter: { status: query.status, type: query.type, group: query.group },
|
||||||
|
limit: query.limit,
|
||||||
|
offset: query.offset,
|
||||||
|
});
|
||||||
|
return events.map((event) => ({ ...event, status: EventsService.status(event) }));
|
||||||
|
}, {
|
||||||
|
query: t.Object({
|
||||||
|
status: t.Optional(EventStatusSchema),
|
||||||
|
type: t.Optional(t.String()),
|
||||||
|
group: t.Optional(t.String()),
|
||||||
|
limit: t.Optional(t.Numeric()),
|
||||||
|
offset: t.Optional(t.Numeric()),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.get("/groups", async ({ }) => queues.map((q) => q.group))
|
||||||
|
.group("/:id", (app) => app
|
||||||
|
.get("/", async ({ params: { id } }) => {
|
||||||
|
const event = await s.Events.get(id);
|
||||||
|
if (!event) throw new NotFoundError("Event not found");
|
||||||
|
return { ...event, status: EventsService.status(event) };
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: BigIntIdSchema })
|
||||||
|
})
|
||||||
|
.post("/retry", async ({ params: { id } }) => {
|
||||||
|
const retried = await s.Events.retry(id);
|
||||||
|
if (!retried) throw new NotFoundError("Event not found or not in a failed state");
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: BigIntIdSchema })
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
export default EventsController;
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import Elysia, { NotFoundError, t } from "elysia";
|
||||||
|
import { StandardsParamsSchema } from "@blade-and-brawn/calculator";
|
||||||
|
import { authPlugin } from "../plugins/auth";
|
||||||
|
import { s } from "../services";
|
||||||
|
import { BigIntIdSchema } from "../util/models";
|
||||||
|
import { ConflictError } from "../util/error";
|
||||||
|
|
||||||
|
const StandardsController = new Elysia({ prefix: "/standards" })
|
||||||
|
.use(authPlugin)
|
||||||
|
.group("/configs", { authAdmin: true }, (app) => app
|
||||||
|
.post("/", async ({ body: { name, datasetId, params } }) => {
|
||||||
|
return await s.Standards.Configs.create(name, datasetId, params);
|
||||||
|
}, {
|
||||||
|
body: t.Object({ name: t.String(), datasetId: BigIntIdSchema, params: StandardsParamsSchema })
|
||||||
|
})
|
||||||
|
.get("/", async () => {
|
||||||
|
return await s.Standards.Configs.list();
|
||||||
|
})
|
||||||
|
.group("/:id", (app) => app
|
||||||
|
.get("/", async ({ params: { id } }) => {
|
||||||
|
const config = await s.Standards.Configs.get(id);
|
||||||
|
if (!config) throw new NotFoundError("Standards config not found");
|
||||||
|
return config;
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: BigIntIdSchema })
|
||||||
|
})
|
||||||
|
.put("/", async ({ params: { id }, body: { name, datasetId, params: parameters } }) => {
|
||||||
|
const activeConfig = await s.Calculator.Standards.Config.get();
|
||||||
|
if (activeConfig.id === id) throw new ConflictError("Cannot edit the active standards config");
|
||||||
|
const updated = await s.Standards.Configs.update(id, name, datasetId, parameters);
|
||||||
|
if (!updated) throw new NotFoundError("Standards config not found");
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: BigIntIdSchema }),
|
||||||
|
body: t.Object({ name: t.String(), datasetId: BigIntIdSchema, params: StandardsParamsSchema })
|
||||||
|
})
|
||||||
|
.delete("/", async ({ params: { id } }) => {
|
||||||
|
if (await s.Standards.Configs.count() <= 1) throw new ConflictError("Cannot delete the last remaining standards config");
|
||||||
|
const deleted = await s.Standards.Configs.delete(id);
|
||||||
|
if (!deleted) throw new NotFoundError("Standards config not found");
|
||||||
|
}, { params: t.Object({ id: BigIntIdSchema }) })
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.group("/datasets", { authAdmin: true }, (app) => app
|
||||||
|
.get("/", async () => {
|
||||||
|
return await s.Standards.Datasets.list();
|
||||||
|
})
|
||||||
|
.group("/:id", (app) => app
|
||||||
|
.get("/", async ({ params: { id } }) => {
|
||||||
|
const dataset = await s.Standards.Datasets.get(id);
|
||||||
|
if (!dataset) throw new NotFoundError("Standards dataset not found");
|
||||||
|
return dataset;
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: BigIntIdSchema })
|
||||||
|
})
|
||||||
|
.patch("/", async ({ params: { id }, body: { name } }) => {
|
||||||
|
const updated = await s.Standards.Datasets.update(id, name);
|
||||||
|
if (!updated) throw new NotFoundError("Standards dataset not found");
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: BigIntIdSchema }),
|
||||||
|
body: t.Object({ name: t.String() })
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
export default StandardsController;
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
import Elysia, { NotFoundError, t } from "elysia";
|
||||||
|
import { ActivityVerificationsSchema } from "@blade-and-brawn/domain";
|
||||||
|
import { authPlugin } from "../plugins/auth";
|
||||||
|
import { s } from "../services";
|
||||||
|
import { VerificationStatusSchema } from "../services/verifications";
|
||||||
|
import { ConflictError, ForbiddenError } from "../util/error";
|
||||||
|
import { AccountIdSchema, BigIntIdSchema } from "../util/models";
|
||||||
|
import { r2 } from "../util/r2";
|
||||||
|
|
||||||
|
const VerificationsController = new Elysia({ prefix: "/verifications" })
|
||||||
|
.use(authPlugin)
|
||||||
|
.get("/", async ({ query }) => {
|
||||||
|
return await s.Verifications.list({
|
||||||
|
filter: { status: query.status },
|
||||||
|
limit: query.limit,
|
||||||
|
offset: query.offset,
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
authAdmin: true,
|
||||||
|
query: t.Object({
|
||||||
|
status: t.Optional(VerificationStatusSchema),
|
||||||
|
limit: t.Optional(t.Numeric()),
|
||||||
|
offset: t.Optional(t.Numeric()),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.group("/:id", (app) => app
|
||||||
|
// TODO: dev-only, unguarded so the bot can call it; restore admin/bot auth
|
||||||
|
.get("/", async ({ params: { id } }) => {
|
||||||
|
const verification = await s.Verifications.get(id);
|
||||||
|
if (!verification) throw new NotFoundError("Verification not found");
|
||||||
|
|
||||||
|
const { contents = [] } = await r2.verificationMedia.list({ prefix: `${verification.assessment_id}/` });
|
||||||
|
const media = contents.map(({ key, size, lastModified }) => ({
|
||||||
|
key,
|
||||||
|
size,
|
||||||
|
lastModified,
|
||||||
|
url: r2.verificationMedia.presign(key, { expiresIn: 60 * 60 }),
|
||||||
|
}));
|
||||||
|
|
||||||
|
return { ...verification, media };
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: BigIntIdSchema })
|
||||||
|
})
|
||||||
|
// TODO: dev-only, unguarded so the bot can call it; restore admin/bot auth
|
||||||
|
.post("/request-action", async ({ params: { id }, body: { reviewerNotes, activityVerifications } }) => {
|
||||||
|
const updated = await s.Verifications.requestAction(id, reviewerNotes ?? null, activityVerifications);
|
||||||
|
if (updated) return updated;
|
||||||
|
|
||||||
|
const verification = await s.Verifications.get(id);
|
||||||
|
if (!verification) throw new NotFoundError("Verification not found");
|
||||||
|
throw new ConflictError(`Cannot request action on a ${verification.status} verification`);
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: BigIntIdSchema }),
|
||||||
|
body: t.Object({
|
||||||
|
reviewerNotes: t.Optional(t.String()),
|
||||||
|
activityVerifications: ActivityVerificationsSchema,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// TODO: dev-only, unguarded so the bot can call it; restore admin/bot auth and drop completedBy from the body
|
||||||
|
.post("/complete", async ({ params: { id }, body: { activityVerifications, completedBy }, jwt, cookie: { auth } }) => {
|
||||||
|
const portalSession = auth.value && await jwt.verify(auth.value);
|
||||||
|
const completerId = completedBy ?? (portalSession ? portalSession.accountId?.toString() : undefined);
|
||||||
|
const completer = completerId && await s.Accounts.get(completerId);
|
||||||
|
if (!completer || completer.role !== "admin") throw new ForbiddenError("Only a classmaster can complete a verification");
|
||||||
|
|
||||||
|
const updated = await s.Verifications.complete(id, completer.id, activityVerifications);
|
||||||
|
if (updated) return updated;
|
||||||
|
|
||||||
|
const verification = await s.Verifications.get(id);
|
||||||
|
if (!verification) throw new NotFoundError("Verification not found");
|
||||||
|
throw new ConflictError(`Cannot complete a ${verification.status} verification`);
|
||||||
|
}, {
|
||||||
|
params: t.Object({ id: BigIntIdSchema }),
|
||||||
|
body: t.Object({
|
||||||
|
activityVerifications: ActivityVerificationsSchema,
|
||||||
|
completedBy: t.Optional(AccountIdSchema),
|
||||||
|
}),
|
||||||
|
cookie: t.Cookie({ auth: t.Optional(t.String()) })
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
export default VerificationsController;
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
import Elysia, { NotFoundError, t } from "elysia";
|
||||||
|
import { Printful, Webflow } from "@blade-and-brawn/commerce";
|
||||||
|
import { randomUUIDv7 } from "bun";
|
||||||
|
import { s } from "../services";
|
||||||
|
import { BadRequestError } from "../util/error";
|
||||||
|
import { log } from "../util/log";
|
||||||
|
|
||||||
|
const WebhooksController = new Elysia({ prefix: "/webhooks" })
|
||||||
|
.post("/printful", async ({ body, query }) => {
|
||||||
|
// https://webflow.com/integrations/printful
|
||||||
|
if (!s.Commerce.Printful.Util.verifySecret(query.secret))
|
||||||
|
throw new BadRequestError("Invalid secret");
|
||||||
|
|
||||||
|
const payload = body as Printful.Webhook.EventPayload;
|
||||||
|
|
||||||
|
switch (payload.type) {
|
||||||
|
case Printful.Webhook.Event.ProductUpdated: {
|
||||||
|
const pProduct = payload.data.sync_product;
|
||||||
|
log.info({ productId: pProduct.id }, "printful webhook: product updated");
|
||||||
|
|
||||||
|
await s.Commerce.Apparel.Syncs.Queue.enqueue({
|
||||||
|
type: "apparel_sync_update",
|
||||||
|
source: "printful",
|
||||||
|
payload: {
|
||||||
|
session: { id: randomUUIDv7(), name: "Printful" },
|
||||||
|
filter: { pProductIds: [pProduct.id] }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Printful.Webhook.Event.ProductDeleted: {
|
||||||
|
const pProduct = payload.data.sync_product;
|
||||||
|
const wProductId = pProduct.external_id.split("-")[0];
|
||||||
|
log.info({ externalId: payload.data.sync_product.external_id, wProductId }, "printful webhook: product deleted");
|
||||||
|
if (!wProductId) throw new NotFoundError("Missing webflow product ID");
|
||||||
|
|
||||||
|
await s.Commerce.Apparel.Syncs.Queue.enqueue({
|
||||||
|
type: "apparel_sync_delete",
|
||||||
|
source: "printful",
|
||||||
|
payload: { wProductId }
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Printful.Webhook.Event.PackageShipped: {
|
||||||
|
const wOrderId = payload.data.order.external_id;
|
||||||
|
const shipment = payload.data.shipment;
|
||||||
|
log.info({ wOrderId, carrier: shipment.carrier, tracking: shipment.tracking_number }, "printful webhook: package shipped");
|
||||||
|
|
||||||
|
// TODO: possible to have multiple packages shipped
|
||||||
|
// order should NOT be immediately fulfulled in that case
|
||||||
|
|
||||||
|
await s.Commerce.Apparel.Orders.Queue.enqueue({
|
||||||
|
type: "apparel_order_fulfill",
|
||||||
|
source: "printful",
|
||||||
|
payload: { wOrderId, shipment }
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
log.warn({ type: (payload as any).type }, "printful webhook: unhandled event type");
|
||||||
|
}
|
||||||
|
}, { query: t.Object({ secret: t.String() }) })
|
||||||
|
.post("/webflow", async ({ request, body }) => {
|
||||||
|
if (!s.Commerce.Webflow.Util.verifySecret(request, body))
|
||||||
|
throw new BadRequestError("Invalid signature");
|
||||||
|
|
||||||
|
const payload = body as Webflow.Webhook.EventPayload;
|
||||||
|
|
||||||
|
switch (payload.triggerType) {
|
||||||
|
case Webflow.Webhook.Event.OrderCreated: {
|
||||||
|
const wOrder = payload.payload;
|
||||||
|
log.info({ orderId: wOrder.orderId }, "webflow webhook: order created");
|
||||||
|
|
||||||
|
await s.Commerce.Apparel.Orders.Queue.enqueue({
|
||||||
|
type: "apparel_order_create",
|
||||||
|
source: "webflow",
|
||||||
|
payload: { wOrder }
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
log.warn({ triggerType: (payload as any).triggerType }, "webflow webhook: unhandled event type");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default WebhooksController;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { CreateTableBuilder, Kysely, PostgresDialect, sql } from 'kysely';
|
import { CreateTableBuilder, Kysely, PostgresDialect, sql } from 'kysely';
|
||||||
import { type DB } from "./out/db";
|
import { type DB } from "./out/db";
|
||||||
import { Pool } from "pg";
|
import { Pool } from "pg";
|
||||||
import { env, WORKER_COUNT } from '../util';
|
import { env, WORKER_COUNT } from '../util/env';
|
||||||
|
|
||||||
export const db = new Kysely<DB>({
|
export const db = new Kysely<DB>({
|
||||||
dialect: new PostgresDialect({
|
dialect: new PostgresDialect({
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import { promises as fs } from 'fs'
|
|||||||
import { FileMigrationProvider, Migrator, type MigrationResultSet } from 'kysely/migration'
|
import { FileMigrationProvider, Migrator, type MigrationResultSet } from 'kysely/migration'
|
||||||
import { db } from './db'
|
import { db } from './db'
|
||||||
import { argv } from 'bun'
|
import { argv } from 'bun'
|
||||||
import { env, log } from '../util'
|
import { env } from '../util/env';
|
||||||
|
import { log } from '../util/log';
|
||||||
|
|
||||||
type HandlerResult = {
|
type HandlerResult = {
|
||||||
message: string;
|
message: string;
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
import { Kysely, sql } from 'kysely'
|
||||||
|
import { addDefaultColumns } from '../db';
|
||||||
|
|
||||||
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
|
// TABLE: VERIFICATIONS
|
||||||
|
await db.schema.createTable("verifications")
|
||||||
|
.$call(addDefaultColumns)
|
||||||
|
.addColumn("assessment_id", "bigint", (cb) => cb.notNull().unique())
|
||||||
|
.addColumn("status", "text", (cb) => cb.notNull().defaultTo("draft")) // draft | submitted | in_review | action_requested | completed
|
||||||
|
.addColumn("submitted_at", "timestamptz")
|
||||||
|
.addColumn("completed_at", "timestamptz")
|
||||||
|
.addColumn("completed_by", "uuid")
|
||||||
|
.addColumn("verf_back_squat", "boolean")
|
||||||
|
.addColumn("verf_deadlift", "boolean")
|
||||||
|
.addColumn("verf_bench_press", "boolean")
|
||||||
|
.addColumn("verf_run", "boolean")
|
||||||
|
.addColumn("verf_broad_jump", "boolean")
|
||||||
|
.addColumn("verf_cone_drill", "boolean")
|
||||||
|
.addColumn("reviewer_notes", "text") // can be structured in the future, for now keep simple
|
||||||
|
.addForeignKeyConstraint(
|
||||||
|
"fk_verifications_assessment_id",
|
||||||
|
["assessment_id"],
|
||||||
|
"assessments",
|
||||||
|
["id"],
|
||||||
|
(cb) => cb.onDelete("cascade")
|
||||||
|
)
|
||||||
|
.addForeignKeyConstraint(
|
||||||
|
"fk_verifications_completed_by",
|
||||||
|
["completed_by"],
|
||||||
|
"accounts",
|
||||||
|
["id"],
|
||||||
|
(cb) => cb.onDelete("restrict")
|
||||||
|
)
|
||||||
|
.addCheckConstraint(
|
||||||
|
"chk_verifications_completed_fields",
|
||||||
|
sql`status != 'completed' OR (completed_at IS NOT NULL AND completed_by IS NOT NULL)`
|
||||||
|
)
|
||||||
|
.execute()
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down(db: Kysely<any>): Promise<void> {
|
||||||
|
// TABLE: VERIFICATIONS
|
||||||
|
await db.schema.dropTable("verifications").ifExists().execute()
|
||||||
|
}
|
||||||
@@ -3,10 +3,13 @@ import {
|
|||||||
} from "@blade-and-brawn/calculator";
|
} from "@blade-and-brawn/calculator";
|
||||||
import { Value } from "@sinclair/typebox/value";
|
import { Value } from "@sinclair/typebox/value";
|
||||||
import { db } from "./db";
|
import { db } from "./db";
|
||||||
import { DEFAULT_NAME, env, log } from "../util";
|
import { env } from "../util/env";
|
||||||
|
import { log } from "../util/log";
|
||||||
import standardsConfig from "./seed-data/standards-config.json" with {type: "json"};
|
import standardsConfig from "./seed-data/standards-config.json" with {type: "json"};
|
||||||
import type { AccountRole } from "../services/accounts";
|
import type { AccountRole } from "../services/accounts";
|
||||||
|
|
||||||
|
export const DEFAULT_NAME = "Default";
|
||||||
|
|
||||||
Value.Assert(StandardsConfigSchema, standardsConfig);
|
Value.Assert(StandardsConfigSchema, standardsConfig);
|
||||||
|
|
||||||
async function seedStandardsDataset(): Promise<string> {
|
async function seedStandardsDataset(): Promise<string> {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import cluster from 'node:cluster'
|
import cluster from 'node:cluster'
|
||||||
import { log, WORKER_COUNT } from "./util";
|
import { log } from "./util/log";
|
||||||
|
import { WORKER_COUNT } from "./util/env";
|
||||||
|
|
||||||
if (cluster.isPrimary) {
|
if (cluster.isPrimary) {
|
||||||
log.info(`Starting ${WORKER_COUNT} worker processes`)
|
log.info(`Starting ${WORKER_COUNT} worker processes`)
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import Elysia, { status, t } from "elysia";
|
||||||
|
import jwt from "@elysia/jwt";
|
||||||
|
import { env } from "../util/env";
|
||||||
|
|
||||||
|
export const authPlugin = new Elysia({ name: "auth" })
|
||||||
|
.use(jwt({ name: "jwt", secret: env.AUTH_SECRET }))
|
||||||
|
.guard({ cookie: t.Cookie({ auth: t.Optional(t.String()) }) })
|
||||||
|
.macro({
|
||||||
|
authAdmin: {
|
||||||
|
async resolve({ jwt, cookie: { auth } }) {
|
||||||
|
const token = auth.value && await jwt.verify(auth.value);
|
||||||
|
if (!token || token.role !== "admin" || !token.accountId || !token.sessionId) return status(401, { error: "Unauthorized" });
|
||||||
|
return { role: token.role.toString(), sessionId: token.sessionId.toString(), accountId: token.accountId.toString() };
|
||||||
|
}
|
||||||
|
},
|
||||||
|
auth: {
|
||||||
|
async resolve({ jwt, cookie: { auth } }) {
|
||||||
|
const token = auth.value && await jwt.verify(auth.value);
|
||||||
|
if (!token || !token.role || !token.accountId || !token.sessionId) return status(401, { error: "Unauthorized" });
|
||||||
|
return { role: token.role.toString(), sessionId: token.sessionId.toString(), accountId: token.accountId.toString() };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { WebflowClient } from "@blade-and-brawn/commerce";
|
import { WebflowClient } from "@blade-and-brawn/commerce";
|
||||||
import { env } from "../util";
|
import { env } from "../util/env";
|
||||||
|
|
||||||
const webflow = new WebflowClient({
|
const webflow = new WebflowClient({
|
||||||
siteId: env.WEBFLOW_SITE_ID,
|
siteId: env.WEBFLOW_SITE_ID,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Printful, PrintfulClient, PrintfulError, Webflow, WebflowClient, WebflowError } from "@blade-and-brawn/commerce";
|
import { Printful, PrintfulClient, PrintfulError, Webflow, WebflowClient, WebflowError } from "@blade-and-brawn/commerce";
|
||||||
import { env } from "../util";
|
import { env } from "../util/env";
|
||||||
|
|
||||||
const DOMAIN = env.NODE_ENV === "development" ?
|
const DOMAIN = env.NODE_ENV === "development" ?
|
||||||
"dev-api.bladeandbrawn.com" :
|
"dev-api.bladeandbrawn.com" :
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
import { Gender, inToCm, lbToKg, minToMs, secToMs } from "@blade-and-brawn/domain";
|
||||||
|
import { S3Client } from "bun";
|
||||||
|
import { readdir } from "node:fs/promises";
|
||||||
|
import path from "node:path";
|
||||||
|
import { parseArgs } from "node:util";
|
||||||
|
import { db } from "../database/db";
|
||||||
|
import { env } from "../util/env";
|
||||||
|
import { log } from "../util/log";
|
||||||
|
import type { AccountRole } from "../services/accounts";
|
||||||
|
import { VerificationsService } from "../services/verifications";
|
||||||
|
|
||||||
|
const DEFAULT_DISCORD_ID = "1325552430942916731";
|
||||||
|
const MEDIA_DIR = path.join(import.meta.dir, "test-verification-media");
|
||||||
|
const BUCKET = `verification-media${env.NODE_ENV === "production" ? "" : "-dev"}`;
|
||||||
|
|
||||||
|
const { values: args } = parseArgs({
|
||||||
|
args: Bun.argv.slice(2),
|
||||||
|
options: { "discord-id": { type: "string", default: DEFAULT_DISCORD_ID } },
|
||||||
|
});
|
||||||
|
const discordId = args["discord-id"];
|
||||||
|
|
||||||
|
const r2 = new S3Client({
|
||||||
|
accessKeyId: env.R2_ACCESS_KEY_ID,
|
||||||
|
secretAccessKey: env.R2_SECRET_ACCESS_KEY,
|
||||||
|
bucket: BUCKET,
|
||||||
|
endpoint: env.R2_URL,
|
||||||
|
});
|
||||||
|
|
||||||
|
async function seedTestAccount(): Promise<string> {
|
||||||
|
const existing = await db.selectFrom("accounts")
|
||||||
|
.select("id")
|
||||||
|
.where("discord_id", "=", discordId)
|
||||||
|
.executeTakeFirst();
|
||||||
|
if (existing) {
|
||||||
|
log.info({ id: existing.id, discordId }, "account already exists, reusing");
|
||||||
|
return existing.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
const account = await db.insertInto("accounts")
|
||||||
|
.values({
|
||||||
|
discord_id: discordId,
|
||||||
|
name: "Test Player",
|
||||||
|
role: "user" satisfies AccountRole,
|
||||||
|
})
|
||||||
|
.returning("id")
|
||||||
|
.executeTakeFirstOrThrow();
|
||||||
|
log.info({ id: account.id, discordId }, "seeded test account");
|
||||||
|
return account.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function seedTestAssessment(accountId: string): Promise<string> {
|
||||||
|
const result = await db.insertInto("assessments")
|
||||||
|
.values({
|
||||||
|
account_id: accountId,
|
||||||
|
name: `Test Verification ${new Date().toISOString()}`,
|
||||||
|
gender: Gender.Male,
|
||||||
|
age: 22,
|
||||||
|
weight: lbToKg(180),
|
||||||
|
perf_back_squat: lbToKg(225),
|
||||||
|
perf_deadlift: lbToKg(315),
|
||||||
|
perf_bench_press: lbToKg(185),
|
||||||
|
perf_broad_jump: inToCm(96),
|
||||||
|
perf_run: minToMs(7) + secToMs(30),
|
||||||
|
perf_cone_drill: secToMs(7),
|
||||||
|
})
|
||||||
|
.returning("id")
|
||||||
|
.executeTakeFirstOrThrow();
|
||||||
|
log.info({ id: result.id }, "seeded test assessment");
|
||||||
|
return result.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function uploadMedia(assessmentId: string) {
|
||||||
|
const names = await readdir(MEDIA_DIR).catch(() => []);
|
||||||
|
if (names.length === 0) log.warn({ dir: MEDIA_DIR }, "no fixture media found, verification will have no media");
|
||||||
|
|
||||||
|
for (const name of names) {
|
||||||
|
const file = Bun.file(path.join(MEDIA_DIR, name));
|
||||||
|
const key = `${assessmentId}/${crypto.randomUUID()}`;
|
||||||
|
await r2.write(key, file, { type: file.type });
|
||||||
|
log.info({ key, name, size: file.size }, "uploaded fixture media");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
const answer = prompt(`Seed a test verification for discord id "${discordId}" in the database (${env.DATABASE_URL}) and R2 bucket "${BUCKET}"? (y/N)`);
|
||||||
|
if (answer?.trim().toLowerCase() !== "y") {
|
||||||
|
log.info("Aborted");
|
||||||
|
await db.destroy();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const accountId = await seedTestAccount();
|
||||||
|
const assessmentId = await seedTestAssessment(accountId);
|
||||||
|
|
||||||
|
const verifications = new VerificationsService();
|
||||||
|
const verification = await verifications.create(assessmentId);
|
||||||
|
if (!verification) throw new Error("Failed to create test verification");
|
||||||
|
|
||||||
|
await uploadMedia(assessmentId);
|
||||||
|
|
||||||
|
const submitted = await verifications.submit(verification.id);
|
||||||
|
if (!submitted) throw new Error("Failed to submit test verification");
|
||||||
|
|
||||||
|
log.info({ id: submitted.id, status: submitted.status, assessmentId, accountId }, "seeded test verification request");
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
log.error({ err }, "seed failed");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
await db.destroy();
|
||||||
|
}
|
||||||
|
})();
|
||||||
BIN
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@ import {
|
|||||||
ProductSyncer,
|
ProductSyncer,
|
||||||
WebflowClient,
|
WebflowClient,
|
||||||
} from "@blade-and-brawn/commerce";
|
} from "@blade-and-brawn/commerce";
|
||||||
import { env } from "../util";
|
import { env } from "../util/env";
|
||||||
|
|
||||||
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
|
||||||
|
|||||||
+54
-563
@@ -1,76 +1,29 @@
|
|||||||
import {
|
|
||||||
ActivityPerformanceSchema,
|
|
||||||
PlayerSchema,
|
|
||||||
} from "@blade-and-brawn/domain"
|
|
||||||
import { cors } from "@elysiajs/cors";
|
import { cors } from "@elysiajs/cors";
|
||||||
import { Elysia, NotFoundError, redirect, status, t } from "elysia";
|
import { Elysia, status } from "elysia";
|
||||||
import {
|
import { PrintfulError, WebflowError } from "@blade-and-brawn/commerce";
|
||||||
PrintfulError,
|
|
||||||
WebflowError,
|
|
||||||
Printful,
|
|
||||||
Webflow,
|
|
||||||
} from "@blade-and-brawn/commerce";
|
|
||||||
import { DEFAULT_NAME, DUMMY_PASSWORD_HASH, env, log } from "./util";
|
|
||||||
import serverTiming from "@elysia/server-timing";
|
import serverTiming from "@elysia/server-timing";
|
||||||
import jwt from "@elysia/jwt";
|
|
||||||
import { CommerceService, WOrderStatusSchema } from "./services/commerce";
|
|
||||||
import cluster from "node:cluster";
|
import cluster from "node:cluster";
|
||||||
import { randomUUIDv7, sleep } from "bun";
|
import { sleep } from "bun";
|
||||||
import { CalculatorService, CalculatorUnavailableError } from "./services/calculator";
|
import { DatabaseError } from "pg";
|
||||||
import { StandardsParamsSchema } from "@blade-and-brawn/calculator";
|
import { HttpError } from "./util/error";
|
||||||
import { StandardsService } from "./services/standards";
|
import { log } from "./util/log";
|
||||||
import { EventsService, EventStatusSchema } from "./services/events";
|
import { queues } from "./services";
|
||||||
import { AccountsService, type AccountRole } from "./services/accounts";
|
import { CalculatorUnavailableError } from "./services/calculator";
|
||||||
import { Value } from "@sinclair/typebox/value";
|
import { EventsService } from "./services/events";
|
||||||
import { AssessmentsService } from "./services/assessments";
|
import AuthController from "./controllers/auth";
|
||||||
import { Not } from "@sinclair/typebox";
|
import CalculatorController from "./controllers/calculator";
|
||||||
|
import StandardsController from "./controllers/standards";
|
||||||
|
import CommerceController from "./controllers/commerce";
|
||||||
|
import EventsController from "./controllers/events";
|
||||||
|
import AccountsController from "./controllers/accounts";
|
||||||
|
import AssessmentsController from "./controllers/assessments";
|
||||||
|
import VerificationsController from "./controllers/verifications";
|
||||||
|
import WebhooksController from "./controllers/webhooks";
|
||||||
|
|
||||||
// CONSTANTS
|
// CONSTANTS
|
||||||
// -----------------------
|
// -----------------------
|
||||||
const EVENT_QUEUE_MANAGE_DELAY_MS = 1000 // 1 sec
|
const EVENT_QUEUE_MANAGE_DELAY_MS = 1000 // 1 sec
|
||||||
const JWT_EXP = "1d";
|
const QUIET_ROUTES = new Set(["GET /commerce/products/sync/"]); // logged at debug level
|
||||||
const JWT_EXP_SECONDS = 60 * 60 * 24; // keep in sync with JWT_EXP; used for cookie maxAge
|
|
||||||
|
|
||||||
// SERVICES
|
|
||||||
// -----------------------
|
|
||||||
const s = (() => {
|
|
||||||
const Standards = new StandardsService();
|
|
||||||
const Calculator = new CalculatorService(DEFAULT_NAME);
|
|
||||||
const Commerce = new CommerceService();
|
|
||||||
const Accounts = new AccountsService(Calculator);
|
|
||||||
const Events = new EventsService();
|
|
||||||
const Assessments = new AssessmentsService();
|
|
||||||
return { Standards, Calculator, Commerce, Accounts, Events, Assessments };
|
|
||||||
})();
|
|
||||||
|
|
||||||
// QUEUES
|
|
||||||
// -----------------------
|
|
||||||
const queues = [
|
|
||||||
s.Commerce.Apparel.Syncs.Queue,
|
|
||||||
s.Commerce.Apparel.Orders.Queue,
|
|
||||||
] as const;
|
|
||||||
|
|
||||||
// PLUGINS
|
|
||||||
// -----------------------
|
|
||||||
const authPlugin = new Elysia({ name: "auth" })
|
|
||||||
.use(jwt({ name: "jwt", secret: env.AUTH_SECRET }))
|
|
||||||
.guard({ cookie: t.Cookie({ auth: t.Optional(t.String()) }) })
|
|
||||||
.macro({
|
|
||||||
authAdmin: {
|
|
||||||
async resolve({ jwt, cookie: { auth } }) {
|
|
||||||
const token = auth.value && await jwt.verify(auth.value);
|
|
||||||
if (!token || token.role !== "admin" || !token.accountId || !token.sessionId) throw status(401, "Unauthorized");
|
|
||||||
return { role: token.role.toString(), sessionId: token.sessionId.toString(), accountId: token.accountId.toString() };
|
|
||||||
}
|
|
||||||
},
|
|
||||||
auth: {
|
|
||||||
async resolve({ jwt, cookie: { auth } }) {
|
|
||||||
const token = auth.value && await jwt.verify(auth.value);
|
|
||||||
if (!token || !token.role || !token.accountId || !token.sessionId) throw status(401, "Unauthorized");
|
|
||||||
return { role: token.role.toString(), sessionId: token.sessionId.toString(), accountId: token.accountId.toString() };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// ELYSIA
|
// ELYSIA
|
||||||
// -----------------------
|
// -----------------------
|
||||||
@@ -88,521 +41,58 @@ export const app = new Elysia()
|
|||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.guard({
|
|
||||||
cookie: t.Cookie({
|
|
||||||
auth: t.Optional(t.String()),
|
|
||||||
authDiscord: t.Optional(t.String())
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.use(authPlugin)
|
|
||||||
|
|
||||||
.error({
|
|
||||||
PrintfulError,
|
|
||||||
WebflowError,
|
|
||||||
CalculatorUnavailableError
|
|
||||||
})
|
|
||||||
|
|
||||||
|
.error({ PrintfulError, WebflowError, CalculatorUnavailableError, HttpError })
|
||||||
.onError(({ code, error }) => {
|
.onError(({ code, error }) => {
|
||||||
|
// Database errors
|
||||||
|
if (error instanceof DatabaseError) {
|
||||||
|
if (error.code === "23505")
|
||||||
|
return status(409, { error: "Conflicts with an existing record" });
|
||||||
|
log.error({ err: error }, "Database error");
|
||||||
|
return status(500, { error: "Internal Server Error" });
|
||||||
|
}
|
||||||
|
|
||||||
|
// All other errors
|
||||||
switch (code) {
|
switch (code) {
|
||||||
|
case "HttpError":
|
||||||
|
break;
|
||||||
case "PrintfulError":
|
case "PrintfulError":
|
||||||
case "WebflowError":
|
case "WebflowError":
|
||||||
log.error(
|
log.error({ upstreamStatus: error.upstreamStatus, payload: error.payload }, error.message);
|
||||||
{ upstreamStatus: error.upstreamStatus, payload: error.payload },
|
break;
|
||||||
error.message,
|
|
||||||
);
|
|
||||||
return status(error.status, { error: error.message });
|
|
||||||
case "CalculatorUnavailableError":
|
|
||||||
log.error({ err: error.cause }, error.message);
|
|
||||||
return status(error.status, { error: error.message });
|
|
||||||
case "NOT_FOUND":
|
case "NOT_FOUND":
|
||||||
return status(error.status, { error: error.message });
|
return status(404, { error: error.message || "NOT_FOUND" });
|
||||||
case "VALIDATION":
|
case "VALIDATION":
|
||||||
return status(error.status, { error: error.message });
|
return status(422, { error: error.message, detail: error.detail });
|
||||||
default:
|
default:
|
||||||
log.error({ err: error }, "unhandled error");
|
log.error({ err: error }, "Unhandled error");
|
||||||
|
return status(500, { error: "Internal Server Error" })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.onAfterResponse(({ request, status, path }) => {
|
.onAfterResponse(({ request, route, set, responseValue }) => {
|
||||||
if (env.NODE_ENV === "development") {
|
const failed = Number(set.status) >= 400;
|
||||||
const skip: Record<string, string[]> = { "/commerce/products/sync/": ["GET"] };
|
const level = failed ? "warn" : QUIET_ROUTES.has(`${request.method} ${route}`) ? "debug" : "info";
|
||||||
if (skip[path]?.includes(request.method)) return;
|
log[level]({
|
||||||
}
|
|
||||||
|
|
||||||
log.info({
|
|
||||||
method: request.method,
|
method: request.method,
|
||||||
path,
|
path: route,
|
||||||
status
|
status: set.status,
|
||||||
|
...(failed && { response: responseValue }),
|
||||||
}, "request");
|
}, "request");
|
||||||
})
|
})
|
||||||
|
|
||||||
.get("/", () => ({ status: "ok" }))
|
.get("/", () => ({ status: "ok" }))
|
||||||
.get("/health", () => ({ status: "ok" }))
|
.get("/health", () => ({ status: "ok" }))
|
||||||
|
|
||||||
// AUTHENTICATION
|
.use(AuthController)
|
||||||
.post("/auth/login", async ({ jwt, body: { password, email }, cookie: { auth } }) => {
|
.use(CalculatorController)
|
||||||
const account = await s.Accounts.getByEmail(email);
|
.use(StandardsController)
|
||||||
const password_match = await Bun.password.verify(password, account?.password_hash ?? DUMMY_PASSWORD_HASH);
|
.use(CommerceController)
|
||||||
if (!account || !password_match) throw status(401, "Invalid credentials");
|
.use(EventsController)
|
||||||
|
.use(AccountsController)
|
||||||
auth.set({
|
.use(AssessmentsController)
|
||||||
value: await jwt.sign({ role: account.role, sessionId: randomUUIDv7(), accountId: account.id, exp: JWT_EXP }),
|
.use(VerificationsController)
|
||||||
path: "/",
|
.use(WebhooksController);
|
||||||
maxAge: JWT_EXP_SECONDS,
|
|
||||||
sameSite: env.NODE_ENV === "production" ? "lax" : "none",
|
|
||||||
httpOnly: true,
|
|
||||||
secure: true,
|
|
||||||
domain: env.NODE_ENV === "production" ?
|
|
||||||
".bladeandbrawn.com" :
|
|
||||||
undefined
|
|
||||||
});
|
|
||||||
}, { body: t.Object({ email: t.String(), password: t.String() }) })
|
|
||||||
|
|
||||||
.group("/auth/discord", (app) => app
|
|
||||||
.get("/login", async ({ cookie: { authDiscord } }) => {
|
|
||||||
const state = crypto.randomUUID();
|
|
||||||
|
|
||||||
authDiscord.set({
|
|
||||||
value: state,
|
|
||||||
path: "/",
|
|
||||||
maxAge: 60 * 10, // 10 min
|
|
||||||
sameSite: "lax",
|
|
||||||
httpOnly: true,
|
|
||||||
secure: env.NODE_ENV === "production"
|
|
||||||
});
|
|
||||||
|
|
||||||
const url = new URL("https://discord.com/api/oauth2/authorize");
|
|
||||||
url.searchParams.set("client_id", env.BOT_CLIENT_ID);
|
|
||||||
url.searchParams.set("redirect_uri", env.BOT_REDIRECT_URL);
|
|
||||||
url.searchParams.set("response_type", "code");
|
|
||||||
url.searchParams.set("scope", "identify email");
|
|
||||||
url.searchParams.set("state", state);
|
|
||||||
|
|
||||||
return redirect(url.toString(), 302);
|
|
||||||
})
|
|
||||||
.get("/callback", async ({ query, cookie: { authDiscord, auth }, jwt }) => {
|
|
||||||
if (query.error) throw status(400, { error: query.error_description ? `${query.error}: ${query.error_description}` : query.error });
|
|
||||||
|
|
||||||
if (!query.state) throw status(400, "No Discord OAuth2 state query parameter provided");
|
|
||||||
if (query.state !== authDiscord.value) throw status(400, "Invalid Discord OAuth state");
|
|
||||||
|
|
||||||
const tokenRes = await fetch("https://discord.com/api/oauth2/token", {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
},
|
|
||||||
body: new URLSearchParams({
|
|
||||||
client_id: env.BOT_CLIENT_ID,
|
|
||||||
client_secret: env.BOT_CLIENT_SECRET,
|
|
||||||
grant_type: "authorization_code",
|
|
||||||
code: query.code ?? "",
|
|
||||||
redirect_uri: env.BOT_REDIRECT_URL
|
|
||||||
}).toString()
|
|
||||||
});
|
|
||||||
if (!tokenRes.ok) {
|
|
||||||
const errorBody = await tokenRes.json().catch(() => null);
|
|
||||||
throw status(502, { error: errorBody ?? "Discord token exchange failed" });
|
|
||||||
}
|
|
||||||
|
|
||||||
const tokenResPayload = await tokenRes.json();
|
|
||||||
Value.Assert(t.Object({ access_token: t.String() }), tokenResPayload);
|
|
||||||
|
|
||||||
const identityRes = await fetch("https://discord.com/api/users/@me", {
|
|
||||||
headers: { "Authorization": `Bearer ${tokenResPayload.access_token}` }
|
|
||||||
});
|
|
||||||
if (!identityRes.ok) {
|
|
||||||
const errorBody = await identityRes.json().catch(() => null);
|
|
||||||
throw status(502, { error: errorBody ?? "Failed to fetch Discord identity" });
|
|
||||||
}
|
|
||||||
|
|
||||||
const identityResPayload = await identityRes.json();
|
|
||||||
Value.Assert(t.Object({ id: t.String(), email: t.Optional(t.String()), username: t.String() }), identityResPayload);
|
|
||||||
|
|
||||||
// Create the account
|
|
||||||
let accountId = (await s.Accounts.get(`@${identityResPayload.id}`))?.id;
|
|
||||||
if (!accountId) {
|
|
||||||
accountId = (await s.Accounts.create(
|
|
||||||
identityResPayload.id,
|
|
||||||
identityResPayload.email,
|
|
||||||
identityResPayload.username
|
|
||||||
)).id;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Authenticate
|
|
||||||
auth.set({
|
|
||||||
value: await jwt.sign({ role: "user" satisfies AccountRole, sessionId: randomUUIDv7(), accountId, exp: JWT_EXP }),
|
|
||||||
path: "/",
|
|
||||||
maxAge: JWT_EXP_SECONDS,
|
|
||||||
sameSite: env.NODE_ENV === "production" ? "lax" : "none",
|
|
||||||
httpOnly: true,
|
|
||||||
secure: true,
|
|
||||||
domain: env.NODE_ENV === "production" ?
|
|
||||||
".bladeandbrawn.com" :
|
|
||||||
undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
return redirect(env.BOT_LOGIN_REDIRECT_URL, 302);
|
|
||||||
}, {
|
|
||||||
query: t.Object({
|
|
||||||
code: t.Optional(t.String()),
|
|
||||||
state: t.Optional(t.String()),
|
|
||||||
error: t.Optional(t.String()),
|
|
||||||
error_description: t.Optional(t.String()),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
// CALCULATOR
|
|
||||||
.group("/calculator", (app) => app
|
|
||||||
// Non-authenticated
|
|
||||||
.post("/calculate", async ({ body }) => {
|
|
||||||
return { levels: await s.Calculator.calculate(body.player, body.activityPerformances) };
|
|
||||||
}, {
|
|
||||||
body: t.Object({
|
|
||||||
player: PlayerSchema,
|
|
||||||
activityPerformances: t.Array(ActivityPerformanceSchema)
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
// Authenticated
|
|
||||||
.guard({ authAdmin: true }, (app) => app
|
|
||||||
.get("/standards/config", async () => {
|
|
||||||
return await s.Calculator.Standards.Config.get();
|
|
||||||
})
|
|
||||||
.post("/standards/config/switch", async ({ body: { standardsConfigId } }) => {
|
|
||||||
await s.Calculator.Standards.Config.switch(standardsConfigId);
|
|
||||||
}, {
|
|
||||||
body: t.Object({ standardsConfigId: t.String() })
|
|
||||||
})
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.group("/standards", { authAdmin: true }, (app) => app
|
|
||||||
.post("/configs", async ({ body: { name, datasetId, params } }) => {
|
|
||||||
return await s.Standards.Configs.create(name, datasetId, params);
|
|
||||||
}, {
|
|
||||||
body: t.Object({ name: t.String(), datasetId: t.String(), params: StandardsParamsSchema })
|
|
||||||
})
|
|
||||||
.get("/configs", async () => {
|
|
||||||
return await s.Standards.Configs.list();
|
|
||||||
})
|
|
||||||
.get("/configs/:id", async ({ params: { id } }) => {
|
|
||||||
return await s.Standards.Configs.get(id);
|
|
||||||
}, {
|
|
||||||
params: t.Object({ id: t.String() })
|
|
||||||
})
|
|
||||||
.put("/configs/:id", async ({ params: { id }, body: { name, datasetId, params: parameters } }) => {
|
|
||||||
await s.Standards.Configs.update(id, name, datasetId, parameters);
|
|
||||||
}, {
|
|
||||||
params: t.Object({ id: t.String() }),
|
|
||||||
body: t.Object({ name: t.String(), datasetId: t.String(), params: StandardsParamsSchema })
|
|
||||||
})
|
|
||||||
.delete("/configs/:id", async ({ params: { id } }) => {
|
|
||||||
await s.Standards.Configs.delete(id);
|
|
||||||
}, { params: t.Object({ id: t.String() }) })
|
|
||||||
.get("/datasets", async () => {
|
|
||||||
return await s.Standards.Datasets.list();
|
|
||||||
})
|
|
||||||
.get("/datasets/:id", async ({ params: { id } }) => {
|
|
||||||
return await s.Standards.Datasets.get(id);
|
|
||||||
}, {
|
|
||||||
params: t.Object({ id: t.String() })
|
|
||||||
})
|
|
||||||
.patch("/datasets/:id", async ({ params: { id }, body: { name } }) => {
|
|
||||||
await s.Standards.Datasets.update(id, name);
|
|
||||||
}, {
|
|
||||||
params: t.Object({ id: t.String() }),
|
|
||||||
body: t.Object({ name: t.String() })
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
// COMMERCE
|
|
||||||
.group("/commerce", { authAdmin: true }, (app) => app
|
|
||||||
.group("/products", (app) => app
|
|
||||||
.get("/", async ({ query }) => {
|
|
||||||
const [pProducts, wProducts] = await Promise.all([
|
|
||||||
s.Commerce.Printful.Products.list({
|
|
||||||
limit: query.limit,
|
|
||||||
offset: query.offset,
|
|
||||||
}),
|
|
||||||
s.Commerce.Webflow.Products.list({ forceAll: true }),
|
|
||||||
]);
|
|
||||||
const wProductIds = new Set(wProducts.map((wProduct) => wProduct.product.id));
|
|
||||||
return pProducts.map((pProduct) => {
|
|
||||||
const wProductId = pProduct.external_id.split("-")[0];
|
|
||||||
return { pProduct, isSynced: wProductId ? wProductIds.has(wProductId) : false };
|
|
||||||
});
|
|
||||||
}, {
|
|
||||||
query: t.Object({
|
|
||||||
limit: t.Optional(t.Numeric({ maximum: 100 })),
|
|
||||||
offset: t.Optional(t.Numeric()),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.group("/sync", (app) => app
|
|
||||||
// Sync status
|
|
||||||
.get("/", async ({ sessionId }) => {
|
|
||||||
const latestSyncState = await s.Commerce.Apparel.Syncs.getLatestSyncState(sessionId);
|
|
||||||
if (!latestSyncState) throw new NotFoundError("No product sync found for the provided session");
|
|
||||||
return latestSyncState;
|
|
||||||
})
|
|
||||||
// Run sync
|
|
||||||
.post("/:pProductId?", async ({ params: { pProductId }, sessionId }) => {
|
|
||||||
await s.Commerce.Apparel.Syncs.Queue.enqueue({
|
|
||||||
type: "apparel_sync_update",
|
|
||||||
source: "portal",
|
|
||||||
payload: {
|
|
||||||
session: { id: sessionId, name: "Portal" },
|
|
||||||
filter: {
|
|
||||||
pProductIds: pProductId ? [pProductId] : undefined
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, { params: t.Object({ pProductId: t.Optional(t.Numeric()) }) }),
|
|
||||||
)
|
|
||||||
.get("/:pProductId", async ({ params: { pProductId } }) => {
|
|
||||||
const pProduct = await s.Commerce.Printful.Products.get(pProductId);
|
|
||||||
if (!pProduct) throw new NotFoundError("Missing printful product");
|
|
||||||
|
|
||||||
const wProductId = pProduct.sync_product.external_id.split("-")[0];
|
|
||||||
if (!wProductId) throw new NotFoundError("Missing webflow product ID");
|
|
||||||
|
|
||||||
const wProduct = await s.Commerce.Webflow.Products.get(wProductId);
|
|
||||||
|
|
||||||
return { pProduct, wProduct };
|
|
||||||
}, {
|
|
||||||
params: t.Object({ pProductId: t.Numeric() })
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.group("/orders", (app) => app
|
|
||||||
.get("/", async ({ query }) => {
|
|
||||||
const [wOrders, pOrders] = await Promise.all([
|
|
||||||
s.Commerce.Webflow.Orders.list({
|
|
||||||
status: query.status,
|
|
||||||
limit: query.limit,
|
|
||||||
offset: query.offset,
|
|
||||||
}),
|
|
||||||
s.Commerce.Printful.Orders.list({ forceAll: true }),
|
|
||||||
]);
|
|
||||||
const pOrderExternalIds = new Set(pOrders.map((pOrder) => pOrder.external_id));
|
|
||||||
return wOrders.map((wOrder) => ({
|
|
||||||
wOrder,
|
|
||||||
isSynced: pOrderExternalIds.has(wOrder.orderId),
|
|
||||||
}));
|
|
||||||
}, {
|
|
||||||
query: t.Object({
|
|
||||||
status: t.Optional(WOrderStatusSchema),
|
|
||||||
limit: t.Optional(t.Numeric({ maximum: 100 })),
|
|
||||||
offset: t.Optional(t.Numeric()),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.get("/:wOrderId", async ({ params: { wOrderId } }) => {
|
|
||||||
const wOrder = await s.Commerce.Webflow.Orders.get(wOrderId);
|
|
||||||
if (!wOrder) throw new NotFoundError("Missing webflow order");
|
|
||||||
|
|
||||||
const pOrder = await s.Commerce.Printful.Orders.get(`@${wOrder.orderId}`);
|
|
||||||
|
|
||||||
return { wOrder, pOrder };
|
|
||||||
}, { params: t.Object({ wOrderId: t.String() }) })
|
|
||||||
.post("/sync/:wOrderId", async ({ params: { wOrderId } }) => {
|
|
||||||
const wOrder = await s.Commerce.Webflow.Orders.get(wOrderId);
|
|
||||||
if (!wOrder) throw new NotFoundError("Missing webflow order");
|
|
||||||
|
|
||||||
const pOrder = await s.Commerce.Printful.Orders.get(`@${wOrder.orderId}`);
|
|
||||||
if (pOrder) throw status(409, { error: "Cannot sync an already synced webflow order" });
|
|
||||||
|
|
||||||
await s.Commerce.Apparel.Orders.Queue.enqueue({
|
|
||||||
type: "apparel_order_create",
|
|
||||||
source: "portal",
|
|
||||||
payload: { wOrder }
|
|
||||||
});
|
|
||||||
|
|
||||||
}, { params: t.Object({ wOrderId: t.String() }) })
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
// EVENTS
|
|
||||||
.group("/events", { authAdmin: true }, (app) => app
|
|
||||||
.get("/", async ({ query }) => {
|
|
||||||
const events = await s.Events.list({
|
|
||||||
filter: { status: query.status, type: query.type, group: query.group },
|
|
||||||
limit: query.limit,
|
|
||||||
offset: query.offset,
|
|
||||||
});
|
|
||||||
return events.map((event) => ({ ...event, status: EventsService.status(event) }));
|
|
||||||
}, {
|
|
||||||
query: t.Object({
|
|
||||||
status: t.Optional(EventStatusSchema),
|
|
||||||
type: t.Optional(t.String()),
|
|
||||||
group: t.Optional(t.String()),
|
|
||||||
limit: t.Optional(t.Numeric()),
|
|
||||||
offset: t.Optional(t.Numeric()),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.get("/:id", async ({ params: { id } }) => {
|
|
||||||
const event = await s.Events.get(id);
|
|
||||||
if (!event) throw new NotFoundError("Event not found");
|
|
||||||
return { ...event, status: EventsService.status(event) };
|
|
||||||
}, {
|
|
||||||
params: t.Object({ id: t.String() })
|
|
||||||
})
|
|
||||||
.post("/:id/retry", async ({ params: { id } }) => {
|
|
||||||
const retried = await s.Events.retry(id);
|
|
||||||
if (!retried) throw new NotFoundError("Event not found or not in a failed state");
|
|
||||||
}, {
|
|
||||||
params: t.Object({ id: t.String() })
|
|
||||||
})
|
|
||||||
.get("/groups", async ({ }) => queues.map((q) => q.group))
|
|
||||||
)
|
|
||||||
|
|
||||||
// ACCOUNTS
|
|
||||||
.group("/accounts", (app) => app
|
|
||||||
.get("/:id/stats", async ({ params: { id } }) => {
|
|
||||||
const stats = await s.Accounts.stats(id);
|
|
||||||
if (!stats) throw new NotFoundError("Account stats not found");
|
|
||||||
return stats;
|
|
||||||
}, {
|
|
||||||
params: t.Object({ id: t.String() })
|
|
||||||
})
|
|
||||||
.guard({ auth: true }, (app) => app
|
|
||||||
.get("/me/stats", async ({ accountId }) => {
|
|
||||||
const stats = await s.Accounts.stats(accountId);
|
|
||||||
if (!stats) throw new NotFoundError("Account stats not found");
|
|
||||||
return stats;
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.guard({ authAdmin: true }, (app) => app
|
|
||||||
.get("/:id", async ({ params: { id } }) => {
|
|
||||||
const account = await s.Accounts.get(id);
|
|
||||||
if (!account) throw new NotFoundError("Account not found");
|
|
||||||
return account;
|
|
||||||
}, {
|
|
||||||
params: t.Object({ id: t.String() })
|
|
||||||
})
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
// ASSESSMENTS
|
|
||||||
.group("/assessments", (app) => app
|
|
||||||
.guard({ auth: true }, (app) => app
|
|
||||||
.post("/me", async ({ body: { player, activityPerformances }, accountId }) => {
|
|
||||||
return await s.Assessments.create(player, activityPerformances, accountId);
|
|
||||||
}, {
|
|
||||||
body: t.Object({
|
|
||||||
player: PlayerSchema,
|
|
||||||
activityPerformances: t.Array(ActivityPerformanceSchema)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.get("/me", async ({ accountId }) => {
|
|
||||||
return await s.Assessments.list({ filter: { accountId } });
|
|
||||||
})
|
|
||||||
.delete("/me/:id", async ({ params: { id }, accountId }) => {
|
|
||||||
const deleted = await s.Assessments.delete(id, accountId);
|
|
||||||
if (!deleted) throw new NotFoundError("Assessment not found");
|
|
||||||
}, {
|
|
||||||
params: t.Object({ id: t.String() })
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.guard({ authAdmin: true }, (app) => app
|
|
||||||
.post("/", async ({ body: { player, activityPerformances, id } }) => {
|
|
||||||
await s.Assessments.create(player, activityPerformances, id);
|
|
||||||
}, {
|
|
||||||
body: t.Object({
|
|
||||||
player: PlayerSchema,
|
|
||||||
activityPerformances: t.Array(ActivityPerformanceSchema),
|
|
||||||
id: t.Optional(t.String()),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.put("/:id", async ({ body: { player, activityPerformances }, params: { id } }) => {
|
|
||||||
const updated = await s.Assessments.update(id, player, activityPerformances);
|
|
||||||
if (!updated) throw new NotFoundError("Assessment not found");
|
|
||||||
}, {
|
|
||||||
params: t.Object({ id: t.String() }),
|
|
||||||
body: t.Object({
|
|
||||||
player: PlayerSchema,
|
|
||||||
activityPerformances: t.Array(ActivityPerformanceSchema),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
// WEBHOOKS
|
|
||||||
.post("/webhooks/printful", async ({ body, query }) => {
|
|
||||||
// https://webflow.com/integrations/printful
|
|
||||||
if (!s.Commerce.Printful.Util.verifySecret(query.secret))
|
|
||||||
throw status(400, "Invalid secret");
|
|
||||||
|
|
||||||
const payload = body as Printful.Webhook.EventPayload;
|
|
||||||
|
|
||||||
switch (payload.type) {
|
|
||||||
case Printful.Webhook.Event.ProductUpdated: {
|
|
||||||
const pProduct = payload.data.sync_product;
|
|
||||||
log.info({ productId: pProduct.id }, "printful webhook: product updated");
|
|
||||||
|
|
||||||
await s.Commerce.Apparel.Syncs.Queue.enqueue({
|
|
||||||
type: "apparel_sync_update",
|
|
||||||
source: "printful",
|
|
||||||
payload: {
|
|
||||||
session: { id: randomUUIDv7(), name: "Printful" },
|
|
||||||
filter: { pProductIds: [pProduct.id] }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Printful.Webhook.Event.ProductDeleted: {
|
|
||||||
const pProduct = payload.data.sync_product;
|
|
||||||
const wProductId = pProduct.external_id.split("-")[0];
|
|
||||||
log.info({ externalId: payload.data.sync_product.external_id, wProductId }, "printful webhook: product deleted");
|
|
||||||
if (!wProductId) throw new NotFoundError("Missing webflow product ID");
|
|
||||||
|
|
||||||
await s.Commerce.Apparel.Syncs.Queue.enqueue({
|
|
||||||
type: "apparel_sync_delete",
|
|
||||||
source: "printful",
|
|
||||||
payload: { wProductId }
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Printful.Webhook.Event.PackageShipped: {
|
|
||||||
const wOrderId = payload.data.order.external_id;
|
|
||||||
const shipment = payload.data.shipment;
|
|
||||||
log.info({ wOrderId, carrier: shipment.carrier, tracking: shipment.tracking_number }, "printful webhook: package shipped");
|
|
||||||
|
|
||||||
// TODO: possible to have multiple packages shipped
|
|
||||||
// order should NOT be immediately fulfulled in that case
|
|
||||||
|
|
||||||
await s.Commerce.Apparel.Orders.Queue.enqueue({
|
|
||||||
type: "apparel_order_fulfill",
|
|
||||||
source: "printful",
|
|
||||||
payload: { wOrderId, shipment }
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
log.warn({ type: (payload as any).type }, "printful webhook: unhandled event type");
|
|
||||||
}
|
|
||||||
}, { query: t.Object({ secret: t.String() }) })
|
|
||||||
.post("/webhooks/webflow", async ({ request, body }) => {
|
|
||||||
if (!s.Commerce.Webflow.Util.verifySecret(request, body))
|
|
||||||
throw status(400, "Invalid signature");
|
|
||||||
|
|
||||||
const payload = body as Webflow.Webhook.EventPayload;
|
|
||||||
|
|
||||||
switch (payload.triggerType) {
|
|
||||||
case Webflow.Webhook.Event.OrderCreated: {
|
|
||||||
const wOrder = payload.payload;
|
|
||||||
log.info({ orderId: wOrder.orderId }, "webflow webhook: order created");
|
|
||||||
|
|
||||||
await s.Commerce.Apparel.Orders.Queue.enqueue({
|
|
||||||
type: "apparel_order_create",
|
|
||||||
source: "webflow",
|
|
||||||
payload: { wOrder }
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
log.warn({ triggerType: (payload as any).triggerType }, "webflow webhook: unhandled event type");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.listen(3000, async () => {
|
app.listen(3000, async () => {
|
||||||
if (cluster.worker?.id === 1)
|
if (cluster.worker?.id === 1)
|
||||||
@@ -630,3 +120,4 @@ app.listen(3000, async () => {
|
|||||||
|
|
||||||
export type API = typeof app
|
export type API = typeof app
|
||||||
export { type EventStatus } from "./services/events";
|
export { type EventStatus } from "./services/events";
|
||||||
|
export { type VerificationStatus } from "./services/verifications";
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export type AccountRole = "user" | "admin";
|
|||||||
export class AccountsService {
|
export class AccountsService {
|
||||||
constructor(private Calculator: CalculatorService) { }
|
constructor(private Calculator: CalculatorService) { }
|
||||||
|
|
||||||
private static idComparison(id: string): ["accounts.id" | "accounts.discord_id", "=", string] {
|
static idComparison(id: string): ["accounts.id" | "accounts.discord_id", "=", string] {
|
||||||
return id.startsWith("@")
|
return id.startsWith("@")
|
||||||
? ["accounts.discord_id", "=", id.slice(1)]
|
? ["accounts.discord_id", "=", id.slice(1)]
|
||||||
: ["accounts.id", "=", id];
|
: ["accounts.id", "=", id];
|
||||||
@@ -22,7 +22,7 @@ export class AccountsService {
|
|||||||
name: name ?? "",
|
name: name ?? "",
|
||||||
email: email ?? null
|
email: email ?? null
|
||||||
})
|
})
|
||||||
.returning("id")
|
.returning(["id", "discord_id", "name", "email", "gender", "role"])
|
||||||
.executeTakeFirstOrThrow();
|
.executeTakeFirstOrThrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,14 @@ export class AssessmentsService {
|
|||||||
.executeTakeFirstOrThrow();
|
.executeTakeFirstOrThrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async get(id: string, accountId?: string) {
|
||||||
|
return await db.selectFrom("assessments")
|
||||||
|
.selectAll()
|
||||||
|
.where("id", "=", id)
|
||||||
|
.$if(accountId !== undefined, (qb) => qb.where("account_id", "=", accountId!))
|
||||||
|
.executeTakeFirst();
|
||||||
|
}
|
||||||
|
|
||||||
async list(opt: {
|
async list(opt: {
|
||||||
filter?: { accountId?: string },
|
filter?: { accountId?: string },
|
||||||
limit?: number,
|
limit?: number,
|
||||||
@@ -41,7 +49,7 @@ export class AssessmentsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async update(id: string, player: Player, activityPerformances: ActivityPerformance[]) {
|
async update(id: string, player: Player, activityPerformances: ActivityPerformance[]) {
|
||||||
const result = await db.updateTable("assessments")
|
return await db.updateTable("assessments")
|
||||||
.where("id", "=", id)
|
.where("id", "=", id)
|
||||||
.set({
|
.set({
|
||||||
name: player.name ?? "Anonymous",
|
name: player.name ?? "Anonymous",
|
||||||
@@ -55,8 +63,8 @@ export class AssessmentsService {
|
|||||||
perf_run: AssessmentsService.performanceFor(activityPerformances, Activity.Run),
|
perf_run: AssessmentsService.performanceFor(activityPerformances, Activity.Run),
|
||||||
perf_cone_drill: AssessmentsService.performanceFor(activityPerformances, Activity.ConeDrill),
|
perf_cone_drill: AssessmentsService.performanceFor(activityPerformances, Activity.ConeDrill),
|
||||||
})
|
})
|
||||||
|
.returning("id")
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
return result.numUpdatedRows > 0n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async delete(id: string, accountId: string): Promise<boolean> {
|
async delete(id: string, accountId: string): Promise<boolean> {
|
||||||
|
|||||||
@@ -1,19 +1,28 @@
|
|||||||
import { LevelCalculator, Standards, StandardsParamsSchema, StandardsDataSchema, type StandardsConfig, type LevelCalculatorOutput } from "@blade-and-brawn/calculator";
|
import { LevelCalculator, Standards, StandardsParamsSchema, StandardsDataSchema, type StandardsConfig, type LevelCalculatorOutput } from "@blade-and-brawn/calculator";
|
||||||
import type { ActivityPerformance, Player } from "@blade-and-brawn/domain";
|
import type { ActivityPerformance, Player } from "@blade-and-brawn/domain";
|
||||||
import { log } from "../util";
|
import { log } from "../util/log";
|
||||||
import { db } from "../database/db";
|
import { db } from "../database/db";
|
||||||
import { Value } from "@sinclair/typebox/value";
|
import { Value } from "@sinclair/typebox/value";
|
||||||
|
|
||||||
export class CalculatorUnavailableError extends Error {
|
export class CalculatorUnavailableError extends Error {
|
||||||
status: number = 503
|
status: number = 503
|
||||||
|
|
||||||
|
toResponse() {
|
||||||
|
return new Response(JSON.stringify({ error: this.message }), {
|
||||||
|
status: this.status,
|
||||||
|
headers: { 'content-type': 'application/json' }
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CalculatorService {
|
export class CalculatorService {
|
||||||
|
private static readonly DEFAULT_NAME = "Default";
|
||||||
|
|
||||||
private calculator: LevelCalculator | null = null;
|
private calculator: LevelCalculator | null = null;
|
||||||
Standards: CalculatorStandardsService;
|
Standards: CalculatorStandardsService;
|
||||||
|
|
||||||
constructor(private name: string) {
|
constructor() {
|
||||||
this.Standards = new CalculatorStandardsService(this.name);
|
this.Standards = new CalculatorStandardsService(CalculatorService.DEFAULT_NAME);
|
||||||
// eagerly load
|
// eagerly load
|
||||||
this.refresh().catch((err) => log.error({ err }, "failed to load initial standards config"));
|
this.refresh().catch((err) => log.error({ err }, "failed to load initial standards config"));
|
||||||
}
|
}
|
||||||
@@ -55,6 +64,9 @@ class CalculatorStandardsConfigService {
|
|||||||
config: null as StandardsConfig | null
|
config: null as StandardsConfig | null
|
||||||
},
|
},
|
||||||
isStale: async () => {
|
isStale: async () => {
|
||||||
|
// Becomes stale only when standards are switched
|
||||||
|
// We currently enforce read-only view of selected calculator's standards config
|
||||||
|
// So only way to update calculator is to make new standards config, edit, then switch
|
||||||
const { standards_config_id: selectedConfigId } = await db.selectFrom("calculators")
|
const { standards_config_id: selectedConfigId } = await db.selectFrom("calculators")
|
||||||
.select("standards_config_id")
|
.select("standards_config_id")
|
||||||
.where("name", "=", this.name)
|
.where("name", "=", this.name)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { PrintfulClient, ProductSyncer, WebflowClient } from "@blade-and-brawn/commerce";
|
import { PrintfulClient, ProductSyncer, WebflowClient } from "@blade-and-brawn/commerce";
|
||||||
import { env, log } from "../util";
|
import { env } from "../util/env";
|
||||||
|
import { log } from "../util/log";
|
||||||
import { db } from "../database/db";
|
import { db } from "../database/db";
|
||||||
import { defineEventType, EventQueue } from "./event-queue";
|
import { defineEventType, EventQueue } from "./event-queue";
|
||||||
import { Type as t } from "@sinclair/typebox";
|
import { Type as t } from "@sinclair/typebox";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { type Selectable, type Transaction } from "kysely";
|
import { type Selectable, type Transaction } from "kysely";
|
||||||
import type { DB } from "../database/out/db";
|
import type { DB } from "../database/out/db";
|
||||||
import { log } from "../util";
|
import { log } from "../util/log";
|
||||||
import { sleep } from "bun";
|
import { sleep } from "bun";
|
||||||
import { db } from "../database/db";
|
import { db } from "../database/db";
|
||||||
import { AssertError, Value } from "@sinclair/typebox/value";
|
import { AssertError, Value } from "@sinclair/typebox/value";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { t } from "elysia";
|
|||||||
import { sql, type Selectable, type Transaction } from "kysely";
|
import { sql, type Selectable, type Transaction } from "kysely";
|
||||||
import type { DB, JsonValue } from "../database/out/db";
|
import type { DB, JsonValue } from "../database/out/db";
|
||||||
import { db } from "../database/db";
|
import { db } from "../database/db";
|
||||||
import { log } from "../util";
|
import { log } from "../util/log";
|
||||||
import { minToMs } from "@blade-and-brawn/domain";
|
import { minToMs } from "@blade-and-brawn/domain";
|
||||||
|
|
||||||
export const EventStatusSchema = t.Union([
|
export const EventStatusSchema = t.Union([
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { AccountsService } from "./accounts";
|
||||||
|
import { AssessmentsService } from "./assessments";
|
||||||
|
import { CalculatorService } from "./calculator";
|
||||||
|
import { CommerceService } from "./commerce";
|
||||||
|
import { EventsService } from "./events";
|
||||||
|
import { StandardsService } from "./standards";
|
||||||
|
import { VerificationsService } from "./verifications";
|
||||||
|
|
||||||
|
export const s = (() => {
|
||||||
|
const Standards = new StandardsService();
|
||||||
|
const Calculator = new CalculatorService();
|
||||||
|
const Commerce = new CommerceService();
|
||||||
|
const Accounts = new AccountsService(Calculator);
|
||||||
|
const Events = new EventsService();
|
||||||
|
const Assessments = new AssessmentsService();
|
||||||
|
const Verifications = new VerificationsService();
|
||||||
|
return { Standards, Calculator, Commerce, Accounts, Events, Assessments, Verifications };
|
||||||
|
})();
|
||||||
|
|
||||||
|
export const queues = [
|
||||||
|
s.Commerce.Apparel.Syncs.Queue,
|
||||||
|
s.Commerce.Apparel.Orders.Queue,
|
||||||
|
] as const;
|
||||||
@@ -31,7 +31,7 @@ class StandardsConfigService {
|
|||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
async get(id: string): Promise<StandardsConfig & { id: string, name: string, datasetId: string }> {
|
async get(id: string): Promise<(StandardsConfig & { id: string, name: string, datasetId: string }) | undefined> {
|
||||||
const result = await db.selectFrom("standards_configs")
|
const result = await db.selectFrom("standards_configs")
|
||||||
.innerJoin("standards_datasets", "standards_datasets.id", "standards_configs.dataset_id")
|
.innerJoin("standards_datasets", "standards_datasets.id", "standards_configs.dataset_id")
|
||||||
.select([
|
.select([
|
||||||
@@ -42,7 +42,8 @@ class StandardsConfigService {
|
|||||||
"standards_datasets.data as data",
|
"standards_datasets.data as data",
|
||||||
])
|
])
|
||||||
.where("standards_configs.id", "=", id)
|
.where("standards_configs.id", "=", id)
|
||||||
.executeTakeFirstOrThrow({ errorConstructor: () => new Error(`No config with id "${id}"`) });
|
.executeTakeFirst();
|
||||||
|
if (!result) return;
|
||||||
Value.Assert(StandardsParamsSchema, result.params);
|
Value.Assert(StandardsParamsSchema, result.params);
|
||||||
Value.Assert(StandardsDataSchema, result.data);
|
Value.Assert(StandardsDataSchema, result.data);
|
||||||
return {
|
return {
|
||||||
@@ -54,24 +55,26 @@ class StandardsConfigService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(id: string, name: string, datasetId: string, params: StandardsParams) {
|
async update(id: string, name: string, datasetId: string, params: StandardsParams): Promise<boolean> {
|
||||||
const result = await db.updateTable("standards_configs")
|
const result = await db.updateTable("standards_configs")
|
||||||
.set({ name, params, dataset_id: datasetId })
|
.set({ name, params, dataset_id: datasetId })
|
||||||
.where("id", "=", id)
|
.where("id", "=", id)
|
||||||
.execute();
|
.executeTakeFirst();
|
||||||
if (result[0]?.numUpdatedRows === 0n) throw new Error(`No config with id "${id}"`);
|
return result.numUpdatedRows > 0n;
|
||||||
}
|
}
|
||||||
|
|
||||||
async delete(id: string) {
|
async count(): Promise<number> {
|
||||||
const { count } = await db.selectFrom("standards_configs")
|
const { count } = await db.selectFrom("standards_configs")
|
||||||
.select(db.fn.countAll<number>().as("count"))
|
.select(db.fn.countAll<number>().as("count"))
|
||||||
.executeTakeFirstOrThrow();
|
.executeTakeFirstOrThrow();
|
||||||
if (Number(count) <= 1) throw new Error("Cannot delete the last remaining standards configuration");
|
return Number(count);
|
||||||
|
}
|
||||||
|
|
||||||
|
async delete(id: string): Promise<boolean> {
|
||||||
const result = await db.deleteFrom("standards_configs")
|
const result = await db.deleteFrom("standards_configs")
|
||||||
.where("id", "=", id)
|
.where("id", "=", id)
|
||||||
.execute();
|
.executeTakeFirst();
|
||||||
if (result[0]?.numDeletedRows === 0n) throw new Error(`No config with id "${id}"`);
|
return result.numDeletedRows > 0n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,20 +86,21 @@ class StandardsDatasetService {
|
|||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
async get(id: string): Promise<{ id: string, name: string, data: StandardsData }> {
|
async get(id: string): Promise<{ id: string, name: string, data: StandardsData } | undefined> {
|
||||||
const result = await db.selectFrom("standards_datasets")
|
const result = await db.selectFrom("standards_datasets")
|
||||||
.select(["id", "name", "data"])
|
.select(["id", "name", "data"])
|
||||||
.where("id", "=", id)
|
.where("id", "=", id)
|
||||||
.executeTakeFirstOrThrow({ errorConstructor: () => new Error(`No dataset with id "${id}"`) });
|
.executeTakeFirst();
|
||||||
|
if (!result) return;
|
||||||
Value.Assert(StandardsDataSchema, result.data);
|
Value.Assert(StandardsDataSchema, result.data);
|
||||||
return { id: result.id, name: result.name, data: result.data };
|
return { id: result.id, name: result.name, data: result.data };
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(id: string, name: string) {
|
async update(id: string, name: string): Promise<boolean> {
|
||||||
const result = await db.updateTable("standards_datasets")
|
const result = await db.updateTable("standards_datasets")
|
||||||
.set({ name })
|
.set({ name })
|
||||||
.where("id", "=", id)
|
.where("id", "=", id)
|
||||||
.execute();
|
.executeTakeFirst();
|
||||||
if (result[0]?.numUpdatedRows === 0n) throw new Error(`No dataset with id "${id}"`);
|
return result.numUpdatedRows > 0n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,157 @@
|
|||||||
|
import { Activity, type ActivityVerifications } from "@blade-and-brawn/domain";
|
||||||
|
import type { Static } from "@sinclair/typebox";
|
||||||
|
import { t } from "elysia";
|
||||||
|
import { db } from "../database/db";
|
||||||
|
import { AccountsService } from "./accounts";
|
||||||
|
import { S3Client } from "bun";
|
||||||
|
|
||||||
|
export const VerificationStatusSchema = t.Union([
|
||||||
|
t.Literal("draft"),
|
||||||
|
t.Literal("submitted"),
|
||||||
|
t.Literal("in_review"),
|
||||||
|
t.Literal("action_requested"),
|
||||||
|
t.Literal("completed"),
|
||||||
|
]);
|
||||||
|
export type VerificationStatus = Static<typeof VerificationStatusSchema>;
|
||||||
|
|
||||||
|
const ALLOWED_FROM = {
|
||||||
|
reopen: ["draft", "action_requested"],
|
||||||
|
submit: ["draft"],
|
||||||
|
requestAction: ["submitted", "in_review"],
|
||||||
|
complete: ["submitted", "in_review"],
|
||||||
|
} satisfies Record<string, VerificationStatus[]>;
|
||||||
|
|
||||||
|
export class VerificationsService {
|
||||||
|
public static presignMediaUploads(s3Client: S3Client, assessmentId: string) {
|
||||||
|
return Object.values(Activity).map(() => s3Client.presign(`${assessmentId}/${crypto.randomUUID()}`, {
|
||||||
|
method: "PUT",
|
||||||
|
expiresIn: 30 * 60,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
async create(assessmentId: string) {
|
||||||
|
return await db.insertInto("verifications")
|
||||||
|
.values({ assessment_id: assessmentId, status: "draft" satisfies VerificationStatus })
|
||||||
|
.onConflict((oc) => oc.column("assessment_id").doNothing())
|
||||||
|
.returning(["id", "status"])
|
||||||
|
.executeTakeFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
async get(id: string, accountId?: string) {
|
||||||
|
return await VerificationsService.baseQuery()
|
||||||
|
.where("verifications.id", "=", id)
|
||||||
|
.$if(accountId !== undefined, (qb) => qb.where("assessments.account_id", "=", VerificationsService.accountIdQuery(accountId!)))
|
||||||
|
.executeTakeFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
async list(opt: {
|
||||||
|
filter?: { status?: VerificationStatus, accountId?: string },
|
||||||
|
limit?: number,
|
||||||
|
offset?: number,
|
||||||
|
} = {}) {
|
||||||
|
return await VerificationsService.baseQuery()
|
||||||
|
.$if(opt.filter?.status !== undefined, (qb) => qb
|
||||||
|
.where("verifications.status", "=", opt.filter!.status!)
|
||||||
|
)
|
||||||
|
.$if(opt.filter?.accountId !== undefined, (qb) => qb
|
||||||
|
.where("assessments.account_id", "=", VerificationsService.accountIdQuery(opt.filter!.accountId!))
|
||||||
|
)
|
||||||
|
.orderBy("verifications.submitted_at", (ob) => ob.desc().nullsLast())
|
||||||
|
.orderBy("verifications.created_at", "desc")
|
||||||
|
.$if(opt.limit !== undefined, (qb) => qb.limit(opt.limit!))
|
||||||
|
.$if(opt.offset !== undefined, (qb) => qb.offset(opt.offset!))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
async submit(id: string) {
|
||||||
|
return await db.updateTable("verifications")
|
||||||
|
.where("id", "=", id)
|
||||||
|
.where("status", "in", ALLOWED_FROM.submit)
|
||||||
|
.set({ status: "submitted" satisfies VerificationStatus, submitted_at: new Date() })
|
||||||
|
.returning(["id", "status"])
|
||||||
|
.executeTakeFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
async requestAction(id: string, reviewerNotes: string | null, activityVerifications: ActivityVerifications) {
|
||||||
|
return await db.updateTable("verifications")
|
||||||
|
.where("id", "=", id)
|
||||||
|
.where("status", "in", ALLOWED_FROM.requestAction)
|
||||||
|
.set({
|
||||||
|
status: "action_requested" satisfies VerificationStatus,
|
||||||
|
reviewer_notes: reviewerNotes,
|
||||||
|
verf_back_squat: activityVerifications[Activity.BackSquat] ?? null,
|
||||||
|
verf_deadlift: activityVerifications[Activity.Deadlift] ?? null,
|
||||||
|
verf_bench_press: activityVerifications[Activity.BenchPress] ?? null,
|
||||||
|
verf_broad_jump: activityVerifications[Activity.BroadJump] ?? null,
|
||||||
|
verf_run: activityVerifications[Activity.Run] ?? null,
|
||||||
|
verf_cone_drill: activityVerifications[Activity.ConeDrill] ?? null,
|
||||||
|
})
|
||||||
|
.returning(["id", "status"])
|
||||||
|
.executeTakeFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
async complete(id: string, completedBy: string, activityVerifications: ActivityVerifications) {
|
||||||
|
return await db.updateTable("verifications")
|
||||||
|
.where("id", "=", id)
|
||||||
|
.where("status", "in", ALLOWED_FROM.complete)
|
||||||
|
.set({
|
||||||
|
status: "completed" satisfies VerificationStatus,
|
||||||
|
completed_at: new Date(),
|
||||||
|
completed_by: completedBy,
|
||||||
|
verf_back_squat: activityVerifications[Activity.BackSquat] ?? null,
|
||||||
|
verf_deadlift: activityVerifications[Activity.Deadlift] ?? null,
|
||||||
|
verf_bench_press: activityVerifications[Activity.BenchPress] ?? null,
|
||||||
|
verf_broad_jump: activityVerifications[Activity.BroadJump] ?? null,
|
||||||
|
verf_run: activityVerifications[Activity.Run] ?? null,
|
||||||
|
verf_cone_drill: activityVerifications[Activity.ConeDrill] ?? null,
|
||||||
|
})
|
||||||
|
.returning(["id", "status"])
|
||||||
|
.executeTakeFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
async reopen(id: string) {
|
||||||
|
return await db.updateTable("verifications")
|
||||||
|
.where("id", "=", id)
|
||||||
|
.where("status", "in", ALLOWED_FROM.reopen)
|
||||||
|
.set({ status: "draft" satisfies VerificationStatus, submitted_at: null })
|
||||||
|
.returning(["id", "status"])
|
||||||
|
.executeTakeFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static accountIdQuery(accountId: string) {
|
||||||
|
return db.selectFrom("accounts")
|
||||||
|
.select("id")
|
||||||
|
.where(...AccountsService.idComparison(accountId));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static baseQuery() {
|
||||||
|
return db.selectFrom("verifications")
|
||||||
|
.innerJoin("assessments", "assessments.id", "verifications.assessment_id")
|
||||||
|
.select([
|
||||||
|
"verifications.id",
|
||||||
|
"verifications.assessment_id",
|
||||||
|
"verifications.status",
|
||||||
|
"verifications.created_at",
|
||||||
|
"verifications.submitted_at",
|
||||||
|
"verifications.completed_at",
|
||||||
|
"verifications.completed_by",
|
||||||
|
"verifications.reviewer_notes",
|
||||||
|
"verifications.verf_back_squat",
|
||||||
|
"verifications.verf_deadlift",
|
||||||
|
"verifications.verf_bench_press",
|
||||||
|
"verifications.verf_broad_jump",
|
||||||
|
"verifications.verf_run",
|
||||||
|
"verifications.verf_cone_drill",
|
||||||
|
"assessments.name",
|
||||||
|
"assessments.gender",
|
||||||
|
"assessments.age",
|
||||||
|
"assessments.weight",
|
||||||
|
"assessments.perf_back_squat",
|
||||||
|
"assessments.perf_deadlift",
|
||||||
|
"assessments.perf_bench_press",
|
||||||
|
"assessments.perf_broad_jump",
|
||||||
|
"assessments.perf_run",
|
||||||
|
"assessments.perf_cone_drill",
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { createHash } from "node:crypto";
|
||||||
|
|
||||||
|
export const DUMMY_PASSWORD_HASH = await Bun.password.hash("Dummy");
|
||||||
|
export const sha256Sum = (s: string) => createHash("sha256").update(s).digest();
|
||||||
@@ -1,15 +1,6 @@
|
|||||||
import cluster from 'node:cluster';
|
import cluster from 'node:cluster';
|
||||||
import { createHash } from 'node:crypto';
|
|
||||||
import { pino } from 'pino';
|
|
||||||
import os from 'node:os'
|
import os from 'node:os'
|
||||||
|
|
||||||
export const log = pino({
|
|
||||||
level: Bun.env.LOG_LEVEL ?? "info",
|
|
||||||
transport: Bun.env.NODE_ENV != "production"
|
|
||||||
? { target: "pino-pretty" }
|
|
||||||
: undefined,
|
|
||||||
});
|
|
||||||
|
|
||||||
export const env = {
|
export const env = {
|
||||||
PRINTFUL_AUTH: requireEnv("PRINTFUL_AUTH"),
|
PRINTFUL_AUTH: requireEnv("PRINTFUL_AUTH"),
|
||||||
PRINTFUL_STORE_ID: requireEnv("PRINTFUL_STORE_ID"),
|
PRINTFUL_STORE_ID: requireEnv("PRINTFUL_STORE_ID"),
|
||||||
@@ -31,17 +22,19 @@ export const env = {
|
|||||||
BOT_CLIENT_SECRET: requireEnv("BOT_CLIENT_SECRET"),
|
BOT_CLIENT_SECRET: requireEnv("BOT_CLIENT_SECRET"),
|
||||||
BOT_REDIRECT_URL: requireEnv("BOT_REDIRECT_URL"),
|
BOT_REDIRECT_URL: requireEnv("BOT_REDIRECT_URL"),
|
||||||
BOT_LOGIN_REDIRECT_URL: requireEnv("BOT_LOGIN_REDIRECT_URL"),
|
BOT_LOGIN_REDIRECT_URL: requireEnv("BOT_LOGIN_REDIRECT_URL"),
|
||||||
|
CLOUDFLARE_TOKEN: requireEnv("CLOUDFLARE_TOKEN"),
|
||||||
|
R2_ACCESS_KEY_ID: requireEnv("R2_ACCESS_KEY_ID"),
|
||||||
|
R2_SECRET_ACCESS_KEY: requireEnv("R2_SECRET_ACCESS_KEY"),
|
||||||
|
R2_URL: requireEnv("R2_URL")
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WORKER_COUNT = Math.min(os.availableParallelism(), +env.MAX_WORKER_COUNT);
|
export const WORKER_COUNT = Math.min(os.availableParallelism(), +env.MAX_WORKER_COUNT);
|
||||||
export const DEFAULT_NAME = "Default";
|
|
||||||
export const DUMMY_PASSWORD_HASH = await Bun.password.hash("Dummy");
|
|
||||||
|
|
||||||
function requireEnv(key: string): string {
|
function requireEnv(key: string): string {
|
||||||
const val = Bun.env[key];
|
const val = Bun.env[key];
|
||||||
if (!val) {
|
if (!val) {
|
||||||
if (cluster.worker?.id === 1)
|
if (cluster.worker?.id === 1)
|
||||||
log.error({ name: key }, "Missing required environment variable");
|
console.error({ name: key }, "Missing required environment variable");
|
||||||
throw new Error(`Missing required environment variable: ${key}`)
|
throw new Error(`Missing required environment variable: ${key}`)
|
||||||
};
|
};
|
||||||
return val;
|
return val;
|
||||||
@@ -51,10 +44,8 @@ function optionEnv(key: string, fallback: string = ""): string {
|
|||||||
const val = Bun.env[key];
|
const val = Bun.env[key];
|
||||||
if (!val) {
|
if (!val) {
|
||||||
if (cluster.worker?.id === 1)
|
if (cluster.worker?.id === 1)
|
||||||
log.warn({ name: key }, `Missing optional environmental variable, falling back to "${fallback}"`)
|
console.warn({ name: key }, `Missing optional environmental variable, falling back to "${fallback}"`)
|
||||||
return fallback
|
return fallback
|
||||||
};
|
};
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const sha256Sum = (s: string) => createHash("sha256").update(s).digest();
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
export class HttpError extends Error {
|
||||||
|
constructor(public status: number, message: string) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
toResponse() {
|
||||||
|
return Response.json({ error: this.message }, { status: this.status });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class BadRequestError extends HttpError {
|
||||||
|
constructor(message: string) { super(400, message); }
|
||||||
|
}
|
||||||
|
|
||||||
|
export class UnauthorizedError extends HttpError {
|
||||||
|
constructor(message: string) { super(401, message); }
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ForbiddenError extends HttpError {
|
||||||
|
constructor(message: string) { super(403, message); }
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ConflictError extends HttpError {
|
||||||
|
constructor(message: string) { super(409, message); }
|
||||||
|
}
|
||||||
|
|
||||||
|
export class BadGatewayError extends HttpError {
|
||||||
|
constructor(message: string) { super(502, message); }
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { pino } from 'pino';
|
||||||
|
|
||||||
|
export const log = pino({
|
||||||
|
level: Bun.env.LOG_LEVEL ?? "info",
|
||||||
|
transport: Bun.env.NODE_ENV != "production"
|
||||||
|
? { target: "pino-pretty" }
|
||||||
|
: undefined,
|
||||||
|
});
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { t } from 'elysia';
|
||||||
|
|
||||||
|
export const BigIntIdSchema = t.String({ pattern: "^\\d+$" });
|
||||||
|
export const AccountIdSchema = t.String({ pattern: "^(@.+|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$" });
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { S3Client } from "bun";
|
||||||
|
import { env } from "./env";
|
||||||
|
|
||||||
|
// All buckets should have a variant for development formatted as: "<bucket>-dev"
|
||||||
|
|
||||||
|
function bucketKeyForEnv(key: string) {
|
||||||
|
return `${key}${env.NODE_ENV === "production" ? "" : "-dev"}`
|
||||||
|
}
|
||||||
|
|
||||||
|
export const r2 = {
|
||||||
|
verificationMedia: new S3Client({
|
||||||
|
accessKeyId: env.R2_ACCESS_KEY_ID,
|
||||||
|
secretAccessKey: env.R2_SECRET_ACCESS_KEY,
|
||||||
|
bucket: bucketKeyForEnv("verification-media"),
|
||||||
|
endpoint: env.R2_URL,
|
||||||
|
})
|
||||||
|
};
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {},
|
"peerDependencies": {},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@blade-and-brawn/domain": "workspace:*",
|
||||||
"@elysia/eden": "^1.4.10",
|
"@elysia/eden": "^1.4.10",
|
||||||
"discord.js": "^14.27.0"
|
"discord.js": "^14.27.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { EmbedBuilder, type Message } from "discord.js";
|
import { EmbedBuilder, type Message } from "discord.js";
|
||||||
import type { Command } from "../service";
|
import type { Command } from "../../models";
|
||||||
import { api } from "../../../util";
|
import { api } from "../../util";
|
||||||
|
|
||||||
const ATTRIBUTE_EMOJI: Record<string, string> = {
|
const ATTRIBUTE_EMOJI: Record<string, string> = {
|
||||||
Strength: "💪",
|
Strength: "💪",
|
||||||
@@ -12,8 +12,11 @@ const ATTRIBUTE_EMOJI: Record<string, string> = {
|
|||||||
export default {
|
export default {
|
||||||
name: "stats",
|
name: "stats",
|
||||||
description: "View your fitness statistics!",
|
description: "View your fitness statistics!",
|
||||||
|
usage: ".stats",
|
||||||
execute: async (message: Message) => {
|
execute: async (message: Message) => {
|
||||||
const res = await api.accounts({ id: `@${message.author.id}` }).stats.get();
|
const res = await api.accounts({ id: `@${message.author.id}` }).stats.get();
|
||||||
|
if (res.error) return;
|
||||||
|
|
||||||
if (!res.data) {
|
if (!res.data) {
|
||||||
await message.reply("No stats found yet — submit an assessment first!");
|
await message.reply("No stats found yet — submit an assessment first!");
|
||||||
return;
|
return;
|
||||||
@@ -38,4 +41,4 @@ export default {
|
|||||||
|
|
||||||
await message.reply({ embeds: [embed] });
|
await message.reply({ embeds: [embed] });
|
||||||
}
|
}
|
||||||
} as Command;
|
} satisfies Command;
|
||||||
@@ -0,0 +1,299 @@
|
|||||||
|
import {
|
||||||
|
ActionRowBuilder,
|
||||||
|
ButtonBuilder,
|
||||||
|
ButtonStyle,
|
||||||
|
ComponentType,
|
||||||
|
EmbedBuilder,
|
||||||
|
MessageFlags,
|
||||||
|
ModalBuilder,
|
||||||
|
TextInputStyle,
|
||||||
|
type Message,
|
||||||
|
} from "discord.js";
|
||||||
|
import { Activity, cmToIn, kgToLb, type ActivityVerifications } from "@blade-and-brawn/domain";
|
||||||
|
import type { Command } from "../../models";
|
||||||
|
import { api } from "../../util";
|
||||||
|
|
||||||
|
const REVIEW_TIMEOUT_MS = 15 * 60_000;
|
||||||
|
const NOTES_TIMEOUT_MS = 10 * 60_000;
|
||||||
|
const MEDIA_TEXT_LIMIT = 3800;
|
||||||
|
|
||||||
|
const ACTIVITIES = Object.values(Activity);
|
||||||
|
|
||||||
|
const ACTIVITY_LABEL: Record<Activity, string> = {
|
||||||
|
[Activity.BackSquat]: "Back Squat",
|
||||||
|
[Activity.Deadlift]: "Deadlift",
|
||||||
|
[Activity.BenchPress]: "Bench Press",
|
||||||
|
[Activity.Run]: "Run",
|
||||||
|
[Activity.BroadJump]: "Broad Jump",
|
||||||
|
[Activity.ConeDrill]: "Cone Drill",
|
||||||
|
};
|
||||||
|
|
||||||
|
const VERF_COLUMN = {
|
||||||
|
[Activity.BackSquat]: "verf_back_squat",
|
||||||
|
[Activity.Deadlift]: "verf_deadlift",
|
||||||
|
[Activity.BenchPress]: "verf_bench_press",
|
||||||
|
[Activity.Run]: "verf_run",
|
||||||
|
[Activity.BroadJump]: "verf_broad_jump",
|
||||||
|
[Activity.ConeDrill]: "verf_cone_drill",
|
||||||
|
} as const satisfies Record<Activity, string>;
|
||||||
|
|
||||||
|
const PERF_COLUMN = {
|
||||||
|
[Activity.BackSquat]: "perf_back_squat",
|
||||||
|
[Activity.Deadlift]: "perf_deadlift",
|
||||||
|
[Activity.BenchPress]: "perf_bench_press",
|
||||||
|
[Activity.Run]: "perf_run",
|
||||||
|
[Activity.BroadJump]: "perf_broad_jump",
|
||||||
|
[Activity.ConeDrill]: "perf_cone_drill",
|
||||||
|
} as const satisfies Record<Activity, string>;
|
||||||
|
|
||||||
|
async function loadVerification(id: string) {
|
||||||
|
return await api.verifications({ id }).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
type Verification = NonNullable<Awaited<ReturnType<typeof loadVerification>>["data"]>;
|
||||||
|
type Result = boolean | null;
|
||||||
|
|
||||||
|
function formatPerformance(activity: Activity, value: number | null): string {
|
||||||
|
if (value === null) return "—";
|
||||||
|
switch (activity) {
|
||||||
|
case Activity.BackSquat:
|
||||||
|
case Activity.Deadlift:
|
||||||
|
case Activity.BenchPress:
|
||||||
|
return `${Math.round(kgToLb(value))} lb`;
|
||||||
|
case Activity.Run: {
|
||||||
|
const totalSeconds = Math.floor(value / 1000);
|
||||||
|
return `${Math.floor(totalSeconds / 60)}m ${totalSeconds % 60}s`;
|
||||||
|
}
|
||||||
|
case Activity.ConeDrill:
|
||||||
|
return `${(value / 1000).toFixed(2)} seconds`;
|
||||||
|
case Activity.BroadJump: {
|
||||||
|
const inches = cmToIn(value);
|
||||||
|
const ft = Math.floor(inches / 12);
|
||||||
|
return `${ft}' ${Math.round((inches - ft * 12) * 2) / 2}"`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatSize(bytes: number | undefined): string {
|
||||||
|
if (bytes === undefined) return "—";
|
||||||
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
||||||
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resultIcon(result: Result): string {
|
||||||
|
if (result === true) return "✅";
|
||||||
|
if (result === false) return "❌";
|
||||||
|
return "⬜";
|
||||||
|
}
|
||||||
|
|
||||||
|
function nextResult(result: Result): Result {
|
||||||
|
if (result === null) return true;
|
||||||
|
if (result === true) return false;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function errorText(error: { status: number, value: unknown }): string {
|
||||||
|
return (error.value as { error?: string } | undefined)?.error ?? "Something went wrong talking to the API.";
|
||||||
|
}
|
||||||
|
|
||||||
|
function mediaText(media: Verification["media"]): string {
|
||||||
|
if (media.length === 0) return "No media uploaded";
|
||||||
|
|
||||||
|
const lines: string[] = [];
|
||||||
|
let length = 0;
|
||||||
|
for (const [i, file] of media.entries()) {
|
||||||
|
const line = `[File ${i + 1}](${file.url}) · ${formatSize(file.size)}`;
|
||||||
|
if (length + line.length > MEDIA_TEXT_LIMIT) {
|
||||||
|
lines.push(`…and ${media.length - i} more (see the portal)`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
lines.push(line);
|
||||||
|
length += line.length + 1;
|
||||||
|
}
|
||||||
|
return lines.join("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "verify",
|
||||||
|
description: "Review a player's submitted verification",
|
||||||
|
usage: ".verify <user>",
|
||||||
|
execute: async (message: Message) => {
|
||||||
|
if (message.mentions.users.size > 1) {
|
||||||
|
await message.reply("Only one player may be provided.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const user = message.mentions.users.first();
|
||||||
|
if (!user) {
|
||||||
|
await message.reply("No valid player was provided.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const classmasterId = message.author.id;
|
||||||
|
|
||||||
|
const listRes = await api.accounts({ id: `@${user.id}` }).verifications.get({
|
||||||
|
query: { limit: 1, status: "submitted" },
|
||||||
|
});
|
||||||
|
if (listRes.error) {
|
||||||
|
await message.reply(errorText(listRes.error));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const latest = listRes.data[0];
|
||||||
|
if (!latest) {
|
||||||
|
await message.reply("This player has no submitted verification.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await loadVerification(latest.id);
|
||||||
|
if (res.error) {
|
||||||
|
await message.reply(errorText(res.error));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const v = res.data;
|
||||||
|
const results = Object.fromEntries(ACTIVITIES.map((a) => [a, v[VERF_COLUMN[a]]])) as Record<Activity, Result>;
|
||||||
|
let notes = v.reviewer_notes ?? "";
|
||||||
|
|
||||||
|
const reviewedCount = () => ACTIVITIES.filter((a) => results[a] !== null).length;
|
||||||
|
|
||||||
|
const embeds = () => [
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setColor(0xEEE8AA)
|
||||||
|
.setTitle(v.name)
|
||||||
|
.setDescription(`${user} · ${v.gender} · age ${v.age} · ${Math.round(kgToLb(v.weight))} lb`)
|
||||||
|
.addFields(
|
||||||
|
ACTIVITIES.map((a) => ({
|
||||||
|
name: ACTIVITY_LABEL[a],
|
||||||
|
value: formatPerformance(a, v[PERF_COLUMN[a]]),
|
||||||
|
inline: true,
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
.addFields(notes ? [{ name: "Reviewer notes", value: notes.slice(0, 1024) }] : [])
|
||||||
|
.setFooter({ text: `${reviewedCount()} / ${ACTIVITIES.length} reviewed · Click an activity to cycle Pass → Fail → Unreviewed` }),
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setTitle(`Media (${v.media.length})`)
|
||||||
|
.setDescription(mediaText(v.media)),
|
||||||
|
];
|
||||||
|
|
||||||
|
const components = () => [
|
||||||
|
new ActionRowBuilder<ButtonBuilder>().addComponents(ACTIVITIES.slice(0, 3).map(activityButton)),
|
||||||
|
new ActionRowBuilder<ButtonBuilder>().addComponents(ACTIVITIES.slice(3).map(activityButton)),
|
||||||
|
new ActionRowBuilder<ButtonBuilder>().addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("request-action")
|
||||||
|
.setLabel("Request action")
|
||||||
|
.setStyle(ButtonStyle.Primary),
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("complete")
|
||||||
|
.setLabel("Complete")
|
||||||
|
.setStyle(ButtonStyle.Success)
|
||||||
|
.setDisabled(reviewedCount() < ACTIVITIES.length),
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId("cancel")
|
||||||
|
.setLabel("Cancel")
|
||||||
|
.setStyle(ButtonStyle.Secondary),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
const activityButton = (activity: Activity) => new ButtonBuilder()
|
||||||
|
.setCustomId(`result:${activity}`)
|
||||||
|
.setLabel(`${resultIcon(results[activity])} ${ACTIVITY_LABEL[activity]}`)
|
||||||
|
.setStyle(results[activity] === true ? ButtonStyle.Success : results[activity] === false ? ButtonStyle.Danger : ButtonStyle.Secondary);
|
||||||
|
|
||||||
|
const activityVerifications = (): ActivityVerifications =>
|
||||||
|
Object.fromEntries(ACTIVITIES.filter((a) => results[a] !== null).map((a) => [a, results[a]]));
|
||||||
|
|
||||||
|
const reply = await message.reply({ embeds: embeds(), components: components() });
|
||||||
|
|
||||||
|
const finish = async (content: string) => {
|
||||||
|
collector.stop("done");
|
||||||
|
await reply.edit({ content, embeds: embeds(), components: [] });
|
||||||
|
};
|
||||||
|
|
||||||
|
const collector = reply.createMessageComponentCollector({ componentType: ComponentType.Button, time: REVIEW_TIMEOUT_MS });
|
||||||
|
|
||||||
|
collector.on("collect", async (i) => {
|
||||||
|
if (i.user.id !== classmasterId) {
|
||||||
|
await i.reply({ content: "Only the classmaster who ran this command can review it.", flags: MessageFlags.Ephemeral });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i.customId.startsWith("result:")) {
|
||||||
|
const activity = i.customId.slice("result:".length) as Activity;
|
||||||
|
results[activity] = nextResult(results[activity]);
|
||||||
|
await i.update({ embeds: embeds(), components: components() });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i.customId === "cancel") {
|
||||||
|
collector.stop("done");
|
||||||
|
await i.deferUpdate();
|
||||||
|
await reply.delete();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i.customId === "complete") {
|
||||||
|
await i.deferUpdate();
|
||||||
|
// TODO: drop completedBy once the bot authenticates as the classmaster
|
||||||
|
const res = await api.verifications({ id: v.id }).complete.post({
|
||||||
|
activityVerifications: activityVerifications(),
|
||||||
|
completedBy: `@${classmasterId}`,
|
||||||
|
});
|
||||||
|
if (res.error) {
|
||||||
|
await i.followUp({ content: errorText(res.error), flags: MessageFlags.Ephemeral });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await finish(`✅ Verification completed by ${i.user}.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i.customId === "request-action") {
|
||||||
|
const modalId = `request-action:${i.id}`;
|
||||||
|
await i.showModal(
|
||||||
|
new ModalBuilder()
|
||||||
|
.setCustomId(modalId)
|
||||||
|
.setTitle("Request action")
|
||||||
|
.addLabelComponents((label) => label
|
||||||
|
.setLabel("What needs to be fixed?")
|
||||||
|
.setTextInputComponent((input) => {
|
||||||
|
input
|
||||||
|
.setCustomId("notes")
|
||||||
|
.setStyle(TextInputStyle.Paragraph)
|
||||||
|
.setRequired(false)
|
||||||
|
.setMaxLength(1000);
|
||||||
|
return notes ? input.setValue(notes) : input;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const submitted = await i.awaitModalSubmit({
|
||||||
|
time: NOTES_TIMEOUT_MS,
|
||||||
|
filter: (m) => m.customId === modalId,
|
||||||
|
}).catch(() => null);
|
||||||
|
if (!submitted?.isFromMessage()) return;
|
||||||
|
|
||||||
|
await submitted.deferUpdate();
|
||||||
|
notes = submitted.fields.getTextInputValue("notes").trim();
|
||||||
|
|
||||||
|
const res = await api.verifications({ id: v.id })["request-action"].post({
|
||||||
|
reviewerNotes: notes || undefined,
|
||||||
|
activityVerifications: activityVerifications(),
|
||||||
|
});
|
||||||
|
if (res.error) {
|
||||||
|
await submitted.followUp({ content: errorText(res.error), flags: MessageFlags.Ephemeral });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await finish(`↩️ Action requested by ${i.user}.`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
collector.on("end", async (_, reason) => {
|
||||||
|
if (reason === "done") return;
|
||||||
|
await reply.edit({
|
||||||
|
content: "⌛ Review timed out. Run `.verify` again to continue.",
|
||||||
|
components: [],
|
||||||
|
}).catch(() => { });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} satisfies Command;
|
||||||
+10
-12
@@ -1,20 +1,13 @@
|
|||||||
import { Client, Events, GatewayIntentBits } from 'discord.js';
|
import { Client, Events, GatewayIntentBits } from 'discord.js';
|
||||||
import { CommandService } from './services/cmd/service';
|
import CommandService from './services/command';
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
|
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
|
||||||
});
|
});
|
||||||
|
|
||||||
// SERVICES
|
|
||||||
// -----------------------
|
|
||||||
const s = (() => {
|
|
||||||
const Commands = new CommandService(client);
|
|
||||||
return { Commands };
|
|
||||||
})();
|
|
||||||
|
|
||||||
client.once(Events.ClientReady, async (readyClient) => {
|
client.once(Events.ClientReady, async (readyClient) => {
|
||||||
// Initialize
|
// Initialize services
|
||||||
await s.Commands.init();
|
await CommandService.init();
|
||||||
|
|
||||||
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
|
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
|
||||||
});
|
});
|
||||||
@@ -25,8 +18,13 @@ client.on("guildMemberAdd", async (guildMember) => {
|
|||||||
client.on("messageCreate", async (message) => {
|
client.on("messageCreate", async (message) => {
|
||||||
if (message.author.bot) return;
|
if (message.author.bot) return;
|
||||||
|
|
||||||
const command = s.Commands.parse(message);
|
try {
|
||||||
if (command) command.execute(message);
|
const command = CommandService.parse(message);
|
||||||
|
if (command) await command.execute(message);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
client.login(Bun.env.BOT_TOKEN);
|
client.login(Bun.env.BOT_TOKEN);
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import type { Message } from "discord.js";
|
||||||
|
|
||||||
|
// COMMANDS
|
||||||
|
|
||||||
|
export interface Command {
|
||||||
|
name: string,
|
||||||
|
description: string,
|
||||||
|
usage: string,
|
||||||
|
execute: (message: Message) => void | Promise<void>
|
||||||
|
}
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import type { Client, Message } from "discord.js";
|
|
||||||
import { readdir } from "fs/promises";
|
|
||||||
|
|
||||||
const CMD_PREFIX = ".";
|
|
||||||
|
|
||||||
export interface Command {
|
|
||||||
name: string,
|
|
||||||
description: string,
|
|
||||||
execute: (message: Message) => void | Promise<void>
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CommandService {
|
|
||||||
private client: Client
|
|
||||||
private registry: Record<string, Command> = {}
|
|
||||||
|
|
||||||
constructor(client: Client) {
|
|
||||||
this.client = client;
|
|
||||||
}
|
|
||||||
|
|
||||||
async init() {
|
|
||||||
const commands = await Promise.all(
|
|
||||||
(await readdir(`${import.meta.dir}/registry`)).map(async file => (await import(`./registry/${file}`)).default as Command)
|
|
||||||
);
|
|
||||||
for (const command of commands)
|
|
||||||
this.registry[command.name] = command;
|
|
||||||
};
|
|
||||||
|
|
||||||
parse(message: Message): Command | undefined {
|
|
||||||
if (!message.content.startsWith(CMD_PREFIX)) return;
|
|
||||||
const name = message.content.slice(CMD_PREFIX.length).split(/\s+/)[0];
|
|
||||||
return this.registry[name ?? ""];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import type { Message } from "discord.js";
|
||||||
|
import { readdir } from "fs/promises";
|
||||||
|
import { dirname } from "path";
|
||||||
|
import type { Command } from "../models";
|
||||||
|
|
||||||
|
const CMD_PREFIX = ".";
|
||||||
|
const CMD_REGISTRY_DIR = `${dirname(Bun.main)}/cmd/registry`;
|
||||||
|
|
||||||
|
export default abstract class CommandService {
|
||||||
|
private static registry: Record<string, Command> = {}
|
||||||
|
|
||||||
|
static async init() {
|
||||||
|
const commands = await Promise.all(
|
||||||
|
(await readdir(CMD_REGISTRY_DIR)).map(async file => (await import(`${CMD_REGISTRY_DIR}/${file}`)).default satisfies Command)
|
||||||
|
);
|
||||||
|
for (const command of commands)
|
||||||
|
CommandService.registry[command.name] = command;
|
||||||
|
};
|
||||||
|
|
||||||
|
static parse(message: Message): Command | undefined {
|
||||||
|
if (!message.content.startsWith(CMD_PREFIX)) return;
|
||||||
|
const name = message.content.slice(CMD_PREFIX.length).split(/\s+/)[0];
|
||||||
|
return this.registry[name ?? ""];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
"@sveltejs/kit": "^2.70.3",
|
"@sveltejs/kit": "^2.70.3",
|
||||||
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
||||||
"elysia": "^1.4.30",
|
"elysia": "^1.4.30",
|
||||||
"svelte": "^5.57.0",
|
"svelte": "^5.57.1",
|
||||||
"svelte-adapter-bun": "^1.0.1",
|
"svelte-adapter-bun": "^1.0.1",
|
||||||
"svelte-check": "^4.7.6",
|
"svelte-check": "^4.7.6",
|
||||||
"vite": "^7.3.6"
|
"vite": "^7.3.6"
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"@blade-and-brawn/domain": "workspace:*",
|
"@blade-and-brawn/domain": "workspace:*",
|
||||||
"@elysia/eden": "^1.4.10",
|
"@elysia/eden": "^1.4.10",
|
||||||
"@tailwindcss/vite": "^4.3.3",
|
"@tailwindcss/vite": "^4.3.3",
|
||||||
"daisyui": "^5.7.38",
|
"daisyui": "^5.7.47",
|
||||||
"jose": "^6.2.12",
|
"jose": "^6.2.12",
|
||||||
"tailwindcss": "^4.3.3"
|
"tailwindcss": "^4.3.3"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
import { api } from "$lib/api";
|
import { api } from "$lib/api";
|
||||||
|
|
||||||
type AssessmentRow = NonNullable<
|
type AssessmentRow = NonNullable<
|
||||||
Awaited<ReturnType<typeof api.assessments.me.get>>["data"]
|
Awaited<ReturnType<typeof api.accounts.me.assessments.get>>["data"]
|
||||||
>[number];
|
>[number];
|
||||||
|
|
||||||
interface CalcData {
|
interface CalcData {
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
loading = true;
|
loading = true;
|
||||||
loadError = null;
|
loadError = null;
|
||||||
try {
|
try {
|
||||||
const res = await api.assessments.me.get();
|
const res = await api.accounts.me.assessments.get();
|
||||||
if (res.error) throw res.error;
|
if (res.error) throw res.error;
|
||||||
calculations = (res.data ?? []).map(assessmentToCalc);
|
calculations = (res.data ?? []).map(assessmentToCalc);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
});
|
});
|
||||||
if (res.error) throw res.error;
|
if (res.error) throw res.error;
|
||||||
} else {
|
} else {
|
||||||
const res = await api.assessments.me.post({
|
const res = await api.accounts.me.assessments.post({
|
||||||
player: calculation.player,
|
player: calculation.player,
|
||||||
activityPerformances: calculation.activityPerformances,
|
activityPerformances: calculation.activityPerformances,
|
||||||
});
|
});
|
||||||
@@ -162,7 +162,7 @@
|
|||||||
calculation.deleting = true;
|
calculation.deleting = true;
|
||||||
calculation.deleteError = undefined;
|
calculation.deleteError = undefined;
|
||||||
try {
|
try {
|
||||||
const res = await api.assessments.me({ id: calculation.id }).delete();
|
const res = await api.accounts.me.assessments({ id: calculation.id }).delete();
|
||||||
if (res.error) throw res.error;
|
if (res.error) throw res.error;
|
||||||
calculations.splice(index, 1);
|
calculations.splice(index, 1);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -25,6 +25,11 @@
|
|||||||
path: "/activity",
|
path: "/activity",
|
||||||
links: [{ name: "Events", path: "/events" }],
|
links: [{ name: "Events", path: "/events" }],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Verification",
|
||||||
|
path: "/verification",
|
||||||
|
links: [{ name: "Verifications", path: "/verifications" }],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
let { children } = $props();
|
let { children } = $props();
|
||||||
|
|||||||
@@ -0,0 +1,157 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { api } from "$lib/api";
|
||||||
|
import type { VerificationStatus } from "@blade-and-brawn/api";
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
|
||||||
|
type VerificationRow = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof api.verifications.get>>["data"]
|
||||||
|
>[number];
|
||||||
|
|
||||||
|
const LIMIT = 25;
|
||||||
|
|
||||||
|
const STATUS_BADGE: Record<VerificationStatus, string> = {
|
||||||
|
draft: "badge-ghost",
|
||||||
|
submitted: "badge-info",
|
||||||
|
in_review: "badge-warning",
|
||||||
|
action_requested: "badge-error",
|
||||||
|
completed: "badge-success",
|
||||||
|
};
|
||||||
|
|
||||||
|
function formatDate(value: string | Date | null): string {
|
||||||
|
if (!value) return "—";
|
||||||
|
return new Date(value).toLocaleString();
|
||||||
|
}
|
||||||
|
|
||||||
|
function errorMessage(err: unknown): string {
|
||||||
|
const value = (err as { value?: { error?: string } })?.value;
|
||||||
|
return (
|
||||||
|
value?.error ??
|
||||||
|
(err instanceof Error ? err.message : "Unknown error")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let verifications = $state<VerificationRow[]>([]);
|
||||||
|
let loading = $state(true);
|
||||||
|
let loadError = $state<string | null>(null);
|
||||||
|
let offset = $state(0);
|
||||||
|
let status = $state<VerificationStatus | "">("submitted");
|
||||||
|
|
||||||
|
async function refresh() {
|
||||||
|
loading = true;
|
||||||
|
loadError = null;
|
||||||
|
try {
|
||||||
|
const res = await api.verifications.get({
|
||||||
|
query: { status: status || undefined, limit: LIMIT, offset },
|
||||||
|
});
|
||||||
|
if (res.error) throw res.error;
|
||||||
|
verifications = res.data as VerificationRow[];
|
||||||
|
} catch (err) {
|
||||||
|
loadError = errorMessage(err);
|
||||||
|
} finally {
|
||||||
|
loading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setStatus(value: string) {
|
||||||
|
status = value as VerificationStatus | "";
|
||||||
|
offset = 0;
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
function prevPage() {
|
||||||
|
offset = Math.max(0, offset - LIMIT);
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
function nextPage() {
|
||||||
|
offset += LIMIT;
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(refresh);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="w-full flex items-center gap-2 flex-wrap mt-10 mb-5">
|
||||||
|
<select
|
||||||
|
class="select select-sm w-44"
|
||||||
|
value={status}
|
||||||
|
onchange={(e) => setStatus(e.currentTarget.value)}
|
||||||
|
>
|
||||||
|
<option value="">All statuses</option>
|
||||||
|
<option value="draft">Draft</option>
|
||||||
|
<option value="submitted">Submitted</option>
|
||||||
|
<option value="action_requested">Action requested</option>
|
||||||
|
<option value="completed">Completed</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="btn btn-secondary btn-sm"
|
||||||
|
onclick={refresh}
|
||||||
|
disabled={loading}
|
||||||
|
>
|
||||||
|
{loading ? "Refreshing..." : "Refresh"}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="flex-1"></div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="btn btn-neutral btn-sm"
|
||||||
|
onclick={prevPage}
|
||||||
|
disabled={offset === 0 || loading}
|
||||||
|
>
|
||||||
|
Prev
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-neutral btn-sm"
|
||||||
|
onclick={nextPage}
|
||||||
|
disabled={verifications.length < LIMIT || loading}
|
||||||
|
>
|
||||||
|
Next
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if loadError}
|
||||||
|
<div role="alert" class="alert alert-error w-full mb-4">
|
||||||
|
<span>{loadError}</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="w-full overflow-x-auto">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Player</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Submitted</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{#each verifications as row (row.id)}
|
||||||
|
<tr class="hover:bg-base-300">
|
||||||
|
<td>{row.name}</td>
|
||||||
|
<td>
|
||||||
|
<div class="badge {STATUS_BADGE[row.status as VerificationStatus]}">
|
||||||
|
{row.status}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="whitespace-nowrap">{formatDate(row.submitted_at)}</td>
|
||||||
|
<td>
|
||||||
|
<a
|
||||||
|
class="btn btn-primary btn-xs"
|
||||||
|
href="/verification/verifications/{row.id}"
|
||||||
|
>
|
||||||
|
Review
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{:else}
|
||||||
|
<tr>
|
||||||
|
<td colspan="4" class="text-center opacity-60">
|
||||||
|
{loading ? "Loading..." : "No verifications"}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,365 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { goto } from "$app/navigation";
|
||||||
|
import { api } from "$lib/api";
|
||||||
|
import { Activity, cmToIn, kgToLb } from "@blade-and-brawn/domain";
|
||||||
|
import type { ActivityVerifications } from "@blade-and-brawn/domain";
|
||||||
|
import type { VerificationStatus } from "@blade-and-brawn/api";
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
import type { PageProps } from "./$types";
|
||||||
|
|
||||||
|
async function loadVerification(id: string) {
|
||||||
|
return await api.verifications({ id }).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
type VerificationDetail = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof loadVerification>>["data"]
|
||||||
|
>;
|
||||||
|
type VerfChoice = "unset" | "pass" | "fail";
|
||||||
|
|
||||||
|
const ACTIVITIES = Object.values(Activity);
|
||||||
|
|
||||||
|
const STATUS_BADGE: Record<VerificationStatus, string> = {
|
||||||
|
draft: "badge-ghost",
|
||||||
|
submitted: "badge-info",
|
||||||
|
in_review: "badge-warning",
|
||||||
|
action_requested: "badge-error",
|
||||||
|
completed: "badge-success",
|
||||||
|
};
|
||||||
|
|
||||||
|
const VERF_COLUMN = {
|
||||||
|
[Activity.BackSquat]: "verf_back_squat",
|
||||||
|
[Activity.Deadlift]: "verf_deadlift",
|
||||||
|
[Activity.BenchPress]: "verf_bench_press",
|
||||||
|
[Activity.Run]: "verf_run",
|
||||||
|
[Activity.BroadJump]: "verf_broad_jump",
|
||||||
|
[Activity.ConeDrill]: "verf_cone_drill",
|
||||||
|
} as const satisfies Record<Activity, keyof VerificationDetail>;
|
||||||
|
|
||||||
|
const PERF_COLUMN = {
|
||||||
|
[Activity.BackSquat]: "perf_back_squat",
|
||||||
|
[Activity.Deadlift]: "perf_deadlift",
|
||||||
|
[Activity.BenchPress]: "perf_bench_press",
|
||||||
|
[Activity.Run]: "perf_run",
|
||||||
|
[Activity.BroadJump]: "perf_broad_jump",
|
||||||
|
[Activity.ConeDrill]: "perf_cone_drill",
|
||||||
|
} as const satisfies Record<Activity, keyof VerificationDetail>;
|
||||||
|
|
||||||
|
function formatPerformance(activity: Activity, value: number | null): string {
|
||||||
|
if (value === null) return "—";
|
||||||
|
switch (activity) {
|
||||||
|
case Activity.BackSquat:
|
||||||
|
case Activity.Deadlift:
|
||||||
|
case Activity.BenchPress:
|
||||||
|
return `${Math.round(kgToLb(value))} lb`;
|
||||||
|
case Activity.Run: {
|
||||||
|
const totalSeconds = Math.floor(value / 1000);
|
||||||
|
const minutes = Math.floor(totalSeconds / 60);
|
||||||
|
const seconds = totalSeconds % 60;
|
||||||
|
return `${minutes}m ${seconds}s`;
|
||||||
|
}
|
||||||
|
case Activity.ConeDrill:
|
||||||
|
return `${(value / 1000).toFixed(2)} seconds`;
|
||||||
|
case Activity.BroadJump: {
|
||||||
|
const inches = cmToIn(value);
|
||||||
|
const ft = Math.floor(inches / 12);
|
||||||
|
const rem = Math.round((inches - ft * 12) * 2) / 2;
|
||||||
|
return `${ft}' ${rem}"`;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return "—";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function verfChoiceFrom(value: boolean | null): VerfChoice {
|
||||||
|
if (value === true) return "pass";
|
||||||
|
if (value === false) return "fail";
|
||||||
|
return "unset";
|
||||||
|
}
|
||||||
|
|
||||||
|
function toActivityVerifications(
|
||||||
|
choices: Record<Activity, VerfChoice>,
|
||||||
|
): ActivityVerifications {
|
||||||
|
const result: ActivityVerifications = {};
|
||||||
|
for (const activity of ACTIVITIES) {
|
||||||
|
if (choices[activity] === "pass") result[activity] = true;
|
||||||
|
else if (choices[activity] === "fail") result[activity] = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatSize(bytes: number | undefined): string {
|
||||||
|
if (bytes === undefined) return "—";
|
||||||
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
||||||
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDate(value: string | undefined): string {
|
||||||
|
return value ? new Date(value).toLocaleString() : "—";
|
||||||
|
}
|
||||||
|
|
||||||
|
function errorMessage(err: unknown): string {
|
||||||
|
const value = (err as { value?: { error?: string } })?.value;
|
||||||
|
return (
|
||||||
|
value?.error ??
|
||||||
|
(err instanceof Error ? err.message : "Unknown error")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let { params }: PageProps = $props();
|
||||||
|
const id = $derived(params.id);
|
||||||
|
|
||||||
|
let verification = $state<VerificationDetail | null>(null);
|
||||||
|
let loading = $state(true);
|
||||||
|
let loadError = $state<string | null>(null);
|
||||||
|
let notes = $state("");
|
||||||
|
let verf = $state<Record<Activity, VerfChoice>>(
|
||||||
|
Object.fromEntries(ACTIVITIES.map((a) => [a, "unset"])) as Record<
|
||||||
|
Activity,
|
||||||
|
VerfChoice
|
||||||
|
>,
|
||||||
|
);
|
||||||
|
let submitting = $state<"action" | "complete" | undefined>();
|
||||||
|
let submitError = $state<string | null>(null);
|
||||||
|
|
||||||
|
const reviewedCount = $derived(
|
||||||
|
ACTIVITIES.filter((a) => verf[a] !== "unset").length,
|
||||||
|
);
|
||||||
|
const allReviewed = $derived(reviewedCount === ACTIVITIES.length);
|
||||||
|
const isReadOnly = $derived(
|
||||||
|
verification?.status !== "submitted" &&
|
||||||
|
verification?.status !== "in_review",
|
||||||
|
);
|
||||||
|
|
||||||
|
async function load() {
|
||||||
|
loading = true;
|
||||||
|
loadError = null;
|
||||||
|
try {
|
||||||
|
const res = await loadVerification(id);
|
||||||
|
if (res.error) throw res.error;
|
||||||
|
if (!res.data) throw new Error("Verification not found");
|
||||||
|
verification = res.data;
|
||||||
|
notes = verification.reviewer_notes ?? "";
|
||||||
|
verf = Object.fromEntries(
|
||||||
|
ACTIVITIES.map((a) => [
|
||||||
|
a,
|
||||||
|
verfChoiceFrom(verification![VERF_COLUMN[a]]),
|
||||||
|
]),
|
||||||
|
) as Record<Activity, VerfChoice>;
|
||||||
|
} catch (err) {
|
||||||
|
loadError = errorMessage(err);
|
||||||
|
} finally {
|
||||||
|
loading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleVerf(activity: Activity, choice: VerfChoice) {
|
||||||
|
if (isReadOnly) return;
|
||||||
|
verf[activity] = verf[activity] === choice ? "unset" : choice;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function requestAction() {
|
||||||
|
submitting = "action";
|
||||||
|
submitError = null;
|
||||||
|
try {
|
||||||
|
const res = await api
|
||||||
|
.verifications({ id })
|
||||||
|
["request-action"].post({
|
||||||
|
reviewerNotes: notes || undefined,
|
||||||
|
activityVerifications: toActivityVerifications(verf),
|
||||||
|
});
|
||||||
|
if (res.error) throw res.error;
|
||||||
|
await goto("/verification/verifications");
|
||||||
|
} catch (err) {
|
||||||
|
submitError = errorMessage(err);
|
||||||
|
} finally {
|
||||||
|
submitting = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function complete() {
|
||||||
|
submitting = "complete";
|
||||||
|
submitError = null;
|
||||||
|
try {
|
||||||
|
const res = await api.verifications({ id }).complete.post({
|
||||||
|
activityVerifications: toActivityVerifications(verf),
|
||||||
|
});
|
||||||
|
if (res.error) throw res.error;
|
||||||
|
await goto("/verification/verifications");
|
||||||
|
} catch (err) {
|
||||||
|
submitError = errorMessage(err);
|
||||||
|
} finally {
|
||||||
|
submitting = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(load);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="w-full mt-10 mb-5">
|
||||||
|
<a
|
||||||
|
href="/verification/verifications"
|
||||||
|
class="link link-hover text-sm opacity-70">← Back to verifications</a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if loading}
|
||||||
|
<div class="w-full flex justify-center pt-10">
|
||||||
|
<span class="loading loading-spinner loading-lg"></span>
|
||||||
|
</div>
|
||||||
|
{:else if loadError}
|
||||||
|
<div role="alert" class="alert alert-error w-full mb-4">
|
||||||
|
<span>{loadError}</span>
|
||||||
|
</div>
|
||||||
|
{:else if verification}
|
||||||
|
{@const v = verification}
|
||||||
|
<div class="w-full flex items-center gap-3 flex-wrap mb-6">
|
||||||
|
<h1 class="text-xl font-semibold">{v.name}</h1>
|
||||||
|
<div class="badge {STATUS_BADGE[v.status as VerificationStatus]}">
|
||||||
|
{v.status}
|
||||||
|
</div>
|
||||||
|
<span class="text-sm opacity-70"
|
||||||
|
>{v.gender} · age {v.age} · {Math.round(kgToLb(v.weight))} lb</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="w-full flex flex-col gap-4 bg-base-200/60 rounded-lg p-6">
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<h2 class="text-lg font-semibold">Activities</h2>
|
||||||
|
<span class="text-sm opacity-70"
|
||||||
|
>{reviewedCount} / {ACTIVITIES.length} reviewed</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="overflow-x-auto">
|
||||||
|
<table class="table table-sm">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Activity</th>
|
||||||
|
<th>Claimed</th>
|
||||||
|
<th>Result</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{#each ACTIVITIES as activity (activity)}
|
||||||
|
<tr>
|
||||||
|
<td>{activity}</td>
|
||||||
|
<td class="font-semibold">
|
||||||
|
{formatPerformance(
|
||||||
|
activity,
|
||||||
|
v[PERF_COLUMN[activity]],
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="join">
|
||||||
|
<button
|
||||||
|
class="btn btn-xs join-item {verf[
|
||||||
|
activity
|
||||||
|
] === 'pass'
|
||||||
|
? 'btn-success'
|
||||||
|
: 'btn-outline btn-success'}"
|
||||||
|
disabled={isReadOnly}
|
||||||
|
onclick={() =>
|
||||||
|
toggleVerf(activity, "pass")}
|
||||||
|
>
|
||||||
|
Pass
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-xs join-item {verf[
|
||||||
|
activity
|
||||||
|
] === 'fail'
|
||||||
|
? 'btn-error'
|
||||||
|
: 'btn-outline btn-error'}"
|
||||||
|
disabled={isReadOnly}
|
||||||
|
onclick={() =>
|
||||||
|
toggleVerf(activity, "fail")}
|
||||||
|
>
|
||||||
|
Fail
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="w-full flex flex-col gap-4 bg-base-200/60 rounded-lg p-6 mt-4">
|
||||||
|
<h2 class="text-lg font-semibold">Media ({v.media.length})</h2>
|
||||||
|
|
||||||
|
{#if v.media.length === 0}
|
||||||
|
<span class="opacity-60">No media uploaded</span>
|
||||||
|
{:else}
|
||||||
|
<ul class="flex flex-col gap-2">
|
||||||
|
{#each v.media as file, i (file.key)}
|
||||||
|
<li class="flex items-center gap-3 flex-wrap">
|
||||||
|
<a
|
||||||
|
class="link link-primary"
|
||||||
|
href={file.url}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
File {i + 1}
|
||||||
|
</a>
|
||||||
|
<span class="text-xs opacity-60">
|
||||||
|
{formatSize(file.size)} · uploaded {formatDate(
|
||||||
|
file.lastModified,
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="w-full flex flex-col gap-4 bg-base-200/60 rounded-lg p-6 mt-4">
|
||||||
|
<label class="form-control">
|
||||||
|
<span class="label mb-1 text-xs">Reviewer notes</span>
|
||||||
|
<textarea
|
||||||
|
class="textarea textarea-bordered w-full"
|
||||||
|
rows="3"
|
||||||
|
placeholder="What needs to be fixed?"
|
||||||
|
disabled={isReadOnly}
|
||||||
|
bind:value={notes}
|
||||||
|
></textarea>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
{#if submitError}
|
||||||
|
<div role="alert" class="alert alert-error">
|
||||||
|
<span>{submitError}</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="flex items-center gap-2 justify-end">
|
||||||
|
{#if isReadOnly}
|
||||||
|
<span class="text-sm opacity-70">
|
||||||
|
{v.status === "completed"
|
||||||
|
? "This verification is completed and read-only."
|
||||||
|
: v.status === "draft"
|
||||||
|
? "This verification is still a draft (the player hasn't finished uploading) and is read-only."
|
||||||
|
: "This verification is waiting on the player to resubmit and is read-only."}
|
||||||
|
</span>
|
||||||
|
{:else}
|
||||||
|
{#if !allReviewed}
|
||||||
|
<span class="text-xs text-warning"
|
||||||
|
>Mark every activity Pass or Fail to complete</span
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
|
<button
|
||||||
|
class="btn btn-warning"
|
||||||
|
disabled={!!submitting}
|
||||||
|
onclick={requestAction}
|
||||||
|
>
|
||||||
|
{submitting === "action" ? "Submitting..." : "Request action"}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-success"
|
||||||
|
disabled={!!submitting || !allReviewed}
|
||||||
|
onclick={complete}
|
||||||
|
>
|
||||||
|
{submitting === "complete" ? "Submitting..." : "Complete"}
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
{
|
{
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 2,
|
||||||
"configVersion": 0,
|
"configVersion": 1,
|
||||||
"workspaces": {
|
"workspaces": {
|
||||||
"": {
|
"": {
|
||||||
"name": "blade-and-brawn",
|
"name": "blade-and-brawn",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sinclair/typebox": "^0.34.52",
|
"@sinclair/typebox": "^0.34.52",
|
||||||
"pino": "^10.3.1",
|
"pino": "^10.4.0",
|
||||||
|
"pino-pretty": "^13.1.3",
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/bun": "^1.4.2",
|
"@types/bun": "^1.4.2",
|
||||||
"typescript": "^7.0.2",
|
"@types/node": "^26.6.4",
|
||||||
|
"@typescript/native": "npm:typescript@7",
|
||||||
|
"typescript": "~6",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"apps/api": {
|
"apps/api": {
|
||||||
@@ -26,17 +29,17 @@
|
|||||||
"elysia": "^1.4.30",
|
"elysia": "^1.4.30",
|
||||||
"kysely": "^0.29.6",
|
"kysely": "^0.29.6",
|
||||||
"ml-levenberg-marquardt": "^5.1.0",
|
"ml-levenberg-marquardt": "^5.1.0",
|
||||||
"pg": "^8.23.0",
|
"pg": "^8.23.1",
|
||||||
"zipcodes-us": "^1.1.3",
|
"zipcodes-us": "^1.2.0",
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"kysely-codegen": "^0.20.0",
|
"kysely-codegen": "^0.20.0",
|
||||||
"pino-pretty": "^13.1.3",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"apps/bot": {
|
"apps/bot": {
|
||||||
"name": "@blade-and-brawn/bot",
|
"name": "@blade-and-brawn/bot",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@blade-and-brawn/domain": "workspace:*",
|
||||||
"@elysia/eden": "^1.4.10",
|
"@elysia/eden": "^1.4.10",
|
||||||
"discord.js": "^14.27.0",
|
"discord.js": "^14.27.0",
|
||||||
},
|
},
|
||||||
@@ -52,7 +55,7 @@
|
|||||||
"@blade-and-brawn/domain": "workspace:*",
|
"@blade-and-brawn/domain": "workspace:*",
|
||||||
"@elysia/eden": "^1.4.10",
|
"@elysia/eden": "^1.4.10",
|
||||||
"@tailwindcss/vite": "^4.3.3",
|
"@tailwindcss/vite": "^4.3.3",
|
||||||
"daisyui": "^5.7.38",
|
"daisyui": "^5.7.47",
|
||||||
"jose": "^6.2.12",
|
"jose": "^6.2.12",
|
||||||
"tailwindcss": "^4.3.3",
|
"tailwindcss": "^4.3.3",
|
||||||
},
|
},
|
||||||
@@ -61,7 +64,7 @@
|
|||||||
"@sveltejs/kit": "^2.70.3",
|
"@sveltejs/kit": "^2.70.3",
|
||||||
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
||||||
"elysia": "^1.4.30",
|
"elysia": "^1.4.30",
|
||||||
"svelte": "^5.57.0",
|
"svelte": "^5.57.1",
|
||||||
"svelte-adapter-bun": "^1.0.1",
|
"svelte-adapter-bun": "^1.0.1",
|
||||||
"svelte-check": "^4.7.6",
|
"svelte-check": "^4.7.6",
|
||||||
"vite": "^7.3.6",
|
"vite": "^7.3.6",
|
||||||
@@ -193,93 +196,93 @@
|
|||||||
|
|
||||||
"@napi-rs/lzma-linux-x64-gnu": ["@napi-rs/lzma-linux-x64-gnu@1.5.1", "", { "os": "linux", "cpu": "x64" }, "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ=="],
|
"@napi-rs/lzma-linux-x64-gnu": ["@napi-rs/lzma-linux-x64-gnu@1.5.1", "", { "os": "linux", "cpu": "x64" }, "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ=="],
|
||||||
|
|
||||||
"@oxc-project/types": ["@oxc-project/types@0.149.0", "", {}, "sha512-Efcc+iF0j3Bf67YjEqIqWXbX5XddXoK/Mw4K1/JuXwRCZ8N16VR7iT23nlCc9XrveFVh/E5Rqs2StT0V8v9LdA=="],
|
"@oxc-project/types": ["@oxc-project/types@0.152.0", "", {}, "sha512-oM/5rLBm2tPkg0iBgkH/FOeR3PCDpY19GTgAZjMFM8h9WI9VW7cLgzp6nwtarYKmovavIQZ+Fe/RKX/8C8O/Rw=="],
|
||||||
|
|
||||||
"@pinojs/redact": ["@pinojs/redact@0.4.0", "", {}, "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg=="],
|
"@pinojs/redact": ["@pinojs/redact@0.4.0", "", {}, "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg=="],
|
||||||
|
|
||||||
"@polka/url": ["@polka/url@1.0.0-next.29", "", {}, "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww=="],
|
"@polka/url": ["@polka/url@1.0.0-next.29", "", {}, "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww=="],
|
||||||
|
|
||||||
"@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.2.8", "", { "os": "android", "cpu": "arm" }, "sha512-tN5aztYkKCte4i5SIrrz5yK/HMjEuCqCSCJa418jOV8tZ1cBY3YF2otxB1ktPxzsLA1BeTqwapK0bfjxNvHJVw=="],
|
"@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.2.12", "", { "os": "android", "cpu": "arm" }, "sha512-dB/a1214qKfHMXCpgqR4OZT+jS4kTyEXbQGJPqzobt5EwH5rX080pxE37alt3RzvR1bf1Yz/yGqRfrYAxuPw0A=="],
|
||||||
|
|
||||||
"@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.2.8", "", { "os": "android", "cpu": "arm64" }, "sha512-dIYTWl9XprMUiQFoc55KUyk/oS8SKYH3zFl0LTR7RT0Xj4hgSVyuJcroH8JUu8RcpF8fTB6E0aOwCkZoYPcDSQ=="],
|
"@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.2.12", "", { "os": "android", "cpu": "arm64" }, "sha512-7KHFgQ5VJxIHcLlrwrc3Xbds7oTNQT7Pgi9gQCJKrd2VGab/UksIOYp6VD8MzCstGxOKMgNamPwUCfxPdP1OHg=="],
|
||||||
|
|
||||||
"@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.2.8", "", { "os": "darwin", "cpu": "arm64" }, "sha512-PCSDQGXD2IyTEFrcgPyBM8jJuGmrbCMuoIOXdbEGVemruKACXoLQJrb+A45Z0L5t1RQkdfJprAYPkikbh7dzdA=="],
|
"@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.2.12", "", { "os": "darwin", "cpu": "arm64" }, "sha512-3YIhqHD96nA5SaYNRBR16HnGv4oavZvXfD/ayHM+oYZ0WD/8lBAtf6zQua4kEyAvpqrluKXl0lnOBoiNby7x9w=="],
|
||||||
|
|
||||||
"@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.2.8", "", { "os": "darwin", "cpu": "x64" }, "sha512-Uk7lRsGhPFHVX/sAUC6D5H9Ol30dFHd6iquokll2th3LpdJ3F5CzQB+7DHn0Ri2mG+U7k2zXiPHDrwZenXhwSA=="],
|
"@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.2.12", "", { "os": "darwin", "cpu": "x64" }, "sha512-UuuJ35MFw4gmFOrE9pEqIV+K3syIKveph+Qc1/ljHZVdoDW4pz/JHR/eMVom+TZGl/5OOvGJOWaOCVt3ZfqhxA=="],
|
||||||
|
|
||||||
"@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.2.8", "", { "os": "freebsd", "cpu": "x64" }, "sha512-DjszaTEVogPqA5bYzsEeqDCQxbcp2fexQwKcRspYji2yzR68fCf+e4fx6kBSRDwX5/brZaHw/hWS9+A/+/w9sQ=="],
|
"@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.2.12", "", { "os": "freebsd", "cpu": "x64" }, "sha512-uMvssit0a4W+/7D8CbHUvG719mH3R2jwXAlh/XcPvuHTE0g++LymF88DCGNX0HM2rBOn0xrzgXktIB6fLSJBTQ=="],
|
||||||
|
|
||||||
"@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.2.8", "", { "os": "linux", "cpu": "arm" }, "sha512-zmwa7FTmdzB6aaEEuuls18H6Ap5JmJPSoPTuXixeJZV6tG40SyLkApQtz1g8ptZtiEKqj9OM0oNLPh1AgvE31Q=="],
|
"@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.2.12", "", { "os": "linux", "cpu": "arm" }, "sha512-XcFu0R0xWnwzSf4IQgFH1rJIckPN1pLy2R+4r9IDB7Yfu/ys9cVqfa4pBrMHj7a3gl8mIR4nRNPg0e5IvEVs6g=="],
|
||||||
|
|
||||||
"@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.2.8", "", { "os": "linux", "cpu": "arm64" }, "sha512-KdYQDPHwJVnbFwdTGMgxsI9SqblBlz6STGM+w1We/d5B8OWWidYH0MwkU/uA1wM5fIpO2MkOVxXrNzzuZhw9ew=="],
|
"@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.2.12", "", { "os": "linux", "cpu": "arm64" }, "sha512-260UrKgn8tz39ak+SMDOirKzr7V04M9dWPw5llW00SwBivCZoWcRBKV1d8cXnRkUmSZA3BdiUmBHWk7734Ulpw=="],
|
||||||
|
|
||||||
"@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.2.8", "", { "os": "linux", "cpu": "arm64" }, "sha512-jFJTifHnNPY+yzOoNZQfSIysrVyXzEQPhPnOUjmD1bcQGHH6s7c8cViKWar8YplQImE5N9JRqMCLrM2CdxOrZA=="],
|
"@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.2.12", "", { "os": "linux", "cpu": "arm64" }, "sha512-5YK1I9SqDkbPgc1IA8BgDl34suqUS2q0KWnBrirm0E51YjOs6eo6dV6jbQfNE/argHRSvd0QUGgtpIoYx+WWpw=="],
|
||||||
|
|
||||||
"@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.2.8", "", { "os": "linux", "cpu": "ppc64" }, "sha512-FhiOziBDWPBjbcmRzfLyIJnaP7AVMFXT7YCXPjXxj7wKU3vx24RjrCNN/zjvVa+N2vVoHJwCoUBvsrN/DG3zIA=="],
|
"@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.2.12", "", { "os": "linux", "cpu": "ppc64" }, "sha512-Rkcrmp7eFRg74yL5fXEU91JEWbdEPLevWwGtXpmhbjlD1StScbWTmO94Bhly+Mo+ketKYkdmM1vNUKeWSlx8cQ=="],
|
||||||
|
|
||||||
"@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.2.8", "", { "os": "linux", "cpu": "s390x" }, "sha512-WnHfADMzOV2Y55wlx1hzzQnar/wDt/VdvWSD99r18Mz9ylNieIGOkRx3UV21h7m/eJvjySYJkO26VvGNFkwsIQ=="],
|
"@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.2.12", "", { "os": "linux", "cpu": "s390x" }, "sha512-qvK4DuAsQc2BSjlx+Xr+IzOIvvxbGZqxFwdWfG6F518Erj0GGISyQbJ6pIappnOxlNPzNHvo/L0BwB30GZ+zVw=="],
|
||||||
|
|
||||||
"@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.2.8", "", { "os": "linux", "cpu": "x64" }, "sha512-H9tRr5ibfXFVLxbPOseVewewFpl28zcEdjRDt2FTUZU7odxP0gEv1ki4/kGmcGOh78oRwZuuQllGLZ9zTJp84g=="],
|
"@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.2.12", "", { "os": "linux", "cpu": "x64" }, "sha512-Q9uLBO53Xd4QIq1WOycVQyPP1O4HhraEV2qqb3uTrnVw6QZih9duY4vNXOivL1xoUS1/z+W8eF4NMfl2a8Sdjw=="],
|
||||||
|
|
||||||
"@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.2.8", "", { "os": "linux", "cpu": "x64" }, "sha512-UefiqfM3D6IVNlZ8tSGs9+Ejjud2T+oxO0IHADU45Y+lyEjD2dVFyZHbkfX0LUb5Zugo/oIv1eCO/KVYhgYJYA=="],
|
"@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.2.12", "", { "os": "linux", "cpu": "x64" }, "sha512-3IBxWFMjbOZskDPKv8Lf9BCnahlKuHthWkYnyIxOH/QcJrFcS4EmcenthApkwr/5+nEqZlLzeYbxeMaX7A5u4g=="],
|
||||||
|
|
||||||
"@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.2.8", "", { "os": "none", "cpu": "arm64" }, "sha512-637Ke4kWSy6rp9cxQ9gMOXlxPgIw/c1beASV4M//3+9I4uwBVOOl74G+e3zyU3u19U7RkRl/HuewixZ/Z6+Rjg=="],
|
"@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.2.12", "", { "os": "none", "cpu": "arm64" }, "sha512-xtX61xg4LKPkPWilZU1ynKClz5Gj4bf74LML4r3eVLWumKnGjoEr1OSHQhMdbBDoYTi+yjrujvpZe2pUnqCrrA=="],
|
||||||
|
|
||||||
"@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.2.8", "", { "os": "win32", "cpu": "arm64" }, "sha512-xWBkPOF1Q9k/Gv1nQXnVdLxKu74jXppuOM4Z3mnypVUJJJwLsMl7hNJGRAUJoG8A5MgOI1ACKM+wBFxSJzKy4A=="],
|
"@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.2.12", "", { "os": "win32", "cpu": "arm64" }, "sha512-At7fPB6PCaIjzgIhEZFxuT+BBFqiQibJDT4d3PhiR3f4E7bbMZF4aKblbFfEM3sETRDd1YiQx/+U/g/B/ou5Ew=="],
|
||||||
|
|
||||||
"@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.2.8", "", { "os": "win32", "cpu": "x64" }, "sha512-uz2ZvfgXbxqNwijjjbxrnvALwpyODDcgc1T1N8N3rf/DXKQmaFwmB4LX4yyjggpwN2obdQLb2rgirX5ffCWYng=="],
|
"@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.2.12", "", { "os": "win32", "cpu": "x64" }, "sha512-WIw2haVKwjuYdXkHaoC0mF8Le71TuCBxjrdKqLbJGctbBABj+ClfmNvtbOnzpq3RokNo5+V1qhtSzJyXorsklQ=="],
|
||||||
|
|
||||||
"@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.1", "", {}, "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw=="],
|
"@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.1", "", {}, "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw=="],
|
||||||
|
|
||||||
"@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.63.3", "", { "os": "android", "cpu": "arm" }, "sha512-w3Jnvi1ocaVm/c7yVPpfB98XeSRBMyzp6njL5MVVbGyXjpmUkN+s6Hp4t0PqhGCCaI1ZHMKXt/w0lA1RCaLVcw=="],
|
"@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.64.0", "", { "os": "android", "cpu": "arm" }, "sha512-FLLpX941CD/7aBvX3GqLGBM9OvY5PGXTryPJkG5r5/OuBpZpV5k45Uo3RxAvqd35tsyc3hH1bhtz921IKzoIzg=="],
|
||||||
|
|
||||||
"@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.63.3", "", { "os": "android", "cpu": "arm64" }, "sha512-uI/ESiaIbbRYAEhzy8PCUWDp1hB0bjAqM06mW9flOoNO4Q8DQpeoREhBR5Hegfl+wpXiguyJv6XSPzEN7OxyHQ=="],
|
"@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.64.0", "", { "os": "android", "cpu": "arm64" }, "sha512-iI32XM/jnDYJsvx5ai/za/7gWO9XoSeFFtU06/ZCaRgyilfJOjaopD3nOpk2WrTCGOyeDt4hleUiGOAnd5tHNg=="],
|
||||||
|
|
||||||
"@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.63.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-oxhrd1jmXLwWZ83eQYDXxuqRdkqkzrjR3JobKeuUyfdNZo11FuQIvqEOZhyIT7OBHxXoGslDDjN0cQcM6T0TqQ=="],
|
"@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.64.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-dRBZlbt2sEtF8Mn4MODThze9fIPdDoOhVSlXMAKy5dQbOYK9pOOoPY4Fat3OTtr0+8zbJo5TTZwlsfxY/kDNJg=="],
|
||||||
|
|
||||||
"@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.63.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-7/YiIMghVE8DrxKvNdorAaJVdriOFgOIpdStnPx8ppx5zfTwC3jBCSEAIzB7JD5404m65THl6H93UTTVUvypmg=="],
|
"@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.64.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-Y3whrJOMucfkhgNkvcM93M6j8C53iEAMmPMYD99C6G1kUy4ELigLWk9ar2/4aCBSRgsql0zdlOemLgW2m5GZgQ=="],
|
||||||
|
|
||||||
"@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.63.3", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-GXFZRRoMAytaI5z6N3Zhfw0WL18Q0M8r95D5hlC4GqE/lGk8pbSJNUBoOWDfbm6dTciqHj2nU87tI5f6XhQiOg=="],
|
"@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.64.0", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-S6S1GEzPjFF6IONYJX3AKt/799+8RgBgCcwRnUo+Ep1IvBxUbw5M51iU0TDdK2NWWVnSvCQ8yi6Em0fGASMOng=="],
|
||||||
|
|
||||||
"@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.63.3", "", { "os": "freebsd", "cpu": "x64" }, "sha512-77W+8X3ddYgPxUpB8nZFQs2Mq+wc4HVlcSRtApXLjYBcnPMkttrSnU8VwKQjeWYhMsITHFs5cWBQ8vz1Q+5RHQ=="],
|
"@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.64.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-Ed1DPoFENkXj4IGzSB12SesV40iP6LxCCrbTIkSGIQBpOOxpBM+0kj62lmaeIHfMWTDoddqTOtqc7s8LYfn+Pw=="],
|
||||||
|
|
||||||
"@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.63.3", "", { "os": "linux", "cpu": "arm" }, "sha512-FVkwK+iUC+mq+GipVK46rRVticfAPtvPUNlqlGXUDxdVk/UGjQiiiUVPUrEXdSpU2ufU0XxLGyTqDtBidDOVmg=="],
|
"@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.64.0", "", { "os": "linux", "cpu": "arm" }, "sha512-J/6xhutJPtFyIkmHdf4olOdHHKH5kOJNumojdWn+Elv5ICEYTVOa362Vw27TxsK0BLzb1le3EDlO3UbvFK1lnQ=="],
|
||||||
|
|
||||||
"@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.63.3", "", { "os": "linux", "cpu": "arm" }, "sha512-+aGU1t3398yQOVj1Bz8o3e+KtswxAPvO+mtxtNdfXYMkXIHu7XhhkCD7/DEH9q8tF8uhDnMWvfpUKI8y1sZJsg=="],
|
"@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.64.0", "", { "os": "linux", "cpu": "arm" }, "sha512-G4L/Nnx59d2LvDoV/P4S5lZ7oVLT6hodOHMacqjiq2LL2gts86KbkEBTYL53+fBt0odhf7XPIbIATGoYiJctxg=="],
|
||||||
|
|
||||||
"@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.63.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-cR0kjpRXR2KJ2oQK8E2KTPtphs+b9hZ8IhTZubNryt/RsqgdOZBQ2Zq0q5UedtiIi0rs3jVhJh55RE1ZHUVGUA=="],
|
"@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.64.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-zF16pvJDEUksGYRbfnXne7pdklAyj2XDmJeYKgP93oq0cUyX9Y8O7lUo1R+IY1GagP/YBvCEDCe7eEcAKpw//g=="],
|
||||||
|
|
||||||
"@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.63.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-y1RYi4Q3/9ByVWSSt9kX2ustE0B7kFYbJ6zZdVZVyqopZs3yhCTwRfrjIX4vezUJInma/Gs6BOFDJg7yZmJ0IQ=="],
|
"@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.64.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-nIggWn8n+w12+R5lsV+PYYoUY8vuObxPAQqJI7WES+9v0qspYuAHoZMfYM0yLxlipasT5BY9ht5W8t5c/rSCkg=="],
|
||||||
|
|
||||||
"@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.63.3", "", { "os": "linux", "cpu": "none" }, "sha512-DNhEA5viIj3Z5bZLE4z4oV8N5ozWqDwyt7T6KG7VdLDJ0nW+rNOYlphBl4/3HQkK75qipPLsVOfStHHOwN9WSg=="],
|
"@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.64.0", "", { "os": "linux", "cpu": "none" }, "sha512-WLOTiHPzszP0dxIMsHpFeDSOSB5I49Mj8K4+yKE3H1X/D0JRG5XZ5jrctJLMjnUc/LUzaKiwq6EHWNJ8pup8PA=="],
|
||||||
|
|
||||||
"@rollup/rollup-linux-loong64-musl": ["@rollup/rollup-linux-loong64-musl@4.63.3", "", { "os": "linux", "cpu": "none" }, "sha512-17gQCqrIpXBX2Cmi9/TygnVOqGbzsba/iaqcYSL8FY7lNugg+7AiYNs5c5nKWD+NRQha36Sa0CqkJqH4XVHwnQ=="],
|
"@rollup/rollup-linux-loong64-musl": ["@rollup/rollup-linux-loong64-musl@4.64.0", "", { "os": "linux", "cpu": "none" }, "sha512-35RK9aRhh7g7Pmeu5gQ01aCvrhXzj9LoBE6xtUcEH1ns+nyTaSzxSpADmBQINu4QiTDGvmQYwo1j5hlg1rRXFw=="],
|
||||||
|
|
||||||
"@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.63.3", "", { "os": "linux", "cpu": "ppc64" }, "sha512-6LwVnZRIyINpdku/yOcI8Tm9YqLmhHK5emmlOOnW9tO0SYEm1FmKPcsSAGp0NBlqR2P04xaND4jvN6sTHqhq8A=="],
|
"@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.64.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-RqTfnpoTjuWfPAmqK5p2edt2AMCDJWm6oTn7sKfmyx+6tRga0ip05SJ977o6udTcIiDeF/CJMUfkaN4gtWt6Aw=="],
|
||||||
|
|
||||||
"@rollup/rollup-linux-ppc64-musl": ["@rollup/rollup-linux-ppc64-musl@4.63.3", "", { "os": "linux", "cpu": "ppc64" }, "sha512-xMUqkTXlEUtI/p5AAukMwBRr1enU3efsTeF+bskeFfk8t1C9rcC8sLREcZXmTfAXEbvRdJVSonVJez3TMlbR3w=="],
|
"@rollup/rollup-linux-ppc64-musl": ["@rollup/rollup-linux-ppc64-musl@4.64.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-RQjZPigjxFvFZDijG6rjlSXxhRaTf9zLYVpGK+lVcga64oMqP1GbgVqCb46eHTTceSIgp89Ja0y5aPe3GFBYHg=="],
|
||||||
|
|
||||||
"@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.63.3", "", { "os": "linux", "cpu": "none" }, "sha512-S3E94co9F9WRRqEaUoQZ38K1gCz6KiM+nL7/3ijq7fDGF3OznjS5TasgYITlvl27GQKtu4lOAOsr5MFwkijvOA=="],
|
"@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.64.0", "", { "os": "linux", "cpu": "none" }, "sha512-tjL58mgQcTRnDRpeky+Sth1MKQeYi2Ct6r3Luq9E5aTSjnM/i/JbozqZkKqp9thM5+oDSZxo+05f9kdQedfTGA=="],
|
||||||
|
|
||||||
"@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.63.3", "", { "os": "linux", "cpu": "none" }, "sha512-1QtRDwG42x5BJI3s9mxu5rEjDnfbSnk20HQ9/ylTAYnSwYwxMVb+Vgu34wzzTQ7ogqBybebgQNUDAvZVQ38DbA=="],
|
"@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.64.0", "", { "os": "linux", "cpu": "none" }, "sha512-ictoRyVaoZ8C67myHef+8hhCa6IplXJJ/xUCkVCxziV4zxMZh+jvhkhGsPBLqj1S72fnqD0QH5zL4lcaa4X7DQ=="],
|
||||||
|
|
||||||
"@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.63.3", "", { "os": "linux", "cpu": "s390x" }, "sha512-BQhejF6ZXOpxbngiNTP12GCGQeaDVL2QXGeBVViKIYzFHM5RKxTxwUMB1fr1BeNFphFMpnRqC5QSXFSa4z6UQw=="],
|
"@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.64.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-8aVvZ2hfr9RLFzBQkQNmYeHLDja8fLeQAmLt757zdKN/B+8L809KlLJKctQjS22wZotptV8G6o7fVPuAs8S1tQ=="],
|
||||||
|
|
||||||
"@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.63.3", "", { "os": "linux", "cpu": "x64" }, "sha512-SXagRwnI2Wlwlitllu59UK/nGVbD1CKPcNqDplHwIC4BqJcpXFjD32d1R/RbuISa95HdQrZM3/7v4bKiowFaLA=="],
|
"@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.64.0", "", { "os": "linux", "cpu": "x64" }, "sha512-2dEF8GAcDKwshUfydD+GhosppNyBzhVUHkdFF3CXd3FpOkzj/RZzF5aoEtzklujklT5qFVRU2GK/cFeLaTNKVg=="],
|
||||||
|
|
||||||
"@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.63.3", "", { "os": "linux", "cpu": "x64" }, "sha512-2IPozoEALRCziGqE8O9KMK60PMu5TS1huv4fwoeCexj+WjmcwFtX9CTOVbfXCUqcELAubEwRFPYlzb/WvwY2HQ=="],
|
"@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.64.0", "", { "os": "linux", "cpu": "x64" }, "sha512-3XHTvoo2hKkh0MiOfS7SkhHjMaaWF7P4F3drocZZaho/Z8w7h/jpnuBHm91BOQLfvrKHs1yR+zir4E8RI3XzTQ=="],
|
||||||
|
|
||||||
"@rollup/rollup-openbsd-x64": ["@rollup/rollup-openbsd-x64@4.63.3", "", { "os": "openbsd", "cpu": "x64" }, "sha512-AoxqosUHT9IX54hFn2TiN6A7d6ZKTtE6pd2bqWtqkkNJ6HJGaU6FRouGX8L1O7R/ZwsnCnpQrHzb4pDEx+UHRQ=="],
|
"@rollup/rollup-openbsd-x64": ["@rollup/rollup-openbsd-x64@4.64.0", "", { "os": "openbsd", "cpu": "x64" }, "sha512-HKtkzodL4a3KFWDXDoO61cRynAWTR3LnAE0oGtfG9lcNFpNuVYUFOByxDgNqEvic9rvaQbAj+SFwTEWDptRaIw=="],
|
||||||
|
|
||||||
"@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.63.3", "", { "os": "none", "cpu": "arm64" }, "sha512-d+CaftKgmkFBzCwezMqqy1d0QNNYugqLCMcYVQWBy5SS2YfeMP8Q8ripkgx9O8IyBXXLHrJ+aaCV4U96usv6Yg=="],
|
"@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.64.0", "", { "os": "none", "cpu": "arm64" }, "sha512-JBsxqiY16uyyCujtoC3s7zL+SrYyNElptD7K4V+KUoJ2V8/XG3hPWpheK+SuPwNh1cikJvIZmIdsrYXvD6PLJw=="],
|
||||||
|
|
||||||
"@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.63.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-xXlDF6nR1eOuXbdDy5Hl5fmtY7teUDevF/k0O7IPoZe4Tpmdv+lgdE5JRsnhQtt37ql9P0VF2kAN9a0OCZdo+Q=="],
|
"@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.64.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-S5Qrijh37qhnUYQ0ay8WN3LuWeKjow7wTUyCOPMZtnXiBXYXdsZETI6ZLfYnQAKovltckPLBFdNeD61P2rJc7g=="],
|
||||||
|
|
||||||
"@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.63.3", "", { "os": "win32", "cpu": "ia32" }, "sha512-YtXAgLN+JP7Ay6qG3eWhc7IHMQPzLc8r3uvhAvlJIoCz/4Q32+Bl9Fmnywidh8v1GOIMmymjovfqY9ETAtysvA=="],
|
"@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.64.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-zbZ6iMmLFEsCtTdc2/y1F/cDFVNNCPF7Ae8PCT/wdPE//hGwYp6r+MyCLMFX+kOeIe09Pz6ASfnnfpSTN1FJQQ=="],
|
||||||
|
|
||||||
"@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.63.3", "", { "os": "win32", "cpu": "x64" }, "sha512-WuWtSJRNo549vzcfZyEgfqb6zeSgn1F+UE5kQ+BCjzz0W4MGCjntUHkZVc1VRuAM7+ULaSyhiPxD1spyewFvkQ=="],
|
"@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.64.0", "", { "os": "win32", "cpu": "x64" }, "sha512-L6Hw69oNpuYaOr1zCG30v0/DqKYCSRwodPGwIcVZ/6f8SOzq9rxtL/xNVI5MO4wjli+Ko0ErK9uHJL3mNPt8wQ=="],
|
||||||
|
|
||||||
"@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.63.3", "", { "os": "win32", "cpu": "x64" }, "sha512-+lIKX7O0+IGe7WuhATaAMMeT7B76vfhXH/l9wLQL+nvyhbw2ohYCKIdWL56JfDu75CWt5oKRP4QFH/jkMtBquA=="],
|
"@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.64.0", "", { "os": "win32", "cpu": "x64" }, "sha512-nl+CTWIgOGszQmUz/kanfgrfFZ4qiwxKIfT/ryl3N3Ewk5tqizmYtNXiqb7Bu/fDtNgu1kyxdFiAUJNur3iysg=="],
|
||||||
|
|
||||||
"@sapphire/async-queue": ["@sapphire/async-queue@1.5.5", "", {}, "sha512-cvGzxbba6sav2zZkH8GPf2oGk9yYoD5qrNWdu9fRehifgnFZJMV+nuy2nON2roRO4yQQ+v7MK/Pktl/HgfsUXg=="],
|
"@sapphire/async-queue": ["@sapphire/async-queue@1.5.5", "", {}, "sha512-cvGzxbba6sav2zZkH8GPf2oGk9yYoD5qrNWdu9fRehifgnFZJMV+nuy2nON2roRO4yQQ+v7MK/Pktl/HgfsUXg=="],
|
||||||
|
|
||||||
@@ -341,11 +344,13 @@
|
|||||||
|
|
||||||
"@types/estree": ["@types/estree@1.0.9", "", {}, "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg=="],
|
"@types/estree": ["@types/estree@1.0.9", "", {}, "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg=="],
|
||||||
|
|
||||||
"@types/node": ["@types/node@26.2.0", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-5IviulTZeRNp2vAJ514cc/HUlY5nZ9fCbq9DMyC52BrhFZACo3nI0R7qBxhQmo/d27NFe96ur/b7Wwxklda+kg=="],
|
"@types/node": ["@types/node@26.6.4", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-ldVPDCzj7fsaGZrLB0NuHuTvJcsNasysBAqMolr/cgxrLd1xbqxIr3XJiPnHHJUCxj5sNF1vnRj9aWnrVh5Jcg=="],
|
||||||
|
|
||||||
"@types/pg": ["@types/pg@8.23.1", "", { "dependencies": { "@types/node": "*", "pg-protocol": "*", "pg-types": "^2.2.0" } }, "sha512-fKVHpikPdg4GKks3JuLEhvwSyvwzF23hnabPy6DD8ljVbC7+6J5dQzdv4arV6jqq57djnMgs1HKBxX4P8aBI3A=="],
|
"@types/pg": ["@types/pg@8.23.1", "", { "dependencies": { "@types/node": "*", "pg-protocol": "*", "pg-types": "^2.2.0" } }, "sha512-fKVHpikPdg4GKks3JuLEhvwSyvwzF23hnabPy6DD8ljVbC7+6J5dQzdv4arV6jqq57djnMgs1HKBxX4P8aBI3A=="],
|
||||||
|
|
||||||
"@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="],
|
"@types/ws": ["@types/ws@8.18.2", "", { "dependencies": { "@types/node": "*" } }, "sha512-67MQl+fpWKVTT1NYdnmo3U4sc/xPo/zQBncVnI74qmQa0z/b+1g6iYqNmGCPbxO+zz2aklb08a0oHfegiVd0/w=="],
|
||||||
|
|
||||||
|
"@typescript/native": ["typescript@7.0.2", "", { "optionalDependencies": { "@typescript/typescript-aix-ppc64": "7.0.2", "@typescript/typescript-darwin-arm64": "7.0.2", "@typescript/typescript-darwin-x64": "7.0.2", "@typescript/typescript-freebsd-arm64": "7.0.2", "@typescript/typescript-freebsd-x64": "7.0.2", "@typescript/typescript-linux-arm": "7.0.2", "@typescript/typescript-linux-arm64": "7.0.2", "@typescript/typescript-linux-loong64": "7.0.2", "@typescript/typescript-linux-mips64el": "7.0.2", "@typescript/typescript-linux-ppc64": "7.0.2", "@typescript/typescript-linux-riscv64": "7.0.2", "@typescript/typescript-linux-s390x": "7.0.2", "@typescript/typescript-linux-x64": "7.0.2", "@typescript/typescript-netbsd-arm64": "7.0.2", "@typescript/typescript-netbsd-x64": "7.0.2", "@typescript/typescript-openbsd-arm64": "7.0.2", "@typescript/typescript-openbsd-x64": "7.0.2", "@typescript/typescript-sunos-x64": "7.0.2", "@typescript/typescript-win32-arm64": "7.0.2", "@typescript/typescript-win32-x64": "7.0.2" }, "bin": { "tsc": "bin/tsc" } }, "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA=="],
|
||||||
|
|
||||||
"@typescript/typescript-aix-ppc64": ["@typescript/typescript-aix-ppc64@7.0.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ=="],
|
"@typescript/typescript-aix-ppc64": ["@typescript/typescript-aix-ppc64@7.0.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ=="],
|
||||||
|
|
||||||
@@ -423,7 +428,7 @@
|
|||||||
|
|
||||||
"cosmiconfig": ["cosmiconfig@9.0.2", "", { "dependencies": { "env-paths": "^2.2.1", "import-fresh": "^3.3.0", "js-yaml": "^4.1.0", "parse-json": "^5.2.0" }, "peerDependencies": { "typescript": ">=4.9.5" }, "optionalPeers": ["typescript"] }, "sha512-gtTZxTDau1wL7Y7zifc2dd8jHSK/k6BTx/2Xp/BpdlAdnlYWFVt7qhJqgwi7637yRwRQ3qL4ZidbB4I8tA5VOg=="],
|
"cosmiconfig": ["cosmiconfig@9.0.2", "", { "dependencies": { "env-paths": "^2.2.1", "import-fresh": "^3.3.0", "js-yaml": "^4.1.0", "parse-json": "^5.2.0" }, "peerDependencies": { "typescript": ">=4.9.5" }, "optionalPeers": ["typescript"] }, "sha512-gtTZxTDau1wL7Y7zifc2dd8jHSK/k6BTx/2Xp/BpdlAdnlYWFVt7qhJqgwi7637yRwRQ3qL4ZidbB4I8tA5VOg=="],
|
||||||
|
|
||||||
"daisyui": ["daisyui@5.7.38", "", {}, "sha512-ef3RIbteKVmlQ10ak0l4mu8F70pBJ2UBjDJNsA2vWlpNdErpHqfxddxK2ckNNYd7vQvTqP4a1A1vSsunlCGVOw=="],
|
"daisyui": ["daisyui@5.7.47", "", {}, "sha512-NOl4vPifelRqB3CMzoU751zc44KCDD9HdHMTTqQ30uiYVpIyK7+s94/ySDWgYqjdl1tQCaCrgGBx4KCizm+a3Q=="],
|
||||||
|
|
||||||
"dateformat": ["dateformat@4.6.3", "", {}, "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA=="],
|
"dateformat": ["dateformat@4.6.3", "", {}, "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA=="],
|
||||||
|
|
||||||
@@ -433,11 +438,11 @@
|
|||||||
|
|
||||||
"detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
|
"detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
|
||||||
|
|
||||||
"devalue": ["devalue@5.9.2", "", {}, "sha512-po4PAY5c53tw5XMocSnf8A/5OHhbbUftpr93aEN6BBoAdntUmK7vu7wOATqvt7cXO7m1Cl4gMVn6p7n6n4mj0w=="],
|
"devalue": ["devalue@5.9.4", "", {}, "sha512-sPAT4pztbu6586/hrhOnMKS17IJrvg12mXiSPSS3W5qDeN2RGgvZ0diZCm31dBbnevfVmujNO3IM2wrS4Y2Rhg=="],
|
||||||
|
|
||||||
"diff": ["diff@8.0.4", "", {}, "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw=="],
|
"diff": ["diff@8.0.4", "", {}, "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw=="],
|
||||||
|
|
||||||
"discord-api-types": ["discord-api-types@0.38.55", "", {}, "sha512-ytuaRTzdnHUCXJ6KjL9MrItQX0xKncBKEeYI1Bst4+ud47eejH3cG6gaesYakjpPcUhh68XYS2YwGq3mmujFsA=="],
|
"discord-api-types": ["discord-api-types@0.38.56", "", {}, "sha512-Hti4RZsGvF5C7SM8rF2MDHtIm0Hyfrlk84GpEA29nj91tvVVMvX+oQSCodu10t2ZcjFGofq8TX0YyC04B2E69Q=="],
|
||||||
|
|
||||||
"discord.js": ["discord.js@14.27.0", "", { "dependencies": { "@discordjs/builders": "^1.14.1", "@discordjs/collection": "1.5.3", "@discordjs/formatters": "^0.6.2", "@discordjs/rest": "^2.6.2", "@discordjs/util": "^1.2.0", "@discordjs/ws": "^1.2.3", "@sapphire/snowflake": "3.5.5", "discord-api-types": "^0.38.49", "fast-deep-equal": "3.1.3", "lodash.snakecase": "4.1.1", "magic-bytes.js": "^1.13.0", "tslib": "^2.6.3", "undici": "^6.27.0" } }, "sha512-qHbFlFG2N7y3LjPySYsL6A1+BnX6bkTVgo842EX0CqVPk/KTMwZkojPHEXKsQUpWZNyz5BISNHK1cPpQw0+m4A=="],
|
"discord.js": ["discord.js@14.27.0", "", { "dependencies": { "@discordjs/builders": "^1.14.1", "@discordjs/collection": "1.5.3", "@discordjs/formatters": "^0.6.2", "@discordjs/rest": "^2.6.2", "@discordjs/util": "^1.2.0", "@discordjs/ws": "^1.2.3", "@sapphire/snowflake": "3.5.5", "discord-api-types": "^0.38.49", "fast-deep-equal": "3.1.3", "lodash.snakecase": "4.1.1", "magic-bytes.js": "^1.13.0", "tslib": "^2.6.3", "undici": "^6.27.0" } }, "sha512-qHbFlFG2N7y3LjPySYsL6A1+BnX6bkTVgo842EX0CqVPk/KTMwZkojPHEXKsQUpWZNyz5BISNHK1cPpQw0+m4A=="],
|
||||||
|
|
||||||
@@ -449,7 +454,7 @@
|
|||||||
|
|
||||||
"end-of-stream": ["end-of-stream@1.4.5", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg=="],
|
"end-of-stream": ["end-of-stream@1.4.5", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg=="],
|
||||||
|
|
||||||
"enhanced-resolve": ["enhanced-resolve@5.25.1", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.3.3" } }, "sha512-nGXts5znJzmWPu+mIE9izCOzdg63oJca2mDzGWWTth7sr4aCToKcoyFVBQwN75Ij5Pf6p510EwkTqViTRzDV+w=="],
|
"enhanced-resolve": ["enhanced-resolve@5.26.0", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.3.3" } }, "sha512-9vhedylFonb2YGogzUKX6+Ja72gOJbN1QHAqdrvqLwhdl/QWbKopzoUC9EbQNVsAns/bx/4uyqalrQAoy1IByw=="],
|
||||||
|
|
||||||
"env-paths": ["env-paths@2.2.1", "", {}, "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A=="],
|
"env-paths": ["env-paths@2.2.1", "", {}, "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A=="],
|
||||||
|
|
||||||
@@ -459,7 +464,7 @@
|
|||||||
|
|
||||||
"esm-env": ["esm-env@1.2.2", "", {}, "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA=="],
|
"esm-env": ["esm-env@1.2.2", "", {}, "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA=="],
|
||||||
|
|
||||||
"esrap": ["esrap@2.3.7", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, "peerDependencies": { "@typescript-eslint/types": "^8.2.0" }, "optionalPeers": ["@typescript-eslint/types"] }, "sha512-n2nf7fZR3c9yXf0BPEuHuXqT+KW0SJVj4cN5FMEkpCZ3scLjOQWpiccyCxVzCC2q1wubTghuEGzngJY/7Ah0Ow=="],
|
"esrap": ["esrap@2.4.0", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, "peerDependencies": { "@typescript-eslint/types": "^8.2.0" }, "optionalPeers": ["@typescript-eslint/types"] }, "sha512-CQPcneEHw/czj32uwQC52nYnax8H4SXt25FCM+LIwGZ49cMIxpOj3bP8wmzcI+Z0HIy5KkClaPhRLfCySzwHPA=="],
|
||||||
|
|
||||||
"exact-mirror": ["exact-mirror@0.2.7", "", { "peerDependencies": { "@sinclair/typebox": "^0.34.15" }, "optionalPeers": ["@sinclair/typebox"] }, "sha512-+MeEmDcLA4o/vjK2zujgk+1VTxPR4hdp23qLqkWfStbECtAq9gmsvQa3LW6z/0GXZyHJobrCnmy1cdeE7BjsYg=="],
|
"exact-mirror": ["exact-mirror@0.2.7", "", { "peerDependencies": { "@sinclair/typebox": "^0.34.15" }, "optionalPeers": ["@sinclair/typebox"] }, "sha512-+MeEmDcLA4o/vjK2zujgk+1VTxPR4hdp23qLqkWfStbECtAq9gmsvQa3LW6z/0GXZyHJobrCnmy1cdeE7BjsYg=="],
|
||||||
|
|
||||||
@@ -473,7 +478,7 @@
|
|||||||
|
|
||||||
"fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
|
"fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
|
||||||
|
|
||||||
"file-type": ["file-type@22.1.0", "", { "dependencies": { "@tokenizer/inflate": "^0.4.1", "strtok3": "^10.3.5", "token-types": "^6.1.2", "uint8array-extras": "^1.5.0" } }, "sha512-fbvf9u6jnHWr1EP6V8R99E9iLMhNLXgZkUzWBiPpJ5/89UJ/Atuxjn5YXR+XaZWo2hc2/8mGfTez+NDAgOcpLA=="],
|
"file-type": ["file-type@22.1.1", "", { "dependencies": { "@tokenizer/inflate": "^0.4.1", "strtok3": "^10.3.5", "token-types": "^6.1.2", "uint8array-extras": "^1.5.0" } }, "sha512-sEB0oStmeLGtpmSAD88RDNuLsvhv4iC3u0lE25CUvfCULvj49xoQ3l3K525Vn+ZzsZ6DOLajQCV6RmhwwhqiJg=="],
|
||||||
|
|
||||||
"fill-range": ["fill-range@7.1.1", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="],
|
"fill-range": ["fill-range@7.1.1", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="],
|
||||||
|
|
||||||
@@ -587,17 +592,17 @@
|
|||||||
|
|
||||||
"parse-json": ["parse-json@5.2.0", "", { "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" } }, "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg=="],
|
"parse-json": ["parse-json@5.2.0", "", { "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" } }, "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg=="],
|
||||||
|
|
||||||
"pg": ["pg@8.23.0", "", { "dependencies": { "pg-connection-string": "^2.14.0", "pg-pool": "^3.14.0", "pg-protocol": "^1.16.0", "pg-types": "2.2.0", "pgpass": "1.0.5" }, "optionalDependencies": { "pg-cloudflare": "^1.4.0" }, "peerDependencies": { "pg-native": ">=3.0.1" }, "optionalPeers": ["pg-native"] }, "sha512-Ip2EQCngowJLGOfCwkFhPXU7/ljlhn6Rxlmy4XYfL2Y+vyRM59+8uR2xqRWKdYmbXmxCFOAmKxBuSUCdF34qLg=="],
|
"pg": ["pg@8.23.1", "", { "dependencies": { "pg-connection-string": "^2.14.1", "pg-pool": "^3.14.0", "pg-protocol": "^1.16.1", "pg-types": "2.2.0", "pgpass": "1.0.5" }, "optionalDependencies": { "pg-cloudflare": "^1.4.1" }, "peerDependencies": { "pg-native": ">=3.0.1" }, "optionalPeers": ["pg-native"] }, "sha512-aL96AHANtWjPLDOLqnhx+ngp9+UK7ETEU8VJrDCGvsSSi/mGLcWYsS6Herg7lmaBJe4uwrfqsa7gTEFaSizDoQ=="],
|
||||||
|
|
||||||
"pg-cloudflare": ["pg-cloudflare@1.4.0", "", {}, "sha512-Vo7z/6rrQYxpNRylp4Tlob2elzbh+N/MOQbxFVWCxS7oEx6jF53GTJFxK2WWpKuBRkmiin4Mt+xofFDjx09R0A=="],
|
"pg-cloudflare": ["pg-cloudflare@1.4.1", "", {}, "sha512-6PQbsFWZcp9EmJEwy5cGQ2La+AMWpP46lgbb8X+U/XsHIUweYDNCpeuKck5RxL2MdVFi7krbbEi5nX4Zh7JhrQ=="],
|
||||||
|
|
||||||
"pg-connection-string": ["pg-connection-string@2.14.0", "", {}, "sha512-XwWDGcLRGCXAR8F/AM5bG7Q+A3Wm2s6QeEjlOKZLlH3UYcguiqCWKyWXVag5TLTIjR7oOJUY8kcADaZgWPyLeg=="],
|
"pg-connection-string": ["pg-connection-string@2.14.1", "", {}, "sha512-qR3kGNPBLpCNtz0evbKA0Y/MRFXwSSdT+pTJvYp/bXTcReZbvX1kzF0IyTc1QnxqF7AZbOeBhNL8R5mYQZV/MA=="],
|
||||||
|
|
||||||
"pg-int8": ["pg-int8@1.0.1", "", {}, "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw=="],
|
"pg-int8": ["pg-int8@1.0.1", "", {}, "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw=="],
|
||||||
|
|
||||||
"pg-pool": ["pg-pool@3.14.0", "", { "peerDependencies": { "pg": ">=8.0" } }, "sha512-gKtPkFdQPU3DksooVLi9LsjZxrsBUZIpa+7aVx+LV5pNh0KzP4Zleud2po+ConrxbuXGBJ6Hfer6hdgpIBpBaw=="],
|
"pg-pool": ["pg-pool@3.14.0", "", { "peerDependencies": { "pg": ">=8.0" } }, "sha512-gKtPkFdQPU3DksooVLi9LsjZxrsBUZIpa+7aVx+LV5pNh0KzP4Zleud2po+ConrxbuXGBJ6Hfer6hdgpIBpBaw=="],
|
||||||
|
|
||||||
"pg-protocol": ["pg-protocol@1.16.0", "", {}, "sha512-sILXutLVjCLjcDuOmvhX5e2Z4cS5qG/6Bu3VkpFwdf/633ElGLpEh9bgmuI5I4sqKqkifQiGyiCcx1HdtrK7tg=="],
|
"pg-protocol": ["pg-protocol@1.16.1", "", {}, "sha512-p9VOFMiHB/ZbJATetbg+99PxssTVSQRnyuPSQ67mN1+1KBOjZaZ83ZQzltnxPhJwSsC3nwVjJ10DVJlerbFzLg=="],
|
||||||
|
|
||||||
"pg-types": ["pg-types@2.2.0", "", { "dependencies": { "pg-int8": "1.0.1", "postgres-array": "~2.0.0", "postgres-bytea": "~1.0.0", "postgres-date": "~1.0.4", "postgres-interval": "^1.1.0" } }, "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA=="],
|
"pg-types": ["pg-types@2.2.0", "", { "dependencies": { "pg-int8": "1.0.1", "postgres-array": "~2.0.0", "postgres-bytea": "~1.0.0", "postgres-date": "~1.0.4", "postgres-interval": "^1.1.0" } }, "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA=="],
|
||||||
|
|
||||||
@@ -607,7 +612,7 @@
|
|||||||
|
|
||||||
"picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="],
|
"picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="],
|
||||||
|
|
||||||
"pino": ["pino@10.3.1", "", { "dependencies": { "@pinojs/redact": "^0.4.0", "atomic-sleep": "^1.0.0", "on-exit-leak-free": "^2.1.0", "pino-abstract-transport": "^3.0.0", "pino-std-serializers": "^7.0.0", "process-warning": "^5.0.0", "quick-format-unescaped": "^4.0.3", "real-require": "^0.2.0", "safe-stable-stringify": "^2.3.1", "sonic-boom": "^4.0.1", "thread-stream": "^4.0.0" }, "bin": { "pino": "bin.js" } }, "sha512-r34yH/GlQpKZbU1BvFFqOjhISRo1MNx1tWYsYvmj6KIRHSPMT2+yHOEb1SG6NMvRoHRF0a07kCOox/9yakl1vg=="],
|
"pino": ["pino@10.4.0", "", { "dependencies": { "@pinojs/redact": "^0.4.0", "atomic-sleep": "^1.0.0", "on-exit-leak-free": "^2.1.0", "pino-abstract-transport": "^3.0.0", "pino-std-serializers": "^7.0.0", "process-warning": "^5.0.0", "quick-format-unescaped": "^4.0.3", "real-require": "^1.0.0", "safe-stable-stringify": "^2.3.1", "sonic-boom": "^4.0.1", "thread-stream": "^4.0.0" }, "bin": { "pino": "bin.js" } }, "sha512-bk1ZMTwG/Vymx+zPoa28MhNzucFvXJWp3csrSuxuHPSMeUettaCoQ5Jvg07mtC4JGNpcfTwz41oVCnNgBK9+vA=="],
|
||||||
|
|
||||||
"pino-abstract-transport": ["pino-abstract-transport@3.0.0", "", { "dependencies": { "split2": "^4.0.0" } }, "sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg=="],
|
"pino-abstract-transport": ["pino-abstract-transport@3.0.0", "", { "dependencies": { "split2": "^4.0.0" } }, "sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg=="],
|
||||||
|
|
||||||
@@ -635,13 +640,13 @@
|
|||||||
|
|
||||||
"readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="],
|
"readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="],
|
||||||
|
|
||||||
"real-require": ["real-require@0.2.0", "", {}, "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg=="],
|
"real-require": ["real-require@1.0.0", "", {}, "sha512-P4nbQYQfePJxRSmY+v/KINxVucm4NF3p3s7pJveMTtom52FR4YGltUQLB8idDXwDDWW+eYrWDFbuzUnjoWHF7g=="],
|
||||||
|
|
||||||
"resolve-from": ["resolve-from@4.0.0", "", {}, "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="],
|
"resolve-from": ["resolve-from@4.0.0", "", {}, "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="],
|
||||||
|
|
||||||
"rolldown": ["rolldown@1.2.8", "", { "dependencies": { "@oxc-project/types": "=0.149.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.2.8", "@rolldown/binding-android-arm64": "1.2.8", "@rolldown/binding-darwin-arm64": "1.2.8", "@rolldown/binding-darwin-x64": "1.2.8", "@rolldown/binding-freebsd-x64": "1.2.8", "@rolldown/binding-linux-arm-gnueabihf": "1.2.8", "@rolldown/binding-linux-arm64-gnu": "1.2.8", "@rolldown/binding-linux-arm64-musl": "1.2.8", "@rolldown/binding-linux-ppc64-gnu": "1.2.8", "@rolldown/binding-linux-s390x-gnu": "1.2.8", "@rolldown/binding-linux-x64-gnu": "1.2.8", "@rolldown/binding-linux-x64-musl": "1.2.8", "@rolldown/binding-openharmony-arm64": "1.2.8", "@rolldown/binding-win32-arm64-msvc": "1.2.8", "@rolldown/binding-win32-x64-msvc": "1.2.8" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-Z67nTmhZe7anqnM/EjI392w5i/ANUinjip7QYsOyN37oayduxt3ksdX0hf5OOamkAd53BiIHfbfSzfUmzKFQqQ=="],
|
"rolldown": ["rolldown@1.2.12", "", { "dependencies": { "@oxc-project/types": "=0.152.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.2.12", "@rolldown/binding-android-arm64": "1.2.12", "@rolldown/binding-darwin-arm64": "1.2.12", "@rolldown/binding-darwin-x64": "1.2.12", "@rolldown/binding-freebsd-x64": "1.2.12", "@rolldown/binding-linux-arm-gnueabihf": "1.2.12", "@rolldown/binding-linux-arm64-gnu": "1.2.12", "@rolldown/binding-linux-arm64-musl": "1.2.12", "@rolldown/binding-linux-ppc64-gnu": "1.2.12", "@rolldown/binding-linux-s390x-gnu": "1.2.12", "@rolldown/binding-linux-x64-gnu": "1.2.12", "@rolldown/binding-linux-x64-musl": "1.2.12", "@rolldown/binding-openharmony-arm64": "1.2.12", "@rolldown/binding-win32-arm64-msvc": "1.2.12", "@rolldown/binding-win32-x64-msvc": "1.2.12" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-8wafseiaG80xmXSfqidUNqZcylTlhmPZZt+za2m+js2sFZ8dTNlhIOV2WcbIPx2hgwPBJpEUGFAMZ9bgBBLTSQ=="],
|
||||||
|
|
||||||
"rollup": ["rollup@4.63.3", "", { "dependencies": { "@types/estree": "1.0.9" }, "optionalDependencies": { "@napi-rs/lzma-linux-x64-gnu": "1.5.1", "@rollup/rollup-android-arm-eabi": "4.63.3", "@rollup/rollup-android-arm64": "4.63.3", "@rollup/rollup-darwin-arm64": "4.63.3", "@rollup/rollup-darwin-x64": "4.63.3", "@rollup/rollup-freebsd-arm64": "4.63.3", "@rollup/rollup-freebsd-x64": "4.63.3", "@rollup/rollup-linux-arm-gnueabihf": "4.63.3", "@rollup/rollup-linux-arm-musleabihf": "4.63.3", "@rollup/rollup-linux-arm64-gnu": "4.63.3", "@rollup/rollup-linux-arm64-musl": "4.63.3", "@rollup/rollup-linux-loong64-gnu": "4.63.3", "@rollup/rollup-linux-loong64-musl": "4.63.3", "@rollup/rollup-linux-ppc64-gnu": "4.63.3", "@rollup/rollup-linux-ppc64-musl": "4.63.3", "@rollup/rollup-linux-riscv64-gnu": "4.63.3", "@rollup/rollup-linux-riscv64-musl": "4.63.3", "@rollup/rollup-linux-s390x-gnu": "4.63.3", "@rollup/rollup-linux-x64-gnu": "4.63.3", "@rollup/rollup-linux-x64-musl": "4.63.3", "@rollup/rollup-openbsd-x64": "4.63.3", "@rollup/rollup-openharmony-arm64": "4.63.3", "@rollup/rollup-win32-arm64-msvc": "4.63.3", "@rollup/rollup-win32-ia32-msvc": "4.63.3", "@rollup/rollup-win32-x64-gnu": "4.63.3", "@rollup/rollup-win32-x64-msvc": "4.63.3", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-1i2XreiAoMMXuPGD6Msj2xWrMMkHojNRKivInxGQcg7/1KuPuYlfUutLyh4drnOxUTHX9cHI4wFoat8D/NKaBw=="],
|
"rollup": ["rollup@4.64.0", "", { "dependencies": { "@types/estree": "1.0.9" }, "optionalDependencies": { "@napi-rs/lzma-linux-x64-gnu": "1.5.1", "@rollup/rollup-android-arm-eabi": "4.64.0", "@rollup/rollup-android-arm64": "4.64.0", "@rollup/rollup-darwin-arm64": "4.64.0", "@rollup/rollup-darwin-x64": "4.64.0", "@rollup/rollup-freebsd-arm64": "4.64.0", "@rollup/rollup-freebsd-x64": "4.64.0", "@rollup/rollup-linux-arm-gnueabihf": "4.64.0", "@rollup/rollup-linux-arm-musleabihf": "4.64.0", "@rollup/rollup-linux-arm64-gnu": "4.64.0", "@rollup/rollup-linux-arm64-musl": "4.64.0", "@rollup/rollup-linux-loong64-gnu": "4.64.0", "@rollup/rollup-linux-loong64-musl": "4.64.0", "@rollup/rollup-linux-ppc64-gnu": "4.64.0", "@rollup/rollup-linux-ppc64-musl": "4.64.0", "@rollup/rollup-linux-riscv64-gnu": "4.64.0", "@rollup/rollup-linux-riscv64-musl": "4.64.0", "@rollup/rollup-linux-s390x-gnu": "4.64.0", "@rollup/rollup-linux-x64-gnu": "4.64.0", "@rollup/rollup-linux-x64-musl": "4.64.0", "@rollup/rollup-openbsd-x64": "4.64.0", "@rollup/rollup-openharmony-arm64": "4.64.0", "@rollup/rollup-win32-arm64-msvc": "4.64.0", "@rollup/rollup-win32-ia32-msvc": "4.64.0", "@rollup/rollup-win32-x64-gnu": "4.64.0", "@rollup/rollup-win32-x64-msvc": "4.64.0", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-gjA/kFeDfffII8COoPsvLPvE16hWDTEc1+0QKQNKUkuV8iJjqsC4xXs8/FzuL0v9EV39kuxTbAgcFoTRyy2TGQ=="],
|
||||||
|
|
||||||
"sade": ["sade@1.8.1", "", { "dependencies": { "mri": "^1.1.0" } }, "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A=="],
|
"sade": ["sade@1.8.1", "", { "dependencies": { "mri": "^1.1.0" } }, "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A=="],
|
||||||
|
|
||||||
@@ -655,7 +660,7 @@
|
|||||||
|
|
||||||
"sonic-boom": ["sonic-boom@4.2.1", "", { "dependencies": { "atomic-sleep": "^1.0.0" } }, "sha512-w6AxtubXa2wTXAUsZMMWERrsIRAdrK0Sc+FUytWvYAhBJLyuI4llrMIC1DtlNSdI99EI86KZum2MMq3EAZlF9Q=="],
|
"sonic-boom": ["sonic-boom@4.2.1", "", { "dependencies": { "atomic-sleep": "^1.0.0" } }, "sha512-w6AxtubXa2wTXAUsZMMWERrsIRAdrK0Sc+FUytWvYAhBJLyuI4llrMIC1DtlNSdI99EI86KZum2MMq3EAZlF9Q=="],
|
||||||
|
|
||||||
"source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],
|
"source-map-js": ["source-map-js@1.2.2", "", {}, "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw=="],
|
||||||
|
|
||||||
"split2": ["split2@4.2.0", "", {}, "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg=="],
|
"split2": ["split2@4.2.0", "", {}, "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg=="],
|
||||||
|
|
||||||
@@ -665,7 +670,7 @@
|
|||||||
|
|
||||||
"supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
"supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
||||||
|
|
||||||
"svelte": ["svelte@5.57.0", "", { "dependencies": { "@jridgewell/remapping": "^2.3.4", "@jridgewell/sourcemap-codec": "^1.5.0", "@sveltejs/acorn-typescript": "^1.0.10", "@types/estree": "^1.0.5", "acorn": "^8.12.1", "aria-query": "5.3.1", "axobject-query": "^4.1.0", "clsx": "^2.1.1", "devalue": "^5.8.1", "esm-env": "^1.2.1", "esrap": "^2.2.12", "is-reference": "^3.0.3", "locate-character": "^3.0.0", "magic-string": "^0.30.11", "zimmerframe": "^1.1.2" } }, "sha512-NdbDn7fl4be1ViUG0oq/lvG6OZy3oENolV2ONjiqqsfVoeAfzaQAKUcEX3MrQod/Bebv1PgwET9rfXhgn9s4Kg=="],
|
"svelte": ["svelte@5.57.1", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "@jridgewell/sourcemap-codec": "^1.6.0", "@sveltejs/acorn-typescript": "^1.0.13", "@types/estree": "^1.0.9", "acorn": "^8.18.0", "aria-query": "5.3.1", "axobject-query": "^4.1.0", "clsx": "^2.1.1", "devalue": "^5.9.2", "esm-env": "^1.2.1", "esrap": "^2.3.6", "is-reference": "^3.0.3", "locate-character": "^3.0.0", "magic-string": "^0.30.11", "zimmerframe": "^1.1.2" } }, "sha512-Uqj49lWKB+iSSnneuwiYYJ7MZgkB+eXr0LXBhv4uDuAkXqnWmq65Sxflfvp0Lc6MdKjMUxGaeOKWJqz5SNiVIA=="],
|
||||||
|
|
||||||
"svelte-adapter-bun": ["svelte-adapter-bun@1.0.1", "", { "dependencies": { "rolldown": "^1.0.0-beta.38" }, "peerDependencies": { "@sveltejs/kit": "^2.4.0", "typescript": "^5" } }, "sha512-tNOvfm8BGgG+rmEA7hkmqtq07v7zoo4skLQc+hIoQ79J+1fkEMpJEA2RzCIe3aPc8JdrsMJkv3mpiZPMsgahjA=="],
|
"svelte-adapter-bun": ["svelte-adapter-bun@1.0.1", "", { "dependencies": { "rolldown": "^1.0.0-beta.38" }, "peerDependencies": { "@sveltejs/kit": "^2.4.0", "typescript": "^5" } }, "sha512-tNOvfm8BGgG+rmEA7hkmqtq07v7zoo4skLQc+hIoQ79J+1fkEMpJEA2RzCIe3aPc8JdrsMJkv3mpiZPMsgahjA=="],
|
||||||
|
|
||||||
@@ -689,13 +694,13 @@
|
|||||||
|
|
||||||
"tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
"tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||||
|
|
||||||
"typescript": ["typescript@7.0.2", "", { "optionalDependencies": { "@typescript/typescript-aix-ppc64": "7.0.2", "@typescript/typescript-darwin-arm64": "7.0.2", "@typescript/typescript-darwin-x64": "7.0.2", "@typescript/typescript-freebsd-arm64": "7.0.2", "@typescript/typescript-freebsd-x64": "7.0.2", "@typescript/typescript-linux-arm": "7.0.2", "@typescript/typescript-linux-arm64": "7.0.2", "@typescript/typescript-linux-loong64": "7.0.2", "@typescript/typescript-linux-mips64el": "7.0.2", "@typescript/typescript-linux-ppc64": "7.0.2", "@typescript/typescript-linux-riscv64": "7.0.2", "@typescript/typescript-linux-s390x": "7.0.2", "@typescript/typescript-linux-x64": "7.0.2", "@typescript/typescript-netbsd-arm64": "7.0.2", "@typescript/typescript-netbsd-x64": "7.0.2", "@typescript/typescript-openbsd-arm64": "7.0.2", "@typescript/typescript-openbsd-x64": "7.0.2", "@typescript/typescript-sunos-x64": "7.0.2", "@typescript/typescript-win32-arm64": "7.0.2", "@typescript/typescript-win32-x64": "7.0.2" }, "bin": { "tsc": "bin/tsc" } }, "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA=="],
|
"typescript": ["typescript@6.0.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="],
|
||||||
|
|
||||||
"uint8array-extras": ["uint8array-extras@1.5.0", "", {}, "sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A=="],
|
"uint8array-extras": ["uint8array-extras@1.6.0", "", {}, "sha512-8iAasVS4wUx0gPLjH8Xtz2PeDzTSiy8QiLGu2DT3X5GU+egFEQhpnbtkehbAwjvDcxIERmCYcysiODFmE3Ud0Q=="],
|
||||||
|
|
||||||
"undici": ["undici@6.28.1", "", {}, "sha512-zWpdTVD54H48CIybL0rWQ3ukpb9d23wM7eH5RtfdmeP70cWHNjtfo7P4vZX+5CoDcO53J4Pu5uXp7lNfjc6DRA=="],
|
"undici": ["undici@6.29.0", "", {}, "sha512-R+RODBqp6i2pPflGdq+xIOUkl+RNfGgHwoinecKu/JCuf2uO06cOKoDbI2P7Dn6KcswdKwrczbU6IYJ6K8X+wg=="],
|
||||||
|
|
||||||
"undici-types": ["undici-types@8.3.0", "", {}, "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ=="],
|
"undici-types": ["undici-types@8.9.0", "", {}, "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="],
|
||||||
|
|
||||||
"vite": ["vite@7.3.6", "", { "dependencies": { "esbuild": "^0.27.0 || ^0.28.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg=="],
|
"vite": ["vite@7.3.6", "", { "dependencies": { "esbuild": "^0.27.0 || ^0.28.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg=="],
|
||||||
|
|
||||||
@@ -703,13 +708,13 @@
|
|||||||
|
|
||||||
"wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
|
"wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
|
||||||
|
|
||||||
"ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="],
|
"ws": ["ws@8.22.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg=="],
|
||||||
|
|
||||||
"xtend": ["xtend@4.0.2", "", {}, "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="],
|
"xtend": ["xtend@4.0.2", "", {}, "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="],
|
||||||
|
|
||||||
"zimmerframe": ["zimmerframe@1.1.5", "", {}, "sha512-msJxIvYDYcoNL+PJsu+7qmpDWsYmAxTY+2TNYXXF0hzBzBk0BMecOqDOG/EckUoKCuKwObfbugIl8QpqHDXeFA=="],
|
"zimmerframe": ["zimmerframe@1.1.5", "", {}, "sha512-msJxIvYDYcoNL+PJsu+7qmpDWsYmAxTY+2TNYXXF0hzBzBk0BMecOqDOG/EckUoKCuKwObfbugIl8QpqHDXeFA=="],
|
||||||
|
|
||||||
"zipcodes-us": ["zipcodes-us@1.1.3", "", {}, "sha512-gOz8WAO6iWBU4aUc0lljpa+TKZckRKmgoHKcc1jWnn4eTbdc9XO5cXEaGccYn7GAjykueO0Wn+N7zdmzG0Uf5w=="],
|
"zipcodes-us": ["zipcodes-us@1.2.0", "", {}, "sha512-Hleo6rT/geN1JW+w1TlOQokjuRf2jLGBToPdXUCKvF0tcEbbIlgI91KXd9Uz/JGlfomjXjoyHnlslQnLPHe1LQ=="],
|
||||||
|
|
||||||
"zod": ["zod@4.6.5", "", {}, "sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q=="],
|
"zod": ["zod@4.6.5", "", {}, "sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q=="],
|
||||||
|
|
||||||
@@ -719,24 +724,20 @@
|
|||||||
|
|
||||||
"@sveltejs/kit/cookie": ["cookie@0.6.0", "", {}, "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw=="],
|
"@sveltejs/kit/cookie": ["cookie@0.6.0", "", {}, "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" }, "bundled": true }, "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ=="],
|
"@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.3", "tslib": "^2.4.0" }, "bundled": true }, "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.1", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw=="],
|
"@tailwindcss/oxide-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.11.3", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-wasm32-wasi/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.2", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA=="],
|
"@tailwindcss/oxide-wasm32-wasi/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.3", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.1.6", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1", "@emnapi/runtime": "^1.7.1" }, "bundled": true }, "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg=="],
|
"@tailwindcss/oxide-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.4", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" }, "bundled": true }, "sha512-AJxoUD2/15ESHbvpcyjU274nsAPLuOtPHCk0vKJM5pj//Fg/B1FXNWjPnXTT9PymCYYiHo4zPj0ZomXBKhoy7g=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-wasm32-wasi/@tybys/wasm-util": ["@tybys/wasm-util@0.10.3", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg=="],
|
"@tailwindcss/oxide-wasm32-wasi/@tybys/wasm-util": ["@tybys/wasm-util@0.10.4", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A=="],
|
||||||
|
|
||||||
"@tailwindcss/oxide-wasm32-wasi/tslib": ["tslib@2.8.1", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
"@tailwindcss/oxide-wasm32-wasi/tslib": ["tslib@2.8.1", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||||
|
|
||||||
"dotenv-expand/dotenv": ["dotenv@16.6.1", "", {}, "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow=="],
|
"dotenv-expand/dotenv": ["dotenv@16.6.1", "", {}, "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow=="],
|
||||||
|
|
||||||
"micromatch/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],
|
"micromatch/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],
|
||||||
|
|
||||||
"thread-stream/real-require": ["real-require@1.0.0", "", {}, "sha512-P4nbQYQfePJxRSmY+v/KINxVucm4NF3p3s7pJveMTtom52FR4YGltUQLB8idDXwDDWW+eYrWDFbuzUnjoWHF7g=="],
|
|
||||||
|
|
||||||
"@tailwindcss/oxide-wasm32-wasi/@napi-rs/wasm-runtime/@tybys/wasm-util": ["@tybys/wasm-util@0.10.4", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A=="],
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -14,10 +14,13 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/bun": "^1.4.2",
|
"@types/bun": "^1.4.2",
|
||||||
"typescript": "^7.0.2"
|
"@types/node": "^26.6.4",
|
||||||
|
"@typescript/native": "npm:typescript@7",
|
||||||
|
"typescript": "~6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pino": "^10.3.1",
|
"pino": "^10.4.0",
|
||||||
|
"pino-pretty": "^13.1.3",
|
||||||
"@sinclair/typebox": "^0.34.52"
|
"@sinclair/typebox": "^0.34.52"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,13 @@ export class PrintfulError extends Error {
|
|||||||
public status: number = 502
|
public status: number = 502
|
||||||
) {
|
) {
|
||||||
super(message);
|
super(message);
|
||||||
this.name = "PrintfulError";
|
}
|
||||||
|
|
||||||
|
toResponse() {
|
||||||
|
return new Response(JSON.stringify({ error: this.message }), {
|
||||||
|
status: this.status,
|
||||||
|
headers: { 'content-type': 'application/json' }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,13 @@ export class WebflowError extends Error {
|
|||||||
public status: number = 502
|
public status: number = 502
|
||||||
) {
|
) {
|
||||||
super(message);
|
super(message);
|
||||||
this.name = "WebflowError";
|
}
|
||||||
|
|
||||||
|
toResponse() {
|
||||||
|
return new Response(JSON.stringify({ error: this.message }), {
|
||||||
|
status: this.status,
|
||||||
|
headers: { 'content-type': 'application/json' }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,3 +42,6 @@ export const ActivityPerformanceSchema = t.Object({
|
|||||||
performance: t.Number(),
|
performance: t.Number(),
|
||||||
});
|
});
|
||||||
export type ActivityPerformance = Static<typeof ActivityPerformanceSchema>;
|
export type ActivityPerformance = Static<typeof ActivityPerformanceSchema>;
|
||||||
|
|
||||||
|
export const ActivityVerificationsSchema = t.Partial(t.Record(t.Enum(Activity), t.Boolean()));
|
||||||
|
export type ActivityVerifications = Static<typeof ActivityVerificationsSchema>;
|
||||||
|
|||||||
Reference in New Issue
Block a user