@forge/cli 0.0.0-experimental-034f51a → 0.0.0-experimental-c8e9749
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 +1110 -2
- package/npm-shrinkwrap.json +13389 -0
- package/out/analytics-client/analytics-client.d.ts +36 -0
- package/out/analytics-client/analytics-client.d.ts.map +1 -0
- package/out/analytics-client/analytics-client.js +140 -0
- package/out/analytics-client/analytics-message-handler.d.ts +21 -0
- package/out/analytics-client/analytics-message-handler.d.ts.map +1 -0
- package/out/analytics-client/analytics-message-handler.js +43 -0
- package/out/autocomplete/autocomplete-config.json +243 -0
- package/out/autocomplete/index.d.ts +5 -0
- package/out/autocomplete/index.d.ts.map +1 -0
- package/out/autocomplete/index.js +41 -0
- package/out/autocomplete/isSupportedShell.d.ts +2 -0
- package/out/autocomplete/isSupportedShell.d.ts.map +1 -0
- package/out/autocomplete/isSupportedShell.js +11 -0
- package/out/autocomplete/types.d.ts +14 -0
- package/out/autocomplete/types.d.ts.map +1 -0
- package/out/autocomplete/types.js +2 -0
- package/out/autocomplete/util.d.ts +6 -0
- package/out/autocomplete/util.d.ts.map +1 -0
- package/out/autocomplete/util.js +15 -0
- package/out/bin/cli.d.ts +1 -0
- package/out/bin/cli.d.ts.map +1 -1
- package/out/bin/cli.js +4 -1
- package/out/bin/postinstall.d.ts +2 -0
- package/out/bin/postinstall.d.ts.map +1 -0
- package/out/bin/postinstall.js +23 -0
- package/out/command-line/anon-user-id.d.ts +3 -0
- package/out/command-line/anon-user-id.d.ts.map +1 -0
- package/out/command-line/anon-user-id.js +17 -0
- package/out/command-line/command.d.ts +80 -0
- package/out/command-line/command.d.ts.map +1 -0
- package/out/command-line/command.js +408 -0
- package/out/command-line/controller/assertUnreachable.d.ts +2 -0
- package/out/command-line/controller/assertUnreachable.d.ts.map +1 -0
- package/out/command-line/controller/assertUnreachable.js +7 -0
- package/out/command-line/controller/autocomplete-controller.d.ts +12 -0
- package/out/command-line/controller/autocomplete-controller.d.ts.map +1 -0
- package/out/command-line/controller/autocomplete-controller.js +54 -0
- package/out/command-line/controller/deploy-controller.d.ts +42 -0
- package/out/command-line/controller/deploy-controller.d.ts.map +1 -0
- package/out/command-line/controller/deploy-controller.js +139 -0
- package/out/command-line/controller/feedback-controller.d.ts +9 -0
- package/out/command-line/controller/feedback-controller.d.ts.map +1 -0
- package/out/command-line/controller/feedback-controller.js +19 -0
- package/out/command-line/controller/getNodeVersion.d.ts +2 -0
- package/out/command-line/controller/getNodeVersion.d.ts.map +1 -0
- package/out/command-line/controller/getNodeVersion.js +7 -0
- package/out/command-line/controller/install-controller.d.ts +35 -0
- package/out/command-line/controller/install-controller.d.ts.map +1 -0
- package/out/command-line/controller/install-controller.js +157 -0
- package/out/command-line/controller/lint-controller.d.ts +9 -0
- package/out/command-line/controller/lint-controller.d.ts.map +1 -0
- package/out/command-line/controller/lint-controller.js +20 -0
- package/out/command-line/controller/pre-command-controller.d.ts +25 -0
- package/out/command-line/controller/pre-command-controller.d.ts.map +1 -0
- package/out/command-line/controller/pre-command-controller.js +57 -0
- package/out/command-line/controller/prerequisites-controller.d.ts +15 -0
- package/out/command-line/controller/prerequisites-controller.d.ts.map +1 -0
- package/out/command-line/controller/prerequisites-controller.js +41 -0
- package/out/command-line/controller/settings-controller.d.ts +19 -0
- package/out/command-line/controller/settings-controller.d.ts.map +1 -0
- package/out/command-line/controller/settings-controller.js +48 -0
- package/out/command-line/controller/stubController.d.ts +9 -0
- package/out/command-line/controller/stubController.d.ts.map +1 -0
- package/out/command-line/controller/stubController.js +15 -0
- package/out/command-line/controller/tunnel-controller.d.ts +14 -0
- package/out/command-line/controller/tunnel-controller.d.ts.map +1 -0
- package/out/command-line/controller/tunnel-controller.js +43 -0
- package/out/command-line/dependency-injection.d.ts +76 -0
- package/out/command-line/dependency-injection.d.ts.map +1 -0
- package/out/command-line/dependency-injection.js +211 -0
- package/out/command-line/environment.d.ts +2 -0
- package/out/command-line/environment.d.ts.map +1 -0
- package/out/command-line/environment.js +16 -0
- package/out/command-line/errors.d.ts +6 -0
- package/out/command-line/errors.d.ts.map +1 -0
- package/out/command-line/errors.js +12 -0
- package/out/command-line/index.d.ts +5 -0
- package/out/command-line/index.d.ts.map +1 -0
- package/out/command-line/index.js +73 -0
- package/out/command-line/register-app-commands.d.ts +10 -0
- package/out/command-line/register-app-commands.d.ts.map +1 -0
- package/out/command-line/register-app-commands.js +128 -0
- package/out/command-line/register-authentication-command.d.ts +16 -0
- package/out/command-line/register-authentication-command.d.ts.map +1 -0
- package/out/command-line/register-authentication-command.js +94 -0
- package/out/command-line/register-autocomplete-commands.d.ts +3 -0
- package/out/command-line/register-autocomplete-commands.d.ts.map +1 -0
- package/out/command-line/register-autocomplete-commands.js +14 -0
- package/out/command-line/register-contributors-commands.d.ts +3 -0
- package/out/command-line/register-contributors-commands.d.ts.map +1 -0
- package/out/command-line/register-contributors-commands.js +134 -0
- package/out/command-line/register-deployment-commands.d.ts +22 -0
- package/out/command-line/register-deployment-commands.d.ts.map +1 -0
- package/out/command-line/register-deployment-commands.js +16 -0
- package/out/command-line/register-environment-variables-commands.d.ts +3 -0
- package/out/command-line/register-environment-variables-commands.d.ts.map +1 -0
- package/out/command-line/register-environment-variables-commands.js +103 -0
- package/out/command-line/register-feedback-commands.d.ts +3 -0
- package/out/command-line/register-feedback-commands.d.ts.map +1 -0
- package/out/command-line/register-feedback-commands.js +32 -0
- package/out/command-line/register-installation-commands.d.ts +6 -0
- package/out/command-line/register-installation-commands.d.ts.map +1 -0
- package/out/command-line/register-installation-commands.js +143 -0
- package/out/command-line/register-lint-command.d.ts +8 -0
- package/out/command-line/register-lint-command.d.ts.map +1 -0
- package/out/command-line/register-lint-command.js +16 -0
- package/out/command-line/register-log-commands.d.ts +4 -0
- package/out/command-line/register-log-commands.d.ts.map +1 -0
- package/out/command-line/register-log-commands.js +139 -0
- package/out/command-line/register-providers-commands.d.ts +3 -0
- package/out/command-line/register-providers-commands.d.ts.map +1 -0
- package/out/command-line/register-providers-commands.js +44 -0
- package/out/command-line/register-settings-commands.d.ts +3 -0
- package/out/command-line/register-settings-commands.d.ts.map +1 -0
- package/out/command-line/register-settings-commands.js +39 -0
- package/out/command-line/register-tunnel-commands.d.ts +3 -0
- package/out/command-line/register-tunnel-commands.d.ts.map +1 -0
- package/out/command-line/register-tunnel-commands.js +15 -0
- package/out/command-line/register-webtrigger-commands.d.ts +3 -0
- package/out/command-line/register-webtrigger-commands.d.ts.map +1 -0
- package/out/command-line/register-webtrigger-commands.js +56 -0
- package/out/command-line/sentry.d.ts +4 -0
- package/out/command-line/sentry.d.ts.map +1 -0
- package/out/command-line/sentry.js +16 -0
- package/out/command-line/unique-machine-id.d.ts +3 -0
- package/out/command-line/unique-machine-id.d.ts.map +1 -0
- package/out/command-line/unique-machine-id.js +19 -0
- package/out/command-line/version-info.d.ts +9 -0
- package/out/command-line/version-info.d.ts.map +1 -0
- package/out/command-line/version-info.js +42 -0
- package/out/command-line/view/analytics-settings-view.d.ts +7 -0
- package/out/command-line/view/analytics-settings-view.d.ts.map +1 -0
- package/out/command-line/view/analytics-settings-view.js +18 -0
- package/out/command-line/view/deploy-view.d.ts +21 -0
- package/out/command-line/view/deploy-view.d.ts.map +1 -0
- package/out/command-line/view/deploy-view.js +58 -0
- package/out/command-line/view/install-view.d.ts +18 -0
- package/out/command-line/view/install-view.d.ts.map +1 -0
- package/out/command-line/view/install-view.js +56 -0
- package/out/command-line/view/lint-view.d.ts +12 -0
- package/out/command-line/view/lint-view.d.ts.map +1 -0
- package/out/command-line/view/lint-view.js +31 -0
- package/out/command-line/view/lite-lint-view.d.ts +10 -0
- package/out/command-line/view/lite-lint-view.d.ts.map +1 -0
- package/out/command-line/view/lite-lint-view.js +18 -0
- package/out/command-line/view/settings-view.d.ts +10 -0
- package/out/command-line/view/settings-view.d.ts.map +1 -0
- package/out/command-line/view/settings-view.js +26 -0
- package/out/command-line/view/tunnel-view.d.ts +20 -0
- package/out/command-line/view/tunnel-view.d.ts.map +1 -0
- package/out/command-line/view/tunnel-view.js +92 -0
- package/out/contributors/add-contributor.d.ts +17 -0
- package/out/contributors/add-contributor.d.ts.map +1 -0
- package/out/contributors/add-contributor.js +14 -0
- package/out/contributors/graphql-client.d.ts +14 -0
- package/out/contributors/graphql-client.d.ts.map +1 -0
- package/out/contributors/graphql-client.js +113 -0
- package/out/contributors/list-contributors.d.ts +18 -0
- package/out/contributors/list-contributors.d.ts.map +1 -0
- package/out/contributors/list-contributors.js +14 -0
- package/out/contributors/remove-contributors.d.ts +18 -0
- package/out/contributors/remove-contributors.d.ts.map +1 -0
- package/out/contributors/remove-contributors.js +14 -0
- package/out/deploy/deployer/deploy-monitor-graphql-client.d.ts +24 -0
- package/out/deploy/deployer/deploy-monitor-graphql-client.d.ts.map +1 -0
- package/out/deploy/deployer/deploy-monitor-graphql-client.js +57 -0
- package/out/deploy/deployer/deployer.d.ts +40 -0
- package/out/deploy/deployer/deployer.d.ts.map +1 -0
- package/out/deploy/deployer/deployer.js +187 -0
- package/out/deploy/deployer/index.d.ts +4 -0
- package/out/deploy/deployer/index.d.ts.map +1 -0
- package/out/deploy/deployer/index.js +6 -0
- package/out/deploy/deployer/trigger-deploy-graphql-client.d.ts +19 -0
- package/out/deploy/deployer/trigger-deploy-graphql-client.d.ts.map +1 -0
- package/out/deploy/deployer/trigger-deploy-graphql-client.js +49 -0
- package/out/deploy/index.d.ts +5 -0
- package/out/deploy/index.d.ts.map +1 -0
- package/out/deploy/index.js +7 -0
- package/out/deploy/package-upload-deploy.d.ts +20 -0
- package/out/deploy/package-upload-deploy.d.ts.map +1 -0
- package/out/deploy/package-upload-deploy.js +37 -0
- package/out/deploy/packager/archiver.d.ts +27 -0
- package/out/deploy/packager/archiver.d.ts.map +1 -0
- package/out/deploy/packager/archiver.js +76 -0
- package/out/deploy/packager/index.d.ts +3 -0
- package/out/deploy/packager/index.d.ts.map +1 -0
- package/out/deploy/packager/index.js +5 -0
- package/out/deploy/packager/nativeui-bundler.d.ts +12 -0
- package/out/deploy/packager/nativeui-bundler.d.ts.map +1 -0
- package/out/deploy/packager/nativeui-bundler.js +34 -0
- package/out/deploy/packager/packager.d.ts +32 -0
- package/out/deploy/packager/packager.d.ts.map +1 -0
- package/out/deploy/packager/packager.js +21 -0
- package/out/deploy/packager/runtime-bundler.d.ts +15 -0
- package/out/deploy/packager/runtime-bundler.d.ts.map +1 -0
- package/out/deploy/packager/runtime-bundler.js +53 -0
- package/out/deploy/uploader/artifact-graphql-client.d.ts +26 -0
- package/out/deploy/uploader/artifact-graphql-client.d.ts.map +1 -0
- package/out/deploy/uploader/artifact-graphql-client.js +100 -0
- package/out/deploy/uploader/index.d.ts +3 -0
- package/out/deploy/uploader/index.d.ts.map +1 -0
- package/out/deploy/uploader/index.js +5 -0
- package/out/deploy/uploader/uploader.d.ts +19 -0
- package/out/deploy/uploader/uploader.d.ts.map +1 -0
- package/out/deploy/uploader/uploader.js +43 -0
- package/out/environment-variables/delete-environment-variable.d.ts +18 -0
- package/out/environment-variables/delete-environment-variable.d.ts.map +1 -0
- package/out/environment-variables/delete-environment-variable.js +14 -0
- package/out/environment-variables/graphql-client.d.ts +16 -0
- package/out/environment-variables/graphql-client.d.ts.map +1 -0
- package/out/environment-variables/graphql-client.js +113 -0
- package/out/environment-variables/list-environment-variables.d.ts +22 -0
- package/out/environment-variables/list-environment-variables.d.ts.map +1 -0
- package/out/environment-variables/list-environment-variables.js +14 -0
- package/out/environment-variables/set-environment-variable.d.ts +20 -0
- package/out/environment-variables/set-environment-variable.d.ts.map +1 -0
- package/out/environment-variables/set-environment-variable.js +14 -0
- package/out/installations/graphql-client.d.ts +75 -0
- package/out/installations/graphql-client.d.ts.map +1 -0
- package/out/installations/graphql-client.js +423 -0
- package/out/installations/install-app-site.d.ts +21 -0
- package/out/installations/install-app-site.d.ts.map +1 -0
- package/out/installations/install-app-site.js +19 -0
- package/out/installations/shared.d.ts +5 -0
- package/out/installations/shared.d.ts.map +1 -0
- package/out/installations/shared.js +20 -0
- package/out/installations/site-translation/bitbucket.d.ts +24 -0
- package/out/installations/site-translation/bitbucket.d.ts.map +1 -0
- package/out/installations/site-translation/bitbucket.js +113 -0
- package/out/installations/site-translation/cloudid-products.d.ts +17 -0
- package/out/installations/site-translation/cloudid-products.d.ts.map +1 -0
- package/out/installations/site-translation/cloudid-products.js +89 -0
- package/out/installations/site-translation/index.d.ts +4 -0
- package/out/installations/site-translation/index.d.ts.map +1 -0
- package/out/installations/site-translation/index.js +6 -0
- package/out/installations/site-translation/site-translation.d.ts +12 -0
- package/out/installations/site-translation/site-translation.d.ts.map +1 -0
- package/out/installations/site-translation/site-translation.js +2 -0
- package/out/installations/uninstall-app.d.ts +25 -0
- package/out/installations/uninstall-app.d.ts.map +1 -0
- package/out/installations/uninstall-app.js +43 -0
- package/out/migration-keys/graphql-client.d.ts +8 -0
- package/out/migration-keys/graphql-client.d.ts.map +1 -0
- package/out/migration-keys/graphql-client.js +55 -0
- package/out/providers/configure-provider.d.ts +19 -0
- package/out/providers/configure-provider.d.ts.map +1 -0
- package/out/providers/configure-provider.js +14 -0
- package/out/providers/graphql-client.d.ts +8 -0
- package/out/providers/graphql-client.d.ts.map +1 -0
- package/out/providers/graphql-client.js +45 -0
- package/out/service/cached-config-service.d.ts +8 -0
- package/out/service/cached-config-service.d.ts.map +1 -0
- package/out/service/cached-config-service.js +16 -0
- package/out/service/command-suggestion-service.d.ts +4 -0
- package/out/service/command-suggestion-service.d.ts.map +1 -0
- package/out/service/command-suggestion-service.js +17 -0
- package/out/service/docker-service.d.ts +24 -0
- package/out/service/docker-service.d.ts.map +1 -0
- package/out/service/docker-service.js +71 -0
- package/out/service/installation-service.d.ts +51 -0
- package/out/service/installation-service.d.ts.map +1 -0
- package/out/service/installation-service.js +91 -0
- package/out/service/lint-service.d.ts +23 -0
- package/out/service/lint-service.d.ts.map +1 -0
- package/out/service/lint-service.js +39 -0
- package/out/service/lite-lint-service.d.ts +10 -0
- package/out/service/lite-lint-service.d.ts.map +1 -0
- package/out/service/lite-lint-service.js +27 -0
- package/out/service/migration-keys-service.d.ts +19 -0
- package/out/service/migration-keys-service.d.ts.map +1 -0
- package/out/service/migration-keys-service.js +14 -0
- package/out/service/port-finding-service.d.ts +12 -0
- package/out/service/port-finding-service.d.ts.map +1 -0
- package/out/service/port-finding-service.js +34 -0
- package/out/service/resource-packaging-service.d.ts +46 -0
- package/out/service/resource-packaging-service.d.ts.map +1 -0
- package/out/service/resource-packaging-service.js +132 -0
- package/out/service/resources-uploader-service.d.ts +16 -0
- package/out/service/resources-uploader-service.d.ts.map +1 -0
- package/out/service/resources-uploader-service.js +39 -0
- package/out/service/tunnel-analytics-service.d.ts +11 -0
- package/out/service/tunnel-analytics-service.d.ts.map +1 -0
- package/out/service/tunnel-analytics-service.js +24 -0
- package/out/service/tunnel-service.d.ts +41 -0
- package/out/service/tunnel-service.d.ts.map +1 -0
- package/out/service/tunnel-service.js +196 -0
- package/out/storage/local-file-storage.d.ts +17 -0
- package/out/storage/local-file-storage.d.ts.map +1 -0
- package/out/storage/local-file-storage.js +53 -0
- package/out/webtrigger/get-webtrigger-url.d.ts +27 -0
- package/out/webtrigger/get-webtrigger-url.d.ts.map +1 -0
- package/out/webtrigger/get-webtrigger-url.js +26 -0
- package/out/webtrigger/graphql-client.d.ts +14 -0
- package/out/webtrigger/graphql-client.d.ts.map +1 -0
- package/out/webtrigger/graphql-client.js +52 -0
- package/out/workers/analytics-message-worker.d.ts +12 -0
- package/out/workers/analytics-message-worker.d.ts.map +1 -0
- package/out/workers/analytics-message-worker.js +29 -0
- package/out/workers/forge-cli-workers.d.ts +2 -0
- package/out/workers/forge-cli-workers.d.ts.map +1 -0
- package/out/workers/forge-cli-workers.js +21 -0
- package/out/workers/tunnel-clean-up-worker.d.ts +8 -0
- package/out/workers/tunnel-clean-up-worker.d.ts.map +1 -0
- package/out/workers/tunnel-clean-up-worker.js +31 -0
- package/out/workers/version-check-worker.d.ts +8 -0
- package/out/workers/version-check-worker.d.ts.map +1 -0
- package/out/workers/version-check-worker.js +20 -0
- package/out/workers/worker-info.d.ts +8 -0
- package/out/workers/worker-info.d.ts.map +1 -0
- package/out/workers/worker-info.js +15 -0
- package/out/workers/worker.d.ts +6 -0
- package/out/workers/worker.d.ts.map +1 -0
- package/out/workers/worker.js +9 -0
- package/out/workers/workers-starter.d.ts +5 -0
- package/out/workers/workers-starter.d.ts.map +1 -0
- package/out/workers/workers-starter.js +22 -0
- package/package.json +60 -5
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BitbucketTranslator = exports.getBitbucketEndpoint = exports.InvalidResponseError = exports.InvalidWorkspaceError = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
6
|
+
const url_1 = require("url");
|
|
7
|
+
const cs_ari_1 = require("@forge/util/packages/cs-ari");
|
|
8
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
9
|
+
class InvalidWorkspaceError extends Error {
|
|
10
|
+
constructor(url) {
|
|
11
|
+
super(cli_shared_1.Text.install.error.invalidWorkspace(url));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.InvalidWorkspaceError = InvalidWorkspaceError;
|
|
15
|
+
class InvalidResponseError extends Error {
|
|
16
|
+
constructor(url) {
|
|
17
|
+
super(cli_shared_1.Text.install.error.site(url.toString()));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.InvalidResponseError = InvalidResponseError;
|
|
21
|
+
const DEFAULT_BITBUCKET_ENDPOINT = 'https://api.bitbucket.org';
|
|
22
|
+
const BITBUCKET_URL = new url_1.URL('https://bitbucket.org');
|
|
23
|
+
const RESOURCE_TYPE = 'workspace';
|
|
24
|
+
const RESOURCE_OWNER = 'bitbucket';
|
|
25
|
+
const getBitbucketEndpoint = () => {
|
|
26
|
+
return process.env.BITBUCKET_ENDPOINT || DEFAULT_BITBUCKET_ENDPOINT;
|
|
27
|
+
};
|
|
28
|
+
exports.getBitbucketEndpoint = getBitbucketEndpoint;
|
|
29
|
+
class BitbucketTranslator {
|
|
30
|
+
ariBelongsToProduct(ari) {
|
|
31
|
+
return ari.resourceOwner === RESOURCE_OWNER;
|
|
32
|
+
}
|
|
33
|
+
async buildInstallationContext(product, site) {
|
|
34
|
+
const workspaceId = await this.getWorkspaceId(site);
|
|
35
|
+
const ari = new cs_ari_1.ResourceIdentifier({
|
|
36
|
+
resourceOwner: product.toLowerCase(),
|
|
37
|
+
resourceType: RESOURCE_TYPE,
|
|
38
|
+
resourceId: workspaceId
|
|
39
|
+
});
|
|
40
|
+
return ari;
|
|
41
|
+
}
|
|
42
|
+
async getSitesForResourceAris(aris) {
|
|
43
|
+
const workspaceIds = aris.map((ari) => ari.resourceId);
|
|
44
|
+
const workspaceAriToHostname = {};
|
|
45
|
+
const workspaceUrls = await Promise.all(workspaceIds.map((workspaceId) => this.getWorkspaceUrl(workspaceId)));
|
|
46
|
+
aris.forEach((ari, index) => {
|
|
47
|
+
const result = workspaceUrls[index];
|
|
48
|
+
workspaceAriToHostname[ari.toString()] = result ? result.toString() : ari.resourceId;
|
|
49
|
+
});
|
|
50
|
+
return workspaceAriToHostname;
|
|
51
|
+
}
|
|
52
|
+
async getWorkspaceId(site) {
|
|
53
|
+
const workspaceName = this.extractWorkspaceName(site);
|
|
54
|
+
const url = this.buildFetchUrl(workspaceName);
|
|
55
|
+
const res = await (0, node_fetch_1.default)(url);
|
|
56
|
+
if (!res.ok) {
|
|
57
|
+
throw new InvalidWorkspaceError(site);
|
|
58
|
+
}
|
|
59
|
+
let json;
|
|
60
|
+
try {
|
|
61
|
+
json = await res.json();
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
throw new InvalidResponseError(site);
|
|
65
|
+
}
|
|
66
|
+
if (json && json.uuid) {
|
|
67
|
+
return this.extractWorkspaceId(json.uuid);
|
|
68
|
+
}
|
|
69
|
+
throw new InvalidResponseError(site);
|
|
70
|
+
}
|
|
71
|
+
async getWorkspaceUrl(workspaceId) {
|
|
72
|
+
const url = this.buildFetchUrl(this.decorateWorkspaceId(workspaceId));
|
|
73
|
+
const res = await (0, node_fetch_1.default)(url);
|
|
74
|
+
if (!res.ok) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
let json;
|
|
78
|
+
try {
|
|
79
|
+
json = await res.json();
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
if (json && json.slug) {
|
|
85
|
+
return this.buildWorkspaceUrl(json.slug);
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
decorateWorkspaceId(workspaceId) {
|
|
90
|
+
return `%7B${workspaceId}%7D`;
|
|
91
|
+
}
|
|
92
|
+
extractWorkspaceId(workspaceIdWithBraces) {
|
|
93
|
+
return workspaceIdWithBraces.replace(/\{|\}/gi, '');
|
|
94
|
+
}
|
|
95
|
+
buildFetchUrl(workspaceNameOrId) {
|
|
96
|
+
const urlObj = new url_1.URL(`${(0, exports.getBitbucketEndpoint)()}/2.0/workspaces/${workspaceNameOrId}`);
|
|
97
|
+
return urlObj.toString();
|
|
98
|
+
}
|
|
99
|
+
extractWorkspaceName(workspaceURL) {
|
|
100
|
+
if (workspaceURL.hostname !== BITBUCKET_URL.hostname) {
|
|
101
|
+
throw new InvalidWorkspaceError(workspaceURL);
|
|
102
|
+
}
|
|
103
|
+
const pathnames = workspaceURL.pathname.substr(1).split('/');
|
|
104
|
+
if (!pathnames.length) {
|
|
105
|
+
throw new InvalidWorkspaceError(workspaceURL);
|
|
106
|
+
}
|
|
107
|
+
return pathnames[0];
|
|
108
|
+
}
|
|
109
|
+
buildWorkspaceUrl(workspaceName) {
|
|
110
|
+
return new url_1.URL(`/${workspaceName}/`, BITBUCKET_URL);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.BitbucketTranslator = BitbucketTranslator;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { SiteTranslator, ResourcefulAri } from './site-translation';
|
|
3
|
+
import { URL } from 'url';
|
|
4
|
+
import { Ari } from '@forge/util/packages/cs-ari';
|
|
5
|
+
import { GraphQLClient, UserError } from '@forge/cli-shared';
|
|
6
|
+
export declare class InvalidAtlassianSiteError extends UserError {
|
|
7
|
+
constructor(url: URL);
|
|
8
|
+
}
|
|
9
|
+
export declare class CloudIdTranslator implements SiteTranslator {
|
|
10
|
+
private graphqlClient;
|
|
11
|
+
constructor(graphqlClient: GraphQLClient);
|
|
12
|
+
ariBelongsToProduct(ari: ResourcefulAri): boolean;
|
|
13
|
+
buildInstallationContext(product: string, site: URL): Promise<Ari>;
|
|
14
|
+
getSitesForResourceAris(aris: ResourcefulAri[]): Promise<Record<string, string>>;
|
|
15
|
+
private getCloudId;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=cloudid-products.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudid-products.d.ts","sourceRoot":"","sources":["../../../src/installations/site-translation/cloudid-products.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAsB,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,aAAa,EAA8B,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzF,qBAAa,yBAA0B,SAAQ,SAAS;gBAC1C,GAAG,EAAE,GAAG;CAGrB;AAyBD,qBAAa,iBAAkB,YAAW,cAAc;IAC1C,OAAO,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAEzC,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO;IAI3C,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAUlE,uBAAuB,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YA6C/E,UAAU;CAezB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudIdTranslator = exports.InvalidAtlassianSiteError = void 0;
|
|
4
|
+
const cs_ari_1 = require("@forge/util/packages/cs-ari");
|
|
5
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
6
|
+
class InvalidAtlassianSiteError extends cli_shared_1.UserError {
|
|
7
|
+
constructor(url) {
|
|
8
|
+
super(cli_shared_1.Text.install.error.invalidAtlassianSite(url));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.InvalidAtlassianSiteError = InvalidAtlassianSiteError;
|
|
12
|
+
const RESOURCE_TYPE = 'site';
|
|
13
|
+
const tenantContextsToCloudId = (url, contexts) => {
|
|
14
|
+
if (!contexts.length) {
|
|
15
|
+
throw new InvalidAtlassianSiteError(url);
|
|
16
|
+
}
|
|
17
|
+
const context = contexts[0];
|
|
18
|
+
if (!context || !context.cloudId) {
|
|
19
|
+
throw new InvalidAtlassianSiteError(url);
|
|
20
|
+
}
|
|
21
|
+
return context.cloudId;
|
|
22
|
+
};
|
|
23
|
+
const tenantToHostname = (tenantInfo) => {
|
|
24
|
+
if (!tenantInfo) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return tenantInfo.hostName || null;
|
|
28
|
+
};
|
|
29
|
+
class CloudIdTranslator {
|
|
30
|
+
constructor(graphqlClient) {
|
|
31
|
+
this.graphqlClient = graphqlClient;
|
|
32
|
+
}
|
|
33
|
+
ariBelongsToProduct(ari) {
|
|
34
|
+
return ari.resourceType === RESOURCE_TYPE;
|
|
35
|
+
}
|
|
36
|
+
async buildInstallationContext(product, site) {
|
|
37
|
+
const cloudId = await this.getCloudId(site);
|
|
38
|
+
const ari = new cs_ari_1.ResourceIdentifier({
|
|
39
|
+
resourceOwner: product.toLowerCase(),
|
|
40
|
+
resourceType: RESOURCE_TYPE,
|
|
41
|
+
resourceId: cloudId
|
|
42
|
+
});
|
|
43
|
+
return ari;
|
|
44
|
+
}
|
|
45
|
+
async getSitesForResourceAris(aris) {
|
|
46
|
+
const MAX_CLOUD_IDS_AT_ONCE = 20;
|
|
47
|
+
const cloudIds = [...new Set(aris.map((ari) => ari.resourceId))];
|
|
48
|
+
const cloudIdsChunks = [];
|
|
49
|
+
for (let i = 0; i < cloudIds.length; i += MAX_CLOUD_IDS_AT_ONCE) {
|
|
50
|
+
cloudIdsChunks.push(cloudIds.slice(i, i + MAX_CLOUD_IDS_AT_ONCE));
|
|
51
|
+
}
|
|
52
|
+
const query = `
|
|
53
|
+
query forge_cli_getHostnameForTenantContexts($cloudIds: [ID!]!) {
|
|
54
|
+
tenantContexts(cloudIds: $cloudIds) {
|
|
55
|
+
hostName
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
const results = await Promise.all(cloudIdsChunks.map((cloudIdsChunk) => this.graphqlClient.query(query, {
|
|
60
|
+
cloudIds: cloudIdsChunk
|
|
61
|
+
})));
|
|
62
|
+
const tenantContexts = [].concat(...results.map((result) => result.tenantContexts || []));
|
|
63
|
+
const cloudIdToHostname = {};
|
|
64
|
+
const ariToHostname = {};
|
|
65
|
+
cloudIds.forEach((cloudId, index) => {
|
|
66
|
+
const maybeHostname = tenantToHostname(tenantContexts[index]);
|
|
67
|
+
cloudIdToHostname[cloudId] = maybeHostname || cloudId;
|
|
68
|
+
});
|
|
69
|
+
aris.forEach((ari) => {
|
|
70
|
+
ariToHostname[ari.toString()] = cloudIdToHostname[ari.resourceId];
|
|
71
|
+
});
|
|
72
|
+
return ariToHostname;
|
|
73
|
+
}
|
|
74
|
+
async getCloudId(site) {
|
|
75
|
+
const query = `
|
|
76
|
+
query forge_cli_getCloudIfForTenantContexts($hostNames: [String!]) {
|
|
77
|
+
tenantContexts(hostNames: $hostNames) {
|
|
78
|
+
cloudId
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
82
|
+
const result = await this.graphqlClient.query(query, {
|
|
83
|
+
hostNames: [site.hostname]
|
|
84
|
+
});
|
|
85
|
+
const tenantContexts = result.tenantContexts || [];
|
|
86
|
+
return tenantContextsToCloudId(site, tenantContexts);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.CloudIdTranslator = CloudIdTranslator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/installations/site-translation/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./bitbucket"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./cloudid-products"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./site-translation"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { URL } from 'url';
|
|
3
|
+
import { Ari } from '@forge/util/packages/cs-ari';
|
|
4
|
+
export interface SiteTranslator {
|
|
5
|
+
buildInstallationContext: (product: string, site: URL) => Promise<Ari>;
|
|
6
|
+
getSitesForResourceAris: (ari: ResourcefulAri[]) => Promise<Record<string, string>>;
|
|
7
|
+
ariBelongsToProduct: (ari: ResourcefulAri) => boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ResourcefulAri extends Ari {
|
|
10
|
+
resourceId: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=site-translation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-translation.d.ts","sourceRoot":"","sources":["../../../src/installations/site-translation/site-translation.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAElD,MAAM,WAAW,cAAc;IAC7B,wBAAwB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAEvE,uBAAuB,EAAE,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpF,mBAAmB,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC;CACvD;AAED,MAAM,WAAW,cAAe,SAAQ,GAAG;IACzC,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AppConfigProvider } from '@forge/cli-shared';
|
|
2
|
+
import { AppUninstallationInput } from '@forge/cli-shared';
|
|
3
|
+
import { Installation } from '../service/installation-service';
|
|
4
|
+
export interface UninstallAppOutput {
|
|
5
|
+
product: string;
|
|
6
|
+
site: string;
|
|
7
|
+
environmentKey: string;
|
|
8
|
+
successful?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface AsyncAppUninstallationInput extends AppUninstallationInput {
|
|
11
|
+
async: true;
|
|
12
|
+
}
|
|
13
|
+
export interface UninstallAppClient {
|
|
14
|
+
getInstallation(appId: string, installationId: string): Promise<Installation>;
|
|
15
|
+
uninstallApp(input: AsyncAppUninstallationInput): Promise<boolean>;
|
|
16
|
+
uninstallMultipleApps(input: AsyncAppUninstallationInput[]): Promise<Partial<UninstallAppOutput>[]>;
|
|
17
|
+
}
|
|
18
|
+
export declare class UninstallAppCommand {
|
|
19
|
+
private readonly getAppConfig;
|
|
20
|
+
private readonly client;
|
|
21
|
+
constructor(getAppConfig: AppConfigProvider, client: UninstallAppClient);
|
|
22
|
+
execute(installationId: string): Promise<UninstallAppOutput>;
|
|
23
|
+
batchExecute(installationIds?: string[], installationInfos?: Installation[]): Promise<UninstallAppOutput[]>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=uninstall-app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uninstall-app.d.ts","sourceRoot":"","sources":["../../src/installations/uninstall-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,2BAA4B,SAAQ,sBAAsB;IACzE,KAAK,EAAE,IAAI,CAAC;CACb;AAED,MAAM,WAAW,kBAAkB;IACjC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9E,YAAY,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,qBAAqB,CAAC,KAAK,EAAE,2BAA2B,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;CACrG;AAED,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAAqB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAxD,YAAY,EAAE,iBAAiB,EAAmB,MAAM,EAAE,kBAAkB;IAE5F,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAY5D,YAAY,CACvB,eAAe,GAAE,MAAM,EAAO,EAC9B,iBAAiB,CAAC,EAAE,YAAY,EAAE,GACjC,OAAO,CAAC,kBAAkB,EAAE,CAAC;CA4BjC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UninstallAppCommand = void 0;
|
|
4
|
+
class UninstallAppCommand {
|
|
5
|
+
constructor(getAppConfig, client) {
|
|
6
|
+
this.getAppConfig = getAppConfig;
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
async execute(installationId) {
|
|
10
|
+
const { id: appId } = await this.getAppConfig();
|
|
11
|
+
const { product, site, environmentKey } = await this.client.getInstallation(appId, installationId);
|
|
12
|
+
const success = await this.client.uninstallApp({ appId, environmentKey, installationId, async: true });
|
|
13
|
+
return {
|
|
14
|
+
product,
|
|
15
|
+
site,
|
|
16
|
+
environmentKey,
|
|
17
|
+
successful: success
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
async batchExecute(installationIds = [], installationInfos) {
|
|
21
|
+
const { id: appId } = await this.getAppConfig();
|
|
22
|
+
let appsInstallInfo;
|
|
23
|
+
if (installationInfos && installationInfos.length) {
|
|
24
|
+
appsInstallInfo = installationInfos;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
appsInstallInfo = await Promise.all(installationIds.map((installId) => this.client.getInstallation(appId, installId)));
|
|
28
|
+
}
|
|
29
|
+
const uninstallOutput = await this.client.uninstallMultipleApps(appsInstallInfo.map((installInfo) => ({
|
|
30
|
+
appId,
|
|
31
|
+
environmentKey: installInfo.environmentKey,
|
|
32
|
+
installationId: installInfo.id,
|
|
33
|
+
async: true
|
|
34
|
+
})));
|
|
35
|
+
return appsInstallInfo.map(({ product, site, environmentKey }, index) => ({
|
|
36
|
+
product,
|
|
37
|
+
site,
|
|
38
|
+
environmentKey,
|
|
39
|
+
successful: uninstallOutput[index].successful
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.UninstallAppCommand = UninstallAppCommand;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GraphQLClient } from '@forge/cli-shared';
|
|
2
|
+
import { AppEnvironmentMigrationKeys } from '../service/migration-keys-service';
|
|
3
|
+
export declare class GraphqlClient {
|
|
4
|
+
private readonly graphqlClient;
|
|
5
|
+
constructor(graphqlClient: GraphQLClient);
|
|
6
|
+
getLatestMigrationKeys(appId: string, environmentKey: string): Promise<AppEnvironmentMigrationKeys>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=graphql-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/migration-keys/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA+C,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;CA+CjH"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphqlClient = void 0;
|
|
4
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
|
+
class GraphqlClient {
|
|
6
|
+
constructor(graphqlClient) {
|
|
7
|
+
this.graphqlClient = graphqlClient;
|
|
8
|
+
}
|
|
9
|
+
async getLatestMigrationKeys(appId, environmentKey) {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const query = `
|
|
12
|
+
query forge_cli_getMigrationKeys($id: ID!, $key: String!) {
|
|
13
|
+
app(id: $id) {
|
|
14
|
+
environmentByKey(key: $key) {
|
|
15
|
+
id
|
|
16
|
+
versions(first: 1) {
|
|
17
|
+
edges {
|
|
18
|
+
node {
|
|
19
|
+
isLatest
|
|
20
|
+
migrationKeys {
|
|
21
|
+
jira
|
|
22
|
+
confluence
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
marketplaceApp {
|
|
29
|
+
appKey
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
const result = await this.graphqlClient.query(query, {
|
|
35
|
+
id: appId,
|
|
36
|
+
key: environmentKey
|
|
37
|
+
});
|
|
38
|
+
if (!result.app) {
|
|
39
|
+
throw new cli_shared_1.MissingAppError();
|
|
40
|
+
}
|
|
41
|
+
if (!result.app.environmentByKey) {
|
|
42
|
+
throw new cli_shared_1.MissingAppEnvironmentError();
|
|
43
|
+
}
|
|
44
|
+
const mpacAppKey = (_a = result.app.marketplaceApp) === null || _a === void 0 ? void 0 : _a.appKey;
|
|
45
|
+
const versions = result.app.environmentByKey.versions;
|
|
46
|
+
let migrationKeys;
|
|
47
|
+
for (const edge of (versions === null || versions === void 0 ? void 0 : versions.edges) || []) {
|
|
48
|
+
if (edge) {
|
|
49
|
+
migrationKeys = (_b = edge.node) === null || _b === void 0 ? void 0 : _b.migrationKeys;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return { migrationKeys, mpacAppKey };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.GraphqlClient = GraphqlClient;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AppConfigProvider } from '@forge/cli-shared';
|
|
2
|
+
export interface ProviderDetails {
|
|
3
|
+
environment: string;
|
|
4
|
+
providerKey: string;
|
|
5
|
+
clientSecret: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AppProviderDetails extends ProviderDetails {
|
|
8
|
+
appId: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ConfigureProviderClient {
|
|
11
|
+
configureProvider(details: AppProviderDetails): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare class ConfigureProviderCommand {
|
|
14
|
+
private readonly client;
|
|
15
|
+
private readonly getAppConfig;
|
|
16
|
+
constructor(client: ConfigureProviderClient, getAppConfig: AppConfigProvider);
|
|
17
|
+
execute(details: ProviderDetails): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=configure-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure-provider.d.ts","sourceRoot":"","sources":["../../src/providers/configure-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED,qBAAa,wBAAwB;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAA2B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAA9D,MAAM,EAAE,uBAAuB,EAAmB,YAAY,EAAE,iBAAiB;IAEjG,OAAO,CAAC,OAAO,EAAE,eAAe;CAO9C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigureProviderCommand = void 0;
|
|
4
|
+
class ConfigureProviderCommand {
|
|
5
|
+
constructor(client, getAppConfig) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
this.getAppConfig = getAppConfig;
|
|
8
|
+
}
|
|
9
|
+
async execute(details) {
|
|
10
|
+
const { id: appId } = await this.getAppConfig();
|
|
11
|
+
await this.client.configureProvider(Object.assign(Object.assign({}, details), { appId }));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ConfigureProviderCommand = ConfigureProviderCommand;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GraphQLClient } from '@forge/cli-shared';
|
|
2
|
+
import { AppProviderDetails, ConfigureProviderClient } from './configure-provider';
|
|
3
|
+
export declare class GraphqlClient implements ConfigureProviderClient {
|
|
4
|
+
private readonly graphqlClient;
|
|
5
|
+
constructor(graphqlClient: GraphQLClient);
|
|
6
|
+
configureProvider(details: AppProviderDetails): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=graphql-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/providers/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,aAAa,EAAwB,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,qBAAa,aAAc,YAAW,uBAAuB;IAC/C,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,iBAAiB,CAAC,OAAO,EAAE,kBAAkB;CA8C3D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphqlClient = void 0;
|
|
4
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
|
+
class GraphqlClient {
|
|
6
|
+
constructor(graphqlClient) {
|
|
7
|
+
this.graphqlClient = graphqlClient;
|
|
8
|
+
}
|
|
9
|
+
async configureProvider(details) {
|
|
10
|
+
const mutation = `
|
|
11
|
+
mutation forge_cli_setExternalAuthCredentials($input: SetExternalAuthCredentialsInput!) {
|
|
12
|
+
setExternalAuthCredentials(input: $input) {
|
|
13
|
+
success
|
|
14
|
+
errors {
|
|
15
|
+
message
|
|
16
|
+
extensions {
|
|
17
|
+
errorType
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
const { response: { setExternalAuthCredentials: { success, errors } }, requestId } = await this.graphqlClient.mutate(mutation, {
|
|
24
|
+
input: {
|
|
25
|
+
environment: {
|
|
26
|
+
appId: details.appId,
|
|
27
|
+
key: details.environment
|
|
28
|
+
},
|
|
29
|
+
serviceKey: details.providerKey,
|
|
30
|
+
credentials: {
|
|
31
|
+
clientSecret: details.clientSecret
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const error = (0, cli_shared_1.getError)(errors);
|
|
36
|
+
if (!success) {
|
|
37
|
+
throw new cli_shared_1.GraphQlMutationError(`${error.message} (requestId: ${requestId || 'unknown'})`, {
|
|
38
|
+
requestId,
|
|
39
|
+
code: error.code,
|
|
40
|
+
statusCode: error.statusCode
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.GraphqlClient = GraphqlClient;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CachedConf } from '@forge/cli-shared';
|
|
2
|
+
export declare class CachedConfigService {
|
|
3
|
+
private readonly cachedConf;
|
|
4
|
+
constructor(cachedConf: CachedConf);
|
|
5
|
+
getAnalyticsPreferences(): boolean | undefined;
|
|
6
|
+
setAnalyticsPreferences(preference: boolean): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=cached-config-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cached-config-service.d.ts","sourceRoot":"","sources":["../../src/service/cached-config-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAE5C,uBAAuB,IAAI,OAAO,GAAG,SAAS;IAI9C,uBAAuB,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI;CAG1D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CachedConfigService = void 0;
|
|
4
|
+
const ANALYTICS_PREFERENCES_KEY = 'analytics-preferences';
|
|
5
|
+
class CachedConfigService {
|
|
6
|
+
constructor(cachedConf) {
|
|
7
|
+
this.cachedConf = cachedConf;
|
|
8
|
+
}
|
|
9
|
+
getAnalyticsPreferences() {
|
|
10
|
+
return this.cachedConf.get(ANALYTICS_PREFERENCES_KEY);
|
|
11
|
+
}
|
|
12
|
+
setAnalyticsPreferences(preference) {
|
|
13
|
+
this.cachedConf.set(ANALYTICS_PREFERENCES_KEY, preference);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.CachedConfigService = CachedConfigService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-suggestion-service.d.ts","sourceRoot":"","sources":["../../src/service/command-suggestion-service.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,wBAAwB;IACpC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;CAc/D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const didyoumean_1 = tslib_1.__importDefault(require("didyoumean"));
|
|
5
|
+
class CommandSuggestionService {
|
|
6
|
+
getSuggestions(input, list) {
|
|
7
|
+
const set = [...list, ...list.map((item) => item.split(':')[0])];
|
|
8
|
+
let result = set.filter((search) => search.includes(input));
|
|
9
|
+
const dym = (0, didyoumean_1.default)(input, set);
|
|
10
|
+
if (dym) {
|
|
11
|
+
result.push(dym);
|
|
12
|
+
result = [...result, ...set.filter((search) => search.includes(dym))];
|
|
13
|
+
}
|
|
14
|
+
return list.filter((item) => result.includes(item));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.default = CommandSuggestionService;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { spawn } from 'cross-spawn';
|
|
2
|
+
export declare class DockerError extends Error {
|
|
3
|
+
readonly code: DockerErrorCode;
|
|
4
|
+
constructor(message: string, code: DockerErrorCode);
|
|
5
|
+
}
|
|
6
|
+
export interface DockerVersion {
|
|
7
|
+
full: string;
|
|
8
|
+
major: number;
|
|
9
|
+
minor: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const DOCKER_DOWNLOAD_LINK = "https://docs.docker.com/get-docker/";
|
|
12
|
+
export declare enum DockerErrorCode {
|
|
13
|
+
DAEMON_NOT_RUNNING = 0,
|
|
14
|
+
NOT_INSTALLED = 1
|
|
15
|
+
}
|
|
16
|
+
export declare class DockerService {
|
|
17
|
+
runContainer(args: string[]): ReturnType<typeof spawn>;
|
|
18
|
+
getDockerVersion(debugEnabled: boolean): Promise<DockerVersion>;
|
|
19
|
+
removeContainer(containerName: string): Promise<void>;
|
|
20
|
+
downloadImage(imageName: string): ReturnType<typeof spawn>;
|
|
21
|
+
startCleanupWorker(pids: number[], containerName: string): void;
|
|
22
|
+
private execPromise;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=docker-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker-service.d.ts","sourceRoot":"","sources":["../../src/service/docker-service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAWpC,qBAAa,WAAY,SAAQ,KAAK;aACS,IAAI,EAAE,eAAe;gBAAtD,OAAO,EAAE,MAAM,EAAkB,IAAI,EAAE,eAAe;CAGnE;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,oBAAoB,wCAAwC,CAAC;AAE1E,oBAAY,eAAe;IACzB,kBAAkB,IAAA;IAClB,aAAa,IAAA;CACd;AAED,qBAAa,aAAa;IACjB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC;IAIhD,gBAAgB,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IAwB/D,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC;IAI1D,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI;IActE,OAAO,CAAC,WAAW;CAWpB"}
|