Skip to content

Automagically declare Props/SecuredProps with TS transformer #3411

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

Merged
merged 10 commits into from
May 9, 2025

Conversation

CarsonF
Copy link
Member

@CarsonF CarsonF commented May 2, 2025

Any class within a .dto.ts file that is decorated with one of the @nestjs/graphql decorators or our RegisterResource decorator will automatically define Props & SecuredProps for use at runtime.

TS isn't statically aware of this, but it can be accessed via EnhancedResource:

user = EnhancedResource.of(User)
user.props
user.securedProps

These are strictly typed Sets.


This needed #3422, #3421, #3420, #3416, #3415


Currently the plugin updates the transpired JS directly.
I've stubbed the "readonly" code path which is used with SWC.
I'm not entirely convinced SWC will help overall - if TS compiler is still needed to generate this metadata, and that is not cached or something, then it is probably worse than this current setup.

@CarsonF CarsonF changed the base branch from develop to ts-5.8 May 2, 2025 13:22
@CarsonF CarsonF force-pushed the ts-5.8 branch 2 times, most recently from cbc6303 to 6fac407 Compare May 2, 2025 15:35
Base automatically changed from ts-5.8 to develop May 2, 2025 16:14
@CarsonF CarsonF force-pushed the ts-plugin-resources branch 2 times, most recently from d9a10ad to 688a429 Compare May 2, 2025 21:05
@CarsonF CarsonF changed the title Automagically declare Props/SecuredProps with Nest plugin Automagically declare Props/SecuredProps with TS transformer May 2, 2025
@CarsonF CarsonF force-pushed the ts-plugin-resources branch from 688a429 to 836a733 Compare May 2, 2025 23:45
@CarsonF CarsonF changed the base branch from develop to vertbatim May 2, 2025 23:45
Base automatically changed from vertbatim to develop May 2, 2025 23:45
@CarsonF CarsonF force-pushed the ts-plugin-resources branch 4 times, most recently from 2c8f0a6 to f1a7179 Compare May 6, 2025 15:01
@CarsonF CarsonF changed the base branch from develop to ts-compiler-stuff May 6, 2025 15:02
Base automatically changed from ts-compiler-stuff to develop May 6, 2025 15:17
CarsonF added 8 commits May 8, 2025 18:09
They will only be declared in compiled code now.
I'm having a hard time getting the transformer to load & transpile.
There are too many different loading variations between Nest, Jest, ts-node, ts-patch.
It was giving a cryptic error with gel:gen (ts-node).

I don't want to get stuck here because the landscape is going to change as we switch
to SWC, vitest, etc.

There's possibly a good performance gain to do this anyway, unsure, unmeasured.
The JS with jsdocs is _almost_ as good - TS does check it.
@CarsonF CarsonF force-pushed the ts-plugin-resources branch from f1a7179 to 2262ea2 Compare May 9, 2025 02:08
@CarsonF CarsonF marked this pull request as ready for review May 9, 2025 02:52
Copy link

coderabbitai bot commented May 9, 2025

📝 Walkthrough

Walkthrough

This change removes the ts-transformer-keys dependency and all related imports and usages across the codebase, including static Props and SecuredProps properties from numerous DTO classes. It introduces a custom TypeScript transformer plugin that programmatically adds these properties during compilation, updating the TypeScript configuration to use this new plugin.

Changes

