@heroku/plugin-compute 0.4.3 → 0.4.4

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.
@@ -15,8 +15,10 @@
15
15
  */
16
16
  import { Messages } from '@salesforce/core';
17
17
  import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
18
+ import { mkdir, rm, writeFile } from 'node:fs/promises';
19
+ import { dirname, join } from 'node:path';
18
20
  import { pathExists, resolveAppDir, validateName } from '../../../shared/computeApp.js';
19
- import { unpackComputeBundle } from '../../../shared/computeBundle.js';
21
+ import { decodeComputeBundle, writeBundleFiles } from '../../../shared/computeBundle.js';
20
22
  import { downloadComputeSource } from '../../../shared/computeConnectApi.js';
21
23
  import { retrieveComputeMetadata } from '../../../shared/metadataRetrieve.js';
22
24
  import { PLUGIN_NAME } from '../../../shared/plugin-name.js';
@@ -53,18 +55,43 @@ export default class Retrieve extends SfCommand {
53
55
  const connection = flags['target-org'].getConnection(flags['api-version']);
54
56
  const username = connection.getUsername() ?? flags['target-org'].getUsername() ?? '<org>';
55
57
  this.log(messages.getMessage('info.retrieving', [name, username]));
56
- // No rollback on failure below -- if the source download fails, appDir is left in place,
57
- // partially populated, same as generate.ts/deploy.ts's own "no automatic rollback" style
58
- // elsewhere in this plugin. A retry after a failure here will need the directory removed
59
- // first, since it now exists and would otherwise hit error.appAlreadyExists.
60
- await retrieveComputeMetadata(connection, appDir, name);
61
- this.log(messages.getMessage('info.retrievedMetadata', [`${name}.computeApp-meta.xml`]));
58
+ // Finish every network call before touching disk (as generate.ts does), so a failed retrieve
59
+ // or download leaves nothing behind for a retry to trip over.
60
+ const metadata = await retrieveComputeMetadata(connection, name);
61
+ this.log(messages.getMessage('info.retrievedMetadata', [metadata.fileName]));
62
62
  this.log(messages.getMessage('info.downloadingSource'));
63
63
  const bundle = await downloadComputeSource(connection, { appIdOrName: name });
64
- const { fileCount } = await unpackComputeBundle(bundle, appDir);
65
- this.log(messages.getMessage('info.extractedSource', [fileCount]));
64
+ // Check the archive and every entry path now, so a bad bundle fails before anything touches
65
+ // disk and the cleanup below only has to cover real I/O failures (ENOSPC, EACCES, ...).
66
+ const files = await decodeComputeBundle(bundle, appDir);
67
+ // The existence check above ran before two slow network calls, so claim appDir itself with a
68
+ // non-recursive mkdir: it throws EEXIST if the folder appeared in the meantime. That makes
69
+ // the cleanup below safe -- it only ever removes a folder this run created.
70
+ await mkdir(dirname(appDir), { recursive: true });
71
+ try {
72
+ await mkdir(appDir);
73
+ }
74
+ catch (error) {
75
+ if (error.code === 'EEXIST') {
76
+ throw messages.createError('error.appAlreadyExists', [name, appDir]);
77
+ }
78
+ throw error;
79
+ }
80
+ try {
81
+ await writeFile(join(appDir, metadata.fileName), metadata.contents);
82
+ await writeBundleFiles(files);
83
+ }
84
+ catch (error) {
85
+ // Remove the half-written folder so a retry isn't blocked by error.appAlreadyExists. A
86
+ // failed cleanup must not replace the error that caused it, so warn and rethrow the original.
87
+ await rm(appDir, { force: true, recursive: true }).catch((rmError) => {
88
+ this.warn(messages.getMessage('warning.cleanupFailed', [appDir, String(rmError)]));
89
+ });
90
+ throw error;
91
+ }
92
+ this.log(messages.getMessage('info.extractedSource', [files.length]));
66
93
  this.logSuccess(messages.getMessage('info.done', [name, appDir]));
67
- return { name, path: appDir, files: fileCount };
94
+ return { name, path: appDir, files: files.length };
68
95
  }
69
96
  }
