Merge pull request #9952 from backstage/iameap/mv-techdocs-search-common
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-search-common': patch
|
||||
---
|
||||
|
||||
Renamed `@backstage/search-common` to `@backstage/plugin-search-common`.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@backstage/search-common': patch
|
||||
---
|
||||
|
||||
**DEPRECATION**
|
||||
|
||||
The `@backstage/search-common` package is being renamed `@backstage/plugin-search-common`. We may continue to publish changes to `@backstage/search-common` for a time, but will stop doing so in the near future. If you depend on this package, you should update your dependencies to point at the renamed package.
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
'@backstage/plugin-catalog': patch
|
||||
'@backstage/plugin-search-backend-module-elasticsearch': patch
|
||||
'@backstage/plugin-search-backend-module-pg': patch
|
||||
'@backstage/plugin-search-backend-node': patch
|
||||
'@backstage/plugin-search-backend': patch
|
||||
'@backstage/plugin-search': patch
|
||||
'@backstage/plugin-techdocs-backend': patch
|
||||
'@backstage/plugin-techdocs-node': patch
|
||||
---
|
||||
|
||||
Use `@backstage/plugin-search-common` package instead of `@backstage/search-common`.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-techdocs-node': patch
|
||||
---
|
||||
|
||||
Renamed `@backstage/techdocs-common` to `@backstage/plugin-techdocs-node`.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@backstage/techdocs-common': patch
|
||||
---
|
||||
|
||||
**DEPRECATION**
|
||||
|
||||
The `@backstage/techdocs-common` package is being renamed `@backstage/plugin-techdocs-node`. We may continue to publish changes to `@backstage/techdocs-common` for a time, but will stop doing so in the near future. If you depend on this package, you should update your dependencies to point at the renamed package.
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-techdocs-backend': patch
|
||||
'@techdocs/cli': patch
|
||||
---
|
||||
|
||||
Use `@backstage/plugin-techdocs-node` package instead of `@backstage/techdocs-common`.
|
||||
+1
-1
@@ -46,7 +46,7 @@
|
||||
/plugins/search-* @backstage/reviewers @backstage/techdocs-core
|
||||
/plugins/sonarqube @backstage/reviewers @backstage/sda-se-reviewers
|
||||
/plugins/techdocs @backstage/reviewers @backstage/techdocs-core
|
||||
/plugins/techdocs-backend @backstage/reviewers @backstage/techdocs-core
|
||||
/plugins/techdocs-* @backstage/reviewers @backstage/techdocs-core
|
||||
/tech-insights-backend @backstage/reviewers @xantier @iain-b
|
||||
/tech-insights-backend-module-jsonfc @backstage/reviewers @xantier @iain-b
|
||||
/tech-insights-tech-insights-common @backstage/reviewers @xantier @iain-b
|
||||
|
||||
@@ -128,7 +128,7 @@ plugins integrated to search.
|
||||
| Frontend Plugin | @backstage/plugin-search |
|
||||
| Backend Plugin | @backstage/plugin-search-backend |
|
||||
| Indexer Plugin | @backstage/plugin-search-backend-node |
|
||||
| Common Code | @backstage/search-common |
|
||||
| Common Code | @backstage/plugin-search-common |
|
||||
|
||||
## Get Involved
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ implement the factory method that instantiates the stream:
|
||||
|
||||
```ts
|
||||
import { BatchSearchEngineIndexer } from '@backstage/plugin-search-backend-node';
|
||||
import { SearchEngine } from '@backstage/search-common';
|
||||
import { SearchEngine } from '@backstage/plugin-search-common';
|
||||
export class YourSearchEngineIndexer extends BatchSearchEngineIndexer {
|
||||
constructor({ type }: { type: string }) {
|
||||
// Customize the number of documents passed to the index method per batch.
|
||||
|
||||
@@ -97,7 +97,7 @@ techdocs-cli generate
|
||||
Alias: `techdocs-cli build`
|
||||
|
||||
The generate command uses the
|
||||
[`@backstage/techdocs-common`](https://github.com/backstage/backstage/tree/master/packages/techdocs-common)
|
||||
[`@backstage/plugin-techdocs-node`](https://github.com/backstage/backstage/tree/master/plugins/techdocs-node)
|
||||
package from Backstage for consistency. A Backstage app can also generate and
|
||||
publish TechDocs sites if `techdocs.builder` is set to `'local'` in
|
||||
`app-config.yaml`. See
|
||||
|
||||
@@ -160,8 +160,8 @@ are separated out into their own folder, see further down.
|
||||
reusable React components. Stories are within the core package, and are
|
||||
published in the [Backstage Storybook](https://backstage.io/storybook).
|
||||
|
||||
- [`techdocs-common/`](https://github.com/backstage/backstage/tree/master/packages/techdocs-common) -
|
||||
Common functionalities for TechDocs, to be shared between
|
||||
- [`techdocs-node/`](https://github.com/backstage/backstage/tree/master/plugins/techdocs-node) -
|
||||
Common node.js functionalities for TechDocs, to be shared between
|
||||
[techdocs-backend](https://github.com/backstage/backstage/tree/master/plugins/techdocs-backend)
|
||||
plugin and [techdocs-cli](https://github.com/backstage/techdocs-cli).
|
||||
|
||||
|
||||
@@ -46,13 +46,13 @@
|
||||
"@backstage/plugin-rollbar": "^0.4.1",
|
||||
"@backstage/plugin-scaffolder": "^0.14.0",
|
||||
"@backstage/plugin-search": "^0.7.2",
|
||||
"@backstage/plugin-search-common": "^0.3.0",
|
||||
"@backstage/plugin-sentry": "^0.3.39",
|
||||
"@backstage/plugin-shortcuts": "^0.2.2",
|
||||
"@backstage/plugin-tech-radar": "^0.5.8",
|
||||
"@backstage/plugin-techdocs": "^0.15.0",
|
||||
"@backstage/plugin-todo": "^0.2.3",
|
||||
"@backstage/plugin-user-settings": "^0.4.0",
|
||||
"@backstage/search-common": "^0.3.0",
|
||||
"@backstage/plugin-tech-insights": "^0.1.11",
|
||||
"@backstage/theme": "^0.2.15",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# @backstage/search-common
|
||||
|
||||
**WARNING**: This package is moving to `@backstage/plugin-search-common`.
|
||||
Please update any dependencies you may have, as this package will no longer be
|
||||
published or updated in the near future.
|
||||
|
||||
Common functionalities for Search, to be shared between various search-enabled plugins.
|
||||
|
||||
@@ -3,87 +3,7 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
/// <reference types="node" />
|
||||
export * from '@backstage/plugin-search-common';
|
||||
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { Permission } from '@backstage/plugin-permission-common';
|
||||
import { Readable } from 'stream';
|
||||
import { Transform } from 'stream';
|
||||
import { Writable } from 'stream';
|
||||
|
||||
// @beta
|
||||
export interface DocumentCollatorFactory {
|
||||
getCollator(): Promise<Readable>;
|
||||
readonly type: string;
|
||||
readonly visibilityPermission?: Permission;
|
||||
}
|
||||
|
||||
// @beta
|
||||
export interface DocumentDecoratorFactory {
|
||||
getDecorator(): Promise<Transform>;
|
||||
readonly types?: string[];
|
||||
}
|
||||
|
||||
// @beta
|
||||
export type DocumentTypeInfo = {
|
||||
visibilityPermission?: Permission;
|
||||
};
|
||||
|
||||
// @beta
|
||||
export interface IndexableDocument {
|
||||
authorization?: {
|
||||
resourceRef: string;
|
||||
};
|
||||
location: string;
|
||||
text: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
// @beta
|
||||
export type QueryRequestOptions = {
|
||||
token?: string;
|
||||
};
|
||||
|
||||
// @beta
|
||||
export type QueryTranslator = (query: SearchQuery) => unknown;
|
||||
|
||||
// @beta
|
||||
export interface SearchEngine {
|
||||
getIndexer(type: string): Promise<Writable>;
|
||||
query(
|
||||
query: SearchQuery,
|
||||
options?: QueryRequestOptions,
|
||||
): Promise<SearchResultSet>;
|
||||
setTranslator(translator: QueryTranslator): void;
|
||||
}
|
||||
|
||||
// @beta (undocumented)
|
||||
export interface SearchQuery {
|
||||
// (undocumented)
|
||||
filters?: JsonObject;
|
||||
// (undocumented)
|
||||
pageCursor?: string;
|
||||
// (undocumented)
|
||||
term: string;
|
||||
// (undocumented)
|
||||
types?: string[];
|
||||
}
|
||||
|
||||
// @beta (undocumented)
|
||||
export interface SearchResult {
|
||||
// (undocumented)
|
||||
document: IndexableDocument;
|
||||
// (undocumented)
|
||||
type: string;
|
||||
}
|
||||
|
||||
// @beta (undocumented)
|
||||
export interface SearchResultSet {
|
||||
// (undocumented)
|
||||
nextPageCursor?: string;
|
||||
// (undocumented)
|
||||
previousPageCursor?: string;
|
||||
// (undocumented)
|
||||
results: SearchResult[];
|
||||
}
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
|
||||
@@ -39,12 +39,9 @@
|
||||
"url": "https://github.com/backstage/backstage/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/types": "^0.1.3",
|
||||
"@backstage/plugin-permission-common": "^0.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^0.15.0"
|
||||
"@backstage/plugin-search-common": "^0.3.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"jest": {
|
||||
"roots": [
|
||||
".."
|
||||
|
||||
@@ -14,10 +14,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Common functionalities for Search, to be shared between various search-enabled plugins
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
export * from './types';
|
||||
export * from '@backstage/plugin-search-common';
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
"@backstage/catalog-model": "^0.12.0",
|
||||
"@backstage/cli-common": "^0.1.8",
|
||||
"@backstage/config": "^0.1.15",
|
||||
"@backstage/techdocs-common": "^0.11.11",
|
||||
"@backstage/plugin-techdocs-node": "^0.11.11",
|
||||
"@types/dockerode": "^3.3.0",
|
||||
"commander": "^6.1.0",
|
||||
"dockerode": "^3.3.1",
|
||||
|
||||
@@ -21,7 +21,7 @@ import Docker from 'dockerode';
|
||||
import {
|
||||
TechdocsGenerator,
|
||||
ParsedLocationAnnotation,
|
||||
} from '@backstage/techdocs-common';
|
||||
} from '@backstage/plugin-techdocs-node';
|
||||
import { DockerContainerRunner } from '@backstage/backend-common';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import {
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
import { stdout } from 'process';
|
||||
|
||||
export default async function generate(cmd: Command) {
|
||||
// Use techdocs-common package to generate docs. Keep consistency between Backstage and CI generating docs.
|
||||
// Use techdocs-node package to generate docs. Keep consistency between Backstage and CI generating docs.
|
||||
// Docs can be prepared using actions/checkout or git clone, or similar paradigms on CI. The TechDocs CI workflow
|
||||
// will run on the CI pipeline containing the documentation files.
|
||||
|
||||
@@ -78,7 +78,7 @@ export default async function generate(cmd: Command) {
|
||||
}
|
||||
}
|
||||
|
||||
// Generate docs using @backstage/techdocs-common
|
||||
// Generate docs using @backstage/plugin-techdocs-node
|
||||
const techdocsGenerator = await TechdocsGenerator.fromConfig(config, {
|
||||
logger,
|
||||
containerRunner,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { CommanderStatic } from 'commander';
|
||||
import { TechdocsGenerator } from '@backstage/techdocs-common';
|
||||
import { TechdocsGenerator } from '@backstage/plugin-techdocs-node';
|
||||
|
||||
const defaultDockerImage = TechdocsGenerator.defaultDockerImage;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { SingleHostDiscovery } from '@backstage/backend-common';
|
||||
import { Publisher } from '@backstage/techdocs-common';
|
||||
import { Publisher } from '@backstage/plugin-techdocs-node';
|
||||
import { Command } from 'commander';
|
||||
import { createLogger } from '../../lib/utility';
|
||||
import { PublisherConfig } from '../../lib/PublisherConfig';
|
||||
|
||||
@@ -18,7 +18,7 @@ import { resolve } from 'path';
|
||||
import { Command } from 'commander';
|
||||
import { createLogger } from '../../lib/utility';
|
||||
import { SingleHostDiscovery } from '@backstage/backend-common';
|
||||
import { Publisher } from '@backstage/techdocs-common';
|
||||
import { Publisher } from '@backstage/plugin-techdocs-node';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { PublisherConfig } from '../../lib/PublisherConfig';
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import {
|
||||
RemoteProtocol,
|
||||
ParsedLocationAnnotation,
|
||||
} from '@backstage/techdocs-common';
|
||||
} from '@backstage/plugin-techdocs-node';
|
||||
import * as winston from 'winston';
|
||||
|
||||
export const convertTechDocsRefToLocationAnnotation = (
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
# @backstage/techdocs-common
|
||||
|
||||
Common functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli
|
||||
**WARNING**: This package is moving to `@backstage/plugin-techdocs-node`.
|
||||
Please update any dependencies you may have, as this package will no longer be
|
||||
published or updated in the near future.
|
||||
|
||||
Common node.js functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli
|
||||
|
||||
This package is used by `techdocs-backend` to serve docs from different types of publishers (Google GCS, Local, etc.).
|
||||
It is also used to build docs and publish them to storage, by both `techdocs-backend` and `techdocs-cli`.
|
||||
|
||||
## Usage
|
||||
|
||||
Create a preparer instance from the [preparers available](/packages/techdocs-common/src/stages/prepare) at which takes an Entity instance.
|
||||
Run the [docs generator](/packages/techdocs-common/src/stages/generate) on the prepared directory.
|
||||
Publish the generated directory files to a [storage](/packages/techdocs-common/src/stages/publish) of your choice.
|
||||
Create a preparer instance from the [preparers available](/plugins/techdocs-node/src/stages/prepare) at which takes an Entity instance.
|
||||
Run the [docs generator](/plugins/techdocs-node/src/stages/generate) on the prepared directory.
|
||||
Publish the generated directory files to a [storage](/plugins/techdocs-node/src/stages/publish) of your choice.
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
@@ -3,256 +3,7 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
/// <reference types="node" />
|
||||
export * from '@backstage/plugin-techdocs-node';
|
||||
|
||||
import { CompoundEntityRef } from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
import { ContainerRunner } from '@backstage/backend-common';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import express from 'express';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { Logger as Logger_2 } from 'winston';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { UrlReader } from '@backstage/backend-common';
|
||||
import { Writable } from 'stream';
|
||||
|
||||
// @public
|
||||
export class DirectoryPreparer implements PreparerBase {
|
||||
// @deprecated
|
||||
constructor(config: Config, _logger: Logger_2 | null, reader: UrlReader);
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
{ logger, reader }: PreparerConfig,
|
||||
): DirectoryPreparer;
|
||||
prepare(entity: Entity, options?: PreparerOptions): Promise<PreparerResponse>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ETag = string;
|
||||
|
||||
// @public
|
||||
export type GeneratorBase = {
|
||||
run(opts: GeneratorRunOptions): Promise<void>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type GeneratorBuilder = {
|
||||
register(protocol: SupportedGeneratorKey, generator: GeneratorBase): void;
|
||||
get(entity: Entity): GeneratorBase;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type GeneratorOptions = {
|
||||
containerRunner: ContainerRunner;
|
||||
logger: Logger_2;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type GeneratorRunOptions = {
|
||||
inputDir: string;
|
||||
outputDir: string;
|
||||
parsedLocationAnnotation?: ParsedLocationAnnotation;
|
||||
etag?: string;
|
||||
logger: Logger_2;
|
||||
logStream?: Writable;
|
||||
};
|
||||
|
||||
// @public
|
||||
export class Generators implements GeneratorBuilder {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger_2;
|
||||
containerRunner: ContainerRunner;
|
||||
},
|
||||
): Promise<GeneratorBuilder>;
|
||||
get(entity: Entity): GeneratorBase;
|
||||
register(generatorKey: SupportedGeneratorKey, generator: GeneratorBase): void;
|
||||
}
|
||||
|
||||
// @public
|
||||
export const getDocFilesFromRepository: (
|
||||
reader: UrlReader,
|
||||
entity: Entity,
|
||||
opts?:
|
||||
| {
|
||||
etag?: string | undefined;
|
||||
logger?: Logger_2 | undefined;
|
||||
}
|
||||
| undefined,
|
||||
) => Promise<PreparerResponse>;
|
||||
|
||||
// @public
|
||||
export const getLocationForEntity: (
|
||||
entity: Entity,
|
||||
scmIntegration: ScmIntegrationRegistry,
|
||||
) => ParsedLocationAnnotation;
|
||||
|
||||
// @public
|
||||
export type MigrateRequest = {
|
||||
removeOriginal?: boolean;
|
||||
concurrency?: number;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type ParsedLocationAnnotation = {
|
||||
type: RemoteProtocol;
|
||||
target: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export const parseReferenceAnnotation: (
|
||||
annotationName: string,
|
||||
entity: Entity,
|
||||
) => ParsedLocationAnnotation;
|
||||
|
||||
// @public
|
||||
export type PreparerBase = {
|
||||
prepare(entity: Entity, options?: PreparerOptions): Promise<PreparerResponse>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type PreparerBuilder = {
|
||||
register(protocol: RemoteProtocol, preparer: PreparerBase): void;
|
||||
get(entity: Entity): PreparerBase;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type PreparerConfig = {
|
||||
logger: Logger_2;
|
||||
reader: UrlReader;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type PreparerOptions = {
|
||||
logger?: Logger_2;
|
||||
etag?: ETag;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type PreparerResponse = {
|
||||
preparedDir: string;
|
||||
etag: ETag;
|
||||
};
|
||||
|
||||
// @public
|
||||
export class Preparers implements PreparerBuilder {
|
||||
static fromConfig(
|
||||
backstageConfig: Config,
|
||||
{ logger, reader }: PreparerConfig,
|
||||
): Promise<PreparerBuilder>;
|
||||
get(entity: Entity): PreparerBase;
|
||||
register(protocol: RemoteProtocol, preparer: PreparerBase): void;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class Publisher {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
{ logger, discovery }: PublisherFactory,
|
||||
): Promise<PublisherBase>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface PublisherBase {
|
||||
docsRouter(): express.Handler;
|
||||
fetchTechDocsMetadata(
|
||||
entityName: CompoundEntityRef,
|
||||
): Promise<TechDocsMetadata>;
|
||||
getReadiness(): Promise<ReadinessResponse>;
|
||||
hasDocsBeenGenerated(entityName: Entity): Promise<boolean>;
|
||||
migrateDocsCase?(migrateRequest: MigrateRequest): Promise<void>;
|
||||
publish(request: PublishRequest): Promise<PublishResponse>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type PublisherFactory = {
|
||||
logger: Logger_2;
|
||||
discovery: PluginEndpointDiscovery;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type PublisherType =
|
||||
| 'local'
|
||||
| 'googleGcs'
|
||||
| 'awsS3'
|
||||
| 'azureBlobStorage'
|
||||
| 'openStackSwift';
|
||||
|
||||
// @public
|
||||
export type PublishRequest = {
|
||||
entity: Entity;
|
||||
directory: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type PublishResponse = {
|
||||
remoteUrl?: string;
|
||||
objects?: string[];
|
||||
} | void;
|
||||
|
||||
// @public
|
||||
export type ReadinessResponse = {
|
||||
isAvailable: boolean;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type RemoteProtocol = 'url' | 'dir';
|
||||
|
||||
// @public
|
||||
export type SupportedGeneratorKey = 'techdocs' | string;
|
||||
|
||||
// @public
|
||||
export interface TechDocsDocument extends IndexableDocument {
|
||||
kind: string;
|
||||
lifecycle: string;
|
||||
name: string;
|
||||
namespace: string;
|
||||
owner: string;
|
||||
path: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class TechdocsGenerator implements GeneratorBase {
|
||||
constructor(options: {
|
||||
logger: Logger_2;
|
||||
containerRunner: ContainerRunner;
|
||||
config: Config;
|
||||
scmIntegrations: ScmIntegrationRegistry;
|
||||
});
|
||||
static readonly defaultDockerImage = 'spotify/techdocs:v0.3.7';
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: GeneratorOptions,
|
||||
): TechdocsGenerator;
|
||||
run(options: GeneratorRunOptions): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type TechDocsMetadata = {
|
||||
site_name: string;
|
||||
site_description: string;
|
||||
etag: string;
|
||||
build_timestamp: number;
|
||||
files?: string[];
|
||||
};
|
||||
|
||||
// @public
|
||||
export const transformDirLocation: (
|
||||
entity: Entity,
|
||||
dirAnnotation: ParsedLocationAnnotation,
|
||||
scmIntegrations: ScmIntegrationRegistry,
|
||||
) => {
|
||||
type: 'dir' | 'url';
|
||||
target: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export class UrlPreparer implements PreparerBase {
|
||||
// @deprecated
|
||||
constructor(reader: UrlReader, logger: Logger_2);
|
||||
static fromConfig({ reader, logger }: PreparerConfig): UrlPreparer;
|
||||
prepare(entity: Entity, options?: PreparerOptions): Promise<PreparerResponse>;
|
||||
}
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@backstage/techdocs-common",
|
||||
"description": "Common functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli",
|
||||
"description": "Common node.js functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli",
|
||||
"version": "0.11.11",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
@@ -40,39 +40,9 @@
|
||||
"url": "https://github.com/backstage/backstage/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@azure/identity": "^2.0.1",
|
||||
"@azure/storage-blob": "^12.5.0",
|
||||
"@backstage/backend-common": "^0.12.0",
|
||||
"@backstage/catalog-model": "^0.12.0",
|
||||
"@backstage/config": "^0.1.15",
|
||||
"@backstage/errors": "^0.2.2",
|
||||
"@backstage/search-common": "^0.3.0",
|
||||
"@backstage/integration": "^0.8.0",
|
||||
"@google-cloud/storage": "^5.6.0",
|
||||
"@trendyol-js/openstack-swift-sdk": "^0.0.5",
|
||||
"@types/express": "^4.17.6",
|
||||
"aws-sdk": "^2.840.0",
|
||||
"express": "^4.17.1",
|
||||
"fs-extra": "9.1.0",
|
||||
"git-url-parse": "^11.6.0",
|
||||
"js-yaml": "^4.0.0",
|
||||
"json5": "^2.1.3",
|
||||
"mime-types": "^2.1.27",
|
||||
"mock-fs": "^5.1.0",
|
||||
"p-limit": "^3.1.0",
|
||||
"recursive-readdir": "^2.2.2",
|
||||
"winston": "^3.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^0.15.0",
|
||||
"@types/fs-extra": "^9.0.5",
|
||||
"@types/js-yaml": "^4.0.0",
|
||||
"@types/mime-types": "^2.1.0",
|
||||
"@types/mock-fs": "^4.13.0",
|
||||
"@types/recursive-readdir": "^2.2.0",
|
||||
"@types/supertest": "^2.0.8",
|
||||
"supertest": "^6.1.3"
|
||||
"@backstage/plugin-techdocs-node": "^0.11.11"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"jest": {
|
||||
"roots": [
|
||||
".."
|
||||
|
||||
@@ -14,12 +14,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Common functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
export * from './stages';
|
||||
export * from './helpers';
|
||||
export * from './techdocsTypes';
|
||||
export * from '@backstage/plugin-techdocs-node';
|
||||
|
||||
@@ -12,7 +12,7 @@ import { CompoundEntityRef } from '@backstage/catalog-model';
|
||||
import { ConditionalPolicyDecision } from '@backstage/plugin-permission-node';
|
||||
import { Conditions } from '@backstage/plugin-permission-node';
|
||||
import { Config } from '@backstage/config';
|
||||
import { DocumentCollatorFactory } from '@backstage/search-common';
|
||||
import { DocumentCollatorFactory } from '@backstage/plugin-search-common';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { EntityPolicy } from '@backstage/catalog-model';
|
||||
import express from 'express';
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
"@backstage/plugin-permission-common": "^0.5.2",
|
||||
"@backstage/plugin-permission-node": "^0.5.3",
|
||||
"@backstage/plugin-scaffolder-common": "^0.2.3",
|
||||
"@backstage/search-common": "^0.3.0",
|
||||
"@backstage/plugin-search-common": "^0.3.0",
|
||||
"@backstage/types": "^0.1.3",
|
||||
"@octokit/graphql": "^4.5.8",
|
||||
"@types/express": "^4.17.6",
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
UserEntity,
|
||||
} from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
import { DocumentCollatorFactory } from '@backstage/search-common';
|
||||
import { DocumentCollatorFactory } from '@backstage/plugin-search-common';
|
||||
import {
|
||||
catalogEntityReadPermission,
|
||||
CatalogEntityDocument,
|
||||
|
||||
@@ -11,7 +11,7 @@ import { CompoundEntityRef } from '@backstage/catalog-model';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { ExternalRouteRef } from '@backstage/core-plugin-api';
|
||||
import { IconComponent } from '@backstage/core-plugin-api';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { InfoCardVariants } from '@backstage/core-components';
|
||||
import { Observable } from '@backstage/types';
|
||||
import { Overrides } from '@material-ui/core/styles/overrides';
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"@backstage/integration-react": "^0.1.24",
|
||||
"@backstage/plugin-catalog-common": "^0.2.0",
|
||||
"@backstage/plugin-catalog-react": "^0.8.0",
|
||||
"@backstage/search-common": "^0.3.0",
|
||||
"@backstage/plugin-search-common": "^0.3.0",
|
||||
"@backstage/theme": "^0.2.15",
|
||||
"@backstage/types": "^0.1.2",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ import {
|
||||
makeStyles,
|
||||
} from '@material-ui/core';
|
||||
import { Link } from '@backstage/core-components';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
flexContainer: {
|
||||
|
||||
@@ -9,11 +9,11 @@ import { BatchSearchEngineIndexer } from '@backstage/plugin-search-backend-node'
|
||||
import { Client } from '@elastic/elasticsearch';
|
||||
import { Config } from '@backstage/config';
|
||||
import type { ConnectionOptions } from 'tls';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { Logger as Logger_2 } from 'winston';
|
||||
import { SearchEngine } from '@backstage/search-common';
|
||||
import { SearchQuery } from '@backstage/search-common';
|
||||
import { SearchResultSet } from '@backstage/search-common';
|
||||
import { SearchEngine } from '@backstage/plugin-search-common';
|
||||
import { SearchQuery } from '@backstage/plugin-search-common';
|
||||
import { SearchResultSet } from '@backstage/plugin-search-common';
|
||||
|
||||
// Warning: (ae-missing-release-tag) "ElasticSearchClientOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/plugin-search-backend-module-elasticsearch" does not have an export "ElasticSearchEngine"
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/config": "^0.1.15",
|
||||
"@backstage/search-common": "^0.3.0",
|
||||
"@backstage/plugin-search-backend-node": "^0.5.0",
|
||||
"@backstage/plugin-search-common": "^0.3.0",
|
||||
"@elastic/elasticsearch": "7.13.0",
|
||||
"@acuris/aws-es-connection": "^2.2.0",
|
||||
"aws-sdk": "^2.948.0",
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ import {
|
||||
SearchEngine,
|
||||
SearchQuery,
|
||||
SearchResultSet,
|
||||
} from '@backstage/search-common';
|
||||
} from '@backstage/plugin-search-common';
|
||||
import { Client } from '@elastic/elasticsearch';
|
||||
import esb from 'elastic-builder';
|
||||
import { isEmpty, isNaN as nan, isNumber } from 'lodash';
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { BatchSearchEngineIndexer } from '@backstage/plugin-search-backend-node';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { Client } from '@elastic/elasticsearch';
|
||||
import { Readable } from 'stream';
|
||||
import { Logger } from 'winston';
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
```ts
|
||||
import { BatchSearchEngineIndexer } from '@backstage/plugin-search-backend-node';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { Knex } from 'knex';
|
||||
import { PluginDatabaseManager } from '@backstage/backend-common';
|
||||
import { SearchEngine } from '@backstage/plugin-search-backend-node';
|
||||
import { SearchQuery } from '@backstage/search-common';
|
||||
import { SearchResultSet } from '@backstage/search-common';
|
||||
import { SearchQuery } from '@backstage/plugin-search-common';
|
||||
import { SearchResultSet } from '@backstage/plugin-search-common';
|
||||
|
||||
// Warning: (ae-missing-release-tag) "ConcretePgSearchQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "^0.12.0",
|
||||
"@backstage/search-common": "^0.3.0",
|
||||
"@backstage/plugin-search-backend-node": "^0.5.0",
|
||||
"@backstage/plugin-search-common": "^0.3.0",
|
||||
"lodash": "^4.17.21",
|
||||
"knex": "^1.0.2"
|
||||
},
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
import { PluginDatabaseManager } from '@backstage/backend-common';
|
||||
import { SearchEngine } from '@backstage/plugin-search-backend-node';
|
||||
import { SearchQuery, SearchResultSet } from '@backstage/search-common';
|
||||
import { SearchQuery, SearchResultSet } from '@backstage/plugin-search-common';
|
||||
import { PgSearchEngineIndexer } from './PgSearchEngineIndexer';
|
||||
import {
|
||||
DatabaseDocumentStore,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { BatchSearchEngineIndexer } from '@backstage/plugin-search-backend-node';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { Knex } from 'knex';
|
||||
import { DatabaseStore } from '../database';
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TestDatabaseId, TestDatabases } from '@backstage/backend-test-utils';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { DatabaseDocumentStore } from './DatabaseDocumentStore';
|
||||
|
||||
describe('DatabaseDocumentStore', () => {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { resolvePackagePath } from '@backstage/backend-common';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { Knex } from 'knex';
|
||||
import {
|
||||
DatabaseStore,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { Knex } from 'knex';
|
||||
|
||||
export interface PgSearchQuery {
|
||||
|
||||
@@ -5,17 +5,17 @@
|
||||
```ts
|
||||
/// <reference types="node" />
|
||||
|
||||
import { DocumentCollatorFactory } from '@backstage/search-common';
|
||||
import { DocumentDecoratorFactory } from '@backstage/search-common';
|
||||
import { DocumentTypeInfo } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { DocumentCollatorFactory } from '@backstage/plugin-search-common';
|
||||
import { DocumentDecoratorFactory } from '@backstage/plugin-search-common';
|
||||
import { DocumentTypeInfo } from '@backstage/plugin-search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { Logger as Logger_2 } from 'winston';
|
||||
import { default as lunr_2 } from 'lunr';
|
||||
import { QueryTranslator } from '@backstage/search-common';
|
||||
import { QueryTranslator } from '@backstage/plugin-search-common';
|
||||
import { Readable } from 'stream';
|
||||
import { SearchEngine } from '@backstage/search-common';
|
||||
import { SearchQuery } from '@backstage/search-common';
|
||||
import { SearchResultSet } from '@backstage/search-common';
|
||||
import { SearchEngine } from '@backstage/plugin-search-common';
|
||||
import { SearchQuery } from '@backstage/plugin-search-common';
|
||||
import { SearchResultSet } from '@backstage/plugin-search-common';
|
||||
import { Transform } from 'stream';
|
||||
import { Writable } from 'stream';
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/errors": "^0.2.2",
|
||||
"@backstage/search-common": "^0.3.0",
|
||||
"@backstage/plugin-search-common": "^0.3.0",
|
||||
"@types/lunr": "^2.3.3",
|
||||
"lodash": "^4.17.21",
|
||||
"lunr": "^2.3.9",
|
||||
|
||||
@@ -18,7 +18,7 @@ import { getVoidLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
DocumentCollatorFactory,
|
||||
DocumentDecoratorFactory,
|
||||
} from '@backstage/search-common';
|
||||
} from '@backstage/plugin-search-common';
|
||||
import { Readable, Transform } from 'stream';
|
||||
import { IndexBuilder } from './IndexBuilder';
|
||||
import { LunrSearchEngine, SearchEngine } from './index';
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
DocumentDecoratorFactory,
|
||||
DocumentTypeInfo,
|
||||
SearchEngine,
|
||||
} from '@backstage/search-common';
|
||||
} from '@backstage/plugin-search-common';
|
||||
import { Transform, pipeline } from 'stream';
|
||||
import { Logger } from 'winston';
|
||||
import { Scheduler } from './index';
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
|
||||
import { getVoidLogger } from '@backstage/backend-common';
|
||||
import lunr from 'lunr';
|
||||
import { IndexableDocument, SearchEngine } from '@backstage/search-common';
|
||||
import {
|
||||
IndexableDocument,
|
||||
SearchEngine,
|
||||
} from '@backstage/plugin-search-common';
|
||||
import {
|
||||
ConcreteLunrQuery,
|
||||
LunrSearchEngine,
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
SearchResultSet,
|
||||
QueryTranslator,
|
||||
SearchEngine,
|
||||
} from '@backstage/search-common';
|
||||
} from '@backstage/plugin-search-common';
|
||||
import lunr from 'lunr';
|
||||
import { Logger } from 'winston';
|
||||
import { LunrSearchEngineIndexer } from './LunrSearchEngineIndexer';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import lunr from 'lunr';
|
||||
import { BatchSearchEngineIndexer } from '../indexing';
|
||||
|
||||
|
||||
@@ -37,6 +37,6 @@ export * from './indexing';
|
||||
export * from './test-utils';
|
||||
|
||||
/**
|
||||
* @deprecated Import from @backstage/search-common instead
|
||||
* @deprecated Import from @backstage/plugin-search-common instead
|
||||
*/
|
||||
export type { SearchEngine } from '@backstage/search-common';
|
||||
export type { SearchEngine } from '@backstage/plugin-search-common';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { BatchSearchEngineIndexer } from './BatchSearchEngineIndexer';
|
||||
import { TestPipeline } from '../test-utils';
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { assertError } from '@backstage/errors';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { Writable } from 'stream';
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { DecoratorBase } from './DecoratorBase';
|
||||
import { TestPipeline } from '../test-utils';
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { assertError } from '@backstage/errors';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { Transform } from 'stream';
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { pipeline, Readable, Transform, Writable } from 'stream';
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
DocumentCollatorFactory,
|
||||
DocumentDecoratorFactory,
|
||||
SearchEngine,
|
||||
} from '@backstage/search-common';
|
||||
} from '@backstage/plugin-search-common';
|
||||
import { Logger } from 'winston';
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
```ts
|
||||
import { Config } from '@backstage/config';
|
||||
import { DocumentTypeInfo } from '@backstage/search-common';
|
||||
import { DocumentTypeInfo } from '@backstage/plugin-search-common';
|
||||
import express from 'express';
|
||||
import { Logger as Logger_2 } from 'winston';
|
||||
import { PermissionAuthorizer } from '@backstage/plugin-permission-common';
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
"@backstage/backend-common": "^0.12.0",
|
||||
"@backstage/config": "^0.1.15",
|
||||
"@backstage/errors": "^0.2.2",
|
||||
"@backstage/search-common": "^0.3.0",
|
||||
"@backstage/plugin-auth-node": "^0.1.4",
|
||||
"@backstage/plugin-permission-common": "^0.5.2",
|
||||
"@backstage/plugin-permission-node": "^0.5.3",
|
||||
"@backstage/plugin-search-backend-node": "^0.5.0",
|
||||
"@backstage/plugin-search-common": "^0.3.0",
|
||||
"@backstage/types": "^0.1.3",
|
||||
"@types/express": "^4.17.6",
|
||||
"dataloader": "^2.0.0",
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
DocumentTypeInfo,
|
||||
IndexableDocument,
|
||||
SearchEngine,
|
||||
} from '@backstage/search-common';
|
||||
} from '@backstage/plugin-search-common';
|
||||
import {
|
||||
encodePageCursor,
|
||||
decodePageCursor,
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
SearchQuery,
|
||||
SearchResult,
|
||||
SearchResultSet,
|
||||
} from '@backstage/search-common';
|
||||
} from '@backstage/plugin-search-common';
|
||||
import { Config } from '@backstage/config';
|
||||
import { InputError } from '@backstage/errors';
|
||||
import { Writable } from 'stream';
|
||||
|
||||
@@ -24,7 +24,10 @@ import { Config } from '@backstage/config';
|
||||
import { JsonObject, JsonValue } from '@backstage/types';
|
||||
import { getBearerTokenFromAuthorizationHeader } from '@backstage/plugin-auth-node';
|
||||
import { PermissionAuthorizer } from '@backstage/plugin-permission-common';
|
||||
import { DocumentTypeInfo, SearchResultSet } from '@backstage/search-common';
|
||||
import {
|
||||
DocumentTypeInfo,
|
||||
SearchResultSet,
|
||||
} from '@backstage/plugin-search-common';
|
||||
import { SearchEngine } from '@backstage/plugin-search-backend-node';
|
||||
import { AuthorizedSearchEngine } from './AuthorizedSearchEngine';
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
extends: [require.resolve('@backstage/cli/config/eslint.backend')],
|
||||
};
|
||||
@@ -0,0 +1,148 @@
|
||||
# @backstage/plugin-search-common
|
||||
|
||||
## 0.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 022507c860: **BREAKING**
|
||||
|
||||
The Backstage Search Platform's indexing process has been rewritten as a stream
|
||||
pipeline in order to improve efficiency and performance on large document sets.
|
||||
|
||||
The concepts of `Collator` and `Decorator` have been replaced with readable and
|
||||
transform object streams (respectively), as well as factory classes to
|
||||
instantiate them. Accordingly, the `SearchEngine.index()` method has also been
|
||||
replaced with a `getIndexer()` factory method that resolves to a writable
|
||||
object stream.
|
||||
|
||||
Check [this upgrade guide](https://backstage.io/docs/features/search/how-to-guides#how-to-migrate-from-search-alpha-to-beta)
|
||||
for further details.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @backstage/plugin-permission-common@0.5.2
|
||||
|
||||
## 0.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fix for the previous release with missing type declarations.
|
||||
- Updated dependencies
|
||||
- @backstage/types@0.1.3
|
||||
- @backstage/plugin-permission-common@0.5.1
|
||||
|
||||
## 0.2.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- c77c5c7eb6: Added `backstage.role` to `package.json`
|
||||
- Updated dependencies
|
||||
- @backstage/plugin-permission-common@0.5.0
|
||||
- @backstage/types@0.1.2
|
||||
|
||||
## 0.2.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9a511968b1: - Add optional visibilityPermission property to DocumentCollator type
|
||||
- Add new DocumentTypeInfo type for housing information about the document types stored in a search engine.
|
||||
- b2e918fa0b: Add optional resourceRef field to the IndexableDocument type for use when authorizing access to documents.
|
||||
- 96cbebc629: Add optional query request options containing authorization token to SearchEngine#query.
|
||||
|
||||
## 0.2.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 10615525f3: Switch to use the json and observable types from `@backstage/types`
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- a13f21cdc: Implement optional `pageCursor` based paging in search.
|
||||
|
||||
To use paging in your app, add a `<SearchResultPager />` to your
|
||||
`SearchPage.tsx`.
|
||||
|
||||
## 0.1.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- d9c13d535: Implements configuration and indexing functionality for ElasticSearch search engine. Adds indexing, searching and default translator for ElasticSearch and modifies default backend example-app to use ES if it is configured.
|
||||
|
||||
## Example configurations:
|
||||
|
||||
### AWS
|
||||
|
||||
Using AWS hosted ElasticSearch the only configuration options needed is the URL to the ElasticSearch service. The implementation assumes
|
||||
that environment variables for AWS access key id and secret access key are defined in accordance to the [default AWS credential chain.](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html).
|
||||
|
||||
```yaml
|
||||
search:
|
||||
elasticsearch:
|
||||
provider: aws
|
||||
node: https://my-backstage-search-asdfqwerty.eu-west-1.es.amazonaws.com
|
||||
```
|
||||
|
||||
### Elastic.co
|
||||
|
||||
Elastic Cloud hosted ElasticSearch uses a Cloud ID to determine the instance of hosted ElasticSearch to connect to. Additionally, username and password needs to be provided either directly or using environment variables like defined in [Backstage documentation.](https://backstage.io/docs/conf/writing#includes-and-dynamic-data)
|
||||
|
||||
```yaml
|
||||
search:
|
||||
elasticsearch:
|
||||
provider: elastic
|
||||
cloudId: backstage-elastic:asdfqwertyasdfqwertyasdfqwertyasdfqwerty==
|
||||
auth:
|
||||
username: elastic
|
||||
password: changeme
|
||||
```
|
||||
|
||||
### Others
|
||||
|
||||
Other ElasticSearch instances can be connected to by using standard ElasticSearch authentication methods and exposed URL, provided that the cluster supports that. The configuration options needed are the URL to the node and authentication information. Authentication can be handled by either providing username/password or and API key or a bearer token. In case both username/password combination and one of the tokens are provided, token takes precedence. For more information how to create an API key, see [Elastic documentation on API keys](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html) and how to create a bearer token, see [Elastic documentation on tokens.](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-service-token.html)
|
||||
|
||||
#### Configuration examples
|
||||
|
||||
##### With username and password
|
||||
|
||||
```yaml
|
||||
search:
|
||||
elasticsearch:
|
||||
node: http://localhost:9200
|
||||
auth:
|
||||
username: elastic
|
||||
password: changeme
|
||||
```
|
||||
|
||||
##### With bearer token
|
||||
|
||||
```yaml
|
||||
search:
|
||||
elasticsearch:
|
||||
node: http://localhost:9200
|
||||
auth:
|
||||
bearer: token
|
||||
```
|
||||
|
||||
##### With API key
|
||||
|
||||
```yaml
|
||||
search:
|
||||
elasticsearch:
|
||||
node: http://localhost:9200
|
||||
auth:
|
||||
apiKey: base64EncodedKey
|
||||
```
|
||||
|
||||
- Updated dependencies
|
||||
- @backstage/config@0.1.6
|
||||
|
||||
## 0.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- db1c8f93b: The `<Search...Next /> set of components exported by the Search Plugin are now updated to use the Search Backend API. These will be made available as the default non-"next" versions in a follow-up release.
|
||||
|
||||
The interfaces for decorators and collators in the Search Backend have also seen minor, breaking revisions ahead of a general release. If you happen to be building on top of these interfaces, check and update your implementations accordingly. The APIs will be considered more stable in a follow-up release.
|
||||
@@ -0,0 +1,3 @@
|
||||
# @backstage/plugin-search-common
|
||||
|
||||
Common functionalities for Search, to be shared between various search-enabled plugins.
|
||||
@@ -0,0 +1,89 @@
|
||||
## API Report File for "@backstage/plugin-search-common"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
/// <reference types="node" />
|
||||
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { Permission } from '@backstage/plugin-permission-common';
|
||||
import { Readable } from 'stream';
|
||||
import { Transform } from 'stream';
|
||||
import { Writable } from 'stream';
|
||||
|
||||
// @beta
|
||||
export interface DocumentCollatorFactory {
|
||||
getCollator(): Promise<Readable>;
|
||||
readonly type: string;
|
||||
readonly visibilityPermission?: Permission;
|
||||
}
|
||||
|
||||
// @beta
|
||||
export interface DocumentDecoratorFactory {
|
||||
getDecorator(): Promise<Transform>;
|
||||
readonly types?: string[];
|
||||
}
|
||||
|
||||
// @beta
|
||||
export type DocumentTypeInfo = {
|
||||
visibilityPermission?: Permission;
|
||||
};
|
||||
|
||||
// @beta
|
||||
export interface IndexableDocument {
|
||||
authorization?: {
|
||||
resourceRef: string;
|
||||
};
|
||||
location: string;
|
||||
text: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
// @beta
|
||||
export type QueryRequestOptions = {
|
||||
token?: string;
|
||||
};
|
||||
|
||||
// @beta
|
||||
export type QueryTranslator = (query: SearchQuery) => unknown;
|
||||
|
||||
// @beta
|
||||
export interface SearchEngine {
|
||||
getIndexer(type: string): Promise<Writable>;
|
||||
query(
|
||||
query: SearchQuery,
|
||||
options?: QueryRequestOptions,
|
||||
): Promise<SearchResultSet>;
|
||||
setTranslator(translator: QueryTranslator): void;
|
||||
}
|
||||
|
||||
// @beta (undocumented)
|
||||
export interface SearchQuery {
|
||||
// (undocumented)
|
||||
filters?: JsonObject;
|
||||
// (undocumented)
|
||||
pageCursor?: string;
|
||||
// (undocumented)
|
||||
term: string;
|
||||
// (undocumented)
|
||||
types?: string[];
|
||||
}
|
||||
|
||||
// @beta (undocumented)
|
||||
export interface SearchResult {
|
||||
// (undocumented)
|
||||
document: IndexableDocument;
|
||||
// (undocumented)
|
||||
type: string;
|
||||
}
|
||||
|
||||
// @beta (undocumented)
|
||||
export interface SearchResultSet {
|
||||
// (undocumented)
|
||||
nextPageCursor?: string;
|
||||
// (undocumented)
|
||||
previousPageCursor?: string;
|
||||
// (undocumented)
|
||||
results: SearchResult[];
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "@backstage/plugin-search-common",
|
||||
"description": "Common functionalities for Search, to be shared between various search-enabled plugins",
|
||||
"version": "0.3.0",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"private": false,
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"main": "dist/index.cjs.js",
|
||||
"types": "dist/index.d.ts"
|
||||
},
|
||||
"backstage": {
|
||||
"role": "common-library"
|
||||
},
|
||||
"homepage": "https://backstage.io",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/backstage/backstage",
|
||||
"directory": "plugins/search-common"
|
||||
},
|
||||
"keywords": [
|
||||
"backstage",
|
||||
"search"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "backstage-cli package build",
|
||||
"lint": "backstage-cli package lint",
|
||||
"test": "backstage-cli package test",
|
||||
"prepack": "backstage-cli package prepack",
|
||||
"postpack": "backstage-cli package postpack",
|
||||
"clean": "backstage-cli package clean"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/backstage/backstage/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/types": "^0.1.3",
|
||||
"@backstage/plugin-permission-common": "^0.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^0.15.0"
|
||||
},
|
||||
"jest": {
|
||||
"roots": [
|
||||
".."
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2021 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Common functionalities for Search, to be shared between various search-enabled plugins
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
export * from './types';
|
||||
@@ -9,16 +9,16 @@ import { ApiRef } from '@backstage/core-plugin-api';
|
||||
import { AsyncState } from 'react-use/lib/useAsync';
|
||||
import { BackstagePlugin } from '@backstage/core-plugin-api';
|
||||
import { IconComponent } from '@backstage/core-plugin-api';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { InputBaseProps } from '@material-ui/core';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { default as React_2 } from 'react';
|
||||
import { ReactElement } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { RouteRef } from '@backstage/core-plugin-api';
|
||||
import { SearchQuery } from '@backstage/search-common';
|
||||
import { SearchResult as SearchResult_2 } from '@backstage/search-common';
|
||||
import { SearchResultSet } from '@backstage/search-common';
|
||||
import { SearchQuery } from '@backstage/plugin-search-common';
|
||||
import { SearchResult as SearchResult_2 } from '@backstage/plugin-search-common';
|
||||
import { SearchResultSet } from '@backstage/plugin-search-common';
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DefaultResultListItem" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"@backstage/core-plugin-api": "^0.8.0",
|
||||
"@backstage/errors": "^0.2.2",
|
||||
"@backstage/plugin-catalog-react": "^0.8.0",
|
||||
"@backstage/search-common": "^0.3.0",
|
||||
"@backstage/plugin-search-common": "^0.3.0",
|
||||
"@backstage/theme": "^0.2.15",
|
||||
"@backstage/types": "^0.1.3",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
IdentityApi,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { ResponseError } from '@backstage/errors';
|
||||
import { SearchQuery, SearchResultSet } from '@backstage/search-common';
|
||||
import { SearchQuery, SearchResultSet } from '@backstage/plugin-search-common';
|
||||
import qs from 'qs';
|
||||
|
||||
export const searchApiRef = createApiRef<SearchApi>({
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import React, { ReactNode } from 'react';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import {
|
||||
ListItem,
|
||||
ListItemIcon,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { useApi, AnalyticsContext } from '@backstage/core-plugin-api';
|
||||
import { SearchResultSet } from '@backstage/search-common';
|
||||
import { SearchResultSet } from '@backstage/plugin-search-common';
|
||||
import React, {
|
||||
createContext,
|
||||
PropsWithChildren,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { ApiProvider } from '@backstage/core-app-api';
|
||||
import { SearchResultSet } from '@backstage/search-common';
|
||||
import { SearchResultSet } from '@backstage/plugin-search-common';
|
||||
import { TestApiRegistry } from '@backstage/test-utils';
|
||||
import React, { ComponentProps, PropsWithChildren } from 'react';
|
||||
import { searchApiRef } from '../../apis';
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
Progress,
|
||||
ResponseErrorPanel,
|
||||
} from '@backstage/core-components';
|
||||
import { SearchResult } from '@backstage/search-common';
|
||||
import { SearchResult } from '@backstage/plugin-search-common';
|
||||
import React from 'react';
|
||||
import { useSearch } from '../SearchContext';
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ yarn start
|
||||
This provides serving and building of documentation for any entity.
|
||||
To configure various storage providers and building options, see http://backstage.io/docs/features/techdocs/configuration.
|
||||
|
||||
The techdocs-backend re-exports the [techdocs-common](https://github.com/backstage/backstage/tree/master/packages/techdocs-common) package which has the features to prepare, generate and publish docs.
|
||||
The techdocs-backend re-exports the [techdocs-node](https://github.com/backstage/backstage/tree/master/plugins/techdocs-node) package which has the features to prepare, generate and publish docs.
|
||||
The Publishers are also used to fetch the static documentation files and render them in TechDocs.
|
||||
|
||||
## Links
|
||||
|
||||
@@ -7,19 +7,19 @@
|
||||
|
||||
import { CatalogApi } from '@backstage/catalog-client';
|
||||
import { Config } from '@backstage/config';
|
||||
import { DocumentCollatorFactory } from '@backstage/search-common';
|
||||
import { DocumentCollatorFactory } from '@backstage/plugin-search-common';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import express from 'express';
|
||||
import { GeneratorBuilder } from '@backstage/techdocs-common';
|
||||
import { GeneratorBuilder } from '@backstage/plugin-techdocs-node';
|
||||
import { Knex } from 'knex';
|
||||
import { Logger as Logger_2 } from 'winston';
|
||||
import { Permission } from '@backstage/plugin-permission-common';
|
||||
import { PluginCacheManager } from '@backstage/backend-common';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { PreparerBuilder } from '@backstage/techdocs-common';
|
||||
import { PublisherBase } from '@backstage/techdocs-common';
|
||||
import { PreparerBuilder } from '@backstage/plugin-techdocs-node';
|
||||
import { PublisherBase } from '@backstage/plugin-techdocs-node';
|
||||
import { Readable } from 'stream';
|
||||
import { TechDocsDocument } from '@backstage/techdocs-common';
|
||||
import { TechDocsDocument } from '@backstage/plugin-techdocs-node';
|
||||
import { TokenManager } from '@backstage/backend-common';
|
||||
|
||||
// @public
|
||||
@@ -123,5 +123,5 @@ export type TechDocsCollatorOptions = {
|
||||
|
||||
export { TechDocsDocument };
|
||||
|
||||
export * from '@backstage/techdocs-common';
|
||||
export * from '@backstage/plugin-techdocs-node';
|
||||
```
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
"@backstage/errors": "^0.2.2",
|
||||
"@backstage/integration": "^0.8.0",
|
||||
"@backstage/plugin-catalog-common": "^0.2.0",
|
||||
"@backstage/search-common": "^0.3.0",
|
||||
"@backstage/techdocs-common": "^0.11.11",
|
||||
"@backstage/plugin-search-common": "^0.3.0",
|
||||
"@backstage/plugin-techdocs-node": "^0.11.11",
|
||||
"@types/express": "^4.17.6",
|
||||
"dockerode": "^3.3.1",
|
||||
"express": "^4.17.1",
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
PreparerBuilder,
|
||||
PublisherBase,
|
||||
UrlPreparer,
|
||||
} from '@backstage/techdocs-common';
|
||||
} from '@backstage/plugin-techdocs-node';
|
||||
import fs from 'fs-extra';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
@@ -39,8 +39,8 @@ export type {
|
||||
} from './search';
|
||||
|
||||
/**
|
||||
* @deprecated Use directly from @backstage/techdocs-common
|
||||
* @deprecated Use directly from @backstage/plugin-techdocs-node
|
||||
*/
|
||||
export type { TechDocsDocument } from '@backstage/techdocs-common';
|
||||
export type { TechDocsDocument } from '@backstage/plugin-techdocs-node';
|
||||
|
||||
export * from '@backstage/techdocs-common';
|
||||
export * from '@backstage/plugin-techdocs-node';
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
CatalogClient,
|
||||
CATALOG_FILTER_EXISTS,
|
||||
} from '@backstage/catalog-client';
|
||||
import { TechDocsDocument } from '@backstage/techdocs-common';
|
||||
import { TechDocsDocument } from '@backstage/plugin-techdocs-node';
|
||||
|
||||
interface MkSearchIndexDoc {
|
||||
title: string;
|
||||
|
||||
@@ -31,8 +31,8 @@ import {
|
||||
} from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
import { catalogEntityReadPermission } from '@backstage/plugin-catalog-common';
|
||||
import { DocumentCollatorFactory } from '@backstage/search-common';
|
||||
import { TechDocsDocument } from '@backstage/techdocs-common';
|
||||
import { DocumentCollatorFactory } from '@backstage/plugin-search-common';
|
||||
import { TechDocsDocument } from '@backstage/plugin-techdocs-node';
|
||||
import unescape from 'lodash/unescape';
|
||||
import fetch from 'node-fetch';
|
||||
import pLimit from 'p-limit';
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
GeneratorBuilder,
|
||||
PreparerBuilder,
|
||||
PublisherBase,
|
||||
} from '@backstage/techdocs-common';
|
||||
} from '@backstage/plugin-techdocs-node';
|
||||
import { TechDocsCache } from '../cache';
|
||||
import { DocsBuilder, shouldCheckForUpdate } from '../DocsBuilder';
|
||||
import { DocsSynchronizer, DocsSynchronizerSyncOpts } from './DocsSynchronizer';
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
GeneratorBuilder,
|
||||
PreparerBuilder,
|
||||
PublisherBase,
|
||||
} from '@backstage/techdocs-common';
|
||||
} from '@backstage/plugin-techdocs-node';
|
||||
import fetch from 'node-fetch';
|
||||
import { PassThrough } from 'stream';
|
||||
import * as winston from 'winston';
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
GeneratorBuilder,
|
||||
PreparerBuilder,
|
||||
PublisherBase,
|
||||
} from '@backstage/techdocs-common';
|
||||
} from '@backstage/plugin-techdocs-node';
|
||||
import express, { Response } from 'express';
|
||||
import request from 'supertest';
|
||||
import { DocsSynchronizer, DocsSynchronizerSyncOpts } from './DocsSynchronizer';
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
getLocationForEntity,
|
||||
PreparerBuilder,
|
||||
PublisherBase,
|
||||
} from '@backstage/techdocs-common';
|
||||
} from '@backstage/plugin-techdocs-node';
|
||||
import express, { Response } from 'express';
|
||||
import Router from 'express-promise-router';
|
||||
import { Knex } from 'knex';
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
Preparers,
|
||||
Publisher,
|
||||
TechdocsGenerator,
|
||||
} from '@backstage/techdocs-common';
|
||||
} from '@backstage/plugin-techdocs-node';
|
||||
import Docker from 'dockerode';
|
||||
import { Server } from 'http';
|
||||
import { Logger } from 'winston';
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
extends: [require.resolve('@backstage/cli/config/eslint.backend')],
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,49 @@
|
||||
# @backstage/plugin-techdocs-node
|
||||
|
||||
Common node.js functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli
|
||||
|
||||
This package is used by `techdocs-backend` to serve docs from different types of publishers (Google GCS, Local, etc.).
|
||||
It is also used to build docs and publish them to storage, by both `techdocs-backend` and `techdocs-cli`.
|
||||
|
||||
## Usage
|
||||
|
||||
Create a preparer instance from the [preparers available](/plugins/techdocs-node/src/stages/prepare) at which takes an Entity instance.
|
||||
Run the [docs generator](/plugins/techdocs-node/src/stages/generate) on the prepared directory.
|
||||
Publish the generated directory files to a [storage](/plugins/techdocs-node/src/stages/publish) of your choice.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
async () => {
|
||||
const preparedDir = await preparer.prepare(entity);
|
||||
|
||||
const parsedLocationAnnotation = getLocationForEntity(entity);
|
||||
const { resultDir } = await generator.run({
|
||||
directory: preparedDir,
|
||||
dockerClient: dockerClient,
|
||||
parsedLocationAnnotation,
|
||||
});
|
||||
|
||||
await publisher.publish({
|
||||
entity: entity,
|
||||
directory: resultDir,
|
||||
});
|
||||
};
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
Currently the build process is split up in these three stages.
|
||||
|
||||
- Preparers
|
||||
- Generators
|
||||
- Publishers
|
||||
|
||||
Preparers read your entity data and creates a working directory with your documentation source code. For example if you have set your `backstage.io/techdocs-ref` to `url:https://github.com/backstage/backstage.git` it will clone that repository to a temp folder and pass that on to the generator.
|
||||
|
||||
Generators takes the prepared source and runs the `techdocs-container` on it. It then passes on the output folder of that build to the publisher.
|
||||
|
||||
Publishers gets a folder path from the generator and publish it to your storage solution. Read documentation to know more about configuring storage solutions.
|
||||
http://backstage.io/docs/features/techdocs/configuration
|
||||
|
||||
Any of these can be extended. We want to extend our support to most of the storage providers (Publishers) and source code host providers (Preparers).
|
||||
@@ -0,0 +1,258 @@
|
||||
## API Report File for "@backstage/plugin-techdocs-node"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
/// <reference types="node" />
|
||||
|
||||
import { CompoundEntityRef } from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
import { ContainerRunner } from '@backstage/backend-common';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import express from 'express';
|
||||
import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { Logger as Logger_2 } from 'winston';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { UrlReader } from '@backstage/backend-common';
|
||||
import { Writable } from 'stream';
|
||||
|
||||
// @public
|
||||
export class DirectoryPreparer implements PreparerBase {
|
||||
// @deprecated
|
||||
constructor(config: Config, _logger: Logger_2 | null, reader: UrlReader);
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
{ logger, reader }: PreparerConfig,
|
||||
): DirectoryPreparer;
|
||||
prepare(entity: Entity, options?: PreparerOptions): Promise<PreparerResponse>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ETag = string;
|
||||
|
||||
// @public
|
||||
export type GeneratorBase = {
|
||||
run(opts: GeneratorRunOptions): Promise<void>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type GeneratorBuilder = {
|
||||
register(protocol: SupportedGeneratorKey, generator: GeneratorBase): void;
|
||||
get(entity: Entity): GeneratorBase;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type GeneratorOptions = {
|
||||
containerRunner: ContainerRunner;
|
||||
logger: Logger_2;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type GeneratorRunOptions = {
|
||||
inputDir: string;
|
||||
outputDir: string;
|
||||
parsedLocationAnnotation?: ParsedLocationAnnotation;
|
||||
etag?: string;
|
||||
logger: Logger_2;
|
||||
logStream?: Writable;
|
||||
};
|
||||
|
||||
// @public
|
||||
export class Generators implements GeneratorBuilder {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger_2;
|
||||
containerRunner: ContainerRunner;
|
||||
},
|
||||
): Promise<GeneratorBuilder>;
|
||||
get(entity: Entity): GeneratorBase;
|
||||
register(generatorKey: SupportedGeneratorKey, generator: GeneratorBase): void;
|
||||
}
|
||||
|
||||
// @public
|
||||
export const getDocFilesFromRepository: (
|
||||
reader: UrlReader,
|
||||
entity: Entity,
|
||||
opts?:
|
||||
| {
|
||||
etag?: string | undefined;
|
||||
logger?: Logger_2 | undefined;
|
||||
}
|
||||
| undefined,
|
||||
) => Promise<PreparerResponse>;
|
||||
|
||||
// @public
|
||||
export const getLocationForEntity: (
|
||||
entity: Entity,
|
||||
scmIntegration: ScmIntegrationRegistry,
|
||||
) => ParsedLocationAnnotation;
|
||||
|
||||
// @public
|
||||
export type MigrateRequest = {
|
||||
removeOriginal?: boolean;
|
||||
concurrency?: number;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type ParsedLocationAnnotation = {
|
||||
type: RemoteProtocol;
|
||||
target: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export const parseReferenceAnnotation: (
|
||||
annotationName: string,
|
||||
entity: Entity,
|
||||
) => ParsedLocationAnnotation;
|
||||
|
||||
// @public
|
||||
export type PreparerBase = {
|
||||
prepare(entity: Entity, options?: PreparerOptions): Promise<PreparerResponse>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type PreparerBuilder = {
|
||||
register(protocol: RemoteProtocol, preparer: PreparerBase): void;
|
||||
get(entity: Entity): PreparerBase;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type PreparerConfig = {
|
||||
logger: Logger_2;
|
||||
reader: UrlReader;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type PreparerOptions = {
|
||||
logger?: Logger_2;
|
||||
etag?: ETag;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type PreparerResponse = {
|
||||
preparedDir: string;
|
||||
etag: ETag;
|
||||
};
|
||||
|
||||
// @public
|
||||
export class Preparers implements PreparerBuilder {
|
||||
static fromConfig(
|
||||
backstageConfig: Config,
|
||||
{ logger, reader }: PreparerConfig,
|
||||
): Promise<PreparerBuilder>;
|
||||
get(entity: Entity): PreparerBase;
|
||||
register(protocol: RemoteProtocol, preparer: PreparerBase): void;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class Publisher {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
{ logger, discovery }: PublisherFactory,
|
||||
): Promise<PublisherBase>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface PublisherBase {
|
||||
docsRouter(): express.Handler;
|
||||
fetchTechDocsMetadata(
|
||||
entityName: CompoundEntityRef,
|
||||
): Promise<TechDocsMetadata>;
|
||||
getReadiness(): Promise<ReadinessResponse>;
|
||||
hasDocsBeenGenerated(entityName: Entity): Promise<boolean>;
|
||||
migrateDocsCase?(migrateRequest: MigrateRequest): Promise<void>;
|
||||
publish(request: PublishRequest): Promise<PublishResponse>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type PublisherFactory = {
|
||||
logger: Logger_2;
|
||||
discovery: PluginEndpointDiscovery;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type PublisherType =
|
||||
| 'local'
|
||||
| 'googleGcs'
|
||||
| 'awsS3'
|
||||
| 'azureBlobStorage'
|
||||
| 'openStackSwift';
|
||||
|
||||
// @public
|
||||
export type PublishRequest = {
|
||||
entity: Entity;
|
||||
directory: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type PublishResponse = {
|
||||
remoteUrl?: string;
|
||||
objects?: string[];
|
||||
} | void;
|
||||
|
||||
// @public
|
||||
export type ReadinessResponse = {
|
||||
isAvailable: boolean;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type RemoteProtocol = 'url' | 'dir';
|
||||
|
||||
// @public
|
||||
export type SupportedGeneratorKey = 'techdocs' | string;
|
||||
|
||||
// @public
|
||||
export interface TechDocsDocument extends IndexableDocument {
|
||||
kind: string;
|
||||
lifecycle: string;
|
||||
name: string;
|
||||
namespace: string;
|
||||
owner: string;
|
||||
path: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class TechdocsGenerator implements GeneratorBase {
|
||||
constructor(options: {
|
||||
logger: Logger_2;
|
||||
containerRunner: ContainerRunner;
|
||||
config: Config;
|
||||
scmIntegrations: ScmIntegrationRegistry;
|
||||
});
|
||||
static readonly defaultDockerImage = 'spotify/techdocs:v0.3.7';
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: GeneratorOptions,
|
||||
): TechdocsGenerator;
|
||||
run(options: GeneratorRunOptions): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type TechDocsMetadata = {
|
||||
site_name: string;
|
||||
site_description: string;
|
||||
etag: string;
|
||||
build_timestamp: number;
|
||||
files?: string[];
|
||||
};
|
||||
|
||||
// @public
|
||||
export const transformDirLocation: (
|
||||
entity: Entity,
|
||||
dirAnnotation: ParsedLocationAnnotation,
|
||||
scmIntegrations: ScmIntegrationRegistry,
|
||||
) => {
|
||||
type: 'dir' | 'url';
|
||||
target: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export class UrlPreparer implements PreparerBase {
|
||||
// @deprecated
|
||||
constructor(reader: UrlReader, logger: Logger_2);
|
||||
static fromConfig({ reader, logger }: PreparerConfig): UrlPreparer;
|
||||
prepare(entity: Entity, options?: PreparerOptions): Promise<PreparerResponse>;
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"name": "@backstage/plugin-techdocs-node",
|
||||
"description": "Common node.js functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli",
|
||||
"version": "0.11.11",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"private": false,
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"main": "dist/index.cjs.js",
|
||||
"types": "dist/index.d.ts"
|
||||
},
|
||||
"backstage": {
|
||||
"role": "node-library"
|
||||
},
|
||||
"homepage": "https://backstage.io",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/backstage/backstage",
|
||||
"directory": "plugins/techdocs-node"
|
||||
},
|
||||
"keywords": [
|
||||
"techdocs",
|
||||
"backstage"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "backstage-cli package build",
|
||||
"lint": "backstage-cli package lint",
|
||||
"test": "backstage-cli package test",
|
||||
"prepack": "backstage-cli package prepack",
|
||||
"postpack": "backstage-cli package postpack",
|
||||
"clean": "backstage-cli package clean",
|
||||
"start": "backstage-cli package start"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/backstage/backstage/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@azure/identity": "^2.0.1",
|
||||
"@azure/storage-blob": "^12.5.0",
|
||||
"@backstage/backend-common": "^0.12.0",
|
||||
"@backstage/catalog-model": "^0.12.0",
|
||||
"@backstage/config": "^0.1.15",
|
||||
"@backstage/errors": "^0.2.2",
|
||||
"@backstage/integration": "^0.8.0",
|
||||
"@backstage/plugin-search-common": "^0.3.0",
|
||||
"@google-cloud/storage": "^5.6.0",
|
||||
"@trendyol-js/openstack-swift-sdk": "^0.0.5",
|
||||
"@types/express": "^4.17.6",
|
||||
"aws-sdk": "^2.840.0",
|
||||
"express": "^4.17.1",
|
||||
"fs-extra": "9.1.0",
|
||||
"git-url-parse": "^11.6.0",
|
||||
"js-yaml": "^4.0.0",
|
||||
"json5": "^2.1.3",
|
||||
"mime-types": "^2.1.27",
|
||||
"mock-fs": "^5.1.0",
|
||||
"p-limit": "^3.1.0",
|
||||
"recursive-readdir": "^2.2.2",
|
||||
"winston": "^3.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^0.15.0",
|
||||
"@types/fs-extra": "^9.0.5",
|
||||
"@types/js-yaml": "^4.0.0",
|
||||
"@types/mime-types": "^2.1.0",
|
||||
"@types/mock-fs": "^4.13.0",
|
||||
"@types/recursive-readdir": "^2.2.0",
|
||||
"@types/supertest": "^2.0.8",
|
||||
"supertest": "^6.1.3"
|
||||
},
|
||||
"jest": {
|
||||
"roots": [
|
||||
".."
|
||||
]
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user