@heroku/plugin-compute 0.4.0 → 0.4.2

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.
@@ -16,12 +16,15 @@
16
16
  import { Messages } from '@salesforce/core';
17
17
  import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
18
18
  import { requireAppName, resolveComputeAppNameFromDir, validateName } from '../../../shared/computeApp.js';
19
- import { fetchLogplexOutput } from '../../../shared/computeLogStream.js';
19
+ import { fetchLogplexOutput, LOGPLEX_FETCH_TIMEOUT_MS } from '../../../shared/computeLogStream.js';
20
20
  import { queryComputeApp, requireHerokuAppId, toComputeAppSummary } from '../../../shared/computeQuery.js';
21
21
  import { createComputeLogSessionViaProxy, fetchComputeAppViaProxy } from '../../../shared/herokuProxyApi.js';
22
22
  import { PLUGIN_NAME } from '../../../shared/plugin-name.js';
23
23
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
24
24
  const messages = Messages.loadMessages(PLUGIN_NAME, 'compute.get.runtime-log');
25
+ // How long a Fir log session may stay silent before the one-shot read treats the buffered output as
26
+ // complete. Long enough to cover session setup and the initial backfill, short enough to feel instant.
27
+ const FIR_IDLE_MS = 3000;
25
28
  // Drops the single trailing empty element split('\n') produces when the text ends in a newline,
26
29
  // without dropping genuine blank lines in the middle of the output.
