From 76691f323dd49b7129e84184ff28911f570f79e6 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Wed, 29 May 2024 15:32:06 +0200 Subject: [PATCH] fix types issues --- .../core-saved-objects-server-internal/src/routes/create.ts | 1 - .../core-saved-objects-server-internal/src/routes/index.ts | 1 - .../saved_objects/routes/allow_api_access/bulk_create.test.ts | 3 ++- .../saved_objects/routes/allow_api_access/bulk_delete.test.ts | 3 ++- .../saved_objects/routes/allow_api_access/bulk_get.test.ts | 3 ++- .../routes/allow_api_access/bulk_resolve.test.ts | 3 ++- .../saved_objects/routes/allow_api_access/bulk_update.test.ts | 3 ++- .../saved_objects/routes/allow_api_access/create.test.ts | 4 ++-- .../saved_objects/routes/allow_api_access/delete.test.ts | 3 ++- .../saved_objects/routes/allow_api_access/find.test.ts | 3 ++- .../saved_objects/routes/allow_api_access/get.test.ts | 3 ++- .../saved_objects/routes/allow_api_access/resolve.test.ts | 3 ++- .../saved_objects/routes/allow_api_access/update.test.ts | 3 ++- .../saved_objects/routes/bulk_create.test.ts | 3 ++- .../saved_objects/routes/bulk_delete.test.ts | 3 ++- .../integration_tests/saved_objects/routes/bulk_get.test.ts | 4 +++- .../saved_objects/routes/bulk_resolve.test.ts | 4 +++- .../saved_objects/routes/bulk_update.test.ts | 4 +++- .../integration_tests/saved_objects/routes/create.test.ts | 4 +++- .../integration_tests/saved_objects/routes/delete.test.ts | 3 ++- .../integration_tests/saved_objects/routes/find.test.ts | 3 ++- .../server/integration_tests/saved_objects/routes/get.test.ts | 4 +++- .../integration_tests/saved_objects/routes/resolve.test.ts | 3 ++- .../integration_tests/saved_objects/routes/update.test.ts | 3 ++- 24 files changed, 49 insertions(+), 25 deletions(-) diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts index 61a07470c4060..54db933dea814 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/create.ts @@ -22,7 +22,6 @@ interface RouteDependencies { config: SavedObjectConfig; coreUsageData: InternalCoreUsageDataSetup; logger: Logger; - isServerless: boolean; access: RouteAccess; } diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/index.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/index.ts index c8818d24c615b..1fd06cdb0e2bd 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/index.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/index.ts @@ -63,7 +63,6 @@ export function registerRoutes({ config, coreUsageData, logger, - isServerless, access: internalOnServerless, }); registerDeleteRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_create.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_create.test.ts index 30b44340ae4b7..8d15baf75a089 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_create.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_create.test.ts @@ -54,7 +54,8 @@ describe('POST /api/saved_objects/_bulk_create with allowApiAccess true', () => const coreUsageData = coreUsageDataServiceMock.createSetupContract(coreUsageStatsClient); const logger = loggerMock.create(); const config = setupConfig(true); - registerBulkCreateRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + registerBulkCreateRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_delete.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_delete.test.ts index 5189e70e26521..376a2c6865bc4 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_delete.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_delete.test.ts @@ -58,8 +58,9 @@ describe('POST /api/saved_objects/_bulk_delete with allowApiAccess as true', () const logger = loggerMock.create(); const config = setupConfig(true); + const access = 'public'; - registerBulkDeleteRoute(router, { config, coreUsageData, logger }); + registerBulkDeleteRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_get.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_get.test.ts index 2ec6342d601ec..865ad820bb72a 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_get.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_get.test.ts @@ -56,7 +56,8 @@ describe('POST /api/saved_objects/_bulk_get with allowApiAccess true', () => { const logger = loggerMock.create(); const config = setupConfig(true); - registerBulkGetRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + registerBulkGetRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_resolve.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_resolve.test.ts index 33dd5ca478a18..3b62e95bfc271 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_resolve.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_resolve.test.ts @@ -57,7 +57,8 @@ describe('POST /api/saved_objects/_bulk_resolve with allowApiAccess true', () => const logger = loggerMock.create(); const config = setupConfig(true); - registerBulkResolveRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + registerBulkResolveRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_update.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_update.test.ts index 3feea1a471fdd..7cea1d35f326c 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_update.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_update.test.ts @@ -50,7 +50,8 @@ describe('PUT /api/saved_objects/_bulk_update with allowApiAccess true', () => { const logger = loggerMock.create(); const config = setupConfig(true); - registerBulkUpdateRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + registerBulkUpdateRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/create.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/create.test.ts index 02ffcdf2baaeb..e7f4ad8a7a2cf 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/create.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/create.test.ts @@ -56,8 +56,8 @@ describe('POST /api/saved_objects/{type} with allowApiAccess true', () => { const coreUsageData = coreUsageDataServiceMock.createSetupContract(coreUsageStatsClient); const logger = loggerMock.create(); const config = setupConfig(true); - - registerCreateRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + registerCreateRoute(router, { config, coreUsageData, logger, access }); handlerContext.savedObjects.typeRegistry.getType.mockImplementation((typename: string) => { return testTypes diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/delete.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/delete.test.ts index 0cffad1bf2a7c..a3af4ee573ffc 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/delete.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/delete.test.ts @@ -53,7 +53,8 @@ describe('DELETE /api/saved_objects/{type}/{id} with allowApiAccess true', () => const coreUsageData = coreUsageDataServiceMock.createSetupContract(coreUsageStatsClient); const logger = loggerMock.create(); const config = setupConfig(true); - registerDeleteRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + registerDeleteRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/find.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/find.test.ts index 0487f6a519130..ab3011e75b80e 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/find.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/find.test.ts @@ -69,8 +69,9 @@ describe('GET /api/saved_objects/_find with allowApiAccess true', () => { const logger = loggerMock.create(); const config = setupConfig(true); + const access = 'public'; - registerFindRoute(router, { config, coreUsageData, logger }); + registerFindRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/get.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/get.test.ts index 0d589cc5e0fe8..bd78a18a01de5 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/get.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/get.test.ts @@ -78,7 +78,8 @@ describe('GET /api/saved_objects/{type}/{id} with allowApiAccess true', () => { const logger = loggerMock.create(); const config = setupConfig(true); - registerGetRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + registerGetRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/resolve.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/resolve.test.ts index e017cef0f881b..7213e5c4d1b2d 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/resolve.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/resolve.test.ts @@ -78,8 +78,9 @@ describe('GET /api/saved_objects/resolve/{type}/{id} with allowApiAccess true', const logger = loggerMock.create(); const config = setupConfig(true); + const access = 'public'; - registerResolveRoute(router, { config, coreUsageData, logger }); + registerResolveRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/update.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/update.test.ts index 41365962800d3..d9803072b4d22 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/update.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/update.test.ts @@ -54,7 +54,8 @@ describe('PUT /api/saved_objects/{type}/{id?} with allowApiAccess true', () => { const logger = loggerMock.create(); const config = setupConfig(true); - registerUpdateRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + registerUpdateRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_create.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_create.test.ts index d6e885485aeb9..c2b4a2d858910 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_create.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_create.test.ts @@ -58,8 +58,9 @@ describe('POST /api/saved_objects/_bulk_create', () => { loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(); const config = setupConfig(); + const access = 'public'; - registerBulkCreateRoute(router, { config, coreUsageData, logger }); + registerBulkCreateRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_delete.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_delete.test.ts index d42090e87aa66..e2e9001d14bf5 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_delete.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_delete.test.ts @@ -60,8 +60,9 @@ describe('POST /api/saved_objects/_bulk_delete', () => { loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(); const config = setupConfig(); + const access = 'public'; - registerBulkDeleteRoute(router, { config, coreUsageData, logger }); + registerBulkDeleteRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_get.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_get.test.ts index 4403eb1770c81..653106d0bbb49 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_get.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_get.test.ts @@ -58,7 +58,9 @@ describe('POST /api/saved_objects/_bulk_get', () => { loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(); const config = setupConfig(); - registerBulkGetRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + + registerBulkGetRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_resolve.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_resolve.test.ts index 05bc1bf93d2ce..e61f7bd2973a2 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_resolve.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_resolve.test.ts @@ -59,7 +59,9 @@ describe('POST /api/saved_objects/_bulk_resolve', () => { loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(); const config = setupConfig(); - registerBulkResolveRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + + registerBulkResolveRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_update.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_update.test.ts index 6df5f9cc4c718..e6563262c0518 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_update.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_update.test.ts @@ -57,7 +57,9 @@ describe('PUT /api/saved_objects/_bulk_update', () => { loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(); const config = setupConfig(); - registerBulkUpdateRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + + registerBulkUpdateRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/create.test.ts b/src/core/server/integration_tests/saved_objects/routes/create.test.ts index 882cccf879ad7..f618fe36c1713 100644 --- a/src/core/server/integration_tests/saved_objects/routes/create.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/create.test.ts @@ -58,7 +58,9 @@ describe('POST /api/saved_objects/{type}', () => { const logger = loggerMock.create(); loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(); const config = setupConfig(); - registerCreateRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + + registerCreateRoute(router, { config, coreUsageData, logger, access }); handlerContext.savedObjects.typeRegistry.getType.mockImplementation((typename: string) => { return testTypes diff --git a/src/core/server/integration_tests/saved_objects/routes/delete.test.ts b/src/core/server/integration_tests/saved_objects/routes/delete.test.ts index ec364e5de287d..c0e37e1d8f214 100644 --- a/src/core/server/integration_tests/saved_objects/routes/delete.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/delete.test.ts @@ -55,7 +55,8 @@ describe('DELETE /api/saved_objects/{type}/{id}', () => { const logger = loggerMock.create(); loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(); const config = setupConfig(); - registerDeleteRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + registerDeleteRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/find.test.ts b/src/core/server/integration_tests/saved_objects/routes/find.test.ts index 99bffe1406862..cdf9f606c4797 100644 --- a/src/core/server/integration_tests/saved_objects/routes/find.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/find.test.ts @@ -72,8 +72,9 @@ describe('GET /api/saved_objects/_find', () => { loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(); const config = setupConfig(); + const access = 'public'; - registerFindRoute(router, { config, coreUsageData, logger }); + registerFindRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/get.test.ts b/src/core/server/integration_tests/saved_objects/routes/get.test.ts index 7d622e3b118ed..d7c08e8d66a06 100644 --- a/src/core/server/integration_tests/saved_objects/routes/get.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/get.test.ts @@ -80,7 +80,9 @@ describe('GET /api/saved_objects/{type}/{id}', () => { loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(); const config = setupConfig(); - registerGetRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + + registerGetRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/resolve.test.ts b/src/core/server/integration_tests/saved_objects/routes/resolve.test.ts index 3e36a78c90bad..73325a462a9d0 100644 --- a/src/core/server/integration_tests/saved_objects/routes/resolve.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/resolve.test.ts @@ -79,8 +79,9 @@ describe('GET /api/saved_objects/resolve/{type}/{id}', () => { const logger = loggerMock.create(); loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(); const config = setupConfig(); + const access = 'public'; - registerResolveRoute(router, { config, coreUsageData, logger }); + registerResolveRoute(router, { config, coreUsageData, logger, access }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/update.test.ts b/src/core/server/integration_tests/saved_objects/routes/update.test.ts index 283773c3214de..17f1500f0893b 100644 --- a/src/core/server/integration_tests/saved_objects/routes/update.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/update.test.ts @@ -67,7 +67,8 @@ describe('PUT /api/saved_objects/{type}/{id?}', () => { loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(); const config = setupConfig(); - registerUpdateRoute(router, { config, coreUsageData, logger }); + const access = 'public'; + registerUpdateRoute(router, { config, coreUsageData, logger, access }); await server.start(); });