feat: migrate models to insomnia-data - p7#9743
Conversation
✨ Circular References ReportGenerated at: 2026-03-25T09:11:43.976Z Summary
✨ Circular References Removed (2)Click to expand/collapseClick to view all circular references in PR (71)Click to view all circular references in base branch (73)Analysis✨ Great Job! This PR removes 2 circular references. Keep up the good work! This report was generated automatically by comparing against the |
There was a problem hiding this comment.
Pull request overview
Migrates several core data models (gRPC request + meta, workspace + meta, mock server, mock route) out of packages/insomnia/src/models/* into ~/insomnia-data, updating app code to use services.* for persistence and models.* for type guards/constants.
Changes:
- Replaced many
models.<migratedModel>.*DB calls withservices.<migratedModel>.*and moved type-guards/constants to~/insomnia-datamodels.*. - Added
insomnia-datamodel definitions and Node service implementations for the migrated models. - Updated a broad set of routes, UI hooks/components, network/templating/plugin contexts, sync/git/vcs flows, and tests to reference the migrated APIs/types.
Reviewed changes
Copilot reviewed 145 out of 145 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/insomnia/src/utils/try-interpolate.ts | Use GrpcRequest type from ~/insomnia-data. |
| packages/insomnia/src/utils/router.ts | Use services.workspace.getById and models.workspace.* constants/helpers. |
| packages/insomnia/src/ui/sync-utils.ts | Switch workspace/mock-server reads to services.* and types to ~/insomnia-data. |
| packages/insomnia/src/ui/hooks/use-request.ts | Move gRPC/workspace-meta types to ~/insomnia-data. |
| packages/insomnia/src/ui/hooks/use-insomnia-tab.ts | Use models.* type-guards from insomnia-data for gRPC/mock/workspace. |
| packages/insomnia/src/ui/hooks/use-close-connection.ts | Use models.grpcRequest.isGrpcRequestId. |
| packages/insomnia/src/ui/components/templating/tag-editor.tsx | Move Workspace type to ~/insomnia-data. |
| packages/insomnia/src/ui/components/tags/method-tag.tsx | Use models.grpcRequest.isGrpcRequest and insomnia-data GrpcRequest type. |
| packages/insomnia/src/ui/components/tabs/tab-list.tsx | Use services.workspace.getById and models.grpcRequest.isGrpcRequest. |
| packages/insomnia/src/ui/components/settings/import-export.tsx | Use models.workspace.isScratchpad. |
| packages/insomnia/src/ui/components/panes/grpc-request-pane.tsx | Move gRPC request/header types to ~/insomnia-data. |
| packages/insomnia/src/ui/components/modals/workspace-settings-modal.tsx | Use models.workspace.* type-guards and insomnia-data types. |
| packages/insomnia/src/ui/components/modals/workspace-duplicate-modal.tsx | Move Workspace type to ~/insomnia-data. |
| packages/insomnia/src/ui/components/modals/request-settings-modal.tsx | Use models.grpcRequest.isGrpcRequest. |
| packages/insomnia/src/ui/components/modals/request-render-error-modal.tsx | Move GrpcRequest type to ~/insomnia-data. |
| packages/insomnia/src/ui/components/modals/proto-files-modal.tsx | Use services.grpcRequest.findByProtoFileId. |
| packages/insomnia/src/ui/components/modals/nunjucks-modal.tsx | Move Workspace type to ~/insomnia-data. |
| packages/insomnia/src/ui/components/modals/new-workspace-modal.tsx | Use models.workspace.WorkspaceScopeKeys from insomnia-data. |
| packages/insomnia/src/ui/components/modals/import-modal/import-modal.tsx | Use models.workspace.scopeToActivity. |
| packages/insomnia/src/ui/components/modals/git-project-migration-modal.tsx | Move WorkspaceScope type to ~/insomnia-data. |
| packages/insomnia/src/ui/components/modals/export-requests-modal.tsx | Use models.grpcRequest.isGrpcRequest and insomnia-data GrpcRequest type. |
| packages/insomnia/src/ui/components/modals/add-request-to-collection-modal.tsx | Use services.workspace.findByParentId. |
| packages/insomnia/src/ui/components/modals/tests/import-export.test.ts | Use services.workspace/workspaceMeta in tests. |
| packages/insomnia/src/ui/components/mocks/mock-response-pane.tsx | Move mock types to ~/insomnia-data. |
| packages/insomnia/src/ui/components/dropdowns/workspace-dropdown.tsx | Use models.workspace.isScratchpad/isMcp and insomnia-data Workspace type. |
| packages/insomnia/src/ui/components/dropdowns/workspace-card-dropdown.tsx | Use models.workspace.isMcp/WorkspaceScopeKeys from insomnia-data. |
| packages/insomnia/src/ui/components/dropdowns/sync-dropdown.tsx | Move Workspace type to ~/insomnia-data. |
| packages/insomnia/src/ui/components/dropdowns/request-actions-dropdown.tsx | Move GrpcRequest type to ~/insomnia-data. |
| packages/insomnia/src/ui/components/command-palette.tsx | Use models.grpcRequest.isGrpcRequest. |
| packages/insomnia/src/templating/types.ts | Move GrpcRequest/Workspace types to ~/insomnia-data. |
| packages/insomnia/src/templating/base-extension.ts | Use services.workspace.getById in plugin context. |
| packages/insomnia/src/templating/base-extension-worker.ts | Move Workspace type to ~/insomnia-data. |
| packages/insomnia/src/sync/vcs/pull-backend-project.ts | Use models.workspace.isWorkspace from insomnia-data. |
| packages/insomnia/src/sync/vcs/initialize-backend-project.ts | Use services.workspaceMeta.updateByParentId. |
| packages/insomnia/src/sync/ignore-keys.ts | Use models.workspace.isWorkspace from insomnia-data. |
| packages/insomnia/src/sync/git/project-ne-db-client.ts | Use services.workspace/workspaceMeta and models.workspace.isWorkspace. |
| packages/insomnia/src/sync/git/ne-db-client.ts | Use models.workspace.isWorkspace. |
| packages/insomnia/src/sync/git/tests/ne-db-client.test.ts | Use services.workspace.create in tests. |
| packages/insomnia/src/routes/untracked-projects.tsx | Move Workspace type to ~/insomnia-data. |
| packages/insomnia/src/routes/organization.tsx | Use models.workspace.isScratchpad from insomnia-data. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.update.tsx | Use services.workspace/mockServer/workspaceMeta. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.new.tsx | Create workspace/mock resources via services.* and scope helpers via models.workspace.*. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.move.tsx | Use services.workspace.getById and models.workspace.scopeToActivity. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.delete.tsx | Use services.workspace/workspaceMeta. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.update-meta.tsx | Use services.workspaceMeta.updateByParentId. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.tsx | Use services.workspace/workspaceMeta/mockServer for loader reads. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.toggle-expand-all.tsx | Use services.workspace.getById. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.test.test-suite.$testSuiteId.tsx | Use services.workspace/workspaceMeta and models.grpcRequest.isGrpcRequest. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.test._index.tsx | Use services.workspaceMeta.getByParentId. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.spec.tsx | Use services.workspace/workspaceMeta. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.spec.generate-request-collection.tsx | Use services.workspace/workspaceMeta. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.tsx | Use services.workspace/mockServer/mockRoute. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.mock-route.new.tsx | Use services.workspace/mockServer/mockRoute. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.mock-route.$mockRouteId.update.tsx | Use services.mockRoute/mockServer. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.mock-route.$mockRouteId.tsx | Use services.mockServer/mockRoute. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.mock-route.$mockRouteId.delete.tsx | Use services.mockRoute.remove. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.generate-request-collection.tsx | Use services.workspace/mockServer/mockRoute. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mcp.tsx | Use services.workspace.getById. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.insomnia-sync.tsx | Move Workspace type to ~/insomnia-data. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.insomnia-sync.sync-data.tsx | Use services.workspaceMeta.updateByParentId. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.insomnia-sync.rollback.tsx | Use services.workspace.getById and models.workspace.scopeToActivity. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.insomnia-sync.restore.tsx | Use services.workspace.getById and models.workspace.scopeToActivity. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.insomnia-sync.branch.delete.tsx | Use services.workspace.getById and models.workspace.scopeToActivity. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.insomnia-sync.branch.checkout.tsx | Use services.workspace.getById and models.workspace.scopeToActivity. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.environment.set-active.tsx | Use services.workspaceMeta.getOrCreateByParentId/update. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.environment.set-active-global.tsx | Use services.workspaceMeta.getOrCreateByParentId/update. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.tsx | Use services.workspace/workspaceMeta/grpcRequestMeta and insomnia-data model guards. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.request.new.tsx | Use services.grpcRequest.create. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.request.new-mock-send.tsx | Use services.mockRoute.getById. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.request.delete.tsx | Use services.workspaceMeta.getByParentId/updateByParentId. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.request.$requestId.update-meta.tsx | Use services.grpcRequestMeta.updateOrCreateByParentId. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.request.$requestId.tsx | Use services.workspace/workspaceMeta/mockServer/grpcRequestMeta. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.request.$requestId.response.delete.tsx | Use services.workspaceMeta.getByParentId. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.request.$requestId.response.delete-all.tsx | Use services.workspaceMeta.getByParentId. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.request.$requestId.duplicate.tsx | Use services.workspace.getById. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.request-group.duplicate.tsx | Use services.workspace.getById. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.update.tsx | Use services.workspace.findByParentId and services.workspaceMeta.update. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.move-workspace.tsx | Use services.workspace.getById/update. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.list-workspaces.tsx | Use services.workspace.findByParentId and models.workspace.isDesign. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId._index.tsx | Use services.workspace.findByParentId and models.workspace.isDesign. |
| packages/insomnia/src/routes/organization.$organizationId.insomnia-sync.pull-remote-file.tsx | Use services.workspace.getById and models.workspace.scopeToActivity. |
| packages/insomnia/src/routes/import.resources.tsx | Use services.workspaceMeta.getOrCreateByParentId. |
| packages/insomnia/src/routes/commands.tsx | Use models.workspace.scopeToActivity and insomnia-data types. |
| packages/insomnia/src/routes/auth.login.tsx | Use models.workspace.SCRATCHPAD_WORKSPACE_ID. |
| packages/insomnia/src/root.tsx | Use services.workspace.count. |
| packages/insomnia/src/plugins/index.ts | Use services.workspace.getById and insomnia-data types. |
| packages/insomnia/src/plugins/context/data.ts | Use services.workspace.findByParentId/all. |
| packages/insomnia/src/plugins/context/tests/request.test.ts | Use services.workspace.create in tests. |
| packages/insomnia/src/network/network.ts | Use services.workspace/workspaceMeta and insomnia-data types. |
| packages/insomnia/src/network/grpc/write-proto-file.ts | Use models.workspace.isWorkspace from insomnia-data. |
| packages/insomnia/src/network/grpc/tests/write-proto-file.test.ts | Use services.workspace.create in tests. |
| packages/insomnia/src/network/tests/network.test.ts | Use services.workspace.create in tests. |
| packages/insomnia/src/models/stats.ts | Update gRPC type-guard usage (but see comments). |
| packages/insomnia/src/models/request-version.ts | Move GrpcRequest type to insomnia-data. |
| packages/insomnia/src/models/mock-route.ts | Removed legacy mock-route model. |
| packages/insomnia/src/models/index.ts | Re-export migrated models via insomnia-data models.*. |
| packages/insomnia/src/models/helpers/request-operations.ts | Use services.grpcRequest for gRPC operations. |
| packages/insomnia/src/models/helpers/query-all-workspace-urls.ts | Switch to services.workspace and insomnia-data model type constants (but see comments). |
| packages/insomnia/src/models/helpers/project.ts | Use services.workspaceMeta.getOrCreateByParentId. |
| packages/insomnia/src/models/helpers/tests/query-all-workspace-urls.test.ts | Use services.workspace/grpcRequest.create in tests. |
| packages/insomnia/src/models/grpc-request.ts | Removed legacy grpc-request model. |
| packages/insomnia/src/models/environment.ts | Reference workspace model constants/types via insomnia-data models.workspace. |
| packages/insomnia/src/models/tests/workspace.test.ts | Use services.workspace.create in tests. |
| packages/insomnia/src/models/tests/request.test.ts | Use services.workspace.create in tests. |
| packages/insomnia/src/models/tests/grpc-request.test.ts | Use services.grpcRequest.* in tests. |
| packages/insomnia/src/models/schemas/model-schemas.ts | Move GrpcRequest/Workspace types to insomnia-data. |
| packages/insomnia/src/main/templating-worker-database.ts | Use services.workspace.getById. |
| packages/insomnia/src/main/network/websocket.ts | Use services.workspaceMeta.getOrCreateByParentId. |
| packages/insomnia/src/main/network/socket-io.ts | Use services.workspaceMeta.getOrCreateByParentId. |
| packages/insomnia/src/main/network/curl.ts | Use services.workspaceMeta.getOrCreateByParentId. |
| packages/insomnia/src/main/mcp/common.ts | Use services.workspaceMeta.getOrCreateByParentId. |
| packages/insomnia/src/main/ipc/grpc.ts | Move gRPC types to insomnia-data. |
| packages/insomnia/src/main/git-service.ts | Use services.workspace/workspaceMeta and insomnia-data workspace constants/guards. |
| packages/insomnia/src/insomnia-data/src/models/workspace.ts | Move workspace model definition into insomnia-data and drop direct DB helpers. |
| packages/insomnia/src/insomnia-data/src/models/workspace-meta.ts | Move workspace-meta model definition into insomnia-data and drop direct DB helpers. |
| packages/insomnia/src/insomnia-data/src/models/types.ts | Re-export migrated model types/constants from insomnia-data. |
| packages/insomnia/src/insomnia-data/src/models/mock-server.ts | Add insomnia-data mock-server model definition. |
| packages/insomnia/src/insomnia-data/src/models/mock-route.ts | Add insomnia-data mock-route model definition. |
| packages/insomnia/src/insomnia-data/src/models/index.ts | Export new model modules from insomnia-data. |
| packages/insomnia/src/insomnia-data/src/models/grpc-request.ts | Add insomnia-data grpc-request model definition. |
| packages/insomnia/src/insomnia-data/src/models/grpc-request-meta.ts | Add insomnia-data grpc-request-meta model definition. |
| packages/insomnia/src/insomnia-data/node-src/services/workspace.ts | Add Node service for workspace CRUD. |
| packages/insomnia/src/insomnia-data/node-src/services/workspace-meta.ts | Add Node service for workspace-meta CRUD. |
| packages/insomnia/src/insomnia-data/node-src/services/mock-server.ts | Update Node mock-server service to use insomnia-data DB/models. |
| packages/insomnia/src/insomnia-data/node-src/services/mock-route.ts | Add Node service for mock-route CRUD. |
| packages/insomnia/src/insomnia-data/node-src/services/index.ts | Register new services in node implementation map. |
| packages/insomnia/src/insomnia-data/node-src/services/grpc-request.ts | Add Node service for grpc-request CRUD/duplicate. |
| packages/insomnia/src/insomnia-data/node-src/services/grpc-request-meta.ts | Update Node grpc-request-meta service wiring. |
| packages/insomnia/src/insomnia-data/node-src/database/repair-database.ts | Update types to insomnia-data Workspace. |
| packages/insomnia/src/insomnia-data/node-src/database/database.test.ts | Update tests to use services.workspace/grpcRequest. |
| packages/insomnia/src/insomnia-data/node-src/database/database-nedb.ts | Update types to insomnia-data Workspace/WorkspaceMeta. |
| packages/insomnia/src/entry.main.ts | Use services.workspace.getById/create for scratchpad init. |
| packages/insomnia/src/common/sorting.ts | Use models.grpcRequest.isGrpcRequest from insomnia-data. |
| packages/insomnia/src/common/render.ts | Use services.workspaceMeta.getByParentId and insomnia-data workspace guard. |
| packages/insomnia/src/common/insomnia-v5.ts | Use services.workspace.getById and insomnia-data types. |
| packages/insomnia/src/common/import.ts | Use insomnia-data model guards and services.grpcRequest/workspace/workspaceMeta. |
| packages/insomnia/src/common/har.ts | Use services.workspaceMeta.getByParentId and insomnia-data workspace guard. |
| packages/insomnia/src/common/get-workspace-label.ts | Use models.workspace.* helpers and insomnia-data workspace types. |
| packages/insomnia/src/common/constants.ts | Move mock-server type to insomnia-data. |
| packages/insomnia/src/common/tests/render.test.ts | Update tests to use services.workspace/grpcRequest (but see comments). |
| packages/insomnia/src/common/tests/insomnia-v5.test.ts | Update tests to use services.workspace/mockServer. |
| packages/insomnia/src/common/tests/har.test.ts | Update tests to use services.workspace.create. |
| packages/insomnia/src/account/session.ts | Use services.workspaceMeta.update when clearing gitRepositoryId. |
| packages/insomnia-inso/src/commands/run-collection/result-report.ts | Move Workspace type to insomnia-data. |
| packages/insomnia-inso/src/cli.ts | Move Workspace type to insomnia-data. |
Comments suppressed due to low confidence (1)
packages/insomnia/src/insomnia-data/src/models/workspace.ts:67
migrate()/_migrateExtractClientCertificates()triggers side-effects viaservices.clientCertificate.create(...), but migrations are invoked synchronously frominitModel()(no awaiting). Sinceservices.*APIs are async, this can race (migration returns before certs are created) and can surface as unhandled Promise rejections. Consider makinginitModel()await model migrations (so migrations can beasync), or move this into a dedicated async migration/repair phase; at minimum, ensure the Promise fromcreate()is handled.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/insomnia/src/models/helpers/query-all-workspace-urls.ts
Outdated
Show resolved
Hide resolved
553d7f3 to
71cb06f
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 145 out of 145 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
569c157 to
23bb084
Compare
Migrate the following models into
insomnia-data:INS-2208