27
30
  function splitLines(text) {
@@ -63,18 +66,23 @@ export default class RuntimeLog extends SfCommand {
63
66
  return { name };
64
67
  }
65
68
  const appId = requireHerokuAppId(record, name);
66
- // Fir apps keep no log history -- their session URL is a live stream that never closes -- so
67
- // fail fast before creating a session. The lookup is only a guard: if it fails, or the
68
- // generation is unknown, fall through to the Cedar path (the fetch timeout still bounds it) and
69
- // let session creation surface any real proxy failure.
69
+ // Fir apps keep no log history -- their session URL is a live stream that never closes -- so a
70
+ // one-shot read can't wait for EOF; it drains whatever is buffered and stops once the stream
71
+ // goes idle. The lookup only picks the read mode: if it fails, or the generation is unknown, fall
72
+ // through to the Cedar path (the fetch timeout still bounds it) and let session creation surface
73
+ // any real proxy failure -- but say so, since a Fir app read that way waits out the full timeout.
70
74
  const herokuApp = await fetchComputeAppViaProxy(connection, { appId, name }).catch(() => undefined);
71
- if (herokuApp?.generation === 'fir') {
72
- throw messages.createError('error.firNoLogHistory', [name]);
75
+ if (herokuApp?.generation === undefined) {
76
+ this.warn(messages.getMessage('warning.generationUnknown', [name]));
73
77
  }
74
- const session = await createComputeLogSessionViaProxy(connection, {
75
- name, appId, lines: num, tail: false,
76
- });
77
- const { output, timedOut } = await fetchLogplexOutput(session.logplexUrl);
78
+ const isFir = herokuApp?.generation === 'fir';
79
+ // Fir sessions take no line count or tail flag -- they are always a live stream.
80
+ const session = await createComputeLogSessionViaProxy(connection, isFir
81
+ ? { name, appId }
82
+ : {
83
+ name, appId, lines: num, tail: false,
84
+ });
85
+ const { output, timedOut } = await fetchLogplexOutput(session.logplexUrl, LOGPLEX_FETCH_TIMEOUT_MS, isFir ? { idleMs: FIR_IDLE_MS, sse: true } : {});
78
86
  const lines = splitLines(output);
79
87
  if (lines.length === 0) {
80
88
  this.info(messages.getMessage('info.noLogLines', [name]));
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-log.js","sourceRoot":"","sources":["../../../../src/commands/compute/get/runtime-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAC,cAAc,EAAE,4BAA4B,EAAE,YAAY,EAAC,MAAM,+BAA+B,CAAC;AACzG,OAAO,EAAC,kBAAkB,EAAC,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AACzG,OAAO,EAAC,+BAA+B,EAAE,uBAAuB,EAAC,MAAM,mCAAmC,CAAC;AAC3G,O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EAAE,KAAK,EAAC,CAAC;IACvB,CAAC"}
@@ -16,9 +16,10 @@
16
16
  import { Messages } from '@salesforce/core';
17
17
  import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
18
18
  import { requireAppName, resolveComputeAppNameFromDir, validateName } from '../../../shared/computeApp.js';
19
+ import { followFirLogSession } from '../../../shared/computeLogFollow.js';
19
20
  import { streamLogplexOutput } from '../../../shared/computeLogStream.js';
20
21
  import { queryComputeApp, requireHerokuAppId, toComputeAppSummary } from '../../../shared/computeQuery.js';
21
- import { createComputeLogSessionViaProxy } from '../../../shared/herokuProxyApi.js';
22
+ import { createComputeLogSessionViaProxy, fetchComputeAppViaProxy } from '../../../shared/herokuProxyApi.js';
22
23
  import { PLUGIN_NAME } from '../../../shared/plugin-name.js';
23
24
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
24
25
  const messages = Messages.loadMessages(PLUGIN_NAME, 'compute.tail.runtime-log');
@@ -57,9 +58,21 @@ export default class TailRuntimeLog extends SfCommand {
57
58
  return { name };
58
59
  }
59
60
  const appId = requireHerokuAppId(record, name);
60
- const session = await createComputeLogSessionViaProxy(connection, {
61
- name, appId, lines: num, tail: true,
62
- });
61
+ // Fir sessions are SSE streams with their own framing and a server-side lifetime. The lookup
62
+ // only picks the read mode: if it fails, fall back to the Cedar path and let session creation
63
+ // surface any real proxy failure -- but say so, since a Fir app read that way can show nothing.
64
+ const herokuApp = await fetchComputeAppViaProxy(connection, { appId, name }).catch(() => undefined);
65
+ if (herokuApp?.generation === undefined) {
66
+ this.warn(messages.getMessage('warning.generationUnknown', [name]));
67
+ }
68
+ const isFir = herokuApp?.generation === 'fir';
69
+ // Fir sessions take no line count or tail flag -- they are always a live stream.
70
+ const sessionParams = isFir
71
+ ? { name, appId }
72
+ : {
73
+ name, appId, lines: num, tail: true,
74
+ };
75
+ const session = await createComputeLogSessionViaProxy(connection, sessionParams);
63
76
  this.info(messages.getMessage('info.tailStarting', [name]));
64
77
  const controller = new AbortController();
65
78
  // SfCommand._run() registers SIGINT listeners that throw ExitError from inside the signal
@@ -73,11 +86,39 @@ export default class TailRuntimeLog extends SfCommand {
73
86
  controller.abort();
74
87
  });
75
88
  let wasAborted;
89
+ let lineCount = 0;
90
+ const onLine = (line) => {
91
+ lineCount++;
92
+ this.log(line);
93
+ };
76
94
  try {
77
- const reason = await streamLogplexOutput(session.logplexUrl, line => {
78
- this.log(line);
79
- }, controller.signal);
80
- wasAborted = reason === 'aborted';
95
+ if (isFir) {
96
+ const result = await followFirLogSession({
97
+ createSession: async () => createComputeLogSessionViaProxy(connection, sessionParams),
98
+ initialSession: session,
99
+ onLine,
100
+ onNotice: notice => {
101
+ if (notice.kind === 'retrying') {
102
+ this.info(messages.getMessage('info.tailRetrying', [
103
+ name, notice.reason, String(notice.delayMs / 1000), String(notice.attempt), String(notice.max),
104
+ ]));
105
+ }
106
+ else {
107
+ this.info(messages.getMessage(notice.kind === 'stalled' ? 'info.tailStalled' : 'info.tailReconnecting', [name]));
108
+ }
109
+ },
110
+ signal: controller.signal,
111
+ });
112
+ wasAborted = result === 'aborted';
113
+ }
114
+ else {
115
+ wasAborted = (await streamLogplexOutput(session.logplexUrl, onLine, controller.signal)) === 'aborted';
116
+ }
117
+ if (isFir && !wasAborted && lineCount === 0) {
118
+ // A session that closes without a single line is indistinguishable from "nothing happened"
119
+ // unless we say so -- surface it rather than exiting silently.
120
+ this.warn(messages.getMessage('warning.tailEndedWithoutOutput', [name]));
121
+ }
81
122
  this.info(wasAborted
82
123
  ? messages.getMessage('info.tailStopped', [name])
83
124
  : messages.getMessage('info.tailStreamEnded', [name]));
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-log.js","sourceRoot":"","sources":["../../../../src/commands/compute/tail/runtime-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,6BAA6B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,2FAA2F;gBAC3F,+DAA+D;gBAC/D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,gCAAgC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC3E,CAAC;YAED,IAAI,CAAC,IAAI,CACP,UAAU;gBACR,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC;gBACjD,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAC,IAAI,CAAC,CAAC,CACxD,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YACrC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBACjC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;QAED,8FAA8F;QAC9F,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC;QACzB,CAAC;QAED,OAAO,EAAC,IAAI,EAAC,CAAC;IAChB,CAAC"}
@@ -63,7 +63,7 @@ servers:
63
63
  # description: Successful response
64
64
  paths: {}
65
65
  `,
66
- 'src/routes/index.js': `export default async function (_fastify, _opts) {
66
+ 'src/routes/index.js': `export default async function (fastify, _opts) {
67
67
  // Add your routes here. Every route registered this way automatically gets
68
68
  // the Salesforce preHandler from ../plugins/heroku-applink.js, which
69
69
  // decodes the invoking org's context onto request.sdk. For example:
@@ -0,0 +1,32 @@
1
+ export declare const MIN_FIR_SESSION_MS = 5000;
2
+ export declare const FIR_STALL_MS: number;
3
+ export declare const MAX_CONSECUTIVE_FAILURES = 5;
4
+ export type FollowNotice = {
5
+ attempt: number;
6
+ delayMs: number;
7
+ kind: 'retrying';
8
+ max: number;
9
+ reason: string;
10
+ } | {
11
+ kind: 'expired';
12
+ } | {
13
+ kind: 'stalled';
14
+ };
15
+ export type FollowOptions = {
16
+ createSession: () => Promise<{
17
+ logplexUrl: string;
18
+ }>;
19
+ initialSession: {
20
+ logplexUrl: string;
21
+ };
22
+ maxFailures?: number;
23
+ minSessionMs?: number;
24
+ onLine: (line: string) => void;
25
+ onNotice: (notice: FollowNotice) => void;
26
+ signal: AbortSignal;
27
+ sleep?: (ms: number, signal: AbortSignal) => Promise<void>;
28
+ stallMs?: number;
29
+ };
30
+ export type FollowResult = 'aborted' | 'gave-up';
31
+ export declare function backoffMs(failures: number): number;
32
+ export declare function followFirLogSession(options: FollowOptions): Promise<FollowResult>;
@@ -0,0 +1,92 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { streamLogplexOutput } from './computeLogStream.js';
17
+ // A Fir session ends on its own: the server expires it (about 15 min), and a dropped connection or a
18
+ // silent half-open socket looks the same from here. Following means recreating the session each time,
19
+ // not treating the end as "done".
20
+ // A session that closes sooner than this was rejected or dropped, not expired, so it counts as a
21
+ // failure (with backoff) rather than a normal reconnect.
22
+ export const MIN_FIR_SESSION_MS = 5000;
23
+ // A stream silent this long without closing is treated as dead and recreated.
24
+ export const FIR_STALL_MS = 15 * 60_000;
25
+ // Consecutive failed sessions tolerated before giving up; any healthy session resets the count.
26
+ export const MAX_CONSECUTIVE_FAILURES = 5;
27
+ const BACKOFF_BASE_MS = 500;
28
+ const BACKOFF_MAX_MS = 5000;
29
+ export function backoffMs(failures) {
30
+ return Math.min(BACKOFF_BASE_MS * (2 ** (failures - 1)), BACKOFF_MAX_MS);
31
+ }
32
+ async function abortableSleep(ms, signal) {
33
+ return new Promise(resolve => {
34
+ const timer = setTimeout(done, ms);
35
+ function done() {
36
+ clearTimeout(timer);
37
+ signal.removeEventListener('abort', done);
38
+ resolve();
39
+ }
40
+ signal.addEventListener('abort', done, { once: true });
41
+ });
42
+ }
43
+ // Follows a Fir log session until the caller aborts or the sessions keep failing. Clean ends after a
44
+ // real run reconnect at once; early closes, creation failures and transport errors back off
45
+ // (500ms to 5s) and give up after `maxFailures` in a row, rethrowing the last error if there was one.
46
+ export async function followFirLogSession(options) {
47
+ const { createSession, maxFailures = MAX_CONSECUTIVE_FAILURES, minSessionMs = MIN_FIR_SESSION_MS, onLine, onNotice, signal, sleep = abortableSleep, stallMs = FIR_STALL_MS, } = options;
48
+ let session = options.initialSession;
49
+ let failures = 0;
50
+ while (!signal.aborted) {
51
+ let reason;
52
+ let error;
53
+ const startedAt = Date.now();
54
+ try {
55
+ // Session creation and reading share one failure budget, so a proxy outage backs off too.
56
+ // eslint-disable-next-line no-await-in-loop
57
+ session ??= await createSession();
58
+ // eslint-disable-next-line no-await-in-loop
59
+ reason = await streamLogplexOutput(session.logplexUrl, onLine, signal, { sse: true, stallMs });
60
+ }
61
+ catch (error_) {
62
+ error = error_;
63
+ }
64
+ if (reason === 'aborted' || signal.aborted) {
65
+ return 'aborted';
66
+ }
67
+ session = undefined;
68
+ const isRanLong = Date.now() - startedAt >= minSessionMs;
69
+ if (isRanLong) {
70
+ failures = 0;
71
+ if (reason !== undefined) {
72
+ onNotice({ kind: reason === 'stalled' ? 'stalled' : 'expired' });
73
+ continue;
74
+ }
75
+ }
76
+ failures++;
77
+ if (failures > maxFailures) {
78
+ if (error) {
79
+ throw error;
80
+ }
81
+ return 'gave-up';
82
+ }
83
+ const delayMs = backoffMs(failures);
84
+ onNotice({
85
+ attempt: failures, delayMs, kind: 'retrying', max: maxFailures, reason: error?.message ?? 'the session closed early',
86
+ });
87
+ // eslint-disable-next-line no-await-in-loop
88
+ await sleep(delayMs, signal);
89
+ }
90
+ return 'aborted';
91
+ }
92
+ //# sourceMappingURL=computeLogFollow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeLogFollow.js","sourceRoot":"","sources":["../../src/shared/computeLogFollow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAuB,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAEhF,qGAAqG;AACrG,sGAAsG;AACtG,kCAAkC;AAElC,iGAAiG;AACjG,yDAAyD;AACzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AACvC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,GAAG,MAAM,CAAC;AACxC,gGAAgG;AAChG,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAC1C,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,cAAc,GAAG,IAAI,CAAC;AAqB5B,MAAM,UAAU,SAAS,CAAC,QAAgB;IACxC,OAAO,IAAI,CAAC,GAAG,CAAC,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;AAC3E,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,EAAU,EAAE,MAAmB;IAC3D,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACnC,SAAS,IAAI;YACX,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC1C,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC;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,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAC,CAAC,CAAC;gBAC/D,SAAS;YACX,CAAC;QACH,CAAC;QAED,QAAQ,EAAE,CAAC;QACX,IAAI,QAAQ,GAAG,WAAW,EAAE,CAAC;YAC3B,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,KAAK,CAAC;YACd,CAAC;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;QACpC,QAAQ,CAAC;YACP,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,IAAI,0BAA0B;SACrH,CAAC,CAAC;QACH,4CAA4C;QAC5C,MAAM,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -3,7 +3,15 @@ export type LogplexSnapshot = {
3
3
  output: string;
4
4
  timedOut: boolean;
5
5
  };
6
- export declare function fetchLogplexOutput(logplexUrl: string, timeoutMs?: number): Promise<LogplexSnapshot>;
6
+ export type LogplexFetchOptions = {
7
+ idleMs?: number;
8
+ sse?: boolean;
9
+ };
10
+ export declare function fetchLogplexOutput(logplexUrl: string, timeoutMs?: number, options?: LogplexFetchOptions): Promise<LogplexSnapshot>;
7
11
  export declare function fetchBuildOutputStream(outputStreamUrl: string): Promise<string>;
8
- export type StreamEndReason = 'aborted' | 'eof';
9
- export declare function streamLogplexOutput(logplexUrl: string, onLine: (line: string) => void, signal?: AbortSignal): Promise<StreamEndReason>;
12
+ export type StreamEndReason = 'aborted' | 'eof' | 'stalled';
13
+ export type StreamLogplexOptions = Pick<LogplexFetchOptions, 'sse'> & {
14
+ onActivity?: () => void;
15
+ stallMs?: number;
16
+ };
17
+ export declare function streamLogplexOutput(logplexUrl: string, onLine: (line: string) => void, signal?: AbortSignal, options?: StreamLogplexOptions): Promise<StreamEndReason>;
@@ -24,21 +24,89 @@ const messages = Messages.loadMessages(PLUGIN_NAME, 'compute.errors');
24
24
  // Fir apps keep no log history, so their session URL streams and never closes; the timeout also
25
25
  // covers a Cedar logplex that stalls, so the one-shot fetch can never wait indefinitely.
26
26
  export const LOGPLEX_FETCH_TIMEOUT_MS = 30_000;
27
+ // Cedar requests stay byte-for-byte as before: the Accept header is only added when SSE is wanted.
28
+ function requestInit(signal, sse) {
29
+ return sse ? { headers: { Accept: 'text/event-stream' }, signal } : { signal };
30
+ }
31
+ // A server that ignores the Accept header answers text/plain, which the SSE splitter would turn into
32
+ // nothing at all -- so the response, not the request, decides how it is parsed.
33
+ function createSplitterFor(response, sse) {
34
+ if (!sse) {
35
+ return undefined;
36
+ }
37
+ const isSse = (response.headers.get('content-type') ?? '').toLowerCase().includes('text/event-stream');
38
+ return isSse ? createSseSplitter() : createNewlineSplitter();
39
+ }
40
+ function createNewlineSplitter() {
41
+ let buffer = '';
42
+ return {
43
+ flush() {
44
+ const rest = buffer;
45
+ buffer = '';
46
+ return rest.length > 0 ? [rest] : [];
47
+ },
48
+ push(chunk) {
49
+ const lines = (buffer + chunk).split('\n');
50
+ buffer = lines.pop() ?? '';
51
+ return lines;
52
+ },
53
+ };
54
+ }
55
+ // Events end at a blank line; an event's `data:` fields carry the record (id/comment/other fields
56
+ // are ignored). A trailing incomplete event is dropped, as the SSE spec does for a closed stream.
57
+ function createSseSplitter() {
58
+ let buffer = '';
59
+ return {
60
+ flush: () => [],
61
+ push(chunk) {
62
+ const events = (buffer + chunk).replaceAll('\r\n', '\n').split('\n\n');
63
+ buffer = events.pop() ?? '';
64
+ return events.flatMap(event => event
65
+ .split('\n')
66
+ .filter(field => field.startsWith('data:'))
67
+ .map(field => field.slice('data:'.length).replace(/^ /v, ''))
68
+ .join('\n')
69
+ .split(/\n+/v)
70
+ .filter(line => line.length > 0));
71
+ },
72
+ };
73
+ }
27
74
  // On timeout, returns the partial output if any arrived rather than discarding it; throws only
28
- // when nothing arrived before the deadline.
29
- export async function fetchLogplexOutput(logplexUrl, timeoutMs = LOGPLEX_FETCH_TIMEOUT_MS) {
30
- const signal = AbortSignal.timeout(timeoutMs);
75
+ // when nothing arrived before the deadline. With `idleMs`, an idle gap ends the read cleanly
76
+ // (including with no output at all) instead of counting as a timeout.
77
+ export async function fetchLogplexOutput(logplexUrl, timeoutMs = LOGPLEX_FETCH_TIMEOUT_MS, options = {}) {
78
+ const { idleMs, sse } = options;
79
+ const deadline = AbortSignal.timeout(timeoutMs);
80
+ const idle = new AbortController();
81
+ const signal = idleMs === undefined ? deadline : AbortSignal.any([deadline, idle.signal]);
82
+ let idleTimer;
83
+ const armIdleTimer = () => {
84
+ if (idleMs === undefined) {
85
+ return;
86
+ }
87
+ clearTimeout(idleTimer);
88
+ idleTimer = setTimeout(() => {
89
+ idle.abort();
90
+ }, idleMs);
91
+ };
92
+ let splitter;
93
+ const decoder = new TextDecoder();
94
+ const toOutput = (text) => splitter ? splitter.push(text).map(line => `${line}\n`).join('') : text;
95
+ const decode = (bytes) => toOutput(decoder.decode(bytes, { stream: bytes !== undefined }));
96
+ const finish = () => decode() + (splitter ? splitter.flush().map(line => `${line}\n`).join('') : '');
31
97
  let output = '';
32
98
  try {
33
- const response = await fetch(logplexUrl, { signal });
99
+ const response = await fetch(logplexUrl, requestInit(signal, sse));
34
100
  if (!response.ok) {
35
101
  throw new Error(`HTTP ${response.status}`);
36
102
  }
103
+ splitter = createSplitterFor(response, sse);
37
104
  if (!response.body) {
38
- return { output: await response.text(), timedOut: false };
105
+ return { output: toOutput(await response.text()), timedOut: false };
39
106
  }
107
+ // Armed only once connected, so "idle" means connected-but-silent, not slow to connect.
108
+ armIdleTimer();
40
109
  const reader = response.body.getReader();
41
- const decoder = new TextDecoder();
42
110
  while (true) {
43
111
  // Sequential reads of one ordered stream -- there's nothing to parallelize.
44
112
  // eslint-disable-next-line no-await-in-loop
@@ -46,11 +114,15 @@ export async function fetchLogplexOutput(logplexUrl, timeoutMs = LOGPLEX_FETCH_T
46
114
  if (done) {
47
115
  break;
48
116
  }
49
- output += decoder.decode(value, { stream: true });
117
+ armIdleTimer();
118
+ output += decode(value);
50
119
  }
51
- return { output: output + decoder.decode(), timedOut: false };
120
+ return { output: output + finish(), timedOut: false };
52
121
  }
53
122
  catch (error) {
123
+ if (idle.signal.aborted && !deadline.aborted) {
124
+ return { output: output + finish(), timedOut: false };
125
+ }
54
126
  if (signal.aborted) {
55
127
  if (output.length > 0) {
56
128
  return { output, timedOut: true };
@@ -59,6 +131,9 @@ export async function fetchLogplexOutput(logplexUrl, timeoutMs = LOGPLEX_FETCH_T
59
131
  }
60
132
  throw messages.createError('error.logStreamFailed', [error.message]);
61
133
  }
134
+ finally {
135
+ clearTimeout(idleTimer);
136
+ }
62
137
  }
63
138
  // Bounded one-shot fetch, not a stream -- `get build-log` prints one finished-or-in-progress
64
139
  // build's log, unlike `tail runtime-log`'s ongoing runtime stream. Explicit Accept: output_stream_url
@@ -75,19 +150,47 @@ export async function fetchBuildOutputStream(outputStreamUrl) {
75
150
  throw messages.createError('error.buildOutputFetchFailed', [error.message]);
76
151
  }
77
152
  }
78
- // Reports whether the stream ended because the server closed it (EOF) or because the caller's
79
- // AbortSignal fired, rather than leaving the caller to re-derive that from signal.aborted after
80
- // the fact -- ambient signal state can flip between a natural EOF and a same-instant abort,
81
- // misattributing one for the other.
82
- export async function streamLogplexOutput(logplexUrl, onLine, signal) {
83
- let response;
153
+ // Reports whether the stream ended because the server closed it (EOF), because it went silent
154
+ // (stalled), or because the caller's AbortSignal fired, rather than leaving the caller to
155
+ // re-derive that from signal.aborted after the fact -- ambient signal state can flip between a
156
+ // natural EOF and a same-instant abort, misattributing one for the other.
157
+ export async function streamLogplexOutput(logplexUrl, onLine, signal, options = {}) {
158
+ const stall = new AbortController();
159
+ const requestSignal = signal ? AbortSignal.any([signal, stall.signal]) : stall.signal;
160
+ let stallTimer;
161
+ const armStallTimer = () => {
162
+ if (options.stallMs === undefined) {
163
+ return;
164
+ }
165
+ clearTimeout(stallTimer);
166
+ stallTimer = setTimeout(() => {
167
+ stall.abort();
168
+ }, options.stallMs);
169
+ };
84
170
  try {
85
- response = await fetch(logplexUrl, { signal });
171
+ return await readLogplexStream(logplexUrl, onLine, signal, requestSignal, stall, armStallTimer, options);
86
172
  }
87
- catch (error) {
173
+ finally {
174
+ clearTimeout(stallTimer);
175
+ }
176
+ }
177
+ async function readLogplexStream(logplexUrl, onLine, signal, requestSignal, stall, armStallTimer, options) {
178
+ // An abort is either the caller's (stop) or the stall timer's (recreate); anything else is a failure.
179
+ const endedByAbort = () => {
88
180
  if (signal?.aborted) {
89
181
  return 'aborted';
90
182
  }
183
+ return stall.signal.aborted ? 'stalled' : undefined;
184
+ };
185
+ let response;
186
+ try {
187
+ response = await fetch(logplexUrl, requestInit(requestSignal, options.sse));
188
+ }
189
+ catch (error) {
190
+ const ended = endedByAbort();
191
+ if (ended) {
192
+ return ended;
193
+ }
91
194
  throw messages.createError('error.logStreamFailed', [error.message]);
92
195
  }
93
196
  if (!response.ok) {
@@ -101,7 +204,8 @@ export async function streamLogplexOutput(logplexUrl, onLine, signal) {
101
204
  // actually returns.
102
205
  const reader = response.body.getReader();
103
206
  const decoder = new TextDecoder();
104
- let buffer = '';
207
+ const splitter = createSplitterFor(response, options.sse) ?? createNewlineSplitter();
208
+ armStallTimer();
105
209
  try {
106
210
  while (true) {
107
211
  // Sequential reads of one ordered stream -- there's nothing to parallelize.
@@ -110,25 +214,25 @@ export async function streamLogplexOutput(logplexUrl, onLine, signal) {
110
214
  if (done) {
111
215
  break;
112
216
  }
113
- buffer += decoder.decode(value, { stream: true });
114
- const lines = buffer.split('\n');
115
- buffer = lines.pop() ?? '';
116
- for (const line of lines) {
217
+ armStallTimer();
218
+ options.onActivity?.();
219
+ for (const line of splitter.push(decoder.decode(value, { stream: true }))) {
117
220
  onLine(line);
118
221
  }
119
222
  }
120
223
  }
121
224
  catch (error) {
122
- if (signal?.aborted) {
123
- return 'aborted';
225
+ const ended = endedByAbort();
226
+ if (ended) {
227
+ return ended;
124
228
  }
125
229
  throw messages.createError('error.logStreamFailed', [error.message]);
126
230
  }
127
231
  // Reaching here means reader.read() resolved with done:true, i.e. a genuine server-side close
128
232
  // -- not an abort artifact (an aborted fetch rejects the read instead), so this is unambiguously
129
233
  // EOF even if the signal happens to fire in the same tick.
130
- if (buffer.length > 0) {
131
- onLine(buffer);
234
+ for (const line of splitter.flush()) {
235
+ onLine(line);
132
236
  }
133
237
  return 'eof';
134
238
  }
@@ -1 +1 @@
1
- {"version":3,"file":"computeLogStream.js","sourceRoot":"","sources":["../../src/shared/computeLogStream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AAEtE,iGAAiG;AACjG,+FAA+F;AAC/F,0FAA0F;AAC1F,qFAAqF;AAErF,gGAAgG;AAChG,yFAAyF;AACzF,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAQ/C,+FAA+F;AAC/F,4CAA4C;AAC5C,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,UAAkB,EAClB,YAAoB,wBAAwB;IAE5C,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,EAAC,MAAM,EAAC,CAAC,CAAC;QACnD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,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I,EAAE,CAAC;YACZ,4EAA4E;YAC5E,4CAA4C;YAC5C,MAAM,EAAC,IAAI,EAAE,KAAK,EAAC,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAC1C,IAAI,IAAI,EAAE,CAAC;gBACT,MAAM;YACR,CAAC;YAED,aAAa,EAAE,CAAC;YAChB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;YACvB,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC,EAAE,CAAC;gBACxE,MAAM,CAAC,IAAI,CAAC,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;QAC7B,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,QAAQ,CAAC,WAAW,CAAC,uBAAuB,EAAE,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,8FAA8F;IAC9F,iGAAiG;IACjG,2DAA2D;IAC3D,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;QACpC,MAAM,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -12,8 +12,10 @@ This prints the most recent log lines and exits. To keep the session open and
12
12
  stream new lines as they arrive, use compute tail runtime-log.
13
13
 
14
14
  The recent lines come from the Cedar log buffer (about 1500 lines at most), so
15
- --num can't return more than that. Fir apps keep no log history, so this
16
- command isn't supported for them; use compute tail runtime-log instead. The
15
+ --num can't return more than that. Fir apps keep no log history, so for them
16
+ the command reads the live log session instead and stops once it goes quiet
17
+ for a few seconds; it can only show output the session delivers in that
18
+ window, so --num doesn't apply; use compute tail runtime-log to follow a Fir app's log. The
17
19
  command stops waiting after 30 seconds and prints whatever log lines it has
18
20
  received by then; if none arrived, it fails with a timeout error.
19
21
 
@@ -33,14 +35,9 @@ directory's app name if that isn't set either.
33
35
 
34
36
  Number of recent log lines to print.
35
37
 
36
- # error.firNoLogHistory
38
+ # warning.generationUnknown
37
39
 
38
- Fir apps keep no log history, so there is no recent log to fetch for %s.
39
-
40
- # error.firNoLogHistory.actions
41
-
42
- - Run sf compute tail runtime-log to watch the live log instead.
43
- - To learn how Fir differs from Cedar, see https://devcenter.heroku.com/articles/generations.
40
+ Couldn't tell whether %s is a Fir or Cedar app, so it's being read as a Cedar app. If it's a Fir app, its log output may be missing or delayed; run the command again.
44
41
 
45
42
  # warning.logFetchPartial
46
43
 
@@ -44,6 +44,26 @@ Stopped tailing %s.
44
44
 
45
45
  The log session for %s ended.
46
46
 
47
+ # info.tailReconnecting
48
+
49
+ The log session for %s expired; reconnecting.
50
+
51
+ # info.tailStalled
52
+
53
+ The log session for %s went quiet; reconnecting.
54
+
55
+ # info.tailRetrying
56
+
57
+ Lost the log session for %s (%s). Retrying in %s s (attempt %s of %s).
58
+
59
+ # warning.generationUnknown
60
+
61
+ Couldn't tell whether %s is a Fir or Cedar app, so it's being read as a Cedar app. If it's a Fir app, its log output may be missing or delayed; run the command again.
62
+
63
+ # warning.tailEndedWithoutOutput
64
+
65
+ The log session for %s closed without sending any log lines. The app may have produced no output yet; run the command again, or check that the app is running.
66
+
47
67
  # examples
48
68
 
49
69
  - Tail the log until stopped with Ctrl-C:
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@heroku/plugin-compute",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@heroku/plugin-compute",
9
- "version": "0.4.0",
9
+ "version": "0.4.2",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@oclif/core": "^4",
@@ -15,7 +15,7 @@
15
15
  "@salesforce/sf-plugins-core": "^12",
16
16
  "@salesforce/source-deploy-retrieve": "^12.37.2",
17
17
  "form-data": "^4.0.6",
18
- "ignore": "^7.0.8",
18
+ "ignore": "^7.0.13",
19
19
  "jszip": "^3.10.1",
20
20
  "openapi-fetch": "^0.17.0",
21
21
  "tar-stream": "^3.2.1"
@@ -9476,9 +9476,9 @@
9476
9476
  "license": "BSD-3-Clause"
9477
9477
  },
9478
9478
  "node_modules/ignore": {
9479
- "version": "7.0.12",
9480
- "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.12.tgz",
9481
- "integrity": "sha512-/8UvqAPU9DGTI9k4mxtf49U37Isfwr8Uts96+SBHIkFxPJnHS0Ew4f00sM4Scd8V8EjM0jUNtVDdv1kPdt35lg==",
9479
+ "version": "7.0.13",
9480
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.13.tgz",
9481
+ "integrity": "sha512-2E8Q6rh+1RRSq/YdaGsNfXsEZy9FVqv6BSSrkmZJP7BnaoPnRfKL+YaofPvP+5rzdk144qSm6i4+hvPgUcbV4Q==",
9482
9482
  "license": "MIT",
9483
9483
  "engines": {
9484
9484
  "node": ">= 4"
@@ -827,7 +827,7 @@
827
827
  "compute:get:runtime-log": {
828
828
  "aliases": [],
829
829
  "args": {},
830
- "description": "Fetches a compute app's runtime log -- the app's ongoing output (request\nhandling, application logs), not the build/compile log; use compute get\nbuild-log for that.\n\nThis prints the most recent log lines and exits. To keep the session open and\nstream new lines as they arrive, use compute tail runtime-log.\n\nThe recent lines come from the Cedar log buffer (about 1500 lines at most), so\n--num can't return more than that. Fir apps keep no log history, so this\ncommand isn't supported for them; use compute tail runtime-log instead. The\ncommand stops waiting after 30 seconds and prints whatever log lines it has\nreceived by then; if none arrived, it fails with a timeout error.\n\nThis is an org-mediated operation by --name (the app's DeveloperName) -- the\norg creates a log session with Heroku on your behalf and hands back a\nshort-lived, pre-authorized URL that the CLI reads from directly. It doesn't\nread from or require a local Salesforce DX project.",
830
+ "description": "Fetches a compute app's runtime log -- the app's ongoing output (request\nhandling, application logs), not the build/compile log; use compute get\nbuild-log for that.\n\nThis prints the most recent log lines and exits. To keep the session open and\nstream new lines as they arrive, use compute tail runtime-log.\n\nThe recent lines come from the Cedar log buffer (about 1500 lines at most), so\n--num can't return more than that. Fir apps keep no log history, so for them\nthe command reads the live log session instead and stops once it goes quiet\nfor a few seconds; it can only show output the session delivers in that\nwindow, so --num doesn't apply; use compute tail runtime-log to follow a Fir app's log. The\ncommand stops waiting after 30 seconds and prints whatever log lines it has\nreceived by then; if none arrived, it fails with a timeout error.\n\nThis is an org-mediated operation by --name (the app's DeveloperName) -- the\norg creates a log session with Heroku on your behalf and hands back a\nshort-lived, pre-authorized URL that the CLI reads from directly. It doesn't\nread from or require a local Salesforce DX project.",
831
831
  "examples": [
832
832
  "Print the most recent log lines:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --target-org my-org",
833
833
  "Print the most recent 500 log lines:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --num 500 --target-org my-org"
@@ -1070,19 +1070,12 @@
1070
1070
  "telemetry-drain:list:compute"
1071
1071
  ]
1072
1072
  },
1073
- "compute:set:config": {
1073
+ "compute:source:retrieve": {
1074
1074
  "aliases": [],
1075
- "args": {
1076
- "pair": {
1077
- "multiple": true,
1078
- "name": "pair"
1079
- }
1080
- },
1081
- "deprecateAliases": true,
1082
- "description": "Goes through the target org's Salesforce Connect API, which calls Heroku on\nyour behalf. Setting a config var restarts the app's dynos so the new value\ntakes effect. Pass one or more KEY=VALUE pairs; a key that doesn't already\nexist is created.",
1075
+ "args": {},
1076
+ "description": "Creates the compute app's directory under force-app/main/default/computeApps/<name>/\n(or --output-dir), retrieves its <name>.computeApp-meta.xml through the Metadata\nAPI, then downloads its source code through the Connect API and extracts it\ninto that same directory. Deploy it with project deploy start.",
1083
1077
  "examples": [
1084
- "Set a single config var:\n<%= config.bin %> <%= command.id %> STRIPE_KEY=sk_live_xyz789 --name CreditRatingScorer --target-org my-org",
1085
- "Set more than one config var in one command:\n<%= config.bin %> <%= command.id %> STRIPE_KEY=sk_live_xyz789 LOG_LEVEL=debug --name CreditRatingScorer --target-org my-org"
1078
+ "Retrieve a compute app's source and metadata from an org:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --target-org my-org"
1086
1079
  ],
1087
1080
  "flags": {
1088
1081
  "json": {
@@ -1102,9 +1095,9 @@
1102
1095
  },
1103
1096
  "name": {
1104
1097
  "char": "n",
1105
- "env": "COMPUTE_APP_NAME",
1106
1098
  "name": "name",
1107
- "summary": "DeveloperName of the compute app to change config for (or\n<namespace>\\_\\_<developerName> if it was deployed under a namespace).\nDefaults to the COMPUTE_APP_NAME environment variable, or the current\ndirectory's app name if that isn't set either.",
1099
+ "required": true,
1100
+ "summary": "DeveloperName of the compute app to retrieve (or <namespace>\\_\\_<developerName>\nif it was deployed under a namespace).",
1108
1101
  "hasDynamicHelp": false,
1109
1102
  "multiple": false,
1110
1103
  "type": "option"
@@ -1125,44 +1118,59 @@
1125
1118
  "hasDynamicHelp": false,
1126
1119
  "multiple": false,
1127
1120
  "type": "option"
1121
+ },
1122
+ "output-dir": {
1123
+ "char": "d",
1124
+ "description": "Defaults to force-app/main/default/computeApps. The app itself is created in a\nsubdirectory named after --name.",
1125
+ "name": "output-dir",
1126
+ "summary": "Directory to create the app in.",
1127
+ "default": "force-app/main/default/computeApps",
1128
+ "hasDynamicHelp": false,
1129
+ "multiple": false,
1130
+ "type": "option"
1128
1131
  }
1129
1132
  },
1130
1133
  "hasDynamicHelp": true,
1131
- "hiddenAliases": [
1132
- "compute:config:set"
1133
- ],
1134
- "id": "compute:set:config",
1134
+ "hiddenAliases": [],
1135
+ "id": "compute:source:retrieve",
1135
1136
  "pluginAlias": "@heroku/plugin-compute",
1136
1137
  "pluginName": "@heroku/plugin-compute",
1137
1138
  "pluginType": "core",
1138
1139
  "strict": true,
1139
- "summary": "Set one or more of a compute app's config vars.",
1140
+ "summary": "Retrieve a compute app's source and metadata from an org into your local Salesforce DX project.",
1140
1141
  "enableJsonFlag": true,
1141
- "requiresProject": false,
1142
+ "requiresProject": true,
1142
1143
  "isESM": true,
1143
1144
  "relativePath": [
1144
1145
  "dist",
1145
1146
  "commands",
1146
1147
  "compute",
1147
- "set",
1148
- "config.js"
1148
+ "source",
1149
+ "retrieve.js"
1149
1150
  ],
1150
1151
  "aliasPermutations": [],
1151
1152
  "permutations": [
1152
- "compute:set:config",
1153
- "set:compute:config",
1154
- "set:config:compute",
1155
- "compute:config:set",
1156
- "config:compute:set",
1157
- "config:set:compute"
1153
+ "compute:source:retrieve",
1154
+ "source:compute:retrieve",
1155
+ "source:retrieve:compute",
1156
+ "compute:retrieve:source",
1157
+ "retrieve:compute:source",
1158
+ "retrieve:source:compute"
1158
1159
  ]
1159
1160
  },
1160
- "compute:source:retrieve": {
1161
+ "compute:set:config": {
1161
1162
  "aliases": [],
1162
- "args": {},
1163
- "description": "Creates the compute app's directory under force-app/main/default/computeApps/<name>/\n(or --output-dir), retrieves its <name>.computeApp-meta.xml through the Metadata\nAPI, then downloads its source code through the Connect API and extracts it\ninto that same directory. Deploy it with project deploy start.",
1163
+ "args": {
1164
+ "pair": {
1165
+ "multiple": true,
1166
+ "name": "pair"
1167
+ }
1168
+ },
1169
+ "deprecateAliases": true,
1170
+ "description": "Goes through the target org's Salesforce Connect API, which calls Heroku on\nyour behalf. Setting a config var restarts the app's dynos so the new value\ntakes effect. Pass one or more KEY=VALUE pairs; a key that doesn't already\nexist is created.",
1164
1171
  "examples": [
1165
- "Retrieve a compute app's source and metadata from an org:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --target-org my-org"
1172
+ "Set a single config var:\n<%= config.bin %> <%= command.id %> STRIPE_KEY=sk_live_xyz789 --name CreditRatingScorer --target-org my-org",
1173
+ "Set more than one config var in one command:\n<%= config.bin %> <%= command.id %> STRIPE_KEY=sk_live_xyz789 LOG_LEVEL=debug --name CreditRatingScorer --target-org my-org"
1166
1174
  ],
1167
1175
  "flags": {
1168
1176
  "json": {
@@ -1182,9 +1190,9 @@
1182
1190
  },
1183
1191
  "name": {
1184
1192
  "char": "n",
1193
+ "env": "COMPUTE_APP_NAME",
1185
1194
  "name": "name",
1186
- "required": true,
1187
- "summary": "DeveloperName of the compute app to retrieve (or <namespace>\\_\\_<developerName>\nif it was deployed under a namespace).",
1195
+ "summary": "DeveloperName of the compute app to change config for (or\n<namespace>\\_\\_<developerName> if it was deployed under a namespace).\nDefaults to the COMPUTE_APP_NAME environment variable, or the current\ndirectory's app name if that isn't set either.",
1188
1196
  "hasDynamicHelp": false,
1189
1197
  "multiple": false,
1190
1198
  "type": "option"
@@ -1205,44 +1213,36 @@
1205
1213
  "hasDynamicHelp": false,
1206
1214
  "multiple": false,
1207
1215
  "type": "option"
1208
- },
1209
- "output-dir": {
1210
- "char": "d",
1211
- "description": "Defaults to force-app/main/default/computeApps. The app itself is created in a\nsubdirectory named after --name.",
1212
- "name": "output-dir",
1213
- "summary": "Directory to create the app in.",
1214
- "default": "force-app/main/default/computeApps",
1215
- "hasDynamicHelp": false,
1216
- "multiple": false,
1217
- "type": "option"
1218
1216
  }
1219
1217
  },
1220
1218
  "hasDynamicHelp": true,
1221
- "hiddenAliases": [],
1222
- "id": "compute:source:retrieve",
1219
+ "hiddenAliases": [
1220
+ "compute:config:set"
1221
+ ],
1222
+ "id": "compute:set:config",
1223
1223
  "pluginAlias": "@heroku/plugin-compute",
1224
1224
  "pluginName": "@heroku/plugin-compute",
1225
1225
  "pluginType": "core",
1226
1226
  "strict": true,
1227
- "summary": "Retrieve a compute app's source and metadata from an org into your local Salesforce DX project.",
1227
+ "summary": "Set one or more of a compute app's config vars.",
1228
1228
  "enableJsonFlag": true,
1229
- "requiresProject": true,
1229
+ "requiresProject": false,
1230
1230
  "isESM": true,
1231
1231
  "relativePath": [
1232
1232
  "dist",
1233
1233
  "commands",
1234
1234
  "compute",
1235
- "source",
1236
- "retrieve.js"
1235
+ "set",
1236
+ "config.js"
1237
1237
  ],
1238
1238
  "aliasPermutations": [],
1239
1239
  "permutations": [
1240
- "compute:source:retrieve",
1241
- "source:compute:retrieve",
1242
- "source:retrieve:compute",
1243
- "compute:retrieve:source",
1244
- "retrieve:compute:source",
1245
- "retrieve:source:compute"
1240
+ "compute:set:config",
1241
+ "set:compute:config",
1242
+ "set:config:compute",
1243
+ "compute:config:set",
1244
+ "config:compute:set",
1245
+ "config:set:compute"
1246
1246
  ]
1247
1247
  },
1248
1248
  "compute:tail:runtime-log": {
@@ -1517,5 +1517,5 @@
1517
1517
  ]
1518
1518
  }
1519
1519
  },
1520
- "version": "0.4.0"
1520
+ "version": "0.4.2"
1521
1521
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@heroku/plugin-compute",
3
3
  "description": "CLI for Compute",
4
- "version": "0.4.0",
4
+ "version": "0.4.2",
5
5
  "author": "Heroku",
6
6
  "bugs": "https://github.com/heroku/plugin-compute/issues",
7
7
  "dependencies": {
@@ -11,7 +11,7 @@
11
11
  "@salesforce/sf-plugins-core": "^12",
12
12
  "@salesforce/source-deploy-retrieve": "^12.37.2",
13
13
  "form-data": "^4.0.6",
14
- "ignore": "^7.0.8",
14
+ "ignore": "^7.0.13",
15
15
  "jszip": "^3.10.1",
16
16
  "openapi-fetch": "^0.17.0",
17
17
  "tar-stream": "^3.2.1"