diff --git a/.changeset/tasty-colts-hug.md b/.changeset/tasty-colts-hug.md index 942f766a6e..e5957baf29 100644 --- a/.changeset/tasty-colts-hug.md +++ b/.changeset/tasty-colts-hug.md @@ -1,6 +1,7 @@ --- -'@backstage/plugin-azure-functions': major -'@backstage/plugin-azure-functions-backend': major +'@backstage/plugin-azure-functions': minor +'@backstage/plugin-azure-functions-backend': minor +'@backstage/plugin-azure-functions-common': minor --- Azure Functions Plugin support based on annotation supplied by the entity. diff --git a/packages/app/package.json b/packages/app/package.json index 1872b728a9..8632392fc6 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -19,7 +19,7 @@ "@backstage/plugin-apache-airflow": "^0.2.2-next.2", "@backstage/plugin-api-docs": "^0.8.9-next.2", "@backstage/plugin-azure-devops": "^0.2.0-next.2", - "@backstage/plugin-azure-functions": "^0.1.0", + "@backstage/plugin-azure-functions": "^0.0.0", "@backstage/plugin-badges": "^0.2.33-next.2", "@backstage/plugin-catalog-common": "^1.0.6-next.0", "@backstage/plugin-catalog-graph": "^0.2.21-next.1", diff --git a/packages/backend/package.json b/packages/backend/package.json index 23a63226cf..47c09e34f1 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -36,7 +36,7 @@ "@backstage/plugin-auth-backend": "^0.16.0-next.2", "@backstage/plugin-auth-node": "^0.2.5-next.2", "@backstage/plugin-azure-devops-backend": "^0.3.15-next.1", - "@backstage/plugin-azure-functions-backend": "^0.1.0", + "@backstage/plugin-azure-functions-backend": "^0.0.0", "@backstage/plugin-badges-backend": "^0.1.30-next.0", "@backstage/plugin-catalog-backend": "^1.4.0-next.2", "@backstage/plugin-code-coverage-backend": "^0.2.2-next.1", diff --git a/plugins/azure-functions-backend/README.md b/plugins/azure-functions-backend/README.md index abe1a7b148..4d78d682b6 100644 --- a/plugins/azure-functions-backend/README.md +++ b/plugins/azure-functions-backend/README.md @@ -38,8 +38,7 @@ Here's how to get the backend plugin up and running: ```sh # From the Backstage root directory - cd packages/backend - yarn add @backstage/plugin-azure-functions-backend + yarn add --cwd packages/backend @backstage/plugin-azure-functions-backend ``` 2. Then we will create a new file named `packages/backend/src/plugins/azure-functions.ts`, and add the following to it: diff --git a/plugins/azure-functions-backend/api-report.md b/plugins/azure-functions-backend/api-report.md index f9e74f4161..ce873f76a2 100644 --- a/plugins/azure-functions-backend/api-report.md +++ b/plugins/azure-functions-backend/api-report.md @@ -6,7 +6,7 @@ import { AzureFunctionsAllowedSubscriptionsConfig } from '@backstage/plugin-azure-functions-common'; import { Config } from '@backstage/config'; import express from 'express'; -import { FunctionsData } from '@backstage/plugin-azure-functions-common'; +import { FunctionsListResponse } from '@backstage/plugin-azure-functions-common'; import { Logger } from 'winston'; // @public (undocumented) @@ -38,7 +38,11 @@ export class AzureWebManagementApi { // (undocumented) static fromConfig(config: Config): AzureWebManagementApi; // (undocumented) - list({ functionName }: { functionName: string }): Promise; + list({ + functionName, + }: { + functionName: string; + }): Promise; } // @public (undocumented) diff --git a/plugins/azure-functions-backend/package.json b/plugins/azure-functions-backend/package.json index 318608579c..5a4196ee6d 100644 --- a/plugins/azure-functions-backend/package.json +++ b/plugins/azure-functions-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-azure-functions-backend", - "version": "0.1.0", + "version": "0.0.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -38,7 +38,7 @@ "@azure/identity": "^2.1.0", "@backstage/backend-common": "^0.15.1-next.2", "@backstage/config": "^1.0.1", - "@backstage/plugin-azure-functions-common": "^0.0.1", + "@backstage/plugin-azure-functions-common": "^0.0.0", "@types/express": "*", "express": "^4.17.1", "express-promise-router": "^4.1.0", @@ -49,8 +49,7 @@ "devDependencies": { "@backstage/cli": "^0.19.0-next.2", "@types/supertest": "^2.0.8", - "msw": "^0.44.0", - "supertest": "^4.0.2" + "msw": "^0.44.0" }, "files": [ "dist" diff --git a/plugins/azure-functions-backend/src/api/AzureWebManagementApi.ts b/plugins/azure-functions-backend/src/api/AzureWebManagementApi.ts index ef801169c3..9fe2a77b6c 100644 --- a/plugins/azure-functions-backend/src/api/AzureWebManagementApi.ts +++ b/plugins/azure-functions-backend/src/api/AzureWebManagementApi.ts @@ -19,7 +19,7 @@ import { ClientSecretCredential } from '@azure/identity'; import { WebSiteManagementClient } from '@azure/arm-appservice'; import { AzureFunctionsAllowedSubscriptionsConfig, - FunctionsData, + FunctionsListResponse, } from '@backstage/plugin-azure-functions-common'; /** @public */ @@ -77,8 +77,8 @@ export class AzureWebManagementApi { functionName, }: { functionName: string; - }): Promise { - const results = []; + }): Promise { + const items = []; for (const client of this.clients) { try { for await (const webApp of client.webApps.list()) { @@ -86,7 +86,7 @@ export class AzureWebManagementApi { continue; } const v = webApp!; - results.push({ + items.push({ href: `${this.baseHref(this.config.domain)}${v.id!}`, logstreamHref: `${this.baseHref( this.config.domain, @@ -103,6 +103,6 @@ export class AzureWebManagementApi { console.log(ex); } } - return results; + return { items: items }; } } diff --git a/plugins/azure-functions-common/api-report.md b/plugins/azure-functions-common/api-report.md index a7d47adb1a..dff50e2100 100644 --- a/plugins/azure-functions-common/api-report.md +++ b/plugins/azure-functions-common/api-report.md @@ -23,5 +23,10 @@ export type FunctionsData = { lastModifiedDate: Date; }; +// @public (undocumented) +export type FunctionsListResponse = { + items: FunctionsData[]; +}; + // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/azure-functions-common/package.json b/plugins/azure-functions-common/package.json index 3880b8965d..8bbf7ea9bf 100644 --- a/plugins/azure-functions-common/package.json +++ b/plugins/azure-functions-common/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/plugin-azure-functions-common", "description": "Common functionalities for the azure-functions plugin", - "version": "0.0.1", + "version": "0.0.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", diff --git a/plugins/azure-functions-common/src/types.ts b/plugins/azure-functions-common/src/types.ts index 4ec50ffb15..4c4c465d5e 100644 --- a/plugins/azure-functions-common/src/types.ts +++ b/plugins/azure-functions-common/src/types.ts @@ -31,3 +31,8 @@ export type FunctionsData = { containerSize: number; lastModifiedDate: Date; }; + +/** @public */ +export type FunctionsListResponse = { + items: FunctionsData[]; +}; diff --git a/plugins/azure-functions/api-report.md b/plugins/azure-functions/api-report.md index e217c5d65a..949eafab89 100644 --- a/plugins/azure-functions/api-report.md +++ b/plugins/azure-functions/api-report.md @@ -9,7 +9,7 @@ import { ApiRef } from '@backstage/core-plugin-api'; import { BackstagePlugin } from '@backstage/core-plugin-api'; import { DiscoveryApi } from '@backstage/core-plugin-api'; import { Entity } from '@backstage/catalog-model'; -import { FunctionsData } from '@backstage/plugin-azure-functions-common'; +import { FunctionsListResponse } from '@backstage/plugin-azure-functions-common'; import { IdentityApi } from '@backstage/core-plugin-api'; import { RouteRef } from '@backstage/core-plugin-api'; @@ -19,7 +19,7 @@ export type AzureFunctionsApi = { functionName, }: { functionName: string; - }) => Promise; + }) => Promise; }; // @public (undocumented) @@ -32,7 +32,11 @@ export class AzureFunctionsBackendClient implements AzureFunctionsApi { identityApi: IdentityApi; }); // (undocumented) - list({ functionName }: { functionName: string }): Promise; + list({ + functionName, + }: { + functionName: string; + }): Promise; } // @public (undocumented) diff --git a/plugins/azure-functions/package.json b/plugins/azure-functions/package.json index 5f083bf338..f53269caf9 100644 --- a/plugins/azure-functions/package.json +++ b/plugins/azure-functions/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-azure-functions", - "version": "0.1.0", + "version": "0.0.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -37,7 +37,7 @@ "@backstage/catalog-model": "^1.1.0", "@backstage/core-components": "^0.11.1-next.2", "@backstage/core-plugin-api": "^1.0.6-next.2", - "@backstage/plugin-azure-functions-common": "^0.0.1", + "@backstage/plugin-azure-functions-common": "^0.0.0", "@backstage/plugin-catalog-react": "^1.1.4-next.1", "@backstage/theme": "^0.2.16", "@material-ui/core": "^4.9.13", diff --git a/plugins/azure-functions/src/api/AzureFunctionsApi.ts b/plugins/azure-functions/src/api/AzureFunctionsApi.ts index 914ba7c351..0f7bf08bcd 100644 --- a/plugins/azure-functions/src/api/AzureFunctionsApi.ts +++ b/plugins/azure-functions/src/api/AzureFunctionsApi.ts @@ -15,7 +15,7 @@ */ import { createApiRef } from '@backstage/core-plugin-api'; -import { FunctionsData } from '@backstage/plugin-azure-functions-common'; +import { FunctionsListResponse } from '@backstage/plugin-azure-functions-common'; /** @public */ export const azureFunctionsApiRef = createApiRef({ @@ -28,5 +28,5 @@ export type AzureFunctionsApi = { functionName, }: { functionName: string; - }) => Promise; + }) => Promise; }; diff --git a/plugins/azure-functions/src/api/AzureFunctionsBackendClient.ts b/plugins/azure-functions/src/api/AzureFunctionsBackendClient.ts index bdc13f3e0c..58c1d9544d 100644 --- a/plugins/azure-functions/src/api/AzureFunctionsBackendClient.ts +++ b/plugins/azure-functions/src/api/AzureFunctionsBackendClient.ts @@ -15,7 +15,7 @@ */ import { AzureFunctionsApi } from './AzureFunctionsApi'; -import { FunctionsData } from '@backstage/plugin-azure-functions-common'; +import { FunctionsListResponse } from '@backstage/plugin-azure-functions-common'; import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api'; /** @public */ @@ -34,7 +34,7 @@ export class AzureFunctionsBackendClient implements AzureFunctionsApi { functionName, }: { functionName: string; - }): Promise { + }): Promise { try { const url = `${await this.discoveryApi.getBaseUrl( 'azure-functions', diff --git a/plugins/azure-functions/src/components/AzureFunctionsOverviewComponent/AzureFunctionsOverview.tsx b/plugins/azure-functions/src/components/AzureFunctionsOverviewComponent/AzureFunctionsOverview.tsx index 381bc8069e..9ec8b9b80a 100644 --- a/plugins/azure-functions/src/components/AzureFunctionsOverviewComponent/AzureFunctionsOverview.tsx +++ b/plugins/azure-functions/src/components/AzureFunctionsOverviewComponent/AzureFunctionsOverview.tsx @@ -50,7 +50,7 @@ const AzureFunctionsOverview = ({ entity }: { entity: Entity }) => { return ( ); diff --git a/plugins/azure-functions/src/hooks/useFunctions.ts b/plugins/azure-functions/src/hooks/useFunctions.ts index 22d8e339a7..f10e98090c 100644 --- a/plugins/azure-functions/src/hooks/useFunctions.ts +++ b/plugins/azure-functions/src/hooks/useFunctions.ts @@ -16,7 +16,7 @@ import useAsyncRetry from 'react-use/lib/useAsyncRetry'; import { useApi, errorApiRef } from '@backstage/core-plugin-api'; -import { FunctionsData } from '@backstage/plugin-azure-functions-common'; +import { FunctionsListResponse } from '@backstage/plugin-azure-functions-common'; import { azureFunctionsApiRef } from '../api'; import { useCallback } from 'react'; @@ -37,7 +37,7 @@ export function useFunctions({ functionsName }: { functionsName: string }) { value: data, error, retry, - } = useAsyncRetry(async () => { + } = useAsyncRetry(async () => { try { const azureFunction = await list(); return azureFunction; diff --git a/yarn.lock b/yarn.lock index 7260cdc3f8..e89f18e39e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4141,7 +4141,7 @@ __metadata: languageName: unknown linkType: soft -"@backstage/plugin-azure-functions-backend@^0.1.0, @backstage/plugin-azure-functions-backend@workspace:plugins/azure-functions-backend": +"@backstage/plugin-azure-functions-backend@^0.0.0, @backstage/plugin-azure-functions-backend@workspace:plugins/azure-functions-backend": version: 0.0.0-use.local resolution: "@backstage/plugin-azure-functions-backend@workspace:plugins/azure-functions-backend" dependencies: @@ -4150,20 +4150,19 @@ __metadata: "@backstage/backend-common": ^0.15.1-next.2 "@backstage/cli": ^0.19.0-next.2 "@backstage/config": ^1.0.1 - "@backstage/plugin-azure-functions-common": ^0.0.1 + "@backstage/plugin-azure-functions-common": ^0.0.0 "@types/express": "*" "@types/supertest": ^2.0.8 express: ^4.17.1 express-promise-router: ^4.1.0 msw: ^0.44.0 node-fetch: ^2.6.7 - supertest: ^4.0.2 winston: ^3.2.1 yn: ^4.0.0 languageName: unknown linkType: soft -"@backstage/plugin-azure-functions-common@^0.0.1, @backstage/plugin-azure-functions-common@workspace:plugins/azure-functions-common": +"@backstage/plugin-azure-functions-common@^0.0.0, @backstage/plugin-azure-functions-common@workspace:plugins/azure-functions-common": version: 0.0.0-use.local resolution: "@backstage/plugin-azure-functions-common@workspace:plugins/azure-functions-common" dependencies: @@ -4171,7 +4170,7 @@ __metadata: languageName: unknown linkType: soft -"@backstage/plugin-azure-functions@^0.1.0, @backstage/plugin-azure-functions@workspace:plugins/azure-functions": +"@backstage/plugin-azure-functions@^0.0.0, @backstage/plugin-azure-functions@workspace:plugins/azure-functions": version: 0.0.0-use.local resolution: "@backstage/plugin-azure-functions@workspace:plugins/azure-functions" dependencies: @@ -4181,7 +4180,7 @@ __metadata: "@backstage/core-components": ^0.11.1-next.2 "@backstage/core-plugin-api": ^1.0.6-next.2 "@backstage/dev-utils": ^1.0.6-next.1 - "@backstage/plugin-azure-functions-common": ^0.0.1 + "@backstage/plugin-azure-functions-common": ^0.0.0 "@backstage/plugin-catalog-react": ^1.1.4-next.1 "@backstage/test-utils": ^1.2.0-next.2 "@backstage/theme": ^0.2.16 @@ -19143,7 +19142,7 @@ __metadata: languageName: node linkType: hard -"component-emitter@npm:^1.2.0, component-emitter@npm:^1.2.1, component-emitter@npm:^1.3.0, component-emitter@npm:~1.3.0": +"component-emitter@npm:^1.2.1, component-emitter@npm:^1.3.0, component-emitter@npm:~1.3.0": version: 1.3.0 resolution: "component-emitter@npm:1.3.0" checksum: b3c46de38ffd35c57d1c02488355be9f218e582aec72d72d1b8bbec95a3ac1b38c96cd6e03ff015577e68f550fbb361a3bfdbd9bb248be9390b7b3745691be6b @@ -19529,7 +19528,7 @@ __metadata: languageName: node linkType: hard -"cookiejar@npm:^2.1.0, cookiejar@npm:^2.1.3": +"cookiejar@npm:^2.1.3": version: 2.1.3 resolution: "cookiejar@npm:2.1.3" checksum: 88259983ebc52ceb23cdacfa48762b6a518a57872eff1c7ed01d214fff5cf492e2660d7d5c04700a28f1787a76811df39e8639f8e17670b3cf94ecd86e161f07 @@ -22534,7 +22533,7 @@ __metadata: "@backstage/plugin-apache-airflow": ^0.2.2-next.2 "@backstage/plugin-api-docs": ^0.8.9-next.2 "@backstage/plugin-azure-devops": ^0.2.0-next.2 - "@backstage/plugin-azure-functions": ^0.1.0 + "@backstage/plugin-azure-functions": ^0.0.0 "@backstage/plugin-badges": ^0.2.33-next.2 "@backstage/plugin-catalog-common": ^1.0.6-next.0 "@backstage/plugin-catalog-graph": ^0.2.21-next.1 @@ -22638,7 +22637,7 @@ __metadata: "@backstage/plugin-auth-backend": ^0.16.0-next.2 "@backstage/plugin-auth-node": ^0.2.5-next.2 "@backstage/plugin-azure-devops-backend": ^0.3.15-next.1 - "@backstage/plugin-azure-functions-backend": ^0.1.0 + "@backstage/plugin-azure-functions-backend": ^0.0.0 "@backstage/plugin-badges-backend": ^0.1.30-next.0 "@backstage/plugin-catalog-backend": ^1.4.0-next.2 "@backstage/plugin-code-coverage-backend": ^0.2.2-next.1 @@ -23560,7 +23559,7 @@ __metadata: languageName: node linkType: hard -"form-data@npm:^2.3.1, form-data@npm:^2.3.2, form-data@npm:^2.5.0": +"form-data@npm:^2.3.2, form-data@npm:^2.5.0": version: 2.5.1 resolution: "form-data@npm:2.5.1" dependencies: @@ -23631,13 +23630,6 @@ __metadata: languageName: node linkType: hard -"formidable@npm:^1.2.0": - version: 1.2.6 - resolution: "formidable@npm:1.2.6" - checksum: 2b68ed07ba88302b9c63f8eda94f19a460cef6017bfda48348f09f41d2a36660c9353137991618e0e4c3db115b41e4b8f6fa63bc973b7a7c91dec66acdd02a56 - languageName: node - linkType: hard - "formidable@npm:^2.0.1": version: 2.0.1 resolution: "formidable@npm:2.0.1" @@ -29899,7 +29891,7 @@ __metadata: languageName: node linkType: hard -"methods@npm:^1.0.0, methods@npm:^1.1.1, methods@npm:^1.1.2, methods@npm:~1.1.2": +"methods@npm:^1.0.0, methods@npm:^1.1.2, methods@npm:~1.1.2": version: 1.1.2 resolution: "methods@npm:1.1.2" checksum: 0917ff4041fa8e2f2fda5425a955fe16ca411591fbd123c0d722fcf02b73971ed6f764d85f0a6f547ce49ee0221ce2c19a5fa692157931cecb422984f1dcd13a @@ -30309,7 +30301,7 @@ __metadata: languageName: node linkType: hard -"mime@npm:1.6.0, mime@npm:^1.3.4, mime@npm:^1.4.1": +"mime@npm:1.6.0, mime@npm:^1.3.4": version: 1.6.0 resolution: "mime@npm:1.6.0" bin: @@ -34196,15 +34188,6 @@ __metadata: languageName: node linkType: hard -"qs@npm:^6.5.1": - version: 6.11.0 - resolution: "qs@npm:6.11.0" - dependencies: - side-channel: ^1.0.4 - checksum: 6e1f29dd5385f7488ec74ac7b6c92f4d09a90408882d0c208414a34dd33badc1a621019d4c799a3df15ab9b1d0292f97c1dd71dc7c045e69f81a8064e5af7297 - languageName: node - linkType: hard - "qs@npm:~6.5.2": version: 6.5.2 resolution: "qs@npm:6.5.2" @@ -38047,24 +38030,6 @@ __metadata: languageName: node linkType: hard -"superagent@npm:^3.8.3": - version: 3.8.3 - resolution: "superagent@npm:3.8.3" - dependencies: - component-emitter: ^1.2.0 - cookiejar: ^2.1.0 - debug: ^3.1.0 - extend: ^3.0.0 - form-data: ^2.3.1 - formidable: ^1.2.0 - methods: ^1.1.1 - mime: ^1.4.1 - qs: ^6.5.1 - readable-stream: ^2.3.5 - checksum: b13d0303259d76c9180bd40d97d9f0713760f5ced1aef089bdb2fcdf69cfaef89004cd6e986416d59bd9a2f0f9933d72521b5171fa26f89b781a2c3460c516fe - languageName: node - linkType: hard - "superagent@npm:^8.0.0": version: 8.0.0 resolution: "superagent@npm:8.0.0" @@ -38084,16 +38049,6 @@ __metadata: languageName: node linkType: hard -"supertest@npm:^4.0.2": - version: 4.0.2 - resolution: "supertest@npm:4.0.2" - dependencies: - methods: ^1.1.2 - superagent: ^3.8.3 - checksum: ec848088c5d0f6743a0829331c274f67ab4c2e5e6ba724f2fdf4965a73afa22d5091448323e28ae5b69137e42fe3ac67235dfc5b0a0acda3c088bdd193313319 - languageName: node - linkType: hard - "supertest@npm:^6.1.3, supertest@npm:^6.1.6, supertest@npm:^6.2.4": version: 6.2.4 resolution: "supertest@npm:6.2.4"