@forge/cli-shared 0.0.0-experimental-9489df9 → 0.0.0-experimental-52c2a24
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 +599 -4
- package/out/app-logs/view-logs.js +3 -3
- package/out/apps/app-config.d.ts.map +1 -1
- package/out/apps/app-config.js +3 -2
- package/out/apps/create-app-graphql-client.d.ts.map +1 -1
- package/out/apps/create-app-graphql-client.js +6 -2
- package/out/apps/package-installer.js +1 -1
- package/out/apps/register-app.js +1 -1
- package/out/apps/template.js +12 -12
- package/out/auth/index.d.ts +0 -1
- package/out/auth/index.d.ts.map +1 -1
- package/out/auth/index.js +0 -1
- package/out/auth/personal/credential-store.d.ts +57 -0
- package/out/auth/personal/credential-store.d.ts.map +1 -0
- package/out/auth/personal/credential-store.js +188 -0
- package/out/auth/personal/index.d.ts +1 -4
- package/out/auth/personal/index.d.ts.map +1 -1
- package/out/auth/personal/index.js +1 -4
- package/out/auth/personal/login.d.ts +2 -2
- package/out/auth/personal/login.d.ts.map +1 -1
- package/out/auth/personal/login.js +1 -1
- package/out/auth/personal/logout.d.ts +2 -2
- package/out/auth/personal/logout.d.ts.map +1 -1
- package/out/auth/personal/me-graphql-client.d.ts +2 -1
- package/out/auth/personal/me-graphql-client.d.ts.map +1 -1
- package/out/auth/personal/me-graphql-client.js +3 -2
- package/out/auth/personal/token-authenticator.d.ts +3 -3
- package/out/auth/personal/token-authenticator.d.ts.map +1 -1
- package/out/auth/personal/token-authenticator.js +5 -5
- package/out/config/config-file-section-reader.js +2 -1
- package/out/config/config-file-section-writer.js +2 -1
- package/out/config/config-file.d.ts +14 -8
- package/out/config/config-file.d.ts.map +1 -1
- package/out/config/config-file.js +42 -41
- package/out/config/config-section.js +2 -1
- package/out/config/config.d.ts +2 -1
- package/out/config/config.d.ts.map +1 -1
- package/out/config/config.js +4 -2
- package/out/file-system/file-system-reader.d.ts +1 -0
- package/out/file-system/file-system-reader.d.ts.map +1 -1
- package/out/file-system/file-system-reader.js +7 -7
- package/out/file-system/file-system-writer.js +1 -1
- package/out/file-system/zip-accessor.js +1 -1
- package/out/graphql/app-environment-graphql-client.d.ts +3 -2
- package/out/graphql/app-environment-graphql-client.d.ts.map +1 -1
- package/out/graphql/app-environment-graphql-client.js +3 -2
- package/out/graphql/gateway.js +5 -3
- package/out/graphql/get-mutation-error.d.ts +1 -0
- package/out/graphql/get-mutation-error.d.ts.map +1 -1
- package/out/graphql/get-mutation-error.js +3 -2
- package/out/graphql/graphql-types.d.ts +5781 -618
- package/out/graphql/graphql-types.d.ts.map +1 -1
- package/out/graphql/graphql-types.js +520 -22
- package/out/graphql/minimal-graphql-runner.d.ts +9 -4
- package/out/graphql/minimal-graphql-runner.d.ts.map +1 -1
- package/out/graphql/minimal-graphql-runner.js +15 -5
- package/out/graphql/mutation-aware-graphql-client.d.ts +15 -4
- package/out/graphql/mutation-aware-graphql-client.d.ts.map +1 -1
- package/out/graphql/mutation-aware-graphql-client.js +17 -2
- package/out/http-client/feedback-post-client.js +1 -1
- package/out/http-client/file-uploader.js +1 -1
- package/out/service/bridge-script-service.d.ts +2 -0
- package/out/service/bridge-script-service.d.ts.map +1 -1
- package/out/service/bridge-script-service.js +4 -2
- package/out/service/feature-flag-service.d.ts +18 -6
- package/out/service/feature-flag-service.d.ts.map +1 -1
- package/out/service/feature-flag-service.js +32 -8
- package/out/service/iframe-resizer-script-service.d.ts +2 -0
- package/out/service/iframe-resizer-script-service.d.ts.map +1 -1
- package/out/service/iframe-resizer-script-service.js +4 -2
- package/out/shared/error-handling.d.ts +16 -2
- package/out/shared/error-handling.d.ts.map +1 -1
- package/out/shared/error-handling.js +43 -9
- package/out/shared/index.js +1 -1
- package/out/shared/installationId.js +2 -2
- package/out/shared/pause.js +2 -1
- package/out/shared/product.d.ts +4 -1
- package/out/shared/product.d.ts.map +1 -1
- package/out/shared/product.js +15 -5
- package/out/shared/read-app-config-files.d.ts.map +1 -1
- package/out/shared/read-app-config-files.js +8 -6
- package/out/shared/validate.d.ts +1 -1
- package/out/shared/validate.d.ts.map +1 -1
- package/out/shared/validate.js +8 -3
- package/out/ui/command-line-ui.d.ts +5 -3
- package/out/ui/command-line-ui.d.ts.map +1 -1
- package/out/ui/command-line-ui.js +37 -10
- package/out/ui/index.d.ts +0 -1
- package/out/ui/index.d.ts.map +1 -1
- package/out/ui/index.js +0 -1
- package/out/ui/multiple-table-prompt.js +4 -2
- package/out/ui/runtime-log.d.ts.map +1 -1
- package/out/ui/runtime-log.js +10 -5
- package/out/ui/single-table-prompt.js +4 -2
- package/out/ui/table-prompt.js +1 -1
- package/out/ui/text.d.ts +59 -11
- package/out/ui/text.d.ts.map +1 -1
- package/out/ui/text.js +90 -24
- package/out/ui/ui.d.ts +11 -0
- package/out/ui/ui.d.ts.map +1 -1
- package/package.json +13 -15
- package/out/auth/credentials-store-provider.d.ts +0 -4
- package/out/auth/credentials-store-provider.d.ts.map +0 -1
- package/out/auth/credentials-store-provider.js +0 -11
- package/out/auth/personal/abstract-token-store-getter.d.ts +0 -13
- package/out/auth/personal/abstract-token-store-getter.d.ts.map +0 -1
- package/out/auth/personal/abstract-token-store-getter.js +0 -31
- package/out/auth/personal/token-store-cache.d.ts +0 -12
- package/out/auth/personal/token-store-cache.d.ts.map +0 -1
- package/out/auth/personal/token-store-cache.js +0 -41
- package/out/auth/personal/token-store-keytar.d.ts +0 -23
- package/out/auth/personal/token-store-keytar.d.ts.map +0 -1
- package/out/auth/personal/token-store-keytar.js +0 -101
- package/out/auth/personal/token-store.d.ts +0 -28
- package/out/auth/personal/token-store.d.ts.map +0 -1
- package/out/auth/personal/token-store.js +0 -21
- package/out/ui/validation-error.d.ts +0 -3
- package/out/ui/validation-error.d.ts.map +0 -1
- package/out/ui/validation-error.js +0 -6
package/out/ui/text.js
CHANGED
|
@@ -7,14 +7,18 @@ const terminal_link_1 = tslib_1.__importDefault(require("terminal-link"));
|
|
|
7
7
|
const case_1 = require("case");
|
|
8
8
|
const log_symbols_1 = tslib_1.__importDefault(require("./log-symbols"));
|
|
9
9
|
const log_color_1 = require("./log-color");
|
|
10
|
-
const reinstallCmd = chalk_1.default.bold('npm install -g @forge/cli');
|
|
11
10
|
const ctrlC = 'Press Ctrl+C to cancel.';
|
|
11
|
+
const gettingStartedDACLink = 'https://go.atlassian.com/dac/platform/forge/getting-started/#log-in-with-an-atlassian-api-token';
|
|
12
12
|
const encryptedValue = '****';
|
|
13
13
|
const greenTick = `${chalk_1.default.bold(chalk_1.default.green('✔'))}`;
|
|
14
|
-
const buildTerminalLink = (text) => terminal_link_1.default(chalk_1.default.bold(text), text, { fallback: () => chalk_1.default.underline.bold(text) });
|
|
14
|
+
const buildTerminalLink = (text) => (0, terminal_link_1.default)(chalk_1.default.bold(text), text, { fallback: () => chalk_1.default.underline.bold(text) });
|
|
15
|
+
const autoSpaceSentences = (...sentences) => sentences
|
|
16
|
+
.filter((sentence) => sentence.length > 0)
|
|
17
|
+
.join(' ');
|
|
15
18
|
const fatalError = (message) => chalk_1.default.bold(chalk_1.default.red(message));
|
|
16
19
|
const keytarAccessErrorBase = (message) => `Keytar error detected: ${message}`;
|
|
17
|
-
|
|
20
|
+
const capitalise = (word) => word.charAt(0).toUpperCase() + word.slice(1);
|
|
21
|
+
exports.capitalise = capitalise;
|
|
18
22
|
const getLintMessage = (line, column, message, level, colourFunction, reference) => `${chalk_1.default.dim(`${line}:${column}`.padEnd(7))} ${colourFunction(level.padEnd(8))} ${message} ${chalk_1.default.dim(reference)}\n`;
|
|
19
23
|
const checkLintTotalPlurals = (numErrors, numWarnings, numFixableErrors, numFixableWarnings) => ({
|
|
20
24
|
pluralCheckedErrors: `${numErrors} ${numErrors === 1 ? 'error' : 'errors'}`,
|
|
@@ -23,13 +27,20 @@ const checkLintTotalPlurals = (numErrors, numWarnings, numFixableErrors, numFixa
|
|
|
23
27
|
pluralCheckedFixableErrors: `${numFixableErrors} ${numFixableErrors === 1 ? 'error' : 'errors'}`,
|
|
24
28
|
pluralCheckedFixableWarnings: `${numFixableWarnings} ${numFixableWarnings === 1 ? 'warning' : 'warnings'}`
|
|
25
29
|
});
|
|
30
|
+
const platformKeytarRecommendations = () => {
|
|
31
|
+
switch (process.platform) {
|
|
32
|
+
case 'darwin':
|
|
33
|
+
return 'Ensure you enable access to the macOS keychain when prompted.';
|
|
34
|
+
case 'linux':
|
|
35
|
+
return `Ensure you have ${chalk_1.default.bold('libsecret')} installed.`;
|
|
36
|
+
default:
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
};
|
|
26
40
|
exports.Text = {
|
|
27
41
|
error: {
|
|
28
|
-
noKeytar:
|
|
29
|
-
|
|
30
|
-
? `Make sure you have libsecret, then install the CLI again with ${reinstallCmd}.`
|
|
31
|
-
: `To fix this, install the CLI again with ${reinstallCmd}.`),
|
|
32
|
-
noTokenInKeytarOrCache: `Not logged in. Run ${chalk_1.default.bold('forge login')} before trying again.`,
|
|
42
|
+
noKeytar: autoSpaceSentences(`The CLI couldn't securely store your login credentials in a local keychain.`, platformKeytarRecommendations(), `If a local keychain is not available, use environment variables before trying again. See ${buildTerminalLink(gettingStartedDACLink)} for more.`),
|
|
43
|
+
noTokenStored: `Not logged in. If a local keychain is available, run ${chalk_1.default.bold('forge login')}, otherwise set environment variables before trying again. See ${buildTerminalLink(gettingStartedDACLink)} for more.`,
|
|
33
44
|
keytarAccessError: {
|
|
34
45
|
other: (message) => keytarAccessErrorBase(message),
|
|
35
46
|
mac: (message) => keytarAccessErrorBase(message) +
|
|
@@ -43,7 +54,7 @@ exports.Text = {
|
|
|
43
54
|
outdatedNodeVersion: (compatibleNodeVersion, currentNodeVersion) => fatalError(`Unsupported Node.js version. The CLI requires Node.js ${compatibleNodeVersion}, but you're using Node.js ${currentNodeVersion}.`),
|
|
44
55
|
invalidProduct: 'Invalid product. Rerun the command with a valid product.',
|
|
45
56
|
invalidSite: 'The site you entered is not an Atlassian site. Rerun the command with the URL to an Atlassian site to install the app.',
|
|
46
|
-
|
|
57
|
+
invalidTokenInKeytar: `Your API token is no longer valid. Run ${chalk_1.default.bold('forge login')} to reset your login credentials.`,
|
|
47
58
|
invalidTokenInEnv: (instructionsUrl, emailVar, tokenVar) => `The API token on your machine is no longer valid.` +
|
|
48
59
|
`\n 1) Get a new API token: ${instructionsUrl}` +
|
|
49
60
|
`\n 2) Set your email and the token to ${emailVar} and ${tokenVar} environment variables.`,
|
|
@@ -53,11 +64,15 @@ exports.Text = {
|
|
|
53
64
|
resourceDefinitionMissing: (resourceKeys) => `The following resources are declared but are improperly defined in the manifest.yml file:\n - ${resourceKeys.join('\n - ')}`,
|
|
54
65
|
resourceDirectoryMissing: (resourceKey, directory) => `Resource ${resourceKey} at: ${directory} not found`,
|
|
55
66
|
resourceDirectoryEmpty: (resourceKey, directory) => `Resource ${resourceKey} at: ${directory} is an empty directory`,
|
|
56
|
-
templateFetchFailed: 'Failed to fetch templates, try running the command again.'
|
|
67
|
+
templateFetchFailed: 'Failed to fetch templates, try running the command again.',
|
|
68
|
+
handlerFormat: (handler) => `Function handler "${handler}" must be in format <module>.<function>, example: index.run`
|
|
57
69
|
},
|
|
58
70
|
warning: {
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
plaintextCredentialsFound: (url) => `Your credentials were stored in plaintext by a previous version of the Forge CLI. For additional security, revoke your existing API token by visting this URL ${buildTerminalLink(url)}.`,
|
|
72
|
+
plaintextCredentialsMigrated: 'The credentials found in plaintext have been migrated to your local keychain.',
|
|
73
|
+
plaintextCredentialsNotMigrated: autoSpaceSentences(`The CLI couldn't securely store your login credentials in a local keychain.`, platformKeytarRecommendations(), `If a local keychain is not available, use environment variables instead. See ${buildTerminalLink(gettingStartedDACLink)} for more information.`),
|
|
74
|
+
unsupportedNodeVersion: (userNodeVersion, supportedNodeVersions) => log_color_1.LogColor.warn(`Warning: Forge CLI requires Node.js ${supportedNodeVersions} installed. ` +
|
|
75
|
+
`\nUpdate Node.js from version ${chalk_1.default.bold(userNodeVersion)} to a supported Node.js version to continue using Forge CLI.` +
|
|
61
76
|
`\nLearn more about LTS releases at https://nodejs.org/en/about/releases. ` +
|
|
62
77
|
`\n`)
|
|
63
78
|
},
|
|
@@ -65,7 +80,8 @@ exports.Text = {
|
|
|
65
80
|
overviewProduct: 'Select the product your app uses.\n',
|
|
66
81
|
promptProduct: 'Select a product:',
|
|
67
82
|
overviewSite: '\nEnter your site. For example, your-domain.atlassian.net\n',
|
|
68
|
-
promptSite: 'Enter the site URL:'
|
|
83
|
+
promptSite: 'Enter the site URL:',
|
|
84
|
+
promptWorkspace: 'Enter the workspace URL:'
|
|
69
85
|
},
|
|
70
86
|
upgradeContext: {
|
|
71
87
|
overview: `To upgrade your app to use the latest scopes, select it from the list.\n${ctrlC}`,
|
|
@@ -74,12 +90,11 @@ exports.Text = {
|
|
|
74
90
|
optionSite: 'site URL (example.atlassian.net)',
|
|
75
91
|
optionProduct: (supportedProducts) => `product (${supportedProducts.join(', ')})`,
|
|
76
92
|
optionVerbose: 'enable verbose mode',
|
|
93
|
+
optionJson: 'output results in JSON format',
|
|
77
94
|
invalidCmd: (command) => `’${command}’ is not a Forge command.`,
|
|
78
95
|
invalidCmdHelp: `Run ${chalk_1.default.bold('forge --help')} to see the full list of available commands.`,
|
|
79
|
-
extraArguments: (commandName) => `Unexpected argument. Run ${chalk_1.default.bold(`forge ${commandName} --help`)} for a list of available arguments.`,
|
|
80
96
|
rerunningWithVerbose: 'Rerunning the command with --verbose may give more details.',
|
|
81
97
|
ctrlC,
|
|
82
|
-
deprecate: (newCommand) => `This command is deprecated. Consider using "${newCommand}" command instead.`,
|
|
83
98
|
graphQL: {
|
|
84
99
|
request: (url, query, variables) => `▶️ GraphQL ${url}\nQuery: ${query}\nVariables: ${variables}`,
|
|
85
100
|
response: (result, requestId) => `◀️ GraphQL\nRequest ID: ${requestId || 'unknown'}\nResult: ${result}`,
|
|
@@ -288,6 +303,49 @@ What do you like or don't like about Forge? Share your feedback below or press C
|
|
|
288
303
|
optionClientSecret: 'client secret',
|
|
289
304
|
promptClientSecret: 'Enter the client secret:'
|
|
290
305
|
},
|
|
306
|
+
contributors: {
|
|
307
|
+
desc: 'manage who has access to your app'
|
|
308
|
+
},
|
|
309
|
+
addContributor: {
|
|
310
|
+
cmd: {
|
|
311
|
+
desc: 'add a new contributor to your app',
|
|
312
|
+
start: 'Adding contributor to your app',
|
|
313
|
+
success: 'If an Atlassian account is associated with this email address, they can now access your app.'
|
|
314
|
+
},
|
|
315
|
+
overview: 'Adding a new contributor to your app',
|
|
316
|
+
optionSkipConfirmation: 'skip confirmation of email before adding a new contributor to the app',
|
|
317
|
+
optionContributorEmail: 'email address associated with Atlassian account (your-name@your-domain.com)',
|
|
318
|
+
contributorEmailInfo: "Enter the email address associated with the contributor's Atlassian account. For example, your-name@your-domain.com",
|
|
319
|
+
promptContributorEmail: 'Enter their email:',
|
|
320
|
+
confirmationInfo: 'This contributor will have full access to your app via the CLI and developer console.',
|
|
321
|
+
learnMore: 'To learn more about access and permissions, go to: https://go.atlassian.com/contributor-permissions',
|
|
322
|
+
promptConfirmation: 'Do you want to continue?'
|
|
323
|
+
},
|
|
324
|
+
listContributors: {
|
|
325
|
+
cmd: {
|
|
326
|
+
desc: 'list all contributors for your app'
|
|
327
|
+
},
|
|
328
|
+
banner: '\nShowing all current contributors for your app:',
|
|
329
|
+
noContributors: 'No users have been assigned contributor status for your app',
|
|
330
|
+
appOwner: `${chalk_1.default.bold('(App owner)')}`,
|
|
331
|
+
userInactive: '(Deactivated)',
|
|
332
|
+
missingAppContributors: `Cannot list contributors for the app: something went wrong with fetching app contributors.`
|
|
333
|
+
},
|
|
334
|
+
removeContributors: {
|
|
335
|
+
cmd: {
|
|
336
|
+
desc: 'remove contributors from your app',
|
|
337
|
+
start: 'Removing contributor(s) from your app...',
|
|
338
|
+
success: 'Contributor(s) removed successfully'
|
|
339
|
+
},
|
|
340
|
+
overview: 'To remove a contributor from your app, select them from the list.\nPress Ctrl+C to cancel.',
|
|
341
|
+
optionSkipConfirmation: 'skip confirmation before removing contributors from the app',
|
|
342
|
+
optionContributorEmail: 'email address associated with Atlassian account (your-name@your-domain.com)',
|
|
343
|
+
promptContributorEmail: 'Select contributor(s) to remove from the app',
|
|
344
|
+
confirmationInfo: 'You are removing the following contributor(s). They will no longer have access to your app via the CLI and developer console:',
|
|
345
|
+
promptConfirmation: 'Do you want to continue?',
|
|
346
|
+
commandSuccessMessage: (name) => `${chalk_1.default.bold(name.join(', '))} can no longer access your app.`,
|
|
347
|
+
addContributorMessage: "There are no contributors for this app. To add a contributor, run the 'contributors add' command."
|
|
348
|
+
},
|
|
291
349
|
artifact: {
|
|
292
350
|
error: {
|
|
293
351
|
noDeployUrl: "Couldn't find deployment URL",
|
|
@@ -338,9 +396,8 @@ What do you like or don't like about Forge? Share your feedback below or press C
|
|
|
338
396
|
taskPackage: {
|
|
339
397
|
title: 'Packaging app files',
|
|
340
398
|
archiverWarning: (err) => `Packaging warning: ${err.message}`,
|
|
341
|
-
fileAddedToArchive: (filePath) => `File added to archive: ${filePath}`,
|
|
342
399
|
packageBundledFiles: 'Packaging bundled files',
|
|
343
|
-
packageFile: (fileName, filePath) => `
|
|
400
|
+
packageFile: (fileName, filePath) => `File added to archive: ${filePath}` + fileName ? `, from ${fileName}` : '',
|
|
344
401
|
archiveCreated: (archivePath) => `Archive created: ${archivePath}`
|
|
345
402
|
},
|
|
346
403
|
taskUpload: {
|
|
@@ -412,9 +469,9 @@ What do you like or don't like about Forge? Share your feedback below or press C
|
|
|
412
469
|
listEgressAddresses: (egressAddresses) => `Your app will exchange data with the following urls:\n${egressAddresses.map((url) => `- ${url}`).join('\n')}\n`,
|
|
413
470
|
permissionsMismatch: (environment) => `The scopes or egress URLs in the manifest are different from the scopes in your most recent deployment to ${environment}. Try running ${chalk_1.default.bold(`forge deploy -e ${environment}`)} before installing.\n`,
|
|
414
471
|
multiProductScopesDetected: (productsToInstall, productsToUpgrade, site, environment, environmentToOption) => `\nWe detected your app requires scopes across multiple products.\nRun ${chalk_1.default.bold('forge install')} for each of the following:\n${productsToUpgrade
|
|
415
|
-
.map((product) => `- forge install --upgrade -p ${case_1.capital(product)} -s ${site} -e ${environmentToOption(environment)}`)
|
|
472
|
+
.map((product) => `- forge install --upgrade -p ${(0, case_1.capital)(product)} -s ${site} -e ${environmentToOption(environment)}`)
|
|
416
473
|
.join('\n')}${productsToUpgrade.length !== 0 && productsToInstall.length !== 0 ? '\n' : ''}${productsToInstall
|
|
417
|
-
.map((product) => `- forge install -p ${case_1.capital(product)} -s ${site} -e ${environmentToOption(environment)}`)
|
|
474
|
+
.map((product) => `- forge install -p ${(0, case_1.capital)(product)} -s ${site} -e ${environmentToOption(environment)}`)
|
|
418
475
|
.join('\n')}`,
|
|
419
476
|
promptForPermissionsConfirmation: (permissionsMismatchInDevelopment) => permissionsMismatchInDevelopment
|
|
420
477
|
? 'Are you sure you want to continue installing the app?'
|
|
@@ -426,6 +483,9 @@ What do you like or don't like about Forge? Share your feedback below or press C
|
|
|
426
483
|
invalidAtlassianSite: (url) => `The URL you entered doesn't belong to an Atlassian site: ` +
|
|
427
484
|
`\n${url.toString()} ` +
|
|
428
485
|
`\n\nRun the command using a different URL.`,
|
|
486
|
+
invalidWorkspace: (url) => `The URL you entered is not a valid workspace: ` +
|
|
487
|
+
`\n${url.toString()} ` +
|
|
488
|
+
`\n\nRun the command using a different URL.`,
|
|
429
489
|
url: (url) => `Site URL is invalid: ${url}`,
|
|
430
490
|
site: (url) => `Site is invalid: ${url}`,
|
|
431
491
|
alreadyInstalledError: `Installation error: App is already installed.\nIf you're trying to upgrade your app, use the ${chalk_1.default.bold('forge install --upgrade')} command.`,
|
|
@@ -492,7 +552,7 @@ ${buildTerminalLink(link)}\n`,
|
|
|
492
552
|
installList: {
|
|
493
553
|
cmd: 'list app installations',
|
|
494
554
|
banner: `\nShowing all the current installations of your app:`,
|
|
495
|
-
|
|
555
|
+
noResourceId: 'Unknown site with no resource ID',
|
|
496
556
|
noInstallations: `The app is not installed anywhere.\nRun ${chalk_1.default.bold('forge install')} to install your app on an Atlassian site.\n`
|
|
497
557
|
},
|
|
498
558
|
tunnel: {
|
|
@@ -505,11 +565,16 @@ ${buildTerminalLink(link)}\n`,
|
|
|
505
565
|
startedTunnel: (tunnelUrl) => `Started tunnel at address: ${tunnelUrl}`,
|
|
506
566
|
stoppingTunnel: 'Stopping tunnel...',
|
|
507
567
|
stoppedTunnel: 'Tunnel stopped.',
|
|
568
|
+
tunnelStatusChange: (status) => `Tunnel connection status changed: ${status}`,
|
|
508
569
|
snapshotting: 'Snapshotting functions...',
|
|
509
570
|
snapshottingNoLogs: 'No log output.',
|
|
510
|
-
startedInspector: (serverAddress) => `
|
|
571
|
+
startedInspector: (serverAddress) => `Add "debugger;" statement to your app to pause.
|
|
572
|
+
Debugging in Google Chrome:
|
|
573
|
+
- Open Inspect page: chrome://inspect/
|
|
574
|
+
- Select "Open dedicated DevTools for Node"
|
|
575
|
+
- Open inspector URL: devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=${serverAddress}
|
|
576
|
+
`,
|
|
511
577
|
invoke: (requestId, handler) => `invocation: ${requestId} ${handler}`,
|
|
512
|
-
reloaded: 'App code reloaded.',
|
|
513
578
|
customUI: {
|
|
514
579
|
fileServed: (filename, resourceKey) => `Serving file ${filename} for resource ${resourceKey}`,
|
|
515
580
|
fileProxied: (filename, resourceKey, tunnelPort) => `Received proxy request. ${exports.Text.tunnel.customUI.fileServed(filename, resourceKey)} from specified address http://localhost:${tunnelPort}`,
|
|
@@ -523,16 +588,17 @@ ${buildTerminalLink(link)}\n`,
|
|
|
523
588
|
lintFailed: chalk_1.default.red(`${chalk_1.default.bold('Error:')} Linting failed due to errors in the app code.`),
|
|
524
589
|
bundlingHeader: 'Bundling code...',
|
|
525
590
|
bundlingSucceeded: 'App code bundled.',
|
|
591
|
+
resourcesBundlingSucceeded: `${greenTick} Resources bundled.`,
|
|
592
|
+
functionsBundlingSucceeded: `${greenTick} Functions bundled.`,
|
|
526
593
|
error: {
|
|
527
594
|
create: (message) => `Couldn't create tunnel, message: ${message}`,
|
|
528
595
|
delete: (message) => `Couldn't delete tunnel, message: ${message}`,
|
|
529
596
|
ngrok: `Failed to start tunnel, could not establish a connection.`,
|
|
530
597
|
handler: {
|
|
531
|
-
format: (handler) => `Function handler "${handler}" must be in format <module>.<function>, example: index.run`,
|
|
532
598
|
notFound: (handler) => `Function with handler "${handler}" was not found`
|
|
533
599
|
},
|
|
534
600
|
pullDocker: `Checking Docker image... failed`,
|
|
535
|
-
tunnelPackageMissing: 'To run tunnel without Docker please: npm install -g @forge/tunnel',
|
|
601
|
+
tunnelPackageMissing: 'To run tunnel without Docker please: npm install -g @forge/sandbox-tunnel',
|
|
536
602
|
dockerNotInstalled: (dockerDownloadLink) => 'Cannot find Docker. The tunnel command requires Docker to run your app locally. ' +
|
|
537
603
|
`Get Docker at the following URL before rerunning the tunnel command:\n\n${dockerDownloadLink}`,
|
|
538
604
|
dockerOutOfDate: (dockerDownloadLink) => 'The installed version of Docker should be 17.03 or greater. ' +
|
package/out/ui/ui.d.ts
CHANGED
|
@@ -8,9 +8,20 @@ export interface Prompt {
|
|
|
8
8
|
promptForTable(message: string, infoMessage: string, columns: string[], choices: object[]): Promise<number[]>;
|
|
9
9
|
promptForSingleChoiceTable(message: string, infoMessage: string, columns: string[], choices: object[]): Promise<number>;
|
|
10
10
|
}
|
|
11
|
+
export declare type TableCell = string | boolean | null | undefined;
|
|
12
|
+
export declare type TableOptions<Key extends string> = {
|
|
13
|
+
json?: boolean;
|
|
14
|
+
emptyMessage?: string;
|
|
15
|
+
preMessage?: string;
|
|
16
|
+
postMessage?: string;
|
|
17
|
+
format?: {
|
|
18
|
+
[K in Key]?: (value: TableCell) => string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
11
21
|
export interface UI extends Logger, Prompt {
|
|
12
22
|
emptyLine(): void;
|
|
13
23
|
displayProgress<Result>(progress: () => Promise<Result>, startText: string, successText: string | ((result: Result) => string | ProgressResult)): Promise<Result>;
|
|
14
24
|
displayTemporaryMessage<Result>(progress: () => Promise<Result>, waitText: string): Promise<Result>;
|
|
25
|
+
table<Key extends string>(head: [Key, string][], data: Record<Key, TableCell>[] | undefined | null, options?: TableOptions<Key>): void;
|
|
15
26
|
}
|
|
16
27
|
//# sourceMappingURL=ui.d.ts.map
|
package/out/ui/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/ui/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,MAAM;IACrB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9G,0BAA0B,CACxB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EAAE,GAChB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;AAED,MAAM,WAAW,EAAG,SAAQ,MAAM,EAAE,MAAM;IACxC,SAAS,IAAI,IAAI,CAAC;IAElB,eAAe,CAAC,MAAM,EACpB,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAC/B,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,cAAc,CAAC,GAClE,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnB,uBAAuB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/ui/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,MAAM;IACrB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9G,0BAA0B,CACxB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EAAE,GAChB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;AAED,oBAAY,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAE5D,oBAAY,YAAY,CAAC,GAAG,SAAS,MAAM,IAAI;IAC7C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE;SAAG,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,MAAM;KAAE,CAAC;CACxD,CAAC;AAEF,MAAM,WAAW,EAAG,SAAQ,MAAM,EAAE,MAAM;IACxC,SAAS,IAAI,IAAI,CAAC;IAElB,eAAe,CAAC,MAAM,EACpB,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAC/B,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,cAAc,CAAC,GAClE,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnB,uBAAuB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEpG,KAAK,CAAC,GAAG,SAAS,MAAM,EACtB,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EACrB,IAAI,EAAE,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,GAAG,IAAI,EACjD,OAAO,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,GAC1B,IAAI,CAAC;CACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/cli-shared",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-52c2a24",
|
|
4
4
|
"description": "Common functionality for Forge CLI",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -12,14 +12,15 @@
|
|
|
12
12
|
"generate-graphql-types": "graphql-codegen --config src/graphql/codegen.yml"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@forge/manifest": "0.0.0-experimental-
|
|
16
|
-
"@forge/util": "1.2.
|
|
15
|
+
"@forge/manifest": "0.0.0-experimental-52c2a24",
|
|
16
|
+
"@forge/util": "1.2.1",
|
|
17
|
+
"@sentry/node": "^7.29.0",
|
|
17
18
|
"array.prototype.flatmap": "^1.2.3",
|
|
18
19
|
"case": "^1.6.2",
|
|
19
20
|
"chalk": "^2.4.2",
|
|
20
21
|
"cheerio": "^0.22.0",
|
|
21
22
|
"cli-table3": "^0.6.1",
|
|
22
|
-
"conf": "^6.2.
|
|
23
|
+
"conf": "^6.2.4",
|
|
23
24
|
"cross-spawn": "^7.0.1",
|
|
24
25
|
"env-paths": "^2.2.0",
|
|
25
26
|
"figures": "^3.2.0",
|
|
@@ -30,40 +31,37 @@
|
|
|
30
31
|
"graphql": "^15.8.0",
|
|
31
32
|
"graphql-request": "3.4.0",
|
|
32
33
|
"ignore-walk": "^3.0.3",
|
|
33
|
-
"inquirer": "^
|
|
34
|
+
"inquirer": "^8.2.5",
|
|
34
35
|
"io-ts": "^2.0.6",
|
|
36
|
+
"keytar": "^7.9.0",
|
|
35
37
|
"launchdarkly-node-client-sdk": "^2.0.3",
|
|
36
|
-
"node-fetch": "2.6.
|
|
38
|
+
"node-fetch": "2.6.7",
|
|
37
39
|
"ora": "^4.0.3",
|
|
38
40
|
"recursive-readdir": "^2.2.2",
|
|
39
41
|
"terminal-link": "^2.1.1",
|
|
40
42
|
"tmp": "^0.1.0",
|
|
41
|
-
"typescript": "^
|
|
43
|
+
"typescript": "^4.8.4",
|
|
42
44
|
"unzipper": "^0.10.8",
|
|
43
45
|
"yaml": "^1.10.0"
|
|
44
46
|
},
|
|
45
|
-
"optionalDependencies": {
|
|
46
|
-
"keytar": "^7.0.0"
|
|
47
|
-
},
|
|
48
47
|
"devDependencies": {
|
|
49
48
|
"@graphql-codegen/add": "^2.0.1",
|
|
50
49
|
"@graphql-codegen/cli": "^1.21.6",
|
|
51
50
|
"@graphql-codegen/typescript": "^1.17.10",
|
|
52
51
|
"@graphql-codegen/typescript-operations": "^1.17.8",
|
|
53
52
|
"@types/array.prototype.flatmap": "^1.2.1",
|
|
54
|
-
"@types/cheerio": "^0.22.
|
|
55
|
-
"@types/cross-spawn": "^6.0.
|
|
53
|
+
"@types/cheerio": "^0.22.31",
|
|
54
|
+
"@types/cross-spawn": "^6.0.2",
|
|
56
55
|
"@types/fs-extra": "^8.0.1",
|
|
57
56
|
"@types/get-folder-size": "^2.0.0",
|
|
58
57
|
"@types/ignore-walk": "^3.0.1",
|
|
59
|
-
"@types/inquirer": "^
|
|
60
|
-
"@types/jest": "^
|
|
58
|
+
"@types/inquirer": "^8.2.6",
|
|
59
|
+
"@types/jest": "^29.1.2",
|
|
61
60
|
"@types/js-yaml": "^3.12.2",
|
|
62
61
|
"@types/node-fetch": "^2.5.7",
|
|
63
62
|
"@types/recursive-readdir": "^2.2.0",
|
|
64
63
|
"@types/tmp": "^0.1.0",
|
|
65
64
|
"@types/unzipper": "^0.10.1",
|
|
66
|
-
"aws-lambda": "^1.0.6",
|
|
67
65
|
"graphql-tools": "^6.2.4",
|
|
68
66
|
"jest-fixtures": "^0.6.0"
|
|
69
67
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credentials-store-provider.d.ts","sourceRoot":"","sources":["../../src/auth/credentials-store-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAKL,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,2BAA2B,OAAQ,EAAE,KAAG,2BAMpD,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCredentialsStoreProvider = void 0;
|
|
4
|
-
const graphql_1 = require("../graphql");
|
|
5
|
-
const personal_1 = require("./personal");
|
|
6
|
-
exports.getCredentialsStoreProvider = (ui) => {
|
|
7
|
-
const graphqlGateway = graphql_1.getGraphqlGateway();
|
|
8
|
-
return personal_1.hasKeytar()
|
|
9
|
-
? new personal_1.KeytarPersonalApiCredentialsStore(graphqlGateway, () => personal_1.getKeytar(ui))
|
|
10
|
-
: new personal_1.CachePersonalApiCredentialsStore(graphqlGateway);
|
|
11
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { PersonalApiCredentialsGetter, PersonalApiCredentialsValidated } from './token-store';
|
|
2
|
-
export declare const EMAIL_KEY = "FORGE_EMAIL";
|
|
3
|
-
export declare const API_TOKEN_KEY = "FORGE_API_TOKEN";
|
|
4
|
-
export declare const AAID_KEY = "FORGE_AAID";
|
|
5
|
-
export declare abstract class AbstractPersonalApiCredentialsGetter implements PersonalApiCredentialsGetter {
|
|
6
|
-
protected readonly graphqlGateway: string;
|
|
7
|
-
protected constructor(graphqlGateway: string);
|
|
8
|
-
getCredentials: () => Promise<PersonalApiCredentialsValidated>;
|
|
9
|
-
abstract getCredentialsImpl(): Promise<PersonalApiCredentialsValidated>;
|
|
10
|
-
getInstructionsWhenInvalid: () => string;
|
|
11
|
-
abstract getInstructionsWhenInvalidImpl(): string;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=abstract-token-store-getter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-token-store-getter.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/abstract-token-store-getter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAE9F,eAAO,MAAM,SAAS,gBAAgB,CAAC;AACvC,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAC/C,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC,8BAAsB,oCAAqC,YAAW,4BAA4B;IAC1E,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM;IAA/D,SAAS,aAAgC,cAAc,EAAE,MAAM;IAE/D,cAAc,QAAO,OAAO,CAAC,+BAA+B,CAAC,CAU3D;IAEF,QAAQ,CAAC,kBAAkB,IAAI,OAAO,CAAC,+BAA+B,CAAC;IAEvE,0BAA0B,QAAO,MAAM,CAMrC;IAEF,QAAQ,CAAC,8BAA8B,IAAI,MAAM;CAClD"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AbstractPersonalApiCredentialsGetter = exports.AAID_KEY = exports.API_TOKEN_KEY = exports.EMAIL_KEY = void 0;
|
|
4
|
-
const instruction_1 = require("../instruction");
|
|
5
|
-
const ui_1 = require("../../ui");
|
|
6
|
-
exports.EMAIL_KEY = 'FORGE_EMAIL';
|
|
7
|
-
exports.API_TOKEN_KEY = 'FORGE_API_TOKEN';
|
|
8
|
-
exports.AAID_KEY = 'FORGE_AAID';
|
|
9
|
-
class AbstractPersonalApiCredentialsGetter {
|
|
10
|
-
constructor(graphqlGateway) {
|
|
11
|
-
this.graphqlGateway = graphqlGateway;
|
|
12
|
-
this.getCredentials = () => {
|
|
13
|
-
if (process.env[exports.API_TOKEN_KEY] && process.env[exports.EMAIL_KEY]) {
|
|
14
|
-
return Promise.resolve({
|
|
15
|
-
email: process.env[exports.EMAIL_KEY],
|
|
16
|
-
token: process.env[exports.API_TOKEN_KEY],
|
|
17
|
-
accountId: process.env[exports.AAID_KEY] || ''
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return this.getCredentialsImpl();
|
|
21
|
-
};
|
|
22
|
-
this.getInstructionsWhenInvalid = () => {
|
|
23
|
-
if (process.env[exports.API_TOKEN_KEY] && process.env[exports.EMAIL_KEY]) {
|
|
24
|
-
const instructionsUrl = instruction_1.getInstructionsUrl(this.graphqlGateway);
|
|
25
|
-
return ui_1.Text.error.invalidTokenInEnv(instructionsUrl, exports.EMAIL_KEY, exports.API_TOKEN_KEY);
|
|
26
|
-
}
|
|
27
|
-
return this.getInstructionsWhenInvalidImpl();
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.AbstractPersonalApiCredentialsGetter = AbstractPersonalApiCredentialsGetter;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AbstractPersonalApiCredentialsGetter } from './abstract-token-store-getter';
|
|
2
|
-
import { PersonalApiCredentialsDeleter, PersonalApiCredentialsSetter, PersonalApiCredentialsValidated } from './token-store';
|
|
3
|
-
export declare class CachePersonalApiCredentialsStore extends AbstractPersonalApiCredentialsGetter implements PersonalApiCredentialsSetter, PersonalApiCredentialsDeleter {
|
|
4
|
-
protected readonly graphqlGateway: string;
|
|
5
|
-
private cachedConfig;
|
|
6
|
-
constructor(graphqlGateway: string);
|
|
7
|
-
getCredentialsImpl(): Promise<PersonalApiCredentialsValidated>;
|
|
8
|
-
getInstructionsWhenInvalidImpl(): string;
|
|
9
|
-
deleteCredentials(): Promise<void>;
|
|
10
|
-
setCredentials(credentials: PersonalApiCredentialsValidated): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=token-store-cache.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-store-cache.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/token-store-cache.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAEL,6BAA6B,EAC7B,4BAA4B,EAC5B,+BAA+B,EAChC,MAAM,eAAe,CAAC;AAOvB,qBAAa,gCAAiC,SAAQ,oCACpD,YAAW,4BAA4B,EAAE,6BAA6B;IAG1D,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM;IAFrD,OAAO,CAAC,YAAY,CAAa;gBAEF,cAAc,EAAE,MAAM;IAK9C,kBAAkB,IAAI,OAAO,CAAC,+BAA+B,CAAC;IAU9D,8BAA8B,IAAI,MAAM;IAI/C,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAOlC,cAAc,CAAC,WAAW,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC;CAM5E"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CachePersonalApiCredentialsStore = void 0;
|
|
4
|
-
const ui_1 = require("../../ui");
|
|
5
|
-
const abstract_token_store_getter_1 = require("./abstract-token-store-getter");
|
|
6
|
-
const token_store_1 = require("./token-store");
|
|
7
|
-
const cache_1 = require("../../cache");
|
|
8
|
-
const FORGE_CLI_PACKAGE = '@forge/cli';
|
|
9
|
-
const CACHE_CREDENTIALS_KEY = 'forge-credentials';
|
|
10
|
-
class CachePersonalApiCredentialsStore extends abstract_token_store_getter_1.AbstractPersonalApiCredentialsGetter {
|
|
11
|
-
constructor(graphqlGateway) {
|
|
12
|
-
super(graphqlGateway);
|
|
13
|
-
this.graphqlGateway = graphqlGateway;
|
|
14
|
-
this.cachedConfig = cache_1.CachedConf.getCache(FORGE_CLI_PACKAGE);
|
|
15
|
-
}
|
|
16
|
-
getCredentialsImpl() {
|
|
17
|
-
return new Promise((resolve, reject) => {
|
|
18
|
-
const credentials = this.cachedConfig.get(CACHE_CREDENTIALS_KEY);
|
|
19
|
-
if (!credentials) {
|
|
20
|
-
return reject(new token_store_1.NoTokenInStoreError());
|
|
21
|
-
}
|
|
22
|
-
resolve(credentials);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
getInstructionsWhenInvalidImpl() {
|
|
26
|
-
return ui_1.Text.error.invalidTokenInKeytarOrCache;
|
|
27
|
-
}
|
|
28
|
-
deleteCredentials() {
|
|
29
|
-
return new Promise((resolve) => {
|
|
30
|
-
this.cachedConfig.delete(CACHE_CREDENTIALS_KEY);
|
|
31
|
-
resolve();
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
setCredentials(credentials) {
|
|
35
|
-
return new Promise((resolve) => {
|
|
36
|
-
this.cachedConfig.set(CACHE_CREDENTIALS_KEY, credentials);
|
|
37
|
-
resolve();
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.CachePersonalApiCredentialsStore = CachePersonalApiCredentialsStore;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { UI } from '../../ui';
|
|
2
|
-
import { AbstractPersonalApiCredentialsGetter } from './abstract-token-store-getter';
|
|
3
|
-
import { PersonalApiCredentialsDeleter, PersonalApiCredentialsSetter, PersonalApiCredentialsValidated } from './token-store';
|
|
4
|
-
export interface Keytar {
|
|
5
|
-
getPassword(service: string, account: string): Promise<string | null>;
|
|
6
|
-
setPassword(service: string, account: string, password: string): Promise<void>;
|
|
7
|
-
deletePassword(service: string, account: string): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
export declare function getKeytar(ui: UI): Keytar | never;
|
|
10
|
-
export declare const hasKeytar: () => boolean;
|
|
11
|
-
export declare class KeytarPersonalApiCredentialsStore extends AbstractPersonalApiCredentialsGetter implements PersonalApiCredentialsSetter, PersonalApiCredentialsDeleter {
|
|
12
|
-
protected readonly graphqlGateway: string;
|
|
13
|
-
private readonly keytarProvider;
|
|
14
|
-
private keytarAccount;
|
|
15
|
-
constructor(graphqlGateway: string, keytarProvider: () => Keytar);
|
|
16
|
-
private getKeytarAccount;
|
|
17
|
-
getCredentialsImpl(): Promise<PersonalApiCredentialsValidated>;
|
|
18
|
-
getInstructionsWhenInvalidImpl(): string;
|
|
19
|
-
setCredentials(credentials: PersonalApiCredentialsValidated): Promise<void>;
|
|
20
|
-
deleteCredentials(): Promise<void>;
|
|
21
|
-
private wrapKeytarError;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=token-store-keytar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-store-keytar.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/token-store-keytar.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAEL,6BAA6B,EAC7B,4BAA4B,EAC5B,+BAA+B,EAEhC,MAAM,eAAe,CAAC;AAKvB,MAAM,WAAW,MAAM;IACrB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtE,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AASD,wBAAgB,SAAS,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,GAAG,KAAK,CAOhD;AAED,eAAO,MAAM,SAAS,QAAO,OAO5B,CAAC;AAGF,qBAAa,iCAAkC,SAAQ,oCACrD,YAAW,4BAA4B,EAAE,6BAA6B;IAI1D,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM;IAAE,OAAO,CAAC,QAAQ,CAAC,cAAc;IAHtF,OAAO,CAAC,aAAa,CAAS;gBAGC,cAAc,EAAE,MAAM,EAAmB,cAAc,EAAE,MAAM,MAAM;IAKpG,OAAO,CAAC,gBAAgB;IAQX,kBAAkB,IAAI,OAAO,CAAC,+BAA+B,CAAC;IA4BpE,8BAA8B,IAAI,MAAM;IAIxC,cAAc,CAAC,WAAW,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3E,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMzC,OAAO,CAAC,eAAe;CAkBxB"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KeytarPersonalApiCredentialsStore = exports.hasKeytar = exports.getKeytar = void 0;
|
|
4
|
-
const Either_1 = require("fp-ts/lib/Either");
|
|
5
|
-
const shared_1 = require("../../shared");
|
|
6
|
-
const ui_1 = require("../../ui");
|
|
7
|
-
const os_1 = require("os");
|
|
8
|
-
const abstract_token_store_getter_1 = require("./abstract-token-store-getter");
|
|
9
|
-
const token_store_1 = require("./token-store");
|
|
10
|
-
const KEYTAR_SERVICE = 'Atlassian';
|
|
11
|
-
const KEYTAR_ACCOUNT = 'Ecosystem';
|
|
12
|
-
function getKeytar(ui) {
|
|
13
|
-
try {
|
|
14
|
-
return require('keytar');
|
|
15
|
-
}
|
|
16
|
-
catch (_a) {
|
|
17
|
-
const error = new Error(ui_1.Text.error.noKeytar);
|
|
18
|
-
return shared_1.exitOnError(ui)(error);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.getKeytar = getKeytar;
|
|
22
|
-
exports.hasKeytar = () => {
|
|
23
|
-
try {
|
|
24
|
-
require('keytar');
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
catch (_a) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
class KeytarPersonalApiCredentialsStore extends abstract_token_store_getter_1.AbstractPersonalApiCredentialsGetter {
|
|
32
|
-
constructor(graphqlGateway, keytarProvider) {
|
|
33
|
-
super(graphqlGateway);
|
|
34
|
-
this.graphqlGateway = graphqlGateway;
|
|
35
|
-
this.keytarProvider = keytarProvider;
|
|
36
|
-
this.keytarAccount = this.getKeytarAccount(graphqlGateway);
|
|
37
|
-
}
|
|
38
|
-
getKeytarAccount(graphqlGateway) {
|
|
39
|
-
const isStaging = graphqlGateway.includes('.dev.') || graphqlGateway.includes('.stg.');
|
|
40
|
-
if (isStaging) {
|
|
41
|
-
return `${KEYTAR_ACCOUNT}-staging`;
|
|
42
|
-
}
|
|
43
|
-
return KEYTAR_ACCOUNT;
|
|
44
|
-
}
|
|
45
|
-
async getCredentialsImpl() {
|
|
46
|
-
let stringifiedPersonalApiCredentials;
|
|
47
|
-
try {
|
|
48
|
-
stringifiedPersonalApiCredentials = await this.keytarProvider().getPassword(KEYTAR_SERVICE, this.keytarAccount);
|
|
49
|
-
}
|
|
50
|
-
catch (e) {
|
|
51
|
-
this.wrapKeytarError(e);
|
|
52
|
-
}
|
|
53
|
-
if (!stringifiedPersonalApiCredentials) {
|
|
54
|
-
throw new token_store_1.NoTokenInStoreError();
|
|
55
|
-
}
|
|
56
|
-
let personalApiCredentials;
|
|
57
|
-
try {
|
|
58
|
-
personalApiCredentials = JSON.parse(stringifiedPersonalApiCredentials);
|
|
59
|
-
}
|
|
60
|
-
catch (_a) {
|
|
61
|
-
throw new token_store_1.NoTokenInStoreError();
|
|
62
|
-
}
|
|
63
|
-
const decodeResult = token_store_1.personalApiCredentialsValidatedShape.decode(personalApiCredentials);
|
|
64
|
-
if (Either_1.isLeft(decodeResult)) {
|
|
65
|
-
throw new token_store_1.NoTokenInStoreError();
|
|
66
|
-
}
|
|
67
|
-
return decodeResult.right;
|
|
68
|
-
}
|
|
69
|
-
getInstructionsWhenInvalidImpl() {
|
|
70
|
-
return ui_1.Text.error.invalidTokenInKeytarOrCache;
|
|
71
|
-
}
|
|
72
|
-
setCredentials(credentials) {
|
|
73
|
-
return this.keytarProvider()
|
|
74
|
-
.setPassword(KEYTAR_SERVICE, this.keytarAccount, JSON.stringify(credentials))
|
|
75
|
-
.catch((e) => this.wrapKeytarError(e));
|
|
76
|
-
}
|
|
77
|
-
deleteCredentials() {
|
|
78
|
-
return this.keytarProvider()
|
|
79
|
-
.deletePassword(KEYTAR_SERVICE, this.keytarAccount)
|
|
80
|
-
.catch((e) => this.wrapKeytarError(e));
|
|
81
|
-
}
|
|
82
|
-
wrapKeytarError(e) {
|
|
83
|
-
let error;
|
|
84
|
-
const currentPlatform = os_1.platform();
|
|
85
|
-
switch (currentPlatform) {
|
|
86
|
-
case 'darwin':
|
|
87
|
-
error = ui_1.Text.error.keytarAccessError.mac(e.message);
|
|
88
|
-
break;
|
|
89
|
-
case 'linux':
|
|
90
|
-
error = ui_1.Text.error.keytarAccessError.linux(e.message);
|
|
91
|
-
break;
|
|
92
|
-
case 'win32':
|
|
93
|
-
error = ui_1.Text.error.keytarAccessError.windows(e.message);
|
|
94
|
-
break;
|
|
95
|
-
default:
|
|
96
|
-
error = ui_1.Text.error.keytarAccessError.other(e.message);
|
|
97
|
-
}
|
|
98
|
-
throw new Error(error);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.KeytarPersonalApiCredentialsStore = KeytarPersonalApiCredentialsStore;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as t from 'io-ts';
|
|
2
|
-
export declare const personalApiCredentialsShape: t.TypeC<{
|
|
3
|
-
email: t.StringC;
|
|
4
|
-
token: t.StringC;
|
|
5
|
-
}>;
|
|
6
|
-
export declare const personalApiCredentialsValidatedShape: t.TypeC<{
|
|
7
|
-
email: t.StringC;
|
|
8
|
-
token: t.StringC;
|
|
9
|
-
accountId: t.StringC;
|
|
10
|
-
}>;
|
|
11
|
-
export declare type PersonalApiCredentials = t.TypeOf<typeof personalApiCredentialsShape>;
|
|
12
|
-
export declare type PersonalApiCredentialsValidated = t.TypeOf<typeof personalApiCredentialsValidatedShape>;
|
|
13
|
-
export declare class NoTokenInStoreError extends Error {
|
|
14
|
-
constructor();
|
|
15
|
-
}
|
|
16
|
-
export interface PersonalApiCredentialsGetter {
|
|
17
|
-
getCredentials(): Promise<PersonalApiCredentialsValidated>;
|
|
18
|
-
getInstructionsWhenInvalid(): string;
|
|
19
|
-
}
|
|
20
|
-
export interface PersonalApiCredentialsSetter {
|
|
21
|
-
setCredentials(credentials: PersonalApiCredentialsValidated): Promise<void>;
|
|
22
|
-
}
|
|
23
|
-
export interface PersonalApiCredentialsDeleter {
|
|
24
|
-
deleteCredentials(): Promise<void>;
|
|
25
|
-
}
|
|
26
|
-
export interface PersonalApiCredentialsStore extends PersonalApiCredentialsGetter, PersonalApiCredentialsSetter, PersonalApiCredentialsDeleter {
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=token-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-store.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/token-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAG3B,eAAO,MAAM,2BAA2B;;;EAGtC,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;EAI/C,CAAC;AAEH,oBAAY,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAClF,oBAAY,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAEpG,qBAAa,mBAAoB,SAAQ,KAAK;;CAI7C;AAED,MAAM,WAAW,4BAA4B;IAC3C,cAAc,IAAI,OAAO,CAAC,+BAA+B,CAAC,CAAC;IAC3D,0BAA0B,IAAI,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,4BAA4B;IAC3C,cAAc,CAAC,WAAW,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7E;AAED,MAAM,WAAW,6BAA6B;IAC5C,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,2BACf,SAAQ,4BAA4B,EAClC,4BAA4B,EAC5B,6BAA6B;CAAG"}
|