@activepieces/piece-github 0.3.0 → 0.3.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.
- package/package.json +8 -5
- package/src/index.js +2 -1
- package/src/index.js.map +1 -1
- package/src/lib/actions/create-issue.d.ts +11 -0
- package/src/lib/actions/create-issue.js +47 -0
- package/src/lib/actions/create-issue.js.map +1 -0
- package/src/lib/common/index.d.ts +8 -0
- package/src/lib/common/index.js +44 -1
- package/src/lib/common/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-github",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@sinclair/typebox": "^0.26.3",
|
|
6
|
-
"axios": "1.
|
|
6
|
+
"axios": "1.4.0",
|
|
7
|
+
"dayjs": "^1.11.8",
|
|
8
|
+
"is-base64": "^1.1.0",
|
|
7
9
|
"nanoid": "^3.3.4",
|
|
8
|
-
"
|
|
9
|
-
"@activepieces/pieces-
|
|
10
|
-
"@activepieces/
|
|
10
|
+
"semver": "7.5.3",
|
|
11
|
+
"@activepieces/pieces-common": "0.2.1",
|
|
12
|
+
"@activepieces/pieces-framework": "0.6.8",
|
|
13
|
+
"@activepieces/shared": "0.6.2",
|
|
11
14
|
"tslib": "1.14.1"
|
|
12
15
|
},
|
|
13
16
|
"main": "./src/index.js",
|
package/src/index.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.github = exports.githubAuth = void 0;
|
|
4
4
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
5
|
const trigger_1 = require("./lib/trigger");
|
|
6
|
+
const create_issue_1 = require("./lib/actions/create-issue");
|
|
6
7
|
exports.githubAuth = pieces_framework_1.PieceAuth.OAuth2({
|
|
7
8
|
displayName: "Authentication",
|
|
8
9
|
required: true,
|
|
@@ -15,7 +16,7 @@ exports.github = (0, pieces_framework_1.createPiece)({
|
|
|
15
16
|
minimumSupportedRelease: '0.5.0',
|
|
16
17
|
logoUrl: 'https://cdn.activepieces.com/pieces/github.png',
|
|
17
18
|
auth: exports.githubAuth,
|
|
18
|
-
actions: [],
|
|
19
|
+
actions: [create_issue_1.githubCreateIssueAction],
|
|
19
20
|
authors: ['kanarelo'],
|
|
20
21
|
triggers: trigger_1.githubTriggers,
|
|
21
22
|
});
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/github/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,2CAA+C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/github/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,2CAA+C;AAC/C,6DAAqE;AAExD,QAAA,UAAU,GAAG,4BAAS,CAAC,MAAM,CAAC;IACvC,WAAW,EAAE,gBAAgB;IAC7B,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,0CAA0C;IACnD,QAAQ,EAAE,6CAA6C;IACvD,KAAK,EAAE,CAAC,iBAAiB,EAAE,WAAW,EAAE,MAAM,CAAC;CAClD,CAAC,CAAA;AAEW,QAAA,MAAM,GAAG,IAAA,8BAAW,EAAC;IAChC,WAAW,EAAE,QAAQ;IACjB,uBAAuB,EAAE,OAAO;IAClC,OAAO,EAAE,gDAAgD;IAC3D,IAAI,EAAE,kBAAU;IAChB,OAAO,EAAE,CAAC,sCAAuB,CAAC;IAClC,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,QAAQ,EAAE,wBAAc;CACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const githubCreateIssueAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<true, import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
+
repository: import("@activepieces/pieces-framework").DropdownProperty<{
|
|
3
|
+
repo: string;
|
|
4
|
+
owner: string;
|
|
5
|
+
}, false> | import("@activepieces/pieces-framework").DropdownProperty<{
|
|
6
|
+
repo: string;
|
|
7
|
+
owner: string;
|
|
8
|
+
}, true>;
|
|
9
|
+
title: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
assignee: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true>;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.githubCreateIssueAction = 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 __1 = require("../../");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.githubCreateIssueAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: __1.githubAuth,
|
|
11
|
+
name: 'github_create_issue',
|
|
12
|
+
displayName: 'Create Issue',
|
|
13
|
+
description: 'Create Issue',
|
|
14
|
+
sampleData: {},
|
|
15
|
+
props: {
|
|
16
|
+
repository: common_1.githubCommon.repositoryDropdown,
|
|
17
|
+
title: pieces_framework_1.Property.ShortText({
|
|
18
|
+
displayName: 'Title',
|
|
19
|
+
description: 'The title of an issue',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
assignee: common_1.githubCommon.assigneeDropDown,
|
|
23
|
+
},
|
|
24
|
+
run(configValue) {
|
|
25
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const title = configValue.propsValue['title'];
|
|
27
|
+
const { owner, repo } = configValue.propsValue['repository'];
|
|
28
|
+
const assignee = configValue.propsValue['assignee'];
|
|
29
|
+
const requestBody = {
|
|
30
|
+
title: title,
|
|
31
|
+
assignees: assignee,
|
|
32
|
+
};
|
|
33
|
+
const request = {
|
|
34
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
35
|
+
url: `${common_1.githubCommon.baseUrl}/repos/${owner}/${repo}/issues`,
|
|
36
|
+
body: requestBody,
|
|
37
|
+
authentication: {
|
|
38
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
39
|
+
token: configValue.auth.access_token,
|
|
40
|
+
},
|
|
41
|
+
queryParams: {},
|
|
42
|
+
};
|
|
43
|
+
return yield pieces_common_1.httpClient.sendRequest(request);
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=create-issue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-issue.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/github/src/lib/actions/create-issue.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAKqC;AACrC,8BAAoC;AACpC,sCAAyC;AAE5B,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,cAAU;IAChB,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,EAAE;IACd,KAAK,EAAE;QACL,UAAU,EAAE,qBAAY,CAAC,kBAAkB;QAC3C,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,qBAAY,CAAC,gBAAgB;KACxC;IACK,GAAG,CAAC,WAAW;;YACnB,MAAM,KAAK,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAC9C,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,CAAE,CAAC;YAC9D,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC,UAAU,CAAE,CAAC;YACrD,MAAM,WAAW,GAA2B;gBAC1C,KAAK,EAAE,KAAK;gBACZ,SAAS,EAAE,QAAQ;aACpB,CAAC;YACF,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,qBAAY,CAAC,OAAO,UAAU,KAAK,IAAI,IAAI,SAAS;gBAC5D,IAAI,EAAE,WAAW;gBACjB,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,YAAY;iBACrC;gBACD,WAAW,EAAE,EAAE;aAChB,CAAC;YACF,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -7,6 +7,7 @@ export declare const githubCommon: {
|
|
|
7
7
|
repo: string;
|
|
8
8
|
owner: string;
|
|
9
9
|
}, true>;
|
|
10
|
+
assigneeDropDown: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true>;
|
|
10
11
|
};
|
|
11
12
|
export interface GithubRepository {
|
|
12
13
|
name: string;
|
|
@@ -14,3 +15,10 @@ export interface GithubRepository {
|
|
|
14
15
|
login: string;
|
|
15
16
|
};
|
|
16
17
|
}
|
|
18
|
+
export interface GithubAssignee {
|
|
19
|
+
login: string;
|
|
20
|
+
}
|
|
21
|
+
export interface RepositoryProp {
|
|
22
|
+
repo: string;
|
|
23
|
+
owner: string;
|
|
24
|
+
}
|
package/src/lib/common/index.js
CHANGED
|
@@ -33,7 +33,33 @@ exports.githubCommon = {
|
|
|
33
33
|
})
|
|
34
34
|
};
|
|
35
35
|
})
|
|
36
|
-
})
|
|
36
|
+
}),
|
|
37
|
+
assigneeDropDown: pieces_framework_1.Property.MultiSelectDropdown({
|
|
38
|
+
displayName: 'Assignee',
|
|
39
|
+
refreshers: ['repository'],
|
|
40
|
+
required: true,
|
|
41
|
+
options: ({ auth, repository }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
if (!auth || !repository) {
|
|
43
|
+
return {
|
|
44
|
+
disabled: true,
|
|
45
|
+
options: [],
|
|
46
|
+
placeholder: 'please authenticate first and select repo',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const authProp = auth;
|
|
50
|
+
const { owner, repo } = repository;
|
|
51
|
+
const assignees = yield getAssignee(authProp, owner, repo);
|
|
52
|
+
return {
|
|
53
|
+
disabled: false,
|
|
54
|
+
options: assignees.map((assignee) => {
|
|
55
|
+
return {
|
|
56
|
+
label: assignee.login,
|
|
57
|
+
value: assignee.login,
|
|
58
|
+
};
|
|
59
|
+
}),
|
|
60
|
+
};
|
|
61
|
+
}),
|
|
62
|
+
}),
|
|
37
63
|
};
|
|
38
64
|
function getUserRepo(authProp) {
|
|
39
65
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -52,4 +78,21 @@ function getUserRepo(authProp) {
|
|
|
52
78
|
return response.body;
|
|
53
79
|
});
|
|
54
80
|
}
|
|
81
|
+
function getAssignee(authProp, owner, repo) {
|
|
82
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
const request = {
|
|
84
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
85
|
+
url: `${exports.githubCommon.baseUrl}/repos/${owner}/${repo}/assignees`,
|
|
86
|
+
queryParams: {
|
|
87
|
+
per_page: '30',
|
|
88
|
+
},
|
|
89
|
+
authentication: {
|
|
90
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
91
|
+
token: authProp.access_token,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
95
|
+
return response.body;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
55
98
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/github/src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA+E;AAC/E,+DAAsG;AAEzF,QAAA,YAAY,GAAG;IACxB,OAAO,EAAE,wBAAwB;IACjC,kBAAkB,EAAE,2BAAQ,CAAC,QAAQ,CAAkC;QACnE,WAAW,EAAE,YAAY;QACzB,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAO,EAAE,IAAI,EAAE,EAAE,EAAE;YACxB,IAAI,CAAC,IAAI,EAAE;gBACP,OAAO;oBACH,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,2BAA2B;iBAC3C,CAAA;aACJ;YACD,MAAM,QAAQ,GAAwB,IAA2B,CAAC;YAClE,MAAM,YAAY,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAC;YACjD,OAAO;gBACH,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;oBAC7B,OAAO;wBACH,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI;wBACzC,KAAK,EAAE;4BACH,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;4BACvB,IAAI,EAAE,IAAI,CAAC,IAAI;yBAClB;qBACJ,CAAA;gBACL,CAAC,CAAC;aACL,CAAC;QACN,CAAC,CAAA;KACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/github/src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA+E;AAC/E,+DAAsG;AAEzF,QAAA,YAAY,GAAG;IACxB,OAAO,EAAE,wBAAwB;IACjC,kBAAkB,EAAE,2BAAQ,CAAC,QAAQ,CAAkC;QACnE,WAAW,EAAE,YA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