From 0a25c7df6693c38e9b9b680a8ded24b4e3bea178 Mon Sep 17 00:00:00 2001 From: aericio <16523741+Aericio@users.noreply.github.com> Date: Tue, 28 May 2024 14:25:37 -1000 Subject: [PATCH] chore: compile typescript files --- dist/index.d.ts | 266 +++++++++++++++++++++++++++ dist/index.js | 14 ++ dist/index.js.map | 1 + dist/schema.d.ts | 435 +++++++++++++++++++++++++++++++++++++++++++++ dist/schema.js | 59 ++++++ dist/schema.js.map | 1 + dist/types.d.ts | 69 +++++++ dist/types.js | 33 ++++ dist/types.js.map | 1 + eslint.config.js | 7 +- package.json | 6 +- tsconfig.json | 28 +-- 12 files changed, 899 insertions(+), 21 deletions(-) create mode 100644 dist/index.d.ts create mode 100644 dist/index.js create mode 100644 dist/index.js.map create mode 100644 dist/schema.d.ts create mode 100644 dist/schema.js create mode 100644 dist/schema.js.map create mode 100644 dist/types.d.ts create mode 100644 dist/types.js create mode 100644 dist/types.js.map diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..d1b585e --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,266 @@ +import postgres from "postgres"; +/** + * @param connectionString See {@link https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING-URIS Postgres Connection URIs} + */ +export default function initializeDatabase({ connectionUri, }: { + connectionUri: string; +}): { + client: postgres.Sql<{}>; + db: import("drizzle-orm/postgres-js").PostgresJsDatabase<{ + cosmetics: import("drizzle-orm/pg-core").PgTableWithColumns<{ + name: "cosmetics"; + schema: undefined; + columns: { + id: import("drizzle-orm/pg-core").PgColumn<{ + name: "id"; + tableName: "cosmetics"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + }, {}, {}>; + title: import("drizzle-orm/pg-core").PgColumn<{ + name: "title"; + tableName: "cosmetics"; + dataType: "json"; + columnType: "PgJson"; + data: unknown; + driverParam: unknown; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + description: import("drizzle-orm/pg-core").PgColumn<{ + name: "description"; + tableName: "cosmetics"; + dataType: "json"; + columnType: "PgJson"; + data: unknown; + driverParam: unknown; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + creation_date: import("drizzle-orm/pg-core").PgColumn<{ + name: "creation_date"; + tableName: "cosmetics"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + last_modified: import("drizzle-orm/pg-core").PgColumn<{ + name: "last_modified"; + tableName: "cosmetics"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + start_date: import("drizzle-orm/pg-core").PgColumn<{ + name: "start_date"; + tableName: "cosmetics"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: false; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + end_date: import("drizzle-orm/pg-core").PgColumn<{ + name: "end_date"; + tableName: "cosmetics"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: false; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + thumbnail: import("drizzle-orm/pg-core").PgColumn<{ + name: "thumbnail"; + tableName: "cosmetics"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + }, {}, {}>; + images: import("drizzle-orm/pg-core").PgColumn<{ + name: "images"; + tableName: "cosmetics"; + dataType: "json"; + columnType: "PgJson"; + data: unknown; + driverParam: unknown; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + avg_rating: import("drizzle-orm/pg-core").PgColumn<{ + name: "avg_rating"; + tableName: "cosmetics"; + dataType: "number"; + columnType: "PgReal"; + data: number; + driverParam: string | number; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + ratings: import("drizzle-orm/pg-core").PgColumn<{ + name: "ratings"; + tableName: "cosmetics"; + dataType: "json"; + columnType: "PgJson"; + data: unknown; + driverParam: unknown; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + price: import("drizzle-orm/pg-core").PgColumn<{ + name: "price"; + tableName: "cosmetics"; + dataType: "number"; + columnType: "PgInteger"; + data: number; + driverParam: string | number; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + manual_tags: import("drizzle-orm/pg-core").PgColumn<{ + name: "manual_tags"; + tableName: "cosmetics"; + dataType: "array"; + columnType: "PgArray"; + data: string[]; + driverParam: string | string[]; + notNull: false; + hasDefault: true; + enumValues: [string, ...string[]]; + baseColumn: import("drizzle-orm").Column<{ + name: "manual_tags"; + tableName: "cosmetics"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: false; + hasDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + }, object, object>; + }, {}, {}>; + row_created: import("drizzle-orm/pg-core").PgColumn<{ + name: "row_created"; + tableName: "cosmetics"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: false; + hasDefault: true; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + row_updated: import("drizzle-orm/pg-core").PgColumn<{ + name: "row_updated"; + tableName: "cosmetics"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: false; + hasDefault: true; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + }; + dialect: "pg"; + }>; + players: import("drizzle-orm/pg-core").PgTableWithColumns<{ + name: "players"; + schema: undefined; + columns: { + id: import("drizzle-orm/pg-core").PgColumn<{ + name: "uuid"; + tableName: "players"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + }, {}, {}>; + username: import("drizzle-orm/pg-core").PgColumn<{ + name: "username"; + tableName: "players"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + }, {}, {}>; + rank: import("drizzle-orm/pg-core").PgColumn<{ + name: "rank"; + tableName: "players"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + }, {}, {}>; + equipped_avatar: import("drizzle-orm/pg-core").PgColumn<{ + name: "equipped_avatar"; + tableName: "players"; + dataType: "json"; + columnType: "PgJson"; + data: unknown; + driverParam: unknown; + notNull: false; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + }; + dialect: "pg"; + }>; + }>; +}; +export * from "./types"; +export { CosmeticSchema, PlayerSchema } from "./schema"; diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..c204fdb --- /dev/null +++ b/dist/index.js @@ -0,0 +1,14 @@ +import postgres from "postgres"; +import { drizzle } from "drizzle-orm/postgres-js"; +import { cosmetics, players } from "./schema"; +/** + * @param connectionString See {@link https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING-URIS Postgres Connection URIs} + */ +export default function initializeDatabase({ connectionUri, }) { + const client = postgres(connectionUri, { prepare: false }); + const db = drizzle(client, { schema: { cosmetics, players } }); + return { client, db }; +} +export * from "./types"; +export { CosmeticSchema, PlayerSchema } from "./schema"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000..499abf2 --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,aAAa,GAGd;IACC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3D,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IAE/D,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AACxB,CAAC;AAED,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"} \ No newline at end of file diff --git a/dist/schema.d.ts b/dist/schema.d.ts new file mode 100644 index 0000000..e39a2fe --- /dev/null +++ b/dist/schema.d.ts @@ -0,0 +1,435 @@ +import { z } from "zod"; +/** + * Players Schema + */ +export declare const players: import("drizzle-orm/pg-core").PgTableWithColumns<{ + name: "players"; + schema: undefined; + columns: { + id: import("drizzle-orm/pg-core").PgColumn<{ + name: "uuid"; + tableName: "players"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + }, {}, {}>; + username: import("drizzle-orm/pg-core").PgColumn<{ + name: "username"; + tableName: "players"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + }, {}, {}>; + rank: import("drizzle-orm/pg-core").PgColumn<{ + name: "rank"; + tableName: "players"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + }, {}, {}>; + equipped_avatar: import("drizzle-orm/pg-core").PgColumn<{ + name: "equipped_avatar"; + tableName: "players"; + dataType: "json"; + columnType: "PgJson"; + data: unknown; + driverParam: unknown; + notNull: false; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + }; + dialect: "pg"; +}>; +export declare const PlayerSchema: z.ZodObject<{ + id: z.ZodString; + username: z.ZodString; + rank: z.ZodString; + equipped_avatar: z.ZodObject<{ + url: z.ZodString; + name: z.ZodString; + }, "strip", z.ZodTypeAny, { + url: string; + name: string; + }, { + url: string; + name: string; + }>; +}, "strip", z.ZodTypeAny, { + id: string; + username: string; + rank: string; + equipped_avatar: { + url: string; + name: string; + }; +}, { + id: string; + username: string; + rank: string; + equipped_avatar: { + url: string; + name: string; + }; +}>; +export type PlayerSchema = z.infer; +/** + * Cosmetics Schema + */ +export declare const cosmetics: import("drizzle-orm/pg-core").PgTableWithColumns<{ + name: "cosmetics"; + schema: undefined; + columns: { + id: import("drizzle-orm/pg-core").PgColumn<{ + name: "id"; + tableName: "cosmetics"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + }, {}, {}>; + title: import("drizzle-orm/pg-core").PgColumn<{ + name: "title"; + tableName: "cosmetics"; + dataType: "json"; + columnType: "PgJson"; + data: unknown; + driverParam: unknown; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + description: import("drizzle-orm/pg-core").PgColumn<{ + name: "description"; + tableName: "cosmetics"; + dataType: "json"; + columnType: "PgJson"; + data: unknown; + driverParam: unknown; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + creation_date: import("drizzle-orm/pg-core").PgColumn<{ + name: "creation_date"; + tableName: "cosmetics"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + last_modified: import("drizzle-orm/pg-core").PgColumn<{ + name: "last_modified"; + tableName: "cosmetics"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + start_date: import("drizzle-orm/pg-core").PgColumn<{ + name: "start_date"; + tableName: "cosmetics"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: false; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + end_date: import("drizzle-orm/pg-core").PgColumn<{ + name: "end_date"; + tableName: "cosmetics"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: false; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + thumbnail: import("drizzle-orm/pg-core").PgColumn<{ + name: "thumbnail"; + tableName: "cosmetics"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + }, {}, {}>; + images: import("drizzle-orm/pg-core").PgColumn<{ + name: "images"; + tableName: "cosmetics"; + dataType: "json"; + columnType: "PgJson"; + data: unknown; + driverParam: unknown; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + avg_rating: import("drizzle-orm/pg-core").PgColumn<{ + name: "avg_rating"; + tableName: "cosmetics"; + dataType: "number"; + columnType: "PgReal"; + data: number; + driverParam: string | number; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + ratings: import("drizzle-orm/pg-core").PgColumn<{ + name: "ratings"; + tableName: "cosmetics"; + dataType: "json"; + columnType: "PgJson"; + data: unknown; + driverParam: unknown; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + price: import("drizzle-orm/pg-core").PgColumn<{ + name: "price"; + tableName: "cosmetics"; + dataType: "number"; + columnType: "PgInteger"; + data: number; + driverParam: string | number; + notNull: true; + hasDefault: false; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + manual_tags: import("drizzle-orm/pg-core").PgColumn<{ + name: "manual_tags"; + tableName: "cosmetics"; + dataType: "array"; + columnType: "PgArray"; + data: string[]; + driverParam: string | string[]; + notNull: false; + hasDefault: true; + enumValues: [string, ...string[]]; + baseColumn: import("drizzle-orm").Column<{ + name: "manual_tags"; + tableName: "cosmetics"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: false; + hasDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + }, object, object>; + }, {}, {}>; + row_created: import("drizzle-orm/pg-core").PgColumn<{ + name: "row_created"; + tableName: "cosmetics"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: false; + hasDefault: true; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + row_updated: import("drizzle-orm/pg-core").PgColumn<{ + name: "row_updated"; + tableName: "cosmetics"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: false; + hasDefault: true; + enumValues: undefined; + baseColumn: never; + }, {}, {}>; + }; + dialect: "pg"; +}>; +export declare const CosmeticSchema: z.ZodObject<{ + id: z.ZodString; + title: z.ZodObject<{ + neutral: z.ZodString; + }, "strip", z.ZodString, z.objectOutputType<{ + neutral: z.ZodString; + }, z.ZodString, "strip">, z.objectInputType<{ + neutral: z.ZodString; + }, z.ZodString, "strip">>; + description: z.ZodObject<{ + neutral: z.ZodString; + }, "strip", z.ZodString, z.objectOutputType<{ + neutral: z.ZodString; + }, z.ZodString, "strip">, z.objectInputType<{ + neutral: z.ZodString; + }, z.ZodString, "strip">>; + creation_date: z.ZodDate; + last_modified: z.ZodDate; + start_date: z.ZodNullable; + end_date: z.ZodNullable; + thumbnail: z.ZodString; + images: z.ZodArray, "many">; + avg_rating: z.ZodNumber; + ratings: z.ZodObject<{ + Average: z.ZodDefault; + TotalCount: z.ZodDefault; + Count5Star: z.ZodDefault; + Count4Star: z.ZodDefault; + Count3Star: z.ZodDefault; + Count2Star: z.ZodDefault; + Count1Star: z.ZodDefault; + }, "strip", z.ZodTypeAny, { + Average: number; + TotalCount: number; + Count5Star: number; + Count4Star: number; + Count3Star: number; + Count2Star: number; + Count1Star: number; + }, { + Average?: number | undefined; + TotalCount?: number | undefined; + Count5Star?: number | undefined; + Count4Star?: number | undefined; + Count3Star?: number | undefined; + Count2Star?: number | undefined; + Count1Star?: number | undefined; + }>; + price: z.ZodNumber; + manual_tags: z.ZodArray; + row_created: z.ZodOptional; + row_updated: z.ZodOptional; +}, "strip", z.ZodTypeAny, { + id: string; + title: { + neutral: string; + } & { + [k: string]: string; + }; + description: { + neutral: string; + } & { + [k: string]: string; + }; + creation_date: Date; + last_modified: Date; + start_date: Date | null; + end_date: Date | null; + thumbnail: string; + images: { + Id: string; + Tag: string; + Type: string; + Url: string; + }[]; + avg_rating: number; + ratings: { + Average: number; + TotalCount: number; + Count5Star: number; + Count4Star: number; + Count3Star: number; + Count2Star: number; + Count1Star: number; + }; + price: number; + manual_tags: string[]; + row_created?: Date | undefined; + row_updated?: Date | undefined; +}, { + id: string; + title: { + neutral: string; + } & { + [k: string]: string; + }; + description: { + neutral: string; + } & { + [k: string]: string; + }; + creation_date: Date; + last_modified: Date; + start_date: Date | null; + end_date: Date | null; + thumbnail: string; + images: { + Id: string; + Tag: string; + Type: string; + Url: string; + }[]; + avg_rating: number; + ratings: { + Average?: number | undefined; + TotalCount?: number | undefined; + Count5Star?: number | undefined; + Count4Star?: number | undefined; + Count3Star?: number | undefined; + Count2Star?: number | undefined; + Count1Star?: number | undefined; + }; + price: number; + manual_tags: string[]; + row_created?: Date | undefined; + row_updated?: Date | undefined; +}>; +export type CosmeticSchema = z.infer; diff --git a/dist/schema.js b/dist/schema.js new file mode 100644 index 0000000..cd9f601 --- /dev/null +++ b/dist/schema.js @@ -0,0 +1,59 @@ +import { integer, json, pgTable, real, text, timestamp, } from "drizzle-orm/pg-core"; +import { CosmeticImage, CosmeticLocalizedString, CosmeticRating, PlayerAvatar, } from "./types"; +import { sql } from "drizzle-orm"; +import { z } from "zod"; +/** + * Players Schema + */ +export const players = pgTable("players", { + id: text("uuid").primaryKey().notNull(), + username: text("username").notNull(), + rank: text("rank").notNull(), + equipped_avatar: json("equipped_avatar"), +}); +export const PlayerSchema = z.object({ + id: z.string(), + username: z.string(), + rank: z.string(), + equipped_avatar: PlayerAvatar, +}); +/** + * Cosmetics Schema + */ +export const cosmetics = pgTable("cosmetics", { + id: text("id").primaryKey().notNull(), + title: json("title").notNull(), + description: json("description").notNull(), + creation_date: timestamp("creation_date").notNull(), + last_modified: timestamp("last_modified").notNull(), + start_date: timestamp("start_date"), + end_date: timestamp("end_date"), + thumbnail: text("thumbnail").notNull(), + images: json("images").notNull(), + avg_rating: real("avg_rating").notNull(), + ratings: json("ratings").notNull(), + price: integer("price").notNull(), + manual_tags: text("manual_tags") + .array() + .default(sql `ARRAY[]::text[]`), + row_created: timestamp("row_created").defaultNow(), + row_updated: timestamp("row_updated").defaultNow(), +}); +export const CosmeticSchema = z.object({ + id: z.string(), + title: CosmeticLocalizedString, + description: CosmeticLocalizedString, + creation_date: z.date(), + last_modified: z.date(), + start_date: z.date().nullable(), + end_date: z.date().nullable(), + thumbnail: z.string(), + images: z.array(CosmeticImage), + avg_rating: z.number(), + ratings: CosmeticRating, + price: z.number(), + manual_tags: z.array(z.string()), + row_created: z.date().optional(), + row_updated: z.date().optional(), +}); +//# sourceMappingURL=schema.js.map \ No newline at end of file diff --git a/dist/schema.js.map b/dist/schema.js.map new file mode 100644 index 0000000..49ca26f --- /dev/null +++ b/dist/schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,SAAS,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,cAAc,EACd,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,C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dist/types.d.ts new file mode 100644 index 0000000..a08e0a5 --- /dev/null +++ b/dist/types.d.ts @@ -0,0 +1,69 @@ +import { z } from "zod"; +/** + * Player Types + */ +export declare const PlayerAvatar: z.ZodObject<{ + url: z.ZodString; + name: z.ZodString; +}, "strip", z.ZodTypeAny, { + url: string; + name: string; +}, { + url: string; + name: string; +}>; +export type PlayerAvatar = z.infer; +/** + * Cosmetic Types + */ +export declare const CosmeticLocalizedString: z.ZodObject<{ + neutral: z.ZodString; +}, "strip", z.ZodString, z.objectOutputType<{ + neutral: z.ZodString; +}, z.ZodString, "strip">, z.objectInputType<{ + neutral: z.ZodString; +}, z.ZodString, "strip">>; +export type CosmeticImageLocalizedString = z.infer; +export declare const CosmeticImage: z.ZodObject<{ + Id: z.ZodString; + Tag: z.ZodString; + Type: z.ZodString; + Url: z.ZodString; +}, "strip", z.ZodTypeAny, { + Id: string; + Tag: string; + Type: string; + Url: string; +}, { + Id: string; + Tag: string; + Type: string; + Url: string; +}>; +export type CosmeticImage = z.infer; +export declare const CosmeticRating: z.ZodObject<{ + Average: z.ZodDefault; + TotalCount: z.ZodDefault; + Count5Star: z.ZodDefault; + Count4Star: z.ZodDefault; + Count3Star: z.ZodDefault; + Count2Star: z.ZodDefault; + Count1Star: z.ZodDefault; +}, "strip", z.ZodTypeAny, { + Average: number; + TotalCount: number; + Count5Star: number; + Count4Star: number; + Count3Star: number; + Count2Star: number; + Count1Star: number; +}, { + Average?: number | undefined; + TotalCount?: number | undefined; + Count5Star?: number | undefined; + Count4Star?: number | undefined; + Count3Star?: number | undefined; + Count2Star?: number | undefined; + Count1Star?: number | undefined; +}>; +export type CosmeticRating = z.infer; diff --git a/dist/types.js b/dist/types.js new file mode 100644 index 0000000..7effb35 --- /dev/null +++ b/dist/types.js @@ -0,0 +1,33 @@ +import { z } from "zod"; +/** + * Player Types + */ +export const PlayerAvatar = z.object({ + url: z.string(), + name: z.string(), +}); +/** + * Cosmetic Types + */ +export const CosmeticLocalizedString = z + .object({ + neutral: z.string(), +}) + .catchall(z.string()); +export const CosmeticImage = z.object({ + Id: z.string(), + Tag: z.string(), + Type: z.string(), + Url: z.string(), +}); +const CosmeticRatingDefaultNumber = z.number().default(0); +export const CosmeticRating = z.object({ + Average: CosmeticRatingDefaultNumber, + TotalCount: CosmeticRatingDefaultNumber, + Count5Star: CosmeticRatingDefaultNumber, + Count4Star: CosmeticRatingDefaultNumber, + Count3Star: CosmeticRatingDefaultNumber, + Count2Star: CosmeticRatingDefaultNumber, + Count1Star: CosmeticRatingDefaultNumber, +}); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/dist/types.js.map b/dist/types.js.map new file mode 100644 index 0000000..7af72c1 --- /dev/null +++ b/dist/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC;AAGH;;GAEG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACrC,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC;KACD,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AAKxB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAC;AAGH,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,2BAA2B;IACpC,UAAU,EAAE,2BAA2B;IACvC,UAAU,EAAE,2BAA2B;IACvC,UAAU,EAAE,2BAA2B;IACvC,UAAU,EAAE,2BAA2B;IACvC,UAAU,EAAE,2BAA2B;IACvC,UAAU,EAAE,2BAA2B;CACxC,CAAC,CAAC"} \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js index 8bb55a8..d842eef 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,3 +1,8 @@ import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; -export default [eslintPluginPrettierRecommended]; +export default [ + eslintPluginPrettierRecommended, + { + ignores: ["dist/"], + }, +]; diff --git a/package.json b/package.json index 71e26c5..7231fbb 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,13 @@ { "name": "hive-tools-database", "version": "1.0.0", - "main": "src/index.ts", + "main": "dist/index.js", + "types": "dist/index.d.ts", "type": "module", "author": "paroxity", + "scripts": { + "build": "tsc" + }, "dependencies": { "drizzle-kit": "^0.21.4", "drizzle-orm": "^0.30.10", diff --git a/tsconfig.json b/tsconfig.json index e7f838d..ee85539 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,27 +1,17 @@ { "compilerOptions": { - // Enable latest features + "declaration": true, + "esModuleInterop": true, "lib": ["ESNext", "DOM"], - "target": "ESNext", "module": "ESNext", - "moduleDetection": "force", - "allowJs": true, - - // Bundler mode "moduleResolution": "bundler", - "verbatimModuleSyntax": true, - "noEmit": true, - + "outDir": "dist", + "skipLibCheck": true, "sourceMap": true, - - // Best practices "strict": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, - - // Some stricter flags (disabled by default) - "noUnusedLocals": false, - "noUnusedParameters": false, - "noPropertyAccessFromIndexSignature": false - } + "target": "ESNext", + "resolveJsonModule": true, + }, + "include": ["src"], + "exclude": ["node_modules", "dist"] }