autoforce 0.1.17 → 0.1.19

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 (80) hide show
  1. package/.autoforce.json +8 -4
  2. package/CHANGELOG.md +20 -1
  3. package/lib/auto.js +50 -64
  4. package/lib/helpers/class.d.ts +1 -0
  5. package/lib/helpers/class.js +74 -80
  6. package/lib/helpers/connect.js +199 -213
  7. package/lib/helpers/context.d.ts +6 -3
  8. package/lib/helpers/context.js +279 -225
  9. package/lib/helpers/github-graphql.js +90 -113
  10. package/lib/helpers/github-project-graphql.js +100 -132
  11. package/lib/helpers/gitlab-graphql.js +68 -104
  12. package/lib/helpers/lwc.js +42 -48
  13. package/lib/helpers/metadata.js +1 -2
  14. package/lib/helpers/object.js +47 -55
  15. package/lib/helpers/openai.js +10 -22
  16. package/lib/helpers/taskFunctions.js +330 -386
  17. package/lib/helpers/tasks.d.ts +3 -6
  18. package/lib/helpers/tasks.js +132 -147
  19. package/lib/helpers/template.d.ts +9 -5
  20. package/lib/helpers/template.js +31 -18
  21. package/lib/helpers/util.d.ts +5 -6
  22. package/lib/helpers/util.js +131 -187
  23. package/models/dev/models.json +19 -0
  24. package/models/doc/models.json +9 -0
  25. package/models/git/models.json +9 -0
  26. package/models/project/models.json +9 -0
  27. package/package.json +16 -12
  28. package/commands/modelC/new/issue.json +0 -24
  29. package/commands/models.json +0 -18
  30. package/templates/modelB/openIssues.bash +0 -4
  31. package/templates/modelB/viewIssue.bash +0 -8
  32. package/templates/models.json +0 -12
  33. /package/{commands/modelA → models/dev/npm}/subtasks/checkout-branch.json +0 -0
  34. /package/{commands/modelA → models/dev/npm}/subtasks/create-pull.json +0 -0
  35. /package/{commands/modelC → models/dev/npm}/subtasks/pack.json +0 -0
  36. /package/{commands/modelA → models/dev/npm}/subtasks/publish-branch.json +0 -0
  37. /package/{commands/modelA → models/dev/npm}/tasks/cancel.json +0 -0
  38. /package/{commands/modelA → models/dev/npm}/tasks/finish.json +0 -0
  39. /package/{commands/modelC → models/dev/npm}/tasks/list.json +0 -0
  40. /package/{commands/modelC → models/dev/npm}/tasks/publish.json +0 -0
  41. /package/{commands/modelC → models/dev/npm}/tasks/start.json +0 -0
  42. /package/{commands/modelA → models/dev/npm}/tasks/stop.json +0 -0
  43. /package/{commands/modelA → models/dev/npm}/tasks/switch.json +0 -0
  44. /package/{commands/modelA → models/dev/npm}/tasks/view.json +0 -0
  45. /package/{commands/modelA → models/dev/scratchs}/subtasks/create-scratch.json +0 -0
  46. /package/{commands/modelA → models/dev/scratchs}/subtasks/deploy-code.json +0 -0
  47. /package/{commands/modelA → models/dev/scratchs}/subtasks/drop-scratch.json +0 -0
  48. /package/{commands/modelA → models/dev/scratchs}/subtasks/package-code.json +0 -0
  49. /package/{commands/modelA → models/dev/scratchs}/subtasks/validate-code.json +0 -0
  50. /package/{commands/modelA → models/dev/scratchs}/subtasks/validate-scratch.json +0 -0
  51. /package/{commands/modelC → models/dev/scratchs}/tasks/cancel.json +0 -0
  52. /package/{commands/modelA → models/dev/scratchs}/tasks/deploy.json +0 -0
  53. /package/{commands/modelC → models/dev/scratchs}/tasks/finish.json +0 -0
  54. /package/{commands/modelA → models/dev/scratchs}/tasks/rollback.json +0 -0
  55. /package/{commands/modelA → models/dev/scratchs}/tasks/start.json +0 -0
  56. /package/{commands/modelC → models/dev/scratchs}/tasks/stop.json +0 -0
  57. /package/{commands/modelC → models/dev/scratchs}/tasks/switch.json +0 -0
  58. /package/{commands/modelA → models/doc/processes}/new/process.json +0 -0
  59. /package/{commands/modelA/subtasks → models/doc/processes/subtask}/update-documentation.json +0 -0
  60. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class-all.md +0 -0
  61. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class-diagrama.md +0 -0
  62. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class-inner.md +0 -0
  63. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class-metodos.md +0 -0
  64. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class-public.md +0 -0
  65. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class-referencias.md +0 -0
  66. /package/{templates/modelA → models/doc/processes/templates}/dictionary/class.md +0 -0
  67. /package/{templates/modelA → models/doc/processes/templates}/dictionary/classes.md +0 -0
  68. /package/{templates/modelA → models/doc/processes/templates}/dictionary/object.md +0 -0
  69. /package/{templates/modelA → models/doc/processes/templates}/dictionary/objects.md +0 -0
  70. /package/{templates/modelA → models/doc/processes/templates}/intro.md +0 -0
  71. /package/{templates/modelA → models/doc/processes/templates}/process.md +0 -0
  72. /package/{commands/modelC/subtasks → models/git/githubflow/subtask}/checkout-branch.json +0 -0
  73. /package/{commands/modelC/subtasks → models/git/githubflow/subtask}/create-pull.json +0 -0
  74. /package/{commands/modelC/subtasks → models/git/githubflow/subtask}/publish-branch.json +0 -0
  75. /package/{commands/modelA → models/project/github-releases}/new/issue.json +0 -0
  76. /package/{commands/modelA/tasks → models/project/github-releases/task}/list.json +0 -0
  77. /package/{commands/modelC/tasks → models/project/github-releases/task}/view.json +0 -0
  78. /package/{templates/modelB → models/project/github-releases/templates}/changelog.md +0 -0
  79. /package/{templates/modelA → models/project/github-releases/templates}/openIssues.bash +0 -0
  80. /package/{templates/modelA → models/project/github-releases/templates}/viewIssue.bash +0 -0
