Skip to content

Commit 4174d02

Browse files
authored
Merging pull request #18038
* wip * pnpm-lock.yaml * updates * pnpm-lock.yaml * pnpm-lock.yaml * update
1 parent 639ec5b commit 4174d02

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

components/azure_devops/azure_devops.app.mjs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { axios } from "@pipedream/platform";
1+
import {
2+
axios, ConfigurationError,
3+
} from "@pipedream/platform";
24
const API_VERSION = "5.0";
35

46
export default {
@@ -28,8 +30,14 @@ export default {
2830
_baseUrl() {
2931
return "https://dev.azure.com";
3032
},
31-
_headers() {
32-
const basicAuth = Buffer.from(`${this._oauthUid()}:${this._oauthAccessToken()}`).toString("base64");
33+
_headers(useOAuth) {
34+
const token = useOAuth
35+
? this._oauthAccessToken()
36+
: this._personalAccessToken();
37+
if (!token && !useOAuth) {
38+
throw new ConfigurationError("Azure DevOps Personal Access Token is required for this operation. Add it to your Azure DevOps connection.");
39+
}
40+
const basicAuth = Buffer.from(`${this._oauthUid()}:${token}`).toString("base64");
3341
return {
3442
Authorization: `Basic ${basicAuth}`,
3543
};
@@ -40,16 +48,20 @@ export default {
4048
_oauthUid() {
4149
return this.$auth.oauth_uid;
4250
},
51+
_personalAccessToken() {
52+
return this.$auth.personal_access_token;
53+
},
4354
_makeRequest(args = {}) {
4455
const {
4556
$ = this,
4657
url,
4758
path,
59+
useOAuth = false,
4860
...otherArgs
4961
} = args;
5062
const config = {
5163
url: url || `${this._baseUrl()}${path}`,
52-
headers: this._headers(),
64+
headers: this._headers(useOAuth),
5365
...otherArgs,
5466
};
5567
config.url += config.url.includes("?")
@@ -61,6 +73,7 @@ export default {
6173
async listAccounts(args = {}) {
6274
const { value } = await this._makeRequest({
6375
url: `https://app.vssps.visualstudio.com/_apis/accounts?memberId=${this._oauthUid()}`,
76+
useOAuth: true,
6477
...args,
6578
});
6679
return value;

components/azure_devops/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/azure_devops",
3-
"version": "0.0.4",
3+
"version": "0.1.0",
44
"description": "Pipedream Azure DevOps Components",
55
"main": "azure_devops.app.mjs",
66
"keywords": [
@@ -13,6 +13,6 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^1.2.1"
16+
"@pipedream/platform": "^3.1.0"
1717
}
1818
}

components/azure_devops/sources/new-event/new-event.mjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import azureDevops from "../../azure_devops.app.mjs";
22

33
export default {
44
name: "New Event (Instant)",
5-
version: "0.0.2",
5+
version: "0.0.3",
66
key: "azure_devops-new-event",
77
description: "Emit new event for the specified event type.",
88
type: "source",
@@ -40,9 +40,12 @@ export default {
4040
},
4141
eventType: this.eventType,
4242
};
43-
const { id } = await this.azureDevops.createSubscription(this.organization, {
44-
data,
45-
});
43+
const { id } = await this.azureDevops.createSubscription(
44+
this.organization,
45+
{
46+
data,
47+
},
48+
);
4649
this._setHookId(id);
4750
},
4851
async deactivate() {

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)