@forge/cli-shared 3.26.1-next.2 → 4.0.0-next.3
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/CHANGELOG.md +11 -0
- package/out/app-logs/graphql-client.js +9 -2
- package/out/app-logs/view-logs.js +4 -0
- package/out/apps/app-config.js +4 -1
- package/out/apps/create-an-app.js +3 -0
- package/out/apps/create-app-graphql-client.js +1 -0
- package/out/apps/get-app-owner.js +2 -0
- package/out/apps/package-installer.js +1 -0
- package/out/apps/register-app.js +8 -1
- package/out/apps/template.js +5 -0
- package/out/auth/personal/credential-store.js +7 -2
- package/out/auth/personal/login.js +8 -2
- package/out/auth/personal/logout.js +1 -0
- package/out/auth/personal/me-graphql-client.js +2 -0
- package/out/auth/personal/token-authenticator.js +1 -0
- package/out/cache/cached-conf.js +1 -0
- package/out/config/config-file-section-reader.js +4 -0
- package/out/config/config-file-section-writer.js +2 -0
- package/out/config/config-file.d.ts +2 -2
- package/out/config/config-file.d.ts.map +1 -1
- package/out/config/config-file.js +37 -44
- package/out/config/config-section.js +1 -0
- package/out/file-system/file-system-reader.js +2 -2
- package/out/graphql/app-environment-graphql-client.js +1 -0
- package/out/graphql/app-oauth-client-id-graphql-client.js +1 -0
- package/out/graphql/debugging-graphql-runner.js +3 -0
- package/out/graphql/get-mutation-error.js +4 -5
- package/out/graphql/graphql-types.d.ts +33 -258
- package/out/graphql/graphql-types.d.ts.map +1 -1
- package/out/graphql/graphql-types.js +18 -108
- package/out/graphql/minimal-graphql-runner.js +30 -22
- package/out/graphql/mutation-aware-graphql-client.js +14 -10
- package/out/http-client/feedback-post-client.js +1 -3
- package/out/http-client/file-uploader.js +1 -0
- package/out/http-client/global-edge-http-client.js +1 -0
- package/out/http-client/trace.js +1 -2
- package/out/runtimes/helper.js +1 -1
- package/out/service/bridge-script-service.js +1 -0
- package/out/service/feature-flag-service.js +50 -46
- package/out/service/iframe-resizer-script-service.js +1 -0
- package/out/shared/cli-details.js +2 -2
- package/out/shared/error-handling.js +5 -3
- package/out/shared/product.js +2 -4
- package/out/shared/read-app-config-files.js +7 -5
- package/out/shared/validate.js +1 -1
- package/out/ui/command-line-ui.js +14 -8
- package/out/ui/multiple-table-prompt.js +1 -1
- package/out/ui/table-prompt.js +8 -1
- package/package.json +2 -2
|
@@ -5,8 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
6
6
|
exports.FORGE_CLI_PACKAGE = '@forge/cli';
|
|
7
7
|
const isLatestCLIVersion = (cliDetails) => {
|
|
8
|
-
const version = semver_1.default.valid(cliDetails
|
|
9
|
-
const latest = semver_1.default.valid(cliDetails
|
|
8
|
+
const version = semver_1.default.valid(cliDetails?.version);
|
|
9
|
+
const latest = semver_1.default.valid(cliDetails?.latest);
|
|
10
10
|
if (!version || !latest) {
|
|
11
11
|
return false;
|
|
12
12
|
}
|
|
@@ -8,11 +8,10 @@ function isErrorWithAnalytics(e) {
|
|
|
8
8
|
return e.getAttributes !== undefined;
|
|
9
9
|
}
|
|
10
10
|
function isUserError(e) {
|
|
11
|
-
var _a, _b;
|
|
12
11
|
if (isErrorWithAnalytics(e)) {
|
|
13
|
-
return
|
|
12
|
+
return e.getAttributes().isUserError ?? false;
|
|
14
13
|
}
|
|
15
|
-
if (
|
|
14
|
+
if (e.constructor?.name === 'FetchError') {
|
|
16
15
|
if (e.type === 'system') {
|
|
17
16
|
return true;
|
|
18
17
|
}
|
|
@@ -30,6 +29,7 @@ function getErrorAttributes(e) {
|
|
|
30
29
|
}
|
|
31
30
|
exports.getErrorAttributes = getErrorAttributes;
|
|
32
31
|
class BaseError extends Error {
|
|
32
|
+
requestId;
|
|
33
33
|
constructor(requestId, message) {
|
|
34
34
|
super(message);
|
|
35
35
|
this.requestId = requestId;
|
|
@@ -108,6 +108,7 @@ class BundlerTSError extends UserError {
|
|
|
108
108
|
}
|
|
109
109
|
exports.BundlerTSError = BundlerTSError;
|
|
110
110
|
class ApplicationCompileError extends UserError {
|
|
111
|
+
error;
|
|
111
112
|
constructor(error) {
|
|
112
113
|
super(error.message);
|
|
113
114
|
this.error = error;
|
|
@@ -115,6 +116,7 @@ class ApplicationCompileError extends UserError {
|
|
|
115
116
|
}
|
|
116
117
|
exports.ApplicationCompileError = ApplicationCompileError;
|
|
117
118
|
class UIPromptError extends BaseError {
|
|
119
|
+
isTtyError;
|
|
118
120
|
constructor(message, isTtyError = false) {
|
|
119
121
|
super(undefined, message);
|
|
120
122
|
this.isTtyError = isTtyError;
|
package/out/shared/product.js
CHANGED
|
@@ -19,13 +19,11 @@ function getSupportedProducts({ enableAtlas = false } = {}) {
|
|
|
19
19
|
}
|
|
20
20
|
exports.getSupportedProducts = getSupportedProducts;
|
|
21
21
|
function productDisplayName(ariResourceOwner) {
|
|
22
|
-
|
|
23
|
-
return (_a = PRODUCT_DISPLAY_NAME_MAPPING[ariResourceOwner]) !== null && _a !== void 0 ? _a : (0, case_1.capital)(ariResourceOwner);
|
|
22
|
+
return PRODUCT_DISPLAY_NAME_MAPPING[ariResourceOwner] ?? (0, case_1.capital)(ariResourceOwner);
|
|
24
23
|
}
|
|
25
24
|
exports.productDisplayName = productDisplayName;
|
|
26
25
|
function ariResourceOwner(productDisplayName) {
|
|
27
|
-
|
|
28
|
-
return (_a = PRODUCT_ARI_MAPPING[productDisplayName]) !== null && _a !== void 0 ? _a : productDisplayName.toLowerCase();
|
|
26
|
+
return PRODUCT_ARI_MAPPING[productDisplayName] ?? productDisplayName.toLowerCase();
|
|
29
27
|
}
|
|
30
28
|
exports.ariResourceOwner = ariResourceOwner;
|
|
31
29
|
const isWorkspaceProduct = (product) => {
|
|
@@ -6,9 +6,11 @@ const path_1 = tslib_1.__importDefault(require("path"));
|
|
|
6
6
|
const array_prototype_flatmap_1 = tslib_1.__importDefault(require("array.prototype.flatmap"));
|
|
7
7
|
const typescript_1 = require("typescript");
|
|
8
8
|
const listGitIgnoreFiles = async (fileSystemReader, gitIgnorePath = '.gitignore') => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const gitignoreContents = fileSystemReader
|
|
10
|
+
.readFile(gitIgnorePath)
|
|
11
|
+
?.trim()
|
|
12
|
+
.split('\n')
|
|
13
|
+
.filter((glob) => glob.trim() !== '') || [];
|
|
12
14
|
return (0, array_prototype_flatmap_1.default)(await Promise.all(gitignoreContents.map((pattern) => {
|
|
13
15
|
if (fileSystemReader.hasGlobSpecialChars(pattern)) {
|
|
14
16
|
return fileSystemReader.readGlob({ pattern });
|
|
@@ -32,8 +34,8 @@ const listTSConfigIncludeExclude = async (fileSystemReader, tsConfigPath = 'tsco
|
|
|
32
34
|
return { include: [], exclude: [] };
|
|
33
35
|
}
|
|
34
36
|
return {
|
|
35
|
-
include: await processTSConfigGlobList(fileSystemReader, config
|
|
36
|
-
exclude: await processTSConfigGlobList(fileSystemReader, config
|
|
37
|
+
include: await processTSConfigGlobList(fileSystemReader, config?.include),
|
|
38
|
+
exclude: await processTSConfigGlobList(fileSystemReader, config?.exclude)
|
|
37
39
|
};
|
|
38
40
|
};
|
|
39
41
|
exports.listTSConfigIncludeExclude = listTSConfigIncludeExclude;
|
package/out/shared/validate.js
CHANGED
|
@@ -20,22 +20,25 @@ var ProgressLogType;
|
|
|
20
20
|
ProgressLogType[ProgressLogType["other"] = 2] = "other";
|
|
21
21
|
})(ProgressLogType || (ProgressLogType = {}));
|
|
22
22
|
class CommandLineUI {
|
|
23
|
+
verbose;
|
|
24
|
+
logger;
|
|
25
|
+
spinner;
|
|
26
|
+
promptInternal;
|
|
27
|
+
insideProgress = false;
|
|
28
|
+
addedProgressPadding = false;
|
|
23
29
|
constructor(verbose, spinner, logger) {
|
|
24
30
|
this.verbose = verbose;
|
|
25
|
-
this.insideProgress = false;
|
|
26
|
-
this.addedProgressPadding = false;
|
|
27
31
|
this.spinner = spinner || (0, ora_1.default)({ discardStdin: false });
|
|
28
32
|
this.logger = logger || console;
|
|
29
33
|
this.promptInternal = inquirer_1.default.createPromptModule({ skipTTYChecks: false });
|
|
30
34
|
this.registerCustomUIElements();
|
|
31
35
|
}
|
|
32
36
|
async prompt(questions, initialAnswers) {
|
|
33
|
-
var _a;
|
|
34
37
|
try {
|
|
35
38
|
return await this.promptInternal(questions, initialAnswers);
|
|
36
39
|
}
|
|
37
40
|
catch (e) {
|
|
38
|
-
throw new shared_1.UIPromptError(e.message,
|
|
41
|
+
throw new shared_1.UIPromptError(e.message, e.isTtyError ?? false);
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
get traceEnabled() {
|
|
@@ -159,7 +162,7 @@ class CommandLineUI {
|
|
|
159
162
|
return this.promptForString(message, true);
|
|
160
163
|
}
|
|
161
164
|
async promptForList(message, choices, config) {
|
|
162
|
-
const formattedChoices =
|
|
165
|
+
const formattedChoices = config?.format ? choices.map((choice) => config?.format?.(choice)) : choices;
|
|
163
166
|
const { choice } = await this.prompt([
|
|
164
167
|
{
|
|
165
168
|
type: 'list',
|
|
@@ -168,7 +171,7 @@ class CommandLineUI {
|
|
|
168
171
|
message
|
|
169
172
|
}
|
|
170
173
|
]);
|
|
171
|
-
const formattedChoice =
|
|
174
|
+
const formattedChoice = config?.format ? choices[formattedChoices.indexOf(choice)] : choice;
|
|
172
175
|
return formattedChoice;
|
|
173
176
|
}
|
|
174
177
|
async promptForTable(message, infoMessage, columns, choices) {
|
|
@@ -230,13 +233,16 @@ class CommandLineUI {
|
|
|
230
233
|
return formattedValue !== prevFormattedValue;
|
|
231
234
|
}
|
|
232
235
|
logTable(head, data, { format, groupRows }) {
|
|
233
|
-
const table = new cli_table3_1.default(
|
|
236
|
+
const table = new cli_table3_1.default({
|
|
237
|
+
...log_color_1.TableStyle.default,
|
|
238
|
+
head: head.map(([, heading]) => heading)
|
|
239
|
+
});
|
|
234
240
|
if (data) {
|
|
235
241
|
const rowSpanByKey = {};
|
|
236
242
|
for (let i = data.length - 1; i >= 0; i--) {
|
|
237
243
|
const tableRow = [];
|
|
238
244
|
head.forEach(([key]) => {
|
|
239
|
-
rowSpanByKey[key]
|
|
245
|
+
rowSpanByKey[key] ||= 1;
|
|
240
246
|
const row = data[i];
|
|
241
247
|
const value = row[key];
|
|
242
248
|
const formattedValue = this.formatTableValue(key, value, format);
|
|
@@ -25,9 +25,9 @@ const getRowFormatFn = (isDone, isHover, isSelected) => {
|
|
|
25
25
|
};
|
|
26
26
|
exports.getRowFormatFn = getRowFormatFn;
|
|
27
27
|
class MultipleChoiceTablePrompt extends table_prompt_1.TablePrompt {
|
|
28
|
+
selectedIndexes = new Set();
|
|
28
29
|
constructor(questions, readline, answers) {
|
|
29
30
|
super(questions, readline, answers);
|
|
30
|
-
this.selectedIndexes = new Set();
|
|
31
31
|
}
|
|
32
32
|
handleSpaceKey({ pointer, hasMultipleChoices }) {
|
|
33
33
|
if (hasMultipleChoices) {
|
package/out/ui/table-prompt.js
CHANGED
|
@@ -8,9 +8,16 @@ const readline_1 = tslib_1.__importDefault(require("inquirer/lib/utils/readline"
|
|
|
8
8
|
const cli_table3_1 = tslib_1.__importDefault(require("cli-table3"));
|
|
9
9
|
const text_1 = require("./text");
|
|
10
10
|
class TablePrompt extends base_1.default {
|
|
11
|
+
done;
|
|
12
|
+
columns;
|
|
13
|
+
rows;
|
|
14
|
+
promptMessage;
|
|
15
|
+
infoMessage;
|
|
16
|
+
pointer = 1;
|
|
17
|
+
options;
|
|
18
|
+
hasMultipleChoices;
|
|
11
19
|
constructor(questions, readline, answers) {
|
|
12
20
|
super(questions, readline, answers);
|
|
13
|
-
this.pointer = 1;
|
|
14
21
|
this.options = this.opt;
|
|
15
22
|
this.promptMessage = text_1.Text.customPrompts.table.promptMessage(this.options.message);
|
|
16
23
|
this.infoMessage = this.options.infoMessage;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/cli-shared",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-next.3",
|
|
4
4
|
"description": "Common functionality for Forge CLI",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"generate-graphql-types": "graphql-codegen --config src/graphql/codegen.yml"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@forge/manifest": "7.0
|
|
15
|
+
"@forge/manifest": "7.1.0-next.1",
|
|
16
16
|
"@forge/util": "1.4.3-next.0",
|
|
17
17
|
"@sentry/node": "7.100.1",
|
|
18
18
|
"adm-zip": "^0.5.10",
|