autoforce 0.1.4 → 0.1.6

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 (58) hide show
  1. package/README.md +42 -2
  2. package/lib/jest.config.d.ts +16 -0
  3. package/lib/jest.config.js +14 -0
  4. package/lib/{auto.js → src/auto.js} +1 -1
  5. package/lib/{helpers → src/helpers}/color.d.ts +1 -0
  6. package/lib/{helpers → src/helpers}/color.js +4 -1
  7. package/lib/{helpers → src/helpers}/context.d.ts +13 -1
  8. package/lib/{helpers → src/helpers}/context.js +46 -17
  9. package/lib/src/helpers/github-graphql.d.ts +76 -0
  10. package/lib/src/helpers/github-graphql.js +363 -0
  11. package/lib/{helpers → src/helpers}/template.js +3 -2
  12. package/lib/{helpers → src/helpers}/util.d.ts +14 -3
  13. package/lib/{helpers → src/helpers}/util.js +65 -9
  14. package/package.json +8 -2
  15. package/lib/helpers/github-graphql.d.ts +0 -1
  16. package/lib/helpers/github-graphql.js +0 -331
  17. /package/commands/{new → modelA/new}/issue.json +0 -0
  18. /package/commands/{new → modelA/new}/process.json +0 -0
  19. /package/commands/{subtasks → modelA/subtasks}/checkout-branch.json +0 -0
  20. /package/commands/{subtasks → modelA/subtasks}/create-pull.json +0 -0
  21. /package/commands/{subtasks → modelA/subtasks}/create-scratch.json +0 -0
  22. /package/commands/{subtasks → modelA/subtasks}/deploy-code.json +0 -0
  23. /package/commands/{subtasks → modelA/subtasks}/drop-scratch.json +0 -0
  24. /package/commands/{subtasks → modelA/subtasks}/package-code.json +0 -0
  25. /package/commands/{subtasks → modelA/subtasks}/publish-branch.json +0 -0
  26. /package/commands/{subtasks → modelA/subtasks}/update-documentation.json +0 -0
  27. /package/commands/{subtasks → modelA/subtasks}/validate-code.json +0 -0
  28. /package/commands/{subtasks → modelA/subtasks}/validate-scratch.json +0 -0
  29. /package/commands/{tasks → modelA/tasks}/cancel.json +0 -0
  30. /package/commands/{tasks → modelA/tasks}/deploy.json +0 -0
  31. /package/commands/{tasks → modelA/tasks}/finish.json +0 -0
  32. /package/commands/{tasks → modelA/tasks}/rollback.json +0 -0
  33. /package/commands/{tasks → modelA/tasks}/start.json +0 -0
  34. /package/commands/{tasks → modelA/tasks}/stop.json +0 -0
  35. /package/commands/{tasks → modelA/tasks}/switch.json +0 -0
  36. /package/commands/{tasks → modelA/tasks}/view.json +0 -0
  37. /package/lib/{auto.d.ts → src/auto.d.ts} +0 -0
  38. /package/lib/{helpers → src/helpers}/class.d.ts +0 -0
  39. /package/lib/{helpers → src/helpers}/class.js +0 -0
  40. /package/lib/{helpers → src/helpers}/connect.d.ts +0 -0
  41. /package/lib/{helpers → src/helpers}/connect.js +0 -0
  42. /package/lib/{helpers → src/helpers}/gitlab-graphql.d.ts +0 -0
  43. /package/lib/{helpers → src/helpers}/gitlab-graphql.js +0 -0
  44. /package/lib/{helpers → src/helpers}/lwc.d.ts +0 -0
  45. /package/lib/{helpers → src/helpers}/lwc.js +0 -0
  46. /package/lib/{helpers → src/helpers}/merge.d.ts +0 -0
  47. /package/lib/{helpers → src/helpers}/merge.js +0 -0
  48. /package/lib/{helpers → src/helpers}/metadata.d.ts +0 -0
  49. /package/lib/{helpers → src/helpers}/metadata.js +0 -0
  50. /package/lib/{helpers → src/helpers}/object.d.ts +0 -0
  51. /package/lib/{helpers → src/helpers}/object.js +0 -0
  52. /package/lib/{helpers → src/helpers}/openai.d.ts +0 -0
  53. /package/lib/{helpers → src/helpers}/openai.js +0 -0
  54. /package/lib/{helpers → src/helpers}/taskFunctions.d.ts +0 -0
  55. /package/lib/{helpers → src/helpers}/taskFunctions.js +0 -0
  56. /package/lib/{helpers → src/helpers}/tasks.d.ts +0 -0
  57. /package/lib/{helpers → src/helpers}/tasks.js +0 -0
  58. /package/lib/{helpers → src/helpers}/template.d.ts +0 -0
