heroku 8.1.9 → 8.2.0-beta.1
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/README.md +5 -6
- package/autocomplete-scripts/README.md +7 -0
- package/autocomplete-scripts/bash/heroku.bash +59 -0
- package/autocomplete-scripts/brew/bash +4 -0
- package/autocomplete-scripts/brew/zsh/_heroku +59 -0
- package/autocomplete-scripts/zsh/_heroku +53 -0
- package/bin/bats-test-runner.js +7 -0
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +36 -1
- package/lib/analytics.d.ts +2 -2
- package/lib/analytics.js +3 -4
- package/lib/commands/auth/2fa/disable.d.ts +7 -0
- package/lib/commands/auth/2fa/disable.js +16 -0
- package/lib/commands/auth/2fa/index.d.ts +6 -0
- package/lib/commands/auth/2fa/index.js +18 -0
- package/lib/commands/auth/login.d.ts +8 -0
- package/lib/commands/auth/login.js +25 -0
- package/lib/commands/auth/logout.d.ts +6 -0
- package/lib/commands/auth/logout.js +14 -0
- package/lib/commands/auth/token.d.ts +7 -0
- package/lib/commands/auth/token.js +31 -0
- package/lib/commands/auth/whoami.d.ts +7 -0
- package/lib/commands/auth/whoami.js +26 -0
- package/lib/commands/authorizations/create.d.ts +13 -0
- package/lib/commands/authorizations/create.js +41 -0
- package/lib/commands/authorizations/index.d.ts +9 -0
- package/lib/commands/authorizations/index.js +35 -0
- package/lib/commands/authorizations/info.d.ts +11 -0
- package/lib/commands/authorizations/info.js +25 -0
- package/lib/commands/authorizations/revoke.d.ts +10 -0
- package/lib/commands/authorizations/revoke.js +22 -0
- package/lib/commands/authorizations/rotate.d.ts +8 -0
- package/lib/commands/authorizations/rotate.js +19 -0
- package/lib/commands/authorizations/update.d.ts +13 -0
- package/lib/commands/authorizations/update.js +36 -0
- package/lib/commands/autocomplete/create.d.ts +29 -0
- package/lib/commands/autocomplete/create.js +213 -0
- package/lib/commands/autocomplete/doctor.d.ts +12 -0
- package/lib/commands/autocomplete/doctor.js +97 -0
- package/lib/commands/autocomplete/index.d.ts +12 -0
- package/lib/commands/autocomplete/index.js +67 -0
- package/lib/commands/autocomplete/options.d.ts +25 -0
- package/lib/commands/autocomplete/options.js +210 -0
- package/lib/commands/autocomplete/script.d.ts +10 -0
- package/lib/commands/autocomplete/script.js +23 -0
- package/lib/commands/buildpacks/add.d.ts +13 -0
- package/lib/commands/buildpacks/add.js +43 -0
- package/lib/commands/buildpacks/clear.d.ts +9 -0
- package/lib/commands/buildpacks/clear.js +17 -0
- package/lib/commands/buildpacks/index.d.ts +9 -0
- package/lib/commands/buildpacks/index.js +25 -0
- package/lib/commands/buildpacks/info.d.ts +8 -0
- package/lib/commands/buildpacks/info.js +41 -0
- package/lib/commands/buildpacks/remove.d.ts +13 -0
- package/lib/commands/buildpacks/remove.js +55 -0
- package/lib/commands/buildpacks/search.d.ts +13 -0
- package/lib/commands/buildpacks/search.js +69 -0
- package/lib/commands/buildpacks/set.d.ts +13 -0
- package/lib/commands/buildpacks/set.js +42 -0
- package/lib/commands/buildpacks/versions.d.ts +8 -0
- package/lib/commands/buildpacks/versions.js +56 -0
- package/lib/commands/certs/auto/wait.d.ts +9 -0
- package/lib/commands/certs/auto/wait.js +14 -0
- package/lib/commands/ci/index.d.ts +12 -0
- package/lib/commands/ci/index.js +25 -0
- package/lib/commands/ci/info.d.ts +14 -0
- package/lib/commands/ci/info.js +29 -0
- package/lib/commands/ci/last.d.ts +11 -0
- package/lib/commands/ci/last.js +31 -0
- package/lib/commands/ci/rerun.d.ts +13 -0
- package/lib/commands/ci/rerun.js +53 -0
- package/lib/commands/ci/run.d.ts +10 -0
- package/lib/commands/ci/run.js +42 -0
- package/lib/commands/clients/create.d.ts +14 -0
- package/lib/commands/clients/create.js +37 -0
- package/lib/commands/clients/destroy.d.ts +8 -0
- package/lib/commands/clients/destroy.js +18 -0
- package/lib/commands/clients/index.d.ts +8 -0
- package/lib/commands/clients/index.js +32 -0
- package/lib/commands/clients/info.d.ts +13 -0
- package/lib/commands/clients/info.js +33 -0
- package/lib/commands/clients/rotate.d.ts +12 -0
- package/lib/commands/clients/rotate.js +33 -0
- package/lib/commands/clients/update.d.ts +13 -0
- package/lib/commands/clients/update.js +38 -0
- package/lib/commands/config/edit.d.ts +23 -0
- package/lib/commands/config/edit.js +132 -0
- package/lib/commands/config/get.d.ts +16 -0
- package/lib/commands/config/get.js +35 -0
- package/lib/commands/config/index.d.ts +11 -0
- package/lib/commands/config/index.js +33 -0
- package/lib/commands/config/unset.d.ts +12 -0
- package/lib/commands/config/unset.js +51 -0
- package/lib/commands/console.d.ts +11 -0
- package/lib/commands/console.js +30 -0
- package/lib/commands/domains/add.d.ts +19 -0
- package/lib/commands/domains/add.js +117 -0
- package/lib/commands/domains/clear.d.ts +11 -0
- package/lib/commands/domains/clear.js +26 -0
- package/lib/commands/domains/index.d.ts +40 -0
- package/lib/commands/domains/index.js +79 -0
- package/lib/commands/domains/info.d.ts +14 -0
- package/lib/commands/domains/info.js +25 -0
- package/lib/commands/domains/remove.d.ts +14 -0
- package/lib/commands/domains/remove.js +26 -0
- package/lib/commands/domains/update.d.ts +15 -0
- package/lib/commands/domains/update.js +40 -0
- package/lib/commands/domains/wait.d.ts +13 -0
- package/lib/commands/domains/wait.js +32 -0
- package/lib/commands/git/clone.d.ts +13 -0
- package/lib/commands/git/clone.js +29 -0
- package/lib/commands/git/credentials.d.ts +9 -0
- package/lib/commands/git/credentials.js +32 -0
- package/lib/commands/git/remote.d.ts +11 -0
- package/lib/commands/git/remote.js +44 -0
- package/lib/commands/labs/disable.d.ts +11 -0
- package/lib/commands/labs/disable.js +65 -0
- package/lib/commands/local/index.d.ts +17 -0
- package/lib/commands/local/index.js +75 -0
- package/lib/commands/local/run.d.ts +11 -0
- package/lib/commands/local/run.js +38 -0
- package/lib/commands/local/version.d.ts +5 -0
- package/lib/commands/local/version.js +13 -0
- package/lib/commands/logs.d.ts +16 -0
- package/lib/commands/logs.js +45 -0
- package/lib/commands/pipelines/add.d.ts +14 -0
- package/lib/commands/pipelines/add.js +61 -0
- package/lib/commands/pipelines/connect.d.ts +12 -0
- package/lib/commands/pipelines/connect.js +52 -0
- package/lib/commands/pipelines/create.d.ts +15 -0
- package/lib/commands/pipelines/create.js +91 -0
- package/lib/commands/pipelines/destroy.d.ts +9 -0
- package/lib/commands/pipelines/destroy.js +27 -0
- package/lib/commands/pipelines/diff.d.ts +19 -0
- package/lib/commands/pipelines/diff.js +152 -0
- package/lib/commands/pipelines/index.d.ts +9 -0
- package/lib/commands/pipelines/index.js +27 -0
- package/lib/commands/pipelines/info.d.ts +13 -0
- package/lib/commands/pipelines/info.js +43 -0
- package/lib/commands/pipelines/open.d.ts +9 -0
- package/lib/commands/pipelines/open.js +19 -0
- package/lib/commands/pipelines/promote.d.ts +12 -0
- package/lib/commands/pipelines/promote.js +216 -0
- package/lib/commands/pipelines/remove.d.ts +10 -0
- package/lib/commands/pipelines/remove.js +23 -0
- package/lib/commands/pipelines/rename.d.ts +10 -0
- package/lib/commands/pipelines/rename.js +33 -0
- package/lib/commands/pipelines/setup.d.ts +14 -0
- package/lib/commands/pipelines/setup.js +91 -0
- package/lib/commands/pipelines/transfer.d.ts +13 -0
- package/lib/commands/pipelines/transfer.js +65 -0
- package/lib/commands/pipelines/update.d.ts +11 -0
- package/lib/commands/pipelines/update.js +32 -0
- package/lib/commands/ps/autoscale/disable.d.ts +9 -0
- package/lib/commands/ps/autoscale/disable.js +35 -0
- package/lib/commands/ps/autoscale/enable.d.ts +13 -0
- package/lib/commands/ps/autoscale/enable.js +65 -0
- package/lib/commands/ps/wait.d.ts +12 -0
- package/lib/commands/ps/wait.js +78 -0
- package/lib/commands/rake.d.ts +14 -0
- package/lib/commands/rake.js +46 -0
- package/lib/commands/regions.d.ts +11 -0
- package/lib/commands/regions.js +45 -0
- package/lib/commands/reviewapps/disable.d.ts +17 -0
- package/lib/commands/reviewapps/disable.js +102 -0
- package/lib/commands/reviewapps/enable.d.ts +14 -0
- package/lib/commands/reviewapps/enable.js +89 -0
- package/lib/commands/run/detached.d.ts +15 -0
- package/lib/commands/run/detached.js +56 -0
- package/lib/commands/run/index.d.ts +18 -0
- package/lib/commands/run/index.js +64 -0
- package/lib/commands/run/inside.d.ts +15 -0
- package/lib/commands/run/inside.js +55 -0
- package/lib/commands/sessions/destroy.d.ts +8 -0
- package/lib/commands/sessions/destroy.js +18 -0
- package/lib/commands/sessions/index.d.ts +8 -0
- package/lib/commands/sessions/index.js +31 -0
- package/lib/commands/status.d.ts +8 -0
- package/lib/commands/status.js +46 -0
- package/lib/commands/webhooks/add.d.ts +16 -0
- package/lib/commands/webhooks/add.js +47 -0
- package/lib/commands/webhooks/deliveries/index.d.ts +12 -0
- package/lib/commands/webhooks/deliveries/index.js +80 -0
- package/lib/commands/webhooks/deliveries/info.d.ts +14 -0
- package/lib/commands/webhooks/deliveries/info.js +42 -0
- package/lib/commands/webhooks/events/index.d.ts +11 -0
- package/lib/commands/webhooks/events/index.js +46 -0
- package/lib/commands/webhooks/events/info.d.ts +14 -0
- package/lib/commands/webhooks/events/info.js +31 -0
- package/lib/commands/webhooks/index.d.ts +11 -0
- package/lib/commands/webhooks/index.js +45 -0
- package/lib/commands/webhooks/info.d.ts +14 -0
- package/lib/commands/webhooks/info.js +31 -0
- package/lib/commands/webhooks/remove.d.ts +14 -0
- package/lib/commands/webhooks/remove.js +29 -0
- package/lib/commands/webhooks/update.d.ts +19 -0
- package/lib/commands/webhooks/update.js +41 -0
- package/lib/file.js +2 -3
- package/lib/global_telemetry.d.ts +53 -0
- package/lib/global_telemetry.js +82 -0
- package/lib/hooks/command_not_found/performance_analytics.d.ts +3 -0
- package/lib/hooks/command_not_found/performance_analytics.js +7 -0
- package/lib/hooks/init/terms-of-service.js +3 -4
- package/lib/hooks/init/version.d.ts +2 -1
- package/lib/hooks/init/version.js +1 -2
- package/lib/hooks/postrun/performance_analytics.d.ts +3 -0
- package/lib/hooks/postrun/performance_analytics.js +11 -0
- package/lib/hooks/prerun/analytics.d.ts +2 -1
- package/lib/hooks/prerun/analytics.js +4 -4
- package/lib/hooks/recache.d.ts +3 -0
- package/lib/hooks/recache.js +56 -0
- package/lib/hooks/update/brew.d.ts +2 -1
- package/lib/hooks/update/brew.js +3 -5
- package/lib/hooks/update/completions.d.ts +2 -1
- package/lib/hooks/update/completions.js +2 -3
- package/lib/hooks/update/plugin-migrate.d.ts +2 -1
- package/lib/hooks/update/plugin-migrate.js +3 -5
- package/lib/hooks/update/tidy.d.ts +2 -1
- package/lib/hooks/update/tidy.js +3 -5
- package/lib/lib/authorizations/authorizations.d.ts +2 -0
- package/lib/lib/authorizations/authorizations.js +39 -0
- package/lib/lib/autocomplete/base.d.ts +11 -0
- package/lib/lib/autocomplete/base.js +44 -0
- package/lib/lib/autocomplete/cache.d.ts +2 -0
- package/lib/lib/autocomplete/cache.js +28 -0
- package/lib/lib/autocomplete/completions.d.ts +37 -0
- package/lib/lib/autocomplete/completions.js +261 -0
- package/lib/lib/buildpacks/buildpacks.d.ts +32 -0
- package/lib/lib/buildpacks/buildpacks.js +161 -0
- package/lib/lib/buildpacks/push.d.ts +0 -0
- package/lib/lib/buildpacks/push.js +4 -0
- package/lib/lib/ci/git.d.ts +8 -0
- package/lib/lib/ci/git.js +71 -0
- package/lib/lib/ci/interfaces/kolkrabbi.d.ts +311 -0
- package/lib/lib/ci/interfaces/kolkrabbi.js +7 -0
- package/lib/lib/ci/pipelines.d.ts +3 -0
- package/lib/lib/ci/pipelines.js +57 -0
- package/lib/lib/ci/source.d.ts +2 -0
- package/lib/lib/ci/source.js +42 -0
- package/lib/lib/ci/test-run.d.ts +5 -0
- package/lib/lib/ci/test-run.js +232 -0
- package/lib/lib/clients/clients.d.ts +1 -0
- package/lib/lib/clients/clients.js +25 -0
- package/lib/lib/config/quote.d.ts +2 -0
- package/lib/lib/config/quote.js +33 -0
- package/lib/lib/config/util.d.ts +3 -0
- package/lib/lib/config/util.js +12 -0
- package/lib/lib/domains/wait-for-domain.d.ts +3 -0
- package/lib/lib/domains/wait-for-domain.js +19 -0
- package/lib/lib/git/git.d.ts +8 -0
- package/lib/lib/git/git.js +56 -0
- package/lib/lib/local/fork-foreman.d.ts +1 -0
- package/lib/lib/local/fork-foreman.js +33 -0
- package/lib/lib/local/load-foreman-procfile.d.ts +0 -0
- package/lib/lib/local/load-foreman-procfile.js +2 -0
- package/lib/lib/local/run-foreman.d.ts +0 -0
- package/lib/lib/local/run-foreman.js +2 -0
- package/lib/lib/pipelines/api.d.ts +25 -0
- package/lib/lib/pipelines/api.js +130 -0
- package/lib/lib/pipelines/disambiguate.d.ts +3 -0
- package/lib/lib/pipelines/disambiguate.js +49 -0
- package/lib/lib/pipelines/github-api.d.ts +8 -0
- package/lib/lib/pipelines/github-api.js +18 -0
- package/lib/lib/pipelines/infer.d.ts +1 -0
- package/lib/lib/pipelines/infer.js +11 -0
- package/lib/lib/pipelines/key-by.d.ts +1 -0
- package/lib/lib/pipelines/key-by.js +11 -0
- package/lib/lib/pipelines/kolkrabbi-api.d.ts +14 -0
- package/lib/lib/pipelines/kolkrabbi-api.js +62 -0
- package/lib/lib/pipelines/ownership.d.ts +4 -0
- package/lib/lib/pipelines/ownership.js +40 -0
- package/lib/lib/pipelines/render-pipeline.d.ts +6 -0
- package/lib/lib/pipelines/render-pipeline.js +52 -0
- package/lib/lib/pipelines/setup/create-apps.d.ts +1 -0
- package/lib/lib/pipelines/setup/create-apps.js +44 -0
- package/lib/lib/pipelines/setup/get-ci-settings.d.ts +4 -0
- package/lib/lib/pipelines/setup/get-ci-settings.js +19 -0
- package/lib/lib/pipelines/setup/get-github-token.d.ts +1 -0
- package/lib/lib/pipelines/setup/get-github-token.js +10 -0
- package/lib/lib/pipelines/setup/get-name-and-repo.d.ts +1 -0
- package/lib/lib/pipelines/setup/get-name-and-repo.js +47 -0
- package/lib/lib/pipelines/setup/get-repo.d.ts +1 -0
- package/lib/lib/pipelines/setup/get-repo.js +8 -0
- package/lib/lib/pipelines/setup/get-settings.d.ts +9 -0
- package/lib/lib/pipelines/setup/get-settings.js +39 -0
- package/lib/lib/pipelines/setup/poll-app-setups.d.ts +1 -0
- package/lib/lib/pipelines/setup/poll-app-setups.js +25 -0
- package/lib/lib/pipelines/setup/setup-pipeline.d.ts +1 -0
- package/lib/lib/pipelines/setup/setup-pipeline.js +15 -0
- package/lib/lib/pipelines/setup/validate.d.ts +9 -0
- package/lib/lib/pipelines/setup/validate.js +31 -0
- package/lib/lib/pipelines/stages.d.ts +7 -0
- package/lib/lib/pipelines/stages.js +22 -0
- package/lib/lib/run/colorize.d.ts +2 -0
- package/lib/lib/run/colorize.js +300 -0
- package/lib/lib/run/dyno.d.ts +72 -0
- package/lib/lib/run/dyno.js +397 -0
- package/lib/lib/run/helpers.d.ts +2 -0
- package/lib/lib/run/helpers.js +34 -0
- package/lib/lib/run/line-transform.d.ts +4 -0
- package/lib/lib/run/line-transform.js +26 -0
- package/lib/lib/run/log-displayer.d.ts +10 -0
- package/lib/lib/run/log-displayer.js +79 -0
- package/lib/lib/sessions/sessions.d.ts +7 -0
- package/lib/lib/sessions/sessions.js +2 -0
- package/lib/lib/status/util.d.ts +1 -0
- package/lib/lib/status/util.js +14 -0
- package/lib/lib/webhooks/base.d.ts +13 -0
- package/lib/lib/webhooks/base.js +28 -0
- package/lib/user-config.js +2 -3
- package/oclif.manifest.json +3376 -2
- package/package.json +80 -43
- package/lib/hooks/update/b.d.ts +0 -2
- package/lib/hooks/update/b.js +0 -48
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("@heroku-cli/command");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const spinner_1 = require("@oclif/core/lib/cli-ux/action/spinner");
|
|
6
|
+
const base_1 = require("../../lib/webhooks/base");
|
|
7
|
+
class WebhooksRemove extends base_1.default {
|
|
8
|
+
async run() {
|
|
9
|
+
const { flags, args } = await this.parse(WebhooksRemove);
|
|
10
|
+
const { path, display } = this.webhookType(flags);
|
|
11
|
+
const action = new spinner_1.default();
|
|
12
|
+
action.start(`Removing webhook ${args.id} from ${display}`);
|
|
13
|
+
await this.webhooksClient.delete(`${path}/webhooks/${args.id}`);
|
|
14
|
+
action.stop();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.default = WebhooksRemove;
|
|
18
|
+
WebhooksRemove.description = 'removes a webhook from an app';
|
|
19
|
+
WebhooksRemove.examples = [
|
|
20
|
+
'$ heroku webhooks:remove 99999999-9999-9999-9999-999999999999',
|
|
21
|
+
];
|
|
22
|
+
WebhooksRemove.flags = {
|
|
23
|
+
app: command_1.flags.app(),
|
|
24
|
+
remote: command_1.flags.remote(),
|
|
25
|
+
pipeline: command_1.flags.pipeline({ char: 'p', description: 'pipeline on which to list', hidden: true }),
|
|
26
|
+
};
|
|
27
|
+
WebhooksRemove.args = {
|
|
28
|
+
id: core_1.Args.string({ description: 'id of webhook to remove', required: true }),
|
|
29
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import BaseCommand from '../../lib/webhooks/base';
|
|
2
|
+
export default class WebhooksUpdate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
app: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
pipeline: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
include: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
+
level: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
+
secret: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
+
authorization: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
|
+
url: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
static args: {
|
|
16
|
+
id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
17
|
+
};
|
|
18
|
+
run(): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("@heroku-cli/command");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const spinner_1 = require("@oclif/core/lib/cli-ux/action/spinner");
|
|
6
|
+
const base_1 = require("../../lib/webhooks/base");
|
|
7
|
+
class WebhooksUpdate extends base_1.default {
|
|
8
|
+
async run() {
|
|
9
|
+
const { flags, args } = await this.parse(WebhooksUpdate);
|
|
10
|
+
const { path, display } = this.webhookType(flags);
|
|
11
|
+
const action = new spinner_1.default();
|
|
12
|
+
action.start(`Updating webhook ${args.id} for ${display}`);
|
|
13
|
+
await this.webhooksClient.patch(`${path}/webhooks/${args.id}`, {
|
|
14
|
+
body: {
|
|
15
|
+
include: flags.include && flags.include.split(',').map(s => s.trim()),
|
|
16
|
+
level: flags.level,
|
|
17
|
+
secret: flags.secret,
|
|
18
|
+
url: flags.url,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
action.stop();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = WebhooksUpdate;
|
|
25
|
+
WebhooksUpdate.description = 'updates a webhook in an app';
|
|
26
|
+
WebhooksUpdate.examples = [
|
|
27
|
+
'$ heroku webhooks:update 99999999-9999-9999-9999-999999999999 -i dyno -l notify -s 09928c40bf1b191b645174a19f7053d16a180da37332e719ef0998f4c0a2 -u https://example.com/hooks',
|
|
28
|
+
];
|
|
29
|
+
WebhooksUpdate.flags = {
|
|
30
|
+
app: command_1.flags.app(),
|
|
31
|
+
remote: command_1.flags.remote(),
|
|
32
|
+
pipeline: command_1.flags.pipeline({ char: 'p', description: 'pipeline on which to list', hidden: true }),
|
|
33
|
+
include: command_1.flags.string({ char: 'i', description: 'comma delimited event types your server will receive ', required: true }),
|
|
34
|
+
level: command_1.flags.string({ char: 'l', description: 'notify does not retry, sync will retry until successful or timeout', required: true }),
|
|
35
|
+
secret: command_1.flags.string({ char: 's', description: 'value to sign delivery with in Heroku-Webhook-Hmac-SHA256 header' }),
|
|
36
|
+
authorization: command_1.flags.string({ char: 't', description: 'authoriation header to send with webhooks' }),
|
|
37
|
+
url: command_1.flags.string({ char: 'u', description: 'URL for receiver', required: true }),
|
|
38
|
+
};
|
|
39
|
+
WebhooksUpdate.args = {
|
|
40
|
+
id: core_1.Args.string({ required: true }),
|
|
41
|
+
};
|
package/lib/file.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.realpathSync = exports.outputJSON = exports.readJSON = exports.removeEmptyDirs = exports.ls = exports.remove = exports.rename = exports.stat = exports.exists = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const deps_1 = tslib_1.__importDefault(require("./deps"));
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const deps_1 = require("./deps");
|
|
7
6
|
const debug = require('debug')('heroku-cli:file');
|
|
8
7
|
function exists(f) {
|
|
9
8
|
return deps_1.default.fs.pathExists(f);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
interface Telemetry {
|
|
3
|
+
command: string;
|
|
4
|
+
os: string;
|
|
5
|
+
version: string;
|
|
6
|
+
exitCode: number;
|
|
7
|
+
exitState: string[];
|
|
8
|
+
cliRunDuration: number;
|
|
9
|
+
commandRunDuration: number;
|
|
10
|
+
lifecycleHookCompletion: {
|
|
11
|
+
init: boolean;
|
|
12
|
+
prerun: boolean;
|
|
13
|
+
postrun: boolean;
|
|
14
|
+
command_not_found: boolean;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface TelemetryGlobal extends NodeJS.Global {
|
|
18
|
+
cliTelemetry?: Telemetry;
|
|
19
|
+
}
|
|
20
|
+
export declare function setupTelemetry(config: any, opts: any): {
|
|
21
|
+
command: any;
|
|
22
|
+
os: any;
|
|
23
|
+
version: any;
|
|
24
|
+
exitCode: number;
|
|
25
|
+
exitState: string[];
|
|
26
|
+
cliRunDuration: number;
|
|
27
|
+
commandRunDuration: number;
|
|
28
|
+
lifecycleHookCompletion: {
|
|
29
|
+
init: boolean;
|
|
30
|
+
prerun: boolean;
|
|
31
|
+
postrun: boolean;
|
|
32
|
+
command_not_found: boolean;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export declare function computeDuration(cmdStartTime: any): number;
|
|
36
|
+
export declare function reportCmdNotFound(config: any): {
|
|
37
|
+
command: string;
|
|
38
|
+
os: any;
|
|
39
|
+
version: any;
|
|
40
|
+
exitCode: number;
|
|
41
|
+
exitState: string[];
|
|
42
|
+
cliRunDuration: number;
|
|
43
|
+
commandRunDuration: number;
|
|
44
|
+
lifecycleHookCompletion: {
|
|
45
|
+
init: boolean;
|
|
46
|
+
prerun: boolean;
|
|
47
|
+
postrun: boolean;
|
|
48
|
+
command_not_found: boolean;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export declare function sendTelemetry(currentTelemetry: any): Promise<void>;
|
|
52
|
+
export declare function sendToRollbar(data: any): Promise<void>;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendToRollbar = exports.sendTelemetry = exports.reportCmdNotFound = exports.computeDuration = exports.setupTelemetry = void 0;
|
|
4
|
+
const Rollbar = require("rollbar");
|
|
5
|
+
require("dotenv/config");
|
|
6
|
+
const isDev = process.env.IS_DEV_ENVIRONMENT === 'true';
|
|
7
|
+
const debug = require('debug')('global_telemetry');
|
|
8
|
+
const rollbar = new Rollbar({
|
|
9
|
+
accessToken: '41f8730238814af69c248e2f7ca59ff2',
|
|
10
|
+
captureUncaught: true,
|
|
11
|
+
captureUnhandledRejections: true,
|
|
12
|
+
environment: isDev ? 'development' : 'production',
|
|
13
|
+
});
|
|
14
|
+
function setupTelemetry(config, opts) {
|
|
15
|
+
const now = new Date();
|
|
16
|
+
const cmdStartTime = now.getTime();
|
|
17
|
+
return {
|
|
18
|
+
command: opts.Command.id,
|
|
19
|
+
os: config.platform,
|
|
20
|
+
version: config.version,
|
|
21
|
+
exitCode: 0,
|
|
22
|
+
exitState: [''],
|
|
23
|
+
cliRunDuration: 0,
|
|
24
|
+
commandRunDuration: cmdStartTime,
|
|
25
|
+
lifecycleHookCompletion: {
|
|
26
|
+
init: true,
|
|
27
|
+
prerun: true,
|
|
28
|
+
postrun: false,
|
|
29
|
+
command_not_found: false,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
exports.setupTelemetry = setupTelemetry;
|
|
34
|
+
function computeDuration(cmdStartTime) {
|
|
35
|
+
// calculate time duration from start time till now
|
|
36
|
+
const now = new Date();
|
|
37
|
+
const cmdFinishTime = now.getTime();
|
|
38
|
+
return cmdFinishTime - cmdStartTime;
|
|
39
|
+
}
|
|
40
|
+
exports.computeDuration = computeDuration;
|
|
41
|
+
function reportCmdNotFound(config) {
|
|
42
|
+
return {
|
|
43
|
+
command: '',
|
|
44
|
+
os: config.platform,
|
|
45
|
+
version: config.version,
|
|
46
|
+
exitCode: 0,
|
|
47
|
+
exitState: ['command_not_found'],
|
|
48
|
+
cliRunDuration: 0,
|
|
49
|
+
commandRunDuration: 0,
|
|
50
|
+
lifecycleHookCompletion: {
|
|
51
|
+
init: true,
|
|
52
|
+
prerun: false,
|
|
53
|
+
postrun: false,
|
|
54
|
+
command_not_found: true,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
exports.reportCmdNotFound = reportCmdNotFound;
|
|
59
|
+
async function sendTelemetry(currentTelemetry) {
|
|
60
|
+
// send telemetry to honeycomb and rollbar
|
|
61
|
+
let telemetry = currentTelemetry;
|
|
62
|
+
if (telemetry instanceof Error) {
|
|
63
|
+
telemetry = { error_message: telemetry.message, error_stack: telemetry.stack };
|
|
64
|
+
telemetry.cliRunDuration = currentTelemetry.cliRunDuration;
|
|
65
|
+
await sendToRollbar(telemetry);
|
|
66
|
+
}
|
|
67
|
+
// add sendToHoneycomb function here
|
|
68
|
+
}
|
|
69
|
+
exports.sendTelemetry = sendTelemetry;
|
|
70
|
+
async function sendToRollbar(data) {
|
|
71
|
+
try {
|
|
72
|
+
// send data to rollbar
|
|
73
|
+
rollbar.error('Failed to complete execution', data, () => {
|
|
74
|
+
process.exit(1);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
catch (_a) {
|
|
78
|
+
debug('Could not send error report');
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.sendToRollbar = sendToRollbar;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const telemetry = require("../../global_telemetry");
|
|
4
|
+
const performance_analytics = async function () {
|
|
5
|
+
global.cliTelemetry = telemetry.reportCmdNotFound(this.config);
|
|
6
|
+
};
|
|
7
|
+
exports.default = performance_analytics;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkTos = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const core_1 = require("@oclif/core");
|
|
6
|
-
const path =
|
|
7
|
-
const fs =
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const fs = require("fs-extra");
|
|
8
7
|
function checkTos(options) {
|
|
9
8
|
const tosPath = path.join(options.config.cacheDir, 'terms-of-service');
|
|
10
9
|
const viewedBanner = fs.pathExistsSync(tosPath);
|
|
11
10
|
const message = 'Our terms of service have changed: https://dashboard.heroku.com/terms-of-service';
|
|
12
11
|
if (!viewedBanner) {
|
|
13
|
-
core_1.
|
|
12
|
+
core_1.ux.warn(message);
|
|
14
13
|
fs.createFile(tosPath);
|
|
15
14
|
}
|
|
16
15
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.version = void 0;
|
|
4
3
|
const allowlist = [
|
|
5
4
|
'HEROKU_API_KEY',
|
|
6
5
|
'HEROKU_APP',
|
|
@@ -21,4 +20,4 @@ const version = async function () {
|
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
};
|
|
24
|
-
exports.
|
|
23
|
+
exports.default = version;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const telemetry = require("../../global_telemetry");
|
|
4
|
+
const performance_analytics = async function () {
|
|
5
|
+
if (global.cliTelemetry) {
|
|
6
|
+
const cmdStartTime = global.cliTelemetry.commandRunDuration;
|
|
7
|
+
global.cliTelemetry.commandRunDuration = telemetry.computeDuration(cmdStartTime);
|
|
8
|
+
global.cliTelemetry.lifecycleHookCompletion.postrun = true;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
exports.default = performance_analytics;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const analytics_1 = tslib_1.__importDefault(require("../../analytics"));
|
|
3
|
+
const analytics_1 = require("../../analytics");
|
|
4
|
+
const telemetry = require("../../global_telemetry");
|
|
6
5
|
const analytics = async function (options) {
|
|
6
|
+
global.cliTelemetry = telemetry.setupTelemetry(this.config, options);
|
|
7
7
|
const analytics = new analytics_1.default(this.config);
|
|
8
8
|
await analytics.record(options);
|
|
9
9
|
};
|
|
10
|
-
exports.
|
|
10
|
+
exports.default = analytics;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("@heroku-cli/command");
|
|
4
|
+
const completions_1 = require("@heroku-cli/command/lib/completions");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const fs = require("fs-extra");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const cache_1 = require("../lib/autocomplete/cache");
|
|
9
|
+
const create_1 = require("../commands/autocomplete/create");
|
|
10
|
+
const completions = async function ({ type, app }) {
|
|
11
|
+
// autocomplete is now in core, skip windows
|
|
12
|
+
if (this.config.windows)
|
|
13
|
+
return;
|
|
14
|
+
const logInOut = type === 'login' || type === 'logout';
|
|
15
|
+
const completionsDir = path.join(this.config.cacheDir, 'autocomplete', 'completions');
|
|
16
|
+
const rm = () => fs.emptyDir(completionsDir);
|
|
17
|
+
const rmKey = (cacheKey) => fs.remove(path.join(completionsDir, cacheKey));
|
|
18
|
+
if (type === 'app')
|
|
19
|
+
return rmKey('app');
|
|
20
|
+
if (type === 'addon' && app)
|
|
21
|
+
return rmKey(`${app}_addons`);
|
|
22
|
+
if (type === 'config' && app)
|
|
23
|
+
return rmKey(`${app}_config_vars`);
|
|
24
|
+
if (logInOut)
|
|
25
|
+
return rm();
|
|
26
|
+
const update = async (completion, cacheKey) => {
|
|
27
|
+
const cachePath = path.join(completionsDir, cacheKey);
|
|
28
|
+
const options = await completion.options({ config: this.config });
|
|
29
|
+
await (0, cache_1.updateCache)(cachePath, options);
|
|
30
|
+
};
|
|
31
|
+
// if user is not logged in, exit
|
|
32
|
+
try {
|
|
33
|
+
const heroku = new command_1.APIClient(this.config);
|
|
34
|
+
if (!heroku.auth)
|
|
35
|
+
return;
|
|
36
|
+
await heroku.get('/account', { retryAuth: false });
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
this.debug(error.message);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
core_1.ux.action.start('Updating completions');
|
|
43
|
+
await rm();
|
|
44
|
+
await create_1.default.run([], this.config);
|
|
45
|
+
try {
|
|
46
|
+
await update(completions_1.AppCompletion, 'app');
|
|
47
|
+
await update(completions_1.PipelineCompletion, 'pipeline');
|
|
48
|
+
await update(completions_1.SpaceCompletion, 'space');
|
|
49
|
+
await update(completions_1.TeamCompletion, 'team');
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
this.debug(error.message);
|
|
53
|
+
}
|
|
54
|
+
core_1.ux.action.stop();
|
|
55
|
+
};
|
|
56
|
+
exports.default = completions;
|
package/lib/hooks/update/brew.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.brewHook = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
3
|
const child_process_1 = require("child_process");
|
|
6
|
-
const path =
|
|
7
|
-
const fs =
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs = require("../../file");
|
|
8
6
|
const debug = require('debug')('heroku:brewhook');
|
|
9
7
|
function brew(args, opts = {}) {
|
|
10
8
|
debug('brew %o', args);
|
|
@@ -45,4 +43,4 @@ const brewHook = async function () {
|
|
|
45
43
|
brew(['uninstall', 'heroku']);
|
|
46
44
|
brew(['install', 'heroku/brew/heroku']);
|
|
47
45
|
};
|
|
48
|
-
exports.
|
|
46
|
+
exports.default = brewHook;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const brewHook = async function () {
|
|
3
|
+
const doRecache = async function () {
|
|
5
4
|
// autocomplete is now in core, skip windows
|
|
6
5
|
if (this.config.windows)
|
|
7
6
|
return;
|
|
8
7
|
await this.config.runHook('recache', { type: 'update' });
|
|
9
8
|
};
|
|
10
|
-
exports.
|
|
9
|
+
exports.default = doRecache;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
6
|
-
const path = tslib_1.__importStar(require("path"));
|
|
3
|
+
const fs = require("fs-extra");
|
|
4
|
+
const path = require("path");
|
|
7
5
|
const exec = (cmd, args) => {
|
|
8
6
|
const execa = require('execa');
|
|
9
7
|
return execa(cmd, args, { stdio: 'inherit' });
|
|
@@ -57,4 +55,4 @@ const migrate = async function () {
|
|
|
57
55
|
await removeYarnLockFile();
|
|
58
56
|
await migrateV6Plugins();
|
|
59
57
|
};
|
|
60
|
-
exports.
|
|
58
|
+
exports.default = migrate;
|
package/lib/hooks/update/tidy.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const path = tslib_1.__importStar(require("path"));
|
|
6
|
-
const deps_1 = tslib_1.__importDefault(require("../../deps"));
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const deps_1 = require("../../deps");
|
|
7
5
|
const tidy = async function () {
|
|
8
6
|
const cleanupPlugins = async () => {
|
|
9
7
|
const pluginsDir = path.join(this.config.dataDir, 'plugins');
|
|
@@ -30,4 +28,4 @@ const tidy = async function () {
|
|
|
30
28
|
await cleanupPlugins();
|
|
31
29
|
}
|
|
32
30
|
};
|
|
33
|
-
exports.
|
|
31
|
+
exports.default = tidy;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.display = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const addSeconds = require("date-fns/add_seconds");
|
|
6
|
+
const distanceInWordsToNow = require("date-fns/distance_in_words_to_now");
|
|
7
|
+
function display(auth) {
|
|
8
|
+
const obj = {
|
|
9
|
+
ID: auth.id,
|
|
10
|
+
Description: auth.description,
|
|
11
|
+
Scope: auth.scope ? auth.scope.join(',') : undefined,
|
|
12
|
+
Client: '<none>',
|
|
13
|
+
};
|
|
14
|
+
if (auth.client) {
|
|
15
|
+
obj.Client = auth.client.name;
|
|
16
|
+
obj['Redirect URI'] = auth.client.redirect_uri;
|
|
17
|
+
}
|
|
18
|
+
if (auth.access_token) {
|
|
19
|
+
obj.Token = auth.access_token.token;
|
|
20
|
+
if (auth.updated_at) {
|
|
21
|
+
obj['Updated at'] = `${addSeconds(auth.updated_at, 0)} (${distanceInWordsToNow(auth.updated_at)} ago)`;
|
|
22
|
+
}
|
|
23
|
+
if (auth.access_token.expires_in) {
|
|
24
|
+
const date = addSeconds(new Date(), auth.access_token.expires_in);
|
|
25
|
+
obj['Expires at'] = `${date} (in ${distanceInWordsToNow(date)})`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
core_1.ux.styledObject(obj, [
|
|
29
|
+
'Client',
|
|
30
|
+
'Redirect URI',
|
|
31
|
+
'ID',
|
|
32
|
+
'Description',
|
|
33
|
+
'Scope',
|
|
34
|
+
'Token',
|
|
35
|
+
'Expires at',
|
|
36
|
+
'Updated at',
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
exports.display = display;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Command from '@heroku-cli/command';
|
|
2
|
+
import { Completion } from '@oclif/core/lib/interfaces/parser';
|
|
3
|
+
export declare abstract class AutocompleteBase extends Command {
|
|
4
|
+
errorIfWindows(): void;
|
|
5
|
+
errorIfNotSupportedShell(shell: string): void;
|
|
6
|
+
get autocompleteCacheDir(): string;
|
|
7
|
+
get completionsCacheDir(): string;
|
|
8
|
+
get acLogfilePath(): string;
|
|
9
|
+
writeLogFile(msg: string): void;
|
|
10
|
+
protected findCompletion(cmdId: string, name: string, description?: string): Completion | undefined;
|
|
11
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AutocompleteBase = void 0;
|
|
4
|
+
const command_1 = require("@heroku-cli/command");
|
|
5
|
+
const fs = require("fs-extra");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const completions_1 = require("./completions");
|
|
8
|
+
class AutocompleteBase extends command_1.default {
|
|
9
|
+
errorIfWindows() {
|
|
10
|
+
if (this.config.windows) {
|
|
11
|
+
throw new Error('Autocomplete is not currently supported in Windows');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
errorIfNotSupportedShell(shell) {
|
|
15
|
+
if (!shell) {
|
|
16
|
+
this.error('Missing required argument shell');
|
|
17
|
+
}
|
|
18
|
+
this.errorIfWindows();
|
|
19
|
+
if (!['bash', 'zsh'].includes(shell)) {
|
|
20
|
+
throw new Error(`${shell} is not a supported shell for autocomplete`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
get autocompleteCacheDir() {
|
|
24
|
+
return path.join(this.config.cacheDir, 'autocomplete');
|
|
25
|
+
}
|
|
26
|
+
get completionsCacheDir() {
|
|
27
|
+
return path.join(this.config.cacheDir, 'autocomplete', 'completions');
|
|
28
|
+
}
|
|
29
|
+
get acLogfilePath() {
|
|
30
|
+
return path.join(this.config.cacheDir, 'autocomplete.log');
|
|
31
|
+
}
|
|
32
|
+
writeLogFile(msg) {
|
|
33
|
+
const now = new Date();
|
|
34
|
+
const entry = `[${now}] ${msg}\n`;
|
|
35
|
+
const fd = fs.openSync(this.acLogfilePath, 'a');
|
|
36
|
+
// eslint-disable-next-line
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
fs.write(fd, entry);
|
|
39
|
+
}
|
|
40
|
+
findCompletion(cmdId, name, description = '') {
|
|
41
|
+
return new completions_1.CompletionLookup(cmdId, name, description).run();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.AutocompleteBase = AutocompleteBase;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchCache = exports.updateCache = void 0;
|
|
4
|
+
const fs = require("fs-extra");
|
|
5
|
+
async function updateCache(cachePath, cache) {
|
|
6
|
+
await fs.ensureFile(cachePath);
|
|
7
|
+
await fs.writeJSON(cachePath, cache);
|
|
8
|
+
}
|
|
9
|
+
exports.updateCache = updateCache;
|
|
10
|
+
function _mtime(f) {
|
|
11
|
+
return fs.statSync(f).mtime;
|
|
12
|
+
}
|
|
13
|
+
function _isStale(cachePath, cacheDuration) {
|
|
14
|
+
const past = new Date();
|
|
15
|
+
past.setSeconds(past.getSeconds() - cacheDuration);
|
|
16
|
+
return past.getTime() > _mtime(cachePath).getTime();
|
|
17
|
+
}
|
|
18
|
+
async function fetchCache(cachePath, cacheDuration, options) {
|
|
19
|
+
const cachePresent = fs.existsSync(cachePath);
|
|
20
|
+
if (cachePresent && !_isStale(cachePath, cacheDuration)) {
|
|
21
|
+
return fs.readJSON(cachePath);
|
|
22
|
+
}
|
|
23
|
+
const cache = await options.cacheFn();
|
|
24
|
+
// to-do: move this to a fork
|
|
25
|
+
await updateCache(cachePath, cache);
|
|
26
|
+
return cache;
|
|
27
|
+
}
|
|
28
|
+
exports.fetchCache = fetchCache;
|