feat: moving the actions and actions registry to alpha services
Signed-off-by: benjdlambert <ben@blam.sh> Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
@@ -20,8 +20,6 @@
|
||||
"license": "Apache-2.0",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./actions": "./src/entrypoints/actions/index.ts",
|
||||
"./actionsRegistry": "./src/entrypoints/actionsRegistry/index.ts",
|
||||
"./auditor": "./src/entrypoints/auditor/index.ts",
|
||||
"./auth": "./src/entrypoints/auth/index.ts",
|
||||
"./cache": "./src/entrypoints/cache/index.ts",
|
||||
@@ -41,18 +39,13 @@
|
||||
"./scheduler": "./src/entrypoints/scheduler/index.ts",
|
||||
"./urlReader": "./src/entrypoints/urlReader/index.ts",
|
||||
"./userInfo": "./src/entrypoints/userInfo/index.ts",
|
||||
"./alpha": "./src/alpha/index.ts",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"actions": [
|
||||
"src/entrypoints/actions/index.ts"
|
||||
],
|
||||
"actionsRegistry": [
|
||||
"src/entrypoints/actionsRegistry/index.ts"
|
||||
],
|
||||
"auditor": [
|
||||
"src/entrypoints/auditor/index.ts"
|
||||
],
|
||||
@@ -110,6 +103,9 @@
|
||||
"userInfo": [
|
||||
"src/entrypoints/userInfo/index.ts"
|
||||
],
|
||||
"alpha": [
|
||||
"src/alpha/index.ts"
|
||||
],
|
||||
"package.json": [
|
||||
"package.json"
|
||||
]
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
## API Report File for "@backstage/backend-defaults"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { ActionsService } from '@backstage/backend-plugin-api';
|
||||
import { ServiceFactory } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @public (undocumented)
|
||||
export const actionsServiceFactory: ServiceFactory<
|
||||
ActionsService,
|
||||
'plugin',
|
||||
'singleton'
|
||||
>;
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
+9
-1
@@ -3,7 +3,8 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { ActionsRegistryService } from '@backstage/backend-plugin-api';
|
||||
import { ActionsRegistryService } from '@backstage/backend-plugin-api/alpha';
|
||||
import { ActionsService } from '@backstage/backend-plugin-api/alpha';
|
||||
import { ServiceFactory } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @public (undocumented)
|
||||
@@ -13,5 +14,12 @@ export const actionsRegistryServiceFactory: ServiceFactory<
|
||||
'singleton'
|
||||
>;
|
||||
|
||||
// @public (undocumented)
|
||||
export const actionsServiceFactory: ServiceFactory<
|
||||
ActionsService,
|
||||
'plugin',
|
||||
'singleton'
|
||||
>;
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
@@ -35,12 +35,12 @@ import { schedulerServiceFactory } from '@backstage/backend-defaults/scheduler';
|
||||
import { urlReaderServiceFactory } from '@backstage/backend-defaults/urlReader';
|
||||
import { userInfoServiceFactory } from '@backstage/backend-defaults/userInfo';
|
||||
import { eventsServiceFactory } from '@backstage/plugin-events-node';
|
||||
import { actionsRegistryServiceFactory } from './entrypoints/actionsRegistry';
|
||||
import { actionsServiceFactory } from './entrypoints/actions';
|
||||
|
||||
export const defaultServiceFactories = [
|
||||
import {
|
||||
actionsRegistryServiceFactory,
|
||||
actionsServiceFactory,
|
||||
} from '@backstage/backend-defaults/alpha';
|
||||
|
||||
export const defaultServiceFactories = [
|
||||
auditorServiceFactory,
|
||||
authServiceFactory,
|
||||
cacheServiceFactory,
|
||||
@@ -61,6 +61,10 @@ export const defaultServiceFactories = [
|
||||
userInfoServiceFactory,
|
||||
urlReaderServiceFactory,
|
||||
eventsServiceFactory,
|
||||
|
||||
// alpha services
|
||||
actionsRegistryServiceFactory,
|
||||
actionsServiceFactory,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
+4
-2
@@ -14,8 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {
|
||||
ActionsService,
|
||||
ActionsServiceAction,
|
||||
AuthService,
|
||||
BackstageCredentials,
|
||||
DiscoveryService,
|
||||
@@ -24,6 +22,10 @@ import {
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { ResponseError } from '@backstage/errors';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import {
|
||||
ActionsService,
|
||||
ActionsServiceAction,
|
||||
} from '@backstage/backend-plugin-api/alpha';
|
||||
|
||||
export class DefaultActionsService implements ActionsService {
|
||||
private constructor(
|
||||
+6
-4
@@ -21,18 +21,20 @@ import {
|
||||
startTestBackend,
|
||||
} from '@backstage/backend-test-utils';
|
||||
import { actionsRegistryServiceFactory } from '../actionsRegistry';
|
||||
import { httpRouterServiceFactory } from '../httpRouter';
|
||||
import { httpRouterServiceFactory } from '../../../entrypoints/httpRouter';
|
||||
import { actionsServiceFactory } from './actionsServiceFactory';
|
||||
import { setupServer } from 'msw/node';
|
||||
import { rest } from 'msw';
|
||||
import {
|
||||
ActionsServiceAction,
|
||||
coreServices,
|
||||
createBackendPlugin,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { json } from 'express';
|
||||
import Router from 'express-promise-router';
|
||||
import request from 'supertest';
|
||||
import { ActionsServiceAction } from '@backstage/backend-plugin-api/alpha';
|
||||
import { actionsRegistryServiceRef } from '@backstage/backend-plugin-api/alpha';
|
||||
import { actionsServiceRef } from '@backstage/backend-plugin-api/alpha';
|
||||
|
||||
const server = setupServer();
|
||||
|
||||
@@ -201,7 +203,7 @@ describe('actionsServiceFactory', () => {
|
||||
pluginId: 'plugin-with-action',
|
||||
register({ registerInit }) {
|
||||
registerInit({
|
||||
deps: { actionsRegistry: coreServices.actionsRegistry },
|
||||
deps: { actionsRegistry: actionsRegistryServiceRef },
|
||||
async init({ actionsRegistry }) {
|
||||
actionsRegistry.register({
|
||||
name: 'with-validation',
|
||||
@@ -236,7 +238,7 @@ describe('actionsServiceFactory', () => {
|
||||
register({ registerInit }) {
|
||||
registerInit({
|
||||
deps: {
|
||||
actionsService: coreServices.actions,
|
||||
actionsService: actionsServiceRef,
|
||||
router: coreServices.httpRouter,
|
||||
httpAuth: coreServices.httpAuth,
|
||||
},
|
||||
+2
-1
@@ -16,12 +16,13 @@
|
||||
import { createServiceFactory } from '@backstage/backend-plugin-api';
|
||||
import { coreServices } from '@backstage/backend-plugin-api';
|
||||
import { DefaultActionsService } from './DefaultActionsService';
|
||||
import { actionsServiceRef } from '@backstage/backend-plugin-api/alpha';
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const actionsServiceFactory = createServiceFactory({
|
||||
service: coreServices.actions,
|
||||
service: actionsServiceRef,
|
||||
deps: {
|
||||
discovery: coreServices.discovery,
|
||||
config: coreServices.rootConfig,
|
||||
+4
-2
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
ActionsRegistryActionOptions,
|
||||
ActionsRegistryService,
|
||||
AuthService,
|
||||
HttpAuthService,
|
||||
LoggerService,
|
||||
@@ -26,6 +24,10 @@ import PromiseRouter from 'express-promise-router';
|
||||
import { Router, json } from 'express';
|
||||
import { z, AnyZodObject } from 'zod';
|
||||
import zodToJsonSchema from 'zod-to-json-schema';
|
||||
import {
|
||||
ActionsRegistryActionOptions,
|
||||
ActionsRegistryService,
|
||||
} from '@backstage/backend-plugin-api/alpha';
|
||||
import {
|
||||
ForwardedError,
|
||||
InputError,
|
||||
+10
-12
@@ -13,19 +13,17 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {
|
||||
coreServices,
|
||||
createBackendPlugin,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { createBackendPlugin } from '@backstage/backend-plugin-api';
|
||||
import {
|
||||
mockCredentials,
|
||||
mockServices,
|
||||
startTestBackend,
|
||||
} from '@backstage/backend-test-utils';
|
||||
import { httpRouterServiceFactory } from '../httpRouter';
|
||||
import { httpRouterServiceFactory } from '../../../entrypoints/httpRouter';
|
||||
import request from 'supertest';
|
||||
import { actionsRegistryServiceFactory } from './actionsRegistryServiceFactory';
|
||||
import { InputError } from '@backstage/errors';
|
||||
import { actionsRegistryServiceRef } from '@backstage/backend-plugin-api/alpha';
|
||||
|
||||
describe('actionsRegistryServiceFactory', () => {
|
||||
const defaultServices = [
|
||||
@@ -43,7 +41,7 @@ describe('actionsRegistryServiceFactory', () => {
|
||||
register(reg) {
|
||||
reg.registerInit({
|
||||
deps: {
|
||||
actionsRegistry: coreServices.actionsRegistry,
|
||||
actionsRegistry: actionsRegistryServiceRef,
|
||||
},
|
||||
async init({ actionsRegistry }) {
|
||||
actionsRegistry.register({
|
||||
@@ -80,7 +78,7 @@ describe('actionsRegistryServiceFactory', () => {
|
||||
register(reg) {
|
||||
reg.registerInit({
|
||||
deps: {
|
||||
actionsRegistry: coreServices.actionsRegistry,
|
||||
actionsRegistry: actionsRegistryServiceRef,
|
||||
},
|
||||
async init({ actionsRegistry }) {
|
||||
actionsRegistry.register({
|
||||
@@ -118,7 +116,7 @@ describe('actionsRegistryServiceFactory', () => {
|
||||
register(reg) {
|
||||
reg.registerInit({
|
||||
deps: {
|
||||
actionsRegistry: coreServices.actionsRegistry,
|
||||
actionsRegistry: actionsRegistryServiceRef,
|
||||
},
|
||||
async init({ actionsRegistry }) {
|
||||
actionsRegistry.register({
|
||||
@@ -187,7 +185,7 @@ describe('actionsRegistryServiceFactory', () => {
|
||||
register(reg) {
|
||||
reg.registerInit({
|
||||
deps: {
|
||||
actionsRegistry: coreServices.actionsRegistry,
|
||||
actionsRegistry: actionsRegistryServiceRef,
|
||||
},
|
||||
async init({ actionsRegistry }) {
|
||||
actionsRegistry.register({
|
||||
@@ -235,7 +233,7 @@ describe('actionsRegistryServiceFactory', () => {
|
||||
register(reg) {
|
||||
reg.registerInit({
|
||||
deps: {
|
||||
actionsRegistry: coreServices.actionsRegistry,
|
||||
actionsRegistry: actionsRegistryServiceRef,
|
||||
},
|
||||
async init({ actionsRegistry }) {
|
||||
actionsRegistry.register({
|
||||
@@ -290,7 +288,7 @@ describe('actionsRegistryServiceFactory', () => {
|
||||
register(reg) {
|
||||
reg.registerInit({
|
||||
deps: {
|
||||
actionsRegistry: coreServices.actionsRegistry,
|
||||
actionsRegistry: actionsRegistryServiceRef,
|
||||
},
|
||||
async init({ actionsRegistry }) {
|
||||
actionsRegistry.register({
|
||||
@@ -349,7 +347,7 @@ describe('actionsRegistryServiceFactory', () => {
|
||||
register(reg) {
|
||||
reg.registerInit({
|
||||
deps: {
|
||||
actionsRegistry: coreServices.actionsRegistry,
|
||||
actionsRegistry: actionsRegistryServiceRef,
|
||||
},
|
||||
async init({ actionsRegistry }) {
|
||||
actionsRegistry.register({
|
||||
+2
-1
@@ -19,12 +19,13 @@ import {
|
||||
createServiceFactory,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { DefaultActionsRegistryService } from './DefaultActionsRegistryService';
|
||||
import { actionsRegistryServiceRef } from '@backstage/backend-plugin-api/alpha';
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const actionsRegistryServiceFactory = createServiceFactory({
|
||||
service: coreServices.actionsRegistry,
|
||||
service: actionsRegistryServiceRef,
|
||||
deps: {
|
||||
metadata: coreServices.pluginMetadata,
|
||||
httpRouter: coreServices.httpRouter,
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2025 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 { actionsRegistryServiceFactory } from './entrypoints/actionsRegistry';
|
||||
export { actionsServiceFactory } from './entrypoints/actions';
|
||||
Reference in New Issue
Block a user