Files/Group Change Summary
package.json, tsconfig.json Removed ts-transformer-keys dependency and transformer; configured project to use a custom TypeScript transformer plugin at src/core/resources/plugin/index.js.
src/core/resources/plugin/index.js, src/core/resources/plugin/resources.visitor.js Added a custom TypeScript transformer plugin that programmatically injects static Props and SecuredProps arrays into DTO classes based on decorator and property analysis.
src/common/keysOf.spec.ts Deleted test suite for the keysOf utility from ts-transformer-keys.
All DTO files (e.g., src/components/*/dto/*.dto.ts, src/common/resource.dto.ts) Removed imports of ts-transformer-keys and SecuredProps type; deleted static Props and SecuredProps properties from all DTO and resource classes.
src/app.module.ts Removed imports and runtime assertions related to ts-transformer-keys.
src/common/resource.dto.ts Removed static Props and SecuredProps from Resource; made corresponding type properties optional and updated runtime checks in EnhancedResource.
src/components/authentication/authentication.service.ts,
src/components/authorization/assignable-roles.granter.ts,
src/components/user/user.service.ts
Updated import paths for AssignableRoles to use the .dto.ts extension.

Possibly related PRs

  • SeedCompany/cord-api-v3#3422: Coordinates the removal of static Props and SecuredProps from DTOs and replaces direct usage with dynamic access via EnhancedResource, directly related to this PR's transformer/plugin changes.
  • SeedCompany/cord-api-v3#3413: Also addresses the removal of ts-transformer-keys, but retains usage of static properties for a later update; related as part of a staged migration away from the old transformer.
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

🔭 Outside diff range comments (1)
src/components/changeset/dto/changeset.dto.ts (1)

1-29: 💡 Verification agent

🧩 Analysis chain

Verify transformer functionality

All changes look good. To ensure the transformer is working correctly, you might want to add a test that verifies the presence of these properties at runtime.


🏁 Script executed:

#!/bin/bash
# Verify that the transformer correctly adds Props and SecuredProps to classes
# by checking if there are any runtime errors related to missing properties

# Look for the EnhancedResource implementation that uses these properties
echo "Looking for EnhancedResource implementation..."
rg -A 10 "class EnhancedResource" --type ts

# Check if there are any tests that verify the presence of Props and SecuredProps
echo "Checking for tests that verify Props and SecuredProps..."
rg -A 5 "Props|SecuredProps" --type ts --glob "*.spec.ts"

Length of output: 1042


Add runtime tests for transformer-generated properties

We haven’t found any existing specs that assert the transformer is adding the Props and SecuredProps fields to your resources at runtime. Please add a test suite (for example, src/common/resource.dto.spec.ts) that:

  • Imports EnhancedResource (e.g. via a sample resource like Changeset)
  • Instantiates it or derives it from your GraphQL object
  • Asserts the presence of the props and securedProps properties
  • Verifies that those objects include the expected fields (editable, applied, etc.)

This will ensure the transformer wiring remains correct as the code evolves.

🧹 Nitpick comments (4)
src/common/resource.dto.ts (1)

76-77: Prefer readonly arrays for immutability

The metadata arrays are intended to be constants that should never be mutated at runtime.
Declaring them as readonly ...[] (or ReadonlyArray<string>) communicates this intent to TypeScript and prevents accidental writes.

-  Props?: string[];
-  SecuredProps?: string[];
+  readonly Props?: readonly string[];
+  readonly SecuredProps?: readonly string[];
src/core/resources/plugin/resources.visitor.js (3)

1-1: Avoid importing Nest internals that may break on upgrade

@nestjs/graphql/dist/plugin/utils/ast-utils.js is an internal path—minor NestJS releases can rename or relocate it without a semver major bump.
Consider copying the tiny helper you need or using a stable public API to protect the transformer from breaking changes.


83-87: Guard against duplicate static members

If a developer manually adds static Props (or the transformer is invoked twice in watch mode) the class will end up with duplicate property declarations and a TS compilation error.

Add an existence check before prepending new members.

-    return this.updateClassMembers(factory, classNode, [
-      this.createStaticPropArray(factory, 'Props', classProps),
-      this.createStaticPropArray(factory, 'SecuredProps', securedProps),
-      ...classNode.members,
-    ]);
+    const needsProps = !classNode.members.some(
+      (m) => ts.isPropertyDeclaration(m) && m.name.getText() === 'Props',
+    );
+    const needsSecured = !classNode.members.some(
+      (m) => ts.isPropertyDeclaration(m) && m.name.getText() === 'SecuredProps',
+    );
+    return this.updateClassMembers(factory, classNode, [
+      ...(needsProps
+        ? [this.createStaticPropArray(factory, 'Props', classProps)]
+        : []),
+      ...(needsSecured
+        ? [this.createStaticPropArray(factory, 'SecuredProps', securedProps)]
+        : []),
+      ...classNode.members,
+    ]);

95-108: Emit literal arrays as as const for stronger typing

Appending as const lets TS treat the array elements as string literals instead of widening to string, which preserves exact key names for downstream consumers.

-      factory.createArrayLiteralExpression(
-        members.map((p) => factory.createStringLiteral(p.getName(), true)),
-      ),
+      factory.createAsExpression(
+        factory.createArrayLiteralExpression(
+          members.map((p) => factory.createStringLiteral(p.getName(), true)),
+        ),
+        factory.createTypeReferenceNode('const'),
+      ),
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e4902e5 and 16e99d1.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (64)
  • package.json (0 hunks)
  • src/app.module.ts (0 hunks)
  • src/common/keysOf.spec.ts (0 hunks)
  • src/common/resource.dto.ts (2 hunks)
  • src/components/authentication/authentication.service.ts (1 hunks)
  • src/components/authorization/assignable-roles.granter.ts (1 hunks)
  • src/components/authorization/dto/assignable-roles.dto.ts (0 hunks)
  • src/components/authorization/dto/beta-features.dto.ts (0 hunks)
  • src/components/budget/dto/budget-record.dto.ts (0 hunks)
  • src/components/budget/dto/budget.dto.ts (0 hunks)
  • src/components/ceremony/dto/ceremony.dto.ts (0 hunks)
  • src/components/changeset/dto/changeset.dto.ts (1 hunks)
  • src/components/comments/dto/comment-thread.dto.ts (0 hunks)
  • src/components/comments/dto/comment.dto.ts (1 hunks)
  • src/components/comments/dto/commentable.dto.ts (0 hunks)
  • src/components/comments/mention-notification/comment-via-mention-notification.dto.ts (0 hunks)
  • src/components/engagement/dto/engagement.dto.ts (0 hunks)
  • src/components/ethno-art/dto/ethno-art.dto.ts (1 hunks)
  • src/components/field-region/dto/field-region.dto.ts (0 hunks)
  • src/components/field-zone/dto/field-zone.dto.ts (0 hunks)
  • src/components/file/dto/file.dto.ts (0 hunks)
  • src/components/file/media/media.dto.ts (0 hunks)
  • src/components/film/dto/film.dto.ts (1 hunks)
  • src/components/funding-account/dto/funding-account.dto.ts (0 hunks)
  • src/components/language/dto/language.dto.ts (0 hunks)
  • src/components/location/dto/location.dto.ts (0 hunks)
  • src/components/notification-system/system-notification.dto.ts (0 hunks)
  • src/components/notifications/dto/notification.dto.ts (1 hunks)
  • src/components/organization/dto/organization.dto.ts (0 hunks)
  • src/components/partner/dto/partner.dto.ts (0 hunks)
  • src/components/partnership/dto/partnership.dto.ts (0 hunks)
  • src/components/periodic-report/dto/periodic-report.dto.ts (0 hunks)
  • src/components/pnp/extraction-result/extraction-result.dto.ts (0 hunks)
  • src/components/post/dto/post.dto.ts (1 hunks)
  • src/components/post/dto/postable.dto.ts (1 hunks)
  • src/components/product-progress/dto/product-progress.dto.ts (0 hunks)
  • src/components/product-progress/dto/variant-progress.dto.ts (0 hunks)
  • src/components/product/dto/producible.dto.ts (0 hunks)
  • src/components/product/dto/product.dto.ts (0 hunks)
  • src/components/progress-report/dto/community-stories.dto.ts (1 hunks)
  • src/components/progress-report/dto/highlights.dto.ts (1 hunks)
  • src/components/progress-report/dto/progress-report.dto.ts (0 hunks)
  • src/components/progress-report/dto/team-news.dto.ts (1 hunks)
  • src/components/progress-report/media/dto/media.dto.ts (0 hunks)
  • src/components/progress-report/variance-explanation/variance-explanation.dto.ts (0 hunks)
  • src/components/progress-report/workflow/dto/workflow-event.dto.ts (0 hunks)
  • src/components/progress-summary/dto/progress-summary.dto.ts (0 hunks)
  • src/components/project-change-request/dto/project-change-request.dto.ts (1 hunks)
  • src/components/project/dto/project.dto.ts (1 hunks)
  • src/components/project/financial-approver/dto/financial-approver.dto.ts (1 hunks)
  • src/components/project/project-member/dto/project-member.dto.ts (0 hunks)
  • src/components/project/workflow/dto/workflow-event.dto.ts (0 hunks)
  • src/components/prompts/dto/prompt-response.dto.ts (0 hunks)
  • src/components/scripture/dto/scripture-range.dto.ts (1 hunks)
  • src/components/story/dto/story.dto.ts (1 hunks)
  • src/components/user/dto/actor.dto.ts (0 hunks)
  • src/components/user/dto/known-language.dto.ts (1 hunks)
  • src/components/user/dto/user.dto.ts (0 hunks)
  • src/components/user/education/dto/education.dto.ts (0 hunks)
  • src/components/user/unavailability/dto/unavailability.dto.ts (1 hunks)
  • src/components/user/user.service.ts (1 hunks)
  • src/core/resources/plugin/index.js (1 hunks)
  • src/core/resources/plugin/resources.visitor.js (1 hunks)
  • tsconfig.json (1 hunks)
💤 Files with no reviewable changes (40)
  • package.json
  • src/components/authorization/dto/assignable-roles.dto.ts
  • src/app.module.ts
  • src/components/user/education/dto/education.dto.ts
  • src/components/field-zone/dto/field-zone.dto.ts
  • src/components/user/dto/actor.dto.ts
  • src/components/budget/dto/budget.dto.ts
  • src/components/project/workflow/dto/workflow-event.dto.ts
  • src/components/progress-report/dto/progress-report.dto.ts
  • src/components/progress-report/media/dto/media.dto.ts
  • src/components/product-progress/dto/variant-progress.dto.ts
  • src/components/funding-account/dto/funding-account.dto.ts
  • src/components/progress-summary/dto/progress-summary.dto.ts
  • src/components/pnp/extraction-result/extraction-result.dto.ts
  • src/components/progress-report/variance-explanation/variance-explanation.dto.ts
  • src/components/product/dto/producible.dto.ts
  • src/components/location/dto/location.dto.ts
  • src/components/authorization/dto/beta-features.dto.ts
  • src/components/notification-system/system-notification.dto.ts
  • src/components/user/dto/user.dto.ts
  • src/components/project/project-member/dto/project-member.dto.ts
  • src/components/comments/dto/comment-thread.dto.ts
  • src/components/ceremony/dto/ceremony.dto.ts
  • src/components/comments/dto/commentable.dto.ts
  • src/common/keysOf.spec.ts
  • src/components/partnership/dto/partnership.dto.ts
  • src/components/budget/dto/budget-record.dto.ts
  • src/components/partner/dto/partner.dto.ts
  • src/components/organization/dto/organization.dto.ts
  • src/components/comments/mention-notification/comment-via-mention-notification.dto.ts
  • src/components/file/dto/file.dto.ts
  • src/components/progress-report/workflow/dto/workflow-event.dto.ts
  • src/components/language/dto/language.dto.ts
  • src/components/file/media/media.dto.ts
  • src/components/field-region/dto/field-region.dto.ts
  • src/components/periodic-report/dto/periodic-report.dto.ts
  • src/components/engagement/dto/engagement.dto.ts
  • src/components/prompts/dto/prompt-response.dto.ts
  • src/components/product/dto/product.dto.ts
  • src/components/product-progress/dto/product-progress.dto.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/core/resources/plugin/resources.visitor.js (2)
src/common/resource.dto.ts (2)
  • securedProps (204-212)
  • name (155-157)
src/common/secured-property.ts (1)
  • isSecured (84-85)
🔇 Additional comments (34)
src/components/authorization/assignable-roles.granter.ts (1)

2-2: Update import path for AssignableRoles
Aligns with the new DTO filename convention by importing from the .dto-suffixed file. All downstream references should be consistent with this change.

src/components/user/user.service.ts (1)

17-17: Align AssignableRoles import with DTO rename
The import path now points to assignable-roles.dto, matching the updated file naming scheme. This keeps consistency across authentication and authorization modules.

src/components/authentication/authentication.service.ts (1)

25-25: Update AssignableRoles import path
Consistent refactoring of the DTO import to use the .dto suffix. No further changes required in this file.

tsconfig.json (1)

39-39:

✅ Verification successful

Add custom transformer plugin
The new local plugin at ./src/core/resources/plugin/index.js replaces the third-party ts-transformer-keys transformer. Please verify that this path is correct relative to the repo root and that plugin execution order (after typescript-transform-paths) is maintained.


🏁 Script executed:

#!/bin/bash
# Verify that the custom transformer file exists
if [[ ! -f "src/core/resources/plugin/index.js" ]]; then
  echo "❌ Custom transformer not found at src/core/resources/plugin/index.js"
  exit 1
else
  echo "✅ Custom transformer is present."
fi

Length of output: 122


🏁 Script executed:

#!/bin/bash
# Verify tsconfig.json location and list plugin entries
if [[ ! -f "tsconfig.json" ]]; then
  echo "❌ tsconfig.json not found at repo root."
  exit 1
else
  echo "✅ tsconfig.json found at repo root."
fi

echo
echo "📋 'plugins' array in tsconfig.json:"
awk '/"plugins"/,/\]/' tsconfig.json

Length of output: 383


tsconfig.json plugin configuration verified
Both the custom transformer file and its execution order are correct:

  • Custom transformer exists at src/core/resources/plugin/index.js.
  • In tsconfig.json, it’s listed immediately after "typescript-transform-paths", preserving the intended order.

No further changes required.

src/components/user/dto/known-language.dto.ts (1)

2-2:

❓ Verification inconclusive

Remove static keys imports per transformer refactor
Dropped the keys and SecuredProps imports because the custom transformer now injects Props and SecuredProps at compile time for any class with NestJS GraphQL decorators. Ensure the transformer correctly augments this class by inspecting the compiled output.


🏁 Script executed:

#!/bin/bash
# Verify transformer-injected static properties in compiled DTO
grep -R "static readonly Props" dist/src/components/user/dto/known-language.js \
  && echo "✅ Props injected" || echo "❌ Props missing"
grep -R "static readonly SecuredProps" dist/src/components/user/dto/known-language.js \
  && echo "✅ SecuredProps injected" || echo "❌ SecuredProps missing"

Length of output: 424


🏁 Script executed:

#!/bin/bash
set -e
# Locate the compiled DTO file
file=$(find dist -type f -iname "known-language.js" | head -n1)
if [ -z "$file" ]; then
  echo "❌ Compiled file not found"
  exit 1
fi
echo "Compiled file: $file"
# Verify transformer-injected static properties
grep -R "static readonly Props" "$file" && echo "✅ Props injected" || echo "❌ Props missing"
grep -R "static readonly SecuredProps" "$file" && echo "✅ SecuredProps injected" || echo "❌ SecuredProps missing"

Length of output: 200


Remove static keys imports per transformer refactor
Dropped the keys and SecuredProps imports because our custom transformer now injects Props and SecuredProps at compile time for any class with NestJS GraphQL decorators. Since the sandbox build artifacts aren’t available here, please:

  • Run a local build (e.g. npm run build or yarn build).
  • Inspect the compiled DTO at dist/src/components/user/dto/known-language.js.
  • Confirm that it contains:
    • static readonly Props = …
    • static readonly SecuredProps = …
src/components/story/dto/story.dto.ts (2)

2-2: Import simplification looks good

The removal of the keys import from ts-transformer-keys and SecuredProps type from ~/common aligns with the move to auto-generated props.


14-22: LGTM! Auto-generation of Props/SecuredProps in effect

The removal of static Props and SecuredProps properties is consistent with the PR's objective to automatically generate these properties via a custom TS transformer. Since this class has the @RegisterResource decorator, it will now have these properties generated at compile time.

src/components/notifications/dto/notification.dto.ts (2)

3-3: Import cleanup looks good

The imports have been simplified by removing keys from ts-transformer-keys and SecuredProps from ~/common, which are no longer needed with the auto-generation approach.


7-25: Removal of static Props/SecuredProps properties is correct

The Notification class is decorated with @RegisterResource, which will trigger the automatic generation of Props and SecuredProps properties by the custom TypeScript transformer, making the manual declarations unnecessary.

src/components/film/dto/film.dto.ts (2)

2-2: Import simplification looks good

The removal of keys as keysOf from ts-transformer-keys and type SecuredProps properly aligns with the new approach of auto-generated properties.


17-25: LGTM! Static Props/SecuredProps properties properly removed

Since the Film class has the @RegisterResource decorator, it will benefit from the automatic generation of Props and SecuredProps at compile time, eliminating the need for manual declaration.

src/components/progress-report/dto/team-news.dto.ts (2)

1-1: Import simplification looks good

The removal of keys from ts-transformer-keys and SecuredProps from ~/common is appropriate as these are no longer required with the automatic property generation.


7-13: Correctly removed static Props/SecuredProps properties

The ProgressReportTeamNews class is decorated with @RegisterResource, which will now trigger the automatic generation of Props and SecuredProps properties by the custom TypeScript transformer, making the manual declarations redundant.

src/components/scripture/dto/scripture-range.dto.ts (2)

13-13: Verified removal of SecuredProps import

This import change is consistent with the PR's objective to remove the ts-transformer-keys dependency and have the custom TS transformer automatically generate the Props and SecuredProps properties at build time.


72-82: Removed static Props and SecuredProps properties

The static properties that were previously defined using keysOf have been removed as part of the transition to the custom TypeScript transformer. The @ObjectType decorator from @nestjs/graphql will trigger the automatic generation of these properties during compilation.

src/components/ethno-art/dto/ethno-art.dto.ts (2)

2-2: Verified removal of imports

The import for SecuredProps type has been removed as it's no longer needed with the new TypeScript transformer approach.


17-25: Removed static Props and SecuredProps properties

The static properties previously defined using keysOf have been removed as part of the migration to the custom TypeScript transformer. The @RegisterResource decorator will trigger the automatic generation of these properties during compilation.

src/components/user/unavailability/dto/unavailability.dto.ts (2)

2-2: Verified removal of imports

The import for SecuredProps type has been removed as it's no longer needed with the new TypeScript transformer approach.


6-21: Removed static Props and SecuredProps properties

The static properties previously defined using keysOf have been removed as part of the migration to the custom TypeScript transformer. The class is appropriately decorated with @RegisterResource which will trigger the automatic generation of these properties during compilation.

src/components/changeset/dto/changeset.dto.ts (2)

2-2: Verified removal of imports

The import for SecuredProps has been removed as expected with the introduction of the TypeScript transformer.


5-22: Removed static Props and SecuredProps properties

The static properties previously defined using keysOf have been removed as part of the migration to the custom TypeScript transformer. The class is appropriately decorated with @RegisterResource which will trigger the automatic generation of these properties during compilation.

src/components/progress-report/dto/community-stories.dto.ts (2)

1-1: LGTM: Import cleaned up successfully

The import statement has been correctly simplified to only include the required VariantOf type after removing the keysOf and SecuredProps imports that are no longer needed.


7-13: LGTM: Static Props and SecuredProps properties removed

The Props and SecuredProps static properties have been successfully removed from this class. These properties will now be automatically generated by the new TypeScript transformer for classes decorated with @RegisterResource.

src/components/post/dto/postable.dto.ts (2)

3-3: LGTM: Import statement cleaned up correctly

The import statement has been properly updated to remove the no-longer-needed keys and SecuredProps imports while preserving the necessary types.


14-24: LGTM: Static Props and SecuredProps properties removed

The static Props and SecuredProps properties have been successfully removed from the abstract Postable class. These properties will now be automatically generated by the new TypeScript transformer for classes decorated with @RegisterResource.

src/components/project/financial-approver/dto/financial-approver.dto.ts (2)

2-2: LGTM: Import statement cleaned up correctly

The import statement has been properly updated to remove the no-longer-needed keys and SecuredProps imports while preserving the necessary types.


12-17: LGTM: Static Props and SecuredProps properties removed

The static Props and SecuredProps properties have been successfully removed from the FinancialApprover class. These properties will now be automatically generated by the new TypeScript transformer for classes decorated with @RegisterResource.

src/components/post/dto/post.dto.ts (2)

3-3: LGTM: Import statement cleaned up correctly

The import statement has been properly updated to remove the no-longer-needed keys and SecuredProps imports while preserving the necessary imports from the common module.


10-16: LGTM: Static Props and SecuredProps properties removed

The static Props and SecuredProps properties have been successfully removed from the Post class. These properties will now be automatically generated by the new TypeScript transformer for classes decorated with @RegisterResource and that implement Resource.

src/components/progress-report/dto/highlights.dto.ts (1)

1-1: LGTM! Removal of manual Props/SecuredProps declarations.

The removal of the explicit imports and static Props/SecuredProps declarations aligns with the PR's objective to automatically generate these properties at compile time for any class in a .dto.ts file with the @RegisterResource decorator.

src/components/project-change-request/dto/project-change-request.dto.ts (1)

2-2: LGTM! Removal of manual Props/SecuredProps declarations.

The removal of the explicit import for keys and modification of the imports from ~/common aligns with the PR's objective. The static Props and SecuredProps properties will now be automatically generated at compile time by the custom transformer for this class, which is properly decorated with @RegisterResource() and @ObjectType().

src/components/comments/dto/comment.dto.ts (1)

3-3: LGTM! Removal of manual Props/SecuredProps declarations.

The consolidation of imports and removal of explicit dependencies on keys from ts-transformer-keys is consistent with the PR's objective. The class properly meets the criteria for automatic generation of Props and SecuredProps properties, being in a .dto.ts file and decorated with both @RegisterResource and @ObjectType.

src/core/resources/plugin/index.js (1)

1-25: LGTM! Well-structured TypeScript transformer plugin.

The implementation follows standard TypeScript transformer plugin patterns with proper exports for both default usage and integration with ts-patch and Nest CLI. Using JavaScript with JSDoc type annotations is appropriate for transformer plugins to avoid circular dependencies during compilation.

Could you clarify the purpose of re-exporting ResourceVisitor as ReadonlyVisitor on line 17? This suggests there might be plans for external use beyond this plugin.

src/components/project/dto/project.dto.ts (1)

223-223: LGTM – relies on new transformer

TranslationProject now delegates all metadata generation to the new transformer.
No issues spotted with the minimal class body.

@CarsonF CarsonF merged commit a0526e7 into develop May 9, 2025
18 checks passed
@CarsonF CarsonF deleted the ts-plugin-resources branch May 9, 2025 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant