@bretwardjames/ghp-core 0.1.0 → 0.1.2
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/dist/index.cjs +67 -0
- package/dist/index.d.cts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +67 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -74,6 +74,8 @@ __export(queries_exports, {
|
|
|
74
74
|
REMOVE_LABELS_MUTATION: () => REMOVE_LABELS_MUTATION,
|
|
75
75
|
REPOSITORY_ID_QUERY: () => REPOSITORY_ID_QUERY,
|
|
76
76
|
REPOSITORY_PROJECTS_QUERY: () => REPOSITORY_PROJECTS_QUERY,
|
|
77
|
+
UPDATE_ISSUE_BODY_MUTATION: () => UPDATE_ISSUE_BODY_MUTATION,
|
|
78
|
+
UPDATE_ISSUE_MUTATION: () => UPDATE_ISSUE_MUTATION,
|
|
77
79
|
UPDATE_ISSUE_TYPE_MUTATION: () => UPDATE_ISSUE_TYPE_MUTATION,
|
|
78
80
|
UPDATE_ITEM_FIELD_MUTATION: () => UPDATE_ITEM_FIELD_MUTATION,
|
|
79
81
|
UPDATE_ITEM_STATUS_MUTATION: () => UPDATE_ITEM_STATUS_MUTATION,
|
|
@@ -420,6 +422,24 @@ var UPDATE_ISSUE_TYPE_MUTATION = `
|
|
|
420
422
|
}
|
|
421
423
|
}
|
|
422
424
|
`;
|
|
425
|
+
var UPDATE_ISSUE_BODY_MUTATION = `
|
|
426
|
+
mutation($issueId: ID!, $body: String!) {
|
|
427
|
+
updateIssue(input: { id: $issueId, body: $body }) {
|
|
428
|
+
issue {
|
|
429
|
+
id
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
`;
|
|
434
|
+
var UPDATE_ISSUE_MUTATION = `
|
|
435
|
+
mutation($issueId: ID!, $title: String, $body: String) {
|
|
436
|
+
updateIssue(input: { id: $issueId, title: $title, body: $body }) {
|
|
437
|
+
issue {
|
|
438
|
+
id
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
`;
|
|
423
443
|
|
|
424
444
|
// src/github-api.ts
|
|
425
445
|
function createAuthError(message, type, details) {
|
|
@@ -935,6 +955,53 @@ var GitHubAPI = class {
|
|
|
935
955
|
return false;
|
|
936
956
|
}
|
|
937
957
|
}
|
|
958
|
+
/**
|
|
959
|
+
* Update an issue's body/description
|
|
960
|
+
*/
|
|
961
|
+
async updateIssueBody(repo, issueNumber, body) {
|
|
962
|
+
if (!this.graphqlWithAuth) throw new Error("Not authenticated");
|
|
963
|
+
try {
|
|
964
|
+
const issueResponse = await this.graphqlWithAuth(ISSUE_FOR_UPDATE_QUERY, {
|
|
965
|
+
owner: repo.owner,
|
|
966
|
+
name: repo.name,
|
|
967
|
+
number: issueNumber
|
|
968
|
+
});
|
|
969
|
+
if (!issueResponse.repository.issue) {
|
|
970
|
+
return false;
|
|
971
|
+
}
|
|
972
|
+
await this.graphqlWithAuth(UPDATE_ISSUE_BODY_MUTATION, {
|
|
973
|
+
issueId: issueResponse.repository.issue.id,
|
|
974
|
+
body
|
|
975
|
+
});
|
|
976
|
+
return true;
|
|
977
|
+
} catch {
|
|
978
|
+
return false;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Update an issue's title and/or body
|
|
983
|
+
*/
|
|
984
|
+
async updateIssue(repo, issueNumber, updates) {
|
|
985
|
+
if (!this.graphqlWithAuth) throw new Error("Not authenticated");
|
|
986
|
+
try {
|
|
987
|
+
const issueResponse = await this.graphqlWithAuth(ISSUE_FOR_UPDATE_QUERY, {
|
|
988
|
+
owner: repo.owner,
|
|
989
|
+
name: repo.name,
|
|
990
|
+
number: issueNumber
|
|
991
|
+
});
|
|
992
|
+
if (!issueResponse.repository.issue) {
|
|
993
|
+
return false;
|
|
994
|
+
}
|
|
995
|
+
await this.graphqlWithAuth(UPDATE_ISSUE_MUTATION, {
|
|
996
|
+
issueId: issueResponse.repository.issue.id,
|
|
997
|
+
title: updates.title,
|
|
998
|
+
body: updates.body
|
|
999
|
+
});
|
|
1000
|
+
return true;
|
|
1001
|
+
} catch {
|
|
1002
|
+
return false;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
938
1005
|
};
|
|
939
1006
|
|
|
940
1007
|
// src/branch-linker.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -513,6 +513,17 @@ declare class GitHubAPI {
|
|
|
513
513
|
* Set the issue type on an issue
|
|
514
514
|
*/
|
|
515
515
|
setIssueType(repo: RepoInfo, issueNumber: number, issueTypeId: string): Promise<boolean>;
|
|
516
|
+
/**
|
|
517
|
+
* Update an issue's body/description
|
|
518
|
+
*/
|
|
519
|
+
updateIssueBody(repo: RepoInfo, issueNumber: number, body: string): Promise<boolean>;
|
|
520
|
+
/**
|
|
521
|
+
* Update an issue's title and/or body
|
|
522
|
+
*/
|
|
523
|
+
updateIssue(repo: RepoInfo, issueNumber: number, updates: {
|
|
524
|
+
title?: string;
|
|
525
|
+
body?: string;
|
|
526
|
+
}): Promise<boolean>;
|
|
516
527
|
}
|
|
517
528
|
|
|
518
529
|
/**
|
|
@@ -854,6 +865,14 @@ declare const ISSUE_FOR_UPDATE_QUERY = "\n query($owner: String!, $name: Stri
|
|
|
854
865
|
* Mutation to update issue type
|
|
855
866
|
*/
|
|
856
867
|
declare const UPDATE_ISSUE_TYPE_MUTATION = "\n mutation($issueId: ID!, $issueTypeId: ID!) {\n updateIssue(input: { id: $issueId, issueTypeId: $issueTypeId }) {\n issue {\n id\n }\n }\n }\n";
|
|
868
|
+
/**
|
|
869
|
+
* Mutation to update issue body/description
|
|
870
|
+
*/
|
|
871
|
+
declare const UPDATE_ISSUE_BODY_MUTATION = "\n mutation($issueId: ID!, $body: String!) {\n updateIssue(input: { id: $issueId, body: $body }) {\n issue {\n id\n }\n }\n }\n";
|
|
872
|
+
/**
|
|
873
|
+
* Mutation to update issue title and/or body
|
|
874
|
+
*/
|
|
875
|
+
declare const UPDATE_ISSUE_MUTATION = "\n mutation($issueId: ID!, $title: String, $body: String) {\n updateIssue(input: { id: $issueId, title: $title, body: $body }) {\n issue {\n id\n }\n }\n }\n";
|
|
857
876
|
|
|
858
877
|
declare const queries_ADD_COMMENT_MUTATION: typeof ADD_COMMENT_MUTATION;
|
|
859
878
|
declare const queries_ADD_LABELS_MUTATION: typeof ADD_LABELS_MUTATION;
|
|
@@ -874,12 +893,14 @@ declare const queries_RECENT_ISSUES_QUERY: typeof RECENT_ISSUES_QUERY;
|
|
|
874
893
|
declare const queries_REMOVE_LABELS_MUTATION: typeof REMOVE_LABELS_MUTATION;
|
|
875
894
|
declare const queries_REPOSITORY_ID_QUERY: typeof REPOSITORY_ID_QUERY;
|
|
876
895
|
declare const queries_REPOSITORY_PROJECTS_QUERY: typeof REPOSITORY_PROJECTS_QUERY;
|
|
896
|
+
declare const queries_UPDATE_ISSUE_BODY_MUTATION: typeof UPDATE_ISSUE_BODY_MUTATION;
|
|
897
|
+
declare const queries_UPDATE_ISSUE_MUTATION: typeof UPDATE_ISSUE_MUTATION;
|
|
877
898
|
declare const queries_UPDATE_ISSUE_TYPE_MUTATION: typeof UPDATE_ISSUE_TYPE_MUTATION;
|
|
878
899
|
declare const queries_UPDATE_ITEM_FIELD_MUTATION: typeof UPDATE_ITEM_FIELD_MUTATION;
|
|
879
900
|
declare const queries_UPDATE_ITEM_STATUS_MUTATION: typeof UPDATE_ITEM_STATUS_MUTATION;
|
|
880
901
|
declare const queries_VIEWER_QUERY: typeof VIEWER_QUERY;
|
|
881
902
|
declare namespace queries {
|
|
882
|
-
export { queries_ADD_COMMENT_MUTATION as ADD_COMMENT_MUTATION, queries_ADD_LABELS_MUTATION as ADD_LABELS_MUTATION, queries_ADD_TO_PROJECT_MUTATION as ADD_TO_PROJECT_MUTATION, queries_COLLABORATORS_QUERY as COLLABORATORS_QUERY, queries_CREATE_ISSUE_MUTATION as CREATE_ISSUE_MUTATION, queries_ISSUES_WITH_LABEL_QUERY as ISSUES_WITH_LABEL_QUERY, queries_ISSUE_AND_LABEL_QUERY as ISSUE_AND_LABEL_QUERY, queries_ISSUE_DETAILS_QUERY as ISSUE_DETAILS_QUERY, queries_ISSUE_FOR_UPDATE_QUERY as ISSUE_FOR_UPDATE_QUERY, queries_ISSUE_NODE_ID_QUERY as ISSUE_NODE_ID_QUERY, queries_ISSUE_TYPES_QUERY as ISSUE_TYPES_QUERY, queries_LABEL_EXISTS_QUERY as LABEL_EXISTS_QUERY, queries_PROJECT_FIELDS_QUERY as PROJECT_FIELDS_QUERY, queries_PROJECT_ITEMS_QUERY as PROJECT_ITEMS_QUERY, queries_PROJECT_VIEWS_QUERY as PROJECT_VIEWS_QUERY, queries_RECENT_ISSUES_QUERY as RECENT_ISSUES_QUERY, queries_REMOVE_LABELS_MUTATION as REMOVE_LABELS_MUTATION, queries_REPOSITORY_ID_QUERY as REPOSITORY_ID_QUERY, queries_REPOSITORY_PROJECTS_QUERY as REPOSITORY_PROJECTS_QUERY, queries_UPDATE_ISSUE_TYPE_MUTATION as UPDATE_ISSUE_TYPE_MUTATION, queries_UPDATE_ITEM_FIELD_MUTATION as UPDATE_ITEM_FIELD_MUTATION, queries_UPDATE_ITEM_STATUS_MUTATION as UPDATE_ITEM_STATUS_MUTATION, queries_VIEWER_QUERY as VIEWER_QUERY };
|
|
903
|
+
export { queries_ADD_COMMENT_MUTATION as ADD_COMMENT_MUTATION, queries_ADD_LABELS_MUTATION as ADD_LABELS_MUTATION, queries_ADD_TO_PROJECT_MUTATION as ADD_TO_PROJECT_MUTATION, queries_COLLABORATORS_QUERY as COLLABORATORS_QUERY, queries_CREATE_ISSUE_MUTATION as CREATE_ISSUE_MUTATION, queries_ISSUES_WITH_LABEL_QUERY as ISSUES_WITH_LABEL_QUERY, queries_ISSUE_AND_LABEL_QUERY as ISSUE_AND_LABEL_QUERY, queries_ISSUE_DETAILS_QUERY as ISSUE_DETAILS_QUERY, queries_ISSUE_FOR_UPDATE_QUERY as ISSUE_FOR_UPDATE_QUERY, queries_ISSUE_NODE_ID_QUERY as ISSUE_NODE_ID_QUERY, queries_ISSUE_TYPES_QUERY as ISSUE_TYPES_QUERY, queries_LABEL_EXISTS_QUERY as LABEL_EXISTS_QUERY, queries_PROJECT_FIELDS_QUERY as PROJECT_FIELDS_QUERY, queries_PROJECT_ITEMS_QUERY as PROJECT_ITEMS_QUERY, queries_PROJECT_VIEWS_QUERY as PROJECT_VIEWS_QUERY, queries_RECENT_ISSUES_QUERY as RECENT_ISSUES_QUERY, queries_REMOVE_LABELS_MUTATION as REMOVE_LABELS_MUTATION, queries_REPOSITORY_ID_QUERY as REPOSITORY_ID_QUERY, queries_REPOSITORY_PROJECTS_QUERY as REPOSITORY_PROJECTS_QUERY, queries_UPDATE_ISSUE_BODY_MUTATION as UPDATE_ISSUE_BODY_MUTATION, queries_UPDATE_ISSUE_MUTATION as UPDATE_ISSUE_MUTATION, queries_UPDATE_ISSUE_TYPE_MUTATION as UPDATE_ISSUE_TYPE_MUTATION, queries_UPDATE_ITEM_FIELD_MUTATION as UPDATE_ITEM_FIELD_MUTATION, queries_UPDATE_ITEM_STATUS_MUTATION as UPDATE_ITEM_STATUS_MUTATION, queries_VIEWER_QUERY as VIEWER_QUERY };
|
|
883
904
|
}
|
|
884
905
|
|
|
885
906
|
export { type AssigneeInfo, type AuthError, type BranchLink, BranchLinker, type Collaborator, type DateFieldValue, type FieldInfo, type FieldValue, type FieldValueConnection, GitHubAPI, type GitHubAPIOptions, type GitOptions, type IssueDetails, type IssueReference, type IterationFieldValue, type LabelInfo, type NumberFieldValue, type Project, type ProjectConfig, type ProjectItem, type ProjectItemContent, type ProjectItemsQueryResponse, type ProjectV2, type ProjectV2Field, type ProjectV2Item, type ProjectV2View, type ProjectWithViews, type ProjectsQueryResponse, type RepoInfo, type SingleSelectFieldValue, type StatusField, type StorageAdapter, type TextFieldValue, type TokenProvider, branchExists, buildIssueUrl, buildOrgProjectUrl, buildProjectUrl, buildPullRequestUrl, buildRepoUrl, checkoutBranch, createBranch, createInMemoryAdapter, detectRepository, fetchOrigin, generateBranchName, getCommitsAhead, getCommitsBehind, getCurrentBranch, getDefaultBranch, getRepositoryRoot, hasUncommittedChanges, isGitRepository, parseGitHubUrl, parseIssueUrl, pullLatest, queries, sanitizeForBranchName };
|
package/dist/index.d.ts
CHANGED
|
@@ -513,6 +513,17 @@ declare class GitHubAPI {
|
|
|
513
513
|
* Set the issue type on an issue
|
|
514
514
|
*/
|
|
515
515
|
setIssueType(repo: RepoInfo, issueNumber: number, issueTypeId: string): Promise<boolean>;
|
|
516
|
+
/**
|
|
517
|
+
* Update an issue's body/description
|
|
518
|
+
*/
|
|
519
|
+
updateIssueBody(repo: RepoInfo, issueNumber: number, body: string): Promise<boolean>;
|
|
520
|
+
/**
|
|
521
|
+
* Update an issue's title and/or body
|
|
522
|
+
*/
|
|
523
|
+
updateIssue(repo: RepoInfo, issueNumber: number, updates: {
|
|
524
|
+
title?: string;
|
|
525
|
+
body?: string;
|
|
526
|
+
}): Promise<boolean>;
|
|
516
527
|
}
|
|
517
528
|
|
|
518
529
|
/**
|
|
@@ -854,6 +865,14 @@ declare const ISSUE_FOR_UPDATE_QUERY = "\n query($owner: String!, $name: Stri
|
|
|
854
865
|
* Mutation to update issue type
|
|
855
866
|
*/
|
|
856
867
|
declare const UPDATE_ISSUE_TYPE_MUTATION = "\n mutation($issueId: ID!, $issueTypeId: ID!) {\n updateIssue(input: { id: $issueId, issueTypeId: $issueTypeId }) {\n issue {\n id\n }\n }\n }\n";
|
|
868
|
+
/**
|
|
869
|
+
* Mutation to update issue body/description
|
|
870
|
+
*/
|
|
871
|
+
declare const UPDATE_ISSUE_BODY_MUTATION = "\n mutation($issueId: ID!, $body: String!) {\n updateIssue(input: { id: $issueId, body: $body }) {\n issue {\n id\n }\n }\n }\n";
|
|
872
|
+
/**
|
|
873
|
+
* Mutation to update issue title and/or body
|
|
874
|
+
*/
|
|
875
|
+
declare const UPDATE_ISSUE_MUTATION = "\n mutation($issueId: ID!, $title: String, $body: String) {\n updateIssue(input: { id: $issueId, title: $title, body: $body }) {\n issue {\n id\n }\n }\n }\n";
|
|
857
876
|
|
|
858
877
|
declare const queries_ADD_COMMENT_MUTATION: typeof ADD_COMMENT_MUTATION;
|
|
859
878
|
declare const queries_ADD_LABELS_MUTATION: typeof ADD_LABELS_MUTATION;
|
|
@@ -874,12 +893,14 @@ declare const queries_RECENT_ISSUES_QUERY: typeof RECENT_ISSUES_QUERY;
|
|
|
874
893
|
declare const queries_REMOVE_LABELS_MUTATION: typeof REMOVE_LABELS_MUTATION;
|
|
875
894
|
declare const queries_REPOSITORY_ID_QUERY: typeof REPOSITORY_ID_QUERY;
|
|
876
895
|
declare const queries_REPOSITORY_PROJECTS_QUERY: typeof REPOSITORY_PROJECTS_QUERY;
|
|
896
|
+
declare const queries_UPDATE_ISSUE_BODY_MUTATION: typeof UPDATE_ISSUE_BODY_MUTATION;
|
|
897
|
+
declare const queries_UPDATE_ISSUE_MUTATION: typeof UPDATE_ISSUE_MUTATION;
|
|
877
898
|
declare const queries_UPDATE_ISSUE_TYPE_MUTATION: typeof UPDATE_ISSUE_TYPE_MUTATION;
|
|
878
899
|
declare const queries_UPDATE_ITEM_FIELD_MUTATION: typeof UPDATE_ITEM_FIELD_MUTATION;
|
|
879
900
|
declare const queries_UPDATE_ITEM_STATUS_MUTATION: typeof UPDATE_ITEM_STATUS_MUTATION;
|
|
880
901
|
declare const queries_VIEWER_QUERY: typeof VIEWER_QUERY;
|
|
881
902
|
declare namespace queries {
|
|
882
|
-
export { queries_ADD_COMMENT_MUTATION as ADD_COMMENT_MUTATION, queries_ADD_LABELS_MUTATION as ADD_LABELS_MUTATION, queries_ADD_TO_PROJECT_MUTATION as ADD_TO_PROJECT_MUTATION, queries_COLLABORATORS_QUERY as COLLABORATORS_QUERY, queries_CREATE_ISSUE_MUTATION as CREATE_ISSUE_MUTATION, queries_ISSUES_WITH_LABEL_QUERY as ISSUES_WITH_LABEL_QUERY, queries_ISSUE_AND_LABEL_QUERY as ISSUE_AND_LABEL_QUERY, queries_ISSUE_DETAILS_QUERY as ISSUE_DETAILS_QUERY, queries_ISSUE_FOR_UPDATE_QUERY as ISSUE_FOR_UPDATE_QUERY, queries_ISSUE_NODE_ID_QUERY as ISSUE_NODE_ID_QUERY, queries_ISSUE_TYPES_QUERY as ISSUE_TYPES_QUERY, queries_LABEL_EXISTS_QUERY as LABEL_EXISTS_QUERY, queries_PROJECT_FIELDS_QUERY as PROJECT_FIELDS_QUERY, queries_PROJECT_ITEMS_QUERY as PROJECT_ITEMS_QUERY, queries_PROJECT_VIEWS_QUERY as PROJECT_VIEWS_QUERY, queries_RECENT_ISSUES_QUERY as RECENT_ISSUES_QUERY, queries_REMOVE_LABELS_MUTATION as REMOVE_LABELS_MUTATION, queries_REPOSITORY_ID_QUERY as REPOSITORY_ID_QUERY, queries_REPOSITORY_PROJECTS_QUERY as REPOSITORY_PROJECTS_QUERY, queries_UPDATE_ISSUE_TYPE_MUTATION as UPDATE_ISSUE_TYPE_MUTATION, queries_UPDATE_ITEM_FIELD_MUTATION as UPDATE_ITEM_FIELD_MUTATION, queries_UPDATE_ITEM_STATUS_MUTATION as UPDATE_ITEM_STATUS_MUTATION, queries_VIEWER_QUERY as VIEWER_QUERY };
|
|
903
|
+
export { queries_ADD_COMMENT_MUTATION as ADD_COMMENT_MUTATION, queries_ADD_LABELS_MUTATION as ADD_LABELS_MUTATION, queries_ADD_TO_PROJECT_MUTATION as ADD_TO_PROJECT_MUTATION, queries_COLLABORATORS_QUERY as COLLABORATORS_QUERY, queries_CREATE_ISSUE_MUTATION as CREATE_ISSUE_MUTATION, queries_ISSUES_WITH_LABEL_QUERY as ISSUES_WITH_LABEL_QUERY, queries_ISSUE_AND_LABEL_QUERY as ISSUE_AND_LABEL_QUERY, queries_ISSUE_DETAILS_QUERY as ISSUE_DETAILS_QUERY, queries_ISSUE_FOR_UPDATE_QUERY as ISSUE_FOR_UPDATE_QUERY, queries_ISSUE_NODE_ID_QUERY as ISSUE_NODE_ID_QUERY, queries_ISSUE_TYPES_QUERY as ISSUE_TYPES_QUERY, queries_LABEL_EXISTS_QUERY as LABEL_EXISTS_QUERY, queries_PROJECT_FIELDS_QUERY as PROJECT_FIELDS_QUERY, queries_PROJECT_ITEMS_QUERY as PROJECT_ITEMS_QUERY, queries_PROJECT_VIEWS_QUERY as PROJECT_VIEWS_QUERY, queries_RECENT_ISSUES_QUERY as RECENT_ISSUES_QUERY, queries_REMOVE_LABELS_MUTATION as REMOVE_LABELS_MUTATION, queries_REPOSITORY_ID_QUERY as REPOSITORY_ID_QUERY, queries_REPOSITORY_PROJECTS_QUERY as REPOSITORY_PROJECTS_QUERY, queries_UPDATE_ISSUE_BODY_MUTATION as UPDATE_ISSUE_BODY_MUTATION, queries_UPDATE_ISSUE_MUTATION as UPDATE_ISSUE_MUTATION, queries_UPDATE_ISSUE_TYPE_MUTATION as UPDATE_ISSUE_TYPE_MUTATION, queries_UPDATE_ITEM_FIELD_MUTATION as UPDATE_ITEM_FIELD_MUTATION, queries_UPDATE_ITEM_STATUS_MUTATION as UPDATE_ITEM_STATUS_MUTATION, queries_VIEWER_QUERY as VIEWER_QUERY };
|
|
883
904
|
}
|
|
884
905
|
|
|
885
906
|
export { type AssigneeInfo, type AuthError, type BranchLink, BranchLinker, type Collaborator, type DateFieldValue, type FieldInfo, type FieldValue, type FieldValueConnection, GitHubAPI, type GitHubAPIOptions, type GitOptions, type IssueDetails, type IssueReference, type IterationFieldValue, type LabelInfo, type NumberFieldValue, type Project, type ProjectConfig, type ProjectItem, type ProjectItemContent, type ProjectItemsQueryResponse, type ProjectV2, type ProjectV2Field, type ProjectV2Item, type ProjectV2View, type ProjectWithViews, type ProjectsQueryResponse, type RepoInfo, type SingleSelectFieldValue, type StatusField, type StorageAdapter, type TextFieldValue, type TokenProvider, branchExists, buildIssueUrl, buildOrgProjectUrl, buildProjectUrl, buildPullRequestUrl, buildRepoUrl, checkoutBranch, createBranch, createInMemoryAdapter, detectRepository, fetchOrigin, generateBranchName, getCommitsAhead, getCommitsBehind, getCurrentBranch, getDefaultBranch, getRepositoryRoot, hasUncommittedChanges, isGitRepository, parseGitHubUrl, parseIssueUrl, pullLatest, queries, sanitizeForBranchName };
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,8 @@ __export(queries_exports, {
|
|
|
29
29
|
REMOVE_LABELS_MUTATION: () => REMOVE_LABELS_MUTATION,
|
|
30
30
|
REPOSITORY_ID_QUERY: () => REPOSITORY_ID_QUERY,
|
|
31
31
|
REPOSITORY_PROJECTS_QUERY: () => REPOSITORY_PROJECTS_QUERY,
|
|
32
|
+
UPDATE_ISSUE_BODY_MUTATION: () => UPDATE_ISSUE_BODY_MUTATION,
|
|
33
|
+
UPDATE_ISSUE_MUTATION: () => UPDATE_ISSUE_MUTATION,
|
|
32
34
|
UPDATE_ISSUE_TYPE_MUTATION: () => UPDATE_ISSUE_TYPE_MUTATION,
|
|
33
35
|
UPDATE_ITEM_FIELD_MUTATION: () => UPDATE_ITEM_FIELD_MUTATION,
|
|
34
36
|
UPDATE_ITEM_STATUS_MUTATION: () => UPDATE_ITEM_STATUS_MUTATION,
|
|
@@ -375,6 +377,24 @@ var UPDATE_ISSUE_TYPE_MUTATION = `
|
|
|
375
377
|
}
|
|
376
378
|
}
|
|
377
379
|
`;
|
|
380
|
+
var UPDATE_ISSUE_BODY_MUTATION = `
|
|
381
|
+
mutation($issueId: ID!, $body: String!) {
|
|
382
|
+
updateIssue(input: { id: $issueId, body: $body }) {
|
|
383
|
+
issue {
|
|
384
|
+
id
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
`;
|
|
389
|
+
var UPDATE_ISSUE_MUTATION = `
|
|
390
|
+
mutation($issueId: ID!, $title: String, $body: String) {
|
|
391
|
+
updateIssue(input: { id: $issueId, title: $title, body: $body }) {
|
|
392
|
+
issue {
|
|
393
|
+
id
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
`;
|
|
378
398
|
|
|
379
399
|
// src/github-api.ts
|
|
380
400
|
function createAuthError(message, type, details) {
|
|
@@ -890,6 +910,53 @@ var GitHubAPI = class {
|
|
|
890
910
|
return false;
|
|
891
911
|
}
|
|
892
912
|
}
|
|
913
|
+
/**
|
|
914
|
+
* Update an issue's body/description
|
|
915
|
+
*/
|
|
916
|
+
async updateIssueBody(repo, issueNumber, body) {
|
|
917
|
+
if (!this.graphqlWithAuth) throw new Error("Not authenticated");
|
|
918
|
+
try {
|
|
919
|
+
const issueResponse = await this.graphqlWithAuth(ISSUE_FOR_UPDATE_QUERY, {
|
|
920
|
+
owner: repo.owner,
|
|
921
|
+
name: repo.name,
|
|
922
|
+
number: issueNumber
|
|
923
|
+
});
|
|
924
|
+
if (!issueResponse.repository.issue) {
|
|
925
|
+
return false;
|
|
926
|
+
}
|
|
927
|
+
await this.graphqlWithAuth(UPDATE_ISSUE_BODY_MUTATION, {
|
|
928
|
+
issueId: issueResponse.repository.issue.id,
|
|
929
|
+
body
|
|
930
|
+
});
|
|
931
|
+
return true;
|
|
932
|
+
} catch {
|
|
933
|
+
return false;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Update an issue's title and/or body
|
|
938
|
+
*/
|
|
939
|
+
async updateIssue(repo, issueNumber, updates) {
|
|
940
|
+
if (!this.graphqlWithAuth) throw new Error("Not authenticated");
|
|
941
|
+
try {
|
|
942
|
+
const issueResponse = await this.graphqlWithAuth(ISSUE_FOR_UPDATE_QUERY, {
|
|
943
|
+
owner: repo.owner,
|
|
944
|
+
name: repo.name,
|
|
945
|
+
number: issueNumber
|
|
946
|
+
});
|
|
947
|
+
if (!issueResponse.repository.issue) {
|
|
948
|
+
return false;
|
|
949
|
+
}
|
|
950
|
+
await this.graphqlWithAuth(UPDATE_ISSUE_MUTATION, {
|
|
951
|
+
issueId: issueResponse.repository.issue.id,
|
|
952
|
+
title: updates.title,
|
|
953
|
+
body: updates.body
|
|
954
|
+
});
|
|
955
|
+
return true;
|
|
956
|
+
} catch {
|
|
957
|
+
return false;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
893
960
|
};
|
|
894
961
|
|
|
895
962
|
// src/branch-linker.ts
|