-
Notifications
You must be signed in to change notification settings - Fork 839
Repackage azure-devops-extensions-api to fix Azure DevOps report plugin #6299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a32cfb0
Repackage azure-devops-extensions-api
peterwald 1fa4c80
Unify headers
peterwald 7182185
Regenerate the package-lock.json file
peterwald 50dcd33
Remove unneeded packages
peterwald a83cef5
Make tsc build verbose
peterwald dc4dc09
Add debug flag for vite build
peterwald 92bb435
Add NPM build command for testing
peterwald d130ab9
Fix the tsc build
peterwald 3e577ae
Make sure we log stdout when an error occurs.
peterwald File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
...es/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/azure-devops-report/.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
override.json | ||
package-lock.json | ||
VSIXPackageVersion.json | ||
LICENSE | ||
LICENSE | ||
|
||
!Build |
32 changes: 32 additions & 0 deletions
32
...on.Reporting/TypeScript/azure-devops-report/src/azure-devops-extension-api/Build/Build.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
/* | ||
* --------------------------------------------------------- | ||
* Copyright(C) Microsoft Corporation. All rights reserved. | ||
* --------------------------------------------------------- | ||
*/ | ||
|
||
import * as TfsCore from "../Core/Core"; | ||
|
||
/** | ||
* Represents an attachment to a build. | ||
*/ | ||
export interface Attachment { | ||
_links: any; | ||
/** | ||
* The name of the attachment. | ||
*/ | ||
name: string; | ||
} | ||
|
||
/** | ||
* Data representation of a build. | ||
*/ | ||
export interface Build { | ||
/** | ||
* The ID of the build. | ||
*/ | ||
id: number; | ||
|
||
project: TfsCore.TeamProjectReference; | ||
} | ||
|
43 changes: 43 additions & 0 deletions
43
...orting/TypeScript/azure-devops-report/src/azure-devops-extension-api/Build/BuildClient.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* --------------------------------------------------------- | ||
* Copyright(C) Microsoft Corporation. All rights reserved. | ||
* --------------------------------------------------------- | ||
*/ | ||
|
||
import { IVssRestClientOptions } from "../Common/Context"; | ||
import { RestClientBase } from "../Common/RestClientBase"; | ||
|
||
import * as Build from "./Build"; | ||
|
||
export class BuildRestClient extends RestClientBase { | ||
constructor(options: IVssRestClientOptions) { | ||
super(options); | ||
} | ||
|
||
public static readonly RESOURCE_AREA_ID = "965220d5-5bb9-42cf-8d67-9b146df2a5a4"; | ||
|
||
/** | ||
* Gets the list of attachments of a specific type that are associated with a build. | ||
* | ||
* @param project - Project ID or project name | ||
* @param buildId - The ID of the build. | ||
* @param type - The type of attachment. | ||
*/ | ||
public async getAttachments( | ||
project: string, | ||
buildId: number, | ||
type: string | ||
): Promise<Build.Attachment[]> { | ||
|
||
return this.beginRequest<Build.Attachment[]>({ | ||
apiVersion: "7.2-preview.2", | ||
routeTemplate: "{project}/_apis/build/builds/{buildId}/attachments/{type}", | ||
routeValues: { | ||
project: project, | ||
buildId: buildId, | ||
type: type | ||
} | ||
}); | ||
} | ||
|
||
} |
2 changes: 2 additions & 0 deletions
2
...on.Reporting/TypeScript/azure-devops-report/src/azure-devops-extension-api/Build/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./Build"; | ||
export * from "./BuildClient"; |
40 changes: 40 additions & 0 deletions
40
....Reporting/TypeScript/azure-devops-report/src/azure-devops-extension-api/Common/Client.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
import { getAccessToken, getService } from "azure-devops-extension-sdk"; | ||
import { IVssRestClientOptions } from "./Context"; | ||
import { CommonServiceIds, ILocationService } from "./CommonServices"; | ||
|
||
/** | ||
* A REST client factory is the method used to create and initialize an IVssRestClient. | ||
*/ | ||
export type RestClientFactory<T> = { | ||
new (options: IVssRestClientOptions): T; | ||
RESOURCE_AREA_ID?: string; | ||
} | ||
|
||
export function getClient<T>(clientClass: RestClientFactory<T>, clientOptions?: IVssRestClientOptions) { | ||
|
||
const options = clientOptions || {}; | ||
|
||
if (!options.rootPath) { | ||
options.rootPath = getService<ILocationService>(CommonServiceIds.LocationService).then(locationService => { | ||
if (clientClass.RESOURCE_AREA_ID) { | ||
return locationService.getResourceAreaLocation(clientClass.RESOURCE_AREA_ID); | ||
} | ||
else { | ||
return locationService.getServiceLocation(); | ||
} | ||
}); | ||
} | ||
|
||
if (!options.authTokenProvider) { | ||
options.authTokenProvider = { | ||
getAuthorizationHeader: (): Promise<string> => { | ||
return getAccessToken().then(token => token ? ("Bearer " + token) : ""); | ||
} | ||
}; | ||
} | ||
|
||
return new clientClass(options); | ||
} |
68 changes: 68 additions & 0 deletions
68
...ng/TypeScript/azure-devops-report/src/azure-devops-extension-api/Common/CommonServices.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
/** | ||
* Contribution ids of core DevOps services which can be obtained from DevOps.getService | ||
*/ | ||
export const enum CommonServiceIds { | ||
|
||
/** | ||
* Service for getting URLs/locations from the host context | ||
*/ | ||
LocationService = "ms.vss-features.location-service", | ||
|
||
} | ||
|
||
/** | ||
* Host level for a VSS service | ||
*/ | ||
export const enum TeamFoundationHostType { | ||
/** | ||
* The Deployment host | ||
*/ | ||
Deployment = 1, | ||
|
||
/** | ||
* The Enterprise host | ||
*/ | ||
Enterprise = 2, | ||
|
||
/** | ||
* The organization/project collection host | ||
*/ | ||
Organization = 4 | ||
} | ||
|
||
/** | ||
* Service for external content to get locations | ||
*/ | ||
export interface ILocationService { | ||
|
||
/** | ||
* Gets the URL for the given REST resource area | ||
* | ||
* @param resourceAreaId - Id of the resource area | ||
*/ | ||
getResourceAreaLocation(resourceAreaId: string): Promise<string>; | ||
|
||
/** | ||
* Gets the location of a remote service at a given host type. | ||
* | ||
* @param serviceInstanceType - The GUID of the service instance type to lookup | ||
* @param hostType - The host type to lookup (defaults to the host type of the current page data) | ||
*/ | ||
getServiceLocation(serviceInstanceType?: string, hostType?: TeamFoundationHostType): Promise<string>; | ||
|
||
/** | ||
* Attemps to create a url for the specified route template and paramaters. The url will include host path. | ||
* For example, if the page url is https://dev.azure.com/foo and you try to create admin settings url for project "bar", | ||
* the output will be /foo/bar/_admin. | ||
* | ||
* This will asynchronously fetch a route contribution if it has not been included in page data. | ||
* | ||
* @param routeId - Id of the route contribution | ||
* @param routeValues - Route value replacements | ||
* @param hostPath - Optional host path to use rather than the default host path for the page. | ||
*/ | ||
routeUrl(routeId: string, routeValues?: { [key: string]: string }, hostPath?: string): Promise<string>; | ||
} |
43 changes: 43 additions & 0 deletions
43
...porting/TypeScript/azure-devops-report/src/azure-devops-extension-api/Common/Context.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
/** | ||
* Interface for a class that can retrieve authorization tokens to be used in fetch requests. | ||
*/ | ||
export interface IAuthorizationTokenProvider { | ||
/** | ||
* Gets the authorization header to use in a fetch request | ||
* | ||
* @param forceRefresh - If true, indicates that we should get a new token, if applicable for current provider. | ||
* @returns the value to use for the Authorization header in a request. | ||
*/ | ||
getAuthorizationHeader(forceRefresh?: boolean): Promise<string>; | ||
} | ||
|
||
/** | ||
* Options for a specific instance of a REST client. | ||
*/ | ||
export interface IVssRestClientOptions { | ||
|
||
/** | ||
* Auth token manager that can be used to get and attach auth tokens to requests. | ||
* If not supplied, the default token provider is used if the serviceInstanceType option is supplied | ||
* and is different from the hosting page's service instance type. | ||
*/ | ||
authTokenProvider?: IAuthorizationTokenProvider; | ||
|
||
/** | ||
* The root URL path to use for this client. Can be relative or absolute. | ||
*/ | ||
rootPath?: string | Promise<string>; | ||
|
||
/** | ||
* Current session id. | ||
*/ | ||
sessionId?: string; | ||
|
||
/** | ||
* Current command for activity logging. | ||
*/ | ||
command?: string; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.