70
97
  //# sourceMappingURL=retrieve.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"retrieve.js","sourceRoot":"","sources":["../../../../src/commands/compute/source/retrieve.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,UAAU,EAAE,aAAa,EAAE,YAAY,EAAC,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAC,mBAAmB,EAAC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C,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;YACvE,CAAC;YAED,MAAM,KAAK,CAAC;QACd,CAAC;QAED,IAAI,CAAC;YACH,MAAM,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACpE,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,uFAAuF;YACvF,8FAA8F;YAC9F,MAAM,EAAE,CAAC,MAAM,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAgB,EAAE,EAAE;gBAC1E,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,uBAAuB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YACrF,CAAC,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAEtE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QAElE,OAAO,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAC,CAAC;IACnD,CAAC"}
@@ -6,4 +6,10 @@ export declare function packageComputeBundle(appDir: string, name: string, proje
6
6
  export type UnpackedBundle = {
7
7
  fileCount: number;
8
8
  };
9
+ export type BundleFile = {
10
+ data: Buffer;
11
+ filePath: string;
12
+ };
13
+ export declare function decodeComputeBundle(buffer: Buffer, appDir: string): Promise<BundleFile[]>;
14
+ export declare function writeBundleFiles(files: readonly BundleFile[]): Promise<void>;
9
15
  export declare function unpackComputeBundle(buffer: Buffer, appDir: string): Promise<UnpackedBundle>;
@@ -60,12 +60,13 @@ export async function packageComputeBundle(appDir, name, projectRoot) {
60
60
  debug('packaged %s into %d bytes (%d files)', appDir, buffer.length, sourceEntries.length);
61
61
  return { buffer, fileCount: sourceEntries.length };
62
62
  }
63
- // Writes every file in the downloaded source.tar.gz into appDir. The download endpoint returns
64
- // that inner tarball directly (api-spec.yaml included), unlike the nested bundle packageComputeBundle
65
- // uploads -- the asymmetry is deliberate: the appserver inspects the upload's top-level files
66
- // without untarring the source. Used by sf compute source retrieve, the only caller that needs
67
- // to go this direction.
68
- export async function unpackComputeBundle(buffer, appDir) {
63
+ // Reads and checks the downloaded source.tar.gz without touching disk, so every archive or path
64
+ // problem (bad gzip/tar, empty or nested bundle, unsafe or duplicate entry paths) surfaces before
65
+ // the caller creates anything. The download endpoint returns that inner tarball directly
66
+ // (api-spec.yaml included), unlike the nested bundle packageComputeBundle uploads -- the
67
+ // asymmetry is deliberate: the appserver inspects the upload's top-level files without untarring
68
+ // the source. Used by sf compute source retrieve, the only caller that needs to go this direction.
69
+ export async function decodeComputeBundle(buffer, appDir) {
69
70
  const sourceEntries = await untarGzip(buffer);
70
71
  // Release ordering alone doesn't protect against an org still returning the old nested bundle
71
72
  // (api-spec.yaml + source.tar.gz), which would otherwise "succeed" with an unextracted blob.
@@ -78,23 +79,49 @@ export async function unpackComputeBundle(buffer, appDir) {
78
79
  ]);
79
80
  }
80
81
  const resolvedAppDir = resolve(appDir);
81
- await Promise.all(Object.entries(sourceEntries).map(async ([relativePath, data]) => {
82
+ // Keyed by resolved path so entries that name the same file ("a" and "./a") collapse to one
83
+ // write (the later entry wins, as in tar) instead of racing each other.
84
+ const filesByPath = new Map();
85
+ for (const [relativePath, data] of Object.entries(sourceEntries)) {
82
86
  const filePath = resolve(appDir, relativePath);
83
- // Guards against a tar-slip: a malicious (or corrupted) entry name like "../../etc/foo"
84
- // must not be allowed to write outside appDir. The bundle comes from the org's most
85
- // recently deployed source, which this plugin doesn't otherwise validate the shape of.
86
- if (filePath !== resolvedAppDir && !filePath.startsWith(resolvedAppDir + sep)) {
87
+ // A tar-slip guard: a malicious (or corrupted) entry name like "../../etc/foo" must not be
88
+ // allowed to write outside appDir, and a file entry can't be appDir itself. The bundle comes
89
+ // from the org's most recently deployed source, which this plugin doesn't otherwise validate
90
+ // the shape of.
91
+ if (!filePath.startsWith(resolvedAppDir + sep)) {
87
92
  throw messages.createError('error.sourceBundleMalformed', [`unsafe entry path "${relativePath}"`]);
88
93
  }
94
+ filesByPath.set(filePath, data);
95
+ }
96
+ return [...filesByPath].map(([filePath, data]) => ({ data, filePath }));
97
+ }
98
+ // Writes decoded files to disk. Waits for every write to settle before failing, so a caller that
99
+ // cleans up after an error never races writes that are still in flight (which could recreate
100
+ // directories it just removed, or make its rm fail with ENOTEMPTY).
101
+ export async function writeBundleFiles(files) {
102
+ const results = await Promise.allSettled(files.map(async ({ data, filePath }) => {
89
103
  await mkdir(dirname(filePath), { recursive: true });
90
104
  await writeFile(filePath, data);
91
105
  }));
92
- return { fileCount: Object.keys(sourceEntries).length };
106
+ const failed = results.find((result) => result.status === 'rejected');
107
+ if (failed) {
108
+ throw failed.reason;
109
+ }
93
110
  }
94
- // Inverse of tarGzip below -- decompress and read every tar entry into memory, keyed by name.
95
- // Wraps decompression/parse failures as error.sourceBundleMalformed rather than letting a raw
96
- // zlib/tar-stream error (e.g. "incorrect header check") reach the user -- a truncated download
97
- // or an HTTP error page returned with a 200 status both land here.
111
+ // Decode + write in one call. Kept as a convenience for tests; the retrieve command calls
112
+ // decodeComputeBundle and writeBundleFiles separately so it can create the app directory
113
+ // between the two.
114
+ export async function unpackComputeBundle(buffer, appDir) {
115
+ const files = await decodeComputeBundle(buffer, appDir);
116
+ await writeBundleFiles(files);
117
+ return { fileCount: files.length };
118
+ }
119
+ // Inverse of tarGzip below -- decompress and read every file entry into memory, keyed by name.
120
+ // Directory entries are skipped (writing a file mkdirs its parents), and anything that isn't a
121
+ // plain file or directory (symlinks, hardlinks, devices) is rejected rather than silently
122
+ // written as an empty file. Wraps decompression/parse failures as error.sourceBundleMalformed
123
+ // rather than letting a raw zlib/tar-stream error (e.g. "incorrect header check") reach the
124
+ // user -- a truncated download or an HTTP error page returned with a 200 status both land here.
98
125
  async function untarGzip(buffer) {
99
126
  return new Promise((resolveEntries, reject) => {
100
127
  let decompressed;
@@ -108,12 +135,23 @@ async function untarGzip(buffer) {
108
135
  const entries = {};
109
136
  const extract = tarStream.extract();
110
137
  extract.on('entry', (header, stream, next) => {
138
+ const isFile = header.type === 'file' || header.type === 'contiguous-file';
139
+ if (!isFile && header.type !== 'directory') {
140
+ // Stop reading the rest of the archive; the answer is already decided.
141
+ extract.destroy();
142
+ reject(messages.createError('error.sourceBundleMalformed', [
143
+ `unsupported entry type "${header.type}" for "${header.name}"`,
144
+ ]));
145
+ return;
146
+ }
111
147
  const chunks = [];
112
148
  stream.on('data', (chunk) => {
113
149
  chunks.push(chunk);
114
150
  });
115
151
  stream.on('end', () => {
116
- entries[header.name] = Buffer.concat(chunks);
152
+ if (isFile) {
153
+ entries[header.name] = Buffer.concat(chunks);
154
+ }
117
155
  next();
118
156
  });
119
157
  stream.on('error', reject);
@@ -1 +1 @@
1
- {"version":3,"file":"computeBundle.js","sourceRoot":"","sources":["../../src/shared/computeBundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,MAAqB,MAAM,QAAQ,CAAC;AAC3C,OAAO,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,GAAG,GACJ,MAAM,WAAW,CAAC;A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,CAAC,GAAG,CAAC,MAAM,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,KAAK,UAAU,kBAAkB,CAAC,GAAW,EAAE,IAAI,GAAG,GAAG;IACvD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,EAAC,aAAa,EAAE,IAAI,EAAC,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAqB,EAAE;QAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,OAAO,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxC,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YACnB,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CACH,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC"}
@@ -1,2 +1,6 @@
1
1
  import { type Connection } from '@salesforce/core';
2
- export declare function retrieveComputeMetadata(connection: Connection, appDir: string, name: string): Promise<void>;
2
+ export type RetrievedMetadata = {
3
+ contents: Buffer;
4
+ fileName: string;
5
+ };
6
+ export declare function retrieveComputeMetadata(connection: Connection, name: string): Promise<RetrievedMetadata>;
@@ -16,23 +16,13 @@
16
16
  import { getLogger } from '@oclif/core';
17
17
  import { Messages } from '@salesforce/core';
18
18
  import JSZip from 'jszip';
19
- import { mkdir, writeFile } from 'node:fs/promises';
20
- import { join } from 'node:path';
21
19
  import { resolveComputeApiVersion } from './metadataApiVersion.js';
22
20
  import { PLUGIN_NAME } from './plugin-name.js';
23
21
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
24
22
  const messages = Messages.loadMessages(PLUGIN_NAME, 'compute.errors');
25
23
  // Gated by DEBUG=sf:compute:metadataRetrieve (or DEBUG=*).
26
24
  const { debug } = getLogger('sf:compute:metadataRetrieve');
27
- // Inverse of deployComputeMetadata in metadataDeploy.ts, but NOT built on SDR's
28
- // ComponentSet/MetadataApiRetrieve the way that function is built on MetadataApiDeploy --
29
- // ComputeApp has no entry in SDR's metadata registry, and ComponentSet.getObject()
30
- // (called internally when building a retrieve request) requires resolving every member's type
31
- // against that registry, so it throws for this type today. This uses jsforce's lower-level
32
- // retrieve API directly instead. Note the asymmetry with deployComputeMetadata's
33
- // deployResult.complete(true): RetrieveResultLocator#complete() takes no argument (unlike
34
- // DeployResultLocator#complete(includeDetails?)), per @jsforce/jsforce-node's metadata.d.ts.
35
- export async function retrieveComputeMetadata(connection, appDir, name) {
25
+ export async function retrieveComputeMetadata(connection, name) {
36
26
  const version = resolveComputeApiVersion(connection);
37
27
  const retrieveResult = connection.metadata.retrieve({
38
28
  apiVersion: Number(version),
@@ -66,7 +56,6 @@ export async function retrieveComputeMetadata(connection, appDir, name) {
66
56
  `the retrieved metadata is missing computeApps/${wireFileName}${problemDetail}`,
67
57
  ]);
68
58
  }
69
- await mkdir(appDir, { recursive: true });
70
- await writeFile(join(appDir, metaFileName), await metaEntry.async('nodebuffer'));
59
+ return { contents: await metaEntry.async('nodebuffer'), fileName: metaFileName };
71
60
  }
72
61
  //# sourceMappingURL=metadataRetrieve.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"metadataRetrieve.js","sourceRoot":"","sources":["../../src/shared/metadataRetrieve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAkB,QAAQ,EAAC,MAAM,kBAAkB,CAAC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,EAAC,CAAC;AACjF,CAAC"}
@@ -57,3 +57,7 @@ extracted %s files
57
57
  # info.done
58
58
 
59
59
  Retrieved compute app %s into %s.
60
+
61
+ # warning.cleanupFailed
62
+
63
+ Retrieving the compute app failed, and the partially written directory %s could not be removed (%s). Delete it before running this command again, or it will stop with "already exists".
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@heroku/plugin-compute",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@heroku/plugin-compute",
9
- "version": "0.4.3",
9
+ "version": "0.4.4",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@oclif/core": "^4",
@@ -659,13 +659,12 @@
659
659
  "telemetry-drain:display:compute"
660
660
  ]
661
661
  },
662
- "compute:list:config": {
662
+ "compute:get:build-log": {
663
663
  "aliases": [],
664
664
  "args": {},
665
- "deprecateAliases": true,
666
- "description": "Shows every config var (environment variable) currently set for a deployed\ncompute app, sorted alphabetically. Goes through the target org's Salesforce\nConnect API, which calls Heroku on your behalf. Use sf compute get config to\nread a single var's value, sf compute set config to add or change vars, or\nsf compute unset config to remove them.",
665
+ "description": "Fetches the bounded build/compile log (dependency install, slug compile,\nrelease) for the most recent build of a compute app -- useful right after\ndeploy to confirm the build compiled. This is a one-shot fetch of a\nfinished-or-in-progress log, not a live stream; use compute tail runtime-log\nfor the ongoing runtime log.\n\nThis is a read-only, org-mediated lookup by --name (the app's DeveloperName)\n-- the org calls Heroku's Build Info API on your behalf. It doesn't read from\nor require a local Salesforce DX project.",
667
666
  "examples": [
668
- "List all config vars for a compute app:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --target-org my-org"
667
+ "Print the latest build's log:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --target-org my-org"
669
668
  ],
670
669
  "flags": {
671
670
  "json": {
@@ -687,7 +686,7 @@
687
686
  "char": "n",
688
687
  "env": "COMPUTE_APP_NAME",
689
688
  "name": "name",
690
- "summary": "DeveloperName of the compute app to list config vars 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.",
689
+ "summary": "DeveloperName of the compute app to fetch build output 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.",
691
690
  "hasDynamicHelp": false,
692
691
  "multiple": false,
693
692
  "type": "option"
@@ -711,15 +710,13 @@
711
710
  }
712
711
  },
713
712
  "hasDynamicHelp": true,
714
- "hiddenAliases": [
715
- "compute:config:list"
716
- ],
717
- "id": "compute:list:config",
713
+ "hiddenAliases": [],
714
+ "id": "compute:get:build-log",
718
715
  "pluginAlias": "@heroku/plugin-compute",
719
716
  "pluginName": "@heroku/plugin-compute",
720
717
  "pluginType": "core",
721
718
  "strict": true,
722
- "summary": "List a compute app's config vars.",
719
+ "summary": "Print the build/compile log for a compute app's latest build.",
723
720
  "enableJsonFlag": true,
724
721
  "requiresProject": false,
725
722
  "isESM": true,
@@ -727,25 +724,32 @@
727
724
  "dist",
728
725
  "commands",
729
726
  "compute",
730
- "list",
731
- "config.js"
727
+ "get",
728
+ "build-log.js"
732
729
  ],
733
730
  "aliasPermutations": [],
734
731
  "permutations": [
735
- "compute:list:config",
736
- "list:compute:config",
737
- "list:config:compute",
738
- "compute:config:list",
739
- "config:compute:list",
740
- "config:list:compute"
732
+ "compute:get:build-log",
733
+ "get:compute:build-log",
734
+ "get:build-log:compute",
735
+ "compute:build-log:get",
736
+ "build-log:compute:get",
737
+ "build-log:get:compute"
741
738
  ]
742
739
  },
743
- "compute:list:telemetry-drain": {
740
+ "compute:get:config": {
744
741
  "aliases": [],
745
- "args": {},
746
- "description": "Shows every OpenTelemetry drain forwarding the compute app's logs, metrics,\nand traces, with each drain's ID, signals, and endpoint. Use\nsf compute display telemetry-drain to see the full detail of a single drain.",
742
+ "args": {
743
+ "key": {
744
+ "multiple": true,
745
+ "name": "key"
746
+ }
747
+ },
748
+ "deprecateAliases": true,
749
+ "description": "Goes through the target org's Salesforce Connect API, which calls Heroku on\nyour behalf. Pass a single key to print its bare value, or more than one to\nprint each as key: value. Fails if any requested key isn't currently set.",
747
750
  "examples": [
748
- "List the telemetry drains for a compute app:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --target-org my-org"
751
+ "Print a single config var's value:\n<%= config.bin %> <%= command.id %> STRIPE_KEY --name CreditRatingScorer --target-org my-org",
752
+ "Print more than one config var:\n<%= config.bin %> <%= command.id %> STRIPE_KEY LOG_LEVEL --name CreditRatingScorer --target-org my-org"
749
753
  ],
750
754
  "flags": {
751
755
  "json": {
@@ -767,7 +771,7 @@
767
771
  "char": "n",
768
772
  "env": "COMPUTE_APP_NAME",
769
773
  "name": "name",
770
- "summary": "DeveloperName of the compute app to list telemetry drains 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.",
774
+ "summary": "DeveloperName of the compute app to read config from (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.",
771
775
  "hasDynamicHelp": false,
772
776
  "multiple": false,
773
777
  "type": "option"
@@ -791,13 +795,15 @@
791
795
  }
792
796
  },
793
797
  "hasDynamicHelp": true,
794
- "hiddenAliases": [],
795
- "id": "compute:list:telemetry-drain",
798
+ "hiddenAliases": [
799
+ "compute:config:get"
800
+ ],
801
+ "id": "compute:get:config",
796
802
  "pluginAlias": "@heroku/plugin-compute",
797
803
  "pluginName": "@heroku/plugin-compute",
798
804
  "pluginType": "core",
799
805
  "strict": true,
800
- "summary": "List the telemetry drains configured for a compute app.",
806
+ "summary": "Print one or more of a compute app's config var values.",
801
807
  "enableJsonFlag": true,
802
808
  "requiresProject": false,
803
809
  "isESM": true,
@@ -805,25 +811,26 @@
805
811
  "dist",
806
812
  "commands",
807
813
  "compute",
808
- "list",
809
- "telemetry-drain.js"
814
+ "get",
815
+ "config.js"
810
816
  ],
811
817
  "aliasPermutations": [],
812
818
  "permutations": [
813
- "compute:list:telemetry-drain",
814
- "list:compute:telemetry-drain",
815
- "list:telemetry-drain:compute",
816
- "compute:telemetry-drain:list",
817
- "telemetry-drain:compute:list",
818
- "telemetry-drain:list:compute"
819
+ "compute:get:config",
820
+ "get:compute:config",
821
+ "get:config:compute",
822
+ "compute:config:get",
823
+ "config:compute:get",
824
+ "config:get:compute"
819
825
  ]
820
826
  },
821
- "compute:get:build-log": {
827
+ "compute:get:runtime-log": {
822
828
  "aliases": [],
823
829
  "args": {},
824
- "description": "Fetches the bounded build/compile log (dependency install, slug compile,\nrelease) for the most recent build of a compute app -- useful right after\ndeploy to confirm the build compiled. This is a one-shot fetch of a\nfinished-or-in-progress log, not a live stream; use compute tail runtime-log\nfor the ongoing runtime log.\n\nThis is a read-only, org-mediated lookup by --name (the app's DeveloperName)\n-- the org calls Heroku's Build Info API on your behalf. It doesn't read from\nor 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.",
825
831
  "examples": [
826
- "Print the latest build's log:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --target-org my-org"
832
+ "Print the most recent log lines:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --target-org my-org",
833
+ "Print the most recent 500 log lines:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --num 500 --target-org my-org"
827
834
  ],
828
835
  "flags": {
829
836
  "json": {
@@ -845,7 +852,7 @@
845
852
  "char": "n",
846
853
  "env": "COMPUTE_APP_NAME",
847
854
  "name": "name",
848
- "summary": "DeveloperName of the compute app to fetch build output 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.",
855
+ "summary": "DeveloperName of the compute app to fetch logs 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.",
849
856
  "hasDynamicHelp": false,
850
857
  "multiple": false,
851
858
  "type": "option"
@@ -866,16 +873,24 @@
866
873
  "hasDynamicHelp": false,
867
874
  "multiple": false,
868
875
  "type": "option"
876
+ },
877
+ "num": {
878
+ "name": "num",
879
+ "summary": "Number of recent log lines to print.",
880
+ "default": 100,
881
+ "hasDynamicHelp": false,
882
+ "multiple": false,
883
+ "type": "option"
869
884
  }
870
885
  },
871
886
  "hasDynamicHelp": true,
872
887
  "hiddenAliases": [],
873
- "id": "compute:get:build-log",
888
+ "id": "compute:get:runtime-log",
874
889
  "pluginAlias": "@heroku/plugin-compute",
875
890
  "pluginName": "@heroku/plugin-compute",
876
891
  "pluginType": "core",
877
892
  "strict": true,
878
- "summary": "Print the build/compile log for a compute app's latest build.",
893
+ "summary": "Print the recent runtime log for a compute app.",
879
894
  "enableJsonFlag": true,
880
895
  "requiresProject": false,
881
896
  "isESM": true,
@@ -884,31 +899,25 @@
884
899
  "commands",
885
900
  "compute",
886
901
  "get",
887
- "build-log.js"
902
+ "runtime-log.js"
888
903
  ],
889
904
  "aliasPermutations": [],
890
905
  "permutations": [
891
- "compute:get:build-log",
892
- "get:compute:build-log",
893
- "get:build-log:compute",
894
- "compute:build-log:get",
895
- "build-log:compute:get",
896
- "build-log:get:compute"
906
+ "compute:get:runtime-log",
907
+ "get:compute:runtime-log",
908
+ "get:runtime-log:compute",
909
+ "compute:runtime-log:get",
910
+ "runtime-log:compute:get",
911
+ "runtime-log:get:compute"
897
912
  ]
898
913
  },
899
- "compute:get:config": {
914
+ "compute:list:config": {
900
915
  "aliases": [],
901
- "args": {
902
- "key": {
903
- "multiple": true,
904
- "name": "key"
905
- }
906
- },
916
+ "args": {},
907
917
  "deprecateAliases": true,
908
- "description": "Goes through the target org's Salesforce Connect API, which calls Heroku on\nyour behalf. Pass a single key to print its bare value, or more than one to\nprint each as key: value. Fails if any requested key isn't currently set.",
918
+ "description": "Shows every config var (environment variable) currently set for a deployed\ncompute app, sorted alphabetically. Goes through the target org's Salesforce\nConnect API, which calls Heroku on your behalf. Use sf compute get config to\nread a single var's value, sf compute set config to add or change vars, or\nsf compute unset config to remove them.",
909
919
  "examples": [
910
- "Print a single config var's value:\n<%= config.bin %> <%= command.id %> STRIPE_KEY --name CreditRatingScorer --target-org my-org",
911
- "Print more than one config var:\n<%= config.bin %> <%= command.id %> STRIPE_KEY LOG_LEVEL --name CreditRatingScorer --target-org my-org"
920
+ "List all config vars for a compute app:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --target-org my-org"
912
921
  ],
913
922
  "flags": {
914
923
  "json": {
@@ -930,7 +939,7 @@
930
939
  "char": "n",
931
940
  "env": "COMPUTE_APP_NAME",
932
941
  "name": "name",
933
- "summary": "DeveloperName of the compute app to read config from (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.",
942
+ "summary": "DeveloperName of the compute app to list config vars 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.",
934
943
  "hasDynamicHelp": false,
935
944
  "multiple": false,
936
945
  "type": "option"
@@ -955,14 +964,14 @@
955
964
  },
956
965
  "hasDynamicHelp": true,
957
966
  "hiddenAliases": [
958
- "compute:config:get"
967
+ "compute:config:list"
959
968
  ],
960
- "id": "compute:get:config",
969
+ "id": "compute:list:config",
961
970
  "pluginAlias": "@heroku/plugin-compute",
962
971
  "pluginName": "@heroku/plugin-compute",
963
972
  "pluginType": "core",
964
973
  "strict": true,
965
- "summary": "Print one or more of a compute app's config var values.",
974
+ "summary": "List a compute app's config vars.",
966
975
  "enableJsonFlag": true,
967
976
  "requiresProject": false,
968
977
  "isESM": true,
@@ -970,26 +979,25 @@
970
979
  "dist",
971
980
  "commands",
972
981
  "compute",
973
- "get",
982
+ "list",
974
983
  "config.js"
975
984
  ],
976
985
  "aliasPermutations": [],
977
986
  "permutations": [
978
- "compute:get:config",
979
- "get:compute:config",
980
- "get:config:compute",
981
- "compute:config:get",
982
- "config:compute:get",
983
- "config:get:compute"
987
+ "compute:list:config",
988
+ "list:compute:config",
989
+ "list:config:compute",
990
+ "compute:config:list",
991
+ "config:compute:list",
992
+ "config:list:compute"
984
993
  ]
985
994
  },
986
- "compute:get:runtime-log": {
995
+ "compute:list:telemetry-drain": {
987
996
  "aliases": [],
988
997
  "args": {},
989
- "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.",
998
+ "description": "Shows every OpenTelemetry drain forwarding the compute app's logs, metrics,\nand traces, with each drain's ID, signals, and endpoint. Use\nsf compute display telemetry-drain to see the full detail of a single drain.",
990
999
  "examples": [
991
- "Print the most recent log lines:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --target-org my-org",
992
- "Print the most recent 500 log lines:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --num 500 --target-org my-org"
1000
+ "List the telemetry drains for a compute app:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --target-org my-org"
993
1001
  ],
994
1002
  "flags": {
995
1003
  "json": {
@@ -1011,7 +1019,7 @@
1011
1019
  "char": "n",
1012
1020
  "env": "COMPUTE_APP_NAME",
1013
1021
  "name": "name",
1014
- "summary": "DeveloperName of the compute app to fetch logs 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.",
1022
+ "summary": "DeveloperName of the compute app to list telemetry drains 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.",
1015
1023
  "hasDynamicHelp": false,
1016
1024
  "multiple": false,
1017
1025
  "type": "option"
@@ -1032,24 +1040,16 @@
1032
1040
  "hasDynamicHelp": false,
1033
1041
  "multiple": false,
1034
1042
  "type": "option"
1035
- },
1036
- "num": {
1037
- "name": "num",
1038
- "summary": "Number of recent log lines to print.",
1039
- "default": 100,
1040
- "hasDynamicHelp": false,
1041
- "multiple": false,
1042
- "type": "option"
1043
1043
  }
1044
1044
  },
1045
1045
  "hasDynamicHelp": true,
1046
1046
  "hiddenAliases": [],
1047
- "id": "compute:get:runtime-log",
1047
+ "id": "compute:list:telemetry-drain",
1048
1048
  "pluginAlias": "@heroku/plugin-compute",
1049
1049
  "pluginName": "@heroku/plugin-compute",
1050
1050
  "pluginType": "core",
1051
1051
  "strict": true,
1052
- "summary": "Print the recent runtime log for a compute app.",
1052
+ "summary": "List the telemetry drains configured for a compute app.",
1053
1053
  "enableJsonFlag": true,
1054
1054
  "requiresProject": false,
1055
1055
  "isESM": true,
@@ -1057,17 +1057,17 @@
1057
1057
  "dist",
1058
1058
  "commands",
1059
1059
  "compute",
1060
- "get",
1061
- "runtime-log.js"
1060
+ "list",
1061
+ "telemetry-drain.js"
1062
1062
  ],
1063
1063
  "aliasPermutations": [],
1064
1064
  "permutations": [
1065
- "compute:get:runtime-log",
1066
- "get:compute:runtime-log",
1067
- "get:runtime-log:compute",
1068
- "compute:runtime-log:get",
1069
- "runtime-log:compute:get",
1070
- "runtime-log:get:compute"
1065
+ "compute:list:telemetry-drain",
1066
+ "list:compute:telemetry-drain",
1067
+ "list:telemetry-drain:compute",
1068
+ "compute:telemetry-drain:list",
1069
+ "telemetry-drain:compute:list",
1070
+ "telemetry-drain:list:compute"
1071
1071
  ]
1072
1072
  },
1073
1073
  "compute:set:config": {
@@ -1517,5 +1517,5 @@
1517
1517
  ]
1518
1518
  }
1519
1519
  },
1520
- "version": "0.4.3"
1520
+ "version": "0.4.4"
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.3",
4
+ "version": "0.4.4",
5
5
  "author": "Heroku",
6
6
  "bugs": "https://github.com/heroku/plugin-compute/issues",
7
7
  "dependencies": {