@activepieces/piece-github 0.8.2 → 0.8.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 -17
- package/src/index.js +98 -75
- package/src/index.d.ts +0 -6
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/add-labels-to-issue.d.ts +0 -33
- package/src/lib/actions/add-labels-to-issue.d.ts.map +0 -1
- package/src/lib/actions/add-labels-to-issue.js +0 -36
- package/src/lib/actions/add-labels-to-issue.js.map +0 -1
- package/src/lib/actions/create-branch.d.ts +0 -25
- package/src/lib/actions/create-branch.d.ts.map +0 -1
- package/src/lib/actions/create-branch.js +0 -45
- package/src/lib/actions/create-branch.js.map +0 -1
- package/src/lib/actions/create-comment-on-a-issue.d.ts +0 -17
- package/src/lib/actions/create-comment-on-a-issue.d.ts.map +0 -1
- package/src/lib/actions/create-comment-on-a-issue.js +0 -43
- package/src/lib/actions/create-comment-on-a-issue.js.map +0 -1
- package/src/lib/actions/create-commit-comment.d.ts +0 -19
- package/src/lib/actions/create-commit-comment.d.ts.map +0 -1
- package/src/lib/actions/create-commit-comment.js +0 -60
- package/src/lib/actions/create-commit-comment.js.map +0 -1
- package/src/lib/actions/create-discussion-comment.d.ts +0 -17
- package/src/lib/actions/create-discussion-comment.d.ts.map +0 -1
- package/src/lib/actions/create-discussion-comment.js +0 -60
- package/src/lib/actions/create-discussion-comment.js.map +0 -1
- package/src/lib/actions/create-gist.d.ts +0 -11
- package/src/lib/actions/create-gist.d.ts.map +0 -1
- package/src/lib/actions/create-gist.js +0 -63
- package/src/lib/actions/create-gist.js.map +0 -1
- package/src/lib/actions/create-issue.d.ts +0 -35
- package/src/lib/actions/create-issue.d.ts.map +0 -1
- package/src/lib/actions/create-issue.js +0 -53
- package/src/lib/actions/create-issue.js.map +0 -1
- package/src/lib/actions/create-pull-request-review-comment.d.ts +0 -20
- package/src/lib/actions/create-pull-request-review-comment.d.ts.map +0 -1
- package/src/lib/actions/create-pull-request-review-comment.js +0 -61
- package/src/lib/actions/create-pull-request-review-comment.js.map +0 -1
- package/src/lib/actions/delete-branch.d.ts +0 -24
- package/src/lib/actions/delete-branch.d.ts.map +0 -1
- package/src/lib/actions/delete-branch.js +0 -31
- package/src/lib/actions/delete-branch.js.map +0 -1
- package/src/lib/actions/find-branch.d.ts +0 -16
- package/src/lib/actions/find-branch.d.ts.map +0 -1
- package/src/lib/actions/find-branch.js +0 -50
- package/src/lib/actions/find-branch.js.map +0 -1
- package/src/lib/actions/find-issue.d.ts +0 -17
- package/src/lib/actions/find-issue.d.ts.map +0 -1
- package/src/lib/actions/find-issue.js +0 -60
- package/src/lib/actions/find-issue.js.map +0 -1
- package/src/lib/actions/find-user.d.ts +0 -8
- package/src/lib/actions/find-user.d.ts.map +0 -1
- package/src/lib/actions/find-user.js +0 -49
- package/src/lib/actions/find-user.js.map +0 -1
- package/src/lib/actions/get-issue-information.d.ts +0 -16
- package/src/lib/actions/get-issue-information.d.ts.map +0 -1
- package/src/lib/actions/get-issue-information.js +0 -35
- package/src/lib/actions/get-issue-information.js.map +0 -1
- package/src/lib/actions/lock-issue.d.ts +0 -21
- package/src/lib/actions/lock-issue.d.ts.map +0 -1
- package/src/lib/actions/lock-issue.js +0 -55
- package/src/lib/actions/lock-issue.js.map +0 -1
- package/src/lib/actions/raw-graphql-query.d.ts +0 -9
- package/src/lib/actions/raw-graphql-query.d.ts.map +0 -1
- package/src/lib/actions/raw-graphql-query.js +0 -36
- package/src/lib/actions/raw-graphql-query.js.map +0 -1
- package/src/lib/actions/unlock-issue.d.ts +0 -16
- package/src/lib/actions/unlock-issue.d.ts.map +0 -1
- package/src/lib/actions/unlock-issue.js +0 -35
- package/src/lib/actions/unlock-issue.js.map +0 -1
- package/src/lib/actions/update-issue.d.ts +0 -55
- package/src/lib/actions/update-issue.d.ts.map +0 -1
- package/src/lib/actions/update-issue.js +0 -81
- package/src/lib/actions/update-issue.js.map +0 -1
- package/src/lib/auth.d.ts +0 -12
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -75
- package/src/lib/auth.js.map +0 -1
- package/src/lib/common/auth-helpers.d.ts +0 -20
- package/src/lib/common/auth-helpers.d.ts.map +0 -1
- package/src/lib/common/auth-helpers.js +0 -118
- package/src/lib/common/auth-helpers.js.map +0 -1
- package/src/lib/common/index.d.ts +0 -82
- package/src/lib/common/index.d.ts.map +0 -1
- package/src/lib/common/index.js +0 -322
- package/src/lib/common/index.js.map +0 -1
- package/src/lib/trigger/index.d.ts +0 -1349
- package/src/lib/trigger/index.d.ts.map +0 -1
- package/src/lib/trigger/index.js +0 -1208
- package/src/lib/trigger/index.js.map +0 -1
- package/src/lib/trigger/new-branch.d.ts +0 -55
- package/src/lib/trigger/new-branch.d.ts.map +0 -1
- package/src/lib/trigger/new-branch.js +0 -78
- package/src/lib/trigger/new-branch.js.map +0 -1
- package/src/lib/trigger/new-collaborator.d.ts +0 -55
- package/src/lib/trigger/new-collaborator.d.ts.map +0 -1
- package/src/lib/trigger/new-collaborator.js +0 -85
- package/src/lib/trigger/new-collaborator.js.map +0 -1
- package/src/lib/trigger/new-commit.d.ts +0 -55
- package/src/lib/trigger/new-commit.d.ts.map +0 -1
- package/src/lib/trigger/new-commit.js +0 -85
- package/src/lib/trigger/new-commit.js.map +0 -1
- package/src/lib/trigger/new-label.d.ts +0 -55
- package/src/lib/trigger/new-label.d.ts.map +0 -1
- package/src/lib/trigger/new-label.js +0 -83
- package/src/lib/trigger/new-label.js.map +0 -1
- package/src/lib/trigger/new-mention.d.ts +0 -55
- package/src/lib/trigger/new-mention.d.ts.map +0 -1
- package/src/lib/trigger/new-mention.js +0 -98
- package/src/lib/trigger/new-mention.js.map +0 -1
- package/src/lib/trigger/new-milestone.d.ts +0 -55
- package/src/lib/trigger/new-milestone.d.ts.map +0 -1
- package/src/lib/trigger/new-milestone.js +0 -86
- package/src/lib/trigger/new-milestone.js.map +0 -1
- package/src/lib/trigger/new-release.d.ts +0 -55
- package/src/lib/trigger/new-release.d.ts.map +0 -1
- package/src/lib/trigger/new-release.js +0 -82
- package/src/lib/trigger/new-release.js.map +0 -1
- package/src/lib/trigger/new-review-request.d.ts +0 -55
- package/src/lib/trigger/new-review-request.d.ts.map +0 -1
- package/src/lib/trigger/new-review-request.js +0 -75
- package/src/lib/trigger/new-review-request.js.map +0 -1
- package/src/lib/trigger/register-trigger.d.ts +0 -60
- package/src/lib/trigger/register-trigger.d.ts.map +0 -1
- package/src/lib/trigger/register-trigger.js +0 -70
- package/src/lib/trigger/register-trigger.js.map +0 -1
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.githubUnlockIssueAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const auth_1 = require("../auth");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
-
exports.githubUnlockIssueAction = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.githubAuth,
|
|
11
|
-
name: 'unlockIssue',
|
|
12
|
-
displayName: 'Unlock issue',
|
|
13
|
-
description: 'Unlocks the specified issue',
|
|
14
|
-
props: {
|
|
15
|
-
repository: common_1.githubCommon.repositoryDropdown,
|
|
16
|
-
issue_number: pieces_framework_1.Property.Number({
|
|
17
|
-
displayName: 'Issue Number',
|
|
18
|
-
description: 'The number of the issue to be unlocked',
|
|
19
|
-
required: true,
|
|
20
|
-
}),
|
|
21
|
-
},
|
|
22
|
-
run(_a) {
|
|
23
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
24
|
-
const { issue_number } = propsValue;
|
|
25
|
-
const { owner, repo } = propsValue.repository;
|
|
26
|
-
const response = yield (0, common_1.githubApiCall)({
|
|
27
|
-
auth,
|
|
28
|
-
method: pieces_common_1.HttpMethod.DELETE,
|
|
29
|
-
resourceUri: `/repos/${owner}/${repo}/issues/${issue_number}/lock`,
|
|
30
|
-
});
|
|
31
|
-
return response;
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=unlock-issue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unlock-issue.js","sourceRoot":"","sources":["../../../../src/lib/actions/unlock-issue.ts"],"names":[],"mappings":";;;;AAAA,kCAAqC;AACrC,qEAAwE;AACxE,sCAAwD;AACxD,+DAAyD;AAE5C,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,6BAA6B;IAC1C,KAAK,EAAE;QACL,UAAU,EAAE,qBAAY,CAAC,kBAAkB;QAC3C,YAAY,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC5B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC;YACpC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,UAAW,CAAC;YAE/C,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAa,EAAC;gBACnC,IAAI;gBACJ,MAAM,EAAE,0BAAU,CAAC,MAAM;gBACzB,WAAW,EAAE,UAAU,KAAK,IAAI,IAAI,WAAW,YAAY,OAAO;aACnE,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
export declare const githubUpdateIssueAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
-
}>)[], {
|
|
6
|
-
repository: import("@activepieces/pieces-framework").DropdownProperty<{
|
|
7
|
-
repo: string;
|
|
8
|
-
owner: string;
|
|
9
|
-
}, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
10
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
11
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
13
|
-
}>)[]>;
|
|
14
|
-
issue_number: import("@activepieces/pieces-framework").DropdownProperty<number, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
15
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
17
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
18
|
-
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<number, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
19
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
20
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
21
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
22
|
-
}>)[]>;
|
|
23
|
-
title: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
24
|
-
body: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
25
|
-
state: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
26
|
-
state_reason: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
27
|
-
milestone: import("@activepieces/pieces-framework").DropdownProperty<number, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
28
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
29
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
30
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
31
|
-
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<number, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
32
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
33
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
34
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
35
|
-
}>)[]>;
|
|
36
|
-
labels: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
37
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
38
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
39
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
40
|
-
}>)[]> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
41
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
42
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
43
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
44
|
-
}>)[]>;
|
|
45
|
-
assignees: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
46
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
47
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
48
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
49
|
-
}>)[]> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
50
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
51
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
52
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
53
|
-
}>)[]>;
|
|
54
|
-
}>;
|
|
55
|
-
//# sourceMappingURL=update-issue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-issue.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-issue.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqElC,CAAC"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.githubUpdateIssueAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const auth_1 = require("../auth");
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
-
exports.githubUpdateIssueAction = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: auth_1.githubAuth,
|
|
11
|
-
name: 'update_issue',
|
|
12
|
-
displayName: 'Update Issue',
|
|
13
|
-
description: 'Updates an existing issue.',
|
|
14
|
-
props: {
|
|
15
|
-
repository: common_1.githubCommon.repositoryDropdown,
|
|
16
|
-
issue_number: common_1.githubCommon.issueDropdown(),
|
|
17
|
-
title: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'Title',
|
|
19
|
-
required: false,
|
|
20
|
-
}),
|
|
21
|
-
body: pieces_framework_1.Property.LongText({
|
|
22
|
-
displayName: 'Body',
|
|
23
|
-
required: false,
|
|
24
|
-
}),
|
|
25
|
-
state: pieces_framework_1.Property.StaticDropdown({
|
|
26
|
-
displayName: 'State',
|
|
27
|
-
description: 'The new state of the issue.',
|
|
28
|
-
required: false,
|
|
29
|
-
options: {
|
|
30
|
-
options: [
|
|
31
|
-
{ label: 'Open', value: 'open' },
|
|
32
|
-
{ label: 'Closed', value: 'closed' },
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
}),
|
|
36
|
-
state_reason: pieces_framework_1.Property.StaticDropdown({
|
|
37
|
-
displayName: 'State Reason',
|
|
38
|
-
description: 'The reason for the state change. (Only used if State is changed).',
|
|
39
|
-
required: false,
|
|
40
|
-
options: {
|
|
41
|
-
options: [
|
|
42
|
-
{ label: 'Completed', value: 'completed' },
|
|
43
|
-
{ label: 'Not Planned', value: 'not_planned' },
|
|
44
|
-
{ label: 'Reopened', value: 'reopened' },
|
|
45
|
-
{ label: 'Duplicate', value: 'duplicate' },
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
}),
|
|
49
|
-
milestone: common_1.githubCommon.milestoneDropdown(false),
|
|
50
|
-
labels: common_1.githubCommon.labelDropDown(false),
|
|
51
|
-
assignees: common_1.githubCommon.assigneeDropDown(false),
|
|
52
|
-
},
|
|
53
|
-
run(_a) {
|
|
54
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
55
|
-
const { owner, repo } = propsValue.repository;
|
|
56
|
-
const body = {};
|
|
57
|
-
if (propsValue.title !== undefined)
|
|
58
|
-
body.title = propsValue.title;
|
|
59
|
-
if (propsValue.body !== undefined)
|
|
60
|
-
body.body = propsValue.body;
|
|
61
|
-
if (propsValue.state !== undefined)
|
|
62
|
-
body.state = propsValue.state;
|
|
63
|
-
if (propsValue.state_reason !== undefined)
|
|
64
|
-
body.state_reason = propsValue.state_reason;
|
|
65
|
-
if (propsValue.assignees !== undefined)
|
|
66
|
-
body.assignees = propsValue.assignees;
|
|
67
|
-
if (propsValue.labels !== undefined)
|
|
68
|
-
body.labels = propsValue.labels;
|
|
69
|
-
if (propsValue.milestone !== undefined)
|
|
70
|
-
body.milestone = propsValue.milestone;
|
|
71
|
-
const response = yield (0, common_1.githubApiCall)({
|
|
72
|
-
auth,
|
|
73
|
-
method: pieces_common_1.HttpMethod.PATCH,
|
|
74
|
-
resourceUri: `/repos/${owner}/${repo}/issues/${propsValue.issue_number}`,
|
|
75
|
-
body: body,
|
|
76
|
-
});
|
|
77
|
-
return response;
|
|
78
|
-
});
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
//# sourceMappingURL=update-issue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-issue.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-issue.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,kCAAqC;AACrC,sCAAwD;AACxD,+DAAyD;AAE5C,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,cA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const githubOAuth2Auth: import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>;
|
|
2
|
-
export declare const githubAppAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
-
}>;
|
|
7
|
-
export declare const githubAuth: (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
8
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
-
}>)[];
|
|
12
|
-
//# sourceMappingURL=auth.d.ts.map
|
package/src/lib/auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,+GAO3B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;EAoCxB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;KAAoC,CAAC"}
|
package/src/lib/auth.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.githubAuth = exports.githubAppAuth = exports.githubOAuth2Auth = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const auth_helpers_1 = require("./common/auth-helpers");
|
|
7
|
-
exports.githubOAuth2Auth = pieces_framework_1.PieceAuth.OAuth2({
|
|
8
|
-
description: "Authenticate to GitHub. Platform admins can configure this with either OAuth App credentials or GitHub App credentials (Apps use the same authorize/token endpoints — only the client_id differs). When using a GitHub App, the listed scopes are ignored and the App's installation permissions apply instead.",
|
|
9
|
-
required: true,
|
|
10
|
-
authUrl: 'https://github.com/login/oauth/authorize',
|
|
11
|
-
tokenUrl: 'https://github.com/login/oauth/access_token',
|
|
12
|
-
scope: ['admin:repo_hook', 'admin:org', 'repo', 'gist'],
|
|
13
|
-
});
|
|
14
|
-
exports.githubAppAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
15
|
-
displayName: 'GitHub App',
|
|
16
|
-
description: "Authenticate as a GitHub App installation. Calls are made by the App's bot identity (e.g. `app-name[bot]`). The App must be installed on the target repos with the permissions required by the actions you intend to run (e.g. Issues: Read & write, Contents: Read & write, Administration: Read & write for webhook triggers).",
|
|
17
|
-
required: true,
|
|
18
|
-
props: {
|
|
19
|
-
appId: pieces_framework_1.Property.ShortText({
|
|
20
|
-
displayName: 'App ID or Client ID',
|
|
21
|
-
description: 'Either the numeric App ID (e.g. `12345`) or the Client ID (e.g. `Iv23li...`) of your GitHub App. The Client ID is recommended for new Apps. Found at Settings → Developer settings → GitHub Apps → your app.',
|
|
22
|
-
required: true,
|
|
23
|
-
}),
|
|
24
|
-
installationId: pieces_framework_1.Property.ShortText({
|
|
25
|
-
displayName: 'Installation ID',
|
|
26
|
-
description: 'The installation ID for the org/user where the App is installed. Visible in the installation URL: `…/installations/{id}`.',
|
|
27
|
-
required: true,
|
|
28
|
-
}),
|
|
29
|
-
privateKey: pieces_framework_1.PieceAuth.SecretText({
|
|
30
|
-
displayName: 'Private Key',
|
|
31
|
-
description: 'The PEM-encoded RSA private key generated for your GitHub App (paste the contents of the `.pem` file).',
|
|
32
|
-
required: true,
|
|
33
|
-
}),
|
|
34
|
-
},
|
|
35
|
-
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
36
|
-
const { appId, installationId, privateKey } = auth;
|
|
37
|
-
const jwt = trySignJwt({ appId, privateKey });
|
|
38
|
-
if (!jwt.ok) {
|
|
39
|
-
return { valid: false, error: jwt.error };
|
|
40
|
-
}
|
|
41
|
-
const exchange = yield tryExchangeJwt({ jwt: jwt.value, installationId });
|
|
42
|
-
return exchange.ok
|
|
43
|
-
? { valid: true }
|
|
44
|
-
: { valid: false, error: exchange.error };
|
|
45
|
-
}),
|
|
46
|
-
});
|
|
47
|
-
exports.githubAuth = [exports.githubOAuth2Auth, exports.githubAppAuth];
|
|
48
|
-
function trySignJwt({ appId, privateKey, }) {
|
|
49
|
-
try {
|
|
50
|
-
return { ok: true, value: (0, auth_helpers_1.signGithubAppJwt)({ appId, privateKey }) };
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
const message = e instanceof Error ? e.message : String(e);
|
|
54
|
-
return {
|
|
55
|
-
ok: false,
|
|
56
|
-
error: `Could not sign JWT with provided App ID / Client ID and private key: ${message}. Verify the private key is a valid PEM-encoded RSA key.`,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function tryExchangeJwt(_a) {
|
|
61
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ jwt, installationId, }) {
|
|
62
|
-
try {
|
|
63
|
-
yield (0, auth_helpers_1.exchangeAppJwtForInstallationToken)({ jwt, installationId });
|
|
64
|
-
return { ok: true };
|
|
65
|
-
}
|
|
66
|
-
catch (e) {
|
|
67
|
-
const message = e instanceof Error ? e.message : String(e);
|
|
68
|
-
return {
|
|
69
|
-
ok: false,
|
|
70
|
-
error: `Failed to obtain installation token: ${message}. Verify the Installation ID matches an installation of this App.`,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=auth.js.map
|
package/src/lib/auth.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"m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mEAAmE;aAC1H,CAAC;QACJ,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
|
|
2
|
-
import type { githubAuth } from '../auth';
|
|
3
|
-
export declare const githubAuthHelpers: {
|
|
4
|
-
getBearerToken: (auth: GithubAuthValue) => Promise<string>;
|
|
5
|
-
};
|
|
6
|
-
export declare function isAppAuth(auth: GithubAuthValue): boolean;
|
|
7
|
-
export declare function getAuthenticatedLogin(auth: GithubAuthValue): Promise<string>;
|
|
8
|
-
export declare function signGithubAppJwt({ appId, privateKey, }: {
|
|
9
|
-
appId: string;
|
|
10
|
-
privateKey: string;
|
|
11
|
-
}): string;
|
|
12
|
-
export declare function exchangeAppJwtForInstallationToken({ jwt, installationId, }: {
|
|
13
|
-
jwt: string;
|
|
14
|
-
installationId: string;
|
|
15
|
-
}): Promise<{
|
|
16
|
-
token: string;
|
|
17
|
-
expiresAt: number;
|
|
18
|
-
}>;
|
|
19
|
-
export type GithubAuthValue = AppConnectionValueForAuthProperty<typeof githubAuth>;
|
|
20
|
-
//# sourceMappingURL=auth-helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-helpers.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/auth-helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAC;AAGnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,iBAAiB;2BACC,eAAe,KAAG,OAAO,CAAC,MAAM,CAAC;CAO/D,CAAC;AAEF,wBAAgB,SAAS,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAExD;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,MAAM,CAAC,CA0BjB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,UAAU,GACX,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,CAWT;AAqBD,wBAAsB,kCAAkC,CAAC,EACvD,GAAG,EACH,cAAc,GACf,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAiBhD;AAuCD,MAAM,MAAM,eAAe,GAAG,iCAAiC,CAC7D,OAAO,UAAU,CAClB,CAAC"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.githubAuthHelpers = void 0;
|
|
4
|
-
exports.isAppAuth = isAppAuth;
|
|
5
|
-
exports.getAuthenticatedLogin = getAuthenticatedLogin;
|
|
6
|
-
exports.signGithubAppJwt = signGithubAppJwt;
|
|
7
|
-
exports.exchangeAppJwtForInstallationToken = exchangeAppJwtForInstallationToken;
|
|
8
|
-
const tslib_1 = require("tslib");
|
|
9
|
-
const shared_1 = require("@activepieces/shared");
|
|
10
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
11
|
-
const jsonwebtoken_1 = tslib_1.__importDefault(require("jsonwebtoken"));
|
|
12
|
-
exports.githubAuthHelpers = {
|
|
13
|
-
getBearerToken: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
const a = auth;
|
|
15
|
-
if (isGithubAppAuth(a)) {
|
|
16
|
-
return getInstallationToken(a.props);
|
|
17
|
-
}
|
|
18
|
-
return a.access_token;
|
|
19
|
-
}),
|
|
20
|
-
};
|
|
21
|
-
function isAppAuth(auth) {
|
|
22
|
-
return isGithubAppAuth(auth);
|
|
23
|
-
}
|
|
24
|
-
function getAuthenticatedLogin(auth) {
|
|
25
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const a = auth;
|
|
27
|
-
if (isGithubAppAuth(a)) {
|
|
28
|
-
const signedJwt = signGithubAppJwt({
|
|
29
|
-
appId: a.props.appId,
|
|
30
|
-
privateKey: a.props.privateKey,
|
|
31
|
-
});
|
|
32
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
33
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
34
|
-
url: 'https://api.github.com/app',
|
|
35
|
-
headers: {
|
|
36
|
-
Authorization: `Bearer ${signedJwt}`,
|
|
37
|
-
Accept: 'application/vnd.github+json',
|
|
38
|
-
'X-GitHub-Api-Version': '2022-11-28',
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
return `${response.body.slug}[bot]`;
|
|
42
|
-
}
|
|
43
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
44
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
45
|
-
url: 'https://api.github.com/user',
|
|
46
|
-
headers: {
|
|
47
|
-
Authorization: `Bearer ${a.access_token}`,
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
return response.body.login;
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
function signGithubAppJwt({ appId, privateKey, }) {
|
|
54
|
-
const nowSeconds = Math.floor(Date.now() / 1000);
|
|
55
|
-
return jsonwebtoken_1.default.sign({
|
|
56
|
-
iat: nowSeconds - JWT_CLOCK_SKEW_SECONDS,
|
|
57
|
-
exp: nowSeconds + JWT_LIFETIME_SECONDS,
|
|
58
|
-
iss: appId,
|
|
59
|
-
}, normalizePemKey(privateKey), { algorithm: 'RS256' });
|
|
60
|
-
}
|
|
61
|
-
function normalizePemKey(rawKey) {
|
|
62
|
-
var _a;
|
|
63
|
-
const escapedNewlinesReplaced = rawKey.replace(/\\n/g, '\n').trim();
|
|
64
|
-
if (escapedNewlinesReplaced.includes('\n')) {
|
|
65
|
-
return escapedNewlinesReplaced;
|
|
66
|
-
}
|
|
67
|
-
const match = escapedNewlinesReplaced.match(/^(-----BEGIN [A-Z0-9 ]+-----)(.+?)(-----END [A-Z0-9 ]+-----)$/);
|
|
68
|
-
if (!match) {
|
|
69
|
-
return escapedNewlinesReplaced;
|
|
70
|
-
}
|
|
71
|
-
const [, header, body, footer] = match;
|
|
72
|
-
const wrappedBody = (_a = body
|
|
73
|
-
.replace(/\s+/g, '')
|
|
74
|
-
.match(/.{1,64}/g)) === null || _a === void 0 ? void 0 : _a.join('\n');
|
|
75
|
-
return `${header}\n${wrappedBody}\n${footer}`;
|
|
76
|
-
}
|
|
77
|
-
function exchangeAppJwtForInstallationToken(_a) {
|
|
78
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ jwt, installationId, }) {
|
|
79
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
80
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
81
|
-
url: `https://api.github.com/app/installations/${installationId}/access_tokens`,
|
|
82
|
-
headers: {
|
|
83
|
-
Authorization: `Bearer ${jwt}`,
|
|
84
|
-
Accept: 'application/vnd.github+json',
|
|
85
|
-
'X-GitHub-Api-Version': '2022-11-28',
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
return {
|
|
89
|
-
token: response.body.token,
|
|
90
|
-
expiresAt: new Date(response.body.expires_at).getTime(),
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
function isGithubAppAuth(auth) {
|
|
95
|
-
return auth.type === shared_1.AppConnectionType.CUSTOM_AUTH;
|
|
96
|
-
}
|
|
97
|
-
function getInstallationToken(_a) {
|
|
98
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ appId, installationId, privateKey, }) {
|
|
99
|
-
const cacheKey = `${appId}:${installationId}`;
|
|
100
|
-
const cached = installationTokenCache.get(cacheKey);
|
|
101
|
-
const now = Date.now();
|
|
102
|
-
if (cached && cached.expiresAt - now > TOKEN_REFRESH_LEEWAY_MS) {
|
|
103
|
-
return cached.token;
|
|
104
|
-
}
|
|
105
|
-
const signedJwt = signGithubAppJwt({ appId, privateKey });
|
|
106
|
-
const { token, expiresAt } = yield exchangeAppJwtForInstallationToken({
|
|
107
|
-
jwt: signedJwt,
|
|
108
|
-
installationId,
|
|
109
|
-
});
|
|
110
|
-
installationTokenCache.set(cacheKey, { token, expiresAt });
|
|
111
|
-
return token;
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
const JWT_CLOCK_SKEW_SECONDS = 60;
|
|
115
|
-
const JWT_LIFETIME_SECONDS = 540;
|
|
116
|
-
const TOKEN_REFRESH_LEEWAY_MS = 60 * 1000;
|
|
117
|
-
const installationTokenCache = new Map();
|
|
118
|
-
//# sourceMappingURL=auth-helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-helpers.js","sourceRoot":"","sources":["../../../../src/lib/common/auth-helpers.ts"],"names":[],"mappings":";;;AAgBA,8BAEC;AAED,sDA4BC;AAED,4CAiBC;AAqBD,gFAuBC;;AA/GD,iDAAyD;AAEzD,+DAAqE;AACrE,wEAA+B;AAGlB,QAAA,iBAAiB,GAAG;IAC/B,cAAc,EAAE,CAAO,IAAqB,EAAmB,EAAE;QAC/D,MAAM,CAAC,GAAG,IAAkB,CAAC;QAC7B,IAAI,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;YACvB,OAAO,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,CAAC,CAAC,YAAY,CAAC;IACxB,CAAC,CAAA;CACF,CAAC;AAEF,SAAgB,SAAS,CAAC,IAAqB;IAC7C,OAAO,eAAe,CAAC,IAAkB,CAAC,CAAC;AAC7C,CAAC;AAED,SAAsB,qBAAqB,CACzC,IAAqB;;QAErB,MAAM,CAAC,GAAG,IAAkB,CAAC;QAC7B,IAAI,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;YACvB,MAAM,SAAS,GAAG,gBAAgB,CAAC;gBACjC,KAAK,EA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GAAG,KAAK,IAAI,cAAc,EAAE,CAAC;QAC9C,MAAM,MAAM,GAAG,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACpD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,MAAM,IAAI,MAAM,CAAC,SAAS,GAAG,GAAG,GAAG,uBAAuB,EAAE,CAAC;YAC/D,OAAO,MAAM,CAAC,KAAK,CAAC;QACtB,CAAC;QACD,MAAM,SAAS,GAAG,gBAAgB,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;QAC1D,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,kCAAkC,CAAC;YACpE,GAAG,EAAE,SAAS;YACd,cAAc;SACf,CAAC,CAAC;QACH,sBAAsB,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAC3D,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AAED,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,CAAC;AAE1C,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAGnC,CAAC"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { HttpMessageBody, HttpMethod, HttpResponse } from '@activepieces/pieces-common';
|
|
2
|
-
import { GithubAuthValue } from './auth-helpers';
|
|
3
|
-
export declare const githubCommon: {
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
repositoryDropdown: import("@activepieces/pieces-framework").DropdownProperty<{
|
|
6
|
-
repo: string;
|
|
7
|
-
owner: string;
|
|
8
|
-
}, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
11
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
12
|
-
}>)[]>;
|
|
13
|
-
milestoneDropdown: (required?: boolean) => import("@activepieces/pieces-framework").DropdownProperty<number, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
14
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
15
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
17
|
-
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<number, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
18
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
19
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
20
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
21
|
-
}>)[]>;
|
|
22
|
-
branchDropdown: (displayName: string, desc: string, required?: boolean) => import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
23
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
24
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
25
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
26
|
-
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
27
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
28
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
29
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
30
|
-
}>)[]>;
|
|
31
|
-
issueDropdown: (required?: boolean) => import("@activepieces/pieces-framework").DropdownProperty<number, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
32
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
33
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
34
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
35
|
-
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<number, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
36
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
37
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
38
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
39
|
-
}>)[]>;
|
|
40
|
-
assigneeSingleDropdown: (required?: boolean) => import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
41
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
42
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
43
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
44
|
-
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
45
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
46
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
47
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
48
|
-
}>)[]>;
|
|
49
|
-
assigneeDropDown: (required?: boolean) => import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
50
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
51
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
52
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
53
|
-
}>)[]> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
54
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
55
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
56
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
57
|
-
}>)[]>;
|
|
58
|
-
labelDropDown: (required?: boolean) => import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
59
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
60
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
61
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
62
|
-
}>)[]> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
63
|
-
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
64
|
-
installationId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
65
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
66
|
-
}>)[]>;
|
|
67
|
-
};
|
|
68
|
-
export declare function githubApiCall<T extends HttpMessageBody>({ auth, method, resourceUri, query, body, }: GithubApiCallParams): Promise<HttpResponse<T>>;
|
|
69
|
-
export declare function githubPaginatedApiCall<T extends HttpMessageBody>({ auth, method, resourceUri, query, body, }: GithubApiCallParams): Promise<T[]>;
|
|
70
|
-
export interface RepositoryProp {
|
|
71
|
-
repo: string;
|
|
72
|
-
owner: string;
|
|
73
|
-
}
|
|
74
|
-
export type RequestParams = Record<string, string | number | string[] | undefined>;
|
|
75
|
-
export type GithubApiCallParams = {
|
|
76
|
-
auth: GithubAuthValue;
|
|
77
|
-
method: HttpMethod;
|
|
78
|
-
resourceUri: string;
|
|
79
|
-
query?: RequestParams;
|
|
80
|
-
body?: any;
|
|
81
|
-
};
|
|
82
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,UAAU,EAEV,YAAY,EAEb,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAAqB,eAAe,EAAa,MAAM,gBAAgB,CAAC;AAE/E,eAAO,MAAM,YAAY;;;cAGb,MAAM;eAAS,MAAM;;;;;;;;;;;;;;;kCAkED,MAAM,QAAQ,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiKnD,CAAC;AA0DF,wBAAsB,aAAa,CAAC,CAAC,SAAS,eAAe,EAAE,EAC7D,IAAI,EACJ,MAAM,EACN,WAAW,EACX,KAAK,EACL,IAAI,GACL,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAyBhD;AAED,wBAAsB,sBAAsB,CAAC,CAAC,SAAS,eAAe,EAAE,EACtE,IAAI,EACJ,MAAM,EACN,WAAW,EACX,KAAK,EACL,IAAI,GACL,EAAE,mBAAmB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAwBpC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAChC,MAAM,EACN,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CACvC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,CAAC"}
|