@activepieces/piece-azure-devops 0.0.3 → 0.0.5
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/package.json +7 -12
- package/src/index.js +24 -42
- package/src/index.d.ts +0 -5
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/add-comment.d.ts +0 -12
- package/src/lib/actions/add-comment.d.ts.map +0 -1
- package/src/lib/actions/add-comment.js +0 -59
- package/src/lib/actions/add-comment.js.map +0 -1
- package/src/lib/actions/create-work-item.d.ts +0 -27
- package/src/lib/actions/create-work-item.d.ts.map +0 -1
- package/src/lib/actions/create-work-item.js +0 -74
- package/src/lib/actions/create-work-item.js.map +0 -1
- package/src/lib/actions/get-work-item.d.ts +0 -11
- package/src/lib/actions/get-work-item.d.ts.map +0 -1
- package/src/lib/actions/get-work-item.js +0 -43
- package/src/lib/actions/get-work-item.js.map +0 -1
- package/src/lib/actions/list-work-items.d.ts +0 -12
- package/src/lib/actions/list-work-items.d.ts.map +0 -1
- package/src/lib/actions/list-work-items.js +0 -62
- package/src/lib/actions/list-work-items.js.map +0 -1
- package/src/lib/actions/update-work-item.d.ts +0 -67
- package/src/lib/actions/update-work-item.d.ts.map +0 -1
- package/src/lib/actions/update-work-item.js +0 -109
- package/src/lib/actions/update-work-item.js.map +0 -1
- package/src/lib/common/index.d.ts +0 -210
- package/src/lib/common/index.d.ts.map +0 -1
- package/src/lib/common/index.js +0 -581
- package/src/lib/common/index.js.map +0 -1
- package/src/lib/triggers/new-updated-work-item-webhook.d.ts +0 -68
- package/src/lib/triggers/new-updated-work-item-webhook.d.ts.map +0 -1
- package/src/lib/triggers/new-updated-work-item-webhook.js +0 -170
- package/src/lib/triggers/new-updated-work-item-webhook.js.map +0 -1
- package/src/lib/triggers/new-updated-work-item.d.ts +0 -91
- package/src/lib/triggers/new-updated-work-item.d.ts.map +0 -1
- package/src/lib/triggers/new-updated-work-item.js +0 -117
- package/src/lib/triggers/new-updated-work-item.js.map +0 -1
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
import { AzureDevOpsHookEvent } from '../common';
|
|
3
|
-
export declare const newUpdatedWorkItemWebhookTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
4
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
-
}>, {
|
|
7
|
-
project: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
8
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
10
|
-
}>>;
|
|
11
|
-
work_item_type: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
14
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
15
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
17
|
-
}>>;
|
|
18
|
-
events: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<AzureDevOpsHookEvent, true>;
|
|
19
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
20
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
21
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
22
|
-
}>, {
|
|
23
|
-
project: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
24
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
25
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
26
|
-
}>>;
|
|
27
|
-
work_item_type: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
28
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
29
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
30
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
31
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
32
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
33
|
-
}>>;
|
|
34
|
-
events: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<AzureDevOpsHookEvent, true>;
|
|
35
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
36
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
37
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
38
|
-
}>, {
|
|
39
|
-
project: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
40
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
41
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
42
|
-
}>>;
|
|
43
|
-
work_item_type: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
44
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
45
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
46
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
47
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
48
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
49
|
-
}>>;
|
|
50
|
-
events: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<AzureDevOpsHookEvent, true>;
|
|
51
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
52
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
53
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
54
|
-
}>, {
|
|
55
|
-
project: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
56
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
57
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
58
|
-
}>>;
|
|
59
|
-
work_item_type: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
60
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
61
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
62
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
63
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
64
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
65
|
-
}>>;
|
|
66
|
-
events: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<AzureDevOpsHookEvent, true>;
|
|
67
|
-
}>;
|
|
68
|
-
//# sourceMappingURL=new-updated-work-item-webhook.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-updated-work-item-webhook.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-updated-work-item-webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAGL,oBAAoB,EAKrB,MAAM,WAAW,CAAC;AA2BnB,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuG3C,CAAC"}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.newUpdatedWorkItemWebhookTrigger = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const common_1 = require("../common");
|
|
7
|
-
const TRIGGER_STORE_KEY = 'azure_devops_workitem_subscription_ids';
|
|
8
|
-
const TRIGGER_TOKEN_STORE_KEY = 'azure_devops_workitem_webhook_token';
|
|
9
|
-
const BASIC_AUTH_USERNAME = 'activepieces';
|
|
10
|
-
const sampleWebhookOutput = {
|
|
11
|
-
id: 123,
|
|
12
|
-
rev: 2,
|
|
13
|
-
url: 'https://dev.azure.com/myorg/_apis/wit/workItems/123',
|
|
14
|
-
title: 'Fix login page bug',
|
|
15
|
-
work_item_type: 'Bug',
|
|
16
|
-
state: 'Active',
|
|
17
|
-
reason: 'New',
|
|
18
|
-
assigned_to: 'John Doe',
|
|
19
|
-
assigned_to_email: 'john.doe@example.com',
|
|
20
|
-
created_date: '2024-03-15T10:30:00Z',
|
|
21
|
-
created_by: 'Jane Smith',
|
|
22
|
-
changed_date: '2024-03-15T14:45:00Z',
|
|
23
|
-
changed_by: 'John Doe',
|
|
24
|
-
area_path: 'MyProject\\Backend',
|
|
25
|
-
iteration_path: 'MyProject\\Sprint 5',
|
|
26
|
-
priority: 2,
|
|
27
|
-
description: '<p>Users cannot log in after password reset.</p>',
|
|
28
|
-
project: 'MyProject',
|
|
29
|
-
};
|
|
30
|
-
exports.newUpdatedWorkItemWebhookTrigger = (0, pieces_framework_1.createTrigger)({
|
|
31
|
-
auth: common_1.azureDevOpsAuth,
|
|
32
|
-
name: 'new_updated_work_item_webhook',
|
|
33
|
-
displayName: 'New or Updated Work Item (Instant)',
|
|
34
|
-
description: 'Fires instantly when a work item is created, updated, or commented on in Azure DevOps via a Service Hooks subscription. Requires a public webhook URL reachable from Azure DevOps.',
|
|
35
|
-
aiMetadata: {
|
|
36
|
-
description: 'Fires in real time via an Azure DevOps Service Hooks subscription when a work item in the chosen project is created, updated, or commented on, depending on which of those event types are selected. Optionally scope to a single work item type. Requires a publicly reachable webhook URL; use the Polling trigger instead when the instance is not internet-reachable.',
|
|
37
|
-
},
|
|
38
|
-
props: {
|
|
39
|
-
project: common_1.azureDevOpsCommon.projectDropdown,
|
|
40
|
-
work_item_type: common_1.azureDevOpsCommon.workItemTypeDropdownOptional,
|
|
41
|
-
events: pieces_framework_1.Property.StaticMultiSelectDropdown({
|
|
42
|
-
displayName: 'Events',
|
|
43
|
-
description: 'Which work item lifecycle events should trigger this flow. Select at least one.',
|
|
44
|
-
required: true,
|
|
45
|
-
defaultValue: ['workitem.created', 'workitem.updated'],
|
|
46
|
-
options: {
|
|
47
|
-
options: [...common_1.WEBHOOK_EVENT_OPTIONS],
|
|
48
|
-
},
|
|
49
|
-
}),
|
|
50
|
-
},
|
|
51
|
-
sampleData: sampleWebhookOutput,
|
|
52
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
53
|
-
onEnable(context) {
|
|
54
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
var _a;
|
|
56
|
-
const projectName = common_1.azureDevOpsCommon.narrowString(context.propsValue.project, 'project');
|
|
57
|
-
const workItemType = typeof context.propsValue.work_item_type === 'string' &&
|
|
58
|
-
context.propsValue.work_item_type.length > 0
|
|
59
|
-
? context.propsValue.work_item_type
|
|
60
|
-
: undefined;
|
|
61
|
-
const events = filterToHookEvents((_a = context.propsValue.events) !== null && _a !== void 0 ? _a : []);
|
|
62
|
-
const projectId = yield common_1.azureDevOpsCommon.fetchProjectId(context.auth, projectName);
|
|
63
|
-
if (!projectId) {
|
|
64
|
-
throw new Error(`Project "${projectName}" not found in Azure DevOps.`);
|
|
65
|
-
}
|
|
66
|
-
const token = common_1.azureDevOpsCommon.generateWebhookToken();
|
|
67
|
-
yield context.store.put(TRIGGER_TOKEN_STORE_KEY, token);
|
|
68
|
-
const subscriptionIds = [];
|
|
69
|
-
for (const event of events) {
|
|
70
|
-
const subscription = yield common_1.azureDevOpsCommon.createSubscription({
|
|
71
|
-
auth: context.auth,
|
|
72
|
-
projectId,
|
|
73
|
-
eventType: event,
|
|
74
|
-
webhookUrl: context.webhookUrl,
|
|
75
|
-
workItemType,
|
|
76
|
-
basicAuthUsername: BASIC_AUTH_USERNAME,
|
|
77
|
-
basicAuthPassword: token,
|
|
78
|
-
});
|
|
79
|
-
subscriptionIds.push(subscription.id);
|
|
80
|
-
yield context.store.put(TRIGGER_STORE_KEY, subscriptionIds);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
onDisable(context) {
|
|
85
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
var _a;
|
|
87
|
-
const subscriptionIds = (_a = (yield context.store.get(TRIGGER_STORE_KEY))) !== null && _a !== void 0 ? _a : [];
|
|
88
|
-
for (const subscriptionId of subscriptionIds) {
|
|
89
|
-
try {
|
|
90
|
-
yield common_1.azureDevOpsCommon.deleteSubscription({
|
|
91
|
-
auth: context.auth,
|
|
92
|
-
subscriptionId,
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
catch (_b) {
|
|
96
|
-
// best-effort cleanup: if the user already deleted the subscription
|
|
97
|
-
// in Azure DevOps, the DELETE will 404 and we intentionally swallow
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
yield context.store.delete(TRIGGER_STORE_KEY);
|
|
101
|
-
yield context.store.delete(TRIGGER_TOKEN_STORE_KEY);
|
|
102
|
-
});
|
|
103
|
-
},
|
|
104
|
-
run(context) {
|
|
105
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
106
|
-
const expectedToken = yield context.store.get(TRIGGER_TOKEN_STORE_KEY);
|
|
107
|
-
if (!expectedToken)
|
|
108
|
-
return [];
|
|
109
|
-
const authHeader = extractAuthHeader(context.payload.headers);
|
|
110
|
-
if (!authHeader || !verifyBasicAuth(authHeader, BASIC_AUTH_USERNAME, expectedToken)) {
|
|
111
|
-
return [];
|
|
112
|
-
}
|
|
113
|
-
const payload = common_1.azureDevOpsCommon.parseWebhookPayload(context.payload.body);
|
|
114
|
-
if (!payload)
|
|
115
|
-
return [];
|
|
116
|
-
if (payload.eventType === 'workitem.commented') {
|
|
117
|
-
return [flattenCommentEvent(payload)];
|
|
118
|
-
}
|
|
119
|
-
return [flattenResource(payload.resource)];
|
|
120
|
-
});
|
|
121
|
-
},
|
|
122
|
-
test() {
|
|
123
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
return [sampleWebhookOutput];
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
function flattenResource(resource) {
|
|
129
|
-
var _a, _b, _c, _d, _e, _f;
|
|
130
|
-
return common_1.azureDevOpsCommon.flattenWorkItem({
|
|
131
|
-
id: (_b = (_a = resource.id) !== null && _a !== void 0 ? _a : resource.workItemId) !== null && _b !== void 0 ? _b : 0,
|
|
132
|
-
rev: (_c = resource.rev) !== null && _c !== void 0 ? _c : 0,
|
|
133
|
-
url: resource.url,
|
|
134
|
-
fields: (_f = (_e = (_d = resource.revision) === null || _d === void 0 ? void 0 : _d.fields) !== null && _e !== void 0 ? _e : resource.fields) !== null && _f !== void 0 ? _f : {},
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
function flattenCommentEvent(payload) {
|
|
138
|
-
var _a, _b, _c;
|
|
139
|
-
const { resource } = payload;
|
|
140
|
-
return Object.assign(Object.assign({}, flattenResource(resource)), { comment: (_c = (_b = (_a = resource.revision) === null || _a === void 0 ? void 0 : _a.comment) === null || _b === void 0 ? void 0 : _b.content) !== null && _c !== void 0 ? _c : null });
|
|
141
|
-
}
|
|
142
|
-
function extractAuthHeader(headers) {
|
|
143
|
-
var _a;
|
|
144
|
-
const raw = (_a = headers['authorization']) !== null && _a !== void 0 ? _a : headers['Authorization'];
|
|
145
|
-
return typeof raw === 'string' ? raw : null;
|
|
146
|
-
}
|
|
147
|
-
function verifyBasicAuth(header, expectedUser, expectedToken) {
|
|
148
|
-
const prefix = 'Basic ';
|
|
149
|
-
if (!header.startsWith(prefix))
|
|
150
|
-
return false;
|
|
151
|
-
let decoded;
|
|
152
|
-
try {
|
|
153
|
-
decoded = Buffer.from(header.slice(prefix.length), 'base64').toString('utf-8');
|
|
154
|
-
}
|
|
155
|
-
catch (_a) {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
const sep = decoded.indexOf(':');
|
|
159
|
-
if (sep < 0)
|
|
160
|
-
return false;
|
|
161
|
-
const username = decoded.slice(0, sep);
|
|
162
|
-
const password = decoded.slice(sep + 1);
|
|
163
|
-
return (common_1.azureDevOpsCommon.timingSafeEqual(username, expectedUser) &&
|
|
164
|
-
common_1.azureDevOpsCommon.timingSafeEqual(password, expectedToken));
|
|
165
|
-
}
|
|
166
|
-
function filterToHookEvents(values) {
|
|
167
|
-
const allowed = common_1.WEBHOOK_EVENT_OPTIONS.map((o) => o.value);
|
|
168
|
-
return values.filter((v) => typeof v === 'string' && allowed.includes(v));
|
|
169
|
-
}
|
|
170
|
-
//# sourceMappingURL=new-updated-work-item-webhook.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-updated-work-item-webhook.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-updated-work-item-webhook.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,sCAQmB;AAEnB,MAAM,iBAAiB,GAAG,wCAAwC,CAAC;AACnE,MAAM,uBAAuB,GAAG,qCAAqC,CAAC;AACtE,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAE3C,MAAM,mBAAmB,GAAiB;IACxC,EAAE,EAAE,GAAG;IACP,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,qDAAqD;IAC1D,KAAK,EAAE,oBAAoB;IAC3B,cAAc,EAAE,KAAK;IACrB,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,UAAU;IACvB,iBAAiB,EAAE,sBAAsB;IACzC,YAAY,EAAE,sBAAsB;IACpC,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,sBAAsB;IACpC,UAAU,EAAE,UAAU;IACtB,SAAS,EAAE,oBAAoB;IAC/B,cAAc,EAAE,qBAAqB;IACrC,QAAQ,EAAE,CAAC;IACX,WAAW,EAAE,kDAAkD;IAC/D,OAAO,EAAE,WAAW;CACrB,CAAC;AAEW,QAAA,gCAAgC,GAAG,IAAA,gCAAa,EAAC;IAC5D,IAAI,EAAE,wBAAe;IACrB,IAAI,EAAE,+BAA+B;IACrC,WAAW,EAAE,oCAAoC;IACjD,WAAW,EACT,oLAAoL;IACtL,UAAU,EAAE;QACV,WAAW,EAAE,2WAA2W;KACzX;IACD,KAAK,EAAE;QACL,OAAO,EAAE,0BAAiB,CAAC,eAAe;QAC1C,cAAc,EAAE,0BAAiB,CAAC,4BAA4B;QAC9D,MAAM,EAAE,2BAAQ,CAAC,yBAAyB,CAAC;YACzC,WAAW,EAAE,QAAQ;YACrB,WAAW,EACT,iFAAiF;YACnF,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,CA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ggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const newUpdatedWorkItemTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
-
}>, {
|
|
6
|
-
project: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
7
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
9
|
-
}>>;
|
|
10
|
-
work_item_type: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
11
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
13
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
14
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
15
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
16
|
-
}>>;
|
|
17
|
-
state_filter: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
18
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
19
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
20
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
21
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
22
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
23
|
-
}>>;
|
|
24
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
25
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
26
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
27
|
-
}>, {
|
|
28
|
-
project: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
29
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
30
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
31
|
-
}>>;
|
|
32
|
-
work_item_type: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
33
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
34
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
35
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
36
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
37
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
38
|
-
}>>;
|
|
39
|
-
state_filter: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
40
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
41
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
42
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
43
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
44
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
45
|
-
}>>;
|
|
46
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
47
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
48
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
49
|
-
}>, {
|
|
50
|
-
project: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
51
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
52
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
53
|
-
}>>;
|
|
54
|
-
work_item_type: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
55
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
56
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
57
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
58
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
59
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
60
|
-
}>>;
|
|
61
|
-
state_filter: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
62
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
63
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
64
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
65
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
66
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
67
|
-
}>>;
|
|
68
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
69
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
70
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
71
|
-
}>, {
|
|
72
|
-
project: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
73
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
74
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
75
|
-
}>>;
|
|
76
|
-
work_item_type: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
77
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
78
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
79
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
80
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
81
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
82
|
-
}>>;
|
|
83
|
-
state_filter: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
84
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
85
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
86
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
87
|
-
organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
88
|
-
pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
89
|
-
}>>;
|
|
90
|
-
}>;
|
|
91
|
-
//# sourceMappingURL=new-updated-work-item.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-updated-work-item.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-updated-work-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AA2GxC,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBpC,CAAC"}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.newUpdatedWorkItemTrigger = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
const props = {
|
|
9
|
-
project: common_1.azureDevOpsCommon.projectDropdown,
|
|
10
|
-
work_item_type: common_1.azureDevOpsCommon.workItemTypeDropdownOptional,
|
|
11
|
-
state_filter: common_1.azureDevOpsCommon.stateDropdownOptional,
|
|
12
|
-
};
|
|
13
|
-
const POLLING_FIRST_RUN_LOOKBACK_DAYS = 14;
|
|
14
|
-
const polling = {
|
|
15
|
-
strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
|
|
16
|
-
items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
|
|
17
|
-
const orgUrl = common_1.azureDevOpsCommon.sanitizeOrgUrl(auth.props.organizationUrl);
|
|
18
|
-
const { project, work_item_type, state_filter } = propsValue;
|
|
19
|
-
const projectName = common_1.azureDevOpsCommon.narrowString(project, 'project');
|
|
20
|
-
const sinceEpoch = lastFetchEpochMS && lastFetchEpochMS > 0
|
|
21
|
-
? lastFetchEpochMS + 1
|
|
22
|
-
: Date.now() - POLLING_FIRST_RUN_LOOKBACK_DAYS * 24 * 60 * 60 * 1000;
|
|
23
|
-
const sinceDate = new Date(sinceEpoch).toISOString().slice(0, 10);
|
|
24
|
-
const escapedProject = common_1.azureDevOpsCommon.escapeWiqlString(projectName);
|
|
25
|
-
let wiqlQuery = `SELECT [System.Id], [System.ChangedDate] FROM WorkItems ` +
|
|
26
|
-
`WHERE [System.TeamProject] = '${escapedProject}' ` +
|
|
27
|
-
`AND [System.ChangedDate] >= '${sinceDate}'`;
|
|
28
|
-
if (work_item_type) {
|
|
29
|
-
const escapedType = common_1.azureDevOpsCommon.escapeWiqlString(common_1.azureDevOpsCommon.narrowString(work_item_type, 'work_item_type'));
|
|
30
|
-
wiqlQuery += ` AND [System.WorkItemType] = '${escapedType}'`;
|
|
31
|
-
}
|
|
32
|
-
if (state_filter) {
|
|
33
|
-
const escapedState = common_1.azureDevOpsCommon.escapeWiqlString(common_1.azureDevOpsCommon.narrowString(state_filter, 'state_filter'));
|
|
34
|
-
wiqlQuery += ` AND [System.State] = '${escapedState}'`;
|
|
35
|
-
}
|
|
36
|
-
wiqlQuery += ' ORDER BY [System.ChangedDate] DESC';
|
|
37
|
-
const wiqlResponse = yield common_1.azureDevOpsCommon.apiCall({
|
|
38
|
-
organizationUrl: orgUrl,
|
|
39
|
-
pat: auth.props.pat,
|
|
40
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
41
|
-
endpoint: `/${encodeURIComponent(projectName)}/_apis/wit/wiql`,
|
|
42
|
-
queryParams: {
|
|
43
|
-
'$top': '200',
|
|
44
|
-
'api-version': '7.1',
|
|
45
|
-
},
|
|
46
|
-
body: { query: wiqlQuery },
|
|
47
|
-
});
|
|
48
|
-
if (!wiqlResponse.workItems || wiqlResponse.workItems.length === 0) {
|
|
49
|
-
return [];
|
|
50
|
-
}
|
|
51
|
-
const ids = wiqlResponse.workItems.map((wi) => wi.id);
|
|
52
|
-
const workItems = yield common_1.azureDevOpsCommon.fetchWorkItemsByIds({
|
|
53
|
-
organizationUrl: orgUrl,
|
|
54
|
-
pat: auth.props.pat,
|
|
55
|
-
ids,
|
|
56
|
-
});
|
|
57
|
-
return workItems.map((item) => ({
|
|
58
|
-
epochMilliSeconds: item.changed_date
|
|
59
|
-
? new Date(item.changed_date).getTime()
|
|
60
|
-
: Date.now(),
|
|
61
|
-
data: item,
|
|
62
|
-
}));
|
|
63
|
-
}),
|
|
64
|
-
};
|
|
65
|
-
const sampleWorkItem = {
|
|
66
|
-
id: 123,
|
|
67
|
-
rev: 1,
|
|
68
|
-
url: 'https://dev.azure.com/myorg/myproject/_apis/wit/workItems/123',
|
|
69
|
-
title: 'Fix login page bug',
|
|
70
|
-
work_item_type: 'Bug',
|
|
71
|
-
state: 'Active',
|
|
72
|
-
reason: 'New',
|
|
73
|
-
assigned_to: 'John Doe',
|
|
74
|
-
assigned_to_email: 'john.doe@example.com',
|
|
75
|
-
created_date: '2024-03-15T10:30:00Z',
|
|
76
|
-
created_by: 'Jane Smith',
|
|
77
|
-
changed_date: '2024-03-15T14:45:00Z',
|
|
78
|
-
changed_by: 'John Doe',
|
|
79
|
-
area_path: 'MyProject\\Backend',
|
|
80
|
-
iteration_path: 'MyProject\\Sprint 5',
|
|
81
|
-
priority: 2,
|
|
82
|
-
description: '<p>Users cannot log in after password reset.</p>',
|
|
83
|
-
project: 'MyProject',
|
|
84
|
-
};
|
|
85
|
-
exports.newUpdatedWorkItemTrigger = (0, pieces_framework_1.createTrigger)({
|
|
86
|
-
auth: common_1.azureDevOpsAuth,
|
|
87
|
-
name: 'new_updated_work_item',
|
|
88
|
-
displayName: 'New or Updated Work Item (Polling)',
|
|
89
|
-
description: 'Polls Azure DevOps every few minutes and fires when a work item is created or updated. Use this when your Activepieces instance is not reachable from the public internet; otherwise prefer the Instant trigger. Pick a work item type to unlock the state filter.',
|
|
90
|
-
aiMetadata: {
|
|
91
|
-
description: 'Fires for each Azure DevOps work item created or changed since the last poll in the chosen project, discovered by periodic polling rather than instantly. Optionally narrow to a single work item type and, once a type is set, to a specific state. Prefer the Instant trigger when the Activepieces instance is publicly reachable.',
|
|
92
|
-
},
|
|
93
|
-
props,
|
|
94
|
-
sampleData: sampleWorkItem,
|
|
95
|
-
type: pieces_framework_1.TriggerStrategy.POLLING,
|
|
96
|
-
test(context) {
|
|
97
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
return yield pieces_common_1.pollingHelper.test(polling, context);
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
onEnable(context) {
|
|
102
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
yield pieces_common_1.pollingHelper.onEnable(polling, context);
|
|
104
|
-
});
|
|
105
|
-
},
|
|
106
|
-
onDisable(context) {
|
|
107
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
yield pieces_common_1.pollingHelper.onDisable(polling, context);
|
|
109
|
-
});
|
|
110
|
-
},
|
|
111
|
-
run(context) {
|
|
112
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
113
|
-
return yield pieces_common_1.pollingHelper.poll(polling, context);
|
|
114
|
-
});
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
//# sourceMappingURL=new-updated-work-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-updated-work-item.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-updated-work-item.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,+DAAiG;AACjG,sCAMmB;AAEnB,MAAM,KAAK,GAAG;IACZ,OAAO,EAAE,0BAAiB,CAAC,eAAe;IAC1C,cAAc,EAAE,0BAAiB,CAAC,4BAA4B;IAC9D,YAAY,EAAE,0BAAiB,CAAC,qBAAqB;CACtD,CAAC;AAEF,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAE3C,MAAM,OAAO,GAA6D;IACxE,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,IA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