diff --git a/apps/server/src/auth/strategy/github.strategy.ts b/apps/server/src/auth/strategy/github.strategy.ts index ef501b3c7..7425c6de5 100644 --- a/apps/server/src/auth/strategy/github.strategy.ts +++ b/apps/server/src/auth/strategy/github.strategy.ts @@ -30,14 +30,14 @@ export class GitHubStrategy extends PassportStrategy(Strategy, "github") { let user: User | null = null; - if (!email) throw new BadRequestException(); + if (!email) throw new BadRequestException(ErrorMessage.InvalidCredentials); try { const user = (await this.userService.findOneByIdentifier(email)) ?? (username && (await this.userService.findOneByIdentifier(username))); - if (!user) throw new Error("User not found."); + if (!user) throw new Error(ErrorMessage.InvalidCredentials); done(null, user); } catch { diff --git a/apps/server/src/auth/strategy/google.strategy.ts b/apps/server/src/auth/strategy/google.strategy.ts index 5eb985d4a..ff446d4b2 100644 --- a/apps/server/src/auth/strategy/google.strategy.ts +++ b/apps/server/src/auth/strategy/google.strategy.ts @@ -30,14 +30,14 @@ export class GoogleStrategy extends PassportStrategy(Strategy, "google") { let user: User | null = null; - if (!email) throw new BadRequestException(); + if (!email) throw new BadRequestException(ErrorMessage.InvalidCredentials); try { const user = (await this.userService.findOneByIdentifier(email)) ?? (username && (await this.userService.findOneByIdentifier(username))); - if (!user) throw new Error("User not found."); + if (!user) throw new Error(ErrorMessage.InvalidCredentials); done(null, user); } catch { diff --git a/libs/schema/package.json b/libs/schema/package.json index 5bee1075e..682e7c370 100644 --- a/libs/schema/package.json +++ b/libs/schema/package.json @@ -8,10 +8,12 @@ "publishConfig": { "access": "public" }, - "dependencies": { - "@reactive-resume/utils": "*", + "peerDependencies": { "zod": "^3.23.8", "@paralleldrive/cuid2": "^2.2.2", + "@swc/helpers": "^0.5.15" + }, + "devDependencies": { "@swc/helpers": "~0.5.11" } } diff --git a/libs/schema/src/sample.ts b/libs/schema/src/sample.ts index 22f319f49..8ce89dbe0 100644 --- a/libs/schema/src/sample.ts +++ b/libs/schema/src/sample.ts @@ -1,4 +1,4 @@ -import { ResumeData } from "."; +import { ResumeData } from "./index"; export const sampleResume: ResumeData = { basics: { diff --git a/libs/schema/src/sections/index.ts b/libs/schema/src/sections/index.ts index 556410c4b..121b216c9 100644 --- a/libs/schema/src/sections/index.ts +++ b/libs/schema/src/sections/index.ts @@ -1,6 +1,6 @@ -import { FilterKeys } from "@reactive-resume/utils"; import { z } from "zod"; +import { FilterKeys } from "../shared"; import { idSchema } from "../shared"; import { awardSchema } from "./award"; import { certificationSchema } from "./certification"; diff --git a/libs/schema/src/shared/index.ts b/libs/schema/src/shared/index.ts index e3140fbfb..a6244bedb 100644 --- a/libs/schema/src/shared/index.ts +++ b/libs/schema/src/shared/index.ts @@ -1,3 +1,4 @@ export * from "./id"; export * from "./item"; +export * from "./types"; export * from "./url"; diff --git a/libs/schema/src/shared/types.ts b/libs/schema/src/shared/types.ts new file mode 100644 index 000000000..cbd6b22b9 --- /dev/null +++ b/libs/schema/src/shared/types.ts @@ -0,0 +1,3 @@ +export type FilterKeys = { + [Key in keyof T]: T[Key] extends Condition ? Key : never; +}[keyof T]; diff --git a/package.json b/package.json index bb5724f84..20c1d2fe7 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "eslint-plugin-jsx-a11y": "^6.10.2", "eslint-plugin-lingui": "^0.9.0", "eslint-plugin-prettier": "^5.2.1", - "eslint-plugin-react": "^7.37.3", + "eslint-plugin-react": "^7.37.4", "eslint-plugin-react-hooks": "^4.6.2", "eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-tailwindcss": "^3.17.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 03e46cee9..1dfcb1916 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -574,8 +574,8 @@ importers: specifier: ^5.2.1 version: 5.2.1(@types/eslint@8.56.5)(eslint-config-prettier@9.1.0(eslint@8.57.0))(eslint@8.57.0)(prettier@3.4.2) eslint-plugin-react: - specifier: ^7.37.3 - version: 7.37.3(eslint@8.57.0) + specifier: ^7.37.4 + version: 7.37.4(eslint@8.57.0) eslint-plugin-react-hooks: specifier: ^4.6.2 version: 4.6.2(eslint@8.57.0) @@ -6345,8 +6345,8 @@ packages: peerDependencies: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 - eslint-plugin-react@7.37.3: - resolution: {integrity: sha512-DomWuTQPFYZwF/7c9W2fkKkStqZmBd3uugfqBYLdkZ3Hii23WzZuOLUskGxB8qkSKqftxEeGL1TB2kMhrce0jA==} + eslint-plugin-react@7.37.4: + resolution: {integrity: sha512-BGP0jRmfYyvOyvMoRX/uoUeW+GqNj9y16bPQzqAHf3AYII/tDs+jMN0dBVkl88/OZwNGwrVFxE7riHsXVfy/LQ==} engines: {node: '>=4'} peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7 @@ -16805,7 +16805,7 @@ snapshots: array-buffer-byte-length@1.0.1: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 is-array-buffer: 3.0.4 array-buffer-byte-length@1.0.2: @@ -16817,12 +16817,12 @@ snapshots: array-includes@3.1.8: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.23.9 es-object-atoms: 1.0.0 - get-intrinsic: 1.2.4 - is-string: 1.0.7 + get-intrinsic: 1.2.7 + is-string: 1.1.1 array-timsort@1.0.3: {} @@ -16830,9 +16830,9 @@ snapshots: array.prototype.findlast@1.2.5: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.23.9 es-errors: 1.3.0 es-object-atoms: 1.0.0 es-shim-unscopables: 1.0.2 @@ -16869,16 +16869,16 @@ snapshots: array.prototype.tosorted@1.1.4: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.23.9 es-errors: 1.3.0 es-shim-unscopables: 1.0.2 arraybuffer.prototype.slice@1.0.3: dependencies: array-buffer-byte-length: 1.0.1 - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 es-abstract: 1.23.3 es-errors: 1.3.0 @@ -17297,8 +17297,8 @@ snapshots: call-bind@1.0.8: dependencies: call-bind-apply-helpers: 1.0.1 - es-define-property: 1.0.0 - get-intrinsic: 1.2.4 + es-define-property: 1.0.1 + get-intrinsic: 1.2.7 set-function-length: 1.2.2 call-bound@1.0.3: @@ -17859,7 +17859,7 @@ snapshots: data-view-buffer@1.0.1: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 es-errors: 1.3.0 is-data-view: 1.0.1 @@ -17871,7 +17871,7 @@ snapshots: data-view-byte-length@1.0.1: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 es-errors: 1.3.0 is-data-view: 1.0.1 @@ -17883,7 +17883,7 @@ snapshots: data-view-byte-offset@1.0.0: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 es-errors: 1.3.0 is-data-view: 1.0.1 @@ -18298,7 +18298,7 @@ snapshots: define-properties: 1.2.1 es-abstract: 1.23.9 es-errors: 1.3.0 - es-set-tostringtag: 2.0.3 + es-set-tostringtag: 2.1.0 function-bind: 1.1.2 get-intrinsic: 1.2.7 globalthis: 1.0.4 @@ -18344,8 +18344,8 @@ snapshots: es-to-primitive@1.3.0: dependencies: is-callable: 1.2.7 - is-date-object: 1.0.5 - is-symbol: 1.0.4 + is-date-object: 1.1.0 + is-symbol: 1.1.1 esbuild@0.17.19: optionalDependencies: @@ -18519,7 +18519,7 @@ snapshots: dependencies: eslint: 8.57.0 - eslint-plugin-react@7.37.3(eslint@8.57.0): + eslint-plugin-react@7.37.4(eslint@8.57.0): dependencies: array-includes: 3.1.8 array.prototype.findlast: 1.2.5 @@ -19127,7 +19127,7 @@ snapshots: function.prototype.name@1.1.6: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 es-abstract: 1.23.3 functions-have-names: 1.2.3 @@ -19194,7 +19194,7 @@ snapshots: get-symbol-description@1.0.2: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 es-errors: 1.3.0 get-intrinsic: 1.2.4 @@ -19351,7 +19351,7 @@ snapshots: has-property-descriptors@1.0.2: dependencies: - es-define-property: 1.0.0 + es-define-property: 1.0.1 has-proto@1.0.3: {} @@ -19691,12 +19691,12 @@ snapshots: is-arguments@1.1.1: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 has-tostringtag: 1.0.2 is-array-buffer@3.0.4: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 get-intrinsic: 1.2.4 is-array-buffer@3.0.5: @@ -19727,7 +19727,7 @@ snapshots: is-boolean-object@1.1.2: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 has-tostringtag: 1.0.2 is-boolean-object@1.2.1: @@ -19856,7 +19856,7 @@ snapshots: is-shared-array-buffer@1.0.3: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 is-shared-array-buffer@1.0.4: dependencies: @@ -19877,7 +19877,7 @@ snapshots: is-symbol@1.0.4: dependencies: - has-symbols: 1.0.3 + has-symbols: 1.1.0 is-symbol@1.1.1: dependencies: @@ -19899,7 +19899,7 @@ snapshots: is-weakref@1.0.2: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 is-weakref@1.1.0: dependencies: @@ -20469,8 +20469,8 @@ snapshots: dependencies: array-includes: 3.1.8 array.prototype.flat: 1.3.2 - object.assign: 4.1.5 - object.values: 1.2.0 + object.assign: 4.1.7 + object.values: 1.2.1 jszip@3.10.1: dependencies: @@ -21600,7 +21600,7 @@ snapshots: object.assign@4.1.5: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 has-symbols: 1.0.3 object-keys: 1.1.1 @@ -21616,15 +21616,15 @@ snapshots: object.entries@1.1.8: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 es-object-atoms: 1.0.0 object.fromentries@2.0.8: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.23.9 es-object-atoms: 1.0.0 object.groupby@1.0.3: @@ -22845,7 +22845,7 @@ snapshots: regexp.prototype.flags@1.5.2: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 es-errors: 1.3.0 set-function-name: 2.0.2 @@ -23009,7 +23009,7 @@ snapshots: safe-array-concat@1.1.2: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 get-intrinsic: 1.2.4 has-symbols: 1.0.3 isarray: 2.0.5 @@ -23293,7 +23293,7 @@ snapshots: side-channel@1.0.6: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 es-errors: 1.3.0 get-intrinsic: 1.2.4 object-inspect: 1.13.1 @@ -23526,7 +23526,7 @@ snapshots: string.prototype.repeat@1.0.0: dependencies: define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.23.9 string.prototype.trim@1.2.10: dependencies: @@ -23540,7 +23540,7 @@ snapshots: string.prototype.trim@1.2.9: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 es-abstract: 1.23.3 es-object-atoms: 1.0.0 @@ -23560,7 +23560,7 @@ snapshots: string.prototype.trimstart@1.0.8: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 es-object-atoms: 1.0.0 @@ -24035,7 +24035,7 @@ snapshots: typed-array-buffer@1.0.2: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 es-errors: 1.3.0 is-typed-array: 1.1.13 @@ -24047,7 +24047,7 @@ snapshots: typed-array-byte-length@1.0.1: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 for-each: 0.3.3 gopd: 1.0.1 has-proto: 1.0.3 @@ -24064,7 +24064,7 @@ snapshots: typed-array-byte-offset@1.0.2: dependencies: available-typed-arrays: 1.0.7 - call-bind: 1.0.7 + call-bind: 1.0.8 for-each: 0.3.3 gopd: 1.0.1 has-proto: 1.0.3 @@ -24082,7 +24082,7 @@ snapshots: typed-array-length@1.0.6: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 for-each: 0.3.3 gopd: 1.0.1 has-proto: 1.0.3 @@ -24125,7 +24125,7 @@ snapshots: unbox-primitive@1.0.2: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 has-bigints: 1.0.2 has-symbols: 1.0.3 which-boxed-primitive: 1.0.2 @@ -24556,7 +24556,7 @@ snapshots: is-bigint: 1.0.4 is-boolean-object: 1.1.2 is-number-object: 1.0.7 - is-string: 1.0.7 + is-string: 1.1.1 is-symbol: 1.0.4 which-boxed-primitive@1.1.1: @@ -24593,7 +24593,7 @@ snapshots: which-typed-array@1.1.15: dependencies: available-typed-arrays: 1.0.7 - call-bind: 1.0.7 + call-bind: 1.0.8 for-each: 0.3.3 gopd: 1.0.1 has-tostringtag: 1.0.2