fix(sandbox): migrate pluginData off the services.invoke gateway (Phase 2 batch 6)

5 pairs: pluginData.{all,getByKey,removeAll,removeByKey,upsertByKey}. Matches §5's
5-pair count for this batch exactly.

91/183 pairs migrated after this batch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Kyle
2026-07-26 18:26:01 -04:00
parent 7f7c663432
commit c14620d675
6 changed files with 37 additions and 5 deletions

View File

@@ -85,11 +85,11 @@ exports[`describeServicesInvokeSurface (real repo) > matches the current service
"oAuth2Token.remove: services.invoke (1 call site)",
"oAuth2Token.update: services.invoke (1 call site)",
"organization.list: named handler (1 call site)",
"pluginData.all: services.invoke (1 call site)",
"pluginData.getByKey: services.invoke (2 call sites)",
"pluginData.removeAll: services.invoke (1 call site)",
"pluginData.removeByKey: services.invoke (2 call sites)",
"pluginData.upsertByKey: services.invoke (1 call site)",
"pluginData.all: named handler (1 call site)",
"pluginData.getByKey: named handler (2 call sites)",
"pluginData.removeAll: named handler (1 call site)",
"pluginData.removeByKey: named handler (2 call sites)",
"pluginData.upsertByKey: named handler (1 call site)",
"project.count: services.invoke (2 call sites)",
"project.create: services.invoke (4 call sites)",
"project.get: services.invoke (2 call sites)",

View File

@@ -31,6 +31,7 @@ vi.mock('insomnia-data', () => ({
mockRoute: { create: vi.fn(), findByParentId: vi.fn(), getById: vi.fn(), remove: vi.fn(), update: vi.fn() },
mockServer: { findByProjectId: vi.fn(), getById: vi.fn(), getByParentId: vi.fn(), getOrCreateForParentId: vi.fn(), update: vi.fn() },
organization: { list: vi.fn() },
pluginData: { all: vi.fn(), getByKey: vi.fn(), removeAll: vi.fn(), removeByKey: vi.fn(), upsertByKey: vi.fn() },
},
}));
@@ -130,6 +131,11 @@ const CASES: { handlerName: keyof typeof handlers; serviceName: string; methodNa
{ handlerName: 'mockServerGetOrCreateForParentId', serviceName: 'mockServer', methodName: 'getOrCreateForParentId', args: ['w1', {}] },
{ handlerName: 'mockServerUpdate', serviceName: 'mockServer', methodName: 'update', args: [{ _id: 'server1' }, { name: 'renamed' }] },
{ handlerName: 'organizationList', serviceName: 'organization', methodName: 'list', args: [] },
{ handlerName: 'pluginDataAll', serviceName: 'pluginData', methodName: 'all', args: ['my-plugin'] },
{ handlerName: 'pluginDataGetByKey', serviceName: 'pluginData', methodName: 'getByKey', args: ['my-plugin', 'k'] },
{ handlerName: 'pluginDataRemoveAll', serviceName: 'pluginData', methodName: 'removeAll', args: ['my-plugin'] },
{ handlerName: 'pluginDataRemoveByKey', serviceName: 'pluginData', methodName: 'removeByKey', args: ['my-plugin', 'k'] },
{ handlerName: 'pluginDataUpsertByKey', serviceName: 'pluginData', methodName: 'upsertByKey', args: ['my-plugin', 'k', 'v'] },
];
describe.each(CASES)('$handlerName', ({ handlerName, serviceName, methodName, args }) => {

View File

@@ -129,6 +129,11 @@ export type HandleChannels =
| 'services.mockServer.getOrCreateForParentId'
| 'services.mockServer.update'
| 'services.organization.list'
| 'services.pluginData.all'
| 'services.pluginData.getByKey'
| 'services.pluginData.removeAll'
| 'services.pluginData.removeByKey'
| 'services.pluginData.upsertByKey'
| 'extractJsonFileFromPostmanDataDumpArchive'
| 'generateCommitsFromDiff'
| 'generateMockRouteDataFromSpec'

View File

@@ -124,6 +124,11 @@ import {
mockServerGetOrCreateForParentId,
mockServerUpdate,
organizationList,
pluginDataAll,
pluginDataGetByKey,
pluginDataRemoveAll,
pluginDataRemoveByKey,
pluginDataUpsertByKey,
settingsGet,
settingsGetOrCreate,
settingsPatch,
@@ -570,6 +575,11 @@ export function registerMainHandlers() {
ipcMainHandle('services.mockServer.getOrCreateForParentId', mockServerGetOrCreateForParentId);
ipcMainHandle('services.mockServer.update', mockServerUpdate);
ipcMainHandle('services.organization.list', organizationList);
ipcMainHandle('services.pluginData.all', pluginDataAll);
ipcMainHandle('services.pluginData.getByKey', pluginDataGetByKey);
ipcMainHandle('services.pluginData.removeAll', pluginDataRemoveAll);
ipcMainHandle('services.pluginData.removeByKey', pluginDataRemoveByKey);
ipcMainHandle('services.pluginData.upsertByKey', pluginDataUpsertByKey);
ipcMainHandle('createPlugin', async (_, options: { pluginName: string; mainJs: string }) => {
return createPlugin(options.pluginName, options.mainJs);
});

View File

@@ -91,6 +91,11 @@ export const MIGRATED_SERVICES_INVOKE_PAIRS: ReadonlySet<string> = new Set<strin
'mockServer.getOrCreateForParentId',
'mockServer.update',
'organization.list',
'pluginData.all',
'pluginData.getByKey',
'pluginData.removeAll',
'pluginData.removeByKey',
'pluginData.upsertByKey',
]);
/** The IPC channel a `services.<serviceName>.<methodName>` call should use: the named channel once migrated, else the legacy generic gateway. */

View File

@@ -134,3 +134,9 @@ export const mockServerGetOrCreateForParentId = (_: IpcMainInvokeEvent, workspac
export const mockServerUpdate = (_: IpcMainInvokeEvent, mockServer: MockServer, patch: Partial<MockServer> = {}) => services.mockServer.update(mockServer, patch);
export const organizationList = (_: IpcMainInvokeEvent) => services.organization.list();
export const pluginDataAll = (_: IpcMainInvokeEvent, plugin: string) => services.pluginData.all(plugin);
export const pluginDataGetByKey = (_: IpcMainInvokeEvent, plugin: string, key: string) => services.pluginData.getByKey(plugin, key);
export const pluginDataRemoveAll = (_: IpcMainInvokeEvent, plugin: string) => services.pluginData.removeAll(plugin);
export const pluginDataRemoveByKey = (_: IpcMainInvokeEvent, plugin: string, key: string) => services.pluginData.removeByKey(plugin, key);
export const pluginDataUpsertByKey = (_: IpcMainInvokeEvent, plugin: string, key: string, value: string) => services.pluginData.upsertByKey(plugin, key, value);