-
-
Notifications
You must be signed in to change notification settings - Fork 125
merge dev to main (v2.3.0) #1569
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
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
WalkthroughWalkthroughThis update primarily involves the version upgrade of Node.js and pnpm across several workflow files and documentation. It also introduces various enhancements and bug fixes in the codebase, including improvements in object cloning, generation of model hooks, and reordering of enhancements for better processing flow. Additionally, a new contributor is acknowledged, and the description of ZenStack is refined. Changes
Possibly related issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration 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
Outside diff range and nitpick comments (4)
packages/sdk/src/typescript-expression-transformer.ts (1)
279-279: Add a comment to explain the purpose of thecheckfunction.Adding a comment will help future developers understand the function's purpose and usage.
packages/schema/src/plugins/enhancer/policy/utils.ts (3)
123-123: Add a comment to explain the purpose of thegenerateSelectForRulesfunction.Adding a comment will help future developers understand the function's purpose and usage.
129-129: Use a more descriptive variable name thanresult.Using a more descriptive name will improve readability.
- let result: any = {}; + let selectObject: any = {};
267-291: Add a comment to explain the purpose of thegenerateConstantQueryGuardFunctionfunction.Adding a comment will help future developers understand the function's purpose and usage.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (18)
package.jsonis excluded by!**/*.jsonpackages/ide/jetbrains/package.jsonis excluded by!**/*.jsonpackages/language/package.jsonis excluded by!**/*.jsonpackages/misc/redwood/package.jsonis excluded by!**/*.jsonpackages/plugins/openapi/package.jsonis excluded by!**/*.jsonpackages/plugins/swr/package.jsonis excluded by!**/*.jsonpackages/plugins/tanstack-query/package.jsonis excluded by!**/*.jsonpackages/plugins/trpc/package.jsonis excluded by!**/*.jsonpackages/runtime/package.jsonis excluded by!**/*.jsonpackages/schema/package.jsonis excluded by!**/*.jsonpackages/sdk/package.jsonis excluded by!**/*.jsonpackages/server/package.jsonis excluded by!**/*.jsonpackages/server/tsconfig.jsonis excluded by!**/*.jsonpackages/testtools/package.jsonis excluded by!**/*.jsonpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml,!**/*.yamltests/integration/test-run/package.jsonis excluded by!**/*.jsontests/integration/tests/frameworks/nextjs/test-project/package.jsonis excluded by!**/*.jsontests/integration/tests/frameworks/trpc/test-project/package.jsonis excluded by!**/*.json
Files selected for processing (54)
- .github/workflows/build-test.yml (1 hunks)
- .github/workflows/integration-test.yml (1 hunks)
- .github/workflows/regression-test.yml (1 hunks)
- CONTRIBUTING.md (1 hunks)
- README.md (2 hunks)
- packages/ide/jetbrains/build.gradle.kts (1 hunks)
- packages/plugins/swr/src/generator.ts (3 hunks)
- packages/plugins/tanstack-query/src/generator.ts (5 hunks)
- packages/plugins/tanstack-query/tests/plugin.test.ts (3 hunks)
- packages/plugins/tanstack-query/tests/react-hooks-v5.test.tsx (1 hunks)
- packages/plugins/tanstack-query/tests/react-hooks.test.tsx (1 hunks)
- packages/plugins/trpc/src/generator.ts (2 hunks)
- packages/runtime/src/cross/clone.ts (1 hunks)
- packages/runtime/src/cross/index.ts (1 hunks)
- packages/runtime/src/cross/mutator.ts (3 hunks)
- packages/runtime/src/enhancements/create-enhancement.ts (2 hunks)
- packages/runtime/src/enhancements/default-auth.ts (2 hunks)
- packages/runtime/src/enhancements/delegate.ts (17 hunks)
- packages/runtime/src/enhancements/policy/handler.ts (17 hunks)
- packages/runtime/src/enhancements/policy/policy-utils.ts (9 hunks)
- packages/runtime/src/enhancements/proxy.ts (2 hunks)
- packages/runtime/src/enhancements/query-utils.ts (3 hunks)
- packages/runtime/src/enhancements/utils.ts (2 hunks)
- packages/schema/src/cli/actions/generate.ts (1 hunks)
- packages/schema/src/cli/actions/info.ts (2 hunks)
- packages/schema/src/cli/cli-util.ts (3 hunks)
- packages/schema/src/cli/plugin-runner.ts (1 hunks)
- packages/schema/src/language-server/validator/attribute-application-validator.ts (1 hunks)
- packages/schema/src/language-server/validator/function-invocation-validator.ts (4 hunks)
- packages/schema/src/language-server/zmodel-formatter.ts (1 hunks)
- packages/schema/src/plugins/enhancer/enhance/index.ts (2 hunks)
- packages/schema/src/plugins/enhancer/policy/expression-writer.ts (10 hunks)
- packages/schema/src/plugins/enhancer/policy/policy-guard-generator.ts (13 hunks)
- packages/schema/src/plugins/enhancer/policy/utils.ts (10 hunks)
- packages/schema/src/plugins/prisma/index.ts (2 hunks)
- packages/schema/src/plugins/prisma/schema-generator.ts (2 hunks)
- packages/schema/src/res/stdlib.zmodel (1 hunks)
- packages/schema/src/utils/ast-utils.ts (1 hunks)
- packages/schema/tests/generator/expression-writer.test.ts (1 hunks)
- packages/sdk/src/index.ts (1 hunks)
- packages/sdk/src/model-meta-generator.ts (3 hunks)
- packages/sdk/src/names.ts (1 hunks)
- packages/sdk/src/typescript-expression-transformer.ts (4 hunks)
- packages/sdk/src/utils.ts (1 hunks)
- packages/testtools/src/schema.ts (2 hunks)
- script/test-scaffold.ts (1 hunks)
- tests/integration/tests/cli/format.test.ts (4 hunks)
- tests/integration/tests/cli/plugins.test.ts (2 hunks)
- tests/integration/tests/enhancements/with-delegate/plugin-interaction.test.ts (1 hunks)
- tests/integration/tests/enhancements/with-password/with-password.test.ts (2 hunks)
- tests/integration/tests/enhancements/with-policy/field-validation.test.ts (1 hunks)
- tests/integration/tests/enhancements/with-policy/postgres.test.ts (1 hunks)
- tests/integration/tests/enhancements/with-policy/prisma-omit.test.ts (2 hunks)
- tests/integration/tests/enhancements/with-policy/relation-check.test.ts (1 hunks)
Files not processed due to max files limit (8)
- tests/integration/tests/enhancements/with-policy/todo-sample.test.ts
- tests/integration/tests/frameworks/nextjs/generation.test.ts
- tests/integration/tests/frameworks/trpc/generation.test.ts
- tests/regression/tests/issue-1493.test.ts
- tests/regression/tests/issue-1530.test.ts
- tests/regression/tests/issue-1533.test.ts
- tests/regression/tests/issue-1560.test.ts
- tests/regression/tests/issue-925.test.ts
Files skipped from review due to trivial changes (12)
- .github/workflows/build-test.yml
- .github/workflows/integration-test.yml
- .github/workflows/regression-test.yml
- packages/ide/jetbrains/build.gradle.kts
- packages/plugins/tanstack-query/tests/react-hooks-v5.test.tsx
- packages/plugins/tanstack-query/tests/react-hooks.test.tsx
- packages/runtime/src/enhancements/default-auth.ts
- packages/runtime/src/enhancements/utils.ts
- packages/schema/src/language-server/validator/attribute-application-validator.ts
- packages/sdk/src/index.ts
- tests/integration/tests/cli/plugins.test.ts
- tests/integration/tests/enhancements/with-policy/postgres.test.ts
Additional context used
LanguageTool
CONTRIBUTING.md
[uncategorized] ~12-~12: Loose punctuation mark.
Context: ...commands. -ZENSTACK_TEST_DB_USER`: The postgres username, for a user with ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~13-~13: Loose punctuation mark.
Context: ...postgres. -ZENSTACK_TEST_DB_PASS: Password for said user. Default: `abc12...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~14-~14: Loose punctuation mark.
Context: ...t:abc123. -ZENSTACK_TEST_DB_NAME: Default database to connect onto. This ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~15-~15: Loose punctuation mark.
Context: ...postgres. -ZENSTACK_TEST_DB_HOST: Hostname or IP to connect onto. Default...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~16-~16: Loose punctuation mark.
Context: ...localhost. -ZENSTACK_TEST_DB_PORT: Port number to connect onto. Default: `...(UNLIKELY_OPENING_PUNCTUATION)
Biome
packages/runtime/src/enhancements/policy/handler.ts
[error] 1203-1203: Avoid the use of spread (
...) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce) because it causes a time complexity ofO(n^2).
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
Additional comments not posted (124)
packages/runtime/src/cross/index.ts (1)
1-1: Export ofclonefunction added.The addition of the
clonefunction to the exports is straightforward and aligns with the context of replacing thedeepcopyfunction.script/test-scaffold.ts (1)
22-22: Updated package versions for test scaffold.The change ensures that the test scaffold uses specific versions of
prismaand@prisma/client, which helps maintain consistency in testing.packages/runtime/src/cross/clone.ts (1)
1-25: Introduction ofclonefunction for deep cloning.The
clonefunction is well-implemented to handle cloning of arrays and plain objects, ensuring deeper and safer cloning.packages/sdk/src/names.ts (1)
1-25: Introduction of functions for generating function names.The functions
getQueryGuardFunctionNameandgetEntityCheckerFunctionNameare well-implemented to generate consistent and descriptive function names based on model and field details.tests/integration/tests/enhancements/with-delegate/plugin-interaction.test.ts (3)
Line range hint
1-24:
Verify the plugin path and dependencies.Ensure that the
tanstackPluginpath andextraDependenciesare correct and exist in the project.
26-40: Verify the plugin provider and dependencies.Ensure that the
providerandextraDependenciesfor the swr plugin are correct and exist in the project.
42-57: Verify the plugin provider and dependencies.Ensure that the
providerandextraDependenciesfor the trpc plugin are correct and exist in the project.packages/schema/src/cli/actions/info.ts (2)
4-4: Verify the correctness of the import statement.Ensure that
getLatestVersionis correctly imported fromcli-utiland is used properly in the code.
28-45: Verify the correctness of the version check logic.Ensure that the logic for checking the latest version of ZenStack packages is correct and handles errors properly.
tests/integration/tests/cli/format.test.ts (2)
Line range hint
25-38:
Verify the correctness of the schema setup and expected output.Ensure that the schema setup and expected output for the basic format test case are correct.
Line range hint
52-65:
Verify the correctness of the schema setup and expected output.Ensure that the schema setup and expected output for the prisma format test case are correct.
packages/schema/src/cli/actions/generate.ts (2)
46-46: Verify the correctness of the plugin runner logic.Ensure that the logic for running plugins is correct and handles errors properly.
49-51: Verify the correctness of the version check logic.Ensure that the logic for checking the new version of ZenStack packages is correct and handles errors properly.
tests/integration/tests/enhancements/with-password/with-password.test.ts (2)
Line range hint
16-42:
LGTM!The
password testsverify the creation and update of a user password correctly.
43-95: LGTM!The
length testsverify the password length and prefix constraints correctly.tests/integration/tests/enhancements/with-policy/prisma-omit.test.ts (2)
Line range hint
4-57:
LGTM!The
per querytest case verifies theomitfunctionality on a per-query basis correctly.
58-122: LGTM!The
globaltest case verifies theomitfunctionality on a global basis correctly.packages/schema/src/plugins/prisma/index.ts (1)
64-69: LGTM!The warning message is clear and informative, ensuring users are aware of the potential impact of skipping Prisma client generation.
CONTRIBUTING.md (1)
7-8: LGTM!The updated prerequisites for Node.js and pnpm versions are correct and align with the new requirements.
packages/schema/src/language-server/zmodel-formatter.ts (1)
108-120: LGTM!The changes in the method
getFieldTypeLengthcorrectly handle different scenarios for determining the length of a field's type.packages/runtime/src/enhancements/create-enhancement.ts (1)
151-156: LGTM!The changes ensure that password enhancement is applied before policy enhancements, which is logical to prevent validation issues due to field length changes.
packages/runtime/src/cross/mutator.ts (1)
203-203: LGTM!The use of
cloneto ensure new object identity is a good practice to prevent unintended side effects.packages/runtime/src/enhancements/query-utils.ts (1)
214-216: LGTM!The
safeClonemethod correctly clones an object and ensures it's not empty.packages/schema/src/language-server/validator/function-invocation-validator.ts (5)
3-3: Imports look good.The added imports for
DataModel,DataModelAttribute, andDataModelFieldAttributeare appropriate.
11-11: Imports look good.The added imports for
isDataModel,isDataModelAttribute, andisDataModelFieldAttributeare appropriate.
20-20: Import looks good.The added import for
getDataModelFieldReferenceis appropriate.
124-129: LGTM! But verify the function usage in the codebase.The added logic for validating function invocation context and arguments is well-implemented.
However, ensure that all function invocations match the new validation rules.
193-264: LGTM! But verify the function usage in the codebase.The added function
_checkCheckwith the@func('check')decorator is well-implemented.However, ensure that all
checkfunction invocations match the new validation rules.packages/schema/src/utils/ast-utils.ts (1)
154-156: FunctionisCheckInvocationlooks good.The function correctly checks if a node is a
checkfunction invocation.README.md (2)
29-29: Documentation update looks good.The updated README clearly emphasizes ZenStack's enhanced features for Prisma ORM.
237-237: Acknowledgment update looks good.The new contributor Ulric is appropriately added to the acknowledgments section.
packages/plugins/tanstack-query/tests/plugin.test.ts (4)
57-57: Function call update looks good.The additional options for
useFindFirstpost_Itemenhance its functionality.
65-65: Function call update looks good.The additional options for
useInfiniteFindManypost_Itemenhance its functionality.
146-146: Function call update looks good.The additional options for
useFindFirstpost_Itemenhance its functionality.
153-153: Function call update looks good.The additional options for
useInfiniteFindManypost_Itemenhance its functionality.packages/runtime/src/enhancements/proxy.ts (1)
5-5: LGTM! Verify the functionality of theclonefunction.The
deepcopyfunction has been replaced with theclonefunction. Ensure thatcloneprovides the necessary deep cloning functionality.
[approved, verify]Also applies to: 77-77
packages/testtools/src/schema.ts (2)
137-137: LGTM! Addition ofprismaClientOptionstoSchemaLoadOptions.The addition of
prismaClientOptionstoSchemaLoadOptionsis correctly implemented.
258-263: LGTM! Handling ofprismaClientOptionsinloadSchema.The
loadSchemafunction has been correctly updated to handleprismaClientOptions.packages/schema/src/cli/cli-util.ts (3)
22-23: LGTM! Addition ofCHECK_VERSION_TIMEOUT.The addition of the
CHECK_VERSION_TIMEOUTconstant is correctly implemented.
271-278: LGTM! Updates tocheckNewVersionfunction.The updates to the
checkNewVersionfunction, including the try-catch block and handling the latest version, are correctly implemented.
284-300: LGTM! Implementation ofgetLatestVersionfunction.The
getLatestVersionfunction is correctly implemented to fetch the latest version from the npm registry.packages/schema/src/cli/plugin-runner.ts (1)
346-350: LGTM! Updates togetPluginModulePathmethod.The updates to the
getPluginModulePathmethod to handle a test environment are correctly implemented.packages/plugins/trpc/src/generator.ts (3)
4-4: Import Addition:isDelegateModelThe
isDelegateModelimport was added. This function is used to check if a model is a delegate model.
291-295: Addition of Delegate Model CheckThe
generateModelCreateRouterfunction now includes a check for delegate models to exclude create and upsert operations.
300-304: Conditional Exclusion of Create and Upsert OperationsThe code now conditionally excludes create and upsert operations for delegate models, ensuring that these operations are not generated where they are not supported.
packages/plugins/swr/src/generator.ts (4)
8-8: Import Addition:isDelegateModelThe
isDelegateModelimport was added. This function is used to check if a model is a delegate model.
81-85: Addition of Delegate Model Check for Create OperationThe
generateModelHooksfunction now includes a check for delegate models to exclude the create operation, ensuring that this operation is not generated where it is not supported.
91-91: Addition of Delegate Model Check for CreateMany OperationThe
generateModelHooksfunction now includes a check for delegate models to exclude the createMany operation, ensuring that this operation is not generated where it is not supported.
144-144: Addition of Delegate Model Check for Upsert OperationThe
generateModelHooksfunction now includes a check for delegate models to exclude the upsert operation, ensuring that this operation is not generated where it is not supported.packages/sdk/src/model-meta-generator.ts (2)
270-273: Handling of Fields Inherited from Delegate ModelsThe
writeFieldsfunction now includes logic to handle fields inherited from delegate models, ensuring that these fields are correctly included in the metadata.
Line range hint
561-571:
Addition ofgetInheritedFromDelegateFunctionThe
getInheritedFromDelegatefunction was added to find the original delegate base model that defines a given field. This is useful for accurate metadata generation.packages/sdk/src/utils.ts (1)
561-571: Addition ofgetInheritedFromDelegateFunctionThe
getInheritedFromDelegatefunction was added to find the original delegate base model that defines a given field. This is useful for accurate metadata generation.packages/sdk/src/typescript-expression-transformer.ts (1)
308-309: Ensure the checker function name is correctly generated.The function name generation seems correct, but ensure that
getEntityCheckerFunctionNamehandles all edge cases.packages/schema/src/plugins/enhancer/policy/utils.ts (2)
237-257: Ensure the handling ofcheckcalls is correct.The handling of
checkcalls seems correct, but ensure thatgenerateSelectForRulesis correctly handling nestedcheckcalls.
287-287: Ensure the return type is correct.The return type is currently
any. Ensure this is intentional and consider using a more specific type if possible.packages/schema/src/res/stdlib.zmodel (1)
669-677: Verify the missing implementation ofcheckfunction.The function
checkis declared but not implemented. Ensure this is intentional, or provide the implementation.packages/plugins/tanstack-query/src/generator.ts (3)
9-9: Import addition looks good.The import
isDelegateModelis correctly added.
345-349: LGTM! Verify the correct usage ofisDelegateModel.The check for delegate models before generating create mutations is correctly implemented.
Ensure that
isDelegateModelis correctly used throughout the codebase.
428-428: LGTM! Verify the correct usage ofisDelegateModel.The check for delegate models before generating upsert mutations is correctly implemented.
Ensure that
isDelegateModelis correctly used throughout the codebase.packages/schema/src/plugins/enhancer/policy/policy-guard-generator.ts (4)
248-248: LGTM!The addition of
operationContextto the transformer ingenerateCreateInputCheckerFunctionis appropriate.
325-325: LGTM!The addition of
preUpdateSelectorinwritePostUpdatePreValueSelectoris necessary and correctly implemented.
434-435: LGTM!The addition of
selectorinwriteEntityCheckeris appropriate and correctly implemented.
Line range hint
372-413: LGTM!The updates to
shouldUseEntityCheckerfor checking cross-model comparisons are necessary and correctly implemented.tests/integration/tests/enhancements/with-policy/field-validation.test.ts (5)
12-12: Ensure proper password validation.The password validation rule
@password @length(8, 16)is applied correctly, but make sure that all edge cases, such as minimum and maximum lengths, are covered in your tests.
Line range hint
287-287:
Verify model-level validation rules.The validation rules for the
Modelare applied correctly. Ensure that all edge cases are covered in your tests, especially for optional fields and complex expressions.
Line range hint
492-492:
Ensure proper interaction between policy and validation rules.The interaction between policy and validation rules for the
Usermodel is tested correctly. Ensure that all edge cases, such as conflicting rules, are covered in your tests.
Line range hint
442-442:
Ensure proper validation for array fields.The validation rules for array fields in the
Modelare applied correctly. Ensure that all edge cases, such as empty arrays and null values, are covered in your tests.
Line range hint
392-392:
Ensure proper validation for scalar fields.The validation rules for scalar fields in the
Modelare applied correctly. Ensure that all edge cases, such as invalid values and null values, are covered in your tests.packages/schema/src/plugins/enhancer/policy/expression-writer.ts (1)
789-821: LGTM! Added functionwriteRelationCheckis well-implemented.The function correctly validates the arguments and generates the appropriate query guard function call.
packages/schema/src/plugins/prisma/schema-generator.ts (1)
265-268: LGTM! Changes ingenerateModelcorrectly handle fields inherited from delegate models.The function now properly excludes these fields from the physical schema while retaining them in the logical schema.
packages/schema/tests/generator/expression-writer.test.ts (1)
Line range hint
372-372:
LGTM!The addition of
operationContext: 'read'to theExpressionWriterinitialization enhances the context specificity.packages/runtime/src/enhancements/delegate.ts (16)
16-16: LGTM!The import statement correctly adds the
clonefunction from../cross.
75-75: LGTM!The replacement of
deepcopywithclonein thedoFindmethod improves the object handling.
145-145: LGTM!The replacement of
deepcopywithclonein thebuildWhereHierarchymethod improves the object handling.
220-220: LGTM!The replacement of
deepcopywithclonein thebuildSelectIncludeHierarchymethod improves the object handling.
411-411: LGTM!The replacement of
deepcopywithclonein thedoCreatemethod improves the object handling.
627-627: LGTM!The replacement of
deepcopywithclonein theupsertmethod improves the object handling.
645-645: LGTM!The replacement of
deepcopywithclonein thedoUpdatemethod improves the object handling.
665-665: LGTM!The replacement of
deepcopywithclonein thedoUpdateManymethod improves the object handling.
675-675: LGTM!The replacement of
deepcopywithclonein thedoUpdateManymethod improves the object handling.
686-686: LGTM!The replacement of
deepcopywithclonein thedoUpdateManymethod improves the object handling.
852-852: LGTM!The replacement of
deepcopywithclonein thedeletemethod improves the object handling.
868-868: LGTM!The replacement of
deepcopywithclonein thedoDeleteManymethod improves the object handling.
921-921: LGTM!The replacement of
deepcopywithclonein theaggregatemethod improves the object handling.
949-949: LGTM!The replacement of
deepcopywithclonein thecountmethod improves the object handling.
989-989: LGTM!The replacement of
deepcopywithclonein thegroupBymethod improves the object handling.
1030-1030: LGTM!The replacement of
deepcopywithclonein theextractSelectIncludemethod improves the object handling.packages/runtime/src/enhancements/policy/policy-utils.ts (7)
6-6: LGTM!The import statements for
z,ZodError,ZodObject, andZodSchemafromzodare correct and consistent with the usage in the file.
561-561: LGTM! Verify correctness ofclonefunction usage.The change from
deepcopytocloneis consistent with the replacement across the codebase. Ensure that theclonefunction is correctly imported and used.
817-817: LGTM! Verify correctness ofsafeClonefunction usage.The change from
deepcopytosafeCloneis consistent with the replacement across the codebase. Ensure that thesafeClonefunction is correctly implemented and used.
854-862: LGTM! Verify correctness of Zod schema validation.The
validateZodSchemamethod correctly uses thegetZodSchemamethod for validation. Ensure that the schema validation logic is correctly implemented and handles errors appropriately.
1268-1301: LGTM! Verify correctness of schema fetching and modification.The
getZodSchemamethod correctly fetches and optionally modifies the Zod schema to exclude password fields. Ensure that the schema fetching and modification logic is correctly implemented.
1345-1345: LGTM! Verify correctness ofsafeClonefunction usage.The change from
deepcopytosafeCloneis consistent with the replacement across the codebase. Ensure that thesafeClonefunction is correctly implemented and used.
1007-1007: LGTM! Verify correctness ofsafeClonefunction usage.The change from
deepcopytosafeCloneis consistent with the replacement across the codebase. Ensure that thesafeClonefunction is correctly implemented and used.packages/runtime/src/enhancements/policy/handler.ts (15)
28-28: LGTM!The import statement is correct.
130-130: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.
141-141: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.
179-179: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.
413-425: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.
443-443: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.
686-686: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.
1149-1149: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.
1236-1236: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.
1346-1346: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.
1439-1439: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.
1495-1495: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.
1513-1513: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.
1528-1528: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.
1564-1564: LGTM!The use of
cloneto replacedeepcopyfor deep cloning objects is appropriate.tests/integration/tests/enhancements/with-policy/relation-check.test.ts (13)
4-46: LGTM!The test case for read permissions is correctly implemented.
48-87: LGTM!The test case for simple create permissions is correctly implemented.
89-148: LGTM!The test case for nested create permissions is correctly implemented.
150-206: LGTM!The test case for update permissions is correctly implemented.
208-264: LGTM!The test case for delete permissions is correctly implemented.
266-324: LGTM!The test case for field-level read permissions is correctly implemented.
326-383: LGTM!The test case for field-level read permissions with an override is correctly implemented.
385-441: LGTM!The test case for cross-model field comparison is correctly implemented.
443-503: LGTM!The test case for implicit specific operations is correctly implemented.
505-563: LGTM!The test case for implicit all operations is correctly implemented.
565-637: LGTM!The test case for error reporting with invalid arguments is correctly implemented.
639-671: LGTM!The test case for error reporting with cyclic relation checks is correctly implemented.
673-702: LGTM!The test case for error reporting with indirect cyclic relation checks is correctly implemented.
packages/schema/src/plugins/enhancer/enhance/index.ts (2)
150-150: LGTM!The import statement for
InternalArgsandDynamicClientExtensionThisfrom Prisma's runtime library is correctly implemented.
Line range hint
157-177:
LGTM!The code for checking Prisma version and adjusting type definitions is correctly implemented.
…nding polymorphic relations (#1572) Co-authored-by: Yiming <yiming@whimslab.io> Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (6)
packages/plugins/trpc/package.jsonis excluded by!**/*.jsonpackages/server/package.jsonis excluded by!**/*.jsonpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml,!**/*.yamltests/integration/package.jsonis excluded by!**/*.jsontests/integration/tests/frameworks/nextjs/test-project/package.jsonis excluded by!**/*.jsontests/integration/tests/frameworks/trpc/test-project/package.jsonis excluded by!**/*.json
Files selected for processing (3)
- packages/schema/src/plugins/prisma/schema-generator.ts (4 hunks)
- packages/server/tests/adapter/next.test.ts (1 hunks)
- tests/regression/tests/issue-1575.test.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/schema/src/plugins/prisma/schema-generator.ts
Additional comments not posted (5)
tests/regression/tests/issue-1575.test.ts (1)
1-28: LGTM!The regression test for issue 1575 appears to be well-formed and correctly uses the
loadSchemafunction to validate the model setup.packages/server/tests/adapter/next.test.ts (4)
Line range hint
18-102:
LGTM!The test case for simple CRUD operations appears to be comprehensive and correctly validates the functionality of the Next.js adapter.
Line range hint
104-128:
LGTM!The test case for custom load paths appears to be well-formed and correctly validates the functionality of the Next.js adapter.
Line range hint
130-198:
LGTM!The test case for access policy CRUD operations appears to be comprehensive and correctly validates the functionality of the Next.js adapter.
Line range hint
200-272:
LGTM!The test case for REST handler operations appears to be comprehensive and correctly validates the functionality of the Next.js adapter.
No description provided.