-
Notifications
You must be signed in to change notification settings - Fork 6
Upgrades / Nest 11 #3407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrades / Nest 11 #3407
Conversation
Upstreamed in the upgraded Nest module
This was not needed before because CoreModule is global. And AuthorizationModule is global, which imports this module. Now it is necessary to help Nest know that Core needs to initialize before this module. Specifically, the PolicyFactory using the GraphQL schema, via the ResourcesHost, to determine interfaces. And the schema needs to be built (on init) before the PolicyFactory.onModuleInit is called.
5.3 is causing too complex issues with Gel
Really we just need to drop winston all together and simplify the logging layer
Also fix the case of empty input/output trying to be cast
cypher-query-builder is fine with v7 and angular schematics use pinned versions stupidly
We don't even use the stupid thing.
📝 WalkthroughWalkthroughThis set of changes primarily updates dependency versions and refines type imports and usage throughout the codebase. The Changes
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (12)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (4)
src/core/config/version.service.ts (2)
43-44
: Trim explicit.stdout
on$
results
$
already returnsExecaReturnValue
withstripFinalNewline: true
by default, sores.stdout
is a trimmed string.
If you expect to run these commands in an environment where that option might be changed globally, defensively calltrim()
once more to guarantee no stray\n
enters theVersion
string.- const res = await $`git symbolic-ref -q --short HEAD`; - return res.stdout; + const res = await $`git symbolic-ref -q --short HEAD`; + return res.stdout.trim();(do the same for
git rev-parse …
)Also applies to: 56-57
64-70
: HandlepackageJson.version
absence explicitly
readPackageUp()
can succeed yet still return apackageJson
without aversion
(e.g. workspaces / templates).
Returningundefined
is fine, but we can skip thetry/catch
and make intent clearer:-try { - return res.packageJson.version; -} catch (e) { - return undefined; -} +return res.packageJson?.version ?? undefined;Reduces one layer of silent failure.
src/core/http/http.adapter.ts (1)
38-46
: Relying on private FastifyAdapter internals is brittle
injectRouteOptions
is still private upstream. If its signature changes in a future Fastify/Nest release, TypeScript won’t warn because of the@ts-expect-error
.
Safer alternative: copy the original implementation (it's tiny) or open an upstream issue to make itprotected
.No action required now, but keep this in mind when upgrading.
package.json (1)
42-42
: Review version range for@graphql-hive/yoga
Using a loose">=0.41.0"
range may pull in future incompatible releases. Consider pinning with a caret (e.g.,^0.41.0
) for more predictable behavior.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
.yarn/patches/@whatwg-node-fetch-npm-0.10.6-bca79028fb.patch
is excluded by!**/.yarn/**
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (14)
package.json
(5 hunks)src/common/generate-id.ts
(1 hunks)src/common/temporal/calendar-date.ts
(2 hunks)src/common/url.field.ts
(1 hunks)src/common/validators/email.validator.ts
(1 hunks)src/components/authentication/crypto.service.ts
(1 hunks)src/components/authorization/policy/policy.module.ts
(2 hunks)src/components/file/media/media-detector.service.ts
(1 hunks)src/core/config/version.service.ts
(3 hunks)src/core/events/event-handler.decorator.ts
(1 hunks)src/core/exception/exception.normalizer.ts
(2 hunks)src/core/graphql/graphql.options.ts
(0 hunks)src/core/http/http.adapter.ts
(2 hunks)src/core/resources/loader.registry.ts
(1 hunks)
💤 Files with no reviewable changes (1)
- src/core/graphql/graphql.options.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/core/events/event-handler.decorator.ts (2)
src/components/authorization/policy/conditions/condition.interface.ts (1)
id
(35-43)src/common/id-field.ts (1)
ID
(24-25)
🪛 Biome (1.9.4)
src/common/temporal/calendar-date.ts
[error] 169-169: Using super in a static context can be confusing.
super refers to a parent class.
(lint/complexity/noThisInStatic)
[error] 178-178: Using super in a static context can be confusing.
super refers to a parent class.
(lint/complexity/noThisInStatic)
🔇 Additional comments (32)
src/common/validators/email.validator.ts (1)
2-2
: Import style updated to match new validator package requirementsThe change from default import to namespace import aligns with the validator library's updated module structure, ensuring type compatibility while maintaining the same functionality.
src/common/url.field.ts (1)
6-6
: Import style updated consistently with other validator usageThe change to namespace import style is consistent with the same change in email.validator.ts, ensuring uniform usage of the validator library across the codebase after the dependency upgrade.
src/components/authorization/policy/policy.module.ts (1)
2-2
: Added CoreModule dependency to PolicyModuleThe PolicyModule now properly imports CoreModule, ensuring it has access to core functionality. This change likely addresses dependencies that became necessary after the NestJS 11 upgrade.
Also applies to: 15-15
src/components/file/media/media-detector.service.ts (1)
7-7
: Updated type import path for image-size packageThe import for
ISize
has been updated to use the new type definition path and includes the explicittype
keyword, making it a type-only import. This change adapts to the updated structure of the image-size package while improving type handling.src/core/events/event-handler.decorator.ts (1)
58-58
: Improved typing styleGreat improvement switching from type assertion (
as ID
) to explicit type annotation (: ID
). This is considered better TypeScript practice as it's more declarative and allows the compiler to verify type compatibility rather than forcing a type.src/components/authentication/crypto.service.ts (1)
17-23
: Well-simplified code with reduced dependenciesGreat simplification of the
argon2Options
getter. The new implementation:
- Eliminates the need for
lodash
'spickBy
andtype-fest
'sExcept
- Uses modern TypeScript features with the
satisfies
operator for type checking- Achieves the same functionality with cleaner, more concise code
src/core/resources/loader.registry.ts (1)
75-77
: Good defensive programming to handle falsy metatypesThe added guard clause is a great defensive programming practice. It prevents potential runtime errors by checking for the existence of
provider.metatype
before attempting to use it, returning an empty array when it's falsy.This is particularly important as part of the NestJS upgrade from v10.x to v11.x, where framework changes might affect how providers and their metatypes are handled.
src/core/config/version.service.ts (1)
2-5
: Leaner dependency imports look goodSwitching to the
$
tagged-template fromexeca
andreadPackageUp()
simplifies the file and removes some manual promise handling – nice cleanup.src/common/temporal/calendar-date.ts (1)
1-5
: Good use ofNonEmptyArray
importImporting
NonEmptyArray
makes the intent of the later cast explicit. 👍src/core/exception/exception.normalizer.ts (1)
192-204
: Solid granular mapping of GraphQL-specific error codesAdding dedicated buckets for validation / parse / operation-resolution failures and batch-limit 413s will help the client handle these cases. Nice!
src/core/http/http.adapter.ts (1)
15-16
: Import pruning is fineReducing the fastify type surface to only what’s used keeps compile times down.
package.json (21)
5-5
: Ensure consistent packageManager upgrade
Specifying"yarn@4.9.1"
locks the dev workflow to Yarn 4.9.1. Confirm that all contributors update their Yarn version accordingly and that CI runners use this version.
36-36
: Validate@faker-js/faker
major bump
Upgrading to v9 may include breaking changes in APIs. Verify all test fixtures and mocks by runningrg "faker"
and updating any renamed methods.
39-39
: Confirm@fastify/cors
compatibility
Fastify v5 requires CORS plugin v11. Ensure configuration options (e.g.,origin
,methods
) still align with the new major version.
46-49
: Synchronize NestJS v11 dependencies
All core Nest packages (common
,core
,graphql
,platform-fastify
) are bumped to 11.x—good consistency. Ensure any third-party modules or plugins also support Nest v11.
57-57
: Checkargon2
upgrade implications
argon2 v0.43 may adjust default hashing parameters or option shapes. Review yourcrypto.service.ts
changes and rerun related unit tests to ensure hash/verify still function as expected.
67-68
: Approvedotenv-expand
&execa
upgrades
Both packages have been bumped, and code already usesdotenv-expand
the same way and the$
tagged template fromexeca@9
. No breaking changes noted.
74-76
: Review file utilities bumps
file-type
v20 andglob
v11 migrated to ESM-only. Confirm all imports (e.g.,import { fileTypeFromFile }
) and glob calls have been updated to work with ESM entrypoints.
81-83
: Approve GraphQL Yoga & image-size updates
Upgrading tographql-yoga@^5.13.4
andimage-size@^2.0.2
aligns with synchronous import changes. No regressions detected.
93-94
: Verify MIME and Nano ID usage
mime@^4.0.7
andnanoid@^5.1.5
may change default exports vs named exports. Search forimport mime
andimport { nanoid }
to ensure nothing is broken.
101-103
: Approve read-package-up, reflect-metadata & rimraf bumps
These are tooling/runtime support dependencies; the semver bumps appear non-breaking.
107-107
: Approvets-essentials
patch version
This is a purely type-level library; the minor upgrade should have no runtime impact.
109-110
: Validateuuid
&validator
bumps
Moving touuid@^11.1.0
andvalidator@^13.15.0
—check imports (import { v4 as uuidv4 }
) and any custom validation code to ensure APIs remain unchanged.
112-112
: Confirm external tarball forxlsx
Pinning via a CDN URL can break offline installs or caching. Ensure your CI/Yarn offline mirror configuration accommodates this pattern.
118-121
: Approve devtools NestJS & GraphQL CLI updates
Bumping@nestjs/cli
,@nestjs/schematics
,@nestjs/testing
to 11.x and@graphql-hive/cli
to>=0.44
aligns with the runtime upgrades.
129-133
: Validate type definitions for Luxon & stack-trace
Ensure the updated@types/luxon@^3.6.2
and@types/stack-trace@^0.0.33
still match the runtime versions and don't introduce new type errors.
143-144
: Approve lint-staged & npm-check-updates bumps
Minor updates for developer tooling; no changes needed in configuration.
146-151
: Reviewts-morph
& TypeScript upgrade
Locking TS to~5.2.2
and movingts-morph
to v25.0.1 may impact custom AST transforms. Runyarn type-check
and verify any codegen scripts still work.
156-157
: Approve Angular DevKit resolutions
Pinning@angular-devkit/core
and@angular-devkit/schematics
to ^19.2 satisfies Nest CLI peer dependencies.
159-161
: Approve Nest CLI resolution overrides
Stubbing out unsupportedfork-ts-checker-webpack-plugin
&webpack
plus aligningglob
&typescript
for the CLI is correct.
162-165
: Approve patches for@whatwg-node/fetch
Consistent patch across v0.10.x versions is good. Ensure the patch file path remains valid in your Yarn patch directory.
166-169
: Approve miscellaneous resolutions
Locking transitive deps forlogform
,process-warning
,rxjs
, andsecure-json-parse
helps eliminate known vulnerabilities.
60f1751
to
3ed2476
Compare
No description provided.