Merge pull request #24544 from backstage/camilaibs/nbs10-extract-common-test-utilities

[NBS 1.0] Extract common `test-utilities` to the plugin api package
This commit is contained in:
Patrik Oldsberg
2024-05-14 10:59:14 +02:00
committed by GitHub
54 changed files with 323 additions and 167 deletions
+24
View File
@@ -0,0 +1,24 @@
---
'@backstage/plugin-catalog-backend-module-incremental-ingestion': patch
'@backstage/plugin-scaffolder-backend-module-cookiecutter': patch
'@backstage/backend-dynamic-feature-service': patch
'@backstage/plugin-scaffolder-backend-module-github': patch
'@backstage/plugin-scaffolder-backend-module-gitlab': patch
'@backstage/plugin-search-backend-module-pg': patch
'@backstage/plugin-notifications-backend': patch
'@backstage/plugin-user-settings-backend': patch
'@backstage/backend-plugin-api': patch
'@backstage/backend-test-utils': patch
'@backstage/plugin-scaffolder-backend': patch
'@backstage/backend-app-api': patch
'@backstage/backend-common': patch
'@backstage/plugin-catalog-backend': patch
'@backstage/plugin-scaffolder-node': patch
'@backstage/backend-tasks': patch
'@backstage/plugin-techdocs-node': patch
'@backstage/plugin-auth-backend': patch
'@backstage/repo-tools': patch
'@backstage/plugin-app-backend': patch
---
Move path utilities from `backend-common` to the `backend-plugin-api` package.
@@ -14,11 +14,14 @@
* limitations under the License.
*/
import { DatabaseService, LoggerService } from '@backstage/backend-plugin-api';
import {
DatabaseService,
LoggerService,
resolvePackagePath,
} from '@backstage/backend-plugin-api';
import { DateTime } from 'luxon';
import { Knex } from 'knex';
import { JsonObject } from '@backstage/types';
import { resolvePackagePath } from '@backstage/backend-common';
import { KeyStore } from './types';
const MIGRATIONS_TABLE = 'backstage_backend_public_keys__knex_migrations';
+11 -16
View File
@@ -3,24 +3,19 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
// @public
export function overridePackagePathResolution(
options: OverridePackagePathResolutionOptions,
): PackagePathResolutionOverride;
import { overridePackagePathResolution as overridePackagePathResolution_2 } from '@backstage/backend-plugin-api/testUtils';
import { OverridePackagePathResolutionOptions as OverridePackagePathResolutionOptions_2 } from '@backstage/backend-plugin-api/testUtils';
import { PackagePathResolutionOverride as PackagePathResolutionOverride_2 } from '@backstage/backend-plugin-api/testUtils';
// @public (undocumented)
export interface OverridePackagePathResolutionOptions {
packageName: string;
path?: string;
paths?: {
[path in string]: string | (() => string);
};
}
// @public @deprecated (undocumented)
export const overridePackagePathResolution: typeof overridePackagePathResolution_2;
// @public (undocumented)
export interface PackagePathResolutionOverride {
restore(): void;
}
// @public @deprecated (undocumented)
export type OverridePackagePathResolutionOptions =
OverridePackagePathResolutionOptions_2;
// @public @deprecated (undocumented)
export type PackagePathResolutionOverride = PackagePathResolutionOverride_2;
// (No @packageDocumentation comment for this package)
```
+9 -6
View File
@@ -34,7 +34,7 @@ import { HarnessIntegration } from '@backstage/integration';
import { HostDiscovery as HostDiscovery_2 } from '@backstage/backend-app-api';
import { HttpAuthService } from '@backstage/backend-plugin-api';
import { IdentityService } from '@backstage/backend-plugin-api';
import { isChildPath } from '@backstage/cli-common';
import { isChildPath as isChildPath_2 } from '@backstage/backend-plugin-api';
import { KubeConfig } from '@kubernetes/client-node';
import { LifecycleService } from '@backstage/backend-plugin-api';
import { LoadConfigOptionsRemote } from '@backstage/config-loader';
@@ -55,6 +55,8 @@ import { ReadTreeResponseFile } from '@backstage/backend-plugin-api';
import { ReadUrlOptions } from '@backstage/backend-plugin-api';
import { ReadUrlResponse } from '@backstage/backend-plugin-api';
import { RequestHandler } from 'express';
import { resolvePackagePath as resolvePackagePath_2 } from '@backstage/backend-plugin-api';
import { resolveSafeChildPath as resolveSafeChildPath_2 } from '@backstage/backend-plugin-api';
import { RootConfigService } from '@backstage/backend-plugin-api';
import { Router } from 'express';
import { SchedulerService } from '@backstage/backend-plugin-api';
@@ -533,7 +535,8 @@ export class HarnessUrlReader implements UrlReader {
// @public
export const HostDiscovery: typeof HostDiscovery_2;
export { isChildPath };
// @public @deprecated (undocumented)
export const isChildPath: typeof isChildPath_2;
// @public
export function isDatabaseConflictError(e: unknown): boolean;
@@ -738,11 +741,11 @@ export type RequestLoggingHandlerFactory = (
logger?: LoggerService,
) => RequestHandler;
// @public
export function resolvePackagePath(name: string, ...paths: string[]): string;
// @public @deprecated (undocumented)
export const resolvePackagePath: typeof resolvePackagePath_2;
// @public
export function resolveSafeChildPath(base: string, path: string): string;
// @public @deprecated (undocumented)
export const resolveSafeChildPath: typeof resolveSafeChildPath_2;
// @public
export type RunContainerOptions = {
+42
View File
@@ -0,0 +1,42 @@
/*
* Copyright 2024 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.
*/
import {
resolvePackagePath as _resolvePackagePath,
resolveSafeChildPath as _resolveSafeChildPath,
isChildPath as _isChildPath,
} from '@backstage/backend-plugin-api';
/**
* @public
* @deprecated This type is deprecated and will be removed in a future release, see https://github.com/backstage/backstage/issues/24493.
* Please use the `resolvePackagePath` function from the `@backstage/backend-plugin-api` package instead.
*/
export const resolvePackagePath = _resolvePackagePath;
/**
* @public
* @deprecated This type is deprecated and will be removed in a future release, see
* Please use the `resolveSafeChildPath` function from the `@backstage/backend-plugin-api` package instead.
*/
export const resolveSafeChildPath = _resolveSafeChildPath;
/**
* @public
* @deprecated This type is deprecated and will be removed in a future release, see
* Please use the `isChildPath` function from the `@backstage/cli-common` package instead.
*/
export const isChildPath = _isChildPath;
+1 -1
View File
@@ -27,12 +27,12 @@ export type { StaticAuthOptions, AuthCallbackOptions } from './deprecated';
export * from './auth';
export * from './cache';
export { loadBackendConfig } from './config';
export * from './deprecated';
export * from './database';
export * from './discovery';
export * from './hot';
export * from './logging';
export * from './middleware';
export * from './paths';
export * from './reading';
export * from './service';
export * from './tokens';
@@ -25,7 +25,7 @@ import {
ReadTreeResponseFile,
} from '../types';
import { streamToBuffer } from './util';
import { resolveSafeChildPath } from '../../paths';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
/**
* Wraps a zip archive stream into a tree response reader.
+22 -58
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2023 The Backstage Authors
* Copyright 2024 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.
@@ -14,66 +14,30 @@
* limitations under the License.
*/
import { packagePathMocks } from './paths';
import { posix as posixPath, resolve as resolvePath } from 'path';
/** @public */
export interface PackagePathResolutionOverride {
/** Restores the normal behavior of resolvePackagePath */
restore(): void;
}
/** @public */
export interface OverridePackagePathResolutionOptions {
/** The name of the package to mock the resolved path of */
packageName: string;
/** A replacement for the root package path */
path?: string;
/**
* Replacements for package sub-paths, each key must be an exact match of the posix-style path
* that is being resolved within the package.
*
* For example, code calling `resolvePackagePath('x', 'foo', 'bar')` would match only the following
* configuration: `overridePackagePathResolution({ packageName: 'x', paths: { 'foo/bar': baz } })`
*/
paths?: { [path in string]: string | (() => string) };
}
import {
overridePackagePathResolution as _overridePackagePathResolution,
OverridePackagePathResolutionOptions as _OverridePackagePathResolutionOptions,
PackagePathResolutionOverride as _PackagePathResolutionOverride,
} from '@backstage/backend-plugin-api/testUtils';
/**
* This utility helps you override the paths returned by `resolvePackagePath` for a given package.
*
* @public
* @deprecated This function is deprecated and will be removed in future release, see https://github.com/backstage/backstage/issues/24493.
* Please use the `overridePackagePathResolution` function from the `@backstage/backend-plugin-api/testUtils` package instead.
*/
export function overridePackagePathResolution(
options: OverridePackagePathResolutionOptions,
): PackagePathResolutionOverride {
const name = options.packageName;
export const overridePackagePathResolution = _overridePackagePathResolution;
if (packagePathMocks.has(name)) {
throw new Error(
`Tried to override resolution for '${name}' more than once for package '${name}'`,
);
}
/**
* @public
* @deprecated This type is deprecated and will be removed in a future release, see https://github.com/backstage/backstage/issues/24493.
* Please use the `OverridePackagePathResolutionOptions` type from the `@backstage/backend-plugin-api/testUtils` package instead.
*/
export type OverridePackagePathResolutionOptions =
_OverridePackagePathResolutionOptions;
packagePathMocks.set(name, paths => {
const joinedPath = posixPath.join(...paths);
const localResolver = options.paths?.[joinedPath];
if (localResolver) {
return typeof localResolver === 'function'
? localResolver()
: localResolver;
}
if (options.path) {
return resolvePath(options.path, ...paths);
}
return undefined;
});
return {
restore() {
packagePathMocks.delete(name);
},
};
}
/**
* @public
* @deprecated This type is deprecated and will be removed in a future release, see https://github.com/backstage/backstage/issues/24493.
* Please use the `PackagePathResolutionOverride` type from the `@backstage/backend-plugin-api/testUtils` package instead.
*/
export type PackagePathResolutionOverride = _PackagePathResolutionOverride;
@@ -17,13 +17,13 @@
import {
coreServices,
createBackendModule,
resolvePackagePath,
} from '@backstage/backend-plugin-api';
import { dynamicPluginsSchemasServiceRef } from './schemas';
import {
configSchemaExtensionPoint,
loadCompiledConfigSchema,
} from '@backstage/plugin-app-node';
import { resolvePackagePath } from '@backstage/backend-common';
/** @public */
export const dynamicPluginsFrontendSchemas = createBackendModule({
@@ -0,0 +1,26 @@
## API Report File for "@backstage/backend-plugin-api"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
// @public
export function overridePackagePathResolution(
options: OverridePackagePathResolutionOptions,
): PackagePathResolutionOverride;
// @public (undocumented)
export interface OverridePackagePathResolutionOptions {
packageName: string;
path?: string;
paths?: {
[path in string]: string | (() => string);
};
}
// @public (undocumented)
export interface PackagePathResolutionOverride {
restore(): void;
}
// (No @packageDocumentation comment for this package)
```
@@ -10,6 +10,7 @@ import { AuthorizePermissionResponse } from '@backstage/plugin-permission-common
import { Config } from '@backstage/config';
import { Handler } from 'express';
import { IdentityApi } from '@backstage/plugin-auth-node';
import { isChildPath } from '@backstage/cli-common';
import { JsonObject } from '@backstage/types';
import { JsonValue } from '@backstage/types';
import { Knex } from 'knex';
@@ -351,6 +352,8 @@ export interface HttpRouterServiceAuthPolicy {
// @public (undocumented)
export interface IdentityService extends IdentityApi {}
export { isChildPath };
// @public (undocumented)
export interface LifecycleService {
addShutdownHook(
@@ -496,6 +499,12 @@ export type ReadUrlResponse = {
lastModifiedAt?: Date;
};
// @public
export function resolvePackagePath(name: string, ...paths: string[]): string;
// @public
export function resolveSafeChildPath(base: string, path: string): string;
// @public (undocumented)
export interface RootConfigService extends Config {}
+7
View File
@@ -21,6 +21,7 @@
"exports": {
".": "./src/index.ts",
"./alpha": "./src/alpha.ts",
"./testUtils": "./src/testUtils.ts",
"./package.json": "./package.json"
},
"main": "src/index.ts",
@@ -30,6 +31,9 @@
"alpha": [
"src/alpha.ts"
],
"testUtils": [
"src/testUtils.ts"
],
"package.json": [
"package.json"
]
@@ -49,7 +53,9 @@
},
"dependencies": {
"@backstage/backend-tasks": "workspace:^",
"@backstage/cli-common": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/plugin-auth-node": "workspace:^",
"@backstage/plugin-permission-common": "workspace:^",
"@backstage/types": "workspace:^",
@@ -58,6 +64,7 @@
"knex": "^3.0.0"
},
"devDependencies": {
"@backstage/backend-test-utils": "workspace:^",
"@backstage/cli": "workspace:^"
}
}
+1
View File
@@ -22,4 +22,5 @@
export * from './services';
export type { BackendFeature } from './types';
export * from './paths';
export * from './wiring';
@@ -0,0 +1,79 @@
/*
* 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.
*/
import { packagePathMocks } from './paths';
import { posix as posixPath, resolve as resolvePath } from 'path';
/** @public */
export interface PackagePathResolutionOverride {
/** Restores the normal behavior of resolvePackagePath */
restore(): void;
}
/** @public */
export interface OverridePackagePathResolutionOptions {
/** The name of the package to mock the resolved path of */
packageName: string;
/** A replacement for the root package path */
path?: string;
/**
* Replacements for package sub-paths, each key must be an exact match of the posix-style path
* that is being resolved within the package.
*
* For example, code calling `resolvePackagePath('x', 'foo', 'bar')` would match only the following
* configuration: `overridePackagePathResolution({ packageName: 'x', paths: { 'foo/bar': baz } })`
*/
paths?: { [path in string]: string | (() => string) };
}
/**
* This utility helps you override the paths returned by `resolvePackagePath` for a given package.
*
* @public
*/
export function overridePackagePathResolution(
options: OverridePackagePathResolutionOptions,
): PackagePathResolutionOverride {
const name = options.packageName;
if (packagePathMocks.has(name)) {
throw new Error(
`Tried to override resolution for '${name}' more than once for package '${name}'`,
);
}
packagePathMocks.set(name, paths => {
const joinedPath = posixPath.join(...paths);
const localResolver = options.paths?.[joinedPath];
if (localResolver) {
return typeof localResolver === 'function'
? localResolver()
: localResolver;
}
if (options.path) {
return resolvePath(options.path, ...paths);
}
return undefined;
});
return {
restore() {
packagePathMocks.delete(name);
},
};
}
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { resolvePackagePath } from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
import { Knex } from 'knex';
import { DB_MIGRATIONS_TABLE } from './tables';
@@ -15,7 +15,7 @@
*/
import os from 'os';
import { isChildPath } from '@backstage/backend-common';
import { isChildPath } from '@backstage/backend-plugin-api';
import fs from 'fs-extra';
import textextensions from 'textextensions';
import {
+22 -22
View File
@@ -8,31 +8,42 @@
"backstage": {
"role": "cli"
},
"keywords": [
"backstage"
],
"homepage": "https://backstage.io",
"repository": {
"type": "git",
"url": "https://github.com/backstage/backstage",
"directory": "packages/repo-tools"
},
"keywords": [
"backstage"
],
"license": "Apache-2.0",
"main": "dist/index.cjs.js",
"scripts": {
"build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"clean": "backstage-cli package clean",
"start": "nodemon --"
},
"bin": {
"backstage-repo-tools": "bin/backstage-repo-tools"
},
"files": [
"bin",
"dist/**/*.js",
"templates",
"openapitools.json"
],
"scripts": {
"build": "backstage-cli package build",
"clean": "backstage-cli package clean",
"lint": "backstage-cli package lint",
"start": "nodemon --",
"test": "backstage-cli package test"
},
"nodemonConfig": {
"exec": "bin/backstage-repo-tools",
"ext": "ts",
"watch": "./src"
},
"dependencies": {
"@apidevtools/swagger-parser": "^10.1.0",
"@apisyouwonthate/style-guide": "^1.4.0",
"@backstage/backend-common": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/catalog-model": "workspace:^",
"@backstage/cli-common": "workspace:^",
"@backstage/cli-node": "workspace:^",
@@ -84,16 +95,5 @@
"prettier": {
"optional": true
}
},
"files": [
"bin",
"dist/**/*.js",
"templates",
"openapitools.json"
],
"nodemonConfig": {
"watch": "./src",
"exec": "bin/backstage-repo-tools",
"ext": "ts"
}
}
@@ -24,7 +24,7 @@ import { paths as cliPaths } from '../../../../../lib/paths';
import { mkdirpSync } from 'fs-extra';
import fs from 'fs-extra';
import { exec } from '../../../../../lib/exec';
import { resolvePackagePath } from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
import { getPathToCurrentOpenApiSpec } from '../../../../../lib/openapi/helpers';
async function generate(outputDirectory: string) {
@@ -14,15 +14,15 @@
* limitations under the License.
*/
import {
PluginDatabaseManager,
resolvePackagePath,
} from '@backstage/backend-common';
import { PluginDatabaseManager } from '@backstage/backend-common';
import { Knex } from 'knex';
import { DateTime } from 'luxon';
import partition from 'lodash/partition';
import { StaticAsset, StaticAssetInput, StaticAssetProvider } from './types';
import { LoggerService } from '@backstage/backend-plugin-api';
import {
LoggerService,
resolvePackagePath,
} from '@backstage/backend-plugin-api';
const migrationsDir = resolvePackagePath(
'@backstage/plugin-app-backend',
@@ -17,7 +17,7 @@
import fs from 'fs-extra';
import globby from 'globby';
import { StaticAssetInput } from './types';
import { resolveSafeChildPath } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
/**
* Finds all static assets within a directory
@@ -22,7 +22,7 @@ import {
} from '@backstage/backend-test-utils';
import { appPlugin } from './appPlugin';
import { createRootLogger } from '@backstage/backend-common';
import { overridePackagePathResolution } from '@backstage/backend-common/testUtils';
import { overridePackagePathResolution } from '@backstage/backend-plugin-api/testUtils';
const mockDir = createMockDirectory();
overridePackagePathResolution({
+1 -1
View File
@@ -17,8 +17,8 @@
import {
notFoundHandler,
PluginDatabaseManager,
resolvePackagePath,
} from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
import { AppConfig, Config } from '@backstage/config';
import helmet from 'helmet';
import express from 'express';
@@ -17,8 +17,8 @@
import {
DatabaseManager,
PluginDatabaseManager,
resolvePackagePath,
} from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
import { ConfigReader } from '@backstage/config';
import { Knex } from 'knex';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { resolvePackagePath } from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
import { Knex } from 'knex';
import { DB_MIGRATIONS_TABLE } from './tables';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { resolvePackagePath } from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
import { Knex } from 'knex';
export async function applyDatabaseMigrations(knex: Knex): Promise<void> {
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
PluginDatabaseManager,
resolvePackagePath,
} from '@backstage/backend-common';
import { PluginDatabaseManager } from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
import {
NotificationGetOptions,
NotificationModifyOptions,
@@ -14,11 +14,8 @@
* limitations under the License.
*/
import {
ContainerRunner,
UrlReader,
resolveSafeChildPath,
} from '@backstage/backend-common';
import { ContainerRunner, UrlReader } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import { JsonObject, JsonValue } from '@backstage/types';
import { InputError } from '@backstage/errors';
import { ScmIntegrations } from '@backstage/integration';
@@ -27,11 +27,13 @@ import {
} from '@backstage/plugin-scaffolder-node';
import { Octokit } from 'octokit';
import { CustomErrorBase, InputError } from '@backstage/errors';
import { resolveSafeChildPath } from '@backstage/backend-common';
import { createPullRequest } from 'octokit-plugin-create-pull-request';
import { getOctokitOptions } from './helpers';
import { examples } from './githubPullRequest.examples';
import { LoggerService } from '@backstage/backend-plugin-api';
import {
LoggerService,
resolveSafeChildPath,
} from '@backstage/backend-plugin-api';
import { Config } from '@backstage/config';
export type Encoding = 'utf-8' | 'base64';
@@ -23,7 +23,7 @@ import { Types } from '@gitbeaker/core';
import path from 'path';
import { ScmIntegrationRegistry } from '@backstage/integration';
import { InputError } from '@backstage/errors';
import { resolveSafeChildPath } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import { createGitlabApi } from './helpers';
import { examples } from './gitlabMergeRequest.examples';
@@ -23,7 +23,7 @@ import { Types } from '@gitbeaker/core';
import path from 'path';
import { ScmIntegrationRegistry } from '@backstage/integration';
import { InputError } from '@backstage/errors';
import { resolveSafeChildPath } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import { createGitlabApi } from './helpers';
import { examples } from './gitlabRepoPush.examples';
@@ -15,7 +15,7 @@
*/
import { Isolate } from 'isolated-vm';
import { resolvePackagePath } from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
import {
TemplateFilter as _TemplateFilter,
TemplateGlobal as _TemplateGlobal,
@@ -17,7 +17,7 @@
import fs from 'fs-extra';
import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
import * as yaml from 'yaml';
import { resolveSafeChildPath } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import { z } from 'zod';
import { examples } from './write.examples';
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { UrlReader, resolveSafeChildPath } from '@backstage/backend-common';
import { UrlReader } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import { ScmIntegrations } from '@backstage/integration';
import { examples } from './plain.examples';
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { UrlReader, resolveSafeChildPath } from '@backstage/backend-common';
import { UrlReader } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import { ScmIntegrations } from '@backstage/integration';
import { examples } from './plainFile.examples';
import {
@@ -16,7 +16,8 @@
import { join as joinPath, sep as pathSep } from 'path';
import fs from 'fs-extra';
import { resolvePackagePath, UrlReader } from '@backstage/backend-common';
import { UrlReader } from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
import { ScmIntegrations } from '@backstage/integration';
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
import { createFetchTemplateAction } from './template';
@@ -21,7 +21,8 @@ jest.mock('@backstage/plugin-scaffolder-node', () => {
import { join as joinPath, sep as pathSep } from 'path';
import fs from 'fs-extra';
import { resolvePackagePath, UrlReader } from '@backstage/backend-common';
import { UrlReader } from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
import { ScmIntegrations } from '@backstage/integration';
import { createFetchTemplateAction } from './template';
import {
@@ -15,7 +15,8 @@
*/
import { extname } from 'path';
import { resolveSafeChildPath, UrlReader } from '@backstage/backend-common';
import { UrlReader } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import { InputError } from '@backstage/errors';
import { ScmIntegrations } from '@backstage/integration';
import {
@@ -16,7 +16,7 @@
import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
import { InputError } from '@backstage/errors';
import { resolveSafeChildPath } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import fs from 'fs-extra';
import { examples } from './delete.examples';
@@ -15,7 +15,7 @@
*/
import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
import { resolveSafeChildPath } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import { InputError } from '@backstage/errors';
import fs from 'fs-extra';
import { examples } from './rename.examples';
@@ -33,9 +33,11 @@ import { TemplateActionRegistry } from '../actions';
import { NunjucksWorkflowRunner } from '../tasks/NunjucksWorkflowRunner';
import { DecoratedActionsRegistry } from './DecoratedActionsRegistry';
import fs from 'fs-extra';
import { resolveSafeChildPath } from '@backstage/backend-common';
import { PermissionEvaluator } from '@backstage/plugin-permission-common';
import { BackstageCredentials } from '@backstage/backend-plugin-api';
import {
BackstageCredentials,
resolveSafeChildPath,
} from '@backstage/backend-plugin-api';
interface DryRunInput {
spec: TaskSpec;
@@ -15,10 +15,8 @@
*/
import { JsonObject } from '@backstage/types';
import {
PluginDatabaseManager,
resolvePackagePath,
} from '@backstage/backend-common';
import { PluginDatabaseManager } from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
import { ConflictError, NotFoundError } from '@backstage/errors';
import { Knex } from 'knex';
import { v4 as uuid } from 'uuid';
+2 -1
View File
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { resolveSafeChildPath, UrlReader } from '@backstage/backend-common';
import { UrlReader } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import { InputError } from '@backstage/errors';
import { ScmIntegrations } from '@backstage/integration';
import fs from 'fs-extra';
+1 -1
View File
@@ -15,7 +15,7 @@
*/
import { InputError } from '@backstage/errors';
import { isChildPath } from '@backstage/backend-common';
import { isChildPath } from '@backstage/backend-plugin-api';
import { join as joinPath, normalize as normalizePath } from 'path';
import { ScmIntegrationRegistry } from '@backstage/integration';
@@ -16,7 +16,7 @@
import fs from 'fs-extra';
import { dirname } from 'path';
import { resolveSafeChildPath } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import { SerializedFile } from './types';
/**
@@ -17,7 +17,7 @@
import { promises as fs } from 'fs';
import globby from 'globby';
import limiterFactory from 'p-limit';
import { resolveSafeChildPath } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import { SerializedFile } from './types';
import { isError } from '@backstage/errors';
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
PluginDatabaseManager,
resolvePackagePath,
} from '@backstage/backend-common';
import { PluginDatabaseManager } from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
import { IndexableDocument } from '@backstage/plugin-search-common';
import { Knex } from 'knex';
import {
+2 -1
View File
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { resolveSafeChildPath, UrlReader } from '@backstage/backend-common';
import { UrlReader } from '@backstage/backend-common';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import {
Entity,
getEntitySourceLocation,
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { isChildPath } from '@backstage/backend-common';
import { isChildPath } from '@backstage/backend-plugin-api';
import { Entity } from '@backstage/catalog-model';
import { assertError, ForwardedError } from '@backstage/errors';
import { ScmIntegrationRegistry } from '@backstage/integration';
@@ -17,7 +17,7 @@ import {
getVoidLogger,
PluginEndpointDiscovery,
} from '@backstage/backend-common';
import { overridePackagePathResolution } from '@backstage/backend-common/testUtils';
import { overridePackagePathResolution } from '@backstage/backend-plugin-api/testUtils';
import { ConfigReader } from '@backstage/config';
import express from 'express';
import request from 'supertest';
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import {
PluginEndpointDiscovery,
resolvePackagePath,
resolveSafeChildPath,
} from '@backstage/backend-common';
} from '@backstage/backend-plugin-api';
import {
Entity,
CompoundEntityRef,
@@ -14,10 +14,8 @@
* limitations under the License.
*/
import {
PluginDatabaseManager,
resolvePackagePath,
} from '@backstage/backend-common';
import { PluginDatabaseManager } from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
import { NotFoundError } from '@backstage/errors';
import { JsonValue } from '@backstage/types';
import { Knex } from 'knex';
+4 -1
View File
@@ -3506,8 +3506,11 @@ __metadata:
resolution: "@backstage/backend-plugin-api@workspace:packages/backend-plugin-api"
dependencies:
"@backstage/backend-tasks": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/cli-common": "workspace:^"
"@backstage/config": "workspace:^"
"@backstage/errors": "workspace:^"
"@backstage/plugin-auth-node": "workspace:^"
"@backstage/plugin-permission-common": "workspace:^"
"@backstage/types": "workspace:^"
@@ -7670,7 +7673,7 @@ __metadata:
dependencies:
"@apidevtools/swagger-parser": ^10.1.0
"@apisyouwonthate/style-guide": ^1.4.0
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
"@backstage/catalog-model": "workspace:^"
"@backstage/cli": "workspace:^"