refactor: Migrate auth0 to separate plugin#549
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: ae29b1d The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis change set introduces a major refactor to modularize Auth0 authentication functionality into a dedicated plugin, Changes
Sequence Diagram(s)Plugin-based Authentication Flow (New)sequenceDiagram
participant User
participant WebApp (UI)
participant ProjectBuilderLib
participant PluginAuth (Auth0 Plugin)
participant StoragePlugin
User->>WebApp: Open authentication/role config UI
WebApp->>ProjectBuilderLib: Request available plugins
ProjectBuilderLib->>PluginAuth: Initialize plugin, register schema/components
WebApp->>PluginAuth: Render AuthDefinitionEditor
User->>WebApp: Edit/save auth config (roles, user model, etc.)
WebApp->>PluginAuth: Validate and save plugin config
PluginAuth->>ProjectBuilderLib: Update plugin config in project definition
ProjectBuilderLib->>StoragePlugin: Query for user account model via auth plugin
StoragePlugin->>PluginAuth: getUserAccountModel(definition)
PluginAuth-->>StoragePlugin: Return user model reference
StoragePlugin->>ProjectBuilderLib: Complete storage config/model creation
Model Merger Utility UsagesequenceDiagram
participant User
participant WebApp (UI)
participant ModelMerger
participant ProjectDefinition
User->>WebApp: Edit/create model in UI
WebApp->>ModelMerger: createModelMergerResult(current, desired, ...)
ModelMerger->>WebApp: Return PendingModelChange
WebApp->>ModelMerger: applyModelMergerResultInPlace(definition, result, ...)
ModelMerger->>ProjectDefinition: Update model(s) in-place
ProjectDefinition-->>WebApp: Updated definition
Migration of Legacy Auth ConfigsequenceDiagram
participant MigrationScript
participant OldConfig
participant NewConfig
participant PluginAuth
MigrationScript->>OldConfig: Read legacy auth config
alt useAuth0 is true
MigrationScript->>PluginAuth: Create plugin config from old auth fields
MigrationScript->>NewConfig: Add plugin config, remove old auth
else
MigrationScript->>NewConfig: Remove old auth config
end
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure 🪧 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
Documentation and Community
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Actionable comments posted: 20
🔭 Outside diff range comments (3)
packages/project-builder-lib/src/definition/model/model-utils.ts (1)
63-69:⚠️ Potential issueGuard against
undefinedtransformersto avoid runtime crashes
model.service.transformersmay beundefinedfor legacy models or partially-populated test fixtures. Accessing.lengthon an undefined value will throw at runtime, breaking anything that callshasService.
Add optional chaining (or a fallback to an empty array) before readinglength.- !!model.service.delete.enabled || - model.service.transformers.length > 0 + !!model.service.delete.enabled || + (model.service.transformers?.length ?? 0) > 0plugins/baseplate-plugin-storage/src/storage/core/schema/models.ts (1)
31-33:⚠️ Potential issuePotential integer overflow for large files
The
sizefield is declared asint. For storage use-cases, file sizes can
easily exceed 2 147 483 647 bytes (the typical 32-bit signed limit).
Switching tobigInt(or a 64-bit numeric type supported by the ORM) avoids
silent truncation.- { - name: 'size', - type: 'int', + { + name: 'size', + type: 'bigInt', },packages/project-builder-lib/src/schema/auth/index.ts (1)
12-28:⚠️ Potential issue
AUTH_DEFAULT_ROLESobjects lack anidproperty
AuthRolerequiresid, but the constants omit it.
Either relax theAuthRoletype for defaults (e.g.,Partial<AuthRole>) or generate IDs withauthRoleEntityType.generateNewId()to ensure type-safety.- { + { + id: authRoleEntityType.generateNewId(), name: 'public',Repeat for the remaining roles.
🧹 Nitpick comments (29)
plugins/baseplate-plugin-auth/eslint.config.js (1)
1-3: Use the correct ESLint ignore key. The official ESLint config schema usesignorePatternsto exclude files, notignores. Please verify that your tooling supportsignores; otherwise, update to:-export default [...eslintReactConfig, { ignores: ['**/templates/**'] }]; +export default [...eslintReactConfig, { ignorePatterns: ['**/templates/**'] }];plugins/baseplate-plugin-auth/src/index.ts (1)
1-1: Placeholder Export Consideration
Theplaceholderexport signals a stub. Consider adding a JSDoc comment explaining its purpose or removing this until the plugin API is finalized.plugins/baseplate-plugin-auth/src/web-export.ts (1)
1-1: Clarify the purpose ofmainexport.
web-export.tscurrently exports an empty string. Consider adding a JSDoc comment or populating this export (or renaming the file) to reflect its intended use as the web plugin entry point.plugins/baseplate-plugin-auth/src/auth0/constants/packages.ts (1)
4-4: Remove unnecessary blank lineThere's an extra blank line that creates inconsistent spacing between the package entries.
auth0: '4.0.2', 'fastify-auth0-verify': '3.0.0', - '@auth0/auth0-react': '2.3.0',plugins/baseplate-plugin-auth/src/auth0/core/schema/models.ts (1)
1-34: Consider enhancing the Auth0 user modelThe implementation provides a basic user model with UUID, email, and Auth0 ID fields. However, I'd suggest the following improvements:
- The
- Consider adding common Auth0 profile fields like
nameandpicture- Add documentation explaining how this model integrates with Auth0
Here's a suggested enhancement:
export function createAuth0Models(): { user: ModelMergerModelInput; } { return { user: { model: { fields: [ { name: 'id', type: 'uuid', options: { genUuid: true }, }, { name: 'email', type: 'string', }, + { + name: 'name', + type: 'string', + isOptional: true, + }, + { + name: 'picture', + type: 'string', + isOptional: true, + }, { name: 'auth0Id', type: 'string', isOptional: true, }, ], primaryKeyFieldRefs: ['id'], uniqueConstraints: [ { fields: [{ fieldRef: 'auth0Id' }], }, + { + fields: [{ fieldRef: 'email' }], + }, ], }, }, }; }packages/project-builder-lib/src/definition/feature/feature-utils.ts (2)
95-100: Consider handling potential duplicate feature names.The new
getFeatureByNamefunction returns the first feature with a matching name, but doesn't account for potential duplicate feature names in the project definition. Unlike IDs which are unique, names might not be unique across different feature hierarchies.For consistency with the existing API pattern, consider:
function getFeatureByName( projectDefinition: ProjectDefinition, name: string, ): FeatureConfig | undefined { return projectDefinition.features.find((f) => f.name === name); } +function getFeatureByNameOrThrow( + projectDefinition: ProjectDefinition, + name: string, +): FeatureConfig { + const feature = getFeatureByName(projectDefinition, name); + if (!feature) { + throw new Error(`Could not find feature with name ${name}`); + } + return feature; +}
112-112: Remember to export any additional utility functions.If you add the suggested
getFeatureByNameOrThrowfunction, don't forget to include it in the exportedFeatureUtilsobject.plugins/baseplate-plugin-auth/index.html (1)
1-24: Basic HTML template follows best practicesThe HTML setup properly configures ES module shims, includes necessary meta tags, and sets up the root element for the React application following standard practices.
Consider using a more specific title than "React Remote", such as "Auth Plugin" or "Authentication Module", to better identify this application in browser tabs.
packages/project-builder-lib/src/definition/model/model-utils.ts (1)
72-75: Minor: broaden model-name validation or document constraints
validateModelNameonly checks PascalCase. If additional rules (length limits, reserved words, uniqueness) apply elsewhere, consider enforcing them here (or documenting that this util is intentionally minimal).
No code change required if PascalCase is the sole contract.packages/project-builder-lib/src/definition/project-definition-container.test-helper.ts (1)
34-41: Expose injection points for custom plugin setups
pluginStoreandpluginImplementationStoreare always created with empty data.
This makes it impossible to write tests that need a pre-loaded plugin catalogue or custom implementations without re-writing the helper.Consider allowing the caller to pass partial overrides:
-export function createTestProjectDefinitionContainer( - input: Partial<ProjectDefinition> = {}, -): ProjectDefinitionContainer { - const pluginStore = { - availablePlugins: [], - }; - const pluginImplementationStore = new PluginImplementationStore({}); +export function createTestProjectDefinitionContainer( + input: Partial<ProjectDefinition> = {}, + { + pluginStore = { availablePlugins: [] }, + pluginImplementationMap = {}, + }: { + pluginStore?: Parameters<typeof ProjectDefinitionContainer>[1]['pluginStore']; + pluginImplementationMap?: ConstructorParameters<typeof PluginImplementationStore>[0]; + } = {}, +): ProjectDefinitionContainer { + const pluginImplementationStore = new PluginImplementationStore( + pluginImplementationMap, + );This keeps the current default behaviour but makes the helper far more flexible for future tests.
plugins/baseplate-plugin-storage/src/storage/core/schema/models.ts (1)
66-75: Error message could guide the userThe thrown error only tells what is wrong but not how to fix it. Suggest
adding actionable guidance:- throw new Error( - 'User account model is required for storage plugin. Please enable an auth plugin.', - ); + throw new Error( + 'Storage plugin requires an auth plugin exposing a user account model. ' + + 'Add @halfdomelabs/baseplate-plugin-auth (or compatible) before enabling storage.', + );plugins/baseplate-plugin-auth/src/auth0/core/components/auth-definition-editor.tsx (1)
74-83: Variable name misrepresents its meaning
willCreateUserModelistruewhen the model already exists (isId),
which is the opposite of what the name implies. This can confuse future
maintainers.- const willCreateUserModel = modelEntityType.isId(userModelRef); - const userModel = willCreateUserModel + const isExistingModel = modelEntityType.isId(userModelRef); + const userModel = isExistingModel ? ModelUtils.byIdOrThrow(definition, userModelRef) : createNewModelConfigInput(userModelRef, featureRef);packages/project-builder-server/src/compiler/web/features.ts (2)
25-33: Detect cyclic feature graphs
compileWebFeatureRecursiveassumes an acyclic hierarchy. If a feature mistakenly references an ancestor as a child, this will lead to infinite recursion.Add a
visitedset or rely on a depth counter with an upper bound to safeguard against this scenario.
35-42: HandleundefinedfromgetChildrenForFeature
builder.appCompiler.getChildrenForFeature(featureId)may returnundefined.
WhilesafeMergemay tolerate this, an explicit fallback makes the intent clearer and protects against future refactors.-const generatorsForFeature = - builder.appCompiler.getChildrenForFeature(featureId); +const generatorsForFeature = + builder.appCompiler.getChildrenForFeature(featureId) ?? {};packages/project-builder-lib/src/utils/definition-diff/definition-diff.unit.test.ts (1)
124-136: Mismatched field label inDefinitionDiffReplacementFieldtestsYou use
'value'as the field name yet pass wholesettingsobjects.
For clarity—and to mirror the config below—use'settings'.-const field = new DefinitionDiffReplacementField<TestSettings>('value'); +const field = new DefinitionDiffReplacementField<TestSettings>('settings');packages/project-builder-lib/src/schema/definition.test-helper.ts (2)
1-18: Consider deterministic data for test fixtures
fakerproduces random output which can make snapshot or golden-file tests flaky.
Providing an optional seed or fixed defaults (e.g.,"TestFeature") keeps tests deterministic while still allowing overrides.
52-66: Merge order may overwrite providedoptionsdefaults
options: { default: '123', ...field.options }places the caller-supplied options after the hard-coded defaults, meaning a user cannot overridedefault. Swap the spread order.- options: { - default: '123', - ...field.options, - }, + options: { + ...field.options, + default: field.options?.default ?? '123', + },plugins/baseplate-plugin-auth/package.json (2)
37-41: Ambiguouscatalog:version specifiers may leak breaking changesUsing the private tag
catalog:pins the package to whatever version is in the central catalog at install time.
For public OSS consumers and reproducible CI this can introduce silent breaking upgrades.
Consider publishing an explicit semver range (e.g."react": "^18.3.0") or flowing the version via workspace protocol ("workspace:^").
70-72: Engines field is overly restrictive
"node": "^22.0.0"prevents installation on Node 20, which is still in LTS and widely used in CI/CD images.
Unless the plugin actually relies on 22-only features (e.g. built-in^async context), relax to the current active LTSes:- "node": "^22.0.0" + "node": ">=18.18 <23"packages/project-builder-server/src/compiler/web/index.ts (1)
66-68: Left-over TODO hints at missing configurabilityThe hard-coded
devBackendHost(http://localhost:${portOffset + 1}) leaks environment assumptions into the compiler.
Given this refactor focuses on modular plugins, exposing this via a CLI flag / env var will make the server compiler more reusable across teams running non-standard port maps.packages/project-builder-lib/src/web/components/ModelComboboxField.tsx (2)
98-104: Minor: redundantrestPropsassignment
const restProps = rest;followed by{...restProps}incurs an extra variable without benefit.- const restProps = rest; ... - {...restProps} + {...rest}
63-72: Uncontrolled → controlled transition forsearchQuery
searchQueryandonSearchQueryChangeare only provided whencanCreateis true; otherwise the prop is omitted, making the internal state switch between uncontrolled and controlled modes whencanCreatetoggles at runtime.If the parent toggles
canCreatedynamically, React will warn about changing a controlled component to uncontrolled.
Safer pattern:- searchQuery={canCreate ? searchQuery : undefined} - onSearchQueryChange={setSearchQuery} + searchQuery={searchQuery} + onSearchQueryChange={canCreate ? setSearchQuery : undefined}packages/project-builder-lib/src/tools/model-merger/model-merger.unit.test.ts (2)
195-213: Diff equality check may become brittle
toEqualagainst a hard-coded object ignores implementation details such as auto-generatedids, default flags, or additional metadata that might legitimately appear later.Prefer a partial / property-based assertion:
expect(result?.changes['model.relations']).toEqual( expect.arrayContaining([ expect.objectContaining({ type: 'add', key: 'posts' }), ]), );This keeps the test focused on observable behaviour rather than internal representation.
318-324: Avoid relying on array index when verifying added elementsAppending to the end is an implementation detail.
Retrieve the element by.find()or useexpect.arrayContaining.plugins/baseplate-plugin-auth/src/auth0/core/schema/plugin-definition.ts (1)
47-65: Minor performance / readability improvement in built-in role mergeBuilding a
Setonce avoids re-creating the array for each filter call:-...roles.filter( - (r) => !AUTH_DEFAULT_ROLES.map((v) => v.name).includes(r.name), -), +(() => { + const builtIn = new Set(AUTH_DEFAULT_ROLES.map((r) => r.name)); + return roles.filter((r) => !builtIn.has(r.name)); +})(),Very small gain, but it makes the intent explicit.
packages/project-builder-lib/src/utils/definition-diff/definition-diff.ts (3)
46-53: Redundant assignment ofgetKey
public readonly getKeyis already initialised from the constructor parameter;
the extrathis.getKey = getKey;is unnecessary and misleading (the property is
also declaredreadonly, yet reassigned here).- super(name); - this.getKey = getKey; + super(name);Removing the line eliminates an avoidable eslint/TypeScript warning.
108-133:updatemutates array element in place — cloning recommended
toMergedmutates the existing object reference. If callers retain external
references to elements ofcurrentValue, they will observe silent mutations,
breaking immutability expectations.Consider cloning before merging:
-items[index] = toMerged(items[index], item); +items[index] = toMerged(cloneDeep(items[index]), item);(or return a brand-new array with updated element).
219-236: Deep-clone could be expensive for large objects
cloneDeepon everyapplyDefinitionDiffmay become a hot-spot when diffing
large definitions in tight loops (e.g. interactive editors).
If immutability isn’t a hard requirement, consider a shallow clone or exposing a
flag to skip cloning for performance-critical paths.packages/project-builder-lib/src/tools/model-merger/model-merger.ts (1)
159-199: Potential quadratic lookup inresolveLocalFieldName.
resolveLocalFieldNamedoesArray.findfor every reference/constraint field, resulting in O(N·M) behaviour when a model has many references or constraints.
For most real-world schemas this is negligible, but in code-gen scenarios with hundreds of fields it can become a noticeable hotspot.A small optimisation keeps correctness while bringing the lookup to O(1):
- const resolveLocalFieldName = (name: string): string => { - const field = inputWithIds.model.fields.find((f) => f.name === name); - if (!field) { - throw new Error(`Field ${name} not found`); - } - return field.id; - }; + const fieldNameToId = new Map( + inputWithIds.model.fields.map((f) => [f.name, f.id]), + ); + const resolveLocalFieldName = (name: string): string => { + const id = fieldNameToId.get(name); + if (!id) { + throw new Error(`Field ${name} not found`); + } + return id; + };Not urgent, but worth considering if large models are expected.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Lite
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
⛔ Files ignored due to path filters (10)
plugins/baseplate-plugin-auth/src/auth0/generators/fastify/auth0-module/generated/ts-import-maps.tsis excluded by!**/generated/**plugins/baseplate-plugin-auth/src/auth0/generators/fastify/auth0-module/generated/ts-templates.tsis excluded by!**/generated/**plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-callback/generated/ts-templates.tsis excluded by!**/generated/**plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-components/generated/ts-import-maps.tsis excluded by!**/generated/**plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-components/generated/ts-templates.tsis excluded by!**/generated/**plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-hooks/generated/text-templates.tsis excluded by!**/generated/**plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-hooks/generated/ts-import-maps.tsis excluded by!**/generated/**plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-hooks/generated/ts-templates.tsis excluded by!**/generated/**plugins/baseplate-plugin-auth/src/auth0/static/icon.svgis excluded by!**/*.svgpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (103)
.changeset/lazy-icons-design.md(1 hunks)package.json(1 hunks)packages/fastify-generators/src/constants/fastify-packages.ts(0 hunks)packages/fastify-generators/src/generators/index.ts(0 hunks)packages/project-builder-common/package.json(1 hunks)packages/project-builder-lib/package.json(2 hunks)packages/project-builder-lib/src/definition/feature/feature-utils.ts(2 hunks)packages/project-builder-lib/src/definition/index.ts(1 hunks)packages/project-builder-lib/src/definition/model/model-utils.ts(3 hunks)packages/project-builder-lib/src/definition/project-definition-container.test-helper.ts(1 hunks)packages/project-builder-lib/src/migrations/index.ts(2 hunks)packages/project-builder-lib/src/migrations/migration-012-migrate-auth-config.ts(1 hunks)packages/project-builder-lib/src/plugins/schema/store.ts(1 hunks)packages/project-builder-lib/src/plugins/spec/auth-config-spec.ts(1 hunks)packages/project-builder-lib/src/plugins/spec/index.ts(1 hunks)packages/project-builder-lib/src/schema/apps/admin/app.ts(1 hunks)packages/project-builder-lib/src/schema/apps/web/index.ts(1 hunks)packages/project-builder-lib/src/schema/auth/index.ts(1 hunks)packages/project-builder-lib/src/schema/auth/types.ts(0 hunks)packages/project-builder-lib/src/schema/definition.test-helper.ts(1 hunks)packages/project-builder-lib/src/schema/models/graphql.ts(1 hunks)packages/project-builder-lib/src/schema/models/index.ts(1 hunks)packages/project-builder-lib/src/schema/project-definition.ts(0 hunks)packages/project-builder-lib/src/tools/model-merger/model-merger.ts(1 hunks)packages/project-builder-lib/src/tools/model-merger/model-merger.unit.test.ts(1 hunks)packages/project-builder-lib/src/utils/definition-diff/definition-diff.ts(1 hunks)packages/project-builder-lib/src/utils/definition-diff/definition-diff.unit.test.ts(1 hunks)packages/project-builder-lib/src/utils/definition-diff/index.ts(1 hunks)packages/project-builder-lib/src/utils/index.ts(1 hunks)packages/project-builder-lib/src/web/components/ModelComboboxField.tsx(1 hunks)packages/project-builder-lib/src/web/components/ModelMergerResultAlert.tsx(1 hunks)packages/project-builder-lib/src/web/components/index.ts(1 hunks)packages/project-builder-server/src/compiler/admin/index.ts(2 hunks)packages/project-builder-server/src/compiler/admin/sections.ts(2 hunks)packages/project-builder-server/src/compiler/backend/fastify.ts(0 hunks)packages/project-builder-server/src/compiler/backend/feature.ts(1 hunks)packages/project-builder-server/src/compiler/backend/graphql.ts(3 hunks)packages/project-builder-server/src/compiler/lib/web-auth.ts(0 hunks)packages/project-builder-server/src/compiler/web/features.ts(1 hunks)packages/project-builder-server/src/compiler/web/index.ts(2 hunks)packages/project-builder-web/src/app/AppLayout/AppDesktopSidebar.tsx(1 hunks)packages/project-builder-web/src/app/AppLayout/AppMobileSidebar.tsx(1 hunks)packages/project-builder-web/src/pages/_routes.tsx(0 hunks)packages/project-builder-web/src/pages/apps/edit/WebAppForm.tsx(3 hunks)packages/project-builder-web/src/pages/apps/edit/admin/AdminGeneralForm.tsx(2 hunks)packages/project-builder-web/src/pages/data/models/edit/[id]/_components/graphql/GraphQLMutationsSection.tsx(5 hunks)packages/project-builder-web/src/pages/data/models/edit/[id]/_components/graphql/GraphQLQueriesSection.tsx(4 hunks)packages/project-builder-web/src/pages/features/FeaturesHome.page.tsx(0 hunks)packages/project-builder-web/src/pages/features/FeaturesLayout.tsx(0 hunks)packages/project-builder-web/src/pages/features/auth/auth-models.ts(0 hunks)packages/project-builder-web/src/pages/features/auth/index.tsx(0 hunks)packages/project-builder-web/src/pages/features/index.tsx(0 hunks)packages/project-builder-web/src/pages/home/home.page.tsx(1 hunks)packages/project-builder-web/src/pages/plugins/PluginCard.tsx(1 hunks)packages/project-builder-web/src/pages/plugins/home.page.tsx(1 hunks)packages/project-builder-web/src/pages/plugins/plugin-config.page.tsx(2 hunks)packages/react-generators/src/constants/react-packages.ts(0 hunks)packages/react-generators/src/generators/core/react-routes/react-routes.generator.ts(1 hunks)packages/react-generators/src/generators/index.ts(0 hunks)packages/react-generators/src/index.ts(1 hunks)packages/react-generators/src/utils/index.ts(1 hunks)plugins/baseplate-plugin-auth/.gitignore(1 hunks)plugins/baseplate-plugin-auth/LICENSE(1 hunks)plugins/baseplate-plugin-auth/eslint.config.js(1 hunks)plugins/baseplate-plugin-auth/index.html(1 hunks)plugins/baseplate-plugin-auth/manifest.json(1 hunks)plugins/baseplate-plugin-auth/package.json(1 hunks)plugins/baseplate-plugin-auth/postcss.config.js(1 hunks)plugins/baseplate-plugin-auth/prettier.config.js(1 hunks)plugins/baseplate-plugin-auth/src/auth0/constants/packages.ts(1 hunks)plugins/baseplate-plugin-auth/src/auth0/core/common.ts(1 hunks)plugins/baseplate-plugin-auth/src/auth0/core/components/auth-definition-editor.tsx(1 hunks)plugins/baseplate-plugin-auth/src/auth0/core/components/role-editor-form.tsx(2 hunks)plugins/baseplate-plugin-auth/src/auth0/core/node.ts(1 hunks)plugins/baseplate-plugin-auth/src/auth0/core/schema/models.ts(1 hunks)plugins/baseplate-plugin-auth/src/auth0/core/schema/plugin-definition.ts(1 hunks)plugins/baseplate-plugin-auth/src/auth0/core/web.ts(1 hunks)plugins/baseplate-plugin-auth/src/auth0/generators/fastify/auth0-module/auth0-module.generator.ts(3 hunks)plugins/baseplate-plugin-auth/src/auth0/generators/fastify/auth0-module/ts-extractor.json(1 hunks)plugins/baseplate-plugin-auth/src/auth0/generators/index.ts(1 hunks)plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-apollo/auth0-apollo.generator.ts(1 hunks)plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-callback/auth0-callback.generator.ts(1 hunks)plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-callback/templates/auth0-callback.page.tsx(1 hunks)plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-callback/templates/signup.page.tsx(1 hunks)plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-components/auth0-components.generator.ts(1 hunks)plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-hooks/auth0-hooks.generator.ts(1 hunks)plugins/baseplate-plugin-auth/src/auth0/generators/react/react-auth0/react-auth0.generator.ts(2 hunks)plugins/baseplate-plugin-auth/src/auth0/metadata.json(1 hunks)plugins/baseplate-plugin-auth/src/index.ts(1 hunks)plugins/baseplate-plugin-auth/src/styles.css(1 hunks)plugins/baseplate-plugin-auth/src/utils/cn.ts(1 hunks)plugins/baseplate-plugin-auth/src/web-export.ts(1 hunks)plugins/baseplate-plugin-auth/tsconfig.build.json(1 hunks)plugins/baseplate-plugin-auth/tsconfig.json(1 hunks)plugins/baseplate-plugin-auth/tsconfig.node.json(1 hunks)plugins/baseplate-plugin-auth/vite.config.ts(1 hunks)plugins/baseplate-plugin-auth/vitest.config.ts(1 hunks)plugins/baseplate-plugin-storage/package.json(1 hunks)plugins/baseplate-plugin-storage/src/storage/core/components/CategoryEditorForm.tsx(3 hunks)plugins/baseplate-plugin-storage/src/storage/core/components/storage-config.tsx(3 hunks)plugins/baseplate-plugin-storage/src/storage/core/schema/models.ts(2 hunks)plugins/baseplate-plugin-storage/src/storage/core/schema/plugin-definition.ts(1 hunks)plugins/baseplate-plugin-storage/src/storage/core/web.ts(1 hunks)
💤 Files with no reviewable changes (14)
- packages/react-generators/src/generators/index.ts
- packages/fastify-generators/src/generators/index.ts
- packages/react-generators/src/constants/react-packages.ts
- packages/project-builder-lib/src/schema/auth/types.ts
- packages/project-builder-web/src/pages/_routes.tsx
- packages/project-builder-lib/src/schema/project-definition.ts
- packages/fastify-generators/src/constants/fastify-packages.ts
- packages/project-builder-server/src/compiler/backend/fastify.ts
- packages/project-builder-web/src/pages/features/index.tsx
- packages/project-builder-web/src/pages/features/FeaturesHome.page.tsx
- packages/project-builder-web/src/pages/features/FeaturesLayout.tsx
- packages/project-builder-web/src/pages/features/auth/index.tsx
- packages/project-builder-web/src/pages/features/auth/auth-models.ts
- packages/project-builder-server/src/compiler/lib/web-auth.ts
🧰 Additional context used
🧬 Code Graph Analysis (25)
packages/project-builder-lib/src/migrations/index.ts (1)
packages/project-builder-lib/src/migrations/migration-012-migrate-auth-config.ts (1)
migration012MigrateAuthConfig(38-90)
packages/project-builder-web/src/pages/plugins/home.page.tsx (1)
packages/project-builder-web/src/pages/plugins/PluginCard.tsx (1)
PluginCard(31-163)
packages/project-builder-web/src/pages/plugins/PluginCard.tsx (1)
packages/project-builder-lib/src/schema/plugins/index.ts (1)
pluginEntityType(7-7)
packages/project-builder-web/src/pages/home/home.page.tsx (2)
packages/ui-components/src/components/Card/Card.tsx (5)
CardTitle(117-117)CardDescription(114-114)CardHeader(116-116)CardFooter(115-115)Card(111-111)packages/ui-components/src/components/Button/Button.tsx (1)
Button(51-51)
plugins/baseplate-plugin-auth/src/auth0/generators/react/react-auth0/react-auth0.generator.ts (2)
packages/core-generators/src/utils/extract-packages.ts (1)
extractPackageVersions(7-14)plugins/baseplate-plugin-auth/src/auth0/constants/packages.ts (1)
AUTH0_PACKAGES(1-6)
packages/project-builder-web/src/pages/plugins/plugin-config.page.tsx (1)
packages/project-builder-lib/src/schema/plugins/index.ts (1)
pluginEntityType(7-7)
packages/project-builder-lib/src/definition/feature/feature-utils.ts (1)
packages/project-builder-lib/src/schema/project-definition.ts (1)
ProjectDefinition(61-61)
packages/project-builder-web/src/pages/apps/edit/WebAppForm.tsx (2)
packages/project-builder-lib/src/web/hooks/useProjectDefinition.ts (1)
useProjectDefinition(75-83)packages/project-builder-lib/src/plugins/spec/auth-config-spec.ts (1)
authConfigSpec(22-25)
packages/project-builder-web/src/pages/apps/edit/admin/AdminGeneralForm.tsx (1)
packages/project-builder-lib/src/plugins/spec/auth-config-spec.ts (1)
authConfigSpec(22-25)
plugins/baseplate-plugin-storage/src/storage/core/components/CategoryEditorForm.tsx (2)
packages/project-builder-lib/src/web/hooks/useProjectDefinition.ts (1)
useProjectDefinition(75-83)packages/project-builder-lib/src/plugins/spec/auth-config-spec.ts (1)
authConfigSpec(22-25)
packages/project-builder-server/src/compiler/backend/graphql.ts (1)
packages/project-builder-lib/src/plugins/spec/auth-config-spec.ts (1)
authConfigSpec(22-25)
plugins/baseplate-plugin-auth/src/auth0/generators/fastify/auth0-module/auth0-module.generator.ts (2)
packages/core-generators/src/utils/extract-packages.ts (1)
extractPackageVersions(7-14)plugins/baseplate-plugin-auth/src/auth0/constants/packages.ts (1)
AUTH0_PACKAGES(1-6)
packages/project-builder-lib/src/migrations/migration-012-migrate-auth-config.ts (1)
packages/project-builder-lib/src/migrations/types.ts (1)
createSchemaMigration(30-34)
packages/project-builder-lib/src/definition/model/model-utils.ts (1)
packages/utils/src/validators/case-validators.ts (1)
PASCAL_CASE_REGEX(11-11)
packages/project-builder-web/src/pages/data/models/edit/[id]/_components/graphql/GraphQLQueriesSection.tsx (2)
packages/project-builder-lib/src/web/hooks/useProjectDefinition.ts (1)
useProjectDefinition(75-83)packages/project-builder-lib/src/plugins/spec/auth-config-spec.ts (1)
authConfigSpec(22-25)
plugins/baseplate-plugin-auth/src/auth0/core/common.ts (3)
packages/project-builder-lib/src/plugins/spec/auth-config-spec.ts (1)
authConfigSpec(22-25)plugins/baseplate-plugin-auth/src/auth0/core/schema/plugin-definition.ts (2)
auth0PluginDefinitionSchema(37-66)Auth0PluginDefinition(68-68)packages/project-builder-lib/src/definition/plugins/plugin-utils.ts (1)
PluginUtils(63-68)
packages/project-builder-lib/src/plugins/spec/auth-config-spec.ts (2)
packages/project-builder-lib/src/schema/project-definition.ts (1)
ProjectDefinition(61-61)packages/project-builder-lib/src/schema/auth/index.ts (1)
AuthRole(5-10)
plugins/baseplate-plugin-auth/vite.config.ts (1)
packages/project-builder-lib/src/plugin-tools/plugin-loader.ts (2)
getModuleFederationTargets(270-312)rewriteDistToSrc(258-260)
plugins/baseplate-plugin-storage/src/storage/core/components/storage-config.tsx (3)
plugins/baseplate-plugin-storage/src/storage/core/schema/models.ts (1)
createStorageModels(63-94)packages/project-builder-lib/src/tools/model-merger/model-merger.ts (3)
createNewModelConfigInput(202-215)createModelMergerResult(239-270)applyModelMergerResultInPlace(321-347)packages/project-builder-lib/src/web/components/ModelMergerResultAlert.tsx (1)
ModelMergerResultAlert(14-93)
packages/project-builder-lib/src/web/components/ModelMergerResultAlert.tsx (2)
packages/project-builder-lib/src/tools/model-merger/model-merger.ts (1)
PendingModelChange(217-222)packages/ui-components/src/components/Alert/Alert.tsx (3)
Alert(77-77)AlertTitle(77-77)AlertDescription(77-77)
plugins/baseplate-plugin-auth/src/auth0/core/components/role-editor-form.tsx (2)
plugins/baseplate-plugin-auth/src/auth0/core/schema/plugin-definition.ts (1)
Auth0PluginDefinitionInput(70-72)plugins/baseplate-plugin-auth/src/utils/cn.ts (1)
cn(4-13)
plugins/baseplate-plugin-storage/src/storage/core/schema/models.ts (2)
packages/project-builder-lib/src/tools/model-merger/model-merger.ts (2)
ModelMergerScalarFieldInput(30-33)ModelMergerModelInput(58-67)packages/project-builder-lib/src/plugins/spec/auth-config-spec.ts (1)
authConfigSpec(22-25)
packages/project-builder-lib/src/schema/auth/index.ts (1)
packages/project-builder-lib/src/references/types.ts (1)
createEntityType(139-151)
packages/project-builder-lib/src/utils/definition-diff/definition-diff.unit.test.ts (1)
packages/project-builder-lib/src/utils/definition-diff/definition-diff.ts (8)
DefinitionDiffKeyedArrayField(43-136)diff(55-98)diff(144-149)DefinitionDiffOperation(10-14)DefinitionDiffReplacementField(141-155)createDefinitionDiffConfig(169-173)createDefinitionDiff(182-206)applyDefinitionDiff(211-237)
plugins/baseplate-plugin-auth/src/auth0/core/schema/models.ts (1)
packages/project-builder-lib/src/tools/model-merger/model-merger.ts (1)
ModelMergerModelInput(58-67)
🔇 Additional comments (103)
plugins/baseplate-plugin-auth/tsconfig.node.json (1)
1-4: Correct extension of base Node scripts config
The newtsconfig.node.jsonappropriately extends the shared Node script config and explicitly includes only the build scripts (vite.config.ts,tailwind.config.ts). This keeps the plugin aligned with the monorepo’s TypeScript standards.plugins/baseplate-plugin-storage/package.json (1)
4-4: Fix grammatical typo in package description
The description has been corrected to “Contains the storage plugin for Baseplate,” which improves clarity. No functional changes detected.plugins/baseplate-plugin-auth/vitest.config.ts (1)
1-1: Proxy Vitest configuration correctly
Re-exporting the default config from@halfdomelabs/tools/vitest-nodeensures consistency with other packages. No issues found.plugins/baseplate-plugin-auth/prettier.config.js (1)
1-1: Reuse shared Prettier configuration
Exporting the React prettier config from@halfdomelabs/tools/prettier-reactmaintains formatting consistency across the codebase.package.json (1)
39-39: Increase concurrency for watch tasks
Adding--concurrency 20to the turbo watch command will speed up parallel execution of watch tasks. Ensure that your local and CI environments have sufficient resources to handle the increased parallelism.plugins/baseplate-plugin-auth/.gitignore (1)
1-99: Comprehensive .gitignore for the new plugin. This.gitignoreappropriately covers common Node, framework, and tooling artifacts, ensuring transient and build files are excluded from version control.packages/project-builder-lib/src/schema/models/graphql.ts (1)
5-5: Import path updated to new auth index. This aligns with the refactoredauthmodule exportingauthRoleEntityTypefromindex.js. Please confirm that the path resolves correctly in the built artifacts.packages/project-builder-lib/src/schema/apps/web/index.ts (1)
4-4: Update import path forauthRoleEntityType. Changed to import from@src/schema/auth/index.jsfollowing module refactor. Implementation looks correct and consistent.packages/project-builder-lib/src/schema/apps/admin/app.ts (1)
4-4: Sync import path forauthRoleEntityType. Updated to reflect the consolidated auth schema inindex.js. This keeps consistency across schema files.plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-callback/templates/signup.page.tsx (1)
35-35: Styling Adjustment Approved
The removal ofbg-gray-100aligns the signup page's background with the callback page, unifying styles across Auth0 flows.plugins/baseplate-plugin-storage/src/storage/core/web.ts (1)
6-6:Details
✅ Verification successful
Verify Path-Cased Import
Double-check that the filestorage-configmatches the new import path exactly (including kebab-case) on case-sensitive file systems.Run:
🏁 Script executed:
#!/bin/bash # Locate the component file to confirm correct path and casing fd -e ts --exec echo {} | grep -i 'storage-config'Length of output: 52
🏁 Script executed:
#!/bin/bash # List all files in the components directory to inspect exact names and casing find plugins/baseplate-plugin-storage/src/storage/core/components -maxdepth 1 -type f -print # Look for any TypeScript files with “storage-config” in their name fd --case-sensitive -e ts -e tsx 'storage-config' # Also check for camelCase variant just in case fd --case-sensitive -e ts -e tsx 'storageConfig'Length of output: 520
Import Path Verified
The fileplugins/baseplate-plugin-storage/src/storage/core/components/storage-config.tsxexists and matches the kebab-case import inplugins/baseplate-plugin-storage/src/storage/core/web.ts(line 6). No changes required.packages/project-builder-web/src/app/AppLayout/AppMobileSidebar.tsx (2)
5-5: Removed Unused Icon Import
DeletingHiCollectionaligns with the removal of the "Features" section and cleans up unused dependencies.
42-48:Details
✅ Verification successful
Removed "Features" Navigation Item
The "Features" link was removed to reflect deleted routes. Ensure that no remaining references (routes, tests, documentation) to/featuresexist.Run:
🏁 Script executed:
#!/bin/bash # Search for residual '/features' references rg "/features" -nLength of output: 1169
🏁 Script executed:
#!/bin/bash # Verify there are no remaining navigation links to "/features" in the web app rg 'to="/features"' -n packages/project-builder-webLength of output: 53
🏁 Script executed:
#!/bin/bash # Check for any remaining navigation or route references to "/features" in the web app rg -nE '(to|path)=["'\'']/features' packages/project-builder-webLength of output: 127
🏁 Script executed:
#!/bin/bash # Search for any "/features" references in the web app source (TSX/JSX) rg "/features" -n packages/project-builder-web -g '*.tsx' -g '*.jsx'Length of output: 68
Removed "Features" Navigation Item – Verified
File: packages/project-builder-web/src/app/AppLayout/AppMobileSidebar.tsx
Lines: 42–48<SidebarNavigationIcon to="/" icon={MdHome} label="Home" end /> <SidebarNavigationIcon to="/apps" icon={MdApps} label="Apps" /> <SidebarNavigationIcon to="/data/models" icon={HiDatabase} label="Models" />No remaining
/featuresreferences found in the web app’s TSX/JSX files. Other/featureshits in server and lib are internal module imports, not UI routes.packages/project-builder-lib/src/utils/definition-diff/index.ts (1)
1-1:Details
❌ Incorrect review comment
Ensure TypeScript Resolution of .js Modules
Importing fromdefinition-diff.jsrequires thattsconfig.jsonhasallowJsenabled and proper module resolution for.jsextensions. Verify the TS config or consider renaming the source file to.ts.Run:
--- 🏁 Script executed: ```shell #!/bin/bash # Check TS config for allowJs and module resolution grep '"allowJs"' -n tsconfig.json grep '"moduleResolution"' -n tsconfig.jsonLength of output: 80
🏁 Script executed:
#!/bin/bash # Locate all tsconfig files in the repo find . -type f -name "tsconfig*.json" # Search for allowJs and moduleResolution settings within them rg '"allowJs"' --glob 'tsconfig*.json' rg '"moduleResolution"' --glob 'tsconfig*.json'Length of output: 2041
🏁 Script executed:
#!/bin/bash # Check if project-builder-lib tsconfig extends a base config with allowJs echo "Extends in tsconfig.json:" grep -n '"extends"' packages/project-builder-lib/tsconfig.json || true echo echo "Extends in tsconfig.build.json:" grep -n '"extends"' packages/project-builder-lib/tsconfig.build.json || true echo echo "Contents of packages/project-builder-lib/tsconfig.json:" sed -n '1,200p' packages/project-builder-lib/tsconfig.json echo echo "Contents of packages/project-builder-lib/tsconfig.build.json:" sed -n '1,200p' packages/project-builder-lib/tsconfig.build.jsonLength of output: 1214
🏁 Script executed:
#!/bin/bash # Show root tsconfig.json content sed -n '1,200p' tsconfig.jsonLength of output: 169
🏁 Script executed:
#!/bin/bash # Check allowJs and moduleResolution in Vite lib base config echo "Searching for allowJs in packages/tools/tsconfig.vite.lib.json:" grep -n '"allowJs"' packages/tools/tsconfig.vite.lib.json || echo "allowJs not found" echo -e "\nSearching for moduleResolution in packages/tools/tsconfig.vite.lib.json:" grep -n '"moduleResolution"' packages/tools/tsconfig.vite.lib.json || echo "moduleResolution not found" echo -e "\nPreview of packages/tools/tsconfig.vite.lib.json:" sed -n '1,200p' packages/tools/tsconfig.vite.lib.jsonLength of output: 1020
🏁 Script executed:
#!/bin/bash # List files in the definition-diff directory echo "Files in packages/project-builder-lib/src/utils/definition-diff:" find packages/project-builder-lib/src/utils/definition-diff -maxdepth 1 -type f -printLength of output: 449
No TS config change needed for .js import
Theindex.tsexport uses a.jsspecifier so that at runtime the compiled.jsfile is imported, and because this package’s tsconfig.json explicitly sets"moduleResolution": "node16"(and TS 4.7+ is required for that option), TypeScript’s Node-style ESM resolution will automatically map the
.jsimport to yourdefinition-diff.tssource without needingallowJs.• Location:
packages/project-builder-lib/tsconfig.json
– Extends@halfdomelabs/tools/tsconfig.vite.lib.json
– Defines"moduleResolution": "node16"
• NoallowJsflag is necessary here, and you should keep the.jsextension for correct ESM output.Likely an incorrect or invalid review comment.
packages/project-builder-lib/package.json (2)
54-54: Add Faker as a devDependency
Adds@faker-js/fakerto support new randomized test data in unit tests. Ensure that new test helpers import and configure Faker correctly.
63-63: Upgrade type-fest to v4.41.0
Bumpstype-festfor updated type utilities. Verify compatibility with existing TypeScript code and regenerate any affected type artifacts.packages/project-builder-common/package.json (1)
28-28: Introduce the Auth plugin as a workspace dependency
Adds@halfdomelabs/baseplate-plugin-authto enable plugin-based authentication in common utilities.plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-apollo/auth0-apollo.generator.ts (1)
6-6: Switch to absolute import for React Apollo config provider
Updates the import ofreactApolloConfigProviderto use the consolidated@halfdomelabs/react-generatorspackage. Confirm that this export exists and is version-compatible.plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-callback/templates/auth0-callback.page.tsx (1)
48-48: Remove gray background utility class
Eliminatesbg-gray-100to align with updated UI styling guidelines. Verify the callback page layout and contrast remains acceptable in all themes.packages/react-generators/src/index.ts (1)
4-4: Expose utilities via package exports
Addsexport * from './utils/index.js'to make shared utilities available in the public API. Ensure downstream consumers import these utilities as expected and update type definitions if needed.packages/project-builder-lib/src/utils/index.ts (1)
3-3: Clean addition of definition-diff utilities to the public APIThis export makes the new definition diffing and patching utilities available through the
utilspackage, providing access to JSON object diffing and patching capabilities based on configurable field definitions. Good modular approach.packages/project-builder-lib/src/plugins/spec/index.ts (1)
1-1: Well-structured auth config spec exposureAdding this export is a key enabler for the authentication modularization effort, exposing the interface and contract needed for authentication configuration plugins. This change directly supports the PR's goal of migrating Auth0 to a separate plugin architecture.
packages/react-generators/src/generators/core/react-routes/react-routes.generator.ts (1)
75-78: Good defensive programming with guard clauseAdding this early return guard clause prevents unnecessary processing when there are no routes registered, which could happen now that Auth0 routes are being moved to a separate plugin. This is a clean optimization that avoids potential issues when working with empty route collections.
plugins/baseplate-plugin-auth/manifest.json (1)
1-4: Well-structured plugin manifestThis manifest correctly configures the new Auth0 plugin with appropriate plugin entry points and web build output locations. The structure is clean and follows expected plugin architecture patterns. This is a key component enabling the modularization of Auth0 functionality.
plugins/baseplate-plugin-auth/src/auth0/generators/index.ts (1)
1-2: Consolidated Auth0 generator exports
The two exports correctly expose both the Fastify and React generator modules as the unified entry point for the Auth plugin.plugins/baseplate-plugin-auth/tsconfig.build.json (1)
1-12: Enable emission and exclude tests/templates
This build configuration properly extends the base tsconfig, turns on output emission, and excludes test files, mocks, and generator templates from the published output.packages/project-builder-lib/src/web/components/index.ts (1)
1-3: Export new web components
The addition ofModelComboboxFieldandModelMergerResultAlertalongsideFeatureComboboxFieldaligns with the new model merging UI features.packages/project-builder-lib/src/definition/index.ts (1)
9-9: Re-export project-definition-container test helper
Exposingproject-definition-container.test-helper.jsin the public API simplifies test setup for project definitions.packages/project-builder-lib/src/schema/models/index.ts (1)
196-198: Add input type for unique constraints
IntroducingModelUniqueConstraintConfigInputbrings parity with otherz.input<…>types and enhances type safety for unique-constraint inputs.plugins/baseplate-plugin-auth/src/styles.css (1)
1-6: CSS layering structure looks goodThe CSS layer declaration and imports are well-organized, establishing a proper cascade with theme, base, components, and utilities layers. The file correctly imports Tailwind CSS assets and the UI components theme.
packages/project-builder-lib/src/migrations/index.ts (2)
11-11: Appropriate import for the new migrationThe import statement for the new migration is correctly added.
20-20: Schema migration sequence properly extendedThe
migration012MigrateAuthConfigis correctly added to theSCHEMA_MIGRATIONSarray, ensuring that existing projects will have their Auth0 configuration migrated to the new plugin-based system.plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-components/auth0-components.generator.ts (1)
5-12: Imports organization improvedThe reorganization of imports is cleaner and more maintainable. Moving
authComponentsImportsProviderto be grouped with other imports from@halfdomelabs/react-generatorsmakes the code structure more consistent.plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-hooks/auth0-hooks.generator.ts (1)
5-10: Imports correctly consolidated from external packageThe imports have been properly reorganized to source all React generator providers from the
@halfdomelabs/react-generatorspackage instead of local paths, which aligns with the plugin modularization approach.plugins/baseplate-plugin-storage/src/storage/core/schema/plugin-definition.ts (1)
57-57: Important behavior change for role referencesChanging the
onDeletebehavior from'RESTRICT'to'DELETE'is a significant change. This allows roles to be deleted even when referenced by storage categories, with the reference being automatically removed.This change is necessary for the new plugin-based architecture where roles are managed by the Auth0 plugin, but make sure this cascading deletion behavior is documented for users.
plugins/baseplate-plugin-auth/src/auth0/constants/packages.ts (1)
1-6: Good centralization of Auth0 package versionsThis new constant serves as a central place for Auth0 package versions, which is a good practice for version management in this new auth plugin. The mapping of package names to versions is clear and well-typed with
as const.packages/project-builder-web/src/pages/plugins/home.page.tsx (2)
82-84: Bug fix: Now correctly mapping over installed pluginsGood change. The code now correctly maps over
installedPluginsinstead of the unfilteredpluginsarray, ensuring only active plugins appear in the "Active Plugins" section.
90-92: Bug fix: Now correctly mapping over uninstalled pluginsGood change. The code now correctly maps over
uninstalledPluginsinstead of the unfilteredpluginsarray, ensuring only available but not yet active plugins appear in the "Available Plugins" section.packages/project-builder-lib/src/plugins/schema/store.ts (1)
20-24: Good addition of a non-throwing plugin spec getterAdding
getPluginSpecOptionalmethod is a good practice for safely retrieving plugin implementations without throwing errors. This supports the plugin architecture by allowing components to gracefully handle optional plugins.packages/project-builder-web/src/pages/apps/edit/admin/AdminGeneralForm.tsx (2)
6-6: Add import for new auth config specGood addition of the new import to support the auth plugin architecture.
56-62: Refactor to use the plugin system for auth rolesGood change. The code now retrieves auth roles through the plugin system instead of directly accessing
definition.auth?.roles. This is consistent with the architectural shift to modularize authentication as a plugin.packages/project-builder-web/src/pages/plugins/PluginCard.tsx (1)
82-93: LGTM: Plugin disabling logic updated for consistencyThe updated filter condition correctly uses the plugin's ID with
pluginEntityType.fromUid()for identification, which aligns with how plugins are enabled in theenablePluginfunction (line 68).plugins/baseplate-plugin-auth/src/auth0/generators/react/react-auth0/react-auth0.generator.ts (2)
7-11: LGTM: Updated imports for modular Auth0 pluginThe changes correctly update the imports to use the external
@halfdomelabs/react-generatorspackage and the Auth0-specific package constants. This aligns with the modularization of Auth0 functionality into a separate plugin.Also applies to: 19-19
30-32: LGTM: Updated package extraction for Auth0The change from using
REACT_PACKAGEStoAUTH0_PACKAGESis appropriate for this Auth0-specific generator, ensuring it uses the correct versions defined in the Auth0 constants..changeset/lazy-icons-design.md (1)
1-11: Clear, concise changeset documentation for version updates.The changeset correctly documents patch version updates for all seven packages involved in the auth0 refactoring, with a clear and descriptive commit message.
packages/project-builder-server/src/compiler/backend/graphql.ts (3)
18-18: Good import addition for the auth plugin integration.The import for
authConfigSpecis necessary for the plugin-based authentication system.
79-84: Clean migration to plugin-based auth system.This code properly replaces the direct check for
authproperty with the new plugin-based approach, aligning with the refactoring goal of extracting Auth0 authentication into a separate plugin.
143-148: Consistent implementation of auth plugin integration.The changes here mirror those made in the
buildQueriesFileForModelfunction, ensuring consistent plugin-based authentication handling throughout the file.packages/project-builder-web/src/pages/plugins/plugin-config.page.tsx (2)
3-7: Good addition of pluginEntityType import.The updated imports properly include
pluginEntityTypewhich is necessary for the plugin identity comparison.
84-84: Enhanced plugin disabling logic.The modification to use
pluginEntityType.fromUid(metadata.id)for plugin identity comparison aligns with the standardized plugin entity type system, providing more robust plugin ID handling.plugins/baseplate-plugin-auth/src/auth0/core/web.ts (2)
1-9: Good module structure with appropriate imports.The imports correctly bring in the necessary dependencies for creating a web platform plugin, including the
AuthDefinitionEditorcomponent and global styles.
10-19: Well-structured plugin export with proper component registration.The plugin export correctly:
- Declares dependency on the web configuration specification
- Registers the
AuthDefinitionEditorcomponent during initialization- Uses the pluginId parameter to ensure proper component registration
This implementation integrates smoothly with the web configuration system.
plugins/baseplate-plugin-auth/tsconfig.json (1)
1-15: TypeScript configuration looks correct for the new auth plugin.The configuration correctly extends the base Vite library config, sets up path aliases for
@src/*, and includes appropriate include/exclude patterns for the plugin's source files.packages/project-builder-web/src/pages/home/home.page.tsx (2)
28-37: Navigation card update aligns with architecture changes.The renaming from "Features" to "Models" and updating the navigation path reflects the architectural changes in this PR, focusing on models as a core concept.
42-51: Card redesign enhances plugin-based architecture visibility.The renaming from "Models" to "Plugins" and updating the description appropriately highlights the new plugin-based architecture, which aligns with the Auth0 plugin extraction in this PR.
plugins/baseplate-plugin-auth/src/auth0/generators/react/auth0-callback/auth0-callback.generator.ts (1)
2-8: Import consolidation improves code organization.Consolidating the individual imports from local paths into a grouped import from the shared
@halfdomelabs/react-generatorspackage improves maintainability and reflects the modularization of Auth0 functionality into its own plugin.plugins/baseplate-plugin-storage/src/storage/core/components/CategoryEditorForm.tsx (1)
3-3: Good modularization of auth role accessThe change properly implements plugin-based authentication role retrieval instead of directly accessing
definition.auth?.roles. This improves the modularity of the system by decoupling the storage plugin from direct knowledge of the auth schema structure.Also applies to: 28-28, 49-55
packages/project-builder-server/src/compiler/admin/sections.ts (1)
71-73: Excellent enhancement for plugin extensibilityThis change significantly improves the extensibility of admin features by allowing plugins to dynamically register their UI components. The architecture now supports the addition of new features through plugins without requiring modifications to the core compiler code.
Also applies to: 82-82
plugins/baseplate-plugin-auth/src/utils/cn.ts (1)
1-14: Good practice for CSS isolation in module federationThe
cnutility function properly implements CSS class name prefixing with "auth-", which is essential for style isolation in a module federation architecture. The implementation correctly handles multiple class names, filters falsy values, and maintains proper spacing.packages/project-builder-web/src/pages/apps/edit/WebAppForm.tsx (3)
4-7: LGTM: Updated imports to support plugin-based auth configurationThe addition of
authConfigSpecimport aligns with the migration to a separate auth plugin.
37-37: LGTM: Enhanced hook usage to access plugin containerCorrectly destructuring
pluginContaineralongsidedefinitionto access plugin-specific functionality.
49-55: LGTM: Migrated role retrieval to plugin-based approachThe code now properly retrieves auth roles through the plugin system instead of directly accessing
definition.auth?.roles, which aligns with the modular architecture being implemented.plugins/baseplate-plugin-auth/src/auth0/generators/fastify/auth0-module/auth0-module.generator.ts (4)
9-20: LGTM: Improved import organizationConsolidating multiple imports from
@halfdomelabs/fastify-generatorsimproves code readability and maintainability.
28-28: LGTM: Updated package constant importsUsing the Auth0-specific package constants aligns with the plugin architecture and ensures proper versioning.
45-45: LGTM: Updated package version extractionUsing
AUTH0_PACKAGESinstead ofFASTIFY_PACKAGEScorrectly aligns with the migration of Auth0 functionality to a dedicated plugin.
153-153: LGTM: Consistent usage of Auth0 package constantsThe use of
AUTH0_PACKAGESfor the Fastify Auth0 verify package is consistent with the earlier usage.plugins/baseplate-plugin-auth/src/auth0/core/components/role-editor-form.tsx (3)
11-14: LGTM: Updated imports for plugin-specific utilities and typesThe import of the plugin-specific
cnutility andAuth0PluginDefinitionInputtype aligns with the migration to a plugin-based architecture.
17-17: LGTM: Updated control type for plugin-specific formThe control prop type has been correctly updated from
Control<AuthConfigInput>toControl<Auth0PluginDefinitionInput>to match the new plugin-specific schema.
31-31: LGTM: Updated class name utility usageReplacing
clsxwith the plugin-specificcnutility ensures consistent styling within the Auth0 plugin context with proper prefixing.Also applies to: 34-34
packages/project-builder-web/src/pages/data/models/edit/[id]/_components/graphql/GraphQLMutationsSection.tsx (4)
4-7: LGTM: Updated imports to support plugin-based auth configurationGrouping
authConfigSpecwithModelConfigInputimproves code organization.
34-34: LGTM: Enhanced hook usage to access plugin containerCorrectly destructuring
pluginContaineralongsidedefinitionto support the plugin-based architecture.
36-42: LGTM: Migrated role retrieval to plugin-based approachThe code now properly retrieves auth roles through the plugin system, using
getPluginSpecOptional(authConfigSpec)?.getAuthRoles(definition)instead of directly accessingdefinition.auth?.roles.
110-110: LGTM: Updated conditional rendering for role-based permissionsThe code now checks if
roleOptionsis truthy before rendering role-based mutation permissions, which is more robust than relying on a derived boolean.Also applies to: 128-128, 146-146
packages/project-builder-server/src/compiler/backend/feature.ts (1)
3-5: Auth-specific imports removed – looks correctAuth concerns have been delegated to the new plugin system, so dropping the old imports aligns with the PR objective. No issues spotted here.
packages/project-builder-server/src/compiler/admin/index.ts (1)
31-31: Smooth integration of auth0 plugin with React routerThe implementation of
safeMergeto integrate root children (from auth0 plugin) with the base admin routes is a clean approach. This pattern properly supports the plugin-based architecture by allowing the auth plugin to inject its routes without directly modifying the admin compiler.Also applies to: 70-91
packages/project-builder-lib/src/plugins/spec/auth-config-spec.ts (1)
1-26: Well-structured plugin specification for authenticationThis spec defines a clean interface for accessing authentication configuration that abstracts the underlying implementation details. The plugin architecture separates concerns appropriately, with clear function types for accessing user account models and auth roles.
The design allows for future authentication providers beyond Auth0 by establishing a standard interface that implementations must conform to.
plugins/baseplate-plugin-auth/LICENSE (1)
1-30: Standard proprietary license for the pluginThe license appropriately establishes the legal framework for the newly extracted authentication plugin, defining terms of use, ownership, and liability limitations.
plugins/baseplate-plugin-auth/src/auth0/core/common.ts (1)
1-40: Clean implementation of Auth0 plugin with proper integrationThe implementation correctly fulfills the
authConfigSpecinterface by providing methods to access user account models and authentication roles from the plugin configuration.A few observations:
- Good dependency declaration with
pluginConfigSpec- Proper type casting when retrieving the plugin configuration
- Clear separation of concerns with the plugin initialization and exports
plugins/baseplate-plugin-storage/src/storage/core/components/storage-config.tsx (8)
5-7: Enhanced imports for structured model mergingThese imports reflect the shift from a raw diff approach to a more structured model merger mechanism. The new imports provide better type safety and encapsulation for handling model changes.
13-14: New ModelMergerResultAlert component adoptionGood replacement of custom alert logic with a dedicated reusable component for displaying model changes, which improves consistency across the UI.
18-18: UI components import consolidationThe import was consolidated to include ComboboxFieldController alongside Button, improving import organization.
46-46: Added feature reference trackingThe addition of featureRef watching is necessary to properly handle model creation with the correct feature reference.
48-63: Refactored model change detection logicThe implementation now uses a more structured approach with
createModelMergerResultto generate model changes, improving type safety and readability compared to the previous approach. The dependency array has been properly updated to include featureRef.
68-77: Updated model application logicThe implementation now uses
applyModelMergerResultInPlaceto handle model changes in a more structured way, including proper handling of new models by updating the fileModelRef reference when necessary.
84-84: Fixed typo in success messageFixed the typo in the success message: 'Successfully enabled storage plugin!' with proper capitalization of 'plugin'.
107-107: Simplified alert rendering with new componentThe raw diff alert rendering has been replaced with the more declarative
ModelMergerResultAlertcomponent, which improves code readability and maintenance.packages/project-builder-lib/src/web/components/ModelMergerResultAlert.tsx (5)
1-9: Well-structured imports and type definitionsThe component has appropriate imports from the UI component library and proper typing for React elements. The import for PendingModelChange from tools index follows good practices.
10-12: Clear interface definition with nullable changesThe Props interface is well-defined and allows for undefined changes in the array, which provides flexibility when using this component.
14-22: Robust null-checking and filteringThe component properly filters out undefined entries and returns null if no valid changes remain, preventing unnecessary rendering and potential errors.
24-43: Effective conditional rendering for different change typesThe component intelligently adjusts the alert variant and descriptive text based on whether a change represents a new model or an update to an existing model, which improves the user experience.
45-86: Comprehensive change type handlingThe component effectively handles all types of model changes (fields, relations, constraints, primary keys) with consistent formatting and conditional rendering. The use of
undefinedrather than a falsy check is appropriate for conditional rendering.One minor improvement suggestion:
- ) : undefined} + ) : null}Using
nullinstead ofundefinedfor conditional rendering is generally preferred in React, though both work.plugins/baseplate-plugin-auth/vite.config.ts (3)
1-11: Well-structured imports and dependenciesThe imports are well-organized, including Vite-specific types and plugins, as well as the necessary module federation utilities from the project builder library.
12-16: Proper use of async configuration with directory rewritesUsing
defineConfigwith an async function is appropriate for handling the asynchronousgetModuleFederationTargetscall. TherewriteDistToSrcfunction is correctly used to transform plugin directory paths.
17-27: Optimal build configuration for plugin developmentThe build configuration is well-suited for plugin development with source maps enabled and minification disabled. The external declaration for project-builder-lib correctly prevents duplication.
plugins/baseplate-plugin-auth/src/auth0/core/node.ts (6)
1-20: Well-organized imports from generator packagesThe imports are cleanly organized by package, separating fastify generators, project builder lib, and react generators. This makes the dependencies clear and maintainable.
21-30: Clear type imports and local generator referencesThe type import for Auth0PluginDefinition and the import of local generators are well-structured, making the code more maintainable.
32-37: Well-structured platform plugin export with clear dependenciesThe plugin correctly declares its dependency on the app compiler specification and defines empty exports. This follows the platform plugin architecture pattern.
38-72: Comprehensive backend compiler registrationThe backend compiler registration properly retrieves the Auth0 plugin configuration and adds all necessary authentication-related features. The role mapping is correctly implemented.
73-96: Complete web app compiler registrationThe web app compiler registration adds all necessary React-based Auth0 authentication components, hooks, and utilities. The callback path and routes are properly configured.
119-120: Minimal return valueThe function returns an empty object after registration, which is appropriate since the plugin operates by registering compilers rather than exporting values.
packages/project-builder-server/src/compiler/web/index.ts (2)
41-50:featuresnesting depth changed – confirm downstream generatorsPreviously
compileAuthPages/compileAuthFeaturesinjected pages at the root of the router.
With the new structure those pages are now grouped underfeatures:.
Verify that:
reactRouterGeneratorunderstands the nestedfeaturesprop.- Any code that looks-up routes by absolute path still resolves correctly.
This is an easy place for regressions in navigation or SSR exports.
35-36:Details
❌ Incorrect review comment
rootFeaturesordering may override router children unintentionally
safeMerge({ ...staticChildren }, rootFeatures)gives precedence torootFeatures.
If a root feature happens to declare keys likereactNotFoundHandlerorfeaturesthey will clobber the statically defined ones, silently disabling core routes.Two possible mitigations:
- children: safeMerge( - { - reactNotFoundHandler: reactNotFoundHandlerGenerator({}), - features: compileWebFeatures(builder), - }, - rootFeatures, - ), + children: safeMerge( + rootFeatures, + { + reactNotFoundHandler: reactNotFoundHandlerGenerator({}), + features: compileWebFeatures(builder), + }, + ),or validate for duplicate keys prior to merge.
🏁 Script executed:
#!/bin/bash # Locate the safeMerge implementation rg -n "export function safeMerge" -n . # Confirm the call site in compiler/web/index.ts rg -n "safeMerge" -n packages/project-builder-server/src/compiler/web/index.tsLength of output: 811
🏁 Script executed:
#!/bin/bash # Show the implementation of safeMerge to confirm merge order semantics rg -n "export function safeMerge<" -n packages/utils/src/objects/safe-merge.ts -A 20 -B 0Length of output: 1183
Incorrect concern:
safeMergedoesn’t silently override—duplicate keys throwThe
safeMerge(itemOne, itemTwo)implementation inpackages/utils/src/objects/safe-merge.tsuses a customizer that throws on any overlapping key (unlessallowEqualValuesis enabled and values are identical). It never quietly clobbers your static routes withrootFeatures. Swapping the argument order wouldn’t change that behavior—duplicates still error instead of override.No changes to the merge call are required.
Likely an incorrect or invalid review comment.
packages/project-builder-lib/src/tools/model-merger/model-merger.ts (1)
321-345: Concurrent mutation risk when pushing a freshly created model.
applyModelMergerResultInPlacemutates the passeddefinitionobject directly (definition.models.push(...)). If callers reuse the samePendingModelChangeinstance across multiple operations (e.g. batched merges in async workflows) this can lead to double-insertion or stale references.Consider returning a new
ProjectDefinitioninstance or documenting the in-place contract clearly. An immutable approach fits better with the functional style of the diff utilities introduced in this refactor.
| "": { | ||
| "existingImportsProvider": { | ||
| "moduleSpecifier": "@/src/generators/auth/_providers/user-session.js", | ||
| "moduleSpecifier": "@halfdomelabs/fastify-generators", |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify external module specifier resolution.
The existingImportsProvider.moduleSpecifier now points to the top-level @halfdomelabs/fastify-generators package. Ensure that userSessionServiceImportsProvider is actually re-exported at the package root (and not nested) so the TS extractor can resolve it.
🏁 Script executed:
#!/bin/bash
# Verify that the fastify-generators package re-exports the provider
rg "export .*userSessionServiceImportsProvider" -R packages/fastify-generators/srcLength of output: 489
🏁 Script executed:
#!/bin/bash
# Corrected command: verify that the fastify-generators package re-exports the provider
rg "export .*userSessionServiceImportsProvider" -n packages/fastify-generators/srcLength of output: 211
Re-export userSessionServiceImportsProvider at package root
We only found the provider defined here:
packages/fastify-generators/src/generators/auth/_providers/user-session.ts:14
There’s no root‐level re-export, so the TS extractor won’t resolve the top-level module specifier. Please add a re-export in the package entrypoint (e.g. packages/fastify-generators/src/index.ts):
--- a/packages/fastify-generators/src/index.ts
+++ b/packages/fastify-generators/src/index.ts
+ export { userSessionServiceImportsProvider } from './generators/auth/_providers/user-session';This ensures @halfdomelabs/fastify-generators exposes the provider at its root.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "moduleSpecifier": "@halfdomelabs/fastify-generators", | |
| // packages/fastify-generators/src/index.ts | |
| export { userSessionServiceImportsProvider } from './generators/auth/_providers/user-session'; |
🤖 Prompt for AI Agents
In
plugins/baseplate-plugin-auth/src/auth0/generators/fastify/auth0-module/ts-extractor.json
at line 5, the moduleSpecifier points to the top-level package
@halfdomelabs/fastify-generators, but userSessionServiceImportsProvider is not
re-exported at the package root. To fix this, add a re-export statement for
userSessionServiceImportsProvider in the package entrypoint file
packages/fastify-generators/src/index.ts so that it is exposed at the root level
and can be resolved by the TS extractor.
There was a problem hiding this comment.
🧩 Analysis chain
@kingston Thank you for confirming. I checked the exports again and can see that userSessionServiceImportsProvider is indeed exported at the root level of the @halfdomelabs/fastify-generators package. The change in the module specifier from the local path to the package import is appropriate for this refactoring. This helps maintain clean module boundaries between the core package and the newly separated Auth0 plugin.
🏁 Script executed:
#!/bin/bash
# Check if userSessionServiceImportsProvider is exported at the root level of the fastify-generators package
cd packages/fastify-generators/src
grep -r "export.*userSessionServiceImportsProvider" --include="*.ts" .
grep -r "export.*from.*user-session" --include="*.ts" .
cat index.ts
Length of output: 593
🏁 Script executed:
#!/bin/bash
# Check the export chain to see if userSessionServiceImportsProvider is properly exported
cd packages/fastify-generators/src
# Check if auth/_providers/index.ts is exported from auth/index.ts
echo "Checking if auth/_providers/index.ts is exported from auth/index.ts:"
grep -r "export.*from.*_providers" --include="*.ts" generators/auth/
# Check if auth/index.ts is exported from generators/index.ts
echo "Checking if auth/index.ts is exported from generators/index.ts:"
grep -r "export.*from.*auth" --include="*.ts" generators/
# Let's also look directly for any path that might lead to userSessionServiceImportsProvider
echo "Checking all export paths that could lead to userSessionServiceImportsProvider:"
find . -type f -name "*.ts" -exec grep -l "export.*from.*user-session" {} \; | xargs cat
Length of output: 1742
@kingston Thank you for the confirmation. I can now see the complete export chain that makes userSessionServiceImportsProvider available at the root level of the @halfdomelabs/fastify-generators package:
- Defined in
generators/auth/_providers/user-session.ts - Re-exported through
_providers/index.js→auth/index.js→generators/index.js→ rootindex.js
This chained re-export approach is working correctly with the TS extractor, so changing the module specifier to the package import is the right approach for the Auth0 plugin refactoring.
| { | ||
| "name": "auth0", | ||
| "displayName": "Auth0", | ||
| "icon": "icon.svg", | ||
| "description": "This plugin allows users to authenticate and authorize access to the application using Auth0.", | ||
| "version": "0.1.0", | ||
| "moduleDirectories": ["core"] | ||
| } |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Validate Auth0 plugin metadata consistency.
Please confirm that:
- The
versioninmetadata.jsonmatchespackage.json. - The
icon.svgfile exists undersrc/auth0. moduleDirectoriescovers all intended code directories.
🏁 Script executed:
#!/bin/bash
# Check version alignment
meta=$(jq -r '.version' plugins/baseplate-plugin-auth/src/auth0/metadata.json)
pkg=$(jq -r '.version' plugins/baseplate-plugin-auth/package.json)
[[ "$meta" == "$pkg" ]] || { echo "Version mismatch: metadata.json=$meta vs package.json=$pkg"; exit 1; }
# Verify icon file
[[ -f plugins/baseplate-plugin-auth/src/auth0/icon.svg ]] || { echo "Missing icon.svg"; exit 1; }Length of output: 323
#!/bin/bash
# Verify icon.svg existence
if [[ -f plugins/baseplate-plugin-auth/src/auth0/icon.svg ]]; then
echo "icon.svg: exists"
else
echo "icon.svg: missing"
fi
# List subdirectories under src/auth0 for moduleDirectories validation
echo "Subdirectories under plugins/baseplate-plugin-auth/src/auth0:"
find plugins/baseplate-plugin-auth/src/auth0 -mindepth 1 -maxdepth 1 -type d | sed 's|.*/||'#!/bin/bash
# Verify icon.svg existence
if [[ -f plugins/baseplate-plugin-auth/src/auth0/icon.svg ]]; then
echo "icon.svg: exists"
else
echo "icon.svg: missing"
fi
# Show moduleDirectories from metadata.json
echo "moduleDirectories in metadata.json:"
jq -r '.moduleDirectories[]' plugins/baseplate-plugin-auth/src/auth0/metadata.json
# List actual directories under src/auth0
echo "Actual subdirectories under plugins/baseplate-plugin-auth/src/auth0/:"
find plugins/baseplate-plugin-auth/src/auth0 -maxdepth 1 -mindepth 1 -type d -printf "%f\n"Align Auth0 plugin metadata and package versions
The version in plugins/baseplate-plugin-auth/src/auth0/metadata.json (0.1.0) does not match the version in plugins/baseplate-plugin-auth/package.json (5.1.0). Please update so they are identical.
Additionally:
- Confirm that
plugins/baseplate-plugin-auth/src/auth0/icon.svgexists and is packaged correctly. - Ensure the
moduleDirectoriesarray inmetadata.jsonlists every subdirectory underplugins/baseplate-plugin-auth/src/auth0(not justcore).
🤖 Prompt for AI Agents
In plugins/baseplate-plugin-auth/src/auth0/metadata.json lines 1 to 8, update
the "version" field to match the version in
plugins/baseplate-plugin-auth/package.json, which is 5.1.0. Verify that the file
plugins/baseplate-plugin-auth/src/auth0/icon.svg exists and is included in the
package. Also, update the "moduleDirectories" array to include all
subdirectories present under plugins/baseplate-plugin-auth/src/auth0, not just
"core", to ensure complete coverage of code directories.
There was a problem hiding this comment.
This is internal metadata so it's all good here.
There was a problem hiding this comment.
@kingston Understood. If the metadata is for internal use only and the current values are intentional, then there's no need for adjustments. Thanks for the clarification!
| import type React from 'react'; | ||
|
|
||
| import { HiCollection, HiDatabase } from 'react-icons/hi'; | ||
| import { HiDatabase } from 'react-icons/hi'; |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Confirm /data route exists.
A new HiDatabase import and sidebar item for /data was added. Verify that the corresponding route and page for /data are defined in the routing configuration (_routes.tsx).
🏁 Script executed:
#!/bin/bash
rg "to=['\"]/data['\"]" -R packages/project-builder-web/src/pagesLength of output: 476
🏁 Script executed:
#!/bin/bash
# Locate and inspect the routing configuration for the `/data` path
ROUTES_FILE=$(fd -t f _routes.tsx | head -n1)
if [ -z "$ROUTES_FILE" ]; then
echo "Routing config file _routes.tsx not found"
else
echo "Found routing config at: $ROUTES_FILE"
echo "Searching for '/data' route definitions:"
grep -R "\"/data\"" -n "$ROUTES_FILE" || echo "No occurrences of '/data' in $ROUTES_FILE"
fiLength of output: 670
Define missing /data route in routing configuration
The new sidebar item links to /data, but no corresponding route is defined in packages/project-builder-web/src/pages/_routes.tsx. Please add an entry for the /data page:
• File: packages/project-builder-web/src/pages/_routes.tsx
• Missing path: /data
Example diff:
--- a/packages/project-builder-web/src/pages/_routes.tsx
+++ b/packages/project-builder-web/src/pages/_routes.tsx
@@ -10,6 +10,7 @@ const routes: RouteObject[] = [
{ path: '/', element: <HomePage /> },
{ path: '/projects', element: <ProjectsPage /> },
+ { path: '/data', element: <DataPage /> },
];Ensure the DataPage component exists (e.g. packages/project-builder-web/src/pages/data.tsx).
🤖 Prompt for AI Agents
In packages/project-builder-web/src/app/AppLayout/AppDesktopSidebar.tsx at line
4, you imported HiDatabase and added a sidebar item linking to the /data route,
but the corresponding route is missing in
packages/project-builder-web/src/pages/_routes.tsx. To fix this, add a route
entry for the path "/data" in _routes.tsx, importing and referencing the
DataPage component. Also, verify that the DataPage component exists at
packages/project-builder-web/src/pages/data.tsx or create it if missing.
| @@ -0,0 +1 @@ | |||
| export * from './routes.js'; | |||
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Ensure routes.js is present and correctly resolved.
The index now re-exports from ./routes.js. Confirm that routes.js exists at this path and that the build pipeline supports .js extensions in TypeScript imports.
🏁 Script executed:
#!/bin/bash
[[ -f packages/react-generators/src/utils/routes.js ]] || { echo "Missing routes.js"; exit 1; }Length of output: 110
🏁 Script executed:
#!/bin/bash
# List files in the utils directory and verify if routes.ts exists
echo "Contents of packages/react-generators/src/utils:"
ls -1 packages/react-generators/src/utils
echo
if [[ -f packages/react-generators/src/utils/routes.ts ]]; then
echo "Found routes.ts"
else
echo "routes.ts is missing"
fiLength of output: 283
Fix the export path to match the existing file
The index file is exporting from ./routes.js but only routes.ts exists. Update the export to either omit the extension (preferred) or use .ts so TypeScript can resolve it.
• File: packages/react-generators/src/utils/index.ts
Line 1:
-export * from './routes.js';
+export * from './routes';This lets TS resolve to routes.ts at compile time (and emit the correct .js import if configured).
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export * from './routes.js'; | |
| // packages/react-generators/src/utils/index.ts | |
| -export * from './routes.js'; | |
| +export * from './routes'; |
🤖 Prompt for AI Agents
In packages/react-generators/src/utils/index.ts at line 1, the export statement
references './routes.js' but only 'routes.ts' exists in the directory. To fix
this, update the export to './routes' without any extension so TypeScript can
correctly resolve the module during compilation and emit the appropriate
JavaScript import.
| const testFeature = createTestFeature(); | ||
| const existingModel = createTestModel(testFeature.name, { | ||
| name: 'ExistingModel', | ||
| }); | ||
| const mockDefinitionContainer: ProjectDefinitionContainer = | ||
| createTestProjectDefinitionContainer({ | ||
| features: [testFeature], | ||
| models: [existingModel], | ||
| }); | ||
|
|
There was a problem hiding this comment.
Create a fresh definition container per test to avoid state-leakage
mockDefinitionContainer is instantiated once and re-used across all tests.
applyModelMergerDiff mutates the container internally (e.g. it allocates new IDs).
If any test mutates shared state, later tests may yield false positives/negatives that are very hard to trace.
-const mockDefinitionContainer: ProjectDefinitionContainer =
- createTestProjectDefinitionContainer({ ... });
+const createContainer = () =>
+ createTestProjectDefinitionContainer({ ... });Then call const mockDefinitionContainer = createContainer(); inside each it.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In packages/project-builder-lib/src/tools/model-merger/model-merger.unit.test.ts
around lines 34 to 43, the mockDefinitionContainer is created once and shared
across tests, causing state leakage due to mutations inside
applyModelMergerDiff. To fix this, move the creation of mockDefinitionContainer
inside each individual test (inside each 'it' block) so that each test gets a
fresh container instance, preventing shared mutable state and ensuring test
isolation.
| expect(result?.changes['model.fields']).toHaveLength(1); | ||
| expect(result?.changes['model.fields']?.[0].type).toBe('add'); | ||
| expect(result?.changes['model.fields']?.[0].key).toBe('email'); | ||
| }); |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Assertion is order-sensitive → use a predicate instead
The test assumes the first element of changes['model.fields'] is the newly added field.
If the diff implementation changes its ordering strategy, the test will break even though the behaviour is still correct.
-expect(result?.changes['model.fields']?.[0].key).toBe('email');
+expect(
+ result?.changes['model.fields']?.some((c) => c.key === 'email' && c.type === 'add'),
+).toBe(true);Same concern appears in several other assertions throughout the file (e.g. 318-324, 367-369).
Switch to order-agnostic checks or helpers like expect.arrayContaining.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| expect(result?.changes['model.fields']).toHaveLength(1); | |
| expect(result?.changes['model.fields']?.[0].type).toBe('add'); | |
| expect(result?.changes['model.fields']?.[0].key).toBe('email'); | |
| }); | |
| expect(result?.changes['model.fields']).toHaveLength(1); | |
| expect(result?.changes['model.fields']?.[0].type).toBe('add'); | |
| expect( | |
| result?.changes['model.fields']?.some( | |
| (c) => c.key === 'email' && c.type === 'add' | |
| ), | |
| ).toBe(true); | |
| }); |
🤖 Prompt for AI Agents
In packages/project-builder-lib/src/tools/model-merger/model-merger.unit.test.ts
around lines 88 to 91, the test asserts that the first element in
changes['model.fields'] is the added field, which is order-sensitive and may
break if the order changes. Refactor these assertions to be order-agnostic by
using predicates or helpers like expect.arrayContaining to check for the
presence of the added field regardless of its position in the array. Apply
similar changes to other order-sensitive assertions in the file, such as those
around lines 318-324 and 367-369.
| return { | ||
| ...input, | ||
| model: { | ||
| ...input.model, | ||
| fields: input.model.fields.map((f) => ({ | ||
| ...f, | ||
| id: f.id ?? modelScalarFieldEntityType.generateNewId(), | ||
| })), | ||
| relations: input.model.relations?.map((r) => ({ | ||
| ...r, | ||
| id: r.id ?? modelLocalRelationEntityType.generateNewId(), | ||
| foreignId: | ||
| r.foreignId ?? modelForeignRelationEntityType.generateNewId(), | ||
| })), | ||
| uniqueConstraints: input.model.uniqueConstraints?.map((c) => ({ | ||
| ...c, | ||
| id: c.id ?? modelUniqueConstraintEntityType.generateNewId(), | ||
| })), | ||
| }, | ||
| }; | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Return type understates the actual shape – consider widening to ModelConfigInput.
attachIdsToModelMergerModelInput is declared to return Pick<ModelConfigInput, 'model'>, yet it spreads input (which includes id, name, featureRef, etc.).
TypeScript will accept the extra properties, but the narrow return signature:
- Misleads readers (and IDE tooling) about what is really produced.
- Forces callers to up-cast through
as unknown as, reducing type safety in the long run.
-function attachIdsToModelMergerModelInput(
- input: ModelMergerModelInput,
-): Pick<ModelConfigInput, 'model'> {
+function attachIdsToModelMergerModelInput(
+ input: ModelMergerModelInput,
+): ModelConfigInput {deserializeModelMergerModelInput has the same mismatch – update it as well for consistency.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| return { | |
| ...input, | |
| model: { | |
| ...input.model, | |
| fields: input.model.fields.map((f) => ({ | |
| ...f, | |
| id: f.id ?? modelScalarFieldEntityType.generateNewId(), | |
| })), | |
| relations: input.model.relations?.map((r) => ({ | |
| ...r, | |
| id: r.id ?? modelLocalRelationEntityType.generateNewId(), | |
| foreignId: | |
| r.foreignId ?? modelForeignRelationEntityType.generateNewId(), | |
| })), | |
| uniqueConstraints: input.model.uniqueConstraints?.map((c) => ({ | |
| ...c, | |
| id: c.id ?? modelUniqueConstraintEntityType.generateNewId(), | |
| })), | |
| }, | |
| }; | |
| } | |
| function attachIdsToModelMergerModelInput( | |
| input: ModelMergerModelInput, | |
| ): ModelConfigInput { | |
| return { | |
| ...input, | |
| model: { | |
| ...input.model, | |
| fields: input.model.fields.map((f) => ({ | |
| ...f, | |
| id: f.id ?? modelScalarFieldEntityType.generateNewId(), | |
| })), | |
| relations: input.model.relations?.map((r) => ({ | |
| ...r, | |
| id: r.id ?? modelLocalRelationEntityType.generateNewId(), | |
| foreignId: | |
| r.foreignId ?? modelForeignRelationEntityType.generateNewId(), | |
| })), | |
| uniqueConstraints: input.model.uniqueConstraints?.map((c) => ({ | |
| ...c, | |
| id: c.id ?? modelUniqueConstraintEntityType.generateNewId(), | |
| })), | |
| }, | |
| }; | |
| } |
🤖 Prompt for AI Agents
In packages/project-builder-lib/src/tools/model-merger/model-merger.ts around
lines 137 to 157, the function attachIdsToModelMergerModelInput is declared to
return Pick<ModelConfigInput, 'model'> but actually returns the full input
object with additional properties like id, name, and featureRef. To fix this,
update the return type of attachIdsToModelMergerModelInput to ModelConfigInput
to accurately reflect the full shape returned. Also, apply the same return type
update to deserializeModelMergerModelInput for consistency and improved type
safety.
| const siblingModelFieldIdMap = new Map([ | ||
| ...input.model.fields.map((f) => [f.id, f.name] as const), | ||
| ...siblingModels.flatMap((m) => | ||
| m.model.fields.map((f) => [f.id, f.name] as const), | ||
| ), | ||
| ]); | ||
| const nameFromId = (id: string): string => | ||
| siblingModelFieldIdMap.get(id) ?? definitionContainer.nameFromId(id); | ||
| return { |
There was a problem hiding this comment.
Filter out undefined IDs before populating the siblingModelFieldIdMap.
input.model.fields may legitimately contain new fields whose id is still undefined.
Adding [undefined, name] into the map means Map.get(undefined) will succeed (and may even be overwritten several times), which can accidentally translate an unset ID into an arbitrary field name.
Down-stream, nameFromId(reference.localRef) and nameFromId(reference.foreignRef) may therefore return an unrelated field name instead of delegating to definitionContainer.nameFromId, silently corrupting the diff.
A minimal and safe fix is to skip items with a falsy id:
- ...input.model.fields.map((f) => [f.id, f.name] as const),
+ ...input.model.fields
+ .filter((f) => f.id !== undefined)
+ .map((f) => [f.id, f.name] as const),Apply the same guard to the siblingModels branch.
This prevents accidental key collisions on undefined and preserves the fallback to the container look-up.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In packages/project-builder-lib/src/tools/model-merger/model-merger.ts around
lines 102 to 110, the map siblingModelFieldIdMap is populated with entries that
may have undefined IDs, causing incorrect lookups. To fix this, filter out any
fields where the id is falsy (undefined) before adding them to the map, both in
input.model.fields and in siblingModels fields. This ensures that
Map.get(undefined) does not return unintended values and preserves the fallback
to definitionContainer.nameFromId for unset IDs.
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Removals
Chores
Tests