@salesforce/source-deploy-retrieve 13.7.0 → 13.7.1-compute.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/lib/src/client/index.d.ts +1 -0
- package/lib/src/client/index.js.map +1 -1
- package/lib/src/client/metadataApiDeploy.d.ts +5 -0
- package/lib/src/client/metadataApiDeploy.js +19 -7
- package/lib/src/client/metadataApiDeploy.js.map +1 -1
- package/lib/src/client/metadataApiRetrieve.d.ts +5 -0
- package/lib/src/client/metadataApiRetrieve.js +20 -6
- package/lib/src/client/metadataApiRetrieve.js.map +1 -1
- package/lib/src/client/metadataTransfer.d.ts +3 -0
- package/lib/src/client/metadataTransfer.js +11 -1
- package/lib/src/client/metadataTransfer.js.map +1 -1
- package/lib/src/client/transports/computeSourceBundle.d.ts +10 -0
- package/lib/src/client/transports/computeSourceBundle.js +276 -0
- package/lib/src/client/transports/computeSourceBundle.js.map +1 -0
- package/lib/src/client/transports/herokuComputeTransport.d.ts +12 -0
- package/lib/src/client/transports/herokuComputeTransport.js +162 -0
- package/lib/src/client/transports/herokuComputeTransport.js.map +1 -0
- package/lib/src/client/transports/index.d.ts +1 -0
- package/lib/src/client/transports/index.js +18 -0
- package/lib/src/client/transports/index.js.map +1 -0
- package/lib/src/client/transports/transportCoordinator.d.ts +20 -0
- package/lib/src/client/transports/transportCoordinator.js +63 -0
- package/lib/src/client/transports/transportCoordinator.js.map +1 -0
- package/lib/src/client/transports/transportPipeline.d.ts +50 -0
- package/lib/src/client/transports/transportPipeline.js +178 -0
- package/lib/src/client/transports/transportPipeline.js.map +1 -0
- package/lib/src/client/transports/types.d.ts +38 -0
- package/lib/src/client/transports/types.js +18 -0
- package/lib/src/client/transports/types.js.map +1 -0
- package/lib/src/client/types.d.ts +8 -0
- package/lib/src/collections/componentSet.d.ts +9 -0
- package/lib/src/collections/componentSet.js +130 -1
- package/lib/src/collections/componentSet.js.map +1 -1
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/registry/metadataRegistry.json +14 -0
- package/lib/src/registry/types.d.ts +2 -0
- package/package.json +5 -2
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2026, Salesforce, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
34
|
+
var ownKeys = function(o) {
|
|
35
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
36
|
+
var ar = [];
|
|
37
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
return ownKeys(o);
|
|
41
|
+
};
|
|
42
|
+
return function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
46
|
+
__setModuleDefault(result, mod);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
})();
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.MAX_COMPRESSED_BYTES = void 0;
|
|
52
|
+
exports.packageComputeBundle = packageComputeBundle;
|
|
53
|
+
exports.unpackComputeBundle = unpackComputeBundle;
|
|
54
|
+
const promises_1 = require("node:fs/promises");
|
|
55
|
+
const node_path_1 = require("node:path");
|
|
56
|
+
const node_zlib_1 = require("node:zlib");
|
|
57
|
+
const consumers_1 = require("node:stream/consumers");
|
|
58
|
+
const tarStream = __importStar(require("tar-stream"));
|
|
59
|
+
const core_1 = require("@salesforce/core");
|
|
60
|
+
const forceIgnore_1 = require("../../resolve/forceIgnore");
|
|
61
|
+
const logger = core_1.Logger.childFromRoot('computeSourceBundle');
|
|
62
|
+
// Compute source bundles are app source, not dependency caches or compiled artifacts.
|
|
63
|
+
// Cap both gzip layers and the tar entries retained in memory when unpacking.
|
|
64
|
+
exports.MAX_COMPRESSED_BYTES = 40 * 1024 * 1024;
|
|
65
|
+
const MAX_TAR_BYTES = 64 * 1024 * 1024;
|
|
66
|
+
const MAX_ENTRY_BYTES = 16 * 1024 * 1024;
|
|
67
|
+
const MAX_TOTAL_ENTRY_BYTES = 40 * 1024 * 1024;
|
|
68
|
+
const MAX_ENTRIES = 1000;
|
|
69
|
+
// Bundle shape: deployment-bundle.tar.gz containing api-spec.yaml plus a
|
|
70
|
+
// nested source.tar.gz with the app's source files.
|
|
71
|
+
async function packageComputeBundle(appDir, name) {
|
|
72
|
+
const apiSpecPath = (0, node_path_1.join)(appDir, 'api-spec.yaml');
|
|
73
|
+
try {
|
|
74
|
+
await (0, promises_1.access)(apiSpecPath);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
throw new core_1.SfError(`PlatformComputeApp '${name}' is missing required api-spec.yaml in ${appDir}`, 'MissingApiSpec');
|
|
78
|
+
}
|
|
79
|
+
const metaFileName = `${name}.compute-meta.xml`;
|
|
80
|
+
const excluded = new Set([metaFileName, '.forceignore']);
|
|
81
|
+
// Both files are consumed at build/runtime, so a broad .forceignore must not
|
|
82
|
+
// remove them from the nested source archive.
|
|
83
|
+
const alwaysIncluded = new Set(['api-spec.yaml', 'project.toml']);
|
|
84
|
+
const forceIgnore = forceIgnore_1.ForceIgnore.findAndCreate(appDir);
|
|
85
|
+
const sourceRelativePaths = await listFilesRecursive(appDir, (file) => !excluded.has(file) && (alwaysIncluded.has(file) || forceIgnore.accepts((0, node_path_1.join)(appDir, file))));
|
|
86
|
+
logger.debug('packaging %s: %d files after exclusions/.forceignore', appDir, sourceRelativePaths.length);
|
|
87
|
+
const apiSpec = await (0, promises_1.readFile)(apiSpecPath);
|
|
88
|
+
if (apiSpec.length > MAX_ENTRY_BYTES) {
|
|
89
|
+
throw new Error(`Compute source bundle: api-spec.yaml entry size limit (${MAX_ENTRY_BYTES} bytes) exceeded`);
|
|
90
|
+
}
|
|
91
|
+
let sourceBytes = 0;
|
|
92
|
+
for (const relativePath of sourceRelativePaths) {
|
|
93
|
+
// eslint-disable-next-line no-await-in-loop
|
|
94
|
+
const { size } = await (0, promises_1.lstat)((0, node_path_1.join)(appDir, relativePath));
|
|
95
|
+
if (size > MAX_ENTRY_BYTES) {
|
|
96
|
+
throw new Error(`Compute source bundle: entry size limit (${MAX_ENTRY_BYTES} bytes) exceeded for ${relativePath}`);
|
|
97
|
+
}
|
|
98
|
+
sourceBytes += size;
|
|
99
|
+
if (sourceBytes > MAX_TOTAL_ENTRY_BYTES) {
|
|
100
|
+
throw new Error(`Compute source bundle: total size limit (${MAX_TOTAL_ENTRY_BYTES} bytes) exceeded`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const sourceEntries = await Promise.all(sourceRelativePaths.map(async (relativePath) => ({
|
|
104
|
+
name: relativePath,
|
|
105
|
+
data: await (0, promises_1.readFile)((0, node_path_1.join)(appDir, relativePath)),
|
|
106
|
+
})));
|
|
107
|
+
// The source may change between stat and read; check actual bytes before assembling.
|
|
108
|
+
if (sourceEntries.some(({ data }) => data.length > MAX_ENTRY_BYTES)) {
|
|
109
|
+
throw new Error(`Compute source bundle: entry size limit (${MAX_ENTRY_BYTES} bytes) exceeded`);
|
|
110
|
+
}
|
|
111
|
+
if (sourceEntries.reduce((total, { data }) => total + data.length, 0) > MAX_TOTAL_ENTRY_BYTES) {
|
|
112
|
+
throw new Error(`Compute source bundle: total size limit (${MAX_TOTAL_ENTRY_BYTES} bytes) exceeded`);
|
|
113
|
+
}
|
|
114
|
+
const sourceTarGz = await tarGzip(sourceEntries);
|
|
115
|
+
if (sourceTarGz.length > exports.MAX_COMPRESSED_BYTES) {
|
|
116
|
+
throw new Error(`Compute source bundle: source.tar.gz entry size limit (${exports.MAX_COMPRESSED_BYTES} bytes) exceeded`);
|
|
117
|
+
}
|
|
118
|
+
if (apiSpec.length + sourceTarGz.length > MAX_TOTAL_ENTRY_BYTES) {
|
|
119
|
+
throw new Error(`Compute source bundle: outer total size limit (${MAX_TOTAL_ENTRY_BYTES} bytes) exceeded`);
|
|
120
|
+
}
|
|
121
|
+
const buffer = await tarGzip([
|
|
122
|
+
{ name: 'api-spec.yaml', data: apiSpec },
|
|
123
|
+
{ name: 'source.tar.gz', data: sourceTarGz },
|
|
124
|
+
]);
|
|
125
|
+
if (buffer.length > exports.MAX_COMPRESSED_BYTES) {
|
|
126
|
+
throw new Error(`Compute source bundle: compressed size limit (${exports.MAX_COMPRESSED_BYTES} bytes) exceeded`);
|
|
127
|
+
}
|
|
128
|
+
logger.debug('packaged %s into %d bytes (%d files)', appDir, buffer.length, sourceEntries.length);
|
|
129
|
+
return { buffer, fileCount: sourceEntries.length };
|
|
130
|
+
}
|
|
131
|
+
async function unpackComputeBundle(buffer, appDir) {
|
|
132
|
+
const outer = await untarGzip(buffer, true);
|
|
133
|
+
const apiSpec = outer['api-spec.yaml'];
|
|
134
|
+
const sourceTarGz = outer['source.tar.gz'];
|
|
135
|
+
if (!apiSpec || !sourceTarGz) {
|
|
136
|
+
const missing = [!apiSpec && 'api-spec.yaml', !sourceTarGz && 'source.tar.gz'].filter(Boolean).join(', ');
|
|
137
|
+
throw new Error(`Malformed compute source bundle: missing ${missing}`);
|
|
138
|
+
}
|
|
139
|
+
const resolvedAppDir = (0, node_path_1.resolve)(appDir);
|
|
140
|
+
await rejectSymlinks(resolvedAppDir);
|
|
141
|
+
await (0, promises_1.mkdir)(appDir, { recursive: true });
|
|
142
|
+
await rejectSymlinks((0, node_path_1.join)(resolvedAppDir, 'api-spec.yaml'));
|
|
143
|
+
await (0, promises_1.writeFile)((0, node_path_1.join)(appDir, 'api-spec.yaml'), apiSpec);
|
|
144
|
+
const sourceEntries = await untarGzip(sourceTarGz, false);
|
|
145
|
+
await Promise.all(Object.entries(sourceEntries).map(async ([relativePath, data]) => {
|
|
146
|
+
const filePath = (0, node_path_1.resolve)(appDir, relativePath);
|
|
147
|
+
// tar-slip guard: reject entries that escape appDir
|
|
148
|
+
if (filePath !== resolvedAppDir && !filePath.startsWith(resolvedAppDir + node_path_1.sep)) {
|
|
149
|
+
throw new Error(`Malformed compute source bundle: unsafe entry path "${relativePath}"`);
|
|
150
|
+
}
|
|
151
|
+
await rejectSymlinks(filePath);
|
|
152
|
+
await (0, promises_1.mkdir)((0, node_path_1.dirname)(filePath), { recursive: true });
|
|
153
|
+
await rejectSymlinks(filePath);
|
|
154
|
+
await (0, promises_1.writeFile)(filePath, data);
|
|
155
|
+
}));
|
|
156
|
+
return { fileCount: new Set([...Object.keys(sourceEntries), 'api-spec.yaml']).size };
|
|
157
|
+
}
|
|
158
|
+
async function rejectSymlinks(filePath) {
|
|
159
|
+
let current = (0, node_path_1.resolve)(filePath);
|
|
160
|
+
const root = (0, node_path_1.parse)(current).root;
|
|
161
|
+
// The filesystem root is trusted; inspect every component beneath it, including
|
|
162
|
+
// ancestors of an already-existing app or output file.
|
|
163
|
+
while (current !== root) {
|
|
164
|
+
try {
|
|
165
|
+
// eslint-disable-next-line no-await-in-loop
|
|
166
|
+
const stat = await (0, promises_1.lstat)(current);
|
|
167
|
+
if (stat.isSymbolicLink()) {
|
|
168
|
+
// macOS exposes /var as a system alias for /private/var. Do not reject
|
|
169
|
+
// ordinary output paths in its temporary directory for that alias.
|
|
170
|
+
// eslint-disable-next-line no-await-in-loop
|
|
171
|
+
if (!(process.platform === 'darwin' && current === '/var' && (await (0, promises_1.realpath)(current)) === '/private/var')) {
|
|
172
|
+
throw new Error(`Malformed compute source bundle: symlink in output path "${current}"`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
if (err.code !== 'ENOENT')
|
|
178
|
+
throw err;
|
|
179
|
+
}
|
|
180
|
+
current = (0, node_path_1.dirname)(current);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function untarGzip(buffer, outer) {
|
|
184
|
+
return new Promise((resolveEntries, reject) => {
|
|
185
|
+
if (buffer.length > exports.MAX_COMPRESSED_BYTES) {
|
|
186
|
+
reject(new Error(`Malformed compute source bundle: compressed size limit (${exports.MAX_COMPRESSED_BYTES} bytes) exceeded`));
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
let decompressed;
|
|
190
|
+
try {
|
|
191
|
+
decompressed = (0, node_zlib_1.gunzipSync)(buffer, { maxOutputLength: MAX_TAR_BYTES });
|
|
192
|
+
}
|
|
193
|
+
catch (err) {
|
|
194
|
+
reject(new Error(err.code === 'ERR_BUFFER_TOO_LARGE'
|
|
195
|
+
? `Malformed compute source bundle: decompressed size limit (${MAX_TAR_BYTES} bytes) exceeded`
|
|
196
|
+
: 'Malformed compute source bundle: not a valid gzip archive'));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const entries = {};
|
|
200
|
+
const extract = tarStream.extract();
|
|
201
|
+
let entryCount = 0;
|
|
202
|
+
let totalBytes = 0;
|
|
203
|
+
extract.on('entry', (header, stream, next) => {
|
|
204
|
+
entryCount++;
|
|
205
|
+
if (entryCount > MAX_ENTRIES) {
|
|
206
|
+
reject(new Error(`Malformed compute source bundle: entry count limit (${MAX_ENTRIES}) exceeded`));
|
|
207
|
+
extract.destroy();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const entryLimit = outer && header.name === 'source.tar.gz' ? exports.MAX_COMPRESSED_BYTES : MAX_ENTRY_BYTES;
|
|
211
|
+
if (header.size > entryLimit || totalBytes + header.size > MAX_TOTAL_ENTRY_BYTES) {
|
|
212
|
+
reject(new Error(`Malformed compute source bundle: entry size limit (${entryLimit} bytes) or total size limit (${MAX_TOTAL_ENTRY_BYTES} bytes) exceeded`));
|
|
213
|
+
extract.destroy();
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const chunks = [];
|
|
217
|
+
stream.on('data', (chunk) => {
|
|
218
|
+
totalBytes += chunk.length;
|
|
219
|
+
if (totalBytes > MAX_TOTAL_ENTRY_BYTES) {
|
|
220
|
+
reject(new Error(`Malformed compute source bundle: total size limit (${MAX_TOTAL_ENTRY_BYTES} bytes) exceeded`));
|
|
221
|
+
extract.destroy();
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
chunks.push(chunk);
|
|
225
|
+
});
|
|
226
|
+
stream.on('end', () => {
|
|
227
|
+
entries[header.name] = Buffer.concat(chunks);
|
|
228
|
+
next();
|
|
229
|
+
});
|
|
230
|
+
stream.on('error', reject);
|
|
231
|
+
stream.resume();
|
|
232
|
+
});
|
|
233
|
+
extract.on('finish', () => resolveEntries(entries));
|
|
234
|
+
extract.on('error', () => reject(new Error('Malformed compute source bundle: not a valid tar archive')));
|
|
235
|
+
extract.end(decompressed);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
async function tarGzip(entries) {
|
|
239
|
+
const pack = tarStream.pack();
|
|
240
|
+
// Pipe BEFORE writing entries to avoid deadlock: pack is a Readable with
|
|
241
|
+
// a 16KB highWaterMark — without a consumer attached, backpressure stalls
|
|
242
|
+
// the entry callbacks once buffered bytes exceed the threshold.
|
|
243
|
+
const gzippedBufferPromise = (0, consumers_1.buffer)(pack.pipe((0, node_zlib_1.createGzip)()));
|
|
244
|
+
await entries.reduce((previous, { name, data }) => previous.then(async () => new Promise((resolveEntry, reject) => {
|
|
245
|
+
pack.entry({ name, size: data.length }, data, (err) => (err ? reject(err) : resolveEntry()));
|
|
246
|
+
})), Promise.resolve());
|
|
247
|
+
pack.finalize();
|
|
248
|
+
return gzippedBufferPromise;
|
|
249
|
+
}
|
|
250
|
+
async function listFilesRecursive(base, accepts) {
|
|
251
|
+
const files = [];
|
|
252
|
+
async function walk(dir) {
|
|
253
|
+
const entries = await (0, promises_1.readdir)(dir, { withFileTypes: true });
|
|
254
|
+
for (const entry of entries) {
|
|
255
|
+
if (entry.name.startsWith('.'))
|
|
256
|
+
continue;
|
|
257
|
+
const full = (0, node_path_1.join)(dir, entry.name);
|
|
258
|
+
if (entry.isDirectory()) {
|
|
259
|
+
// eslint-disable-next-line no-await-in-loop
|
|
260
|
+
await walk(full);
|
|
261
|
+
}
|
|
262
|
+
else if (entry.isFile()) {
|
|
263
|
+
const file = (0, node_path_1.relative)(base, full).split(node_path_1.sep).join('/');
|
|
264
|
+
if (accepts(file)) {
|
|
265
|
+
if (files.length === MAX_ENTRIES) {
|
|
266
|
+
throw new Error(`Compute source bundle: entry count limit (${MAX_ENTRIES}) exceeded`);
|
|
267
|
+
}
|
|
268
|
+
files.push(file);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
await walk(base);
|
|
274
|
+
return files;
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=computeSourceBundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeSourceBundle.js","sourceRoot":"","sources":["../../../../src/client/transports/computeSourceBundle.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BH,oDAuEC;AAED,kDA+BC;AArID,+CAAgG;AAChG,yCAAyE;AACzE,yCAAmD;AACnD,qDAAiE;AACjE,sDAAwC;AACxC,2CAAmD;AACnD,2DAAwD;AAExD,MAAM,MAAM,GAAG,aAAM,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;AAE3D,sFAAsF;AACtF,8EAA8E;AACjE,QAAA,oBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACrD,MAAM,aAAa,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACvC,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACzC,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAC/C,MAAM,WAAW,GAAG,IAAI,CAAC;AAWzB,yEAAyE;AACzE,oDAAoD;AAC7C,KAAK,UAAU,oBAAoB,CAAC,MAAc,EAAE,IAAY;IACrE,MAAM,WAAW,GAAG,IAAA,gBAAI,EAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAClD,IAAI,CAAC;QACH,MAAM,IAAA,iBAAM,EAAC,WAAW,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,cAAO,CAAC,uBAAuB,IAAI,0CAA0C,MAAM,EAAE,EAAE,gBAAgB,CAAC,CAAC;IACrH,CAAC;IAED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AAK,WAAW,EAAE,CAAC;wBACjC,MAAM,IAAI,KAAK,CAAC,6CAA6C,WAAW,YAAY,CAAC,CAAC;oBACxF,CAAC;oBACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SourceComponent } from '../../resolve/sourceComponent';
|
|
2
|
+
import { TransportContext, TransportDescription, TransportProvider, TransportResult } from './types';
|
|
3
|
+
export declare class HerokuComputeTransport implements TransportProvider {
|
|
4
|
+
readonly name = "herokuCompute";
|
|
5
|
+
private readonly logger;
|
|
6
|
+
describe(): TransportDescription;
|
|
7
|
+
handles(component: SourceComponent): boolean;
|
|
8
|
+
beforeDeploy(context: TransportContext): Promise<TransportResult>;
|
|
9
|
+
afterRetrieve(context: TransportContext): Promise<TransportResult>;
|
|
10
|
+
private assertComputeComponent;
|
|
11
|
+
private checkForFailures;
|
|
12
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2026, Salesforce, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.HerokuComputeTransport = void 0;
|
|
22
|
+
const node_path_1 = require("node:path");
|
|
23
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
24
|
+
const core_1 = require("@salesforce/core");
|
|
25
|
+
const constants_1 = require("../../common/constants");
|
|
26
|
+
const types_1 = require("../types");
|
|
27
|
+
const computeSourceBundle_1 = require("./computeSourceBundle");
|
|
28
|
+
const ENDPOINT = '/connect/compute/source';
|
|
29
|
+
function resolveContentPath(component, project) {
|
|
30
|
+
const packageDir = project.getDefaultPackage().fullPath;
|
|
31
|
+
return (0, node_path_1.join)(packageDir, constants_1.DEFAULT_PACKAGE_ROOT_SFDX, component.type.directoryName, component.fullName);
|
|
32
|
+
}
|
|
33
|
+
async function uploadSource(connection, name, bundle) {
|
|
34
|
+
const form = new form_data_1.default();
|
|
35
|
+
form.append('name', name);
|
|
36
|
+
form.append('bundle', bundle, {
|
|
37
|
+
filename: 'deployment-bundle.tar.gz',
|
|
38
|
+
contentType: 'application/gzip',
|
|
39
|
+
});
|
|
40
|
+
return connection.request({
|
|
41
|
+
method: 'POST',
|
|
42
|
+
url: ENDPOINT,
|
|
43
|
+
body: form.getBuffer(),
|
|
44
|
+
headers: form.getHeaders(),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
// jsforce decodes to UTF-8 by default — lossy for gzip bytes.
|
|
48
|
+
// encoding: 'binary' (latin1) preserves byte values 1:1. Connection.request
|
|
49
|
+
// buffers the complete response; this guard prevents a second oversized Buffer
|
|
50
|
+
// allocation, while unpackComputeBundle limits the archive after download.
|
|
51
|
+
async function downloadSource(connection, appIdOrName) {
|
|
52
|
+
const body = await connection.request({ method: 'GET', url: `/connect/compute/${encodeURIComponent(appIdOrName)}/source` }, { encoding: 'binary' });
|
|
53
|
+
if (body.length > computeSourceBundle_1.MAX_COMPRESSED_BYTES) {
|
|
54
|
+
throw new Error(`Compute source bundle: compressed size limit (${computeSourceBundle_1.MAX_COMPRESSED_BYTES} bytes) exceeded`);
|
|
55
|
+
}
|
|
56
|
+
return Buffer.from(body, 'binary');
|
|
57
|
+
}
|
|
58
|
+
class HerokuComputeTransport {
|
|
59
|
+
name = 'herokuCompute';
|
|
60
|
+
logger = core_1.Logger.childFromRoot('HerokuComputeTransport');
|
|
61
|
+
// eslint-disable-next-line class-methods-use-this
|
|
62
|
+
describe() {
|
|
63
|
+
return { label: 'Heroku Compute', endpoint: ENDPOINT };
|
|
64
|
+
}
|
|
65
|
+
handles(component) {
|
|
66
|
+
return component.type.strategies?.transport === this.name;
|
|
67
|
+
}
|
|
68
|
+
async beforeDeploy(context) {
|
|
69
|
+
const fileResponses = [];
|
|
70
|
+
for (const component of context.components) {
|
|
71
|
+
try {
|
|
72
|
+
this.assertComputeComponent(component);
|
|
73
|
+
this.logger.debug('deploying compute source for %s from %s', component.fullName, component.content);
|
|
74
|
+
// eslint-disable-next-line no-await-in-loop
|
|
75
|
+
const bundle = await (0, computeSourceBundle_1.packageComputeBundle)(component.content, component.fullName);
|
|
76
|
+
this.logger.debug('packaged %s: %d bytes, %d files', component.fullName, bundle.buffer.length, bundle.fileCount);
|
|
77
|
+
// eslint-disable-next-line no-await-in-loop
|
|
78
|
+
const result = await uploadSource(context.connection, component.fullName, bundle.buffer);
|
|
79
|
+
this.logger.debug('uploaded %s: buildId=%s', component.fullName, result.buildId);
|
|
80
|
+
fileResponses.push({
|
|
81
|
+
fullName: component.fullName,
|
|
82
|
+
type: component.type.name,
|
|
83
|
+
state: types_1.ComponentStatus.Changed,
|
|
84
|
+
filePath: component.content,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
fileResponses.push({
|
|
89
|
+
fullName: component.fullName,
|
|
90
|
+
type: component.type.name,
|
|
91
|
+
state: types_1.ComponentStatus.Failed,
|
|
92
|
+
filePath: component.content ?? component.xml ?? '',
|
|
93
|
+
error: `Heroku Compute upload failed for '${component.fullName}': ${err.message}`,
|
|
94
|
+
problemType: 'Error',
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return this.checkForFailures(fileResponses, 'upload');
|
|
99
|
+
}
|
|
100
|
+
async afterRetrieve(context) {
|
|
101
|
+
const fileResponses = [];
|
|
102
|
+
for (const component of context.components) {
|
|
103
|
+
try {
|
|
104
|
+
const packageName = context.transportPackageNames?.[`${component.type.name}#${component.fullName}`];
|
|
105
|
+
const packageOutput = packageName
|
|
106
|
+
? context.packageOptions
|
|
107
|
+
?.map((option) => (typeof option === 'string' ? { name: option, outputDir: option } : option))
|
|
108
|
+
.find((option) => option.name === packageName)
|
|
109
|
+
: undefined;
|
|
110
|
+
if (!component.content && packageName && !packageOutput) {
|
|
111
|
+
throw new Error(`No package option found for '${packageName}' (component '${component.fullName}')`);
|
|
112
|
+
}
|
|
113
|
+
const contentPath = component.content ??
|
|
114
|
+
(packageOutput || context.output
|
|
115
|
+
? (0, node_path_1.join)(packageOutput?.outputDir ?? packageOutput?.name ?? context.output, component.type.directoryName, component.fullName)
|
|
116
|
+
: resolveContentPath(component, context.project));
|
|
117
|
+
this.logger.debug('retrieving compute source for %s into %s', component.fullName, contentPath);
|
|
118
|
+
// eslint-disable-next-line no-await-in-loop
|
|
119
|
+
const buffer = await downloadSource(context.connection, component.fullName);
|
|
120
|
+
// eslint-disable-next-line no-await-in-loop
|
|
121
|
+
const unpacked = await (0, computeSourceBundle_1.unpackComputeBundle)(buffer, contentPath);
|
|
122
|
+
this.logger.debug('unpacked %s: %d files into %s', component.fullName, unpacked.fileCount, contentPath);
|
|
123
|
+
fileResponses.push({
|
|
124
|
+
fullName: component.fullName,
|
|
125
|
+
type: component.type.name,
|
|
126
|
+
state: types_1.ComponentStatus.Changed,
|
|
127
|
+
filePath: contentPath,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
catch (err) {
|
|
131
|
+
fileResponses.push({
|
|
132
|
+
fullName: component.fullName,
|
|
133
|
+
type: component.type.name,
|
|
134
|
+
state: types_1.ComponentStatus.Failed,
|
|
135
|
+
filePath: component.content ?? component.xml ?? '',
|
|
136
|
+
error: `Heroku Compute download failed for '${component.fullName}': ${err.message}`,
|
|
137
|
+
problemType: 'Error',
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return this.checkForFailures(fileResponses, 'download');
|
|
142
|
+
}
|
|
143
|
+
// eslint-disable-next-line class-methods-use-this
|
|
144
|
+
assertComputeComponent(component) {
|
|
145
|
+
if (!component.content) {
|
|
146
|
+
throw new core_1.SfError(`HerokuComputeTransport requires a content path for '${component.fullName}'`, 'MissingComponentContent');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// eslint-disable-next-line class-methods-use-this
|
|
150
|
+
checkForFailures(fileResponses, operation) {
|
|
151
|
+
const failures = fileResponses.filter((r) => r.state === types_1.ComponentStatus.Failed);
|
|
152
|
+
if (failures.length > 0) {
|
|
153
|
+
const details = failures.map((f) => f.error ?? f.fullName).join('; ');
|
|
154
|
+
const error = new core_1.SfError(`Heroku Compute ${operation} failed: ${details}`, `HerokuCompute${operation.charAt(0).toUpperCase() + operation.slice(1)}Error`);
|
|
155
|
+
error.data = fileResponses;
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
return { fileResponses };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
exports.HerokuComputeTransport = HerokuComputeTransport;
|
|
162
|
+
//# sourceMappingURL=herokuComputeTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"herokuComputeTransport.js","sourceRoot":"","sources":["../../../../src/client/transports/herokuComputeTransport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;AAEH,yCAAiC;AACjC,0DAAiC;AACjC,2CAAmD;AAEnD,sDAAmE;AAEnE,oCAAyD;AAEzD,+D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,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACtE,MAAM,KAAK,GAAG,IAAI,cAAO,CACvB,kBAAkB,SAAS,YAAY,OAAO,EAAE,EAChD,gBAAgB,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAC9E,CAAC;YACF,KAAK,CAAC,IAAI,GAAG,aAAa,CAAC;YAC3B,MAAM,KAAK,CAAC;QACd,CAAC;QAED,OAAO,EAAE,aAAa,EAAE,CAAC;IAC3B,CAAC;CACF;AAtID,wDAsIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { TransportStageEvent } from './transportPipeline';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2026, Salesforce, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/transports/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RequestStatus } from '../types';
|
|
2
|
+
import { DeployResult } from '../metadataApiDeploy';
|
|
3
|
+
import { RetrieveResult } from '../metadataApiRetrieve';
|
|
4
|
+
import { TransportContext } from './types';
|
|
5
|
+
import { TransportGroup, TransportPipeline } from './transportPipeline';
|
|
6
|
+
type TransportOperation = 'deploy' | 'retrieve';
|
|
7
|
+
type TransportResult = DeployResult | RetrieveResult;
|
|
8
|
+
export declare class TransportCoordinator {
|
|
9
|
+
private readonly pipeline;
|
|
10
|
+
private readonly groups;
|
|
11
|
+
private readonly context;
|
|
12
|
+
private readonly operation;
|
|
13
|
+
private beforeMetadataResults;
|
|
14
|
+
private readonly beforeAdded;
|
|
15
|
+
private readonly afterStarted;
|
|
16
|
+
constructor(pipeline: TransportPipeline, groups: TransportGroup[], context: TransportContext, operation: TransportOperation);
|
|
17
|
+
runBeforeMetadata(): Promise<void>;
|
|
18
|
+
processResult(result: TransportResult, status: RequestStatus): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2026, Salesforce, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.TransportCoordinator = void 0;
|
|
19
|
+
const types_1 = require("../types");
|
|
20
|
+
const metadataApiRetrieve_1 = require("../metadataApiRetrieve");
|
|
21
|
+
class TransportCoordinator {
|
|
22
|
+
pipeline;
|
|
23
|
+
groups;
|
|
24
|
+
context;
|
|
25
|
+
operation;
|
|
26
|
+
beforeMetadataResults = { fileResponses: [], asyncHandles: [] };
|
|
27
|
+
beforeAdded = new WeakSet();
|
|
28
|
+
afterStarted = new WeakSet();
|
|
29
|
+
constructor(pipeline, groups, context, operation) {
|
|
30
|
+
this.pipeline = pipeline;
|
|
31
|
+
this.groups = groups;
|
|
32
|
+
this.context = context;
|
|
33
|
+
this.operation = operation;
|
|
34
|
+
}
|
|
35
|
+
async runBeforeMetadata() {
|
|
36
|
+
const result = await this.pipeline.runBeforeMetadata(this.context, this.groups, this.operation);
|
|
37
|
+
this.beforeMetadataResults = result;
|
|
38
|
+
}
|
|
39
|
+
async processResult(result, status) {
|
|
40
|
+
if (!this.beforeAdded.has(result)) {
|
|
41
|
+
this.beforeAdded.add(result);
|
|
42
|
+
result.addTransportResults(this.beforeMetadataResults.fileResponses, this.beforeMetadataResults.asyncHandles);
|
|
43
|
+
}
|
|
44
|
+
if (status !== types_1.RequestStatus.Succeeded)
|
|
45
|
+
return;
|
|
46
|
+
if (this.afterStarted.has(result))
|
|
47
|
+
return;
|
|
48
|
+
this.afterStarted.add(result);
|
|
49
|
+
if (this.operation === 'retrieve' && result instanceof metadataApiRetrieve_1.RetrieveResult) {
|
|
50
|
+
const extractedByKey = new Map(result.components
|
|
51
|
+
.getSourceComponents()
|
|
52
|
+
.toArray()
|
|
53
|
+
.map((component) => [`${component.type.name}#${component.fullName}`, component]));
|
|
54
|
+
for (const group of this.groups) {
|
|
55
|
+
group.components = group.components.map((component) => extractedByKey.get(`${component.type.name}#${component.fullName}`) ?? component);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const afterMetadataResults = await this.pipeline.runAfterMetadata(this.context, this.groups, this.operation);
|
|
59
|
+
result.addTransportResults(afterMetadataResults.fileResponses, afterMetadataResults.asyncHandles);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.TransportCoordinator = TransportCoordinator;
|
|
63
|
+
//# sourceMappingURL=transportCoordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transportCoordinator.js","sourceRoot":"","sources":["../../../../src/client/transports/transportCoordinator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,oCAAyC;AAEzC,gEAAwD;AAOxD,MAAa,oBAAoB;IAMZ;IACA;IACA;IACA;IARX,qBAAqB,GAA4B,EAAE,aAAa,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IAChF,WAAW,GAAG,IAAI,OAAO,EAAmB,CAAC;IAC7C,YAAY,GAAG,IAAI,OAAO,EAAmB,CAAC;IAE/D,YACmB,QAA2B,EAC3B,MAAwB,EACxB,OAAyB,EACzB,SAA6B;QAH7B,aAAQ,GAAR,QAAQ,CAAmB;QAC3B,WAAM,GAAN,MAAM,CAAkB;QACxB,YAAO,GAAP,OAAO,CAAkB;QACzB,cAAS,GAAT,SAAS,CAAoB;IAC7C,CAAC;IAEG,KAAK,CAAC,iBAAiB;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAChG,IAAI,CAAC,qBAAqB,GAAG,MAAM,CAAC;IACtC,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,MAAuB,EAAE,MAAqB;QACvE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YAClC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAC7B,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,qBAAqB,CAAC,aAAa,EAAE,IAAI,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;QAChH,CAAC;QACD,IAAI,MAAM,KAAK,qBAAa,CAAC,SAAS;YAAE,OAAO;QAC/C,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,OAAO;QAC1C,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAE9B,IAAI,IAAI,CAAC,SAAS,KAAK,UAAU,IAAI,MAAM,YAAY,oCAAc,EAAE,CAAC;YACtE,MAAM,cAAc,GAAG,IAAI,GAAG,CAC5B,MAAM,CAAC,UAAU;iBACd,mBAAmB,EAAE;iBACrB,OAAO,EAAE;iBACT,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC,CACnF,CAAC;YACF,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CACrC,CAAC,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,SAAS,CAC/F,CAAC;YACJ,CAAC;QACH,CAAC;QAED,MAAM,oBAAoB,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7G,MAAM,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,aAAa,EAAE,oBAAoB,CAAC,YAAY,CAAC,CAAC;IACpG,CAAC;CACF;AA3CD,oDA2CC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { TransportName } from '../../registry/types';
|
|
2
|
+
import { SourceComponent } from '../../resolve/sourceComponent';
|
|
3
|
+
import { FileResponse } from '../types';
|
|
4
|
+
import { AsyncTransportHandle, TransportContext, TransportProvider } from './types';
|
|
5
|
+
export type TransportGroup = {
|
|
6
|
+
transport: TransportProvider;
|
|
7
|
+
components: SourceComponent[];
|
|
8
|
+
};
|
|
9
|
+
export type GroupedComponents = {
|
|
10
|
+
metadataApi: SourceComponent[];
|
|
11
|
+
transports: TransportGroup[];
|
|
12
|
+
};
|
|
13
|
+
export type TransportPlan = {
|
|
14
|
+
phases: TransportPlanPhase[];
|
|
15
|
+
};
|
|
16
|
+
export type TransportPlanPhase = {
|
|
17
|
+
phase: 'before-metadata' | 'metadata-api' | 'after-metadata';
|
|
18
|
+
label: string;
|
|
19
|
+
endpoint: string;
|
|
20
|
+
components: Array<{
|
|
21
|
+
fullName: string;
|
|
22
|
+
type: string;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
export type TransportPipelineResult = {
|
|
26
|
+
fileResponses: FileResponse[];
|
|
27
|
+
asyncHandles: AsyncTransportHandle[];
|
|
28
|
+
};
|
|
29
|
+
export type TransportStageEvent = {
|
|
30
|
+
transportName: TransportName;
|
|
31
|
+
label: string;
|
|
32
|
+
operation: 'deploy' | 'retrieve';
|
|
33
|
+
stage: 'start' | 'complete' | 'error';
|
|
34
|
+
componentCount: number;
|
|
35
|
+
componentNames: string[];
|
|
36
|
+
errorMessage?: string;
|
|
37
|
+
};
|
|
38
|
+
export declare class TransportPipeline {
|
|
39
|
+
private readonly transports;
|
|
40
|
+
private readonly logger;
|
|
41
|
+
constructor(transports?: TransportProvider[]);
|
|
42
|
+
static withBuiltinTransports(): TransportPipeline;
|
|
43
|
+
groupByTransport(components: SourceComponent[]): GroupedComponents;
|
|
44
|
+
explain(components: SourceComponent[], operation?: 'deploy' | 'retrieve'): TransportPlan;
|
|
45
|
+
runBeforeMetadata(context: TransportContext, groups: TransportGroup[], operation?: 'deploy' | 'retrieve'): Promise<TransportPipelineResult>;
|
|
46
|
+
runAfterMetadata(context: TransportContext, groups: TransportGroup[], operation?: 'deploy' | 'retrieve'): Promise<TransportPipelineResult>;
|
|
47
|
+
hasTransports(components: SourceComponent[]): boolean;
|
|
48
|
+
private findTransportFor;
|
|
49
|
+
private runTransportGroups;
|
|
50
|
+
}
|