@activepieces/piece-azure-devops 0.0.1

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.
Files changed (37) hide show
  1. package/package.json +16 -0
  2. package/src/index.d.ts +5 -0
  3. package/src/index.d.ts.map +1 -0
  4. package/src/index.js +42 -0
  5. package/src/index.js.map +1 -0
  6. package/src/lib/actions/add-comment.d.ts +12 -0
  7. package/src/lib/actions/add-comment.d.ts.map +1 -0
  8. package/src/lib/actions/add-comment.js +57 -0
  9. package/src/lib/actions/add-comment.js.map +1 -0
  10. package/src/lib/actions/create-work-item.d.ts +27 -0
  11. package/src/lib/actions/create-work-item.d.ts.map +1 -0
  12. package/src/lib/actions/create-work-item.js +72 -0
  13. package/src/lib/actions/create-work-item.js.map +1 -0
  14. package/src/lib/actions/get-work-item.d.ts +11 -0
  15. package/src/lib/actions/get-work-item.d.ts.map +1 -0
  16. package/src/lib/actions/get-work-item.js +41 -0
  17. package/src/lib/actions/get-work-item.js.map +1 -0
  18. package/src/lib/actions/list-work-items.d.ts +12 -0
  19. package/src/lib/actions/list-work-items.d.ts.map +1 -0
  20. package/src/lib/actions/list-work-items.js +60 -0
  21. package/src/lib/actions/list-work-items.js.map +1 -0
  22. package/src/lib/actions/update-work-item.d.ts +67 -0
  23. package/src/lib/actions/update-work-item.d.ts.map +1 -0
  24. package/src/lib/actions/update-work-item.js +107 -0
  25. package/src/lib/actions/update-work-item.js.map +1 -0
  26. package/src/lib/common/index.d.ts +210 -0
  27. package/src/lib/common/index.d.ts.map +1 -0
  28. package/src/lib/common/index.js +581 -0
  29. package/src/lib/common/index.js.map +1 -0
  30. package/src/lib/triggers/new-updated-work-item-webhook.d.ts +68 -0
  31. package/src/lib/triggers/new-updated-work-item-webhook.d.ts.map +1 -0
  32. package/src/lib/triggers/new-updated-work-item-webhook.js +167 -0
  33. package/src/lib/triggers/new-updated-work-item-webhook.js.map +1 -0
  34. package/src/lib/triggers/new-updated-work-item.d.ts +91 -0
  35. package/src/lib/triggers/new-updated-work-item.d.ts.map +1 -0
  36. package/src/lib/triggers/new-updated-work-item.js +114 -0
  37. package/src/lib/triggers/new-updated-work-item.js.map +1 -0
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@activepieces/piece-azure-devops",
3
+ "version": "0.0.1",
4
+ "main": "./src/index.js",
5
+ "types": "./src/index.d.ts",
6
+ "scripts": {
7
+ "build": "tsc -p tsconfig.lib.json && cp package.json dist/",
8
+ "lint": "eslint 'src/**/*.ts'"
9
+ },
10
+ "dependencies": {
11
+ "@activepieces/pieces-common": "0.12.3",
12
+ "@activepieces/pieces-framework": "0.28.2",
13
+ "@activepieces/shared": "0.78.1",
14
+ "tslib": "2.6.2"
15
+ }
16
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export declare const azureDevOps: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>>;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,WAAW;;;GA4BtB,CAAC"}
package/src/index.js ADDED
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.azureDevOps = 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 shared_1 = require("@activepieces/shared");
8
+ const create_work_item_1 = require("./lib/actions/create-work-item");
9
+ const get_work_item_1 = require("./lib/actions/get-work-item");
10
+ const update_work_item_1 = require("./lib/actions/update-work-item");
11
+ const list_work_items_1 = require("./lib/actions/list-work-items");
12
+ const add_comment_1 = require("./lib/actions/add-comment");
13
+ const new_updated_work_item_1 = require("./lib/triggers/new-updated-work-item");
14
+ const new_updated_work_item_webhook_1 = require("./lib/triggers/new-updated-work-item-webhook");
15
+ const common_1 = require("./lib/common");
16
+ exports.azureDevOps = (0, pieces_framework_1.createPiece)({
17
+ displayName: 'Azure DevOps',
18
+ description: 'Track work, code, and ship software with Azure Boards, Repos, and Pipelines.',
19
+ minimumSupportedRelease: '0.36.1',
20
+ logoUrl: 'https://cdn.activepieces.com/pieces/azure-devops.png',
21
+ categories: [shared_1.PieceCategory.DEVELOPER_TOOLS],
22
+ auth: common_1.azureDevOpsAuth,
23
+ authors: ['majewskibartosz'],
24
+ actions: [
25
+ create_work_item_1.createWorkItemAction,
26
+ get_work_item_1.getWorkItemAction,
27
+ update_work_item_1.updateWorkItemAction,
28
+ list_work_items_1.listWorkItemsAction,
29
+ add_comment_1.addCommentAction,
30
+ (0, pieces_common_1.createCustomApiCallAction)({
31
+ baseUrl: (auth) => common_1.azureDevOpsCommon.sanitizeOrgUrl(common_1.azureDevOpsCommon.asAuth(auth).props.organizationUrl),
32
+ auth: common_1.azureDevOpsAuth,
33
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
34
+ return ({
35
+ Authorization: `Basic ${Buffer.from(`:${common_1.azureDevOpsCommon.asAuth(auth).props.pat}`).toString('base64')}`,
36
+ });
37
+ }),
38
+ }),
39
+ ],
40
+ triggers: [new_updated_work_item_webhook_1.newUpdatedWorkItemWebhookTrigger, new_updated_work_item_1.newUpdatedWorkItemTrigger],
41
+ });
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,+DAAwE;AACxE,iDAAqD;AACrD,qEAAsE;AACtE,+DAAgE;AAChE,qEAAsE;AACtE,mEAAoE;AACpE,2DAA6D;AAC7D,gFAAiF;AACjF,gGAAgG;AAChG,yCAAkE;AAErD,QAAA,WAAW,GAAG,IAAA,8BAAW,EAAC;IACrC,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,8EAA8E;IAC3F,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,sDAAsD;IAC/D,UAAU,EAAE,CAAC,sBAAa,CAAC,eAAe,CAAC;IAC3C,IAAI,EAAE,wBAAe;IACrB,OAAO,EAAE,CAAC,iBAAiB,CAAC;IAC5B,OAAO,EAAE;QACP,uCAAoB;QACpB,iCAAiB;QACjB,uCAAoB;QACpB,qCAAmB;QACnB,8BAAgB;QAChB,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAChB,0BAAiB,CAAC,cAAc,CAC9B,0BAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,eAAe,CACrD;YACH,IAAI,EAAE,wBAAe;YACrB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CACjC,IAAI,0BAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAC/C,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;iBACvB,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE,CAAC,gEAAgC,EAAE,iDAAyB,CAAC;CACxE,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const addCommentAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ project: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>>;
9
+ work_item_id: import("@activepieces/pieces-framework").NumberProperty<true>;
10
+ comment: import("@activepieces/pieces-framework").LongTextProperty<true>;
11
+ }>;
12
+ //# sourceMappingURL=add-comment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-comment.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/add-comment.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;;;;;;EA+C3B,CAAC"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addCommentAction = 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 common_2 = require("../common");
9
+ exports.addCommentAction = (0, pieces_framework_1.createAction)({
10
+ auth: common_1.azureDevOpsAuth,
11
+ name: 'add_comment',
12
+ displayName: 'Add Comment',
13
+ description: 'Adds a comment to an existing work item in Azure DevOps',
14
+ props: {
15
+ project: common_2.azureDevOpsCommon.projectDropdown,
16
+ work_item_id: pieces_framework_1.Property.Number({
17
+ displayName: 'Work Item ID',
18
+ description: 'Numeric ID of the work item (e.g. 123). To pass it dynamically, reference the ID from a previous step (e.g. `{{trigger.id}}`), not the title.',
19
+ required: true,
20
+ }),
21
+ comment: pieces_framework_1.Property.LongText({
22
+ displayName: 'Comment',
23
+ description: 'The comment text to add (supports HTML)',
24
+ required: true,
25
+ }),
26
+ },
27
+ run(context) {
28
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
29
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
30
+ const { project, work_item_id, comment } = context.propsValue;
31
+ const auth = context.auth;
32
+ const orgUrl = common_2.azureDevOpsCommon.sanitizeOrgUrl(auth.props.organizationUrl);
33
+ const response = yield common_2.azureDevOpsCommon.apiCall({
34
+ organizationUrl: orgUrl,
35
+ pat: auth.props.pat,
36
+ method: pieces_common_1.HttpMethod.POST,
37
+ endpoint: `/${encodeURIComponent(project)}/_apis/wit/workItems/${work_item_id}/comments`,
38
+ // Work-item comments remain in preview on REST 7.1; the stable 7.1
39
+ // endpoint does not exist. See
40
+ // https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/comments
41
+ queryParams: { 'api-version': '7.1-preview.4' },
42
+ body: { text: comment },
43
+ });
44
+ return {
45
+ id: response.id,
46
+ work_item_id: response.workItemId,
47
+ text: (_a = response.text) !== null && _a !== void 0 ? _a : null,
48
+ created_by: (_c = (_b = response.createdBy) === null || _b === void 0 ? void 0 : _b.displayName) !== null && _c !== void 0 ? _c : null,
49
+ created_by_email: (_e = (_d = response.createdBy) === null || _d === void 0 ? void 0 : _d.uniqueName) !== null && _e !== void 0 ? _e : null,
50
+ created_date: (_f = response.createdDate) !== null && _f !== void 0 ? _f : null,
51
+ modified_by: (_h = (_g = response.modifiedBy) === null || _g === void 0 ? void 0 : _g.displayName) !== null && _h !== void 0 ? _h : null,
52
+ modified_date: (_j = response.modifiedDate) !== null && _j !== void 0 ? _j : null,
53
+ };
54
+ });
55
+ },
56
+ });
57
+ //# sourceMappingURL=add-comment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-comment.js","sourceRoot":"","sources":["../../../../src/lib/actions/add-comment.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,sCAA4C;AAC5C,sCAA2D;AAE9C,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,wBAAe;IACrB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,yDAAyD;IACtE,KAAK,EAAE;QACL,OAAO,EAAE,0BAAiB,CAAC,eAAe;QAC1C,YAAY,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC5B,WAAW,EAAE,cAAc;YAC3B,WAAW,EACT,+IAA+I;YACjJ,Q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C,UAAU,0CAAE,WAAW,mCAAI,IAAI;gBACrD,aAAa,EAAE,MAAA,QAAQ,CAAC,YAAY,mCAAI,IAAI;aAC7C,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ export declare const createWorkItemAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ project: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>>;
9
+ work_item_type: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
10
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
12
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
13
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
14
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
15
+ }>>;
16
+ title: import("@activepieces/pieces-framework").ShortTextProperty<true>;
17
+ description: import("@activepieces/pieces-framework").LongTextProperty<false>;
18
+ assigned_to: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
19
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
20
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
21
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
22
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
23
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
24
+ }>>;
25
+ priority: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
26
+ }>;
27
+ //# sourceMappingURL=create-work-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-work-item.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-work-item.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;EAmE/B,CAAC"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createWorkItemAction = 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 common_2 = require("../common");
9
+ exports.createWorkItemAction = (0, pieces_framework_1.createAction)({
10
+ auth: common_1.azureDevOpsAuth,
11
+ name: 'create_work_item',
12
+ displayName: 'Create Work Item',
13
+ description: 'Creates a new work item (Bug, Task, User Story, etc.) in Azure DevOps',
14
+ props: {
15
+ project: common_2.azureDevOpsCommon.projectDropdown,
16
+ work_item_type: common_2.azureDevOpsCommon.workItemTypeDropdown,
17
+ title: pieces_framework_1.Property.ShortText({
18
+ displayName: 'Title',
19
+ description: 'The title of the work item',
20
+ required: true,
21
+ }),
22
+ description: pieces_framework_1.Property.LongText({
23
+ displayName: 'Description',
24
+ description: 'Detailed description of the work item (supports HTML)',
25
+ required: false,
26
+ }),
27
+ assigned_to: common_2.azureDevOpsCommon.assignedToDropdown,
28
+ priority: common_2.azureDevOpsCommon.priorityDropdown,
29
+ },
30
+ run(context) {
31
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
32
+ const { project, work_item_type, title, description, assigned_to, priority } = context.propsValue;
33
+ const auth = context.auth;
34
+ const orgUrl = common_2.azureDevOpsCommon.sanitizeOrgUrl(auth.props.organizationUrl);
35
+ const operations = [
36
+ { op: 'add', path: '/fields/System.Title', value: title },
37
+ ];
38
+ if (description) {
39
+ operations.push({
40
+ op: 'add',
41
+ path: '/fields/System.Description',
42
+ value: description,
43
+ });
44
+ }
45
+ if (assigned_to) {
46
+ operations.push({
47
+ op: 'add',
48
+ path: '/fields/System.AssignedTo',
49
+ value: assigned_to,
50
+ });
51
+ }
52
+ if (priority) {
53
+ operations.push({
54
+ op: 'add',
55
+ path: '/fields/Microsoft.VSTS.Common.Priority',
56
+ value: Number(priority),
57
+ });
58
+ }
59
+ const response = yield common_2.azureDevOpsCommon.apiCall({
60
+ organizationUrl: orgUrl,
61
+ pat: auth.props.pat,
62
+ method: pieces_common_1.HttpMethod.POST,
63
+ endpoint: `/${encodeURIComponent(project)}/_apis/wit/workitems/$${encodeURIComponent(common_2.azureDevOpsCommon.narrowString(work_item_type, 'work_item_type'))}`,
64
+ queryParams: { 'api-version': '7.1' },
65
+ body: operations,
66
+ isJsonPatch: true,
67
+ });
68
+ return common_2.azureDevOpsCommon.flattenWorkItem(response);
69
+ });
70
+ },
71
+ });
72
+ //# sourceMappingURL=create-work-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-work-item.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-work-item.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,sCAA4C;AAC5C,sCAImB;AAEN,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,wBAAe;IACrB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,uEAAuE;IACpF,KAAK,EAAE;QACL,OAAO,EAAE,0BAAiB,CAAC,eAAe;QAC1C,cAAc,EAAE,0BAAiB,CAAC,oBAAoB;QACtD,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,W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AM;gBACvB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;gBACnB,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,QAAQ,EAAE,IAAI,kBAAkB,CAAC,OAAO,CAAC,yBAAyB,kBAAkB,CAAC,0BAAiB,CAAC,YAAY,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC,EAAE;gBACxJ,WAAW,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE;gBACrC,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,IAAI;aAClB,CAAC,CAAC;YAEH,OAAO,0BAAiB,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACrD,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const getWorkItemAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ project: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>>;
9
+ work_item_id: import("@activepieces/pieces-framework").NumberProperty<true>;
10
+ }>;
11
+ //# sourceMappingURL=get-work-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-work-item.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-work-item.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,iBAAiB;;;;;;;;;EAgC5B,CAAC"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getWorkItemAction = 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 common_2 = require("../common");
9
+ exports.getWorkItemAction = (0, pieces_framework_1.createAction)({
10
+ auth: common_1.azureDevOpsAuth,
11
+ name: 'get_work_item',
12
+ displayName: 'Get Work Item',
13
+ description: 'Retrieves a work item by ID from Azure DevOps',
14
+ props: {
15
+ project: common_2.azureDevOpsCommon.projectDropdown,
16
+ work_item_id: pieces_framework_1.Property.Number({
17
+ displayName: 'Work Item ID',
18
+ description: 'Numeric ID of the work item (e.g. 123). To pass it dynamically, reference the ID from a previous step (e.g. `{{trigger.id}}`), not the title.',
19
+ required: true,
20
+ }),
21
+ },
22
+ run(context) {
23
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ const { project, work_item_id } = context.propsValue;
25
+ const auth = context.auth;
26
+ const orgUrl = common_2.azureDevOpsCommon.sanitizeOrgUrl(auth.props.organizationUrl);
27
+ const response = yield common_2.azureDevOpsCommon.apiCall({
28
+ organizationUrl: orgUrl,
29
+ pat: auth.props.pat,
30
+ method: pieces_common_1.HttpMethod.GET,
31
+ endpoint: `/${encodeURIComponent(project)}/_apis/wit/workitems/${work_item_id}`,
32
+ queryParams: {
33
+ '$expand': 'all',
34
+ 'api-version': '7.1',
35
+ },
36
+ });
37
+ return common_2.azureDevOpsCommon.flattenWorkItem(response);
38
+ });
39
+ },
40
+ });
41
+ //# sourceMappingURL=get-work-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-work-item.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-work-item.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,sCAA4C;AAC5C,sCAGmB;AAEN,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,wBAAe;IACrB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,+CAA+C;IAC5D,KAAK,EAAE;QACL,OAAO,EAAE,0BAAiB,CAAC,eAAe;QAC1C,YAAY,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC5B,WAAW,EAAE,cAAc;YAC3B,WAAW,EACT,+IAA+I;YACjJ,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACrD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAC1B,MAAM,MAAM,GAAG,0BAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YAE5E,MAAM,QAAQ,GAAG,MAAM,0BAAiB,CAAC,OAAO,CAAsB;gBACpE,eAAe,EAAE,MAAM;gBACvB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;gBACnB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,QAAQ,EAAE,IAAI,kBAAkB,CAAC,OAAO,CAAC,wBAAwB,YAAY,EAAE;gBAC/E,WAAW,EAAE;oBACX,SAAS,EAAE,KAAK;oBAChB,aAAa,EAAE,KAAK;iBACrB;aACF,CAAC,CAAC;YAEH,OAAO,0BAAiB,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACrD,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const listWorkItemsAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ project: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>>;
9
+ wiql_query: import("@activepieces/pieces-framework").LongTextProperty<false>;
10
+ limit: import("@activepieces/pieces-framework").NumberProperty<false>;
11
+ }>;
12
+ //# sourceMappingURL=list-work-items.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-work-items.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/list-work-items.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,mBAAmB;;;;;;;;;;EAqD9B,CAAC"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listWorkItemsAction = 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 common_2 = require("../common");
9
+ const DEFAULT_WIQL = `SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = @project AND [System.WorkItemType] <> '' ORDER BY [System.ChangedDate] DESC`;
10
+ exports.listWorkItemsAction = (0, pieces_framework_1.createAction)({
11
+ auth: common_1.azureDevOpsAuth,
12
+ name: 'list_work_items',
13
+ displayName: 'List Work Items',
14
+ description: 'Lists work items from Azure DevOps using a WIQL query',
15
+ props: {
16
+ project: common_2.azureDevOpsCommon.projectDropdown,
17
+ wiql_query: pieces_framework_1.Property.LongText({
18
+ displayName: 'WIQL Query',
19
+ description: `The WIQL query to execute. Default: SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = @project ORDER BY [System.ChangedDate] DESC`,
20
+ required: false,
21
+ }),
22
+ limit: pieces_framework_1.Property.Number({
23
+ displayName: 'Limit',
24
+ description: 'Maximum number of work items to return (default: 50, max: 200)',
25
+ required: false,
26
+ defaultValue: 50,
27
+ }),
28
+ },
29
+ run(context) {
30
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
31
+ const { project, wiql_query, limit } = context.propsValue;
32
+ const auth = context.auth;
33
+ const orgUrl = common_2.azureDevOpsCommon.sanitizeOrgUrl(auth.props.organizationUrl);
34
+ const query = wiql_query || DEFAULT_WIQL;
35
+ const maxItems = Math.max(1, Math.min(limit !== null && limit !== void 0 ? limit : 50, 200));
36
+ const wiqlResponse = yield common_2.azureDevOpsCommon.apiCall({
37
+ organizationUrl: orgUrl,
38
+ pat: auth.props.pat,
39
+ method: pieces_common_1.HttpMethod.POST,
40
+ endpoint: `/${encodeURIComponent(project)}/_apis/wit/wiql`,
41
+ queryParams: {
42
+ '$top': `${maxItems}`,
43
+ 'api-version': '7.1',
44
+ },
45
+ body: { query },
46
+ });
47
+ if (!wiqlResponse.workItems || wiqlResponse.workItems.length === 0) {
48
+ return [];
49
+ }
50
+ const ids = wiqlResponse.workItems.map((wi) => wi.id);
51
+ const workItems = yield common_2.azureDevOpsCommon.fetchWorkItemsByIds({
52
+ organizationUrl: orgUrl,
53
+ pat: auth.props.pat,
54
+ ids,
55
+ });
56
+ return workItems;
57
+ });
58
+ },
59
+ });
60
+ //# sourceMappingURL=list-work-items.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-work-items.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-work-items.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,sCAA4C;AAC5C,sCAGmB;AAEnB,MAAM,YAAY,GAAG,4IAA4I,CAAC;AAErJ,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,wBAAe;IACrB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,uDAAuD;IACpE,KAAK,EAAE;QACL,OAAO,EAAE,0BAAiB,CAAC,eAAe;QAC1C,UAAU,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,gJAAgJ;YAC7J,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,gEAAgE;YAC7E,QAAQ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,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;gBACnB,GAAG;aACJ,CAAC,CAAC;YAEH,OAAO,SAAS,CAAC;QACnB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,67 @@
1
+ export declare const updateWorkItemAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ project: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>>;
9
+ work_item_type: {
10
+ description: string;
11
+ displayName: string;
12
+ auth: import("@activepieces/pieces-framework").CustomAuthProperty<{
13
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
14
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
15
+ }>;
16
+ refreshers: string[];
17
+ refreshOnSearch?: boolean;
18
+ options: (propsValue: Record<string, unknown> & {
19
+ auth?: import("@activepieces/shared").CustomAuthConnectionValue<import("@activepieces/pieces-framework").StaticPropsValue<{
20
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
21
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
22
+ }>> | undefined;
23
+ }, ctx: import("@activepieces/pieces-framework").PropertyContext) => Promise<import("@activepieces/pieces-framework").DropdownState<string>>;
24
+ valueSchema: string;
25
+ type: import("@activepieces/pieces-framework").PropertyType.DROPDOWN;
26
+ required: false;
27
+ defaultValue?: unknown;
28
+ } | {
29
+ description: string;
30
+ displayName: string;
31
+ auth: import("@activepieces/pieces-framework").CustomAuthProperty<{
32
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
33
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
34
+ }>;
35
+ refreshers: string[];
36
+ refreshOnSearch?: boolean;
37
+ options: (propsValue: Record<string, unknown> & {
38
+ auth?: import("@activepieces/shared").CustomAuthConnectionValue<import("@activepieces/pieces-framework").StaticPropsValue<{
39
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
40
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
41
+ }>> | undefined;
42
+ }, ctx: import("@activepieces/pieces-framework").PropertyContext) => Promise<import("@activepieces/pieces-framework").DropdownState<string>>;
43
+ valueSchema: string;
44
+ type: import("@activepieces/pieces-framework").PropertyType.DROPDOWN;
45
+ required: true;
46
+ defaultValue?: unknown;
47
+ };
48
+ work_item_id: import("@activepieces/pieces-framework").NumberProperty<true>;
49
+ title: import("@activepieces/pieces-framework").ShortTextProperty<false>;
50
+ description: import("@activepieces/pieces-framework").LongTextProperty<false>;
51
+ state: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
52
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
53
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
54
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
55
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
56
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
57
+ }>>;
58
+ assigned_to: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
59
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
60
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
61
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
62
+ organizationUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
63
+ pat: import("@activepieces/pieces-framework").SecretTextProperty<true>;
64
+ }>>;
65
+ priority: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
66
+ }>;
67
+ //# sourceMappingURL=update-work-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-work-item.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-work-item.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2G/B,CAAC"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateWorkItemAction = 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 common_2 = require("../common");
9
+ exports.updateWorkItemAction = (0, pieces_framework_1.createAction)({
10
+ auth: common_1.azureDevOpsAuth,
11
+ name: 'update_work_item',
12
+ displayName: 'Update Work Item',
13
+ description: 'Updates an existing work item in Azure DevOps',
14
+ props: {
15
+ project: common_2.azureDevOpsCommon.projectDropdown,
16
+ work_item_type: Object.assign(Object.assign({}, common_2.azureDevOpsCommon.workItemTypeDropdown), { description: 'Type of the work item. Used only to load the matching list of states below — it does not change the work item\'s type. Changing type requires a separate Azure DevOps operation not supported here.' }),
17
+ work_item_id: pieces_framework_1.Property.Number({
18
+ displayName: 'Work Item ID',
19
+ description: 'Numeric ID of the work item (e.g. 123). To pass it dynamically from a previous step, use a reference like `{{trigger.id}}` or the output of a Get/List step — not the title.',
20
+ required: true,
21
+ }),
22
+ title: pieces_framework_1.Property.ShortText({
23
+ displayName: 'Title',
24
+ description: 'New title for the work item',
25
+ required: false,
26
+ }),
27
+ description: pieces_framework_1.Property.LongText({
28
+ displayName: 'Description',
29
+ description: 'New description for the work item (supports HTML)',
30
+ required: false,
31
+ }),
32
+ state: common_2.azureDevOpsCommon.stateDropdown,
33
+ assigned_to: common_2.azureDevOpsCommon.assignedToDropdown,
34
+ priority: common_2.azureDevOpsCommon.priorityDropdown,
35
+ },
36
+ run(context) {
37
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+ const { project, work_item_id, title, description, state, assigned_to, priority } = context.propsValue;
39
+ const auth = context.auth;
40
+ const orgUrl = common_2.azureDevOpsCommon.sanitizeOrgUrl(auth.props.organizationUrl);
41
+ const encodedProject = encodeURIComponent(project);
42
+ const operations = [];
43
+ if (isNonEmptyString(title)) {
44
+ operations.push({
45
+ op: 'replace',
46
+ path: '/fields/System.Title',
47
+ value: title,
48
+ });
49
+ }
50
+ if (isNonEmptyString(description)) {
51
+ operations.push({
52
+ op: 'replace',
53
+ path: '/fields/System.Description',
54
+ value: description,
55
+ });
56
+ }
57
+ if (isNonEmptyString(state)) {
58
+ operations.push({
59
+ op: 'replace',
60
+ path: '/fields/System.State',
61
+ value: state,
62
+ });
63
+ }
64
+ if (isNonEmptyString(assigned_to)) {
65
+ operations.push({
66
+ op: 'replace',
67
+ path: '/fields/System.AssignedTo',
68
+ value: assigned_to,
69
+ });
70
+ }
71
+ if (priority !== undefined && priority !== null) {
72
+ operations.push({
73
+ op: 'replace',
74
+ path: '/fields/Microsoft.VSTS.Common.Priority',
75
+ value: Number(priority),
76
+ });
77
+ }
78
+ if (operations.length === 0) {
79
+ const getResponse = yield common_2.azureDevOpsCommon.apiCall({
80
+ organizationUrl: orgUrl,
81
+ pat: auth.props.pat,
82
+ method: pieces_common_1.HttpMethod.GET,
83
+ endpoint: `/${encodedProject}/_apis/wit/workitems/${work_item_id}`,
84
+ queryParams: {
85
+ '$expand': 'all',
86
+ 'api-version': '7.1',
87
+ },
88
+ });
89
+ return common_2.azureDevOpsCommon.flattenWorkItem(getResponse);
90
+ }
91
+ const response = yield common_2.azureDevOpsCommon.apiCall({
92
+ organizationUrl: orgUrl,
93
+ pat: auth.props.pat,
94
+ method: pieces_common_1.HttpMethod.PATCH,
95
+ endpoint: `/${encodedProject}/_apis/wit/workitems/${work_item_id}`,
96
+ queryParams: { 'api-version': '7.1' },
97
+ body: operations,
98
+ isJsonPatch: true,
99
+ });
100
+ return common_2.azureDevOpsCommon.flattenWorkItem(response);
101
+ });
102
+ },
103
+ });
104
+ function isNonEmptyString(value) {
105
+ return typeof value === 'string' && value.length > 0;
106
+ }
107
+ //# sourceMappingURL=update-work-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-work-item.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-work-item.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,sCAA4C;AAC5C,sCAImB;AAEN,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,wBAAe;IACrB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,+CAA+C;IAC5D,KAAK,EAAE;QACL,OAAO,EAAE,0BAAiB,CAAC,eAAe;QAC1C,cAAc,kCACT,0BAAiB,CAAC,oBAAoB,KACzC,WAAW,EACT,qMAAqM,GACxM;QACD,YAAY,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC5B,WAAW,EAAE,cAAc;YAC3B,WAAW,EACT,8KAA8K;YAChL,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,0BAAiB,CAAC,aAAa;QACtC,WAAW,EAAE,0BAAiB,CAAC,kBAAkB;QACjD,QAAQ,EAAE,0BAAiB,CAAC,gBAAgB;KAC7C;IACK,G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