diff --git a/.changeset/twenty-moons-sneeze.md b/.changeset/twenty-moons-sneeze.md new file mode 100644 index 0000000000..4c3a6072cf --- /dev/null +++ b/.changeset/twenty-moons-sneeze.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-app-api': patch +--- + +Internal folder structure refactor. diff --git a/packages/backend-app-api/src/services/implementations/cacheService.ts b/packages/backend-app-api/src/services/implementations/cache/cacheFactory.ts similarity index 100% rename from packages/backend-app-api/src/services/implementations/cacheService.ts rename to packages/backend-app-api/src/services/implementations/cache/cacheFactory.ts diff --git a/packages/backend-app-api/src/services/implementations/cache/index.ts b/packages/backend-app-api/src/services/implementations/cache/index.ts new file mode 100644 index 0000000000..3d1bcd75a7 --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/cache/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { cacheFactory } from './cacheFactory'; diff --git a/packages/backend-app-api/src/services/implementations/configService.ts b/packages/backend-app-api/src/services/implementations/config/configFactory.ts similarity index 100% rename from packages/backend-app-api/src/services/implementations/configService.ts rename to packages/backend-app-api/src/services/implementations/config/configFactory.ts diff --git a/packages/backend-app-api/src/services/implementations/config/index.ts b/packages/backend-app-api/src/services/implementations/config/index.ts new file mode 100644 index 0000000000..a9019b5b1c --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/config/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { configFactory } from './configFactory'; diff --git a/packages/backend-app-api/src/services/implementations/databaseService.ts b/packages/backend-app-api/src/services/implementations/database/databaseFactory.ts similarity index 100% rename from packages/backend-app-api/src/services/implementations/databaseService.ts rename to packages/backend-app-api/src/services/implementations/database/databaseFactory.ts diff --git a/packages/backend-app-api/src/services/implementations/database/index.ts b/packages/backend-app-api/src/services/implementations/database/index.ts new file mode 100644 index 0000000000..0045630e15 --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/database/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { databaseFactory } from './databaseFactory'; diff --git a/packages/backend-app-api/src/services/implementations/discoveryService.ts b/packages/backend-app-api/src/services/implementations/discovery/discoveryFactory.ts similarity index 100% rename from packages/backend-app-api/src/services/implementations/discoveryService.ts rename to packages/backend-app-api/src/services/implementations/discovery/discoveryFactory.ts diff --git a/packages/backend-app-api/src/services/implementations/discovery/index.ts b/packages/backend-app-api/src/services/implementations/discovery/index.ts new file mode 100644 index 0000000000..182b9f6cd2 --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/discovery/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { discoveryFactory } from './discoveryFactory'; diff --git a/packages/backend-app-api/src/services/implementations/index.ts b/packages/backend-app-api/src/services/implementations/index.ts index 73c3418090..8b9d0c0679 100644 --- a/packages/backend-app-api/src/services/implementations/index.ts +++ b/packages/backend-app-api/src/services/implementations/index.ts @@ -14,18 +14,17 @@ * limitations under the License. */ +export * from './cache'; +export * from './config'; +export * from './database'; +export * from './discovery'; export * from './httpRouter'; +export * from './lifecycle'; +export * from './logger'; +export * from './permissions'; export * from './rootHttpRouter'; - -export { cacheFactory } from './cacheService'; -export { configFactory } from './configService'; -export { databaseFactory } from './databaseService'; -export { discoveryFactory } from './discoveryService'; -export { loggerFactory } from './loggerService'; -export { rootLoggerFactory } from './rootLoggerService'; -export { permissionsFactory } from './permissionsService'; -export { schedulerFactory } from './schedulerService'; -export { tokenManagerFactory } from './tokenManagerService'; -export { urlReaderFactory } from './urlReaderService'; -export { lifecycleFactory } from './lifecycleService'; -export { rootLifecycleFactory } from './rootLifecycleService'; +export * from './rootLifecycle'; +export * from './rootLogger'; +export * from './scheduler'; +export * from './tokenManager'; +export * from './urlReader'; diff --git a/packages/backend-app-api/src/services/implementations/lifecycle/index.ts b/packages/backend-app-api/src/services/implementations/lifecycle/index.ts new file mode 100644 index 0000000000..cfca37a162 --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/lifecycle/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { lifecycleFactory } from './lifecycleFactory'; diff --git a/packages/backend-app-api/src/services/implementations/lifecycleService.ts b/packages/backend-app-api/src/services/implementations/lifecycle/lifecycleFactory.ts similarity index 100% rename from packages/backend-app-api/src/services/implementations/lifecycleService.ts rename to packages/backend-app-api/src/services/implementations/lifecycle/lifecycleFactory.ts diff --git a/packages/backend-app-api/src/services/implementations/logger/index.ts b/packages/backend-app-api/src/services/implementations/logger/index.ts new file mode 100644 index 0000000000..acef1b178f --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/logger/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { loggerFactory } from './loggerFactory'; diff --git a/packages/backend-app-api/src/services/implementations/loggerService.ts b/packages/backend-app-api/src/services/implementations/logger/loggerFactory.ts similarity index 100% rename from packages/backend-app-api/src/services/implementations/loggerService.ts rename to packages/backend-app-api/src/services/implementations/logger/loggerFactory.ts diff --git a/packages/backend-app-api/src/services/implementations/permissions/index.ts b/packages/backend-app-api/src/services/implementations/permissions/index.ts new file mode 100644 index 0000000000..29a6aa237a --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/permissions/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { permissionsFactory } from './permissionsFactory'; diff --git a/packages/backend-app-api/src/services/implementations/permissionsService.ts b/packages/backend-app-api/src/services/implementations/permissions/permissionsFactory.ts similarity index 100% rename from packages/backend-app-api/src/services/implementations/permissionsService.ts rename to packages/backend-app-api/src/services/implementations/permissions/permissionsFactory.ts diff --git a/packages/backend-app-api/src/services/implementations/rootLifecycle/index.ts b/packages/backend-app-api/src/services/implementations/rootLifecycle/index.ts new file mode 100644 index 0000000000..8adefbfe84 --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/rootLifecycle/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { rootLifecycleFactory } from './rootLifecycleFactory'; diff --git a/packages/backend-app-api/src/services/implementations/rootLifecycleService.test.ts b/packages/backend-app-api/src/services/implementations/rootLifecycle/rootLifecycleFactory.test.ts similarity index 95% rename from packages/backend-app-api/src/services/implementations/rootLifecycleService.test.ts rename to packages/backend-app-api/src/services/implementations/rootLifecycle/rootLifecycleFactory.test.ts index e7827e5fc3..fc1c266775 100644 --- a/packages/backend-app-api/src/services/implementations/rootLifecycleService.test.ts +++ b/packages/backend-app-api/src/services/implementations/rootLifecycle/rootLifecycleFactory.test.ts @@ -15,7 +15,7 @@ */ import { getVoidLogger } from '@backstage/backend-common'; -import { BackendLifecycleImpl } from './rootLifecycleService'; +import { BackendLifecycleImpl } from './rootLifecycleFactory'; describe('lifecycleService', () => { it('should execute registered shutdown hook', async () => { diff --git a/packages/backend-app-api/src/services/implementations/rootLifecycleService.ts b/packages/backend-app-api/src/services/implementations/rootLifecycle/rootLifecycleFactory.ts similarity index 100% rename from packages/backend-app-api/src/services/implementations/rootLifecycleService.ts rename to packages/backend-app-api/src/services/implementations/rootLifecycle/rootLifecycleFactory.ts diff --git a/packages/backend-app-api/src/services/implementations/rootLogger/index.ts b/packages/backend-app-api/src/services/implementations/rootLogger/index.ts new file mode 100644 index 0000000000..ce5816e6fa --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/rootLogger/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { rootLoggerFactory } from './rootLoggerFactory'; diff --git a/packages/backend-app-api/src/services/implementations/rootLoggerService.ts b/packages/backend-app-api/src/services/implementations/rootLogger/rootLoggerFactory.ts similarity index 100% rename from packages/backend-app-api/src/services/implementations/rootLoggerService.ts rename to packages/backend-app-api/src/services/implementations/rootLogger/rootLoggerFactory.ts diff --git a/packages/backend-app-api/src/services/implementations/scheduler/index.ts b/packages/backend-app-api/src/services/implementations/scheduler/index.ts new file mode 100644 index 0000000000..8b84906b5b --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/scheduler/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { schedulerFactory } from './schedulerFactory'; diff --git a/packages/backend-app-api/src/services/implementations/schedulerService.ts b/packages/backend-app-api/src/services/implementations/scheduler/schedulerFactory.ts similarity index 100% rename from packages/backend-app-api/src/services/implementations/schedulerService.ts rename to packages/backend-app-api/src/services/implementations/scheduler/schedulerFactory.ts diff --git a/packages/backend-app-api/src/services/implementations/tokenManager/index.ts b/packages/backend-app-api/src/services/implementations/tokenManager/index.ts new file mode 100644 index 0000000000..c0685079c4 --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/tokenManager/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { tokenManagerFactory } from './tokenManagerFactory'; diff --git a/packages/backend-app-api/src/services/implementations/tokenManagerService.ts b/packages/backend-app-api/src/services/implementations/tokenManager/tokenManagerFactory.ts similarity index 100% rename from packages/backend-app-api/src/services/implementations/tokenManagerService.ts rename to packages/backend-app-api/src/services/implementations/tokenManager/tokenManagerFactory.ts diff --git a/packages/backend-app-api/src/services/implementations/urlReader/index.ts b/packages/backend-app-api/src/services/implementations/urlReader/index.ts new file mode 100644 index 0000000000..5da0ef4049 --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/urlReader/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { urlReaderFactory } from './urlReaderFactory'; diff --git a/packages/backend-app-api/src/services/implementations/urlReaderService.ts b/packages/backend-app-api/src/services/implementations/urlReader/urlReaderFactory.ts similarity index 100% rename from packages/backend-app-api/src/services/implementations/urlReaderService.ts rename to packages/backend-app-api/src/services/implementations/urlReader/urlReaderFactory.ts diff --git a/packages/backend-app-api/src/wiring/BackendInitializer.ts b/packages/backend-app-api/src/wiring/BackendInitializer.ts index 69512ba4c2..ce17398a79 100644 --- a/packages/backend-app-api/src/wiring/BackendInitializer.ts +++ b/packages/backend-app-api/src/wiring/BackendInitializer.ts @@ -20,7 +20,7 @@ import { coreServices, ServiceRef, } from '@backstage/backend-plugin-api'; -import { BackendLifecycleImpl } from '../services/implementations/rootLifecycleService'; +import { BackendLifecycleImpl } from '../services/implementations/rootLifecycle/rootLifecycleFactory'; import { BackendRegisterInit, EnumerableServiceHolder,