@transcend-io/cli 4.107.0 → 4.108.0

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 CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Transcend Inc.",
3
3
  "name": "@transcend-io/cli",
4
4
  "description": "Small package containing useful typescript utilities.",
5
- "version": "4.107.0",
5
+ "version": "4.108.0",
6
6
  "homepage": "https://github.com/transcend-io/cli",
7
7
  "repository": {
8
8
  "type": "git",
@@ -58,13 +58,13 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@transcend-io/airgap.js-types": "^10.4.4",
61
+ "@transcend-io/handlebars-utils": "^1.0.1",
61
62
  "@transcend-io/internationalization": "^1.6.0",
62
63
  "@transcend-io/persisted-state": "^1.0.2",
63
64
  "@transcend-io/privacy-types": "^4.43.0",
64
65
  "@transcend-io/secret-value": "^1.1.1",
65
66
  "@transcend-io/type-utils": "^1.1.1",
66
67
  "bluebird": "^3.7.2",
67
- "change-case": "^4.1.2",
68
68
  "cli-progress": "^3.11.2",
69
69
  "colors": "^1.4.0",
70
70
  "csv-parse": "=4.9.1",
@@ -76,7 +76,6 @@
76
76
  "got": "^11.8.5",
77
77
  "graphql": "^16.6.0",
78
78
  "graphql-request": "^5.0.0",
79
- "handlebars": "^4.7.8",
80
79
  "inquirer": "=7.3.3",
81
80
  "inquirer-autocomplete-prompt": "=1.3.0",
82
81
  "io-ts": "=2.2.16",
@@ -90,7 +89,6 @@
90
89
  "devDependencies": {
91
90
  "@types/bluebird": "^3.5.38",
92
91
  "@types/chai": "^4.3.4",
93
- "@types/change-case": "^2.3.1",
94
92
  "@types/cli-progress": "^3.11.0",
95
93
  "@types/colors": "^1.2.1",
96
94
  "@types/fuzzysearch": "^1.0.0",
@@ -1,25 +0,0 @@
1
- import Handlebars from 'handlebars';
2
- /**
3
- * Input for creating a handlebars instance
4
- */
5
- export interface HandlebarsInput {
6
- /** The handlebars templates */
7
- templates?: {
8
- /** Name of template */
9
- name: string;
10
- /** Content of template */
11
- content: string;
12
- }[];
13
- /** Helper functions to register */
14
- helpers?: {
15
- [name in string]: Handlebars.HelperDelegate;
16
- };
17
- }
18
- /**
19
- * Create an instance of handlebars, loading partial templates and adding utilities
20
- *
21
- * @param input - Input to define the handlebars instance
22
- * @returns The instantiated instance of handlebars
23
- */
24
- export declare function createHandlebarsWithHelpers({ templates, helpers, }?: HandlebarsInput): typeof Handlebars;
25
- //# sourceMappingURL=createHandlebarsWithHelpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createHandlebarsWithHelpers.d.ts","sourceRoot":"","sources":["../../src/ai/createHandlebarsWithHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAqBpC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,+BAA+B;IAC/B,SAAS,CAAC,EAAE;QACV,uBAAuB;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,0BAA0B;QAC1B,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;IACJ,mCAAmC;IACnC,OAAO,CAAC,EAAE;SAAG,IAAI,IAAI,MAAM,GAAG,UAAU,CAAC,cAAc;KAAE,CAAC;CAC3D;AA4GD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,SAAc,EACd,OAAY,GACb,GAAE,eAAoB,GAAG,OAAO,UAAU,CAc1C"}
@@ -1,125 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createHandlebarsWithHelpers = void 0;
7
- const handlebars_1 = __importDefault(require("handlebars"));
8
- const change_case_1 = require("change-case");
9
- const camelCase_1 = __importDefault(require("lodash/camelCase"));
10
- const kebabCase_1 = __importDefault(require("lodash/kebabCase"));
11
- const lowerCase_1 = __importDefault(require("lodash/lowerCase"));
12
- const lowerFirst_1 = __importDefault(require("lodash/lowerFirst"));
13
- const startCase_1 = __importDefault(require("lodash/startCase"));
14
- const upperCase_1 = __importDefault(require("lodash/upperCase"));
15
- const upperFirst_1 = __importDefault(require("lodash/upperFirst"));
16
- /**
17
- * Default helper functions to register
18
- */
19
- const DEFAULT_HELPERS = {
20
- capitalCase: change_case_1.capitalCase,
21
- constantCase: change_case_1.constantCase,
22
- dotCase: change_case_1.dotCase,
23
- lowerCase: lowerCase_1.default,
24
- paramCase: kebabCase_1.default,
25
- upperFirst: upperFirst_1.default,
26
- camelCase: camelCase_1.default,
27
- titleCase: startCase_1.default,
28
- lowerFirst: lowerFirst_1.default,
29
- headerCase: change_case_1.headerCase,
30
- upperCase: upperCase_1.default,
31
- noCase: change_case_1.noCase,
32
- pascalCase: change_case_1.pascalCase,
33
- pathCase: change_case_1.pathCase,
34
- sentenceCase: change_case_1.sentenceCase,
35
- snakeCase: change_case_1.snakeCase,
36
- /**
37
- * Pad with back slashes
38
- *
39
- * @param word - The word to pad
40
- * @returns Slashes the length of the word
41
- */
42
- pad: (word) => '/'.repeat(word.length),
43
- /**
44
- * Render if equality is met
45
- *
46
- * @param this - This context
47
- * @param arg1 - First arg
48
- * @param arg2 - Second arg
49
- * @param options - Handlebars options
50
- * @returns The template if args are equal
51
- */
52
- ifEqual: function ifNotEqual(arg1, arg2, options) {
53
- return arg1 === arg2 ? options.fn(this) : options.inverse(this);
54
- },
55
- /**
56
- * Render if equality is not met
57
- *
58
- * @param this - This context
59
- * @param arg1 - First arg
60
- * @param arg2 - Second arg
61
- * @param options - Handlebars options
62
- * @returns The template if args are not equal
63
- */
64
- ifNotEqual: function ifNotEqual(arg1, arg2, options) {
65
- return arg1 !== arg2 ? options.fn(this) : options.inverse(this);
66
- },
67
- /**
68
- * Uri encode a string
69
- *
70
- * @param word - The word to encode
71
- * @returns The URI encoded word
72
- */
73
- safeString: (word) => encodeURI(word),
74
- /**
75
- * Get the length of a list
76
- *
77
- * @param list - The list in question
78
- * @returns The length of the list
79
- */
80
- listLen: (list) => list.length,
81
- /**
82
- * Convert a JSON object to string
83
- *
84
- * @param obj - The object to convert
85
- * @returns The object stringified
86
- */
87
- toJSON: (obj) => JSON.stringify(obj, (k, v) => {
88
- // Necessary, else functions don't get written.
89
- if (typeof v === 'function') {
90
- return v.toString();
91
- }
92
- return v;
93
- }),
94
- /**
95
- * Compares two string to see if they're sorted
96
- *
97
- * @param arg1 - Some string
98
- * @param arg2 - Some other string to compare against
99
- * @param options - Handlebar options
100
- * @returns boolean
101
- */
102
- ifSorted: function ifSorted(arg1, arg2, options) {
103
- return arg1 <= arg2 ? options.fn(this) : options.inverse(this);
104
- },
105
- };
106
- /**
107
- * Create an instance of handlebars, loading partial templates and adding utilities
108
- *
109
- * @param input - Input to define the handlebars instance
110
- * @returns The instantiated instance of handlebars
111
- */
112
- function createHandlebarsWithHelpers({ templates = [], helpers = {}, } = {}) {
113
- if (templates.length > 0) {
114
- // Register partials
115
- templates.forEach(({ name, content }) => handlebars_1.default.registerPartial(name, content));
116
- }
117
- // Register helpers
118
- Object.entries({
119
- ...DEFAULT_HELPERS,
120
- ...helpers,
121
- }).forEach(([key, func]) => handlebars_1.default.registerHelper(key, func));
122
- return handlebars_1.default;
123
- }
124
- exports.createHandlebarsWithHelpers = createHandlebarsWithHelpers;
125
- //# sourceMappingURL=createHandlebarsWithHelpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createHandlebarsWithHelpers.js","sourceRoot":"","sources":["../../src/ai/createHandlebarsWithHelpers.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAoC;AACpC,6CAUqB;AACrB,iEAAyC;AACzC,iEAAyC;AACzC,iEAAyC;AACzC,mEAA2C;AAC3C,iEAAyC;AACzC,iEAAyC;AACzC,mEAA2C;AAkB3C;;GAEG;AACH,MAAM,eAAe,GAAG;IACtB,WAAW,EAAX,yBAAW;IACX,YAAY,EAAZ,0BAAY;IACZ,OAAO,EAAP,qBAAO;IACP,SAAS,EAAT,mBA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I,OAAO,CAAC,KAAK,UAAU,EAAE;YAC3B,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;SACrB;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;IACJ;;;;;;;OAOG;IACH,QAAQ,EAAE,SAAS,QAAQ,CACzB,IAAY,EACZ,IAAY,EACZ,OAAiC;QAEjC,OAAO,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;CACF,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,EAC1C,SAAS,GAAG,EAAE,EACd,OAAO,GAAG,EAAE,MACO,EAAE;IACrB,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;QACxB,oBAAoB;QACpB,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CACtC,oBAAU,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAC1C,CAAC;KACH;IAED,mBAAmB;IACnB,MAAM,CAAC,OAAO,CAAC;QACb,GAAG,eAAe;QAClB,GAAG,OAAO;KACX,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,oBAAU,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IAClE,OAAO,oBAAU,CAAC;AACpB,CAAC;AAjBD,kEAiBC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Get variables from handlebars template
3
- *
4
- * @param template - Template
5
- * @returns Variables
6
- */
7
- export declare function getVariablesFromHandlebarsTemplate(template: string): {
8
- [k in string]: unknown;
9
- };
10
- //# sourceMappingURL=getVariablesFromHandlebarsTemplate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getVariablesFromHandlebarsTemplate.d.ts","sourceRoot":"","sources":["../../src/helpers/getVariablesFromHandlebarsTemplate.ts"],"names":[],"mappings":"AAyEA;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,QAAQ,EAAE,MAAM,GAAG;KACnE,CAAC,IAAI,MAAM,GAAG,OAAO;CACvB,CAkCA"}
@@ -1,108 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getVariablesFromHandlebarsTemplate = void 0;
7
- const handlebars_1 = __importDefault(require("handlebars"));
8
- /**
9
- * Parse AST for variables
10
- *
11
- * @param statement - Statement to parse
12
- * @returns Variables
13
- */
14
- function parseHandlebarsAst(statement) {
15
- // No variables
16
- if (statement.type === 'ContentStatement') {
17
- return {};
18
- }
19
- if (statement.type === 'PartialStatement') {
20
- const moustacheStatement = statement;
21
- const pathStatement = moustacheStatement.name;
22
- return {
23
- [pathStatement.original]: 'partial',
24
- };
25
- }
26
- // Parse variables from {{ var }}
27
- if (statement.type === 'MustacheStatement') {
28
- const moustacheStatement = statement;
29
- const paramsExpressionList = moustacheStatement.params;
30
- const pathExpression = moustacheStatement.path;
31
- const vars = [
32
- ...paramsExpressionList.map(({ original }) => original),
33
- pathExpression.original,
34
- ].filter((x) => !!x);
35
- return vars.reduce((acc, x) => Object.assign(acc, { [x]: null }), {});
36
- }
37
- // Parse from {{#each}} or {{#with}}
38
- if (statement.type === 'BlockStatement' && statement) {
39
- const moustacheStatement = statement;
40
- const paramsExpressionList = moustacheStatement.params;
41
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
- const program = moustacheStatement.program;
43
- const param = paramsExpressionList[0];
44
- const pathExpression = moustacheStatement.path;
45
- if (param.type === 'SubExpression') {
46
- return program.body
47
- .map(parseHandlebarsAst)
48
- .reduce((acc, obj) => Object.assign(acc, obj), {});
49
- }
50
- if (pathExpression.original === 'each') {
51
- return {
52
- [param.original]: [
53
- program.body
54
- .map(parseHandlebarsAst)
55
- .reduce((acc, obj) => Object.assign(acc, obj), {}),
56
- ],
57
- };
58
- }
59
- return {
60
- [param.original]: program.body
61
- .map(parseHandlebarsAst)
62
- .reduce((acc, obj) => Object.assign(acc, obj), {}),
63
- };
64
- }
65
- throw new Error(`Unknown statement: ${statement.type}`);
66
- }
67
- /**
68
- * Get variables from handlebars template
69
- *
70
- * @param template - Template
71
- * @returns Variables
72
- */
73
- function getVariablesFromHandlebarsTemplate(template) {
74
- const ast = handlebars_1.default.parseWithoutProcessing(template);
75
- const results = ast.body.map(parseHandlebarsAst);
76
- return results.reduce((acc, data) => {
77
- Object.entries(data).forEach(([k, v]) => {
78
- const existing = acc[k];
79
- if (!existing) {
80
- return Object.assign(acc, { [k]: v });
81
- }
82
- if (Array.isArray(existing) && Array.isArray(v)) {
83
- return Object.assign(acc, {
84
- [k]: [
85
- {
86
- ...existing[0],
87
- ...v[0],
88
- },
89
- ],
90
- });
91
- }
92
- if (typeof existing === 'object' && typeof v === 'object') {
93
- return Object.assign(acc, {
94
- [k]: {
95
- ...existing,
96
- ...v,
97
- },
98
- });
99
- }
100
- return Object.assign(acc, {
101
- [k]: v,
102
- });
103
- });
104
- return acc;
105
- }, {});
106
- }
107
- exports.getVariablesFromHandlebarsTemplate = getVariablesFromHandlebarsTemplate;
108
- //# sourceMappingURL=getVariablesFromHandlebarsTemplate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getVariablesFromHandlebarsTemplate.js","sourceRoot":"","sources":["../../src/helpers/getVariablesFromHandlebarsTemplate.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAoC;AAEpC;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,SAA4B;IAGtD,eAAe;IACf,IAAI,SAAS,CAAC,IAAI,KAAK,kBAAkB,EAAE;QACzC,OAAO,EAAE,CAAC;KACX;IAED,IAAI,SAAS,CAAC,IAAI,KAAK,kBAAkB,EAAE;QACzC,MAAM,kBAAkB,GAAG,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AAI,CAAC,QAAQ,EAAE;gBACb,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;aACvC;YACD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;oBACxB,CAAC,CAAC,CAAC,EAAE;wBACH;4BACE,GAAG,QAAQ,CAAC,CAAC,CAAC;4BACd,GAAG,CAAC,CAAC,CAAC,CAAC;yBACR;qBACF;iBACF,CAAC,CAAC;aACJ;YACD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;gBACzD,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;oBACxB,CAAC,CAAC,CAAC,EAAE;wBACH,GAAG,QAAQ;wBACX,GAAG,CAAC;qBACL;iBACF,CAAC,CAAC;aACJ;YACD,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;gBACxB,CAAC,CAAC,CAAC,EAAE,CAAC;aACP,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AApCD,gFAoCC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=getVariablesFromHandlebars.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getVariablesFromHandlebars.test.d.ts","sourceRoot":"","sources":["../../src/tests/getVariablesFromHandlebars.test.ts"],"names":[],"mappings":""}
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const chai_1 = require("chai");
4
- const getVariablesFromHandlebarsTemplate_1 = require("../helpers/getVariablesFromHandlebarsTemplate");
5
- const TEST_HBS = `
6
- <p>
7
- You are an experienced project manager, constantly juggling a variety of different tasks.
8
- Other employees at your company are very busy.
9
- They quickly record notes in slack of things that they want to look into later.
10
- You are tasked with reviewing those raw notes, and turning them into a structured
11
- form that will make the notes more easily indexable by the employee when they have more time to review the information.
12
- {{{ description }}}. Return a JSON object in the following format:
13
-
14
- ({{#each parameters}}{{ name }} - {{slug}}, {{/each}}clarification).
15
- </p>
16
-
17
- {{> promptPartialTodaysDate }}
18
-
19
- {{> promptPartialTranscendProducts }}
20
-
21
-
22
- {{#with dog}}{{cat}} - {{fish}}{{/with}}
23
-
24
- {{#if (listLen extraContext)}}
25
- {{#each extraContext}}
26
- {{ name }}
27
- {{/each}}
28
- {{/if}}
29
-
30
- <p>
31
- The following rules define each of the input parameters:
32
- <ul>
33
- {{#each parameters}}
34
- <li>{{ name }}: {{{ description }}}</li>
35
- {{/each}}
36
- </ul>
37
- </p>
38
-
39
- {{#with dog}} {{meow}}{{/with}}
40
-
41
- <p>
42
- If any of the parameters are not known, it should be set to null.
43
- If anything is not clear, return a prompt in the clarification key of the response asking for further detail
44
- </p>`;
45
- describe('getVariablesFromHandlebars', () => {
46
- it('should merge together', () => {
47
- (0, chai_1.expect)((0, getVariablesFromHandlebarsTemplate_1.getVariablesFromHandlebarsTemplate)(TEST_HBS)).to.deep.equal({
48
- description: null,
49
- parameters: [{ name: null, slug: null, description: null }],
50
- dog: { cat: null, fish: null, meow: null },
51
- extraContext: [
52
- {
53
- name: null,
54
- },
55
- ],
56
- promptPartialTodaysDate: 'partial',
57
- promptPartialTranscendProducts: 'partial',
58
- });
59
- });
60
- });
61
- //# sourceMappingURL=getVariablesFromHandlebars.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getVariablesFromHandlebars.test.js","sourceRoot":"","sources":["../../src/tests/getVariablesFromHandlebars.test.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B,sGAAmG;AAEnG,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuCZ,CAAC;AAEN,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,IAAA,aAAM,EAAC,IAAA,uEAAkC,EAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACjE,WAAW,EAAE,IAAI;YACjB,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;YAC3D,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;YAC1C,YAAY,EAAE;gBACZ;oBACE,IAAI,EAAE,IAAI;iBACX;aACF;YACD,uBAAuB,EAAE,SAAS;YAClC,8BAA8B,EAAE,SAAS;SAC1C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}