@@ -1,8 +1,9 @@
1
1
  import fs from "fs";
2
2
  import Handlebars from "handlebars";
3
3
  import { merge } from "./merge.js";
4
- import { getFiles } from "./util.js";
5
- const TEMPLATE_ROOT_FOLDER = process.cwd() + "/templates";
4
+ import { fileURLToPath } from 'url';
5
+ import { getFiles, searchInFolderHierarchy } from "./util.js";
6
+ const TEMPLATE_ROOT_FOLDER = searchInFolderHierarchy('templates', fileURLToPath(import.meta.url));
6
7
  function isObjectEmpty(objectName) {
7
8
  return (objectName &&
8
9
  Object.keys(objectName).length === 0 &&
@@ -2,6 +2,20 @@ export declare const TEMPLATES_FOLDER: string;
2
2
  export declare const DICTIONARY_FOLDER: string;
3
3
  export declare const WORKING_FOLDER: string;
4
4
  export declare const CONFIG_FILE: string;
5
+ export declare const filterJson: (fullPath: string) => boolean;
6
+ export declare const filterDirectory: (fullPath: string) => boolean;
7
+ export declare const filterFiles: (fullPath: string) => boolean;
8
+ export declare const camelToText: (s: string) => string;
9
+ export declare const kebabToText: (s: string) => string;
10
+ export declare const snakeToText: (s: string) => string;
11
+ export declare function valuesToChoices(list: string[], valueToTitle?: (value: string) => string): {
12
+ value: string;
13
+ title: string;
14
+ }[];
15
+ export declare function titlesToChoices(list: string[], titleToValue?: (title: string) => string): {
16
+ title: string;
17
+ value: string;
18
+ }[];
5
19
  export declare function createConfigurationFile(): Promise<boolean>;
6
20
  export declare function sortByName(objA: {
7
21
  Name: string;
@@ -19,9 +33,6 @@ export declare function splitFilename(fullname: string, defaultFolder?: string):
19
33
  filename: string;
20
34
  folder: string;
21
35
  };
22
- export declare const filterJson: (fullPath: string) => boolean;
23
- export declare const filterDirectory: (fullPath: string) => boolean;
24
- export declare const filterFiles: (fullPath: string) => boolean;
25
36
  /**
26
37
  * Agrega los elementos de newArray a baseArray, si no existen previamente en baseArray.
27
38
  * @param {string[]} baseArray El array donde se agregan los elementos
@@ -9,18 +9,77 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import fs from "fs";
11
11
  import { fileURLToPath } from 'url';
12
+ import prompts from "prompts";
13
+ import { GitProjects, GitServices } from "./context.js";
14
+ import { logWarning } from "./color.js";
15
+ const COMMAND_FOLDER = searchInFolderHierarchy('commands', fileURLToPath(import.meta.url));
12
16
  export const TEMPLATES_FOLDER = searchInFolderHierarchy('templates', fileURLToPath(import.meta.url));
13
17
  export const DICTIONARY_FOLDER = TEMPLATES_FOLDER + "/diccionarios";
14
18
  export const WORKING_FOLDER = process.env.INIT_CWD || ".";
15
19
  export const CONFIG_FILE = process.cwd() + '/.autoforce.json';
20
+ export const filterJson = (fullPath) => fullPath.endsWith(".json");
21
+ export const filterDirectory = (fullPath) => fs.lstatSync(fullPath).isDirectory();
22
+ export const filterFiles = (fullPath) => !fs.lstatSync(fullPath).isDirectory();
23
+ export const camelToText = (s) => s.replace(/[A-Z]/g, x => ' ' + x);
24
+ export const kebabToText = (s) => s.replace(/-./g, x => ' ' + x[1].toUpperCase());
25
+ export const snakeToText = (s) => s.replace(/_./g, x => ' ' + x[1].toUpperCase());
26
+ export function valuesToChoices(list, valueToTitle = (value) => value) {
27
+ return list.map(value => { return { value, title: valueToTitle(value) }; });
28
+ }
29
+ export function titlesToChoices(list, titleToValue = (title) => title) {
30
+ return list.map(title => { return { title, value: titleToValue(title) }; });
31
+ }
16
32
  export function createConfigurationFile() {
17
33
  return __awaiter(this, void 0, void 0, function* () {
18
- console.log('Preguntar por GitHub o GitLab');
19
- console.log('Chequear las variables de entorno');
20
- console.log('Tema proyecto guardar la referencia');
21
- console.log('Genera documentacion');
22
- console.log('Direccion de las carpetas');
23
- const config = { projectNumber: 1 };
34
+ const models = valuesToChoices(getFiles(COMMAND_FOLDER, filterDirectory));
35
+ const automationModel = yield prompts([{
36
+ type: "select",
37
+ name: "model",
38
+ message: "Elija un modelo de automatizacion",
39
+ choices: [
40
+ { title: 'Orgs con Procesos de Negocio usando scratchs', value: 'modelA' },
41
+ { title: 'Custom', value: 'custom', description: 'En este caso los comandos son configurados fuera de la herramienta y los lee de la carpeta commands en el root del repo' }
42
+ ]
43
+ }]);
44
+ // Si es custom pregunta si quiere tomar de base alguno existente
45
+ if (automationModel.model === 'custom') {
46
+ const baseModel = yield prompts([{
47
+ type: "select",
48
+ name: "model",
49
+ message: "Quiere tomar algun modelo existente de base ? Este se copiara a la carpeta ",
50
+ choices: [
51
+ { title: 'Orgs con Procesos de Negocio usando scratchs', value: 'modelA' },
52
+ { title: 'Custom', value: 'custom' }
53
+ ]
54
+ }]);
55
+ }
56
+ // Preguntar por GitHub o GitLab
57
+ const gitServices = yield prompts([{
58
+ type: "select",
59
+ name: "git",
60
+ message: "Elija un servicio de Git",
61
+ choices: [{ title: 'Github', value: GitServices.GitHub }, { title: 'Gitlab', value: GitServices.GitLab }]
62
+ }]);
63
+ // Chequear las variables de entorno
64
+ if (gitServices.git === GitServices.GitHub && !process.env.GITHUB_TOKEN) {
65
+ logWarning('Debe configurar una variable de entorno GITHUB_TOKEN');
66
+ }
67
+ if (gitServices.git === GitServices.GitLab && !process.env.GITLAB_TOKEN) {
68
+ logWarning('Debe configurar una variable de entorno GITLAB_TOKEN');
69
+ }
70
+ const projectServices = yield prompts([{
71
+ type: "select",
72
+ name: "project",
73
+ message: "Gestion de proyecto",
74
+ choices: [{ title: 'Github Projects', value: GitProjects.GitHub }, { title: 'GitLab Projects', value: GitProjects.GitLab }, { title: 'Jira', value: GitProjects.Jira }, { title: 'None', value: GitProjects.None }]
75
+ }]);
76
+ const projectId = yield prompts([{
77
+ type: "text",
78
+ name: "projectId",
79
+ message: "Id del proyecto"
80
+ }]);
81
+ // console.log('Genera documentacion');
82
+ const config = { model: automationModel.model, gitServices: gitServices.git, projectServices: projectServices.project, projectId: projectId.projectId };
24
83
  try {
25
84
  fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
26
85
  }
@@ -71,9 +130,6 @@ export function splitFilename(fullname, defaultFolder = '') {
71
130
  }
72
131
  return { filename, folder };
73
132
  }
74
- export const filterJson = (fullPath) => fullPath.endsWith(".json");
75
- export const filterDirectory = (fullPath) => fs.lstatSync(fullPath).isDirectory();
76
- export const filterFiles = (fullPath) => !fs.lstatSync(fullPath).isDirectory();
77
133
  /**
78
134
  * Agrega los elementos de newArray a baseArray, si no existen previamente en baseArray.
79
135
  * @param {string[]} baseArray El array donde se agregan los elementos
package/package.json CHANGED
@@ -2,7 +2,12 @@
2
2
  "name": "autoforce",
3
3
  "homepage": "https://sebastianclaros.github.io/autoforce",
4
4
  "private": false,
5
- "version": "0.1.4",
5
+ "version": "0.1.6",
6
+ "keywords": [
7
+ "Salesforce",
8
+ "Automation",
9
+ "Git"
10
+ ],
6
11
  "description": "Developer Automation tool for Github / Gitlab and Salesforce projects.",
7
12
  "repository": {
8
13
  "type": "git",
@@ -24,11 +29,12 @@
24
29
  "build": "tsc --project tsconfig.build.json",
25
30
  "prettier": "prettier --write \"**/*.{css,html,js,json,ts,md,xml,yaml,yml}\"",
26
31
  "test:build": "yarn build && npm publish --dry-run && node ./bin/index.js",
27
- "test": "jest --config jest.config.js"
32
+ "test": "ts-jest --config jest.config.ts"
28
33
  },
29
34
  "devDependencies": {
30
35
  "@eslint/js": "^9.9.1",
31
36
  "@types/jest": "29.4.0",
37
+ "@types/node": "^22.8.1",
32
38
  "@typescript-eslint/eslint-plugin": "5.54.0",
33
39
  "@typescript-eslint/parser": "5.52.0",
34
40
  "eslint": "^9.9.1",
@@ -1 +0,0 @@
1
- export {};
@@ -1,331 +0,0 @@
1
- // import { graphql } from "@octokit/graphql";
2
- export {};
3
- // export class GitHubApi implements IGitApi, IProjectApi {
4
- // repoVar;
5
- // projectNumber;
6
- // graphqlAuth;
7
- // constructor(token: string, owner: string, repo: string, projectNumber?: number) {
8
- // this.repoVar = { owner, repo };
9
- // this.projectNumber = projectNumber;
10
- // this.graphqlAuth = graphql.defaults({
11
- // headers: {
12
- // authorization: `Bearer ${token}`,
13
- // "X-Github-Next-Global-ID": 1
14
- // },
15
- // })
16
- // }
17
- // async getUser() {
18
- // const query = `{
19
- // viewer {
20
- // login
21
- // id
22
- // }
23
- // }`;
24
- // const {viewer }: {viewer: { login: string, id: number}} = await this.graphqlAuth(query);
25
- // return viewer;
26
- // }
27
- // async getRepository(label?: string) {
28
- // const query = `
29
- // query getRepo($owner:String!, $repo: String!, $projectNumber: Int!, ${label ? '$label: String!': ''} ) {
30
- // repository(owner: $owner, name: $repo) {
31
- // id
32
- // ${ label ?
33
- // `label(name: $label) {
34
- // id
35
- // }` :''
36
- // }
37
- // projectV2( number: $projectNumber ) {
38
- // id
39
- // field(name: "Status") {
40
- // ... on ProjectV2SingleSelectField {
41
- // id
42
- // name
43
- // options {
44
- // name
45
- // id
46
- // }
47
- // }
48
- // }
49
- // }
50
- // }
51
- // }
52
- // `;
53
- // const { repository }: {repository: { id: string, label?: { id: string}, projectV2: { id: string, field: { id: string, name: string, options: { name: string, id: string}[] }}}} = await this.graphqlAuth(query, { label, projectNumber: this.projectNumber,...this.repoVar});
54
- // return repository;
55
- // }
56
- // async createPullRequest(branchName: string, title: string, body: string): Promise<boolean> {
57
- // const repository = await this.getRepository();
58
- // const repositoryId = repository.id;
59
- // const headRefName = 'main';
60
- // const baseRefName = branchName;
61
- // const mutationPullRequest = `
62
- // mutation createPullRequest( $baseRefName: String!, $headRefName: String!, $headRepositoryId: ID, $repositoryId: ID!, $title: String!, $body: String ) {
63
- // createPullRequest(
64
- // input: {
65
- // repositoryId: $repositoryId,
66
- // headRefName: $headRefName,
67
- // headRepositoryId: $headRepositoryId,
68
- // baseRefName: $baseRefName,
69
- // title: $title,
70
- // body: $body
71
- // }
72
- // ) {
73
- // pullRequest {
74
- // id
75
- // }
76
- // }
77
- // }`;
78
- // try {
79
- // const {createPullRequest}: { createPullRequest: { pullRequest: { id: string} }} = await this.graphqlAuth(mutationPullRequest, { baseRefName, headRefName, headRepositoryId: repositoryId, repositoryId, title, body });
80
- // return createPullRequest.pullRequest ? true : false;
81
- // } catch (error) {
82
- // console.log(error);
83
- // }
84
- // return false;
85
- // }
86
- // async getColumnValueMap(){
87
- // const query = `
88
- // query getFieldOptions($owner:String!, $repo: String!, $projectNumber: Int!) {
89
- // repository(owner: $owner, name: $repo) {
90
- // projectV2(number: $projectNumber) {
91
- // field(name: "Status") {
92
- // ... on ProjectV2SingleSelectField {
93
- // id
94
- // name
95
- // options {
96
- // name
97
- // id
98
- // }
99
- // }
100
- // }
101
- // }
102
- // }
103
- // }
104
- // `;
105
- // const { repository }: {repository: { id: string, projectV2: { id: string, field: { id: string, name: string, options: { name: string, id: string}[] }}}} = await this.graphqlAuth(query, { projectNumber: this.projectNumber,...this.repoVar});
106
- // const mapValues: Record<string, string> = {}
107
- // for ( const option of repository.projectV2.field.options ) {
108
- // mapValues[option.name] = option.id;
109
- // }
110
- // return mapValues;
111
- // }
112
- // async createIssue(title: string, state?: string, label?: string, milestone?: string, body?: string ) {
113
- // const user = await this.getUser();
114
- // const repository = await this.getRepository(label);
115
- // const repositoryId = repository.id;
116
- // const labelId = repository.label?.id;
117
- // const projectId = repository.projectV2.id;
118
- // const mutationIssue = `
119
- // mutation createIssue($repositoryId: ID!, $assignId: ID!, $title: String!, $body: String, ${ labelId ? '$labelId: ID!': ''} , $milestoneId: ID ) {
120
- // createIssue(
121
- // input: {
122
- // repositoryId: $repositoryId,
123
- // assigneeIds: [$assignId],
124
- // ${labelId ? 'labelIds: [$labelId],': ''}
125
- // title: $title,
126
- // milestoneId: $milestoneId,
127
- // body: $body
128
- // }
129
- // ) {
130
- // issue {
131
- // id
132
- // number
133
- // }
134
- // }
135
- // }`;
136
- // const { createIssue }: {createIssue: { issue: { id: string, number: number } }} = await this.graphqlAuth(mutationIssue, { labelId, body, assignId: user.id, projectId, repositoryId, title, label: label? [label]: null });
137
- // const issue = createIssue.issue;
138
- // if ( !state || !issue.number) {
139
- // return issue.number;
140
- // }
141
- // const mutationItem = `
142
- // mutation addProjectV2ItemById($projectId: ID!, $contentId: ID! ) {
143
- // addProjectV2ItemById(
144
- // input: {
145
- // projectId: $projectId
146
- // contentId: $contentId
147
- // }
148
- // ) {
149
- // clientMutationId,
150
- // item {
151
- // id
152
- // }
153
- // }
154
- // }`;
155
- // const { addProjectV2ItemById }: {addProjectV2ItemById: { item: { id: string } }} = await this.graphqlAuth(mutationItem, { projectId, contentId: issue.id });
156
- // const itemId = addProjectV2ItemById.item.id;
157
- // const fieldId = repository.projectV2.field.id;
158
- // const mapValues = await this.getColumnValueMap();
159
- // const columnValue = mapValues[state];
160
- // const mutationColumn = `
161
- // mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $columnValue: String!) {
162
- // updateProjectV2ItemFieldValue(
163
- // input: {
164
- // projectId: $projectId,
165
- // itemId: $itemId,
166
- // fieldId: $fieldId,
167
- // value: {singleSelectOptionId: $columnValue}
168
- // }
169
- // ) {
170
- // clientMutationId
171
- // }
172
- // }`;
173
- // const {updateProjectV2ItemFieldValue }: {updateProjectV2ItemFieldValue: { clientMutationId: string }} = await this.graphqlAuth(mutationColumn, { projectId, itemId, fieldId, columnValue });
174
- // if ( !updateProjectV2ItemFieldValue.clientMutationId ) {
175
- // return 0;
176
- // }
177
- // return issue.number;
178
- // }
179
- // async moveIssue(issueNumber: number, state: string): Promise<boolean> {
180
- // const issue = await this.getIssue(issueNumber);
181
- // const itemId = issue.projectItems.nodes[0].id;
182
- // const projectId = issue.projectItems.nodes[0].project.id;
183
- // const fieldId = issue.projectItems.nodes[0].fieldValueByName.field.id;
184
- // const mapValues = await this.getColumnValueMap();
185
- // const columnValue = mapValues[state];
186
- // const mutation = `
187
- // mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $columnValue: String!) {
188
- // updateProjectV2ItemFieldValue(
189
- // input: {
190
- // projectId: $projectId,
191
- // itemId: $itemId,
192
- // fieldId: $fieldId,
193
- // value: {singleSelectOptionId: $columnValue}
194
- // }
195
- // ) {
196
- // projectV2Item {
197
- // id
198
- // }
199
- // }
200
- // }`;
201
- // const {updateProjectV2ItemFieldValue }: {updateProjectV2ItemFieldValue: { projectV2Item: { id: string } }} = await this.graphqlAuth(mutation, { projectId, itemId, fieldId, columnValue });
202
- // return updateProjectV2ItemFieldValue?.projectV2Item ? true: false ;
203
- // }
204
- // async assignIssueToMe(issueNumber: number): Promise<boolean> {
205
- // const user = await this.getUser();
206
- // const issue = await this.getIssue(issueNumber);
207
- // const mutation = `
208
- // mutation assignUser( $issueId: ID!, $userId: ID!) {
209
- // addAssigneesToAssignable(input: {
210
- // assignableId: $issueId
211
- // assigneeIds: [ $userId ]
212
- // }) {
213
- // assignable {
214
- // assignees {
215
- // totalCount
216
- // }
217
- // }
218
- // }
219
- // }
220
- // `;
221
- // const {addAssigneesToAssignable }: {addAssigneesToAssignable: { assignable: { assignees: { totalCount: number } } }} = await this.graphqlAuth(mutation, { issueId: issue.id, userId: user.id });
222
- // return addAssigneesToAssignable.assignable.assignees.totalCount > 0 ;
223
- // }
224
- // async getCommit(commitSha: string) {
225
- // const query = `
226
- // query getCommit($owner:String!, $repo: String!, $commitSha: String!) {
227
- // repository(owner: $owner, name: $repo) {
228
- // object(expression: $commitSha) {
229
- // ... on Commit {
230
- // id
231
- // oid
232
- // }
233
- // }
234
- // }
235
- // } `;
236
- // const { repository }: {repository:{ object: { id: string; oid: string}}} = await this.graphqlAuth(query, { commitSha,...this.repoVar});
237
- // return repository.object;
238
- // }
239
- // async assignBranchToIssue(issueNumber: number, branchName: string, commitSha: string) {
240
- // const issue = await this.getIssue(issueNumber);
241
- // const commit = await this.getCommit(commitSha);
242
- // const mutation = `
243
- // mutation createLinkedBranch( $issueId: ID!, $oid: GitObjectID!, $branchName: String!) {
244
- // createLinkedBranch(input: {
245
- // issueId: $issueId
246
- // oid: $oid
247
- // name: $branchName
248
- // })
249
- // {
250
- // issue {
251
- // id
252
- // }
253
- // }
254
- // }`;
255
- // const {createLinkedBranch }: {createLinkedBranch: { issue: { id: string } }} = await this.graphqlAuth(mutation, { issueId: issue.id, oid: commit.oid, branchName });
256
- // console.log(createLinkedBranch);
257
- // return createLinkedBranch?.issue?.id ? true: false ;
258
- // }
259
- // async getIssueState(issueNumber: number){
260
- // const issue = await this.getIssue(issueNumber);
261
- // return issue.projectItems?.nodes[0]?.fieldValueByName?.name;
262
- // }
263
- // getIssueName(title: string) {
264
- // return title.toLowerCase().replaceAll(' ', '-');
265
- // }
266
- // async getIssueObject(issueNumber: number) {
267
- // const issue = await this.getIssue(issueNumber);
268
- // const issueObject: IIssueObject = { title: issue.title};
269
- // issueObject.name = this.getIssueName(issue.title);
270
- // if ( issue.linkedBranches.nodes.length > 0 ) {
271
- // issueObject.branch = issue.linkedBranches.nodes[0].ref.name;
272
- // }
273
- // if ( issue.projectItems.nodes.length > 0 ) {
274
- // issueObject.state = issue.projectItems.nodes[0].fieldValueByName.name;
275
- // }
276
- // if ( issue.labels.nodes.length > 0 ) {
277
- // issueObject.labels = [];
278
- // for ( const node of issue.labels.nodes ) {
279
- // issueObject.labels.push(node.name);
280
- // }
281
- // }
282
- // return issueObject;
283
- // }
284
- // async getIssue(issueNumber: number){
285
- // const query = `
286
- // query getIssue($owner:String!, $repo: String!, $issueNumber: Int!) {
287
- // repository(owner: $owner, name: $repo) {
288
- // issue(number: $issueNumber) {
289
- // title
290
- // id
291
- // labels(first:3, orderBy: { field: CREATED_AT, direction: DESC}) {
292
- // nodes {
293
- // color
294
- // name
295
- // }
296
- // }
297
- // projectItems(last: 1) {
298
- // nodes{
299
- // id,
300
- // project {
301
- // id
302
- // }
303
- // fieldValueByName(name: "Status"){
304
- // ... on ProjectV2ItemFieldSingleSelectValue {
305
- // name
306
- // id
307
- // field {
308
- // ... on ProjectV2SingleSelectField {
309
- // id
310
- // }
311
- // }
312
- // }
313
- // }
314
- // }
315
- // }
316
- // linkedBranches(last:1){
317
- // nodes {
318
- // ref {
319
- // id
320
- // name
321
- // }
322
- // }
323
- // }
324
- // }
325
- // }
326
- // }
327
- // `;
328
- // const { repository }: { repository: { issue: { id: string, title: string, labels: { nodes: { name: string, color: string}[] }, projectItems: { nodes: { id: string, project: { id: string }, fieldValueByName: { name: string, id: string, field: { id: string }} }[] }, linkedBranches: { nodes: { ref: { id: string, name: string } } [] } } } } = await this.graphqlAuth(query, { issueNumber,...this.repoVar});
329
- // return repository.issue;
330
- // }
331
- // }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes