@heroku/plugin-compute 0.1.0
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/LICENSE.txt +207 -0
- package/README.md +93 -0
- package/lib/commands/compute/config/get.d.ts +19 -0
- package/lib/commands/compute/config/get.js +76 -0
- package/lib/commands/compute/config/get.js.map +1 -0
- package/lib/commands/compute/config/list.d.ts +16 -0
- package/lib/commands/compute/config/list.js +57 -0
- package/lib/commands/compute/config/list.js.map +1 -0
- package/lib/commands/compute/config/set.d.ts +20 -0
- package/lib/commands/compute/config/set.js +99 -0
- package/lib/commands/compute/config/set.js.map +1 -0
- package/lib/commands/compute/config/unset.d.ts +20 -0
- package/lib/commands/compute/config/unset.js +93 -0
- package/lib/commands/compute/config/unset.js.map +1 -0
- package/lib/commands/compute/deploy.d.ts +18 -0
- package/lib/commands/compute/deploy.js +95 -0
- package/lib/commands/compute/deploy.js.map +1 -0
- package/lib/commands/compute/display.d.ts +26 -0
- package/lib/commands/compute/display.js +188 -0
- package/lib/commands/compute/display.js.map +1 -0
- package/lib/commands/compute/generate.d.ts +21 -0
- package/lib/commands/compute/generate.js +174 -0
- package/lib/commands/compute/generate.js.map +1 -0
- package/lib/commands/compute/get/build-log.d.ts +17 -0
- package/lib/commands/compute/get/build-log.js +62 -0
- package/lib/commands/compute/get/build-log.js.map +1 -0
- package/lib/commands/compute/get/runtime-log.d.ts +17 -0
- package/lib/commands/compute/get/runtime-log.js +79 -0
- package/lib/commands/compute/get/runtime-log.js.map +1 -0
- package/lib/commands/compute/list.d.ts +13 -0
- package/lib/commands/compute/list.js +55 -0
- package/lib/commands/compute/list.js.map +1 -0
- package/lib/commands/compute/scale.d.ts +23 -0
- package/lib/commands/compute/scale.js +112 -0
- package/lib/commands/compute/scale.js.map +1 -0
- package/lib/commands/compute/source/retrieve.d.ts +18 -0
- package/lib/commands/compute/source/retrieve.js +71 -0
- package/lib/commands/compute/source/retrieve.js.map +1 -0
- package/lib/commands/compute/tail/runtime-log.d.ts +17 -0
- package/lib/commands/compute/tail/runtime-log.js +82 -0
- package/lib/commands/compute/tail/runtime-log.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +20 -0
- package/lib/index.js.map +1 -0
- package/lib/shared/computeApp.d.ts +10 -0
- package/lib/shared/computeApp.js +82 -0
- package/lib/shared/computeApp.js.map +1 -0
- package/lib/shared/computeBundle.d.ts +9 -0
- package/lib/shared/computeBundle.js +202 -0
- package/lib/shared/computeBundle.js.map +1 -0
- package/lib/shared/computeConfig.d.ts +2 -0
- package/lib/shared/computeConfig.js +37 -0
- package/lib/shared/computeConfig.js.map +1 -0
- package/lib/shared/computeConnectApi.d.ts +16 -0
- package/lib/shared/computeConnectApi.js +59 -0
- package/lib/shared/computeConnectApi.js.map +1 -0
- package/lib/shared/computeGenerateSkeletons.d.ts +2 -0
- package/lib/shared/computeGenerateSkeletons.js +262 -0
- package/lib/shared/computeGenerateSkeletons.js.map +1 -0
- package/lib/shared/computeGenerateSource.d.ts +8 -0
- package/lib/shared/computeGenerateSource.js +120 -0
- package/lib/shared/computeGenerateSource.js.map +1 -0
- package/lib/shared/computeLogStream.d.ts +4 -0
- package/lib/shared/computeLogStream.js +108 -0
- package/lib/shared/computeLogStream.js.map +1 -0
- package/lib/shared/computeQuery.d.ts +52 -0
- package/lib/shared/computeQuery.js +168 -0
- package/lib/shared/computeQuery.js.map +1 -0
- package/lib/shared/computeTelemetryDrain.d.ts +11 -0
- package/lib/shared/computeTelemetryDrain.js +78 -0
- package/lib/shared/computeTelemetryDrain.js.map +1 -0
- package/lib/shared/herokuProxyApi.d.ts +62 -0
- package/lib/shared/herokuProxyApi.js +243 -0
- package/lib/shared/herokuProxyApi.js.map +1 -0
- package/lib/shared/metadataApiVersion.d.ts +2 -0
- package/lib/shared/metadataApiVersion.js +25 -0
- package/lib/shared/metadataApiVersion.js.map +1 -0
- package/lib/shared/metadataDeploy.d.ts +5 -0
- package/lib/shared/metadataDeploy.js +90 -0
- package/lib/shared/metadataDeploy.js.map +1 -0
- package/lib/shared/metadataRetrieve.d.ts +2 -0
- package/lib/shared/metadataRetrieve.js +68 -0
- package/lib/shared/metadataRetrieve.js.map +1 -0
- package/lib/shared/plugin-name.d.ts +13 -0
- package/lib/shared/plugin-name.js +29 -0
- package/lib/shared/plugin-name.js.map +1 -0
- package/messages/compute.config.get.md +39 -0
- package/messages/compute.config.list.md +24 -0
- package/messages/compute.config.set.md +49 -0
- package/messages/compute.config.unset.md +39 -0
- package/messages/compute.deploy.md +84 -0
- package/messages/compute.display.md +46 -0
- package/messages/compute.errors.md +182 -0
- package/messages/compute.generate.md +74 -0
- package/messages/compute.get.build-log.md +36 -0
- package/messages/compute.get.runtime-log.md +46 -0
- package/messages/compute.list.md +23 -0
- package/messages/compute.scale.md +67 -0
- package/messages/compute.source.retrieve.md +59 -0
- package/messages/compute.tail.runtime-log.md +55 -0
- package/npm-shrinkwrap.json +16162 -0
- package/oclif.manifest.json +982 -0
- package/package.json +117 -0
- package/schemas/compute-config-get.json +25 -0
- package/schemas/compute-config-list.json +25 -0
- package/schemas/compute-config-set.json +28 -0
- package/schemas/compute-config-unset.json +28 -0
- package/schemas/compute-deploy.json +30 -0
- package/schemas/compute-display.json +138 -0
- package/schemas/compute-generate.json +40 -0
- package/schemas/compute-get-build__log.json +30 -0
- package/schemas/compute-get-runtime__log.json +24 -0
- package/schemas/compute-list.json +94 -0
- package/schemas/compute-scale.json +41 -0
- package/schemas/compute-source-retrieve.json +26 -0
- package/schemas/compute-tail-runtime__log.json +18 -0
|
@@ -0,0 +1,168 @@
|
|
|
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 { Messages } from '@salesforce/core';
|
|
17
|
+
import { parseName } from './computeApp.js';
|
|
18
|
+
import { PLUGIN_NAME } from './plugin-name.js';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages(PLUGIN_NAME, 'compute.errors');
|
|
21
|
+
// @salesforce/core doesn't re-export SingleRecordQueryErrors from its package root (only from
|
|
22
|
+
// the internal org/connection module), so match the stable error names it throws by value.
|
|
23
|
+
const SINGLE_RECORD_QUERY_NO_RECORDS = 'SingleRecordQuery_NoRecords';
|
|
24
|
+
const SINGLE_RECORD_QUERY_MULTIPLE_RECORDS = 'SingleRecordQuery_MultipleRecords';
|
|
25
|
+
const BASE_SOQL_FIELDS = [
|
|
26
|
+
'Id',
|
|
27
|
+
'DeveloperName',
|
|
28
|
+
'MasterLabel',
|
|
29
|
+
'Description',
|
|
30
|
+
'Status',
|
|
31
|
+
'StatusReason',
|
|
32
|
+
'CurrentBuild.Id',
|
|
33
|
+
'CurrentBuild.BuildStatus',
|
|
34
|
+
'CurrentBuild.BuildStartedAt',
|
|
35
|
+
'CurrentBuild.BuildCompletedAt',
|
|
36
|
+
'CurrentBuild.DeployedAt',
|
|
37
|
+
'CurrentBuild.DeployedBy.Username',
|
|
38
|
+
'CurrentBuild.Error',
|
|
39
|
+
'ExternalServiceRegistration.Id',
|
|
40
|
+
];
|
|
41
|
+
// ExternalAppIdentifier/CurrentBuild.ExternalBuildIdentifier share PlatformComputeApp's
|
|
42
|
+
// entity-level isSfdcInternal restriction (W-24176390) -- querying them without the
|
|
43
|
+
// SfdcInternalQA client override applied (see setSfdcInternalQaCallOptions below) fails the whole
|
|
44
|
+
// query, so only add them once that override is already in effect. Keeps the default query text
|
|
45
|
+
// byte-for-byte unchanged until W-24176390 ships.
|
|
46
|
+
function soqlFields() {
|
|
47
|
+
const fields = process.env.SALESFORCE_INTERNAL_QA_CLIENT === 'true'
|
|
48
|
+
? [...BASE_SOQL_FIELDS, 'ExternalAppIdentifier', 'CurrentBuild.ExternalBuildIdentifier']
|
|
49
|
+
: BASE_SOQL_FIELDS;
|
|
50
|
+
return fields.join(', ');
|
|
51
|
+
}
|
|
52
|
+
// Defense-in-depth for the SOQL string interpolations in queryComputeApp/listComputeApps below --
|
|
53
|
+
// parseName's regexes already reject the characters SOQL string literals need escaped, so this
|
|
54
|
+
// should never actually fire, but it keeps a future NAME_PATTERN/NAMESPACE_PATTERN change from
|
|
55
|
+
// silently reopening injection.
|
|
56
|
+
function escapeSoqlLiteral(value) {
|
|
57
|
+
return value.replaceAll('\\', '\\\\').replaceAll('\'', String.raw `\'`);
|
|
58
|
+
}
|
|
59
|
+
// Internal engineering workaround, not a customer-facing feature -- do not document in README.
|
|
60
|
+
// PlatformComputeApp/PlatformComputeAppBuild currently ship with
|
|
61
|
+
// Tooling API access gated behind apiAccess="isSfdcInternal" (W-23426078 opened first-party-only
|
|
62
|
+
// access; W-24176390 tracks removing the restriction so any customer org can query these entities
|
|
63
|
+
// without this workaround). Until W-24176390 ships, this lets internal testing exercise the CLI's
|
|
64
|
+
// Tooling queries against a pilot org: jsforce's http-api sets the Sforce-Call-Options header from
|
|
65
|
+
// connection._callOptions on every REST request (incl. Tooling API query); this sets the
|
|
66
|
+
// SfdcInternalQA/ client identifier, which requires the target org's "Allow Salesforce Internal
|
|
67
|
+
// QA Clients" (SfdcInternalQAClients) org perm to be enabled. Gated behind
|
|
68
|
+
// SALESFORCE_INTERNAL_QA_CLIENT=true (opt-in, never silently applied). Note this does NOT unblock
|
|
69
|
+
// ExternalServiceRegistration.IsActive, which has its own separate field-level restriction --
|
|
70
|
+
// see the comment on ComputeAppRecord.ExternalServiceRegistration.IsActive above.
|
|
71
|
+
// Remove this function and its call sites once W-24176390 ships and public access is confirmed.
|
|
72
|
+
function setSfdcInternalQaCallOptions(connection) {
|
|
73
|
+
if (process.env.SALESFORCE_INTERNAL_QA_CLIENT !== 'true') {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
connection._callOptions = {
|
|
77
|
+
client: 'SfdcInternalQA/plugin-compute',
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// Accepts a bare DeveloperName or a namespace-qualified <namespace>__<developerName> value; the
|
|
81
|
+
// latter adds a Namespace filter so it only matches an app deployed under that namespace, since
|
|
82
|
+
// DeveloperName alone isn't unique across namespaces.
|
|
83
|
+
export async function queryComputeApp(connection, name) {
|
|
84
|
+
setSfdcInternalQaCallOptions(connection);
|
|
85
|
+
// parseName's NAME_PATTERN/NAMESPACE_PATTERN (letters/digits/underscore, anchored, no quotes or
|
|
86
|
+
// spaces) are the injection guard for the two interpolations below -- escapeSoqlLiteral is
|
|
87
|
+
// belt-and-suspenders in case either pattern is ever loosened, not the primary defense.
|
|
88
|
+
const { namespace, developerName } = parseName(name);
|
|
89
|
+
const namespaceFilter = namespace === undefined ? '' : ` AND Namespace = '${escapeSoqlLiteral(namespace)}'`;
|
|
90
|
+
const soql = `SELECT ${soqlFields()} FROM PlatformComputeApp WHERE DeveloperName = '${escapeSoqlLiteral(developerName)}'${namespaceFilter}`;
|
|
91
|
+
try {
|
|
92
|
+
return await connection.singleRecordQuery(soql, { tooling: true });
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
if (error instanceof Error && error.name === SINGLE_RECORD_QUERY_NO_RECORDS) {
|
|
96
|
+
throw messages.createError('error.appNotFoundInOrg', [name], [name], error);
|
|
97
|
+
}
|
|
98
|
+
if (error instanceof Error && error.name === SINGLE_RECORD_QUERY_MULTIPLE_RECORDS) {
|
|
99
|
+
throw messages.createError('error.ambiguousName', [name], [], error);
|
|
100
|
+
}
|
|
101
|
+
throw messages.createError('error.queryFailed', [error instanceof Error ? error.message : String(error)], [], error instanceof Error ? error : undefined);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// No --name filter -- lists every PlatformComputeApp in the org. autoFetchQuery auto-paginates
|
|
105
|
+
// (10,000-record default fetch size), which comfortably covers any realistic org's compute-app count.
|
|
106
|
+
export async function listComputeApps(connection) {
|
|
107
|
+
setSfdcInternalQaCallOptions(connection);
|
|
108
|
+
const soql = `SELECT ${soqlFields()} FROM PlatformComputeApp ORDER BY DeveloperName ASC`;
|
|
109
|
+
try {
|
|
110
|
+
// autoFetchQuery's type param is bounded to jsforce's Schema (org-wide SObject map), not the
|
|
111
|
+
// record shape -- there's no way to type this call against ComputeAppRecord directly.
|
|
112
|
+
const result = await connection.autoFetchQuery(soql, { tooling: true });
|
|
113
|
+
return result.records;
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
throw messages.createError('error.queryFailed', [error instanceof Error ? error.message : String(error)], [], error instanceof Error ? error : undefined);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Pure extraction, no fallback to DeveloperName -- a Heroku proxy call must never receive the
|
|
120
|
+
// Salesforce-side name in place of Heroku's own app id, so callers that get undefined back must
|
|
121
|
+
// either skip the Heroku call (display.ts) or hard-error (requireHerokuAppId/resolveHerokuAppId
|
|
122
|
+
// below), never silently substitute name on the wire.
|
|
123
|
+
export function pickHerokuAppId(record) {
|
|
124
|
+
return record.ExternalAppIdentifier ?? undefined;
|
|
125
|
+
}
|
|
126
|
+
// For callers that already hold a queried ComputeAppRecord (logs.ts, build/output.ts) and just
|
|
127
|
+
// need to gate on/extract the Heroku app id without a second query.
|
|
128
|
+
export function requireHerokuAppId(record, name) {
|
|
129
|
+
const herokuAppId = pickHerokuAppId(record);
|
|
130
|
+
if (!herokuAppId) {
|
|
131
|
+
throw messages.createError('error.herokuAppIdentifierUnavailable', [name]);
|
|
132
|
+
}
|
|
133
|
+
return herokuAppId;
|
|
134
|
+
}
|
|
135
|
+
// For callers that don't otherwise query the org (scale.ts, config/*.ts) -- runs the same
|
|
136
|
+
// queryComputeApp lookup those commands now require (see validateName's call-site contract above)
|
|
137
|
+
// and extracts the Heroku app id in one step.
|
|
138
|
+
export async function resolveHerokuAppId(connection, name) {
|
|
139
|
+
const record = await queryComputeApp(connection, name);
|
|
140
|
+
return requireHerokuAppId(record, name);
|
|
141
|
+
}
|
|
142
|
+
// Heroku-side runtime metadata (dyno type, web process/formation count) isn't included here --
|
|
143
|
+
// there's no confirmed Salesforce-queryable source for it yet. Open item, not yet resolved.
|
|
144
|
+
export function toComputeAppSummary(record) {
|
|
145
|
+
return {
|
|
146
|
+
id: record.Id,
|
|
147
|
+
name: record.DeveloperName,
|
|
148
|
+
masterLabel: record.MasterLabel,
|
|
149
|
+
description: record.Description ?? undefined,
|
|
150
|
+
status: record.Status,
|
|
151
|
+
statusReason: record.StatusReason ?? undefined,
|
|
152
|
+
externalServiceId: record.ExternalServiceRegistration?.Id,
|
|
153
|
+
externalServiceRegistered: record.ExternalServiceRegistration !== null,
|
|
154
|
+
externalServiceActive: record.ExternalServiceRegistration?.IsActive,
|
|
155
|
+
currentBuild: record.CurrentBuild
|
|
156
|
+
? {
|
|
157
|
+
id: record.CurrentBuild.Id,
|
|
158
|
+
buildStatus: record.CurrentBuild.BuildStatus,
|
|
159
|
+
buildStartedAt: record.CurrentBuild.BuildStartedAt ?? undefined,
|
|
160
|
+
buildCompletedAt: record.CurrentBuild.BuildCompletedAt ?? undefined,
|
|
161
|
+
deployedAt: record.CurrentBuild.DeployedAt ?? undefined,
|
|
162
|
+
deployedBy: record.CurrentBuild.DeployedBy?.Username,
|
|
163
|
+
error: record.CurrentBuild.Error ?? undefined,
|
|
164
|
+
}
|
|
165
|
+
: undefined,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=computeQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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C,2BAA2B,EAAE,QAAQ;QACnE,YAAY,EAAE,MAAM,CAAC,YAAY;YAC/B,CAAC,CAAC;gBACA,EAAE,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE;gBAC1B,WAAW,EAAE,MAAM,CAAC,YAAY,CAAC,WAAW;gBAC5C,cAAc,EAAE,MAAM,CAAC,YAAY,CAAC,cAAc,IAAI,SAAS;gBAC/D,gBAAgB,EAAE,MAAM,CAAC,YAAY,CAAC,gBAAgB,IAAI,SAAS;gBACnE,UAAU,EAAE,MAAM,CAAC,YAAY,CAAC,UAAU,IAAI,SAAS;gBACvD,UAAU,EAAE,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ;gBACpD,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,KAAK,IAAI,SAAS;aAC9C;YACD,CAAC,CAAC,SAAS;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { components } from '../generated/heroku-platform-api.js';
|
|
2
|
+
import type { TelemetryExporterType, TelemetrySignal } from './herokuProxyApi.js';
|
|
3
|
+
export declare const TELEMETRY_SIGNALS: readonly TelemetrySignal[];
|
|
4
|
+
export declare const TELEMETRY_TRANSPORTS: readonly string[];
|
|
5
|
+
export declare function validateAndFormatSignals(input: string): TelemetrySignal[];
|
|
6
|
+
export declare function exporterTypeForTransport(transport: string): TelemetryExporterType;
|
|
7
|
+
export declare function transportLabelForExporterType(exporterType: string): string;
|
|
8
|
+
export declare function formatTelemetryDrainRows(drain: components['schemas']['TelemetryDrain'], appName: string): Array<{
|
|
9
|
+
key: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,78 @@
|
|
|
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 { Messages } from '@salesforce/core';
|
|
17
|
+
import { PLUGIN_NAME } from './plugin-name.js';
|
|
18
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
19
|
+
const messages = Messages.loadMessages(PLUGIN_NAME, 'compute.errors');
|
|
20
|
+
// Placeholder for a drain field Heroku left unset -- matches the dash HerokuAppSummary/formation
|
|
21
|
+
// rendering uses so single-drain display reads consistently with the other compute tables.
|
|
22
|
+
const DASH = '-';
|
|
23
|
+
// The three OpenTelemetry signal categories a drain can forward. Order matches the enum in
|
|
24
|
+
// api-specs/heroku-platform-api.yaml (TelemetryDrain.signals); `all` is the shorthand for every one.
|
|
25
|
+
export const TELEMETRY_SIGNALS = ['traces', 'metrics', 'logs'];
|
|
26
|
+
// User-facing --transport values and the exporter type each maps to on Heroku's side. `grpc`/`http`
|
|
27
|
+
// are the two OTLP wire protocols; `splunk` is its own exporter. Reversed for display by
|
|
28
|
+
// transportLabelForExporterType below.
|
|
29
|
+
const TRANSPORT_TO_EXPORTER = {
|
|
30
|
+
grpc: 'otlp',
|
|
31
|
+
http: 'otlphttp',
|
|
32
|
+
splunk: 'splunk',
|
|
33
|
+
};
|
|
34
|
+
export const TELEMETRY_TRANSPORTS = Object.keys(TRANSPORT_TO_EXPORTER);
|
|
35
|
+
// Ported from heroku/cli's `telemetry` command. DELIBERATELY case-sensitive, non-trimming, and
|
|
36
|
+
// treats `all` only as the whole input (never as a comma-separated element) -- preserving behavioral
|
|
37
|
+
// parity with heroku/cli. This is an explicit decision, not an oversight: the plugin is pre-GA and no
|
|
38
|
+
// command consumes this yet, so staying strict now is the safe direction -- leniency (trimming,
|
|
39
|
+
// case-insensitivity) can be loosened in later without breaking anyone, whereas tightening after GA
|
|
40
|
+
// would break users. The companion unit tests lock each quirk (`Traces`/` traces`/`all,logs` all throw).
|
|
41
|
+
export function validateAndFormatSignals(input) {
|
|
42
|
+
if (input === 'all') {
|
|
43
|
+
return [...TELEMETRY_SIGNALS];
|
|
44
|
+
}
|
|
45
|
+
const requested = input.split(',');
|
|
46
|
+
const invalid = requested.filter(signal => !TELEMETRY_SIGNALS.includes(signal));
|
|
47
|
+
if (invalid.length > 0) {
|
|
48
|
+
throw messages.createError('error.invalidSignal', [invalid.join(', '), [...TELEMETRY_SIGNALS, 'all'].join(', ')]);
|
|
49
|
+
}
|
|
50
|
+
return requested;
|
|
51
|
+
}
|
|
52
|
+
// Maps a user-facing --transport onto Heroku's exporter type. Same strictness as signals above
|
|
53
|
+
// (exact-match, no trim/case-fold); an unknown transport throws rather than silently defaulting.
|
|
54
|
+
export function exporterTypeForTransport(transport) {
|
|
55
|
+
if (!Object.hasOwn(TRANSPORT_TO_EXPORTER, transport)) {
|
|
56
|
+
throw messages.createError('error.invalidTransport', [transport, TELEMETRY_TRANSPORTS.join(', ')]);
|
|
57
|
+
}
|
|
58
|
+
return TRANSPORT_TO_EXPORTER[transport];
|
|
59
|
+
}
|
|
60
|
+
// Display label for an exporter type: only `otlp` is gRPC; `otlphttp` and `splunk` both ride HTTP.
|
|
61
|
+
export function transportLabelForExporterType(exporterType) {
|
|
62
|
+
return exporterType === 'otlp' ? 'gRPC' : 'HTTP';
|
|
63
|
+
}
|
|
64
|
+
// Builds the ordered key/value rows for a single-drain display. App-only: the app name is passed in
|
|
65
|
+
// (already resolved by the command), not re-derived from the drain's owner, since this foundation
|
|
66
|
+
// never looks owners up. A follow-up `telemetry-drain info` command renders these rows.
|
|
67
|
+
export function formatTelemetryDrainRows(drain, appName) {
|
|
68
|
+
const headers = drain.exporter?.headers;
|
|
69
|
+
const hasHeaders = headers !== undefined && Object.keys(headers).length > 0;
|
|
70
|
+
return [
|
|
71
|
+
{ key: 'App', value: appName },
|
|
72
|
+
{ key: 'Signals', value: drain.signals && drain.signals.length > 0 ? drain.signals.join(', ') : DASH },
|
|
73
|
+
{ key: 'Endpoint', value: drain.exporter?.endpoint ?? DASH },
|
|
74
|
+
{ key: 'Transport', value: drain.exporter?.type ? transportLabelForExporterType(drain.exporter.type) : DASH },
|
|
75
|
+
{ key: 'Headers', value: hasHeaders ? JSON.stringify(headers) : DASH },
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=computeTelemetryDrain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeTelemetryDrain.js","sourceRoot":"","sources":["../../src/shared/computeTelemetryDrain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAK1C,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,2FAA2F;AAC3F,MAAM,IAAI,GAAG,GAAG,CAAC;AAEjB,2FAA2F;AAC3F,qGAAqG;AACrG,MAAM,CAAC,MAAM,iBAAiB,GAA+B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AAE3F,oGAAoG;AACpG,yFAAyF;AACzF,uCAAuC;AACvC,MAAM,qBAAqB,GAAG;IAC5B,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,QAAQ;CACwC,CAAC;AAE3D,MAAM,CAAC,MAAM,oBAAoB,GAAsB,MAAM,CAAC,I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C;AAED,oGAAoG;AACpG,kGAAkG;AAClG,wFAAwF;AACxF,MAAM,UAAU,wBAAwB,CACtC,KAA8C,EAC9C,OAAe;IAEf,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC;IACxC,MAAM,UAAU,GAAG,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAE5E,OAAO;QACL,EAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAC;QAC5B,EAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAC;QACpG,EAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,IAAI,IAAI,EAAC;QAC1D,EAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,6BAA6B,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAC;QAC3G,EAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAC;KACrE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type Connection } from '@salesforce/core';
|
|
2
|
+
export declare class HerokuProxyError extends Error {
|
|
3
|
+
readonly herokuErrorId?: string;
|
|
4
|
+
readonly origin: 'heroku' | 'proxy';
|
|
5
|
+
constructor(message: string, origin: 'heroku' | 'proxy', herokuErrorId?: string);
|
|
6
|
+
}
|
|
7
|
+
export type HerokuAppSummary = {
|
|
8
|
+
generation?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
region?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function fetchComputeAppViaProxy(connection: Connection, params: {
|
|
13
|
+
appId: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}): Promise<HerokuAppSummary | undefined>;
|
|
16
|
+
export type HerokuFormationSummary = Array<{
|
|
17
|
+
dynoSize?: string;
|
|
18
|
+
quantity: number;
|
|
19
|
+
type: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function fetchComputeFormationViaProxy(connection: Connection, params: {
|
|
22
|
+
appId: string;
|
|
23
|
+
name: string;
|
|
24
|
+
}): Promise<HerokuFormationSummary>;
|
|
25
|
+
export type HerokuFormationUpdate = {
|
|
26
|
+
dynoSize?: string;
|
|
27
|
+
quantity: number;
|
|
28
|
+
type: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function scaleComputeFormationViaProxy(connection: Connection, params: {
|
|
31
|
+
appId: string;
|
|
32
|
+
dynoSize?: string;
|
|
33
|
+
name: string;
|
|
34
|
+
processType: string;
|
|
35
|
+
quantity?: number;
|
|
36
|
+
}): Promise<HerokuFormationUpdate>;
|
|
37
|
+
export declare function fetchComputeConfigVarsViaProxy(connection: Connection, params: {
|
|
38
|
+
appId: string;
|
|
39
|
+
name: string;
|
|
40
|
+
}): Promise<Record<string, string>>;
|
|
41
|
+
export declare function updateComputeConfigVarsViaProxy(connection: Connection, params: {
|
|
42
|
+
appId: string;
|
|
43
|
+
name: string;
|
|
44
|
+
updates: Record<string, null | string>;
|
|
45
|
+
}): Promise<Record<string, string>>;
|
|
46
|
+
export declare function fetchLatestReleaseVersionViaProxy(connection: Connection, params: {
|
|
47
|
+
appId: string;
|
|
48
|
+
name: string;
|
|
49
|
+
}): Promise<number | undefined>;
|
|
50
|
+
export type HerokuLogSession = {
|
|
51
|
+
logplexUrl: string;
|
|
52
|
+
};
|
|
53
|
+
export declare function createComputeLogSessionViaProxy(connection: Connection, params: {
|
|
54
|
+
appId: string;
|
|
55
|
+
lines?: number;
|
|
56
|
+
name: string;
|
|
57
|
+
tail?: boolean;
|
|
58
|
+
}): Promise<HerokuLogSession>;
|
|
59
|
+
export declare function fetchLatestBuildOutputStreamUrlViaProxy(connection: Connection, params: {
|
|
60
|
+
appId: string;
|
|
61
|
+
name: string;
|
|
62
|
+
}): Promise<string | undefined>;
|
|
@@ -0,0 +1,243 @@
|
|
|
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 { Messages } from '@salesforce/core';
|
|
17
|
+
import { resolveComputeApiVersion } from './metadataApiVersion.js';
|
|
18
|
+
import { PLUGIN_NAME } from './plugin-name.js';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages(PLUGIN_NAME, 'compute.errors');
|
|
21
|
+
const HEROKU_API_BASE_URL = 'https://api.heroku.com';
|
|
22
|
+
const HEROKU_ACCEPT_HEADER = 'application/vnd.heroku+json; version=3';
|
|
23
|
+
// Distinguishes the two error shapes the /services/data/vXX.0/connect/compute/proxy endpoint can return,
|
|
24
|
+
// without forcing every caller to re-derive which one it got:
|
|
25
|
+
// - 'proxy': the proxy itself rejected the request (bad proxy_url, 502 on the 25 MiB response
|
|
26
|
+
// cap, etc.) -- its body is [{ errorCode: 'HEROKU_PROXY_ERROR', message }].
|
|
27
|
+
// - 'heroku': Heroku's own passthrough error surfaced -- its body is { id, message, url? }, with
|
|
28
|
+
// Heroku's real HTTP status preserved on the wire (jsforce's HttpApiError doesn't expose that
|
|
29
|
+
// status as a typed field, only the parsed body, so callers key off `herokuErrorId`, not a
|
|
30
|
+
// status code).
|
|
31
|
+
export class HerokuProxyError extends Error {
|
|
32
|
+
// Heroku's own machine-readable `id` (e.g. 'not_found') when origin === 'heroku'; undefined for
|
|
33
|
+
// a proxy-originated error, which has no equivalent field.
|
|
34
|
+
herokuErrorId;
|
|
35
|
+
origin;
|
|
36
|
+
constructor(message, origin, herokuErrorId) {
|
|
37
|
+
super(message);
|
|
38
|
+
this.name = 'HerokuProxyError';
|
|
39
|
+
this.origin = origin;
|
|
40
|
+
this.herokuErrorId = herokuErrorId;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// jsforce's HttpApi.getError() (http-api.js) unwraps a single-element error array to that
|
|
44
|
+
// element, then sets HttpApiError.errorCode from the (possibly unwrapped) object's own errorCode
|
|
45
|
+
// field, or leaves it undefined. Confirmed against both shapes this proxy can return:
|
|
46
|
+
// - Proxy-originated: [{ errorCode: 'HEROKU_PROXY_ERROR', message }] unwraps to
|
|
47
|
+
// err.errorCode === 'HEROKU_PROXY_ERROR'.
|
|
48
|
+
// - Heroku passthrough: { id, message, url? } has no errorCode field, so err.errorCode is
|
|
49
|
+
// undefined -- classified via err.data.id instead. err.data always holds the raw parsed error
|
|
50
|
+
// object either way (HttpApiError's contract).
|
|
51
|
+
function toHerokuProxyError(err) {
|
|
52
|
+
const httpErr = err;
|
|
53
|
+
if (httpErr.errorCode === 'HEROKU_PROXY_ERROR') {
|
|
54
|
+
return new HerokuProxyError(httpErr.message ?? 'The Salesforce Heroku proxy rejected the request.', 'proxy');
|
|
55
|
+
}
|
|
56
|
+
return new HerokuProxyError(httpErr.message ?? 'Heroku rejected the request.', 'heroku', httpErr.data?.id);
|
|
57
|
+
}
|
|
58
|
+
// THE ONLY function in this plugin that knows the /services/data/vXX.0/connect/compute/proxy?proxy_url=...
|
|
59
|
+
// shape -- every exported function below calls this and otherwise looks like it's talking to
|
|
60
|
+
// Heroku's typed API directly.
|
|
61
|
+
//
|
|
62
|
+
// proxy_url must carry the full target Heroku URL as a single percent-encoded query param value
|
|
63
|
+
// -- connection.request() is used (never raw fetch) so token refresh/retry/proxy settings apply,
|
|
64
|
+
// and the literal /services/... path (rather than a relative one) is required so jsforce's
|
|
65
|
+
// automatic API-version substitution doesn't undercut the v68+ floor resolveComputeApiVersion
|
|
66
|
+
// pins to.
|
|
67
|
+
async function herokuProxyRequest(connection, opts) {
|
|
68
|
+
let targetPath = opts.path;
|
|
69
|
+
for (const [key, value] of Object.entries(opts.params ?? {})) {
|
|
70
|
+
// Replacer function so the encoded value is inserted verbatim, never read as a $-pattern.
|
|
71
|
+
targetPath = targetPath.replace(`{${key}}`, () => encodeURIComponent(value));
|
|
72
|
+
}
|
|
73
|
+
const targetUrl = `${HEROKU_API_BASE_URL}${targetPath}`;
|
|
74
|
+
const version = resolveComputeApiVersion(connection);
|
|
75
|
+
const proxyUrl = `/services/data/v${version}/connect/compute/proxy?proxy_url=${encodeURIComponent(targetUrl)}`;
|
|
76
|
+
try {
|
|
77
|
+
return await connection.request({
|
|
78
|
+
method: opts.method,
|
|
79
|
+
url: proxyUrl,
|
|
80
|
+
body: opts.body === undefined ? undefined : JSON.stringify(opts.body),
|
|
81
|
+
headers: { 'Content-Type': 'application/json', Accept: HEROKU_ACCEPT_HEADER, ...opts.headers },
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
throw toHerokuProxyError(error);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// notFoundMessage lets a caller override the not_found classification with a more specific error
|
|
89
|
+
// (e.g. scaleComputeFormationViaProxy's "no such process type" instead of "no such app") without
|
|
90
|
+
// duplicating the origin/herokuErrorId checks at each call site.
|
|
91
|
+
function throwHerokuProxyComputeError(err, name, notFoundMessage) {
|
|
92
|
+
if (err instanceof HerokuProxyError && err.origin === 'heroku' && err.herokuErrorId === 'not_found') {
|
|
93
|
+
throw notFoundMessage ?? messages.createError('error.herokuAppNotFound', [name]);
|
|
94
|
+
}
|
|
95
|
+
if (err instanceof HerokuProxyError && err.origin === 'proxy') {
|
|
96
|
+
throw messages.createError('error.herokuProxyRequestFailed', [err.message]);
|
|
97
|
+
}
|
|
98
|
+
throw messages.createError('error.herokuApiRequestFailed', [err instanceof Error ? err.message : String(err)]);
|
|
99
|
+
}
|
|
100
|
+
export async function fetchComputeAppViaProxy(connection, params) {
|
|
101
|
+
try {
|
|
102
|
+
const app = await herokuProxyRequest(connection, {
|
|
103
|
+
method: 'GET',
|
|
104
|
+
path: '/apps/{app_id_or_name}',
|
|
105
|
+
params: { app_id_or_name: params.appId },
|
|
106
|
+
});
|
|
107
|
+
const summary = { name: app.name, region: app.region?.name, generation: app.generation?.name };
|
|
108
|
+
return summary.name === undefined && summary.region === undefined && summary.generation === undefined
|
|
109
|
+
? undefined
|
|
110
|
+
: summary;
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
throwHerokuProxyComputeError(error, params.name);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
export async function fetchComputeFormationViaProxy(connection, params) {
|
|
117
|
+
try {
|
|
118
|
+
const formation = await herokuProxyRequest(connection, {
|
|
119
|
+
method: 'GET',
|
|
120
|
+
path: '/apps/{app_id_or_name}/formation',
|
|
121
|
+
params: { app_id_or_name: params.appId },
|
|
122
|
+
});
|
|
123
|
+
return formation.map(f => ({ type: f.type ?? '-', dynoSize: f.dyno_size?.name, quantity: f.quantity ?? 0 }));
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
throwHerokuProxyComputeError(error, params.name);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export async function scaleComputeFormationViaProxy(connection, params) {
|
|
130
|
+
try {
|
|
131
|
+
const formation = await herokuProxyRequest(connection, {
|
|
132
|
+
method: 'PATCH',
|
|
133
|
+
path: '/apps/{app_id_or_name}/formation/{formation_id_or_type}',
|
|
134
|
+
params: {
|
|
135
|
+
app_id_or_name: params.appId,
|
|
136
|
+
formation_id_or_type: params.processType,
|
|
137
|
+
},
|
|
138
|
+
body: {
|
|
139
|
+
dyno_size: params.dynoSize ? { name: params.dynoSize } : undefined,
|
|
140
|
+
quantity: params.quantity,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
return {
|
|
144
|
+
type: formation.type ?? params.processType,
|
|
145
|
+
dynoSize: formation.dyno_size?.name,
|
|
146
|
+
quantity: formation.quantity ?? 0,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
throwHerokuProxyComputeError(error, params.name, messages.createError('error.herokuFormationNotFound', [params.name, params.processType]));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export async function fetchComputeConfigVarsViaProxy(connection, params) {
|
|
154
|
+
try {
|
|
155
|
+
return await herokuProxyRequest(connection, {
|
|
156
|
+
method: 'GET',
|
|
157
|
+
path: '/apps/{app_id_or_name}/config-vars',
|
|
158
|
+
params: { app_id_or_name: params.appId },
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
throwHerokuProxyComputeError(error, params.name);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
export async function updateComputeConfigVarsViaProxy(connection, params) {
|
|
166
|
+
try {
|
|
167
|
+
return await herokuProxyRequest(connection, {
|
|
168
|
+
method: 'PATCH',
|
|
169
|
+
path: '/apps/{app_id_or_name}/config-vars',
|
|
170
|
+
params: { app_id_or_name: params.appId },
|
|
171
|
+
body: params.updates,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
throwHerokuProxyComputeError(error, params.name);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// Shared by display.ts (formation display) and config/set.ts + config/unset.ts (post-update
|
|
179
|
+
// release number) -- the one place that owns "list releases, take the highest version number."
|
|
180
|
+
// Range: version ..; max=1; order=desc asks Heroku for just the single highest-version release,
|
|
181
|
+
// but Math.max is still applied defensively rather than trusting max=1 to always return exactly
|
|
182
|
+
// one element. Returns undefined (not an error) for a brand-new app with no releases yet.
|
|
183
|
+
export async function fetchLatestReleaseVersionViaProxy(connection, params) {
|
|
184
|
+
try {
|
|
185
|
+
const releases = await herokuProxyRequest(connection, {
|
|
186
|
+
method: 'GET',
|
|
187
|
+
path: '/apps/{app_id_or_name}/releases',
|
|
188
|
+
params: { app_id_or_name: params.appId },
|
|
189
|
+
headers: { Range: 'version ..; max=1; order=desc' },
|
|
190
|
+
});
|
|
191
|
+
const versions = releases.map(r => r.version).filter((v) => v !== undefined);
|
|
192
|
+
return versions.length === 0 ? undefined : Math.max(...versions);
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
throwHerokuProxyComputeError(error, params.name);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// Used by get/runtime-log.ts and tail/runtime-log.ts. `name` rides in the path (app_id_or_name),
|
|
199
|
+
// not the request body -- unlike the
|
|
200
|
+
// old /connect/compute/logs/session Connect resource, Heroku's own createLogSession takes the app
|
|
201
|
+
// only as a path param.
|
|
202
|
+
export async function createComputeLogSessionViaProxy(connection, params) {
|
|
203
|
+
try {
|
|
204
|
+
const session = await herokuProxyRequest(connection, {
|
|
205
|
+
method: 'POST',
|
|
206
|
+
path: '/apps/{app_id_or_name}/log-sessions',
|
|
207
|
+
params: { app_id_or_name: params.appId },
|
|
208
|
+
body: {
|
|
209
|
+
lines: params.lines,
|
|
210
|
+
tail: params.tail,
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
if (!session.logplex_url) {
|
|
214
|
+
throw messages.createError('error.herokuApiRequestFailed', [
|
|
215
|
+
'Heroku returned a log session with no logplex_url.',
|
|
216
|
+
]);
|
|
217
|
+
}
|
|
218
|
+
return { logplexUrl: session.logplex_url };
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
throwHerokuProxyComputeError(error, params.name);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
// Used by build/output.ts. There's no by-id path to a build's output_stream_url from the CLI's
|
|
225
|
+
// side -- the only build identifier available is PlatformComputeAppBuild's Salesforce record Id
|
|
226
|
+
// (from CurrentBuild.Id), not a Heroku build UUID, so getBuild-by-id isn't reachable. listBuilds
|
|
227
|
+
// returns oldest-first, so the latest build is the last element. Returns undefined (not an error)
|
|
228
|
+
// both when the app has no builds yet on Heroku's side and when the latest build hasn't produced
|
|
229
|
+
// output_stream_url yet -- build/output.ts treats both the same as the old Connect resource's 404.
|
|
230
|
+
export async function fetchLatestBuildOutputStreamUrlViaProxy(connection, params) {
|
|
231
|
+
try {
|
|
232
|
+
const builds = await herokuProxyRequest(connection, {
|
|
233
|
+
method: 'GET',
|
|
234
|
+
path: '/apps/{app_id_or_name}/builds',
|
|
235
|
+
params: { app_id_or_name: params.appId },
|
|
236
|
+
});
|
|
237
|
+
return builds.at(-1)?.output_stream_url;
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
throwHerokuProxyComputeError(error, params.name);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=herokuProxyApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"herokuProxyApi.js","sourceRoot":"","sources":["../../src/shared/herokuProxyApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAkB,QAAQ,EAAe,MAAM,kBAAkB,CAAC;AAIzE,OAAO,EAAC,wBAAwB,EAAC,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,C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I,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YACzB,MAAM,QAAQ,CAAC,WAAW,CAAC,8BAA8B,EAAE;gBACzD,oDAAoD;aACrD,CAAC,CAAC;QACL,CAAC;QAED,OAAO,EAAC,UAAU,EAAE,OAAO,CAAC,WAAW,EAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,4BAA4B,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;AACH,CAAC;AAED,+FAA+F;AAC/F,gGAAgG;AAChG,iGAAiG;AACjG,kGAAkG;AAClG,iGAAiG;AACjG,mGAAmG;AACnG,MAAM,CAAC,KAAK,UAAU,uCAAuC,CAC3D,UAAsB,EACtB,MAAqC;IAErC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAwC,UAAU,EAAE;YACzF,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,+BAA+B;YAErC,MAAM,EAAE,EAAC,cAAc,EAAE,MAAM,CAAC,KAAK,EAAC;SACvC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,4BAA4B,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
// PlatformComputeApp was introduced as a metadata type in API 68.0. Deploying/retrieving it at
|
|
17
|
+
// a lower version (e.g. an org's negotiated default, or a lower sourceApiVersion in
|
|
18
|
+
// sfdx-project.json) makes the server fail to resolve the type before it ever inspects the zip
|
|
19
|
+
// contents against package.xml -- surfacing as the misleading "was named in package.xml, but was
|
|
20
|
+
// not found in zipped directory" error rather than an explicit unsupported-type error.
|
|
21
|
+
const MIN_API_VERSION = 68;
|
|
22
|
+
export function resolveComputeApiVersion(connection) {
|
|
23
|
+
return Math.max(Number(connection.getApiVersion()), MIN_API_VERSION).toFixed(1);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=metadataApiVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadataApiVersion.js","sourceRoot":"","sources":["../../src/shared/metadataApiVersion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,+FAA+F;AAC/F,oFAAoF;AACpF,+FAA+F;AAC/F,iGAAiG;AACjG,uFAAuF;AACvF,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,MAAM,UAAU,wBAAwB,CAAC,UAAsB;IAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC"}
|