@@ -1,88 +1,60 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { GraphQLClient } from 'graphql-request';
11
2
  const GITLAB_API = 'https://gitlab.com/api/graphql?remove_deprecated=true';
12
3
  export class GitLabApi {
4
+ repoVar;
5
+ projectNumber;
6
+ graphqlAuth;
13
7
  constructor(token, owner, repo, projectNumber) {
14
8
  this.graphqlAuth = new GraphQLClient(GITLAB_API);
15
9
  this.repoVar = { owner, repo };
16
10
  this.projectNumber = projectNumber;
17
11
  this.graphqlAuth.setHeaders({ authorization: `Bearer ${token}` });
18
12
  }
19
- getLabels() {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- return [];
22
- });
23
- }
24
- getMilestones() {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- return [];
27
- });
28
- }
29
- getIssue(issueNumber) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- console.log(issueNumber);
32
- return {};
33
- });
34
- }
35
- getIssues() {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- return [];
38
- });
39
- }
40
- getIssuesWithFilter(filter) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- return [];
43
- });
44
- }
45
- createLabel(name_1) {
46
- return __awaiter(this, arguments, void 0, function* (name, color = 'random') {
47
- console.log(name, color);
48
- return { id: '', name, color };
49
- });
50
- }
51
- createMilestone(title_1) {
52
- return __awaiter(this, arguments, void 0, function* (title, state = 'open', description, dueOn) {
53
- console.log(title, state, description, dueOn);
54
- return { id: '', title: '', state: '', url: '' };
55
- });
56
- }
57
- createIssue(title, state, label, body, milestone) {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- console.log(title, state, label, body, milestone);
60
- return { number: 1 };
61
- });
62
- }
63
- moveIssue(issueNumber, state) {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- console.log(issueNumber, state);
66
- return true;
67
- });
68
- }
69
- assignIssueToMe(issueNumber) {
70
- return __awaiter(this, void 0, void 0, function* () {
71
- console.log(issueNumber);
72
- return true;
73
- });
74
- }
75
- getUser() {
76
- return __awaiter(this, void 0, void 0, function* () {
77
- const query = `{
13
+ async getLabels() {
14
+ return [];
15
+ }
16
+ async getMilestones() {
17
+ return [];
18
+ }
19
+ async getIssue(issueNumber) {
20
+ console.log(issueNumber);
21
+ return {};
22
+ }
23
+ async getIssues() {
24
+ return [];
25
+ }
26
+ async getIssuesWithFilter(filter) {
27
+ return [];
28
+ }
29
+ async createLabel(name, color = 'random') {
30
+ console.log(name, color);
31
+ return { id: '', name, color };
32
+ }
33
+ async createMilestone(title, state = 'open', description, dueOn) {
34
+ console.log(title, state, description, dueOn);
35
+ return { id: '', title: '', state: '', url: '' };
36
+ }
37
+ async createIssue(title, state, label, body, milestone) {
38
+ console.log(title, state, label, body, milestone);
39
+ return { number: 1 };
40
+ }
41
+ async moveIssue(issueNumber, state) {
42
+ console.log(issueNumber, state);
43
+ return true;
44
+ }
45
+ async assignIssueToMe(issueNumber) {
46
+ console.log(issueNumber);
47
+ return true;
48
+ }
49
+ async getUser() {
50
+ const query = `{
78
51
  viewer {
79
52
  login
80
53
  id
81
54
  }
82
55
  }`;
83
- const { viewer } = yield this.graphqlAuth.request(query);
84
- return viewer;
85
- });
56
+ const { viewer } = await this.graphqlAuth.request(query);
57
+ return viewer;
86
58
  }
87
59
  // async request ( document: string, variables: Record<string, AnyValue> ) {
88
60
  // return await request({
@@ -92,43 +64,35 @@ export class GitLabApi {
92
64
  // headers: this.headers
93
65
  // })
94
66
  // }
95
- graphqlQuery(query, vars) {
96
- return __awaiter(this, void 0, void 0, function* () {
97
- const result = yield this.graphqlAuth.request(query, vars);
98
- return result;
99
- // let toProcess = result[endpoint]
100
- // let returnVal = toProcess.nodes
101
- // let pageInfo = toProcess.pageInfo
102
- // let curPage = pageInfo.endCursor
103
- // if ( pageInfo.hasNextPage ) {
104
- // curPage = pageInfo.endCursor
105
- // result = await this.graphql.request(query, vars)
106
- // returnVal = returnVal.concat(result[endpoint].nodes)
107
- // pageInfo = result[endpoint].pageInfo
108
- // }
109
- // return returnVal
110
- });
111
- }
112
- getRepository() {
113
- return __awaiter(this, void 0, void 0, function* () {
114
- });
115
- }
116
- createPullRequest(branchName, title, body) {
117
- return __awaiter(this, void 0, void 0, function* () {
118
- const query = `mutation($branchName: ID!, $title: String!, $body: String!) {
67
+ async graphqlQuery(query, vars) {
68
+ const result = await this.graphqlAuth.request(query, vars);
69
+ return result;
70
+ // let toProcess = result[endpoint]
71
+ // let returnVal = toProcess.nodes
72
+ // let pageInfo = toProcess.pageInfo
73
+ // let curPage = pageInfo.endCursor
74
+ // if ( pageInfo.hasNextPage ) {
75
+ // curPage = pageInfo.endCursor
76
+ // result = await this.graphql.request(query, vars)
77
+ // returnVal = returnVal.concat(result[endpoint].nodes)
78
+ // pageInfo = result[endpoint].pageInfo
79
+ // }
80
+ // return returnVal
81
+ }
82
+ async getRepository() {
83
+ }
84
+ async createPullRequest(branchName, title, body) {
85
+ const query = `mutation($branchName: ID!, $title: String!, $body: String!) {
119
86
 
120
87
  }`;
121
- yield this.graphqlQuery(query, { branchName, title, body });
122
- return true;
123
- });
88
+ await this.graphqlQuery(query, { branchName, title, body });
89
+ return true;
124
90
  }
125
- assignBranchToIssue(issueNumber, branchName, commitSha) {
126
- return __awaiter(this, void 0, void 0, function* () {
127
- const query = `mutation($branchName: ID!, $issueNumber: Int!, $commitSha: String!) {
91
+ async assignBranchToIssue(issueNumber, branchName, commitSha) {
92
+ const query = `mutation($branchName: ID!, $issueNumber: Int!, $commitSha: String!) {
128
93
 
129
94
  }`;
130
- yield this.graphqlQuery(query, { branchName, issueNumber: Number.parseInt(issueNumber), commitSha });
131
- return true;
132
- });
95
+ await this.graphqlQuery(query, { branchName, issueNumber: Number.parseInt(issueNumber), commitSha });
96
+ return true;
133
97
  }
134
98
  }
@@ -1,29 +1,24 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import sf from "./connect.js";
11
- import templateGenerator from "./template.js";
12
- import { DICTIONARY_FOLDER, TEMPLATE_MODEL_FOLDER } from "./util.js";
13
- const templateEngine = templateGenerator(`${TEMPLATE_MODEL_FOLDER}/dictionary`, "md");
2
+ import { default as templateGenerator } from "./template.js";
3
+ import { DICTIONARY_FOLDER, getModelFolders } from "./util.js";
4
+ let _templateEngine;
5
+ function getTemplateEngine() {
6
+ if (!_templateEngine) {
7
+ _templateEngine = templateGenerator(getModelFolders('dictionary'), "md");
8
+ }
9
+ return _templateEngine;
10
+ }
14
11
  import { sortByName, splitFilename } from "./util.js";
15
- function getMetadata(lwc) {
16
- return __awaiter(this, void 0, void 0, function* () {
17
- try {
18
- yield sf.connect();
19
- const lwcRecords = yield sf.getLwc(lwc);
20
- return Array.isArray(lwcRecords) ? lwcRecords : [lwcRecords];
21
- }
22
- catch (e) {
23
- console.error(e);
24
- }
25
- return [];
26
- });
12
+ async function getMetadata(lwc) {
13
+ try {
14
+ await sf.connect();
15
+ const lwcRecords = await sf.getLwc(lwc);
16
+ return Array.isArray(lwcRecords) ? lwcRecords : [lwcRecords];
17
+ }
18
+ catch (e) {
19
+ console.error(e);
20
+ }
21
+ return [];
27
22
  }
28
23
  function getLwc(files) {
29
24
  const items = new Set();
@@ -35,33 +30,32 @@ function getLwc(files) {
35
30
  }
36
31
  return [...items.values()];
37
32
  }
38
- function executeLwc(items, filename, folder) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- if (items.length === 0) {
41
- return;
42
- }
43
- // Busca la metadata
44
- const contexts = yield getMetadata(items);
45
- if (!contexts || contexts.length === 0) {
46
- return;
47
- }
48
- // Arma el diccionario de cada LWC
49
- templateEngine.read("lwc");
50
- for (const context of contexts) {
51
- templateEngine.render(context, {
52
- helpers: {}
53
- });
54
- templateEngine.save(context.Name, DICTIONARY_FOLDER + "/lwc");
55
- }
56
- // Arma el documento indice del grupo de lwc
57
- contexts.sort(sortByName);
58
- templateEngine.read("lwcs");
59
- const lwcContext = { lwc: contexts };
60
- templateEngine.render(lwcContext, {
33
+ async function executeLwc(items, filename, folder) {
34
+ const templateEngine = getTemplateEngine();
35
+ if (items.length === 0) {
36
+ return;
37
+ }
38
+ // Busca la metadata
39
+ const contexts = await getMetadata(items);
40
+ if (!contexts || contexts.length === 0) {
41
+ return;
42
+ }
43
+ // Arma el diccionario de cada LWC
44
+ templateEngine.read("lwc");
45
+ for (const context of contexts) {
46
+ templateEngine.render(context, {
61
47
  helpers: {}
62
48
  });
63
- templateEngine.save(filename, TEMPLATE_MODEL_FOLDER + "/" + folder);
49
+ templateEngine.save(context.Name, DICTIONARY_FOLDER + "/lwc");
50
+ }
51
+ // Arma el documento indice del grupo de lwc
52
+ contexts.sort(sortByName);
53
+ templateEngine.read("lwcs");
54
+ const lwcContext = { lwc: contexts };
55
+ templateEngine.render(lwcContext, {
56
+ helpers: {}
64
57
  });
58
+ templateEngine.save(filename, folder);
65
59
  }
66
60
  const lwcModule = {
67
61
  getItems: getLwc,
@@ -10,7 +10,6 @@ const helpers = {
10
10
  export default helpers;
11
11
  /*
12
12
  import context from "./context.js";
13
- import { TEMPLATE_MODEL_FOLDER } from "./util.js";
14
13
  import type { DocumentationModule, IProcessInfo, IMetadataNode, IMetadataComponentNode } from "../types/auto.js";
15
14
  function getMetadataFromContext(components: string[]) {
16
15
  return getMetadataArray(context.getProcessMetadata(), components);
@@ -66,7 +65,7 @@ function getMetadataArray(metadata: IProcessInfo[], props: string[]) {
66
65
  return items;
67
66
  };
68
67
 
69
- return getItemsFromTree({ folder: TEMPLATE_MODEL_FOLDER, childs: metadata });
68
+ return getItemsFromTree({ folder: TEMPLATE_FOLDER, childs: metadata });
70
69
  }
71
70
 
72
71
  export async function execute() {
@@ -1,40 +1,33 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import sf from "./connect.js";
11
- import templateGenerator from "./template.js";
12
- import { DICTIONARY_FOLDER, TEMPLATE_MODEL_FOLDER } from "./util.js";
13
- const templateEngine = templateGenerator(`${TEMPLATE_MODEL_FOLDER}/dictionary`, "md");
2
+ import { default as templateGenerator } from "./template.js";
3
+ import { DICTIONARY_FOLDER, getModelFolders } from "./util.js";
4
+ let _templateEngine;
5
+ function getTemplateEngine() {
6
+ if (!_templateEngine) {
7
+ _templateEngine = templateGenerator(getModelFolders('dictionary'), "md");
8
+ }
9
+ return _templateEngine;
10
+ }
14
11
  import { sortByLabel } from "./util.js";
15
- function getMetadata(objetos) {
16
- return __awaiter(this, void 0, void 0, function* () {
17
- try {
18
- yield sf.connect();
19
- const objects = yield sf.customObjects(objetos);
20
- return Array.isArray(objects) ? objects : [objects];
21
- }
22
- catch (e) {
23
- console.error(e);
24
- }
25
- return [];
26
- });
12
+ async function getMetadata(objetos) {
13
+ try {
14
+ await sf.connect();
15
+ const objects = await sf.customObjects(objetos);
16
+ return Array.isArray(objects) ? objects : [objects];
17
+ }
18
+ catch (e) {
19
+ console.error(e);
20
+ }
21
+ return [];
27
22
  }
28
23
  function descriptionFormula() {
29
- var _a;
30
- return (_a = this.description) === null || _a === void 0 ? void 0 : _a.replaceAll(/[\n\r]/g, "<br/>");
24
+ return this.description?.replaceAll(/[\n\r]/g, "<br/>");
31
25
  }
32
26
  function isManaged() {
33
27
  return this.fullName.split("__").length == 3;
34
28
  }
35
29
  function isMetadataFormula() {
36
- var _a;
37
- return ((_a = this.fullName) === null || _a === void 0 ? void 0 : _a.endsWith("__mdt")) || this.customSettingsType;
30
+ return this.fullName?.endsWith("__mdt") || this.customSettingsType;
38
31
  }
39
32
  function attributesFormula() {
40
33
  const attributes = [];
@@ -97,35 +90,34 @@ function getObjects(files) {
97
90
  }
98
91
  return [...items.values()];
99
92
  }
100
- function executeObjects(items, filename, folder) {
101
- return __awaiter(this, void 0, void 0, function* () {
102
- if (items.length === 0) {
103
- return;
104
- }
105
- // Busca la metadata
106
- const contexts = yield getMetadata(items);
107
- if (!contexts || contexts.length === 0) {
108
- return;
109
- }
110
- // Arma el diccionario de cada Objeto
111
- templateEngine.read("object");
112
- for (const context of contexts) {
113
- if (context.fullName) {
114
- templateEngine.render(context, {
115
- helpers: { isManaged, descriptionFormula, typeFormula, attributesFormula }
116
- });
117
- templateEngine.save(context.fullName, DICTIONARY_FOLDER + "/objects");
118
- }
93
+ async function executeObjects(items, filename, folder) {
94
+ const templateEngine = getTemplateEngine();
95
+ if (items.length === 0) {
96
+ return;
97
+ }
98
+ // Busca la metadata
99
+ const contexts = await getMetadata(items);
100
+ if (!contexts || contexts.length === 0) {
101
+ return;
102
+ }
103
+ // Arma el diccionario de cada Objeto
104
+ templateEngine.read("object");
105
+ for (const context of contexts) {
106
+ if (context.fullName) {
107
+ templateEngine.render(context, {
108
+ helpers: { isManaged, descriptionFormula, typeFormula, attributesFormula }
109
+ });
110
+ templateEngine.save(context.fullName, DICTIONARY_FOLDER + "/objects");
119
111
  }
120
- // Arma el documento indice del grupo de objetos
121
- contexts.sort(sortByLabel);
122
- templateEngine.read("objects");
123
- const objectContext = { objects: contexts };
124
- templateEngine.render(objectContext, {
125
- helpers: { isManaged, isMetadataFormula, attributesFormula }
126
- });
127
- templateEngine.save(filename, TEMPLATE_MODEL_FOLDER + "/" + folder);
112
+ }
113
+ // Arma el documento indice del grupo de objetos
114
+ contexts.sort(sortByLabel);
115
+ templateEngine.read("objects");
116
+ const objectContext = { objects: contexts };
117
+ templateEngine.render(objectContext, {
118
+ helpers: { isManaged, isMetadataFormula, attributesFormula }
128
119
  });
120
+ templateEngine.save(filename, folder);
129
121
  }
130
122
  const objectModule = {
131
123
  getItems: getObjects,
@@ -1,29 +1,17 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import OpenAI from 'openai';
11
2
  const client = new OpenAI({
12
3
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
13
4
  });
14
- export function getCommitMessage() {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- var _a;
17
- if (process.env['OPENAI_API_KEY']) {
18
- const params = {
19
- messages: [{ role: 'user', content: 'Say this is a test' }],
20
- model: 'gpt-3.5-turbo',
21
- };
22
- const chatCompletion = yield client.chat.completions.create(params);
23
- return (_a = chatCompletion.choices[0].message) === null || _a === void 0 ? void 0 : _a.content;
24
- }
25
- return null;
26
- });
5
+ export async function getCommitMessage() {
6
+ if (process.env['OPENAI_API_KEY']) {
7
+ const params = {
8
+ messages: [{ role: 'user', content: 'Say this is a test' }],
9
+ model: 'gpt-3.5-turbo',
10
+ };
11
+ const chatCompletion = await client.chat.completions.create(params);
12
+ return chatCompletion.choices[0].message?.content;
13
+ }
14
+ return null;
27
15
  }
28
16
  /*
29
17
  // getCommitMessage();