@backstage/backend-test-utils 0.1.28 → 0.1.29-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/alpha/package.json +1 -1
- package/dist/index.cjs.js +19 -2
- package/dist/index.cjs.js.map +1 -1
- package/package.json +9 -10
- package/LICENSE +0 -201
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @backstage/backend-test-utils
|
|
2
2
|
|
|
3
|
+
## 0.1.29-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 72549952d1: Fixed handling of root scoped services in `startTestBackend`.
|
|
8
|
+
- e91e8e9c55: Increased test database max connection pool size to reduce the risk of resource exhaustion.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/backend-app-api@0.2.2-next.0
|
|
11
|
+
- @backstage/backend-plugin-api@0.1.3-next.0
|
|
12
|
+
- @backstage/cli@0.20.0-next.0
|
|
13
|
+
- @backstage/backend-common@0.15.2-next.0
|
|
14
|
+
- @backstage/config@1.0.3-next.0
|
|
15
|
+
|
|
3
16
|
## 0.1.28
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -137,6 +137,12 @@ const allDatabases = Object.freeze({
|
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
|
|
140
|
+
const LARGER_POOL_CONFIG = {
|
|
141
|
+
pool: {
|
|
142
|
+
min: 0,
|
|
143
|
+
max: 50
|
|
144
|
+
}
|
|
145
|
+
};
|
|
140
146
|
class TestDatabases {
|
|
141
147
|
static create(options) {
|
|
142
148
|
const defaultOptions = {
|
|
@@ -215,6 +221,7 @@ class TestDatabases {
|
|
|
215
221
|
new config.ConfigReader({
|
|
216
222
|
backend: {
|
|
217
223
|
database: {
|
|
224
|
+
knexConfig: properties.driver.includes("sqlite") ? {} : LARGER_POOL_CONFIG,
|
|
218
225
|
client: properties.driver,
|
|
219
226
|
connection: connectionString
|
|
220
227
|
}
|
|
@@ -248,6 +255,7 @@ class TestDatabases {
|
|
|
248
255
|
new config.ConfigReader({
|
|
249
256
|
backend: {
|
|
250
257
|
database: {
|
|
258
|
+
knexConfig: LARGER_POOL_CONFIG,
|
|
251
259
|
client: "pg",
|
|
252
260
|
connection: { host, port, user, password }
|
|
253
261
|
}
|
|
@@ -268,6 +276,7 @@ class TestDatabases {
|
|
|
268
276
|
new config.ConfigReader({
|
|
269
277
|
backend: {
|
|
270
278
|
database: {
|
|
279
|
+
knexConfig: LARGER_POOL_CONFIG,
|
|
271
280
|
client: "mysql2",
|
|
272
281
|
connection: { host, port, user, password }
|
|
273
282
|
}
|
|
@@ -328,10 +337,18 @@ async function startTestBackend(options) {
|
|
|
328
337
|
} = options;
|
|
329
338
|
const factories = services.map((serviceDef) => {
|
|
330
339
|
if (Array.isArray(serviceDef)) {
|
|
340
|
+
const [ref, impl] = serviceDef;
|
|
341
|
+
if (ref.scope === "plugin") {
|
|
342
|
+
return backendPluginApi.createServiceFactory({
|
|
343
|
+
service: ref,
|
|
344
|
+
deps: {},
|
|
345
|
+
factory: async () => async () => impl
|
|
346
|
+
});
|
|
347
|
+
}
|
|
331
348
|
return backendPluginApi.createServiceFactory({
|
|
332
|
-
service:
|
|
349
|
+
service: ref,
|
|
333
350
|
deps: {},
|
|
334
|
-
factory: async () =>
|
|
351
|
+
factory: async () => impl
|
|
335
352
|
});
|
|
336
353
|
}
|
|
337
354
|
return serviceDef;
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/util/isDockerDisabledForTests.ts","../src/database/startMysqlContainer.ts","../src/database/startPostgresContainer.ts","../src/database/types.ts","../src/database/TestDatabases.ts","../src/msw/setupRequestMockHandlers.ts","../src/next/wiring/TestBackend.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @public */\nexport function isDockerDisabledForTests() {\n // If we are not running in continuous integration, the default is to skip\n // the (relatively heavy, long running) docker based tests. If you want to\n // still run local tests for all databases, just pass either the CI=1 env\n // parameter to your test runner, or individual connection strings per\n // database.\n return (\n Boolean(process.env.BACKSTAGE_TEST_DISABLE_DOCKER) ||\n !Boolean(process.env.CI)\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport createConnection, { Knex } from 'knex';\nimport { v4 as uuid } from 'uuid';\n\nasync function waitForMysqlReady(\n connection: Knex.MySqlConnectionConfig,\n): Promise<void> {\n const startTime = Date.now();\n const db = createConnection({ client: 'mysql2', connection });\n\n try {\n for (;;) {\n try {\n const result = await db.select(db.raw('version() AS version'));\n if (result[0]?.version) {\n return;\n }\n } catch (e) {\n if (Date.now() - startTime > 30_000) {\n throw new Error(\n `Timed out waiting for the database to be ready for connections, ${e}`,\n );\n }\n }\n\n await new Promise(resolve => setTimeout(resolve, 100));\n }\n } finally {\n db.destroy();\n }\n}\n\nexport async function startMysqlContainer(image: string) {\n const user = 'root';\n const password = uuid();\n\n // Lazy-load to avoid side-effect of importing testcontainers\n const { GenericContainer } = await import('testcontainers');\n\n const container = await new GenericContainer(image)\n .withExposedPorts(3306)\n .withEnv('MYSQL_ROOT_PASSWORD', password)\n .withTmpFs({ '/var/lib/mysql': 'rw' })\n .start();\n\n const host = container.getHost();\n const port = container.getMappedPort(3306);\n const stop = async () => {\n await container.stop({ timeout: 10_000 });\n };\n\n await waitForMysqlReady({ host, port, user, password });\n\n return { host, port, user, password, stop };\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport createConnection, { Knex } from 'knex';\nimport { v4 as uuid } from 'uuid';\n\nasync function waitForPostgresReady(\n connection: Knex.PgConnectionConfig,\n): Promise<void> {\n const startTime = Date.now();\n const db = createConnection({ client: 'pg', connection });\n\n try {\n for (;;) {\n try {\n const result = await db.select(db.raw('version()'));\n if (Array.isArray(result) && result[0]?.version) {\n return;\n }\n } catch (e) {\n if (Date.now() - startTime > 30_000) {\n throw new Error(\n `Timed out waiting for the database to be ready for connections, ${e}`,\n );\n }\n }\n\n await new Promise(resolve => setTimeout(resolve, 100));\n }\n } finally {\n db.destroy();\n }\n}\n\nexport async function startPostgresContainer(image: string) {\n const user = 'postgres';\n const password = uuid();\n\n // Lazy-load to avoid side-effect of importing testcontainers\n const { GenericContainer } = await import('testcontainers');\n\n const container = await new GenericContainer(image)\n .withExposedPorts(5432)\n .withEnv('POSTGRES_PASSWORD', password)\n .withTmpFs({ '/var/lib/postgresql/data': 'rw' })\n .start();\n\n const host = container.getHost();\n const port = container.getMappedPort(5432);\n const stop = async () => {\n await container.stop({ timeout: 10_000 });\n };\n\n await waitForPostgresReady({ host, port, user, password });\n\n return { host, port, user, password, stop };\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DatabaseManager } from '@backstage/backend-common';\nimport { Knex } from 'knex';\n\n/**\n * The possible databases to test against.\n *\n * @public\n */\nexport type TestDatabaseId =\n | 'POSTGRES_13'\n | 'POSTGRES_9'\n | 'MYSQL_8'\n | 'SQLITE_3';\n\nexport type TestDatabaseProperties = {\n name: string;\n driver: string;\n dockerImageName?: string;\n connectionStringEnvironmentVariableName?: string;\n};\n\nexport type Instance = {\n stopContainer?: () => Promise<void>;\n databaseManager: DatabaseManager;\n connections: Array<Knex>;\n};\n\nexport const allDatabases: Record<TestDatabaseId, TestDatabaseProperties> =\n Object.freeze({\n POSTGRES_13: {\n name: 'Postgres 13.x',\n driver: 'pg',\n dockerImageName: 'postgres:13',\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING',\n },\n POSTGRES_9: {\n name: 'Postgres 9.x',\n driver: 'pg',\n dockerImageName: 'postgres:9',\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING',\n },\n MYSQL_8: {\n name: 'MySQL 8.x',\n driver: 'mysql2',\n dockerImageName: 'mysql:8',\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING',\n },\n SQLITE_3: {\n name: 'SQLite 3.x',\n driver: 'better-sqlite3',\n },\n });\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DatabaseManager } from '@backstage/backend-common';\nimport { ConfigReader } from '@backstage/config';\nimport { randomBytes } from 'crypto';\nimport { Knex } from 'knex';\nimport { isDockerDisabledForTests } from '../util/isDockerDisabledForTests';\nimport { startMysqlContainer } from './startMysqlContainer';\nimport { startPostgresContainer } from './startPostgresContainer';\nimport {\n allDatabases,\n Instance,\n TestDatabaseId,\n TestDatabaseProperties,\n} from './types';\n\n/**\n * Encapsulates the creation of ephemeral test database instances for use\n * inside unit or integration tests.\n *\n * @public\n */\nexport class TestDatabases {\n private readonly instanceById: Map<string, Instance>;\n private readonly supportedIds: TestDatabaseId[];\n\n /**\n * Creates an empty `TestDatabases` instance, and sets up Jest to clean up\n * all of its acquired resources after all tests finish.\n *\n * You typically want to create just a single instance like this at the top\n * of your test file or `describe` block, and then call `init` many times on\n * that instance inside the individual tests. Spinning up a \"physical\"\n * database instance takes a considerable amount of time, slowing down tests.\n * But initializing a new logical database inside that instance using `init`\n * is very fast.\n */\n static create(options?: {\n ids?: TestDatabaseId[];\n disableDocker?: boolean;\n }): TestDatabases {\n const defaultOptions = {\n ids: Object.keys(allDatabases) as TestDatabaseId[],\n disableDocker: isDockerDisabledForTests(),\n };\n\n const { ids, disableDocker } = Object.assign(\n {},\n defaultOptions,\n options ?? {},\n );\n\n const supportedIds = ids.filter(id => {\n const properties = allDatabases[id];\n if (!properties) {\n return false;\n }\n // If the caller has set up the env with an explicit connection string,\n // we'll assume that this database will work\n if (\n properties.connectionStringEnvironmentVariableName &&\n process.env[properties.connectionStringEnvironmentVariableName]\n ) {\n return true;\n }\n // If the database doesn't require docker at all, there's nothing to worry\n // about\n if (!properties.dockerImageName) {\n return true;\n }\n // If the database requires docker, but docker is disabled, we will fail.\n if (disableDocker) {\n return false;\n }\n return true;\n });\n\n const databases = new TestDatabases(supportedIds);\n\n if (supportedIds.length > 0) {\n afterAll(async () => {\n await databases.shutdown();\n });\n }\n\n return databases;\n }\n\n private constructor(supportedIds: TestDatabaseId[]) {\n this.instanceById = new Map();\n this.supportedIds = supportedIds;\n }\n\n supports(id: TestDatabaseId): boolean {\n return this.supportedIds.includes(id);\n }\n\n eachSupportedId(): [TestDatabaseId][] {\n return this.supportedIds.map(id => [id]);\n }\n\n /**\n * Returns a fresh, unique, empty logical database on an instance of the\n * given database ID platform.\n *\n * @param id - The ID of the database platform to use, e.g. 'POSTGRES_13'\n * @returns A `Knex` connection object\n */\n async init(id: TestDatabaseId): Promise<Knex> {\n const properties = allDatabases[id];\n if (!properties) {\n const candidates = Object.keys(allDatabases).join(', ');\n throw new Error(\n `Unknown test database ${id}, possible values are ${candidates}`,\n );\n }\n if (!this.supportedIds.includes(id)) {\n const candidates = this.supportedIds.join(', ');\n throw new Error(\n `Unsupported test database ${id} for this environment, possible values are ${candidates}`,\n );\n }\n\n let instance: Instance | undefined = this.instanceById.get(id);\n\n // Ensure that a testcontainers instance is up for this ID\n if (!instance) {\n instance = await this.initAny(properties);\n this.instanceById.set(id, instance);\n }\n\n // Ensure that a unique logical database is created in the instance\n const connection = await instance.databaseManager\n .forPlugin(`db${randomBytes(16).toString('hex')}`)\n .getClient();\n\n instance.connections.push(connection);\n\n return connection;\n }\n\n private async initAny(properties: TestDatabaseProperties): Promise<Instance> {\n // Use the connection string if provided\n if (properties.driver === 'pg' || properties.driver === 'mysql2') {\n const envVarName = properties.connectionStringEnvironmentVariableName;\n if (envVarName) {\n const connectionString = process.env[envVarName];\n if (connectionString) {\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n client: properties.driver,\n connection: connectionString,\n },\n },\n }),\n );\n return {\n databaseManager,\n connections: [],\n };\n }\n }\n }\n\n // Otherwise start a container for the purpose\n switch (properties.driver) {\n case 'pg':\n return this.initPostgres(properties);\n case 'mysql2':\n return this.initMysql(properties);\n case 'better-sqlite3':\n case 'sqlite3':\n return this.initSqlite(properties);\n default:\n throw new Error(`Unknown database driver ${properties.driver}`);\n }\n }\n\n private async initPostgres(\n properties: TestDatabaseProperties,\n ): Promise<Instance> {\n const { host, port, user, password, stop } = await startPostgresContainer(\n properties.dockerImageName!,\n );\n\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n client: 'pg',\n connection: { host, port, user, password },\n },\n },\n }),\n );\n\n return {\n stopContainer: stop,\n databaseManager,\n connections: [],\n };\n }\n\n private async initMysql(\n properties: TestDatabaseProperties,\n ): Promise<Instance> {\n const { host, port, user, password, stop } = await startMysqlContainer(\n properties.dockerImageName!,\n );\n\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n client: 'mysql2',\n connection: { host, port, user, password },\n },\n },\n }),\n );\n\n return {\n stopContainer: stop,\n databaseManager,\n connections: [],\n };\n }\n\n private async initSqlite(\n properties: TestDatabaseProperties,\n ): Promise<Instance> {\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n client: properties.driver,\n connection: ':memory:',\n },\n },\n }),\n );\n\n return {\n databaseManager,\n connections: [],\n };\n }\n\n private async shutdown() {\n const instances = [...this.instanceById.values()];\n await Promise.all(\n instances.map(async ({ stopContainer, connections }) => {\n try {\n await Promise.all(connections.map(c => c.destroy()));\n } catch {\n // ignore\n }\n try {\n await stopContainer?.();\n } catch {\n // ignore\n }\n }),\n );\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Sets up handlers for request mocking\n * @public\n * @param worker - service worker\n */\nexport function setupRequestMockHandlers(worker: {\n listen: (t: any) => void;\n close: () => void;\n resetHandlers: () => void;\n}) {\n beforeAll(() => worker.listen({ onUnhandledRequest: 'error' }));\n afterAll(() => worker.close());\n afterEach(() => worker.resetHandlers());\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createSpecializedBackend } from '@backstage/backend-app-api';\nimport {\n ServiceFactory,\n ServiceRef,\n createServiceFactory,\n BackendFeature,\n ExtensionPoint,\n} from '@backstage/backend-plugin-api';\n\n/** @alpha */\nexport interface TestBackendOptions<\n TServices extends any[],\n TExtensionPoints extends any[],\n> {\n services?: readonly [\n ...{\n [index in keyof TServices]:\n | ServiceFactory<TServices[index]>\n | (() => ServiceFactory<TServices[index]>)\n | [ServiceRef<TServices[index]>, Partial<TServices[index]>];\n },\n ];\n extensionPoints?: readonly [\n ...{\n [index in keyof TExtensionPoints]: [\n ExtensionPoint<TExtensionPoints[index]>,\n Partial<TExtensionPoints[index]>,\n ];\n },\n ];\n features?: BackendFeature[];\n}\n\n/** @alpha */\nexport async function startTestBackend<\n TServices extends any[],\n TExtensionPoints extends any[],\n>(options: TestBackendOptions<TServices, TExtensionPoints>): Promise<void> {\n const {\n services = [],\n extensionPoints = [],\n features = [],\n ...otherOptions\n } = options;\n\n const factories = services.map(serviceDef => {\n if (Array.isArray(serviceDef)) {\n // if type is ExtensionPoint?\n // do something differently?\n return createServiceFactory({\n service: serviceDef[0],\n deps: {},\n factory: async () => async () => serviceDef[1],\n });\n }\n return serviceDef as ServiceFactory;\n });\n\n const backend = createSpecializedBackend({\n ...otherOptions,\n services: factories,\n });\n\n backend.add({\n id: `---test-extension-point-registrar`,\n register(reg) {\n for (const [ref, impl] of extensionPoints) {\n reg.registerExtensionPoint(ref, impl);\n }\n\n reg.registerInit({ deps: {}, async init() {} });\n },\n });\n\n for (const feature of features) {\n backend.add(feature);\n }\n\n await backend.start();\n}\n"],"names":["createConnection","uuid","randomBytes","DatabaseManager","ConfigReader","createServiceFactory","createSpecializedBackend"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,SAAS,wBAA2B,GAAA;AAMzC,EACE,OAAA,OAAA,CAAQ,QAAQ,GAAI,CAAA,6BAA6B,KACjD,CAAC,OAAA,CAAQ,OAAQ,CAAA,GAAA,CAAI,EAAE,CAAA,CAAA;AAE3B;;ACRA,eAAe,kBACb,UACe,EAAA;AArBjB,EAAA,IAAA,EAAA,CAAA;AAsBE,EAAM,MAAA,SAAA,GAAY,KAAK,GAAI,EAAA,CAAA;AAC3B,EAAA,MAAM,KAAKA,oCAAiB,CAAA,EAAE,MAAQ,EAAA,QAAA,EAAU,YAAY,CAAA,CAAA;AAE5D,EAAI,IAAA;AACF,IAAS,WAAA;AACP,MAAI,IAAA;AACF,QAAA,MAAM,SAAS,MAAM,EAAA,CAAG,OAAO,EAAG,CAAA,GAAA,CAAI,sBAAsB,CAAC,CAAA,CAAA;AAC7D,QAAI,IAAA,CAAA,EAAA,GAAA,MAAA,CAAO,CAAP,CAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAW,OAAS,EAAA;AACtB,UAAA,OAAA;AAAA,SACF;AAAA,eACO,CAAP,EAAA;AACA,QAAA,IAAI,IAAK,CAAA,GAAA,EAAQ,GAAA,SAAA,GAAY,GAA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AAAA,IACT,GAAA,YAAA;AAAA,GACD,GAAA,OAAA,CAAA;AAEJ,EAAM,MAAA,SAAA,GAAY,QAAS,CAAA,GAAA,CAAI,CAAc,UAAA,KAAA;AAC3C,IAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,UAAU,CAAG,EAAA;AAG7B,MAAA,OAAOC,qCAAqB,CAAA;AAAA,QAC1B,SAAS,UAAW,CAAA,CAAA,CAAA;AAAA,QACpB,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,YAAY,YAAY,UAAW,CAAA,CAAA,CAAA;AAAA,OAC7C,CAAA,CAAA;AAAA,KACH;AACA,IAAO,OAAA,UAAA,CAAA;AAAA,GACR,CAAA,CAAA;AAED,EAAA,MAAM,UAAUC,sCAAyB,CAAA;AAAA,IACvC,GAAG,YAAA;AAAA,IACH,QAAU,EAAA,SAAA;AAAA,GACX,CAAA,CAAA;AAED,EAAA,OAAA,CAAQ,GAAI,CAAA;AAAA,IACV,EAAI,EAAA,CAAA,iCAAA,CAAA;AAAA,IACJ,SAAS,GAAK,EAAA;AACZ,MAAA,KAAA,MAAW,CAAC,GAAA,EAAK,IAAI,CAAA,IAAK,eAAiB,EAAA;AACzC,QAAI,GAAA,CAAA,sBAAA,CAAuB,KAAK,IAAI,CAAA,CAAA;AAAA,OACtC;AAEA,MAAA,GAAA,CAAI,aAAa,EAAE,IAAA,EAAM,EAAC,EAAG,MAAM,IAAO,GAAA;AAAA,SAAI,CAAA,CAAA;AAAA,KAChD;AAAA,GACD,CAAA,CAAA;AAED,EAAA,KAAA,MAAW,WAAW,QAAU,EAAA;AAC9B,IAAA,OAAA,CAAQ,IAAI,OAAO,CAAA,CAAA;AAAA,GACrB;AAEA,EAAA,MAAM,QAAQ,KAAM,EAAA,CAAA;AACtB;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/util/isDockerDisabledForTests.ts","../src/database/startMysqlContainer.ts","../src/database/startPostgresContainer.ts","../src/database/types.ts","../src/database/TestDatabases.ts","../src/msw/setupRequestMockHandlers.ts","../src/next/wiring/TestBackend.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @public */\nexport function isDockerDisabledForTests() {\n // If we are not running in continuous integration, the default is to skip\n // the (relatively heavy, long running) docker based tests. If you want to\n // still run local tests for all databases, just pass either the CI=1 env\n // parameter to your test runner, or individual connection strings per\n // database.\n return (\n Boolean(process.env.BACKSTAGE_TEST_DISABLE_DOCKER) ||\n !Boolean(process.env.CI)\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport createConnection, { Knex } from 'knex';\nimport { v4 as uuid } from 'uuid';\n\nasync function waitForMysqlReady(\n connection: Knex.MySqlConnectionConfig,\n): Promise<void> {\n const startTime = Date.now();\n const db = createConnection({ client: 'mysql2', connection });\n\n try {\n for (;;) {\n try {\n const result = await db.select(db.raw('version() AS version'));\n if (result[0]?.version) {\n return;\n }\n } catch (e) {\n if (Date.now() - startTime > 30_000) {\n throw new Error(\n `Timed out waiting for the database to be ready for connections, ${e}`,\n );\n }\n }\n\n await new Promise(resolve => setTimeout(resolve, 100));\n }\n } finally {\n db.destroy();\n }\n}\n\nexport async function startMysqlContainer(image: string) {\n const user = 'root';\n const password = uuid();\n\n // Lazy-load to avoid side-effect of importing testcontainers\n const { GenericContainer } = await import('testcontainers');\n\n const container = await new GenericContainer(image)\n .withExposedPorts(3306)\n .withEnv('MYSQL_ROOT_PASSWORD', password)\n .withTmpFs({ '/var/lib/mysql': 'rw' })\n .start();\n\n const host = container.getHost();\n const port = container.getMappedPort(3306);\n const stop = async () => {\n await container.stop({ timeout: 10_000 });\n };\n\n await waitForMysqlReady({ host, port, user, password });\n\n return { host, port, user, password, stop };\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport createConnection, { Knex } from 'knex';\nimport { v4 as uuid } from 'uuid';\n\nasync function waitForPostgresReady(\n connection: Knex.PgConnectionConfig,\n): Promise<void> {\n const startTime = Date.now();\n const db = createConnection({ client: 'pg', connection });\n\n try {\n for (;;) {\n try {\n const result = await db.select(db.raw('version()'));\n if (Array.isArray(result) && result[0]?.version) {\n return;\n }\n } catch (e) {\n if (Date.now() - startTime > 30_000) {\n throw new Error(\n `Timed out waiting for the database to be ready for connections, ${e}`,\n );\n }\n }\n\n await new Promise(resolve => setTimeout(resolve, 100));\n }\n } finally {\n db.destroy();\n }\n}\n\nexport async function startPostgresContainer(image: string) {\n const user = 'postgres';\n const password = uuid();\n\n // Lazy-load to avoid side-effect of importing testcontainers\n const { GenericContainer } = await import('testcontainers');\n\n const container = await new GenericContainer(image)\n .withExposedPorts(5432)\n .withEnv('POSTGRES_PASSWORD', password)\n .withTmpFs({ '/var/lib/postgresql/data': 'rw' })\n .start();\n\n const host = container.getHost();\n const port = container.getMappedPort(5432);\n const stop = async () => {\n await container.stop({ timeout: 10_000 });\n };\n\n await waitForPostgresReady({ host, port, user, password });\n\n return { host, port, user, password, stop };\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DatabaseManager } from '@backstage/backend-common';\nimport { Knex } from 'knex';\n\n/**\n * The possible databases to test against.\n *\n * @public\n */\nexport type TestDatabaseId =\n | 'POSTGRES_13'\n | 'POSTGRES_9'\n | 'MYSQL_8'\n | 'SQLITE_3';\n\nexport type TestDatabaseProperties = {\n name: string;\n driver: string;\n dockerImageName?: string;\n connectionStringEnvironmentVariableName?: string;\n};\n\nexport type Instance = {\n stopContainer?: () => Promise<void>;\n databaseManager: DatabaseManager;\n connections: Array<Knex>;\n};\n\nexport const allDatabases: Record<TestDatabaseId, TestDatabaseProperties> =\n Object.freeze({\n POSTGRES_13: {\n name: 'Postgres 13.x',\n driver: 'pg',\n dockerImageName: 'postgres:13',\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING',\n },\n POSTGRES_9: {\n name: 'Postgres 9.x',\n driver: 'pg',\n dockerImageName: 'postgres:9',\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING',\n },\n MYSQL_8: {\n name: 'MySQL 8.x',\n driver: 'mysql2',\n dockerImageName: 'mysql:8',\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING',\n },\n SQLITE_3: {\n name: 'SQLite 3.x',\n driver: 'better-sqlite3',\n },\n });\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DatabaseManager } from '@backstage/backend-common';\nimport { ConfigReader } from '@backstage/config';\nimport { randomBytes } from 'crypto';\nimport { Knex } from 'knex';\nimport { isDockerDisabledForTests } from '../util/isDockerDisabledForTests';\nimport { startMysqlContainer } from './startMysqlContainer';\nimport { startPostgresContainer } from './startPostgresContainer';\nimport {\n allDatabases,\n Instance,\n TestDatabaseId,\n TestDatabaseProperties,\n} from './types';\n\nconst LARGER_POOL_CONFIG = {\n pool: {\n min: 0,\n max: 50,\n },\n};\n\n/**\n * Encapsulates the creation of ephemeral test database instances for use\n * inside unit or integration tests.\n *\n * @public\n */\nexport class TestDatabases {\n private readonly instanceById: Map<string, Instance>;\n private readonly supportedIds: TestDatabaseId[];\n\n /**\n * Creates an empty `TestDatabases` instance, and sets up Jest to clean up\n * all of its acquired resources after all tests finish.\n *\n * You typically want to create just a single instance like this at the top\n * of your test file or `describe` block, and then call `init` many times on\n * that instance inside the individual tests. Spinning up a \"physical\"\n * database instance takes a considerable amount of time, slowing down tests.\n * But initializing a new logical database inside that instance using `init`\n * is very fast.\n */\n static create(options?: {\n ids?: TestDatabaseId[];\n disableDocker?: boolean;\n }): TestDatabases {\n const defaultOptions = {\n ids: Object.keys(allDatabases) as TestDatabaseId[],\n disableDocker: isDockerDisabledForTests(),\n };\n\n const { ids, disableDocker } = Object.assign(\n {},\n defaultOptions,\n options ?? {},\n );\n\n const supportedIds = ids.filter(id => {\n const properties = allDatabases[id];\n if (!properties) {\n return false;\n }\n // If the caller has set up the env with an explicit connection string,\n // we'll assume that this database will work\n if (\n properties.connectionStringEnvironmentVariableName &&\n process.env[properties.connectionStringEnvironmentVariableName]\n ) {\n return true;\n }\n // If the database doesn't require docker at all, there's nothing to worry\n // about\n if (!properties.dockerImageName) {\n return true;\n }\n // If the database requires docker, but docker is disabled, we will fail.\n if (disableDocker) {\n return false;\n }\n return true;\n });\n\n const databases = new TestDatabases(supportedIds);\n\n if (supportedIds.length > 0) {\n afterAll(async () => {\n await databases.shutdown();\n });\n }\n\n return databases;\n }\n\n private constructor(supportedIds: TestDatabaseId[]) {\n this.instanceById = new Map();\n this.supportedIds = supportedIds;\n }\n\n supports(id: TestDatabaseId): boolean {\n return this.supportedIds.includes(id);\n }\n\n eachSupportedId(): [TestDatabaseId][] {\n return this.supportedIds.map(id => [id]);\n }\n\n /**\n * Returns a fresh, unique, empty logical database on an instance of the\n * given database ID platform.\n *\n * @param id - The ID of the database platform to use, e.g. 'POSTGRES_13'\n * @returns A `Knex` connection object\n */\n async init(id: TestDatabaseId): Promise<Knex> {\n const properties = allDatabases[id];\n if (!properties) {\n const candidates = Object.keys(allDatabases).join(', ');\n throw new Error(\n `Unknown test database ${id}, possible values are ${candidates}`,\n );\n }\n if (!this.supportedIds.includes(id)) {\n const candidates = this.supportedIds.join(', ');\n throw new Error(\n `Unsupported test database ${id} for this environment, possible values are ${candidates}`,\n );\n }\n\n let instance: Instance | undefined = this.instanceById.get(id);\n\n // Ensure that a testcontainers instance is up for this ID\n if (!instance) {\n instance = await this.initAny(properties);\n this.instanceById.set(id, instance);\n }\n\n // Ensure that a unique logical database is created in the instance\n const connection = await instance.databaseManager\n .forPlugin(`db${randomBytes(16).toString('hex')}`)\n .getClient();\n\n instance.connections.push(connection);\n\n return connection;\n }\n\n private async initAny(properties: TestDatabaseProperties): Promise<Instance> {\n // Use the connection string if provided\n if (properties.driver === 'pg' || properties.driver === 'mysql2') {\n const envVarName = properties.connectionStringEnvironmentVariableName;\n if (envVarName) {\n const connectionString = process.env[envVarName];\n if (connectionString) {\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n knexConfig: properties.driver.includes('sqlite')\n ? {}\n : LARGER_POOL_CONFIG,\n client: properties.driver,\n connection: connectionString,\n },\n },\n }),\n );\n return {\n databaseManager,\n connections: [],\n };\n }\n }\n }\n\n // Otherwise start a container for the purpose\n switch (properties.driver) {\n case 'pg':\n return this.initPostgres(properties);\n case 'mysql2':\n return this.initMysql(properties);\n case 'better-sqlite3':\n case 'sqlite3':\n return this.initSqlite(properties);\n default:\n throw new Error(`Unknown database driver ${properties.driver}`);\n }\n }\n\n private async initPostgres(\n properties: TestDatabaseProperties,\n ): Promise<Instance> {\n const { host, port, user, password, stop } = await startPostgresContainer(\n properties.dockerImageName!,\n );\n\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n knexConfig: LARGER_POOL_CONFIG,\n client: 'pg',\n connection: { host, port, user, password },\n },\n },\n }),\n );\n\n return {\n stopContainer: stop,\n databaseManager,\n connections: [],\n };\n }\n\n private async initMysql(\n properties: TestDatabaseProperties,\n ): Promise<Instance> {\n const { host, port, user, password, stop } = await startMysqlContainer(\n properties.dockerImageName!,\n );\n\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n knexConfig: LARGER_POOL_CONFIG,\n client: 'mysql2',\n connection: { host, port, user, password },\n },\n },\n }),\n );\n\n return {\n stopContainer: stop,\n databaseManager,\n connections: [],\n };\n }\n\n private async initSqlite(\n properties: TestDatabaseProperties,\n ): Promise<Instance> {\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n client: properties.driver,\n connection: ':memory:',\n },\n },\n }),\n );\n\n return {\n databaseManager,\n connections: [],\n };\n }\n\n private async shutdown() {\n const instances = [...this.instanceById.values()];\n await Promise.all(\n instances.map(async ({ stopContainer, connections }) => {\n try {\n await Promise.all(connections.map(c => c.destroy()));\n } catch {\n // ignore\n }\n try {\n await stopContainer?.();\n } catch {\n // ignore\n }\n }),\n );\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Sets up handlers for request mocking\n * @public\n * @param worker - service worker\n */\nexport function setupRequestMockHandlers(worker: {\n listen: (t: any) => void;\n close: () => void;\n resetHandlers: () => void;\n}) {\n beforeAll(() => worker.listen({ onUnhandledRequest: 'error' }));\n afterAll(() => worker.close());\n afterEach(() => worker.resetHandlers());\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createSpecializedBackend } from '@backstage/backend-app-api';\nimport {\n ServiceFactory,\n ServiceRef,\n createServiceFactory,\n BackendFeature,\n ExtensionPoint,\n} from '@backstage/backend-plugin-api';\n\n/** @alpha */\nexport interface TestBackendOptions<\n TServices extends any[],\n TExtensionPoints extends any[],\n> {\n services?: readonly [\n ...{\n [index in keyof TServices]:\n | ServiceFactory<TServices[index]>\n | (() => ServiceFactory<TServices[index]>)\n | [ServiceRef<TServices[index]>, Partial<TServices[index]>];\n },\n ];\n extensionPoints?: readonly [\n ...{\n [index in keyof TExtensionPoints]: [\n ExtensionPoint<TExtensionPoints[index]>,\n Partial<TExtensionPoints[index]>,\n ];\n },\n ];\n features?: BackendFeature[];\n}\n\n/** @alpha */\nexport async function startTestBackend<\n TServices extends any[],\n TExtensionPoints extends any[],\n>(options: TestBackendOptions<TServices, TExtensionPoints>): Promise<void> {\n const {\n services = [],\n extensionPoints = [],\n features = [],\n ...otherOptions\n } = options;\n\n const factories = services.map(serviceDef => {\n if (Array.isArray(serviceDef)) {\n // if type is ExtensionPoint?\n // do something differently?\n const [ref, impl] = serviceDef;\n if (ref.scope === 'plugin') {\n return createServiceFactory({\n service: ref,\n deps: {},\n factory: async () => async () => impl,\n });\n }\n return createServiceFactory({\n service: ref,\n deps: {},\n factory: async () => impl,\n });\n }\n return serviceDef as ServiceFactory;\n });\n\n const backend = createSpecializedBackend({\n ...otherOptions,\n services: factories,\n });\n\n backend.add({\n id: `---test-extension-point-registrar`,\n register(reg) {\n for (const [ref, impl] of extensionPoints) {\n reg.registerExtensionPoint(ref, impl);\n }\n\n reg.registerInit({ deps: {}, async init() {} });\n },\n });\n\n for (const feature of features) {\n backend.add(feature);\n }\n\n await backend.start();\n}\n"],"names":["createConnection","uuid","randomBytes","DatabaseManager","ConfigReader","createServiceFactory","createSpecializedBackend"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,SAAS,wBAA2B,GAAA;AAMzC,EACE,OAAA,OAAA,CAAQ,QAAQ,GAAI,CAAA,6BAA6B,KACjD,CAAC,OAAA,CAAQ,OAAQ,CAAA,GAAA,CAAI,EAAE,CAAA,CAAA;AAE3B;;ACRA,eAAe,kBACb,UACe,EAAA;AArBjB,EAAA,IAAA,EAAA,CAAA;AAsBE,EAAM,MAAA,SAAA,GAAY,KAAK,GAAI,EAAA,CAAA;AAC3B,EAAA,MAAM,KAAKA,oCAAiB,CAAA,EAAE,MAAQ,EAAA,QAAA,EAAU,YAAY,CAAA,CAAA;AAE5D,EAAI,IAAA;AACF,IAAS,WAAA;AACP,MAAI,IAAA;AACF,Q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H;AACA,IAAO,OAAA,UAAA,CAAA;AAAA,GACR,CAAA,CAAA;AAED,EAAA,MAAM,UAAUC,sCAAyB,CAAA;AAAA,IACvC,GAAG,YAAA;AAAA,IACH,QAAU,EAAA,SAAA;AAAA,GACX,CAAA,CAAA;AAED,EAAA,OAAA,CAAQ,GAAI,CAAA;AAAA,IACV,EAAI,EAAA,CAAA,iCAAA,CAAA;AAAA,IACJ,SAAS,GAAK,EAAA;AACZ,MAAA,KAAA,MAAW,CAAC,GAAA,EAAK,IAAI,CAAA,IAAK,eAAiB,EAAA;AACzC,QAAI,GAAA,CAAA,sBAAA,CAAuB,KAAK,IAAI,CAAA,CAAA;AAAA,OACtC;AAEA,MAAA,GAAA,CAAI,aAAa,EAAE,IAAA,EAAM,EAAC,EAAG,MAAM,IAAO,GAAA;AAAA,SAAI,CAAA,CAAA;AAAA,KAChD;AAAA,GACD,CAAA,CAAA;AAED,EAAA,KAAA,MAAW,WAAW,QAAU,EAAA;AAC9B,IAAA,OAAA,CAAQ,IAAI,OAAO,CAAA,CAAA;AAAA,GACrB;AAEA,EAAA,MAAM,QAAQ,KAAM,EAAA,CAAA;AACtB;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/backend-test-utils",
|
|
3
3
|
"description": "Test helpers library for Backstage backends",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.29-next.0",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"publishConfig": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"start": "backstage-cli package start"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@backstage/backend-app-api": "^0.2.
|
|
38
|
-
"@backstage/backend-common": "^0.15.
|
|
39
|
-
"@backstage/backend-plugin-api": "^0.1.
|
|
40
|
-
"@backstage/cli": "^0.
|
|
41
|
-
"@backstage/config": "^1.0.
|
|
37
|
+
"@backstage/backend-app-api": "^0.2.2-next.0",
|
|
38
|
+
"@backstage/backend-common": "^0.15.2-next.0",
|
|
39
|
+
"@backstage/backend-plugin-api": "^0.1.3-next.0",
|
|
40
|
+
"@backstage/cli": "^0.20.0-next.0",
|
|
41
|
+
"@backstage/config": "^1.0.3-next.0",
|
|
42
42
|
"better-sqlite3": "^7.5.0",
|
|
43
43
|
"knex": "^2.0.0",
|
|
44
44
|
"msw": "^0.47.0",
|
|
@@ -48,11 +48,10 @@
|
|
|
48
48
|
"uuid": "^8.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@backstage/cli": "^0.
|
|
51
|
+
"@backstage/cli": "^0.20.0-next.0"
|
|
52
52
|
},
|
|
53
53
|
"files": [
|
|
54
54
|
"dist",
|
|
55
55
|
"alpha"
|
|
56
|
-
]
|
|
57
|
-
|
|
58
|
-
}
|
|
56
|
+
]
|
|
57
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2020 The Backstage Authors
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|