@gapi/gcli 1.8.254 → 1.8.256
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/docs/changelog.d/2026-11-01-dedicated-platform-cluster-cluster-cost-prints-amounts-in-the-platform-currency-no-usd.md +10 -0
- package/docs/changelog.d/2026-11-03-cli-browser-login-gcli-login-without-token-logs-in-through-the-browser-mcp-sta.md +31 -0
- package/docs/changelog.d/2026-11-03-dedicated-platform-cluster-cluster-autoscale-profile-servertypes-step-cluster.autoscale.md +21 -0
- package/docs/changelog.d/2026-11-03-dedicated-platform-cluster-cluster-plan-cluster-autoscale-mode-consolidation-minnodeage.md +20 -0
- package/docs/changelog.d/2026-11-03-lambda-site-url-lambda-create-update-print-url-and-site.md +15 -0
- package/docs/features/README.md +2 -0
- package/docs/features/cli-browser-login.md +13 -0
- package/docs/features/dedicated-platform-cluster.md +3 -2
- package/docs/features/lambda-site-url.md +6 -0
- package/package.json +1 -1
- package/release/index.js +820 -381
package/release/index.js
CHANGED
|
@@ -12391,7 +12391,7 @@ var require_lastValueFrom = __commonJS({
|
|
|
12391
12391
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12392
12392
|
exports2.lastValueFrom = void 0;
|
|
12393
12393
|
var EmptyError_1 = require_EmptyError();
|
|
12394
|
-
function
|
|
12394
|
+
function lastValueFrom60(source, config2) {
|
|
12395
12395
|
var hasConfig = typeof config2 === "object";
|
|
12396
12396
|
return new Promise(function(resolve2, reject) {
|
|
12397
12397
|
var _hasValue = false;
|
|
@@ -12414,7 +12414,7 @@ var require_lastValueFrom = __commonJS({
|
|
|
12414
12414
|
});
|
|
12415
12415
|
});
|
|
12416
12416
|
}
|
|
12417
|
-
exports2.lastValueFrom =
|
|
12417
|
+
exports2.lastValueFrom = lastValueFrom60;
|
|
12418
12418
|
}
|
|
12419
12419
|
});
|
|
12420
12420
|
|
|
@@ -21369,7 +21369,7 @@ var require_lib = __commonJS({
|
|
|
21369
21369
|
var require_XMLHttpRequest = __commonJS({
|
|
21370
21370
|
"../../node_modules/xmlhttprequest/lib/XMLHttpRequest.js"(exports2) {
|
|
21371
21371
|
var Url = require("url");
|
|
21372
|
-
var
|
|
21372
|
+
var spawn5 = require("child_process").spawn;
|
|
21373
21373
|
var fs3 = require("fs");
|
|
21374
21374
|
exports2.XMLHttpRequest = function() {
|
|
21375
21375
|
"use strict";
|
|
@@ -21639,7 +21639,7 @@ var require_XMLHttpRequest = __commonJS({
|
|
|
21639
21639
|
var syncFile = ".node-xmlhttprequest-sync-" + process.pid;
|
|
21640
21640
|
fs3.writeFileSync(syncFile, "", "utf8");
|
|
21641
21641
|
var execString = "var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http" + (ssl ? "s" : "") + ".request;var options = " + JSON.stringify(options) + ";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('" + contentFile + "', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText}}), 'utf8');fs.unlinkSync('" + syncFile + "');});response.on('error', function(error) {fs.writeFileSync('" + contentFile + "', JSON.stringify({err: error}), 'utf8');fs.unlinkSync('" + syncFile + "');});}).on('error', function(error) {fs.writeFileSync('" + contentFile + "', JSON.stringify({err: error}), 'utf8');fs.unlinkSync('" + syncFile + "');});" + (data ? "req.write('" + JSON.stringify(data).slice(1, -1).replace(/'/g, "\\'") + "');" : "") + "req.end();";
|
|
21642
|
-
var syncProc =
|
|
21642
|
+
var syncProc = spawn5(process.argv[0], ["-e", execString]);
|
|
21643
21643
|
while (fs3.existsSync(syncFile)) {
|
|
21644
21644
|
}
|
|
21645
21645
|
var resp = JSON.parse(fs3.readFileSync(contentFile, "utf8"));
|
|
@@ -36015,7 +36015,7 @@ var init_types = __esm({
|
|
|
36015
36015
|
});
|
|
36016
36016
|
|
|
36017
36017
|
// src/commands/cluster/types.ts
|
|
36018
|
-
var ClusterChangeFragment, ClusterAutoscaleFragment, ClusterOverviewFragment, ClusterHealthFragment, ClusterScaleEventFragment, ClusterNodeFragment;
|
|
36018
|
+
var ClusterChangeFragment, ClusterAutoscaleFragment, ClusterOverviewFragment, ClusterHealthFragment, ClusterScaleEventFragment, SCALING_PROFILES, ClusterNodeFragment;
|
|
36019
36019
|
var init_types2 = __esm({
|
|
36020
36020
|
"src/commands/cluster/types.ts"() {
|
|
36021
36021
|
ClusterChangeFragment = `
|
|
@@ -36036,6 +36036,27 @@ error
|
|
|
36036
36036
|
`;
|
|
36037
36037
|
ClusterAutoscaleFragment = `
|
|
36038
36038
|
enabled
|
|
36039
|
+
scalingProfile
|
|
36040
|
+
serverTypes
|
|
36041
|
+
scaleUpStep
|
|
36042
|
+
mode
|
|
36043
|
+
consolidation
|
|
36044
|
+
minNodeAgeMinutes
|
|
36045
|
+
pools {
|
|
36046
|
+
name
|
|
36047
|
+
serverTypes
|
|
36048
|
+
labels {
|
|
36049
|
+
key
|
|
36050
|
+
value
|
|
36051
|
+
}
|
|
36052
|
+
taints {
|
|
36053
|
+
key
|
|
36054
|
+
value
|
|
36055
|
+
effect
|
|
36056
|
+
}
|
|
36057
|
+
maxWorkers
|
|
36058
|
+
weight
|
|
36059
|
+
}
|
|
36039
36060
|
minWorkers
|
|
36040
36061
|
maxWorkers
|
|
36041
36062
|
cpuScaleUpPercent
|
|
@@ -36082,10 +36103,9 @@ monthToDate {
|
|
|
36082
36103
|
period
|
|
36083
36104
|
nodeHours
|
|
36084
36105
|
loadBalancerHours
|
|
36085
|
-
|
|
36086
|
-
totalCostUsd
|
|
36106
|
+
totalCost
|
|
36087
36107
|
}
|
|
36088
|
-
|
|
36108
|
+
estimatedMonthlyCost
|
|
36089
36109
|
issues {
|
|
36090
36110
|
severity
|
|
36091
36111
|
code
|
|
@@ -36134,6 +36154,12 @@ memRequestsPercent
|
|
|
36134
36154
|
pendingPods
|
|
36135
36155
|
error
|
|
36136
36156
|
`;
|
|
36157
|
+
SCALING_PROFILES = [
|
|
36158
|
+
"conservative",
|
|
36159
|
+
"balanced",
|
|
36160
|
+
"aggressive",
|
|
36161
|
+
"custom"
|
|
36162
|
+
];
|
|
36137
36163
|
ClusterNodeFragment = `
|
|
36138
36164
|
name
|
|
36139
36165
|
pool
|
|
@@ -37200,6 +37226,47 @@ var init_gql_client = __esm({
|
|
|
37200
37226
|
variables: { projectId, clusterId, input }
|
|
37201
37227
|
}).pipe((0, import_operators.map)((res) => res.updateProjectClusterAutoscale));
|
|
37202
37228
|
}
|
|
37229
|
+
/** Plan 17: why pods are pending and what pods mode would do. */
|
|
37230
|
+
static clusterProvisioningPlan(projectId, clusterId) {
|
|
37231
|
+
return this.query({
|
|
37232
|
+
query: gql`
|
|
37233
|
+
query clusterProvisioningPlan(
|
|
37234
|
+
$projectId: String!
|
|
37235
|
+
$clusterId: String!
|
|
37236
|
+
) {
|
|
37237
|
+
clusterProvisioningPlan(
|
|
37238
|
+
projectId: $projectId
|
|
37239
|
+
clusterId: $clusterId
|
|
37240
|
+
) {
|
|
37241
|
+
mode
|
|
37242
|
+
enabled
|
|
37243
|
+
agentReportsPods
|
|
37244
|
+
sampleAt
|
|
37245
|
+
note
|
|
37246
|
+
addedMonthly
|
|
37247
|
+
verdicts {
|
|
37248
|
+
pod
|
|
37249
|
+
status
|
|
37250
|
+
reason
|
|
37251
|
+
}
|
|
37252
|
+
claims {
|
|
37253
|
+
pool
|
|
37254
|
+
type
|
|
37255
|
+
price
|
|
37256
|
+
pods
|
|
37257
|
+
}
|
|
37258
|
+
consolidation {
|
|
37259
|
+
action
|
|
37260
|
+
node
|
|
37261
|
+
reason
|
|
37262
|
+
savingMonthly
|
|
37263
|
+
}
|
|
37264
|
+
}
|
|
37265
|
+
}
|
|
37266
|
+
`,
|
|
37267
|
+
variables: { projectId, clusterId }
|
|
37268
|
+
}).pipe((0, import_operators.map)((res) => res.clusterProvisioningPlan));
|
|
37269
|
+
}
|
|
37203
37270
|
/** projectClusters with the fields cluster:apply compares. */
|
|
37204
37271
|
static projectClustersDetailed(projectId) {
|
|
37205
37272
|
return this.query({
|
|
@@ -37917,12 +37984,101 @@ var init_helpers = __esm({
|
|
|
37917
37984
|
}
|
|
37918
37985
|
});
|
|
37919
37986
|
|
|
37987
|
+
// src/commands/auth/browser-login.ts
|
|
37988
|
+
var import_child_process, import_os2, anonymous, startBrowserLogin, pollBrowserLogin, openInBrowser, sleep, waitForApproval, browserLogin;
|
|
37989
|
+
var init_browser_login = __esm({
|
|
37990
|
+
"src/commands/auth/browser-login.ts"() {
|
|
37991
|
+
import_child_process = require("child_process");
|
|
37992
|
+
import_os2 = require("os");
|
|
37993
|
+
init_log();
|
|
37994
|
+
anonymous = async (url2, query, variables) => {
|
|
37995
|
+
const res = await fetch(url2, {
|
|
37996
|
+
method: "POST",
|
|
37997
|
+
headers: { "Content-Type": "application/json", Accept: "application/json" },
|
|
37998
|
+
body: JSON.stringify({ query, variables })
|
|
37999
|
+
});
|
|
38000
|
+
const body = await res.json().catch(() => ({}));
|
|
38001
|
+
if (body.errors?.length) {
|
|
38002
|
+
throw new Error(body.errors.map((e2) => e2.message).join("; "));
|
|
38003
|
+
}
|
|
38004
|
+
if (!body.data) {
|
|
38005
|
+
throw new Error(`${url2} answered ${res.status} without data`);
|
|
38006
|
+
}
|
|
38007
|
+
return body.data;
|
|
38008
|
+
};
|
|
38009
|
+
startBrowserLogin = (url2) => anonymous(
|
|
38010
|
+
url2,
|
|
38011
|
+
`mutation startCliLogin($hostname: String, $platform: String, $apiUrl: String) {
|
|
38012
|
+
startCliLogin(hostname: $hostname, platform: $platform, apiUrl: $apiUrl) {
|
|
38013
|
+
sessionId userCode verificationUrl expiresAt pollIntervalSeconds
|
|
38014
|
+
}
|
|
38015
|
+
}`,
|
|
38016
|
+
{ hostname: (0, import_os2.hostname)(), platform: (0, import_os2.platform)(), apiUrl: url2 }
|
|
38017
|
+
).then((d) => d.startCliLogin);
|
|
38018
|
+
pollBrowserLogin = (url2, sessionId) => anonymous(
|
|
38019
|
+
url2,
|
|
38020
|
+
`mutation pollCliLogin($sessionId: String!) {
|
|
38021
|
+
pollCliLogin(sessionId: $sessionId) { status token key }
|
|
38022
|
+
}`,
|
|
38023
|
+
{ sessionId }
|
|
38024
|
+
).then((d) => d.pollCliLogin);
|
|
38025
|
+
openInBrowser = (link) => {
|
|
38026
|
+
const [cmd, args] = process.platform === "darwin" ? ["open", [link]] : process.platform === "win32" ? ["cmd", ["/c", "start", '""', link]] : ["xdg-open", [link]];
|
|
38027
|
+
try {
|
|
38028
|
+
const child = (0, import_child_process.spawn)(cmd, args, { stdio: "ignore", detached: true });
|
|
38029
|
+
child.on("error", () => void 0);
|
|
38030
|
+
child.unref();
|
|
38031
|
+
} catch {
|
|
38032
|
+
}
|
|
38033
|
+
};
|
|
38034
|
+
sleep = (ms) => new Promise((r2) => setTimeout(r2, ms));
|
|
38035
|
+
waitForApproval = async (url2, start3, pollMs) => {
|
|
38036
|
+
const every = pollMs ?? Math.max(1, start3.pollIntervalSeconds ?? 2) * 1e3;
|
|
38037
|
+
const deadline = start3.expiresAt ? new Date(start3.expiresAt).getTime() : Date.now() + 10 * 6e4;
|
|
38038
|
+
while (Date.now() < deadline + every) {
|
|
38039
|
+
await sleep(every);
|
|
38040
|
+
let poll;
|
|
38041
|
+
try {
|
|
38042
|
+
poll = await pollBrowserLogin(url2, start3.sessionId);
|
|
38043
|
+
} catch {
|
|
38044
|
+
continue;
|
|
38045
|
+
}
|
|
38046
|
+
if (poll.status === "approved" && poll.token && poll.key) {
|
|
38047
|
+
return { token: poll.token, key: poll.key };
|
|
38048
|
+
}
|
|
38049
|
+
if (poll.status === "denied") {
|
|
38050
|
+
throw new Error("The login was denied in the browser.");
|
|
38051
|
+
}
|
|
38052
|
+
if (poll.status === "expired") {
|
|
38053
|
+
break;
|
|
38054
|
+
}
|
|
38055
|
+
}
|
|
38056
|
+
throw new Error("The login link expired. Run `gcli login` again.");
|
|
38057
|
+
};
|
|
38058
|
+
browserLogin = async (url2, options = {}) => {
|
|
38059
|
+
const print = options.print ?? ((line) => Logger.log(line));
|
|
38060
|
+
const start3 = await startBrowserLogin(url2);
|
|
38061
|
+
print("");
|
|
38062
|
+
print("Log in to Lambforge from your browser:");
|
|
38063
|
+
print(` ${start3.verificationUrl}`);
|
|
38064
|
+
print(` Code: ${start3.userCode} (check it matches the page)`);
|
|
38065
|
+
print("");
|
|
38066
|
+
if (options.openBrowser !== false) {
|
|
38067
|
+
openInBrowser(start3.verificationUrl);
|
|
38068
|
+
}
|
|
38069
|
+
print("Waiting for approval... (Ctrl+C to cancel)");
|
|
38070
|
+
return waitForApproval(url2, start3, options.pollMs);
|
|
38071
|
+
};
|
|
38072
|
+
}
|
|
38073
|
+
});
|
|
38074
|
+
|
|
37920
38075
|
// src/commands/auth/login.ts
|
|
37921
38076
|
var login_exports = {};
|
|
37922
38077
|
__export(login_exports, {
|
|
37923
|
-
default: () => login_default
|
|
38078
|
+
default: () => login_default,
|
|
38079
|
+
loginWithToken: () => loginWithToken
|
|
37924
38080
|
});
|
|
37925
|
-
var import_fs2, import_rxjs4, import_operators3, import_util2, MainLambforgeAPI, login_default;
|
|
38081
|
+
var import_fs2, import_rxjs4, import_operators3, import_util2, MainLambforgeAPI, login_default, loginWithToken;
|
|
37926
38082
|
var init_login = __esm({
|
|
37927
38083
|
"src/commands/auth/login.ts"() {
|
|
37928
38084
|
import_fs2 = require("fs");
|
|
@@ -37932,8 +38088,23 @@ var init_login = __esm({
|
|
|
37932
38088
|
init_log();
|
|
37933
38089
|
init_types();
|
|
37934
38090
|
init_gql_client();
|
|
38091
|
+
init_browser_login();
|
|
37935
38092
|
MainLambforgeAPI = "https://api.lambforge.com";
|
|
37936
|
-
login_default = (cmd) =>
|
|
38093
|
+
login_default = async (cmd) => {
|
|
38094
|
+
if (!cmd.token && !cmd.ci) {
|
|
38095
|
+
const { token, key } = await browserLogin(cmd.url || MainLambforgeAPI, {
|
|
38096
|
+
openBrowser: cmd.browser !== false
|
|
38097
|
+
});
|
|
38098
|
+
return loginWithToken({ ...cmd, token, key: cmd.key || key });
|
|
38099
|
+
}
|
|
38100
|
+
if (!cmd.key && !cmd.ci) {
|
|
38101
|
+
throw new Error(
|
|
38102
|
+
"--key is required with --token (or run `gcli login` alone to log in through the browser)"
|
|
38103
|
+
);
|
|
38104
|
+
}
|
|
38105
|
+
return loginWithToken(cmd);
|
|
38106
|
+
};
|
|
38107
|
+
loginWithToken = (cmd) => (0, import_rxjs4.lastValueFrom)(
|
|
37937
38108
|
(0, import_rxjs4.of)(GraphqlClienAPI.init(cmd.key)).pipe(
|
|
37938
38109
|
(0, import_operators3.switchMap)(
|
|
37939
38110
|
() => (0, import_rxjs4.from)((0, import_util2.promisify)(import_fs2.mkdir)(mainDirectory)).pipe(
|
|
@@ -37988,7 +38159,7 @@ var init_login = __esm({
|
|
|
37988
38159
|
]).pipe((0, import_operators3.map)(() => user))
|
|
37989
38160
|
),
|
|
37990
38161
|
(0, import_operators3.tap)(
|
|
37991
|
-
(user) => Logger.log(
|
|
38162
|
+
(user) => cmd.silent || Logger.log(
|
|
37992
38163
|
"Logged in as",
|
|
37993
38164
|
`"${user?.displayName}"`,
|
|
37994
38165
|
"with email",
|
|
@@ -44558,10 +44729,10 @@ var require_typescript = __commonJS({
|
|
|
44558
44729
|
Debug2.loggingHost.log(level, s2);
|
|
44559
44730
|
}
|
|
44560
44731
|
}
|
|
44561
|
-
function
|
|
44732
|
+
function log2(s2) {
|
|
44562
44733
|
logMessage(3, s2);
|
|
44563
44734
|
}
|
|
44564
|
-
Debug2.log =
|
|
44735
|
+
Debug2.log = log2;
|
|
44565
44736
|
((_log) => {
|
|
44566
44737
|
function error210(s2) {
|
|
44567
44738
|
logMessage(1, s2);
|
|
@@ -44571,15 +44742,15 @@ var require_typescript = __commonJS({
|
|
|
44571
44742
|
logMessage(2, s2);
|
|
44572
44743
|
}
|
|
44573
44744
|
_log.warn = warn;
|
|
44574
|
-
function
|
|
44745
|
+
function log22(s2) {
|
|
44575
44746
|
logMessage(3, s2);
|
|
44576
44747
|
}
|
|
44577
|
-
_log.log =
|
|
44748
|
+
_log.log = log22;
|
|
44578
44749
|
function trace2(s2) {
|
|
44579
44750
|
logMessage(4, s2);
|
|
44580
44751
|
}
|
|
44581
44752
|
_log.trace = trace2;
|
|
44582
|
-
})(
|
|
44753
|
+
})(log2 = Debug2.log || (Debug2.log = {}));
|
|
44583
44754
|
const assertionCache = {};
|
|
44584
44755
|
function getAssertionLevel() {
|
|
44585
44756
|
return currentAssertionLevel;
|
|
@@ -49333,7 +49504,7 @@ ${lanes.join("\n")}
|
|
|
49333
49504
|
const isMacOs = process.platform === "darwin";
|
|
49334
49505
|
const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
|
|
49335
49506
|
const statSyncOptions = { throwIfNoEntry: false };
|
|
49336
|
-
const
|
|
49507
|
+
const platform2 = _os.platform();
|
|
49337
49508
|
const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
|
|
49338
49509
|
const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
49339
49510
|
const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
|
|
@@ -49538,7 +49709,7 @@ ${lanes.join("\n")}
|
|
|
49538
49709
|
}
|
|
49539
49710
|
}
|
|
49540
49711
|
function isFileSystemCaseSensitive() {
|
|
49541
|
-
if (
|
|
49712
|
+
if (platform2 === "win32" || platform2 === "win64") {
|
|
49542
49713
|
return false;
|
|
49543
49714
|
}
|
|
49544
49715
|
return !fileExists(swapCase(__filename));
|
|
@@ -175897,8 +176068,8 @@ ${lanes.join("\n")}
|
|
|
175897
176068
|
WatchLogLevel2[WatchLogLevel2["Verbose"] = 2] = "Verbose";
|
|
175898
176069
|
return WatchLogLevel2;
|
|
175899
176070
|
})(WatchLogLevel || {});
|
|
175900
|
-
function getWatchFactory(host, watchLogLevel,
|
|
175901
|
-
setSysLog(watchLogLevel === 2 ?
|
|
176071
|
+
function getWatchFactory(host, watchLogLevel, log2, getDetailWatchInfo2) {
|
|
176072
|
+
setSysLog(watchLogLevel === 2 ? log2 : noop3);
|
|
175902
176073
|
const plainInvokeFactory = {
|
|
175903
176074
|
watchFile: (file2, callback, pollingInterval, options) => host.watchFile(file2, callback, pollingInterval, options),
|
|
175904
176075
|
watchDirectory: (directory, callback, flags, options) => host.watchDirectory(directory, callback, (flags & 1) !== 0, options)
|
|
@@ -175935,36 +176106,36 @@ ${lanes.join("\n")}
|
|
|
175935
176106
|
return typeof host.useCaseSensitiveFileNames === "boolean" ? host.useCaseSensitiveFileNames : host.useCaseSensitiveFileNames();
|
|
175936
176107
|
}
|
|
175937
176108
|
function createExcludeWatcherWithLogging(file2, flags, options, detailInfo1, detailInfo2) {
|
|
175938
|
-
|
|
176109
|
+
log2(`ExcludeWatcher:: Added:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
175939
176110
|
return {
|
|
175940
|
-
close: () =>
|
|
176111
|
+
close: () => log2(`ExcludeWatcher:: Close:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`)
|
|
175941
176112
|
};
|
|
175942
176113
|
}
|
|
175943
176114
|
function createFileWatcherWithLogging(file2, cb, flags, options, detailInfo1, detailInfo2) {
|
|
175944
|
-
|
|
176115
|
+
log2(`FileWatcher:: Added:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
175945
176116
|
const watcher = triggerInvokingFactory.watchFile(file2, cb, flags, options, detailInfo1, detailInfo2);
|
|
175946
176117
|
return {
|
|
175947
176118
|
close: () => {
|
|
175948
|
-
|
|
176119
|
+
log2(`FileWatcher:: Close:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
175949
176120
|
watcher.close();
|
|
175950
176121
|
}
|
|
175951
176122
|
};
|
|
175952
176123
|
}
|
|
175953
176124
|
function createDirectoryWatcherWithLogging(file2, cb, flags, options, detailInfo1, detailInfo2) {
|
|
175954
176125
|
const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
175955
|
-
|
|
176126
|
+
log2(watchInfo);
|
|
175956
176127
|
const start3 = timestamp();
|
|
175957
176128
|
const watcher = triggerInvokingFactory.watchDirectory(file2, cb, flags, options, detailInfo1, detailInfo2);
|
|
175958
176129
|
const elapsed = timestamp() - start3;
|
|
175959
|
-
|
|
176130
|
+
log2(`Elapsed:: ${elapsed}ms ${watchInfo}`);
|
|
175960
176131
|
return {
|
|
175961
176132
|
close: () => {
|
|
175962
176133
|
const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
175963
|
-
|
|
176134
|
+
log2(watchInfo2);
|
|
175964
176135
|
const start22 = timestamp();
|
|
175965
176136
|
watcher.close();
|
|
175966
176137
|
const elapsed2 = timestamp() - start22;
|
|
175967
|
-
|
|
176138
|
+
log2(`Elapsed:: ${elapsed2}ms ${watchInfo2}`);
|
|
175968
176139
|
}
|
|
175969
176140
|
};
|
|
175970
176141
|
}
|
|
@@ -175975,7 +176146,7 @@ ${lanes.join("\n")}
|
|
|
175975
176146
|
file2,
|
|
175976
176147
|
(...args) => {
|
|
175977
176148
|
const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
175978
|
-
|
|
176149
|
+
log2(triggerredInfo);
|
|
175979
176150
|
const start3 = timestamp();
|
|
175980
176151
|
cb.call(
|
|
175981
176152
|
/*thisArg*/
|
|
@@ -175983,7 +176154,7 @@ ${lanes.join("\n")}
|
|
|
175983
176154
|
...args
|
|
175984
176155
|
);
|
|
175985
176156
|
const elapsed = timestamp() - start3;
|
|
175986
|
-
|
|
176157
|
+
log2(`Elapsed:: ${elapsed}ms ${triggerredInfo}`);
|
|
175987
176158
|
},
|
|
175988
176159
|
flags,
|
|
175989
176160
|
options,
|
|
@@ -189054,7 +189225,7 @@ ${lanes.join("\n")}
|
|
|
189054
189225
|
}
|
|
189055
189226
|
return void 0;
|
|
189056
189227
|
}
|
|
189057
|
-
function discoverTypings(host,
|
|
189228
|
+
function discoverTypings(host, log2, fileNames, projectRootPath, safeList, packageNameToTypingLocation, typeAcquisition, unresolvedImports, typesRegistry, compilerOptions) {
|
|
189058
189229
|
if (!typeAcquisition || !typeAcquisition.enable) {
|
|
189059
189230
|
return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };
|
|
189060
189231
|
}
|
|
@@ -189089,7 +189260,7 @@ ${lanes.join("\n")}
|
|
|
189089
189260
|
}
|
|
189090
189261
|
for (const excludeTypingName of exclude) {
|
|
189091
189262
|
const didDelete = inferredTypings.delete(excludeTypingName);
|
|
189092
|
-
if (didDelete &&
|
|
189263
|
+
if (didDelete && log2) log2(`Typing for ${excludeTypingName} is in exclude list, will be ignored.`);
|
|
189093
189264
|
}
|
|
189094
189265
|
packageNameToTypingLocation.forEach((typing, name2) => {
|
|
189095
189266
|
const registryEntry = typesRegistry.get(name2);
|
|
@@ -189107,7 +189278,7 @@ ${lanes.join("\n")}
|
|
|
189107
189278
|
}
|
|
189108
189279
|
});
|
|
189109
189280
|
const result = { cachedTypingPaths, newTypingNames, filesToWatch };
|
|
189110
|
-
if (
|
|
189281
|
+
if (log2) log2(`Finished typings discovery:${stringifyIndented(result)}`);
|
|
189111
189282
|
return result;
|
|
189112
189283
|
function addInferredTyping(typingName) {
|
|
189113
189284
|
if (!inferredTypings.has(typingName)) {
|
|
@@ -189115,7 +189286,7 @@ ${lanes.join("\n")}
|
|
|
189115
189286
|
}
|
|
189116
189287
|
}
|
|
189117
189288
|
function addInferredTypings(typingNames, message) {
|
|
189118
|
-
if (
|
|
189289
|
+
if (log2) log2(`${message}: ${JSON.stringify(typingNames)}`);
|
|
189119
189290
|
forEach(typingNames, addInferredTyping);
|
|
189120
189291
|
}
|
|
189121
189292
|
function getTypingNames(projectRootPath2, manifestName, modulesDirName, filesToWatch2) {
|
|
@@ -189155,7 +189326,7 @@ ${lanes.join("\n")}
|
|
|
189155
189326
|
return isScoped && toFileNameLowerCase(pathComponents2[pathComponents2.length - 4]) === modulesDirName || // `node_modules/@foo/bar`
|
|
189156
189327
|
!isScoped && toFileNameLowerCase(pathComponents2[pathComponents2.length - 3]) === modulesDirName;
|
|
189157
189328
|
});
|
|
189158
|
-
if (
|
|
189329
|
+
if (log2) log2(`Searching for typing names in ${packagesFolderPath}; all files: ${JSON.stringify(dependencyManifestNames)}`);
|
|
189159
189330
|
for (const manifestPath2 of dependencyManifestNames) {
|
|
189160
189331
|
const normalizedFileName = normalizePath(manifestPath2);
|
|
189161
189332
|
const result2 = readConfigFile(normalizedFileName, (path2) => host.readFile(path2));
|
|
@@ -189167,10 +189338,10 @@ ${lanes.join("\n")}
|
|
|
189167
189338
|
if (ownTypes) {
|
|
189168
189339
|
const absolutePath = getNormalizedAbsolutePath(ownTypes, getDirectoryPath(normalizedFileName));
|
|
189169
189340
|
if (host.fileExists(absolutePath)) {
|
|
189170
|
-
if (
|
|
189341
|
+
if (log2) log2(` Package '${manifest2.name}' provides its own types.`);
|
|
189171
189342
|
inferredTypings.set(manifest2.name, absolutePath);
|
|
189172
189343
|
} else {
|
|
189173
|
-
if (
|
|
189344
|
+
if (log2) log2(` Package '${manifest2.name}' provides its own types but they are missing.`);
|
|
189174
189345
|
}
|
|
189175
189346
|
} else {
|
|
189176
189347
|
packageNames.push(manifest2.name);
|
|
@@ -189194,7 +189365,7 @@ ${lanes.join("\n")}
|
|
|
189194
189365
|
/* Jsx */
|
|
189195
189366
|
));
|
|
189196
189367
|
if (hasJsxFile) {
|
|
189197
|
-
if (
|
|
189368
|
+
if (log2) log2(`Inferred 'react' typings due to presence of '.jsx' extension`);
|
|
189198
189369
|
addInferredTyping("react");
|
|
189199
189370
|
}
|
|
189200
189371
|
}
|
|
@@ -203582,7 +203753,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
203582
203753
|
const cancellationToken = host.getCancellationToken ? new CancellationTokenObject(host.getCancellationToken()) : NoopCancellationToken;
|
|
203583
203754
|
const currentDirectory = host.getCurrentDirectory();
|
|
203584
203755
|
maybeSetLocalizedDiagnosticMessages((_a2 = host.getLocalizedDiagnosticMessages) == null ? void 0 : _a2.bind(host));
|
|
203585
|
-
function
|
|
203756
|
+
function log2(message) {
|
|
203586
203757
|
if (host.log) {
|
|
203587
203758
|
host.log(message);
|
|
203588
203759
|
}
|
|
@@ -203597,7 +203768,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
203597
203768
|
readFile: maybeBind(host, host.readFile),
|
|
203598
203769
|
getDocumentPositionMapper: maybeBind(host, host.getDocumentPositionMapper),
|
|
203599
203770
|
getSourceFileLike: maybeBind(host, host.getSourceFileLike),
|
|
203600
|
-
log
|
|
203771
|
+
log: log2
|
|
203601
203772
|
});
|
|
203602
203773
|
function getValidSourceFile(fileName) {
|
|
203603
203774
|
const sourceFile = program2.getSourceFile(fileName);
|
|
@@ -203632,7 +203803,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
203632
203803
|
}
|
|
203633
203804
|
const typeRootsVersion = host.getTypeRootsVersion ? host.getTypeRootsVersion() : 0;
|
|
203634
203805
|
if (lastTypesRootVersion !== typeRootsVersion) {
|
|
203635
|
-
|
|
203806
|
+
log2("TypeRoots version has changed; provide new program");
|
|
203636
203807
|
program2 = void 0;
|
|
203637
203808
|
lastTypesRootVersion = typeRootsVersion;
|
|
203638
203809
|
}
|
|
@@ -204002,7 +204173,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
204002
204173
|
return ts_Completions_exports.getCompletionsAtPosition(
|
|
204003
204174
|
host,
|
|
204004
204175
|
program2,
|
|
204005
|
-
|
|
204176
|
+
log2,
|
|
204006
204177
|
getValidSourceFile(fileName),
|
|
204007
204178
|
position,
|
|
204008
204179
|
fullPreferences,
|
|
@@ -204017,7 +204188,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
204017
204188
|
synchronizeHostData();
|
|
204018
204189
|
return ts_Completions_exports.getCompletionEntryDetails(
|
|
204019
204190
|
program2,
|
|
204020
|
-
|
|
204191
|
+
log2,
|
|
204021
204192
|
getValidSourceFile(fileName),
|
|
204022
204193
|
position,
|
|
204023
204194
|
{ name: name2, source, data },
|
|
@@ -204030,7 +204201,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
204030
204201
|
}
|
|
204031
204202
|
function getCompletionEntrySymbol2(fileName, position, name2, source, preferences = emptyOptions) {
|
|
204032
204203
|
synchronizeHostData();
|
|
204033
|
-
return ts_Completions_exports.getCompletionEntrySymbol(program2,
|
|
204204
|
+
return ts_Completions_exports.getCompletionEntrySymbol(program2, log2, getValidSourceFile(fileName), position, { name: name2, source }, host, preferences);
|
|
204034
204205
|
}
|
|
204035
204206
|
function getQuickInfoAtPosition(fileName, position, maximumLength, verbosityLevel) {
|
|
204036
204207
|
synchronizeHostData();
|
|
@@ -204335,10 +204506,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
204335
204506
|
let start3 = timestamp();
|
|
204336
204507
|
const settings = toEditorSettings(editorOptions);
|
|
204337
204508
|
const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
|
204338
|
-
|
|
204509
|
+
log2("getIndentationAtPosition: getCurrentSourceFile: " + (timestamp() - start3));
|
|
204339
204510
|
start3 = timestamp();
|
|
204340
204511
|
const result = ts_formatting_exports.SmartIndenter.getIndentation(position, sourceFile, settings);
|
|
204341
|
-
|
|
204512
|
+
log2("getIndentationAtPosition: computeIndentation : " + (timestamp() - start3));
|
|
204342
204513
|
return result;
|
|
204343
204514
|
}
|
|
204344
204515
|
function getFormattingEditsForRange(fileName, start3, end, options) {
|
|
@@ -218092,7 +218263,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
218092
218263
|
}
|
|
218093
218264
|
return allCommitCharacters;
|
|
218094
218265
|
}
|
|
218095
|
-
function getCompletionsAtPosition(host, program2,
|
|
218266
|
+
function getCompletionsAtPosition(host, program2, log2, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
|
|
218096
218267
|
var _a2;
|
|
218097
218268
|
const { previousToken } = getRelevantTokens(position, sourceFile);
|
|
218098
218269
|
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
|
|
@@ -218125,7 +218296,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
218125
218296
|
} else {
|
|
218126
218297
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
|
|
218127
218298
|
}
|
|
218128
|
-
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program2,
|
|
218299
|
+
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program2, log2, preferences, includeSymbol);
|
|
218129
218300
|
if (stringCompletions) {
|
|
218130
218301
|
return stringCompletions;
|
|
218131
218302
|
}
|
|
@@ -218134,7 +218305,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
218134
218305
|
}
|
|
218135
218306
|
const completionData = getCompletionData(
|
|
218136
218307
|
program2,
|
|
218137
|
-
|
|
218308
|
+
log2,
|
|
218138
218309
|
sourceFile,
|
|
218139
218310
|
compilerOptions,
|
|
218140
218311
|
position,
|
|
@@ -218150,7 +218321,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
218150
218321
|
}
|
|
218151
218322
|
switch (completionData.kind) {
|
|
218152
218323
|
case 0:
|
|
218153
|
-
const response = completionInfoFromData(sourceFile, host, program2, compilerOptions,
|
|
218324
|
+
const response = completionInfoFromData(sourceFile, host, program2, compilerOptions, log2, completionData, preferences, formatContext, position, includeSymbol);
|
|
218154
218325
|
if (response == null ? void 0 : response.isIncomplete) {
|
|
218155
218326
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
|
|
218156
218327
|
}
|
|
@@ -218572,7 +218743,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
218572
218743
|
function getOptionalReplacementSpan(location) {
|
|
218573
218744
|
return (location == null ? void 0 : location.kind) === 80 ? createTextSpanFromNode(location) : void 0;
|
|
218574
218745
|
}
|
|
218575
|
-
function completionInfoFromData(sourceFile, host, program2, compilerOptions,
|
|
218746
|
+
function completionInfoFromData(sourceFile, host, program2, compilerOptions, log2, completionData, preferences, formatContext, position, includeSymbol) {
|
|
218576
218747
|
const {
|
|
218577
218748
|
symbols,
|
|
218578
218749
|
contextToken,
|
|
@@ -218636,7 +218807,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
218636
218807
|
host,
|
|
218637
218808
|
program2,
|
|
218638
218809
|
getEmitScriptTarget(compilerOptions),
|
|
218639
|
-
|
|
218810
|
+
log2,
|
|
218640
218811
|
completionKind,
|
|
218641
218812
|
preferences,
|
|
218642
218813
|
compilerOptions,
|
|
@@ -219648,7 +219819,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
219648
219819
|
return "TypeOnlyAlias/";
|
|
219649
219820
|
}
|
|
219650
219821
|
}
|
|
219651
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program2, target,
|
|
219822
|
+
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program2, target, log2, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
|
|
219652
219823
|
const start3 = timestamp();
|
|
219653
219824
|
const closestSymbolDeclaration = getClosestSymbolDeclaration(contextToken, location);
|
|
219654
219825
|
const useSemicolons = probablyUsesSemicolons(sourceFile);
|
|
@@ -219708,7 +219879,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
219708
219879
|
true
|
|
219709
219880
|
);
|
|
219710
219881
|
}
|
|
219711
|
-
|
|
219882
|
+
log2("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (timestamp() - start3));
|
|
219712
219883
|
return {
|
|
219713
219884
|
has: (name2) => uniques.has(name2),
|
|
219714
219885
|
add: (name2) => uniques.set(name2, true)
|
|
@@ -219804,7 +219975,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
219804
219975
|
}
|
|
219805
219976
|
return entries;
|
|
219806
219977
|
}
|
|
219807
|
-
function getSymbolCompletionFromEntryId(program2,
|
|
219978
|
+
function getSymbolCompletionFromEntryId(program2, log2, sourceFile, position, entryId, host, preferences) {
|
|
219808
219979
|
if (entryId.source === "SwitchCases/") {
|
|
219809
219980
|
return { type: "cases" };
|
|
219810
219981
|
}
|
|
@@ -219827,7 +219998,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
219827
219998
|
const compilerOptions = program2.getCompilerOptions();
|
|
219828
219999
|
const completionData = getCompletionData(
|
|
219829
220000
|
program2,
|
|
219830
|
-
|
|
220001
|
+
log2,
|
|
219831
220002
|
sourceFile,
|
|
219832
220003
|
compilerOptions,
|
|
219833
220004
|
position,
|
|
@@ -219852,7 +220023,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
219852
220023
|
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" && symbol2.flags & 106500 || entryId.source === "ObjectLiteralMethodSnippet/" && symbol2.flags & (4 | 8192) || getSourceFromOrigin(origin) === entryId.source || entryId.source === "ObjectLiteralMemberWithComma/") ? { type: "symbol", symbol: symbol2, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
219853
220024
|
}) || { type: "none" };
|
|
219854
220025
|
}
|
|
219855
|
-
function getCompletionEntryDetails(program2,
|
|
220026
|
+
function getCompletionEntryDetails(program2, log2, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
219856
220027
|
const typeChecker = program2.getTypeChecker();
|
|
219857
220028
|
const compilerOptions = program2.getCompilerOptions();
|
|
219858
220029
|
const { name: name2, source, data } = entryId;
|
|
@@ -219860,7 +220031,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
219860
220031
|
if (isInString(sourceFile, position, previousToken)) {
|
|
219861
220032
|
return ts_Completions_StringCompletions_exports.getStringLiteralCompletionDetails(name2, sourceFile, position, previousToken, program2, host, cancellationToken, preferences);
|
|
219862
220033
|
}
|
|
219863
|
-
const symbolCompletion = getSymbolCompletionFromEntryId(program2,
|
|
220034
|
+
const symbolCompletion = getSymbolCompletionFromEntryId(program2, log2, sourceFile, position, entryId, host, preferences);
|
|
219864
220035
|
switch (symbolCompletion.type) {
|
|
219865
220036
|
case "request": {
|
|
219866
220037
|
const { request } = symbolCompletion;
|
|
@@ -220054,8 +220225,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220054
220225
|
Debug.assert(!(data == null ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
|
|
220055
220226
|
return { sourceDisplay: [textPart(moduleSpecifier)], codeActions: [codeAction] };
|
|
220056
220227
|
}
|
|
220057
|
-
function getCompletionEntrySymbol(program2,
|
|
220058
|
-
const completion = getSymbolCompletionFromEntryId(program2,
|
|
220228
|
+
function getCompletionEntrySymbol(program2, log2, sourceFile, position, entryId, host, preferences) {
|
|
220229
|
+
const completion = getSymbolCompletionFromEntryId(program2, log2, sourceFile, position, entryId, host, preferences);
|
|
220059
220230
|
return completion.type === "symbol" ? completion.symbol : void 0;
|
|
220060
220231
|
}
|
|
220061
220232
|
var CompletionKind = /* @__PURE__ */ ((CompletionKind2) => {
|
|
@@ -220128,15 +220299,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220128
220299
|
/* SourceFile */
|
|
220129
220300
|
));
|
|
220130
220301
|
}
|
|
220131
|
-
function getCompletionData(program2,
|
|
220302
|
+
function getCompletionData(program2, log2, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) {
|
|
220132
220303
|
const typeChecker = program2.getTypeChecker();
|
|
220133
220304
|
const inCheckedFile = isCheckedFile(sourceFile, compilerOptions);
|
|
220134
220305
|
let start3 = timestamp();
|
|
220135
220306
|
let currentToken2 = getTokenAtPosition(sourceFile, position);
|
|
220136
|
-
|
|
220307
|
+
log2("getCompletionData: Get current token: " + (timestamp() - start3));
|
|
220137
220308
|
start3 = timestamp();
|
|
220138
220309
|
const insideComment = isInComment(sourceFile, position, currentToken2);
|
|
220139
|
-
|
|
220310
|
+
log2("getCompletionData: Is inside comment: " + (timestamp() - start3));
|
|
220140
220311
|
let insideJsDocTagTypeExpression = false;
|
|
220141
220312
|
let insideJsDocImportTag = false;
|
|
220142
220313
|
let isInSnippetScope = false;
|
|
@@ -220181,7 +220352,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220181
220352
|
}
|
|
220182
220353
|
}
|
|
220183
220354
|
if (!insideJsDocTagTypeExpression && !insideJsDocImportTag) {
|
|
220184
|
-
|
|
220355
|
+
log2("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.");
|
|
220185
220356
|
return void 0;
|
|
220186
220357
|
}
|
|
220187
220358
|
}
|
|
@@ -220190,7 +220361,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220190
220361
|
const tokens = getRelevantTokens(position, sourceFile);
|
|
220191
220362
|
const previousToken = tokens.previousToken;
|
|
220192
220363
|
let contextToken = tokens.contextToken;
|
|
220193
|
-
|
|
220364
|
+
log2("getCompletionData: Get previous token: " + (timestamp() - start3));
|
|
220194
220365
|
let node = currentToken2;
|
|
220195
220366
|
let propertyAccessToConvert;
|
|
220196
220367
|
let isRightOfDot = false;
|
|
@@ -220223,7 +220394,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220223
220394
|
isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation;
|
|
220224
220395
|
}
|
|
220225
220396
|
if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) {
|
|
220226
|
-
|
|
220397
|
+
log2("Returning an empty list because completion was requested in an invalid position.");
|
|
220227
220398
|
return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, computeCommitCharactersAndIsNewIdentifier().isNewIdentifierLocation) : void 0;
|
|
220228
220399
|
}
|
|
220229
220400
|
let parent2 = contextToken.parent;
|
|
@@ -220356,7 +220527,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220356
220527
|
return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierLocation) : void 0;
|
|
220357
220528
|
}
|
|
220358
220529
|
}
|
|
220359
|
-
|
|
220530
|
+
log2("getCompletionData: Semantic work: " + (timestamp() - semanticStart));
|
|
220360
220531
|
const contextualType = previousToken && getContextualType(previousToken, position, sourceFile, typeChecker);
|
|
220361
220532
|
const isLiteralExpected = !tryCast(previousToken, isStringLiteralLike) && !isJsxIdentifierExpected;
|
|
220362
220533
|
const literals = !isLiteralExpected ? [] : mapDefined(
|
|
@@ -220903,7 +221074,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220903
221074
|
function isCompletionListBlocker(contextToken2) {
|
|
220904
221075
|
const start22 = timestamp();
|
|
220905
221076
|
const result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken2) || isSolelyIdentifierDefinitionLocation(contextToken2) || isDotOfNumericLiteral(contextToken2) || isInJsxText(contextToken2) || isBigIntLiteral(contextToken2);
|
|
220906
|
-
|
|
221077
|
+
log2("getCompletionsAtPosition: isCompletionListBlocker: " + (timestamp() - start22));
|
|
220907
221078
|
return result;
|
|
220908
221079
|
}
|
|
220909
221080
|
function isInJsxText(contextToken2) {
|
|
@@ -222226,7 +222397,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
222226
222397
|
values: map210.values.bind(map210)
|
|
222227
222398
|
};
|
|
222228
222399
|
}
|
|
222229
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program2,
|
|
222400
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program2, log2, preferences, includeSymbol) {
|
|
222230
222401
|
if (isInReferenceComment(sourceFile, position)) {
|
|
222231
222402
|
const entries = getTripleSlashReferenceCompletion(sourceFile, position, program2, host, createModuleSpecifierResolutionHost(program2, host));
|
|
222232
222403
|
return entries && convertPathCompletions(entries);
|
|
@@ -222234,10 +222405,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
222234
222405
|
if (isInString(sourceFile, position, contextToken)) {
|
|
222235
222406
|
if (!contextToken || !isStringLiteralLike(contextToken)) return void 0;
|
|
222236
222407
|
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program2, host, preferences);
|
|
222237
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program2,
|
|
222408
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program2, log2, options, preferences, position, includeSymbol);
|
|
222238
222409
|
}
|
|
222239
222410
|
}
|
|
222240
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program2,
|
|
222411
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program2, log2, options, preferences, position, includeSymbol) {
|
|
222241
222412
|
if (completion === void 0) {
|
|
222242
222413
|
return void 0;
|
|
222243
222414
|
}
|
|
@@ -222258,7 +222429,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
222258
222429
|
host,
|
|
222259
222430
|
program2,
|
|
222260
222431
|
99,
|
|
222261
|
-
|
|
222432
|
+
log2,
|
|
222262
222433
|
4,
|
|
222263
222434
|
preferences,
|
|
222264
222435
|
options,
|
|
@@ -238761,7 +238932,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
238761
238932
|
isEnabled: () => false,
|
|
238762
238933
|
writeLine: noop3
|
|
238763
238934
|
};
|
|
238764
|
-
function typingToFileName(cachePath, packageName, installTypingHost,
|
|
238935
|
+
function typingToFileName(cachePath, packageName, installTypingHost, log2) {
|
|
238765
238936
|
try {
|
|
238766
238937
|
const result = resolveModuleName(packageName, combinePaths(cachePath, "index.d.ts"), {
|
|
238767
238938
|
moduleResolution: 2
|
|
@@ -238769,8 +238940,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
238769
238940
|
}, installTypingHost);
|
|
238770
238941
|
return result.resolvedModule && result.resolvedModule.resolvedFileName;
|
|
238771
238942
|
} catch (e2) {
|
|
238772
|
-
if (
|
|
238773
|
-
|
|
238943
|
+
if (log2.isEnabled()) {
|
|
238944
|
+
log2.writeLine(`Failed to resolve ${packageName} in folder '${cachePath}': ${e2.message}`);
|
|
238774
238945
|
}
|
|
238775
238946
|
return void 0;
|
|
238776
238947
|
}
|
|
@@ -238797,13 +238968,13 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
238797
238968
|
return { command, remaining: remaining - toSlice };
|
|
238798
238969
|
}
|
|
238799
238970
|
var TypingsInstaller = class {
|
|
238800
|
-
constructor(installTypingHost, globalCachePath, safeListPath, typesMapLocation, throttleLimit,
|
|
238971
|
+
constructor(installTypingHost, globalCachePath, safeListPath, typesMapLocation, throttleLimit, log2 = nullLog) {
|
|
238801
238972
|
this.installTypingHost = installTypingHost;
|
|
238802
238973
|
this.globalCachePath = globalCachePath;
|
|
238803
238974
|
this.safeListPath = safeListPath;
|
|
238804
238975
|
this.typesMapLocation = typesMapLocation;
|
|
238805
238976
|
this.throttleLimit = throttleLimit;
|
|
238806
|
-
this.log =
|
|
238977
|
+
this.log = log2;
|
|
238807
238978
|
this.packageNameToTypingLocation = /* @__PURE__ */ new Map();
|
|
238808
238979
|
this.missingTypingsSet = /* @__PURE__ */ new Set();
|
|
238809
238980
|
this.knownCachesSet = /* @__PURE__ */ new Set();
|
|
@@ -239301,13 +239472,13 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
239301
239472
|
}
|
|
239302
239473
|
static run(self2) {
|
|
239303
239474
|
self2.timerId = void 0;
|
|
239304
|
-
const
|
|
239475
|
+
const log2 = self2.logger.hasLevel(
|
|
239305
239476
|
2
|
|
239306
239477
|
/* requestTime */
|
|
239307
239478
|
);
|
|
239308
|
-
const before =
|
|
239479
|
+
const before = log2 && self2.host.getMemoryUsage();
|
|
239309
239480
|
self2.host.gc();
|
|
239310
|
-
if (
|
|
239481
|
+
if (log2) {
|
|
239311
239482
|
const after = self2.host.getMemoryUsage();
|
|
239312
239483
|
self2.logger.perftrc(`GC::before ${before}, after ${after}`);
|
|
239313
239484
|
}
|
|
@@ -240235,17 +240406,17 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
240235
240406
|
updateProjectIfDirty(this);
|
|
240236
240407
|
return hasOneOrMoreJsAndNoTsFiles(this);
|
|
240237
240408
|
}
|
|
240238
|
-
static resolveModule(moduleName, initialDir, host,
|
|
240239
|
-
return _Project.importServicePluginSync({ name: moduleName }, [initialDir], host,
|
|
240409
|
+
static resolveModule(moduleName, initialDir, host, log2) {
|
|
240410
|
+
return _Project.importServicePluginSync({ name: moduleName }, [initialDir], host, log2).resolvedModule;
|
|
240240
240411
|
}
|
|
240241
240412
|
/** @internal */
|
|
240242
|
-
static importServicePluginSync(pluginConfigEntry, searchPaths, host,
|
|
240413
|
+
static importServicePluginSync(pluginConfigEntry, searchPaths, host, log2) {
|
|
240243
240414
|
Debug.assertIsDefined(host.require);
|
|
240244
240415
|
let errorLogs;
|
|
240245
240416
|
let resolvedModule;
|
|
240246
240417
|
for (const initialDir of searchPaths) {
|
|
240247
240418
|
const resolvedPath = normalizeSlashes(host.resolvePath(combinePaths(initialDir, "node_modules")));
|
|
240248
|
-
|
|
240419
|
+
log2(`Loading ${pluginConfigEntry.name} from ${initialDir} (resolved to ${resolvedPath})`);
|
|
240249
240420
|
const result = host.require(resolvedPath, pluginConfigEntry.name);
|
|
240250
240421
|
if (!result.error) {
|
|
240251
240422
|
resolvedModule = result.module;
|
|
@@ -240257,13 +240428,13 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
240257
240428
|
return { pluginConfigEntry, resolvedModule, errorLogs };
|
|
240258
240429
|
}
|
|
240259
240430
|
/** @internal */
|
|
240260
|
-
static async importServicePluginAsync(pluginConfigEntry, searchPaths, host,
|
|
240431
|
+
static async importServicePluginAsync(pluginConfigEntry, searchPaths, host, log2) {
|
|
240261
240432
|
Debug.assertIsDefined(host.importPlugin);
|
|
240262
240433
|
let errorLogs;
|
|
240263
240434
|
let resolvedModule;
|
|
240264
240435
|
for (const initialDir of searchPaths) {
|
|
240265
240436
|
const resolvedPath = combinePaths(initialDir, "node_modules");
|
|
240266
|
-
|
|
240437
|
+
log2(`Dynamically importing ${pluginConfigEntry.name} from ${initialDir} (resolved to ${resolvedPath})`);
|
|
240267
240438
|
let result;
|
|
240268
240439
|
try {
|
|
240269
240440
|
result = await host.importPlugin(resolvedPath, pluginConfigEntry.name);
|
|
@@ -243070,7 +243241,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
243070
243241
|
3
|
|
243071
243242
|
/* verbose */
|
|
243072
243243
|
) ? 2 : this.logger.loggingEnabled() ? 1 : 0;
|
|
243073
|
-
const
|
|
243244
|
+
const log2 = watchLogLevel !== 0 ? (s2) => this.logger.info(s2) : noop3;
|
|
243074
243245
|
this.packageJsonCache = createPackageJsonCache(this);
|
|
243075
243246
|
this.watchFactory = this.serverMode !== 0 ? {
|
|
243076
243247
|
watchFile: returnNoopFileWatcher,
|
|
@@ -243078,7 +243249,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
243078
243249
|
} : getWatchFactory(
|
|
243079
243250
|
createWatchFactoryHostUsingWatchEvents(this, opts.canUseWatchEvents) || this.host,
|
|
243080
243251
|
watchLogLevel,
|
|
243081
|
-
|
|
243252
|
+
log2,
|
|
243082
243253
|
getDetailWatchInfo
|
|
243083
243254
|
);
|
|
243084
243255
|
this.canUseWatchEvents = getCanUseWatchEvents(this, opts.canUseWatchEvents);
|
|
@@ -255090,9 +255261,10 @@ var init_cluster_change = __esm({
|
|
|
255090
255261
|
});
|
|
255091
255262
|
|
|
255092
255263
|
// src/commands/cluster/helpers/plan.ts
|
|
255093
|
-
var AUTOSCALE_BOUNDS, VIRTUAL_UNSUPPORTED, intIn, validateDesired, planClusterChanges;
|
|
255264
|
+
var AUTOSCALE_BOUNDS, SERVER_TYPE_NAME, VIRTUAL_UNSUPPORTED, intIn, validateDesired, planClusterChanges;
|
|
255094
255265
|
var init_plan = __esm({
|
|
255095
255266
|
"src/commands/cluster/helpers/plan.ts"() {
|
|
255267
|
+
init_types2();
|
|
255096
255268
|
AUTOSCALE_BOUNDS = {
|
|
255097
255269
|
minWorkers: [1, 10],
|
|
255098
255270
|
maxWorkers: [1, 10],
|
|
@@ -255101,8 +255273,11 @@ var init_plan = __esm({
|
|
|
255101
255273
|
cpuScaleDownPercent: [1, 100],
|
|
255102
255274
|
memScaleDownPercent: [1, 100],
|
|
255103
255275
|
samplesToScale: [1, 20],
|
|
255104
|
-
cooldownMinutes: [1, 1440]
|
|
255276
|
+
cooldownMinutes: [1, 1440],
|
|
255277
|
+
scaleUpStep: [1, 3],
|
|
255278
|
+
minNodeAgeMinutes: [5, 1440]
|
|
255105
255279
|
};
|
|
255280
|
+
SERVER_TYPE_NAME = /^[a-z]+[0-9]+[a-z]*$/;
|
|
255106
255281
|
VIRTUAL_UNSUPPORTED = [
|
|
255107
255282
|
"imageId",
|
|
255108
255283
|
"serverType",
|
|
@@ -255143,6 +255318,45 @@ var init_plan = __esm({
|
|
|
255143
255318
|
}
|
|
255144
255319
|
continue;
|
|
255145
255320
|
}
|
|
255321
|
+
if (key === "scalingProfile") {
|
|
255322
|
+
if (!SCALING_PROFILES.includes(value)) {
|
|
255323
|
+
errors.push(
|
|
255324
|
+
`cluster.autoscale.scalingProfile must be one of ${SCALING_PROFILES.join(", ")}`
|
|
255325
|
+
);
|
|
255326
|
+
}
|
|
255327
|
+
continue;
|
|
255328
|
+
}
|
|
255329
|
+
if (key === "mode") {
|
|
255330
|
+
if (!["thresholds", "pods"].includes(String(value))) {
|
|
255331
|
+
errors.push("cluster.autoscale.mode must be 'thresholds' or 'pods'");
|
|
255332
|
+
}
|
|
255333
|
+
continue;
|
|
255334
|
+
}
|
|
255335
|
+
if (key === "consolidation") {
|
|
255336
|
+
if (typeof value !== "boolean") {
|
|
255337
|
+
errors.push("cluster.autoscale.consolidation must be true or false");
|
|
255338
|
+
}
|
|
255339
|
+
continue;
|
|
255340
|
+
}
|
|
255341
|
+
if (key === "pools") {
|
|
255342
|
+
const pools = value;
|
|
255343
|
+
if (!Array.isArray(pools) || pools.length > 5 || pools.some(
|
|
255344
|
+
(p) => !p || typeof p.name !== "string" || !Array.isArray(p.serverTypes) || !p.serverTypes.length
|
|
255345
|
+
)) {
|
|
255346
|
+
errors.push(
|
|
255347
|
+
"cluster.autoscale.pools must be up to 5 pools, each { name, serverTypes: [...], labels?, taints?, maxWorkers?, weight? }"
|
|
255348
|
+
);
|
|
255349
|
+
}
|
|
255350
|
+
continue;
|
|
255351
|
+
}
|
|
255352
|
+
if (key === "serverTypes") {
|
|
255353
|
+
if (!Array.isArray(value) || value.length > 10 || value.some((t2) => !SERVER_TYPE_NAME.test(String(t2)))) {
|
|
255354
|
+
errors.push(
|
|
255355
|
+
"cluster.autoscale.serverTypes must be a list of up to 10 Hetzner server types, e.g. [cx33, cpx22]"
|
|
255356
|
+
);
|
|
255357
|
+
}
|
|
255358
|
+
continue;
|
|
255359
|
+
}
|
|
255146
255360
|
const bounds = AUTOSCALE_BOUNDS[key];
|
|
255147
255361
|
if (!bounds) {
|
|
255148
255362
|
errors.push(`cluster.autoscale.${key} is not a known setting`);
|
|
@@ -255262,8 +255476,9 @@ var init_plan = __esm({
|
|
|
255262
255476
|
if (desired.autoscale) {
|
|
255263
255477
|
const now = current.autoscale ?? {};
|
|
255264
255478
|
const changed = {};
|
|
255479
|
+
const same = (a, b) => Array.isArray(a) || Array.isArray(b) ? JSON.stringify(a ?? []) === JSON.stringify(b ?? []) : a === b;
|
|
255265
255480
|
for (const [key, value] of Object.entries(desired.autoscale)) {
|
|
255266
|
-
if (now[key]
|
|
255481
|
+
if (!same(now[key], value)) {
|
|
255267
255482
|
changed[key] = value;
|
|
255268
255483
|
}
|
|
255269
255484
|
}
|
|
@@ -255271,7 +255486,9 @@ var init_plan = __esm({
|
|
|
255271
255486
|
steps.push({
|
|
255272
255487
|
kind: "autoscale",
|
|
255273
255488
|
input: changed,
|
|
255274
|
-
description: `autoscale: ${Object.entries(changed).map(
|
|
255489
|
+
description: `autoscale: ${Object.entries(changed).map(
|
|
255490
|
+
([k, v]) => `${k}=${k === "pools" ? `${v.length} pool(s)` : Array.isArray(v) ? v.join(",") : v}`
|
|
255491
|
+
).join(", ")}`
|
|
255275
255492
|
});
|
|
255276
255493
|
}
|
|
255277
255494
|
}
|
|
@@ -255692,12 +255909,12 @@ var init_attach = __esm({
|
|
|
255692
255909
|
});
|
|
255693
255910
|
|
|
255694
255911
|
// src/commands/cluster/helpers/talosctl.ts
|
|
255695
|
-
function talosctlAssetName(
|
|
255696
|
-
const os2 =
|
|
255912
|
+
function talosctlAssetName(platform2 = process.platform, arch = process.arch) {
|
|
255913
|
+
const os2 = platform2 === "win32" ? "windows" : platform2 === "darwin" ? "darwin" : platform2 === "linux" ? "linux" : null;
|
|
255697
255914
|
const cpu = arch === "x64" ? "amd64" : arch === "arm64" ? "arm64" : null;
|
|
255698
255915
|
if (!os2 || !cpu) {
|
|
255699
255916
|
throw new Error(
|
|
255700
|
-
`No talosctl release for ${
|
|
255917
|
+
`No talosctl release for ${platform2}/${arch}. Install talosctl yourself: https://www.talos.dev/latest/talos-guides/install/talosctl/`
|
|
255701
255918
|
);
|
|
255702
255919
|
}
|
|
255703
255920
|
return `talosctl-${os2}-${cpu}${os2 === "windows" ? ".exe" : ""}`;
|
|
@@ -255762,10 +255979,10 @@ async function ensureTalosctl(version2) {
|
|
|
255762
255979
|
Logger.info(`talosctl ${version2} saved to ${binary}`);
|
|
255763
255980
|
return binary;
|
|
255764
255981
|
}
|
|
255765
|
-
var
|
|
255982
|
+
var import_child_process2, import_crypto, import_fs4, import_promises, import_path2, RELEASES, VERSION_RE, clientVersionOf, runBinary;
|
|
255766
255983
|
var init_talosctl = __esm({
|
|
255767
255984
|
"src/commands/cluster/helpers/talosctl.ts"() {
|
|
255768
|
-
|
|
255985
|
+
import_child_process2 = require("child_process");
|
|
255769
255986
|
import_crypto = require("crypto");
|
|
255770
255987
|
import_fs4 = require("fs");
|
|
255771
255988
|
import_promises = require("fs/promises");
|
|
@@ -255776,7 +255993,7 @@ var init_talosctl = __esm({
|
|
|
255776
255993
|
VERSION_RE = /^v\d+\.\d+\.\d+$/;
|
|
255777
255994
|
clientVersionOf = (output) => output.match(/Talos (v\d+\.\d+\.\d+\S*)/)?.[1] ?? null;
|
|
255778
255995
|
runBinary = (binary, args, timeoutMs = 2e4) => new Promise(
|
|
255779
|
-
(resolve2) => (0,
|
|
255996
|
+
(resolve2) => (0, import_child_process2.execFile)(
|
|
255780
255997
|
binary,
|
|
255781
255998
|
args,
|
|
255782
255999
|
{ timeout: timeoutMs, maxBuffer: 10 * 1024 * 1024 },
|
|
@@ -255795,11 +256012,11 @@ var attach_exports = {};
|
|
|
255795
256012
|
__export(attach_exports, {
|
|
255796
256013
|
default: () => attach_default
|
|
255797
256014
|
});
|
|
255798
|
-
var import_promises2,
|
|
256015
|
+
var import_promises2, import_os3, import_path3, import_readline, import_rxjs17, sleep2, ask, attach_default;
|
|
255799
256016
|
var init_attach2 = __esm({
|
|
255800
256017
|
"src/commands/cluster/attach.ts"() {
|
|
255801
256018
|
import_promises2 = require("fs/promises");
|
|
255802
|
-
|
|
256019
|
+
import_os3 = require("os");
|
|
255803
256020
|
import_path3 = require("path");
|
|
255804
256021
|
import_readline = require("readline");
|
|
255805
256022
|
import_rxjs17 = __toESM(require_cjs());
|
|
@@ -255808,7 +256025,7 @@ var init_attach2 = __esm({
|
|
|
255808
256025
|
init_attach();
|
|
255809
256026
|
init_cluster_change();
|
|
255810
256027
|
init_talosctl();
|
|
255811
|
-
|
|
256028
|
+
sleep2 = (ms) => new Promise((r2) => setTimeout(r2, ms));
|
|
255812
256029
|
ask = (question) => new Promise((resolve2) => {
|
|
255813
256030
|
const rl = (0, import_readline.createInterface)({
|
|
255814
256031
|
input: process.stdin,
|
|
@@ -255850,7 +256067,7 @@ var init_attach2 = __esm({
|
|
|
255850
256067
|
"yaml"
|
|
255851
256068
|
]);
|
|
255852
256069
|
version2 = probe.code === 0 ? serverTalosVersion(probe.stdout) : void 0;
|
|
255853
|
-
if (!version2) await
|
|
256070
|
+
if (!version2) await sleep2(5e3);
|
|
255854
256071
|
}
|
|
255855
256072
|
if (!version2) {
|
|
255856
256073
|
throw new Error(
|
|
@@ -255894,7 +256111,7 @@ var init_attach2 = __esm({
|
|
|
255894
256111
|
`The cluster runs Talos ${join_.talosVersion}, the machine booted ${version2}. It installs ${join_.talosVersion} anyway; if the join fails, boot ${join_.isoUrl}.`
|
|
255895
256112
|
);
|
|
255896
256113
|
}
|
|
255897
|
-
const dir = await (0, import_promises2.mkdtemp)((0, import_path3.join)((0,
|
|
256114
|
+
const dir = await (0, import_promises2.mkdtemp)((0, import_path3.join)((0, import_os3.tmpdir)(), "gcli-attach-"));
|
|
255898
256115
|
const file2 = (0, import_path3.join)(dir, "machine.yaml");
|
|
255899
256116
|
try {
|
|
255900
256117
|
await (0, import_promises2.writeFile)(file2, join_.config, { mode: 384 });
|
|
@@ -255922,7 +256139,7 @@ var init_attach2 = __esm({
|
|
|
255922
256139
|
);
|
|
255923
256140
|
const deadline = Date.now() + opts.timeoutMs;
|
|
255924
256141
|
while (Date.now() < deadline) {
|
|
255925
|
-
await
|
|
256142
|
+
await sleep2(15e3);
|
|
255926
256143
|
const nodes = await (0, import_rxjs17.lastValueFrom)(GraphqlClienAPI.clusterNodes(clusterId));
|
|
255927
256144
|
const node = nodes.find((n) => n.name === opts.name);
|
|
255928
256145
|
if (node?.status === "ready") {
|
|
@@ -256007,11 +256224,11 @@ __export(reset_machine_exports, {
|
|
|
256007
256224
|
default: () => reset_machine_default,
|
|
256008
256225
|
hostnameOf: () => hostnameOf
|
|
256009
256226
|
});
|
|
256010
|
-
var import_promises3,
|
|
256227
|
+
var import_promises3, import_os4, import_path4, import_readline2, import_rxjs20, hostnameOf, reset_machine_default;
|
|
256011
256228
|
var init_reset_machine = __esm({
|
|
256012
256229
|
"src/commands/cluster/reset-machine.ts"() {
|
|
256013
256230
|
import_promises3 = require("fs/promises");
|
|
256014
|
-
|
|
256231
|
+
import_os4 = require("os");
|
|
256015
256232
|
import_path4 = require("path");
|
|
256016
256233
|
import_readline2 = require("readline");
|
|
256017
256234
|
import_rxjs20 = __toESM(require_cjs());
|
|
@@ -256050,7 +256267,7 @@ var init_reset_machine = __esm({
|
|
|
256050
256267
|
GraphqlClienAPI.clusterTalosconfig(clusterId, 15)
|
|
256051
256268
|
);
|
|
256052
256269
|
const binary = access.talosVersion ? await ensureTalosctl(access.talosVersion) : "talosctl";
|
|
256053
|
-
const dir = await (0, import_promises3.mkdtemp)((0, import_path4.join)((0,
|
|
256270
|
+
const dir = await (0, import_promises3.mkdtemp)((0, import_path4.join)((0, import_os4.tmpdir)(), "gcli-reset-"));
|
|
256054
256271
|
const config2 = (0, import_path4.join)(dir, "talosconfig");
|
|
256055
256272
|
try {
|
|
256056
256273
|
await (0, import_promises3.writeFile)(config2, access.talosconfig, { mode: 384 });
|
|
@@ -256314,7 +256531,7 @@ var init_cost = __esm({
|
|
|
256314
256531
|
init_helpers();
|
|
256315
256532
|
init_gql_client();
|
|
256316
256533
|
init_log();
|
|
256317
|
-
money = (v
|
|
256534
|
+
money = (v) => v == null ? "-" : v.toFixed(2);
|
|
256318
256535
|
cost_default = async (cmd) => {
|
|
256319
256536
|
const projectId = await (0, import_rxjs25.lastValueFrom)(parseProjectId(cmd.project));
|
|
256320
256537
|
const rows = await (0, import_rxjs25.lastValueFrom)(
|
|
@@ -256325,6 +256542,7 @@ var init_cost = __esm({
|
|
|
256325
256542
|
if (!rows.length) {
|
|
256326
256543
|
Logger.info("No private clusters for this project.");
|
|
256327
256544
|
} else {
|
|
256545
|
+
Logger.info("Amounts in the platform currency (EUR unless changed).");
|
|
256328
256546
|
Logger.table(
|
|
256329
256547
|
rows.map((c) => ({
|
|
256330
256548
|
name: c.name,
|
|
@@ -256332,9 +256550,8 @@ var init_cost = __esm({
|
|
|
256332
256550
|
period: c.monthToDate?.period ?? "-",
|
|
256333
256551
|
nodeHours: c.monthToDate?.nodeHours ?? 0,
|
|
256334
256552
|
loadBalancerHours: c.monthToDate?.loadBalancerHours ?? 0,
|
|
256335
|
-
|
|
256336
|
-
|
|
256337
|
-
estimatedMonthEur: money(c.estimatedMonthlyCostEur)
|
|
256553
|
+
monthToDate: money(c.monthToDate?.totalCost),
|
|
256554
|
+
estimatedMonth: money(c.estimatedMonthlyCost)
|
|
256338
256555
|
}))
|
|
256339
256556
|
);
|
|
256340
256557
|
}
|
|
@@ -256412,6 +256629,7 @@ var init_autoscale = __esm({
|
|
|
256412
256629
|
init_gql_client();
|
|
256413
256630
|
init_log();
|
|
256414
256631
|
init_cluster_change();
|
|
256632
|
+
init_types2();
|
|
256415
256633
|
toAutoscaleInput = (cmd) => {
|
|
256416
256634
|
if (cmd.enable && cmd.disable) {
|
|
256417
256635
|
throw new Error("Pass --enable or --disable, not both");
|
|
@@ -256427,7 +256645,9 @@ var init_autoscale = __esm({
|
|
|
256427
256645
|
["cpuDown", "cpuScaleDownPercent", 1, 100],
|
|
256428
256646
|
["memDown", "memScaleDownPercent", 1, 100],
|
|
256429
256647
|
["samples", "samplesToScale", 1, 20],
|
|
256430
|
-
["cooldown", "cooldownMinutes", 1, 1440]
|
|
256648
|
+
["cooldown", "cooldownMinutes", 1, 1440],
|
|
256649
|
+
["step", "scaleUpStep", 1, 3],
|
|
256650
|
+
["minNodeAge", "minNodeAgeMinutes", 5, 1440]
|
|
256431
256651
|
];
|
|
256432
256652
|
for (const [flag, field, min, max] of ints) {
|
|
256433
256653
|
if (cmd[flag] !== void 0) {
|
|
@@ -256439,9 +256659,29 @@ var init_autoscale = __esm({
|
|
|
256439
256659
|
);
|
|
256440
256660
|
}
|
|
256441
256661
|
}
|
|
256662
|
+
if (cmd.profile !== void 0) {
|
|
256663
|
+
if (!SCALING_PROFILES.includes(cmd.profile)) {
|
|
256664
|
+
throw new Error(
|
|
256665
|
+
`--profile must be one of ${SCALING_PROFILES.join(", ")}, got "${cmd.profile}"`
|
|
256666
|
+
);
|
|
256667
|
+
}
|
|
256668
|
+
input.scalingProfile = cmd.profile;
|
|
256669
|
+
}
|
|
256670
|
+
if (cmd.mode !== void 0) {
|
|
256671
|
+
if (!["thresholds", "pods"].includes(cmd.mode)) {
|
|
256672
|
+
throw new Error(`--mode must be thresholds or pods, got "${cmd.mode}"`);
|
|
256673
|
+
}
|
|
256674
|
+
input.mode = cmd.mode;
|
|
256675
|
+
}
|
|
256676
|
+
if (cmd.consolidation !== void 0) {
|
|
256677
|
+
input.consolidation = cmd.consolidation;
|
|
256678
|
+
}
|
|
256679
|
+
if (cmd.serverTypes !== void 0) {
|
|
256680
|
+
input.serverTypes = ["", "none"].includes(cmd.serverTypes.trim()) ? [] : cmd.serverTypes.split(",").map((t2) => t2.trim().toLowerCase()).filter(Boolean);
|
|
256681
|
+
}
|
|
256442
256682
|
if (!Object.keys(input).length) {
|
|
256443
256683
|
throw new Error(
|
|
256444
|
-
"Nothing to change: pass --enable/--disable and/or --min, --max, --cpuUp, --memUp, --cpuDown, --memDown, --samples, --cooldown (gcli cluster:status shows the current policy)"
|
|
256684
|
+
"Nothing to change: pass --enable/--disable and/or --mode, --consolidation/--no-consolidation, --minNodeAge, --profile, --serverTypes, --step, --min, --max, --cpuUp, --memUp, --cpuDown, --memDown, --samples, --cooldown (gcli cluster:status shows the current policy)"
|
|
256445
256685
|
);
|
|
256446
256686
|
}
|
|
256447
256687
|
return input;
|
|
@@ -256460,6 +256700,10 @@ var init_autoscale = __esm({
|
|
|
256460
256700
|
cluster: cluster.name,
|
|
256461
256701
|
workers: cluster.topology?.workers,
|
|
256462
256702
|
enabled: a.enabled,
|
|
256703
|
+
mode: a.mode,
|
|
256704
|
+
profile: a.scalingProfile,
|
|
256705
|
+
workerTypes: a.serverTypes?.length ? a.serverTypes.join(",") : "(cluster type)",
|
|
256706
|
+
step: a.scaleUpStep,
|
|
256463
256707
|
minWorkers: a.minWorkers,
|
|
256464
256708
|
maxWorkers: a.maxWorkers,
|
|
256465
256709
|
scaleUpAt: `cpu ${a.cpuScaleUpPercent}% / mem ${a.memScaleUpPercent}%`,
|
|
@@ -256474,6 +256718,61 @@ var init_autoscale = __esm({
|
|
|
256474
256718
|
}
|
|
256475
256719
|
});
|
|
256476
256720
|
|
|
256721
|
+
// src/commands/cluster/plan.ts
|
|
256722
|
+
var plan_exports = {};
|
|
256723
|
+
__export(plan_exports, {
|
|
256724
|
+
default: () => plan_default
|
|
256725
|
+
});
|
|
256726
|
+
var import_rxjs27, plan_default;
|
|
256727
|
+
var init_plan2 = __esm({
|
|
256728
|
+
"src/commands/cluster/plan.ts"() {
|
|
256729
|
+
import_rxjs27 = __toESM(require_cjs());
|
|
256730
|
+
init_gql_client();
|
|
256731
|
+
init_log();
|
|
256732
|
+
init_cluster_change();
|
|
256733
|
+
plan_default = async (cmd) => {
|
|
256734
|
+
const { projectId, clusterId } = await resolveClusterTarget(cmd);
|
|
256735
|
+
const plan = await (0, import_rxjs27.lastValueFrom)(
|
|
256736
|
+
GraphqlClienAPI.clusterProvisioningPlan(projectId, clusterId)
|
|
256737
|
+
);
|
|
256738
|
+
Logger.log("-------------------");
|
|
256739
|
+
Logger.log("[Action][clusterProvisioningPlan]");
|
|
256740
|
+
Logger.info(
|
|
256741
|
+
`mode ${plan.mode}${plan.enabled ? "" : " (autoscaling off)"}, heartbeat ${plan.sampleAt ?? "none"}`
|
|
256742
|
+
);
|
|
256743
|
+
if (plan.agentReportsPods === false) {
|
|
256744
|
+
Logger.warn(
|
|
256745
|
+
"The cluster agent is too old to report pending pods - reinstall it from the Agent card on the dashboard (Install agent) or with the MCP tool InstallClusterAgent."
|
|
256746
|
+
);
|
|
256747
|
+
}
|
|
256748
|
+
if (plan.note) Logger.info(plan.note);
|
|
256749
|
+
if (plan.verdicts?.length) {
|
|
256750
|
+
Logger.table(
|
|
256751
|
+
plan.verdicts.map((v) => ({
|
|
256752
|
+
pod: v.pod,
|
|
256753
|
+
status: v.status,
|
|
256754
|
+
reason: v.reason ?? ""
|
|
256755
|
+
}))
|
|
256756
|
+
);
|
|
256757
|
+
} else if (!plan.note) {
|
|
256758
|
+
Logger.info("Every pod is scheduled.");
|
|
256759
|
+
}
|
|
256760
|
+
if (plan.claims?.length) {
|
|
256761
|
+
Logger.info(
|
|
256762
|
+
`${plan.mode === "pods" && plan.enabled ? "Creating" : "Pods mode would create"}: ${plan.claims.map((c) => `${c.type} (${c.pool}) for ${c.pods?.length ?? 0} pod(s)`).join(", ")} - +${plan.addedMonthly}/month`
|
|
256763
|
+
);
|
|
256764
|
+
}
|
|
256765
|
+
if (plan.consolidation && plan.consolidation.action !== "keep") {
|
|
256766
|
+
Logger.info(
|
|
256767
|
+
`Consolidation: ${plan.consolidation.action} ${plan.consolidation.node} - ${plan.consolidation.reason}`
|
|
256768
|
+
);
|
|
256769
|
+
}
|
|
256770
|
+
Logger.log("-------------------");
|
|
256771
|
+
return plan;
|
|
256772
|
+
};
|
|
256773
|
+
}
|
|
256774
|
+
});
|
|
256775
|
+
|
|
256477
256776
|
// src/commands/cluster/multi-node.ts
|
|
256478
256777
|
var multi_node_exports = {};
|
|
256479
256778
|
__export(multi_node_exports, {
|
|
@@ -256557,15 +256856,15 @@ var list_environments_exports = {};
|
|
|
256557
256856
|
__export(list_environments_exports, {
|
|
256558
256857
|
default: () => list_environments_default
|
|
256559
256858
|
});
|
|
256560
|
-
var
|
|
256859
|
+
var import_rxjs28, import_operators12, list_environments_default;
|
|
256561
256860
|
var init_list_environments = __esm({
|
|
256562
256861
|
"src/commands/environment/list-environments.ts"() {
|
|
256563
|
-
|
|
256862
|
+
import_rxjs28 = __toESM(require_cjs());
|
|
256564
256863
|
import_operators12 = __toESM(require_operators());
|
|
256565
256864
|
init_helpers();
|
|
256566
256865
|
init_gql_client();
|
|
256567
256866
|
init_log();
|
|
256568
|
-
list_environments_default = (cmd) => (0,
|
|
256867
|
+
list_environments_default = (cmd) => (0, import_rxjs28.lastValueFrom)(
|
|
256569
256868
|
parseProjectId(cmd.project).pipe(
|
|
256570
256869
|
(0, import_operators12.switchMap)((projectId) => GraphqlClienAPI.listEnvironments(projectId)),
|
|
256571
256870
|
(0, import_operators12.tap)((data) => {
|
|
@@ -256637,10 +256936,10 @@ var create_environment_exports = {};
|
|
|
256637
256936
|
__export(create_environment_exports, {
|
|
256638
256937
|
default: () => create_environment_default
|
|
256639
256938
|
});
|
|
256640
|
-
var
|
|
256939
|
+
var import_rxjs29, import_operators13, create_environment_default;
|
|
256641
256940
|
var init_create_environment = __esm({
|
|
256642
256941
|
"src/commands/environment/create-environment.ts"() {
|
|
256643
|
-
|
|
256942
|
+
import_rxjs29 = __toESM(require_cjs());
|
|
256644
256943
|
import_operators13 = __toESM(require_operators());
|
|
256645
256944
|
init_helpers();
|
|
256646
256945
|
init_gql_client();
|
|
@@ -256649,7 +256948,7 @@ var init_create_environment = __esm({
|
|
|
256649
256948
|
init_environment_payload();
|
|
256650
256949
|
create_environment_default = (cmd) => {
|
|
256651
256950
|
const { clusterName: cmdClusterName, ...cmdRest } = cmd;
|
|
256652
|
-
return (0,
|
|
256951
|
+
return (0, import_rxjs29.lastValueFrom)(
|
|
256653
256952
|
parseProjectId(cmd.project).pipe(
|
|
256654
256953
|
(0, import_operators13.switchMap)(
|
|
256655
256954
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -256703,10 +257002,10 @@ var update_environment_exports = {};
|
|
|
256703
257002
|
__export(update_environment_exports, {
|
|
256704
257003
|
default: () => update_environment_default
|
|
256705
257004
|
});
|
|
256706
|
-
var
|
|
257005
|
+
var import_rxjs30, import_operators14, update_environment_default;
|
|
256707
257006
|
var init_update_environment = __esm({
|
|
256708
257007
|
"src/commands/environment/update-environment.ts"() {
|
|
256709
|
-
|
|
257008
|
+
import_rxjs30 = __toESM(require_cjs());
|
|
256710
257009
|
import_operators14 = __toESM(require_operators());
|
|
256711
257010
|
init_helpers();
|
|
256712
257011
|
init_gql_client();
|
|
@@ -256715,7 +257014,7 @@ var init_update_environment = __esm({
|
|
|
256715
257014
|
init_environment_payload();
|
|
256716
257015
|
update_environment_default = (cmd) => {
|
|
256717
257016
|
const { clusterName: cmdClusterName, ...cmdRest } = cmd;
|
|
256718
|
-
return (0,
|
|
257017
|
+
return (0, import_rxjs30.lastValueFrom)(
|
|
256719
257018
|
parseProjectId(cmd.project).pipe(
|
|
256720
257019
|
(0, import_operators14.switchMap)(
|
|
256721
257020
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -256770,16 +257069,16 @@ var delete_environment_exports = {};
|
|
|
256770
257069
|
__export(delete_environment_exports, {
|
|
256771
257070
|
default: () => delete_environment_default
|
|
256772
257071
|
});
|
|
256773
|
-
var
|
|
257072
|
+
var import_rxjs31, import_operators15, delete_environment_default;
|
|
256774
257073
|
var init_delete_environment = __esm({
|
|
256775
257074
|
"src/commands/environment/delete-environment.ts"() {
|
|
256776
|
-
|
|
257075
|
+
import_rxjs31 = __toESM(require_cjs());
|
|
256777
257076
|
import_operators15 = __toESM(require_operators());
|
|
256778
257077
|
init_helpers();
|
|
256779
257078
|
init_gql_client();
|
|
256780
257079
|
init_log();
|
|
256781
257080
|
init_load_spec();
|
|
256782
|
-
delete_environment_default = (cmd) => (0,
|
|
257081
|
+
delete_environment_default = (cmd) => (0, import_rxjs31.lastValueFrom)(
|
|
256783
257082
|
parseProjectId(cmd.project).pipe(
|
|
256784
257083
|
(0, import_operators15.switchMap)(
|
|
256785
257084
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -256832,16 +257131,16 @@ var get_environment_exports = {};
|
|
|
256832
257131
|
__export(get_environment_exports, {
|
|
256833
257132
|
default: () => get_environment_default
|
|
256834
257133
|
});
|
|
256835
|
-
var
|
|
257134
|
+
var import_rxjs32, import_operators16, get_environment_default;
|
|
256836
257135
|
var init_get_environment = __esm({
|
|
256837
257136
|
"src/commands/environment/get-environment.ts"() {
|
|
256838
|
-
|
|
257137
|
+
import_rxjs32 = __toESM(require_cjs());
|
|
256839
257138
|
import_operators16 = __toESM(require_operators());
|
|
256840
257139
|
init_helpers();
|
|
256841
257140
|
init_gql_client();
|
|
256842
257141
|
init_log();
|
|
256843
257142
|
init_load_spec();
|
|
256844
|
-
get_environment_default = (cmd) => (0,
|
|
257143
|
+
get_environment_default = (cmd) => (0, import_rxjs32.lastValueFrom)(
|
|
256845
257144
|
parseProjectId(cmd.project).pipe(
|
|
256846
257145
|
(0, import_operators16.switchMap)(
|
|
256847
257146
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -269338,7 +269637,7 @@ var require_async3 = __commonJS({
|
|
|
269338
269637
|
function groupBySeries(coll, iteratee, callback) {
|
|
269339
269638
|
return groupByLimit$1(coll, 1, iteratee, callback);
|
|
269340
269639
|
}
|
|
269341
|
-
var
|
|
269640
|
+
var log2 = consoleFunc("log");
|
|
269342
269641
|
function mapValuesLimit(obj, limit, iteratee, callback) {
|
|
269343
269642
|
callback = once(callback);
|
|
269344
269643
|
var newObj = {};
|
|
@@ -269866,7 +270165,7 @@ var require_async3 = __commonJS({
|
|
|
269866
270165
|
groupBy,
|
|
269867
270166
|
groupByLimit: groupByLimit$1,
|
|
269868
270167
|
groupBySeries,
|
|
269869
|
-
log,
|
|
270168
|
+
log: log2,
|
|
269870
270169
|
map: map$1,
|
|
269871
270170
|
mapLimit: mapLimit$1,
|
|
269872
270171
|
mapSeries: mapSeries$1,
|
|
@@ -269972,7 +270271,7 @@ var require_async3 = __commonJS({
|
|
|
269972
270271
|
exports3.groupBy = groupBy;
|
|
269973
270272
|
exports3.groupByLimit = groupByLimit$1;
|
|
269974
270273
|
exports3.groupBySeries = groupBySeries;
|
|
269975
|
-
exports3.log =
|
|
270274
|
+
exports3.log = log2;
|
|
269976
270275
|
exports3.map = map$1;
|
|
269977
270276
|
exports3.mapLimit = mapLimit$1;
|
|
269978
270277
|
exports3.mapSeries = mapSeries$1;
|
|
@@ -270050,7 +270349,7 @@ var require_polyfills = __commonJS({
|
|
|
270050
270349
|
var constants = require("constants");
|
|
270051
270350
|
var origCwd = process.cwd;
|
|
270052
270351
|
var cwd = null;
|
|
270053
|
-
var
|
|
270352
|
+
var platform2 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
270054
270353
|
process.cwd = function() {
|
|
270055
270354
|
if (!cwd)
|
|
270056
270355
|
cwd = origCwd.call(process);
|
|
@@ -270109,7 +270408,7 @@ var require_polyfills = __commonJS({
|
|
|
270109
270408
|
fs3.lchownSync = function() {
|
|
270110
270409
|
};
|
|
270111
270410
|
}
|
|
270112
|
-
if (
|
|
270411
|
+
if (platform2 === "win32") {
|
|
270113
270412
|
fs3.rename = /* @__PURE__ */ (function(fs$rename) {
|
|
270114
270413
|
return function(from16, to, cb) {
|
|
270115
270414
|
var start3 = Date.now();
|
|
@@ -278982,8 +279281,8 @@ var require_zip_archive_entry = __commonJS({
|
|
|
278982
279281
|
}
|
|
278983
279282
|
this.name = name2;
|
|
278984
279283
|
};
|
|
278985
|
-
ZipArchiveEntry.prototype.setPlatform = function(
|
|
278986
|
-
this.platform =
|
|
279284
|
+
ZipArchiveEntry.prototype.setPlatform = function(platform2) {
|
|
279285
|
+
this.platform = platform2;
|
|
278987
279286
|
};
|
|
278988
279287
|
ZipArchiveEntry.prototype.setSize = function(size) {
|
|
278989
279288
|
if (size < 0) {
|
|
@@ -288099,22 +288398,22 @@ var package_exports = {};
|
|
|
288099
288398
|
__export(package_exports, {
|
|
288100
288399
|
default: () => package_default
|
|
288101
288400
|
});
|
|
288102
|
-
var import_archiver,
|
|
288401
|
+
var import_archiver, import_child_process3, import_fs5, import_rxjs33, import_operators17, import_util3, ReadFile, package_default;
|
|
288103
288402
|
var init_package = __esm({
|
|
288104
288403
|
"src/commands/lambda/package.ts"() {
|
|
288105
288404
|
import_archiver = __toESM(require_archiver());
|
|
288106
|
-
|
|
288405
|
+
import_child_process3 = require("child_process");
|
|
288107
288406
|
import_fs5 = require("fs");
|
|
288108
|
-
|
|
288407
|
+
import_rxjs33 = __toESM(require_cjs());
|
|
288109
288408
|
import_operators17 = __toESM(require_operators());
|
|
288110
288409
|
import_util3 = require("util");
|
|
288111
288410
|
init_helpers2();
|
|
288112
288411
|
init_load_spec();
|
|
288113
288412
|
init_parse_ignore();
|
|
288114
288413
|
init_read_file();
|
|
288115
|
-
ReadFile = (file2) => readFileAsObservable(file2).pipe((0, import_operators17.catchError)(() => (0,
|
|
288414
|
+
ReadFile = (file2) => readFileAsObservable(file2).pipe((0, import_operators17.catchError)(() => (0, import_rxjs33.of)("")));
|
|
288116
288415
|
package_default = (cmd) => {
|
|
288117
|
-
return (0,
|
|
288416
|
+
return (0, import_rxjs33.lastValueFrom)(
|
|
288118
288417
|
loadSpec(cmd.spec).pipe(
|
|
288119
288418
|
(0, import_operators17.map)((spec) => spec?.function ?? spec),
|
|
288120
288419
|
(0, import_operators17.switchMap)(async (data) => {
|
|
@@ -288122,8 +288421,8 @@ var init_package = __esm({
|
|
|
288122
288421
|
zlib: { level: 9 }
|
|
288123
288422
|
// Sets the compression level.
|
|
288124
288423
|
});
|
|
288125
|
-
await (0, import_util3.promisify)(
|
|
288126
|
-
const ignore = await (0,
|
|
288424
|
+
await (0, import_util3.promisify)(import_child_process3.exec)(["chmod", "+x", data.script].join(" "));
|
|
288425
|
+
const ignore = await (0, import_rxjs33.lastValueFrom)(
|
|
288127
288426
|
ReadFile(".gignore").pipe(
|
|
288128
288427
|
(0, import_operators17.map)((ignore2) => parseIgnoredFiles(ignore2))
|
|
288129
288428
|
)
|
|
@@ -288132,11 +288431,11 @@ var init_package = __esm({
|
|
|
288132
288431
|
ignore: [".gcache/**", ...ignore]
|
|
288133
288432
|
});
|
|
288134
288433
|
archive.finalize();
|
|
288135
|
-
return (0,
|
|
288136
|
-
(0,
|
|
288434
|
+
return (0, import_rxjs33.lastValueFrom)(
|
|
288435
|
+
(0, import_rxjs33.from)(streamToBufferPromise(archive)).pipe(
|
|
288137
288436
|
(0, import_operators17.switchMap)(
|
|
288138
|
-
(buffer) => (0,
|
|
288139
|
-
(0, import_operators17.catchError)(() => (0,
|
|
288437
|
+
(buffer) => (0, import_rxjs33.from)((0, import_util3.promisify)(import_fs5.mkdir)(".gcache")).pipe(
|
|
288438
|
+
(0, import_operators17.catchError)(() => (0, import_rxjs33.of)(true)),
|
|
288140
288439
|
(0, import_operators17.switchMap)(
|
|
288141
288440
|
() => (0, import_util3.promisify)(import_fs5.writeFile)(`.gcache/${data.name}.zip`, buffer)
|
|
288142
288441
|
)
|
|
@@ -288162,13 +288461,13 @@ function streamToBufferPromise(file2) {
|
|
|
288162
288461
|
});
|
|
288163
288462
|
});
|
|
288164
288463
|
}
|
|
288165
|
-
var import_form_data, import_fs6,
|
|
288464
|
+
var import_form_data, import_fs6, import_rxjs34, import_operators18, import_stream_to_buffer, ReadFile2, createOrUpdateLambda, printAddresses, createCommand;
|
|
288166
288465
|
var init_helpers2 = __esm({
|
|
288167
288466
|
"src/commands/lambda/helpers/index.ts"() {
|
|
288168
288467
|
import_form_data = __toESM(require_form_data());
|
|
288169
288468
|
import_fs6 = require("fs");
|
|
288170
288469
|
init_src();
|
|
288171
|
-
|
|
288470
|
+
import_rxjs34 = __toESM(require_cjs());
|
|
288172
288471
|
import_operators18 = __toESM(require_operators());
|
|
288173
288472
|
import_stream_to_buffer = __toESM(require_stream_to_buffer());
|
|
288174
288473
|
init_helpers();
|
|
@@ -288177,14 +288476,14 @@ var init_helpers2 = __esm({
|
|
|
288177
288476
|
init_package();
|
|
288178
288477
|
init_load_spec();
|
|
288179
288478
|
init_read_file();
|
|
288180
|
-
ReadFile2 = (file2) => readFileAsObservable(file2).pipe((0, import_operators18.catchError)(() => (0,
|
|
288181
|
-
createOrUpdateLambda = (cmd, type) => (0,
|
|
288479
|
+
ReadFile2 = (file2) => readFileAsObservable(file2).pipe((0, import_operators18.catchError)(() => (0, import_rxjs34.of)("")));
|
|
288480
|
+
createOrUpdateLambda = (cmd, type) => (0, import_rxjs34.lastValueFrom)(
|
|
288182
288481
|
parseProjectId(cmd.project).pipe(
|
|
288183
288482
|
(0, import_operators18.switchMap)(
|
|
288184
288483
|
(projectId) => GraphqlClienAPI.getProject(projectId).pipe((0, import_operators18.map)(() => projectId))
|
|
288185
288484
|
),
|
|
288186
288485
|
(0, import_operators18.switchMap)(async (projectId) => {
|
|
288187
|
-
const spec = await (0,
|
|
288486
|
+
const spec = await (0, import_rxjs34.lastValueFrom)(loadSpec(cmd.spec));
|
|
288188
288487
|
return {
|
|
288189
288488
|
projectId,
|
|
288190
288489
|
...spec?.function ?? spec
|
|
@@ -288199,9 +288498,9 @@ var init_helpers2 = __esm({
|
|
|
288199
288498
|
await package_default(cmd);
|
|
288200
288499
|
const body = new import_form_data.default();
|
|
288201
288500
|
body.append("file[]", (0, import_fs6.createReadStream)(`.gcache/${data.name}.zip`));
|
|
288202
|
-
const config2 = await (0,
|
|
288203
|
-
return (0,
|
|
288204
|
-
(0,
|
|
288501
|
+
const config2 = await (0, import_rxjs34.lastValueFrom)(GraphqlClienAPI.getConfig());
|
|
288502
|
+
return (0, import_rxjs34.lastValueFrom)(
|
|
288503
|
+
(0, import_rxjs34.from)(
|
|
288205
288504
|
fetch2(config2.uploadUrl, {
|
|
288206
288505
|
method: "POST",
|
|
288207
288506
|
body,
|
|
@@ -288222,23 +288521,23 @@ var init_helpers2 = __esm({
|
|
|
288222
288521
|
);
|
|
288223
288522
|
}),
|
|
288224
288523
|
(0, import_operators18.switchMap)(async (payload) => {
|
|
288225
|
-
const clusterId = await (0,
|
|
288524
|
+
const clusterId = await (0, import_rxjs34.lastValueFrom)(
|
|
288226
288525
|
resolveClusterId(payload.projectId, {
|
|
288227
288526
|
clusterId: cmd.clusterId || payload.clusterId,
|
|
288228
288527
|
clusterName: cmd.clusterName || payload.clusterName
|
|
288229
288528
|
})
|
|
288230
288529
|
);
|
|
288231
|
-
return (0,
|
|
288530
|
+
return (0, import_rxjs34.lastValueFrom)(
|
|
288232
288531
|
GraphqlClienAPI[type]({
|
|
288233
|
-
code: cmd.code || await (0,
|
|
288532
|
+
code: cmd.code || await (0, import_rxjs34.lastValueFrom)(ReadFile2(cmd.file || payload.file)) || "",
|
|
288234
288533
|
name: cmd.name || payload.name || "",
|
|
288235
288534
|
projectId: payload.projectId,
|
|
288236
288535
|
route: cmd.route || payload.route || "",
|
|
288237
|
-
buildBashScript: cmd.buildBashScript || await (0,
|
|
288536
|
+
buildBashScript: cmd.buildBashScript || await (0, import_rxjs34.lastValueFrom)(ReadFile2(cmd.script || payload.script)) || "",
|
|
288238
288537
|
configs: cmd.configs || payload.configs || [],
|
|
288239
288538
|
env: cmd.env || payload.env || "nodejs",
|
|
288240
288539
|
method: cmd.method || payload.method || ["GET"],
|
|
288241
|
-
packageJson: cmd.packageJson || await (0,
|
|
288540
|
+
packageJson: cmd.packageJson || await (0, import_rxjs34.lastValueFrom)(ReadFile2(cmd.package || payload.package)) || "{}",
|
|
288242
288541
|
params: cmd.params || payload.params || [],
|
|
288243
288542
|
secrets: cmd.secrets || payload.secrets || [],
|
|
288244
288543
|
envSecrets: cmd.envSecrets || payload.envSecrets || [],
|
|
@@ -288279,9 +288578,20 @@ var init_helpers2 = __esm({
|
|
|
288279
288578
|
}),
|
|
288280
288579
|
(0, import_operators18.tap)((data) => {
|
|
288281
288580
|
Logger.info(JSON.stringify(data, null, 2));
|
|
288282
|
-
})
|
|
288581
|
+
}),
|
|
288582
|
+
(0, import_operators18.switchMap)((data) => printAddresses(data))
|
|
288283
288583
|
)
|
|
288284
288584
|
);
|
|
288585
|
+
printAddresses = (data) => (data?.id ? GraphqlClienAPI.getLambda(data.id, ["siteUrl"]).pipe(
|
|
288586
|
+
(0, import_operators18.map)((l) => l.siteUrl ?? null),
|
|
288587
|
+
(0, import_operators18.catchError)(() => (0, import_rxjs34.of)(null))
|
|
288588
|
+
) : (0, import_rxjs34.of)(null)).pipe(
|
|
288589
|
+
(0, import_operators18.tap)((siteUrl) => {
|
|
288590
|
+
if (data?.url) Logger.info(`URL: ${data.url}`);
|
|
288591
|
+
if (siteUrl) Logger.info(`Site: ${siteUrl}`);
|
|
288592
|
+
}),
|
|
288593
|
+
(0, import_operators18.map)(() => data)
|
|
288594
|
+
);
|
|
288285
288595
|
createCommand = (command) => (options) => (program2) => {
|
|
288286
288596
|
const cmd = program2.command(command);
|
|
288287
288597
|
for (const option of options) {
|
|
@@ -288297,15 +288607,15 @@ var list_exports2 = {};
|
|
|
288297
288607
|
__export(list_exports2, {
|
|
288298
288608
|
default: () => list_default2
|
|
288299
288609
|
});
|
|
288300
|
-
var
|
|
288610
|
+
var import_rxjs35, import_operators19, list_default2;
|
|
288301
288611
|
var init_list2 = __esm({
|
|
288302
288612
|
"src/commands/lambda/list.ts"() {
|
|
288303
|
-
|
|
288613
|
+
import_rxjs35 = __toESM(require_cjs());
|
|
288304
288614
|
import_operators19 = __toESM(require_operators());
|
|
288305
288615
|
init_helpers();
|
|
288306
288616
|
init_gql_client();
|
|
288307
288617
|
init_log();
|
|
288308
|
-
list_default2 = (cmd) => (0,
|
|
288618
|
+
list_default2 = (cmd) => (0, import_rxjs35.lastValueFrom)(
|
|
288309
288619
|
parseProjectId(cmd.project).pipe(
|
|
288310
288620
|
(0, import_operators19.switchMap)(
|
|
288311
288621
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288340,10 +288650,10 @@ var get_exports = {};
|
|
|
288340
288650
|
__export(get_exports, {
|
|
288341
288651
|
default: () => get_default
|
|
288342
288652
|
});
|
|
288343
|
-
var
|
|
288653
|
+
var import_rxjs36, import_operators20, get_default;
|
|
288344
288654
|
var init_get = __esm({
|
|
288345
288655
|
"src/commands/lambda/get.ts"() {
|
|
288346
|
-
|
|
288656
|
+
import_rxjs36 = __toESM(require_cjs());
|
|
288347
288657
|
import_operators20 = __toESM(require_operators());
|
|
288348
288658
|
init_helpers();
|
|
288349
288659
|
init_gql_client();
|
|
@@ -288365,26 +288675,26 @@ var init_get = __esm({
|
|
|
288365
288675
|
Logger.log("-------------------");
|
|
288366
288676
|
});
|
|
288367
288677
|
if (cmd.lambda) {
|
|
288368
|
-
return (0,
|
|
288678
|
+
return (0, import_rxjs36.lastValueFrom)(
|
|
288369
288679
|
isMongoId(cmd.lambda).pipe(
|
|
288370
288680
|
(0, import_operators20.switchMap)((id) => GraphqlClienAPI.getLambda(id)),
|
|
288371
288681
|
table
|
|
288372
288682
|
)
|
|
288373
288683
|
);
|
|
288374
288684
|
}
|
|
288375
|
-
const spec = await (0,
|
|
288685
|
+
const spec = await (0, import_rxjs36.lastValueFrom)(loadSpec(cmd.spec));
|
|
288376
288686
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288377
288687
|
if (name2) {
|
|
288378
|
-
return (0,
|
|
288688
|
+
return (0, import_rxjs36.lastValueFrom)(
|
|
288379
288689
|
parseProjectId(cmd.project).pipe(
|
|
288380
288690
|
(0, import_operators20.catchError)((error48) => {
|
|
288381
288691
|
if (!cmd.project) {
|
|
288382
|
-
return (0,
|
|
288692
|
+
return (0, import_rxjs36.throwError)(
|
|
288383
288693
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
288384
288694
|
Hint: "gcli lambda:get --name ${name2} --project your-project-id"`
|
|
288385
288695
|
);
|
|
288386
288696
|
}
|
|
288387
|
-
return (0,
|
|
288697
|
+
return (0, import_rxjs36.throwError)(() => error48);
|
|
288388
288698
|
}),
|
|
288389
288699
|
(0, import_operators20.switchMap)(
|
|
288390
288700
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288441,22 +288751,22 @@ var delete_exports = {};
|
|
|
288441
288751
|
__export(delete_exports, {
|
|
288442
288752
|
default: () => delete_default
|
|
288443
288753
|
});
|
|
288444
|
-
var
|
|
288754
|
+
var import_rxjs37, import_operators21, delete_default;
|
|
288445
288755
|
var init_delete = __esm({
|
|
288446
288756
|
"src/commands/lambda/delete.ts"() {
|
|
288447
|
-
|
|
288757
|
+
import_rxjs37 = __toESM(require_cjs());
|
|
288448
288758
|
import_operators21 = __toESM(require_operators());
|
|
288449
288759
|
init_helpers();
|
|
288450
288760
|
init_gql_client();
|
|
288451
288761
|
init_log();
|
|
288452
288762
|
init_load_spec();
|
|
288453
288763
|
delete_default = async (cmd) => {
|
|
288454
|
-
const spec = await (0,
|
|
288764
|
+
const spec = await (0, import_rxjs37.lastValueFrom)(loadSpec(cmd.spec));
|
|
288455
288765
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288456
288766
|
const env = cmd.env ?? spec.function?.env ?? spec.env;
|
|
288457
288767
|
const clusterIdHint = cmd.clusterId ?? spec.function?.clusterId ?? spec.clusterId;
|
|
288458
288768
|
const clusterNameHint = cmd.clusterName ?? spec.function?.clusterName ?? spec.clusterName;
|
|
288459
|
-
return (0,
|
|
288769
|
+
return (0, import_rxjs37.lastValueFrom)(
|
|
288460
288770
|
parseProjectId(cmd.project).pipe(
|
|
288461
288771
|
(0, import_operators21.switchMap)(
|
|
288462
288772
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288491,10 +288801,10 @@ var logs_exports = {};
|
|
|
288491
288801
|
__export(logs_exports, {
|
|
288492
288802
|
default: () => logs_default
|
|
288493
288803
|
});
|
|
288494
|
-
var
|
|
288804
|
+
var import_rxjs38, import_operators22, logs_default;
|
|
288495
288805
|
var init_logs = __esm({
|
|
288496
288806
|
"src/commands/lambda/logs.ts"() {
|
|
288497
|
-
|
|
288807
|
+
import_rxjs38 = __toESM(require_cjs());
|
|
288498
288808
|
import_operators22 = __toESM(require_operators());
|
|
288499
288809
|
init_helpers();
|
|
288500
288810
|
init_gql_client();
|
|
@@ -288503,26 +288813,26 @@ var init_logs = __esm({
|
|
|
288503
288813
|
logs_default = async (cmd) => {
|
|
288504
288814
|
const result = (0, import_operators22.tap)(({ data }) => Logger.log(data));
|
|
288505
288815
|
if (cmd.lambda) {
|
|
288506
|
-
return (0,
|
|
288816
|
+
return (0, import_rxjs38.lastValueFrom)(
|
|
288507
288817
|
isMongoId(cmd.lambda).pipe(
|
|
288508
288818
|
(0, import_operators22.switchMap)((id) => GraphqlClienAPI.getLambdaLogs(id)),
|
|
288509
288819
|
result
|
|
288510
288820
|
)
|
|
288511
288821
|
);
|
|
288512
288822
|
}
|
|
288513
|
-
const spec = await (0,
|
|
288823
|
+
const spec = await (0, import_rxjs38.lastValueFrom)(loadSpec(cmd.spec));
|
|
288514
288824
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288515
288825
|
if (name2) {
|
|
288516
|
-
return (0,
|
|
288826
|
+
return (0, import_rxjs38.lastValueFrom)(
|
|
288517
288827
|
parseProjectId(cmd.project).pipe(
|
|
288518
288828
|
(0, import_operators22.catchError)((error48) => {
|
|
288519
288829
|
if (!cmd.project) {
|
|
288520
|
-
return (0,
|
|
288830
|
+
return (0, import_rxjs38.throwError)(
|
|
288521
288831
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
288522
288832
|
Hint: "gcli lambda:logs --name ${name2} --project your-project-id"`
|
|
288523
288833
|
);
|
|
288524
288834
|
}
|
|
288525
|
-
return (0,
|
|
288835
|
+
return (0, import_rxjs38.throwError)(() => error48);
|
|
288526
288836
|
}),
|
|
288527
288837
|
(0, import_operators22.switchMap)(
|
|
288528
288838
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288548,10 +288858,10 @@ var logs_builder_exports = {};
|
|
|
288548
288858
|
__export(logs_builder_exports, {
|
|
288549
288859
|
default: () => logs_builder_default
|
|
288550
288860
|
});
|
|
288551
|
-
var
|
|
288861
|
+
var import_rxjs39, import_operators23, logs_builder_default;
|
|
288552
288862
|
var init_logs_builder = __esm({
|
|
288553
288863
|
"src/commands/lambda/logs-builder.ts"() {
|
|
288554
|
-
|
|
288864
|
+
import_rxjs39 = __toESM(require_cjs());
|
|
288555
288865
|
import_operators23 = __toESM(require_operators());
|
|
288556
288866
|
init_helpers();
|
|
288557
288867
|
init_gql_client();
|
|
@@ -288560,26 +288870,26 @@ var init_logs_builder = __esm({
|
|
|
288560
288870
|
logs_builder_default = async (cmd) => {
|
|
288561
288871
|
const result = (0, import_operators23.tap)(({ data }) => Logger.log(data));
|
|
288562
288872
|
if (cmd.lambda) {
|
|
288563
|
-
return (0,
|
|
288873
|
+
return (0, import_rxjs39.lastValueFrom)(
|
|
288564
288874
|
isMongoId(cmd.lambda).pipe(
|
|
288565
288875
|
(0, import_operators23.switchMap)((id) => GraphqlClienAPI.getLambdaBuilderLogs(id)),
|
|
288566
288876
|
result
|
|
288567
288877
|
)
|
|
288568
288878
|
);
|
|
288569
288879
|
}
|
|
288570
|
-
const spec = await (0,
|
|
288880
|
+
const spec = await (0, import_rxjs39.lastValueFrom)(loadSpec(cmd.spec));
|
|
288571
288881
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288572
288882
|
if (name2) {
|
|
288573
|
-
return (0,
|
|
288883
|
+
return (0, import_rxjs39.lastValueFrom)(
|
|
288574
288884
|
parseProjectId(cmd.project).pipe(
|
|
288575
288885
|
(0, import_operators23.catchError)((error48) => {
|
|
288576
288886
|
if (!cmd.project) {
|
|
288577
|
-
return (0,
|
|
288887
|
+
return (0, import_rxjs39.throwError)(
|
|
288578
288888
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
288579
288889
|
Hint: "gcli lambda:logs --name ${name2} --project your-project-id"`
|
|
288580
288890
|
);
|
|
288581
288891
|
}
|
|
288582
|
-
return (0,
|
|
288892
|
+
return (0, import_rxjs39.throwError)(() => error48);
|
|
288583
288893
|
}),
|
|
288584
288894
|
(0, import_operators23.switchMap)(
|
|
288585
288895
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288609,18 +288919,18 @@ var test_exports = {};
|
|
|
288609
288919
|
__export(test_exports, {
|
|
288610
288920
|
default: () => test_default
|
|
288611
288921
|
});
|
|
288612
|
-
var
|
|
288922
|
+
var import_rxjs40, import_operators24, test_default;
|
|
288613
288923
|
var init_test = __esm({
|
|
288614
288924
|
"src/commands/lambda/test.ts"() {
|
|
288615
|
-
|
|
288925
|
+
import_rxjs40 = __toESM(require_cjs());
|
|
288616
288926
|
import_operators24 = __toESM(require_operators());
|
|
288617
288927
|
init_helpers();
|
|
288618
288928
|
init_gql_client();
|
|
288619
288929
|
init_log();
|
|
288620
288930
|
init_load_spec();
|
|
288621
288931
|
test_default = async (cmd) => {
|
|
288622
|
-
const spec = await (0,
|
|
288623
|
-
const processParameters = (lambda) => (0,
|
|
288932
|
+
const spec = await (0, import_rxjs40.lastValueFrom)(loadSpec(cmd.spec));
|
|
288933
|
+
const processParameters = (lambda) => (0, import_rxjs40.of)(lambda).pipe(
|
|
288624
288934
|
(0, import_operators24.map)((lambda2) => ({
|
|
288625
288935
|
...lambda2,
|
|
288626
288936
|
url: cmd.pathParams ? cmd.pathParams.split(";").map((param) => param.split("=")).reduce(
|
|
@@ -288634,7 +288944,7 @@ var init_test = __esm({
|
|
|
288634
288944
|
);
|
|
288635
288945
|
}),
|
|
288636
288946
|
(0, import_operators24.switchMap)(
|
|
288637
|
-
(lambda2) => (0,
|
|
288947
|
+
(lambda2) => (0, import_rxjs40.from)(
|
|
288638
288948
|
fetch([lambda2.url, cmd.queryParams].filter((i2) => !!i2).join(""), {
|
|
288639
288949
|
method: cmd?.method ?? "GET",
|
|
288640
288950
|
body: cmd.body
|
|
@@ -288650,7 +288960,7 @@ var init_test = __esm({
|
|
|
288650
288960
|
})
|
|
288651
288961
|
);
|
|
288652
288962
|
if (cmd.lambda) {
|
|
288653
|
-
return (0,
|
|
288963
|
+
return (0, import_rxjs40.lastValueFrom)(
|
|
288654
288964
|
isMongoId(cmd.lambda).pipe(
|
|
288655
288965
|
(0, import_operators24.switchMap)(
|
|
288656
288966
|
(id) => GraphqlClienAPI.getLambda(id, ["id", "url", "method", "params"])
|
|
@@ -288661,16 +288971,16 @@ var init_test = __esm({
|
|
|
288661
288971
|
}
|
|
288662
288972
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288663
288973
|
if (name2) {
|
|
288664
|
-
return (0,
|
|
288974
|
+
return (0, import_rxjs40.lastValueFrom)(
|
|
288665
288975
|
parseProjectId(cmd.project).pipe(
|
|
288666
288976
|
(0, import_operators24.catchError)((error48) => {
|
|
288667
288977
|
if (!cmd.project) {
|
|
288668
|
-
return (0,
|
|
288978
|
+
return (0, import_rxjs40.throwError)(
|
|
288669
288979
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
288670
288980
|
Hint: "gcli lambda:get --name ${name2} --project your-project-id"`
|
|
288671
288981
|
);
|
|
288672
288982
|
}
|
|
288673
|
-
return (0,
|
|
288983
|
+
return (0, import_rxjs40.throwError)(() => error48);
|
|
288674
288984
|
}),
|
|
288675
288985
|
(0, import_operators24.switchMap)(
|
|
288676
288986
|
(projectId) => GraphqlClienAPI.getLambdaByName(name2, projectId, [
|
|
@@ -288694,14 +289004,14 @@ var list_exports3 = {};
|
|
|
288694
289004
|
__export(list_exports3, {
|
|
288695
289005
|
default: () => list_default3
|
|
288696
289006
|
});
|
|
288697
|
-
var
|
|
289007
|
+
var import_rxjs41, import_operators25, list_default3;
|
|
288698
289008
|
var init_list3 = __esm({
|
|
288699
289009
|
"src/commands/plugin/list.ts"() {
|
|
288700
|
-
|
|
289010
|
+
import_rxjs41 = __toESM(require_cjs());
|
|
288701
289011
|
import_operators25 = __toESM(require_operators());
|
|
288702
289012
|
init_gql_client();
|
|
288703
289013
|
init_log();
|
|
288704
|
-
list_default3 = () => (0,
|
|
289014
|
+
list_default3 = () => (0, import_rxjs41.lastValueFrom)(
|
|
288705
289015
|
GraphqlClienAPI.listAvailablePlugins().pipe(
|
|
288706
289016
|
(0, import_operators25.tap)((plugins) => {
|
|
288707
289017
|
Logger.log("-------------------");
|
|
@@ -288726,15 +289036,15 @@ var installed_exports = {};
|
|
|
288726
289036
|
__export(installed_exports, {
|
|
288727
289037
|
default: () => installed_default
|
|
288728
289038
|
});
|
|
288729
|
-
var
|
|
289039
|
+
var import_rxjs42, import_operators26, installed_default;
|
|
288730
289040
|
var init_installed = __esm({
|
|
288731
289041
|
"src/commands/plugin/installed.ts"() {
|
|
288732
|
-
|
|
289042
|
+
import_rxjs42 = __toESM(require_cjs());
|
|
288733
289043
|
import_operators26 = __toESM(require_operators());
|
|
288734
289044
|
init_helpers();
|
|
288735
289045
|
init_gql_client();
|
|
288736
289046
|
init_log();
|
|
288737
|
-
installed_default = (cmd) => (0,
|
|
289047
|
+
installed_default = (cmd) => (0, import_rxjs42.lastValueFrom)(
|
|
288738
289048
|
parseProjectId(cmd.project).pipe(
|
|
288739
289049
|
(0, import_operators26.switchMap)((projectId) => GraphqlClienAPI.listInstalledPlugins(projectId)),
|
|
288740
289050
|
(0, import_operators26.tap)((installed) => {
|
|
@@ -288765,16 +289075,16 @@ var install_exports = {};
|
|
|
288765
289075
|
__export(install_exports, {
|
|
288766
289076
|
default: () => install_default
|
|
288767
289077
|
});
|
|
288768
|
-
var
|
|
289078
|
+
var import_rxjs43, import_operators27, install_default;
|
|
288769
289079
|
var init_install = __esm({
|
|
288770
289080
|
"src/commands/plugin/install.ts"() {
|
|
288771
|
-
|
|
289081
|
+
import_rxjs43 = __toESM(require_cjs());
|
|
288772
289082
|
import_operators27 = __toESM(require_operators());
|
|
288773
289083
|
init_helpers();
|
|
288774
289084
|
init_gql_client();
|
|
288775
289085
|
init_log();
|
|
288776
289086
|
init_load_spec();
|
|
288777
|
-
install_default = (cmd) => (0,
|
|
289087
|
+
install_default = (cmd) => (0, import_rxjs43.lastValueFrom)(
|
|
288778
289088
|
parseProjectId(cmd.project).pipe(
|
|
288779
289089
|
(0, import_operators27.switchMap)(
|
|
288780
289090
|
(projectId) => loadSpec(
|
|
@@ -288783,7 +289093,7 @@ var init_install = __esm({
|
|
|
288783
289093
|
// No spec file is required at all if --name/--cluster fully
|
|
288784
289094
|
// cover it (unlike every other resource here, a plugin install
|
|
288785
289095
|
// is often just "install this by name", no YAML needed).
|
|
288786
|
-
(0, import_operators27.catchError)(() => (0,
|
|
289096
|
+
(0, import_operators27.catchError)(() => (0, import_rxjs43.of)(void 0)),
|
|
288787
289097
|
(0, import_operators27.map)((data) => ({
|
|
288788
289098
|
projectId,
|
|
288789
289099
|
...data ? data.plugin ?? data : {}
|
|
@@ -288814,15 +289124,15 @@ var uninstall_exports = {};
|
|
|
288814
289124
|
__export(uninstall_exports, {
|
|
288815
289125
|
default: () => uninstall_default
|
|
288816
289126
|
});
|
|
288817
|
-
var
|
|
289127
|
+
var import_rxjs44, import_operators28, uninstall_default;
|
|
288818
289128
|
var init_uninstall = __esm({
|
|
288819
289129
|
"src/commands/plugin/uninstall.ts"() {
|
|
288820
|
-
|
|
289130
|
+
import_rxjs44 = __toESM(require_cjs());
|
|
288821
289131
|
import_operators28 = __toESM(require_operators());
|
|
288822
289132
|
init_helpers();
|
|
288823
289133
|
init_gql_client();
|
|
288824
289134
|
init_log();
|
|
288825
|
-
uninstall_default = (cmd) => (0,
|
|
289135
|
+
uninstall_default = (cmd) => (0, import_rxjs44.lastValueFrom)(
|
|
288826
289136
|
parseProjectId(cmd.project).pipe(
|
|
288827
289137
|
(0, import_operators28.switchMap)(
|
|
288828
289138
|
(projectId) => GraphqlClienAPI.uninstallPlugin(projectId, cmd.name, cmd.cluster)
|
|
@@ -288842,14 +289152,14 @@ var list_exports4 = {};
|
|
|
288842
289152
|
__export(list_exports4, {
|
|
288843
289153
|
default: () => list_default4
|
|
288844
289154
|
});
|
|
288845
|
-
var
|
|
289155
|
+
var import_rxjs45, import_operators29, list_default4;
|
|
288846
289156
|
var init_list4 = __esm({
|
|
288847
289157
|
"src/commands/project/list.ts"() {
|
|
288848
|
-
|
|
289158
|
+
import_rxjs45 = __toESM(require_cjs());
|
|
288849
289159
|
import_operators29 = __toESM(require_operators());
|
|
288850
289160
|
init_gql_client();
|
|
288851
289161
|
init_log();
|
|
288852
|
-
list_default4 = async () => (0,
|
|
289162
|
+
list_default4 = async () => (0, import_rxjs45.lastValueFrom)(
|
|
288853
289163
|
GraphqlClienAPI.listProjects().pipe(
|
|
288854
289164
|
(0, import_operators29.tap)((project) => {
|
|
288855
289165
|
const columns = ["id", "name"];
|
|
@@ -288868,24 +289178,24 @@ var use_exports = {};
|
|
|
288868
289178
|
__export(use_exports, {
|
|
288869
289179
|
default: () => use_default
|
|
288870
289180
|
});
|
|
288871
|
-
var import_fs7,
|
|
289181
|
+
var import_fs7, import_rxjs46, import_operators30, import_util4, use_default;
|
|
288872
289182
|
var init_use = __esm({
|
|
288873
289183
|
"src/commands/project/use.ts"() {
|
|
288874
289184
|
import_fs7 = require("fs");
|
|
288875
|
-
|
|
289185
|
+
import_rxjs46 = __toESM(require_cjs());
|
|
288876
289186
|
import_operators30 = __toESM(require_operators());
|
|
288877
289187
|
import_util4 = require("util");
|
|
288878
289188
|
init_helpers();
|
|
288879
289189
|
init_gql_client();
|
|
288880
289190
|
init_types();
|
|
288881
289191
|
use_default = async (cmd) => {
|
|
288882
|
-
return (0,
|
|
289192
|
+
return (0, import_rxjs46.lastValueFrom)(
|
|
288883
289193
|
parseProjectId(cmd).pipe(
|
|
288884
289194
|
(0, import_operators30.switchMap)(
|
|
288885
289195
|
(projectId) => GraphqlClienAPI.getProject(projectId).pipe((0, import_operators30.map)(() => projectId))
|
|
288886
289196
|
),
|
|
288887
289197
|
(0, import_operators30.switchMap)(
|
|
288888
|
-
(projectId) => (0,
|
|
289198
|
+
(projectId) => (0, import_rxjs46.from)(
|
|
288889
289199
|
(0, import_util4.promisify)(import_fs7.writeFile)(projectDirectory, projectId, {
|
|
288890
289200
|
encoding: "utf-8"
|
|
288891
289201
|
})
|
|
@@ -293880,7 +294190,7 @@ __export(regexes_exports, {
|
|
|
293880
294190
|
extendedDuration: () => extendedDuration,
|
|
293881
294191
|
guid: () => guid,
|
|
293882
294192
|
hex: () => hex,
|
|
293883
|
-
hostname: () =>
|
|
294193
|
+
hostname: () => hostname2,
|
|
293884
294194
|
html5Email: () => html5Email,
|
|
293885
294195
|
idnEmail: () => idnEmail,
|
|
293886
294196
|
integer: () => integer,
|
|
@@ -293947,7 +294257,7 @@ function fixedBase64(bodyLength, padding) {
|
|
|
293947
294257
|
function fixedBase64url(length) {
|
|
293948
294258
|
return new RegExp(`^[A-Za-z0-9_-]{${length}}$`);
|
|
293949
294259
|
}
|
|
293950
|
-
var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, extendedDuration, guid, uuid, uuid4, uuid6, uuid7, email, html5Email, rfc5322Email, unicodeEmail, idnEmail, browserEmail, _emoji, ipv4, ipv6, mac, cidrv4, cidrv6, base64, base64url,
|
|
294260
|
+
var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, extendedDuration, guid, uuid, uuid4, uuid6, uuid7, email, html5Email, rfc5322Email, unicodeEmail, idnEmail, browserEmail, _emoji, ipv4, ipv6, mac, cidrv4, cidrv6, base64, base64url, hostname2, domain, e164, dateSource, date, string, bigint, integer, number, boolean, _null, _undefined, lowercase, uppercase, hex, md5_hex, md5_base64, md5_base64url, sha1_hex, sha1_base64, sha1_base64url, sha256_hex, sha256_base64, sha256_base64url, sha384_hex, sha384_base64, sha384_base64url, sha512_hex, sha512_base64, sha512_base64url;
|
|
293951
294261
|
var init_regexes = __esm({
|
|
293952
294262
|
"../../node_modules/zod/v4/core/regexes.js"() {
|
|
293953
294263
|
init_util2();
|
|
@@ -293985,7 +294295,7 @@ var init_regexes = __esm({
|
|
|
293985
294295
|
cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
293986
294296
|
base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
293987
294297
|
base64url = /^[A-Za-z0-9_-]*$/;
|
|
293988
|
-
|
|
294298
|
+
hostname2 = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
|
|
293989
294299
|
domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
|
|
293990
294300
|
e164 = /^\+[1-9]\d{6,14}$/;
|
|
293991
294301
|
dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
@@ -305332,7 +305642,7 @@ __export(schemas_exports3, {
|
|
|
305332
305642
|
guid: () => guid2,
|
|
305333
305643
|
hash: () => hash,
|
|
305334
305644
|
hex: () => hex2,
|
|
305335
|
-
hostname: () =>
|
|
305645
|
+
hostname: () => hostname3,
|
|
305336
305646
|
httpUrl: () => httpUrl,
|
|
305337
305647
|
instanceof: () => _instanceof,
|
|
305338
305648
|
int: () => int,
|
|
@@ -305479,7 +305789,7 @@ function jwt(params) {
|
|
|
305479
305789
|
function stringFormat(format, fnOrRegex, _params = {}) {
|
|
305480
305790
|
return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
|
|
305481
305791
|
}
|
|
305482
|
-
function
|
|
305792
|
+
function hostname3(_params) {
|
|
305483
305793
|
return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
|
|
305484
305794
|
}
|
|
305485
305795
|
function hex2(_params) {
|
|
@@ -307165,7 +307475,7 @@ __export(external_exports3, {
|
|
|
307165
307475
|
guid: () => guid2,
|
|
307166
307476
|
hash: () => hash,
|
|
307167
307477
|
hex: () => hex2,
|
|
307168
|
-
hostname: () =>
|
|
307478
|
+
hostname: () => hostname3,
|
|
307169
307479
|
httpUrl: () => httpUrl,
|
|
307170
307480
|
includes: () => _includes,
|
|
307171
307481
|
instanceof: () => _instanceof,
|
|
@@ -314451,11 +314761,11 @@ var require_core2 = __commonJS({
|
|
|
314451
314761
|
Ajv2.ValidationError = validation_error_1.default;
|
|
314452
314762
|
Ajv2.MissingRefError = ref_error_1.default;
|
|
314453
314763
|
exports2.default = Ajv2;
|
|
314454
|
-
function checkOptions(checkOpts, options, msg,
|
|
314764
|
+
function checkOptions(checkOpts, options, msg, log2 = "error") {
|
|
314455
314765
|
for (const key in checkOpts) {
|
|
314456
314766
|
const opt = key;
|
|
314457
314767
|
if (opt in options)
|
|
314458
|
-
this.logger[
|
|
314768
|
+
this.logger[log2](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
314459
314769
|
}
|
|
314460
314770
|
}
|
|
314461
314771
|
function getSchEnv(keyRef) {
|
|
@@ -319716,6 +320026,105 @@ var init_zod = __esm({
|
|
|
319716
320026
|
}
|
|
319717
320027
|
});
|
|
319718
320028
|
|
|
320029
|
+
// src/commands/proxy/login-gate.ts
|
|
320030
|
+
var LOGIN_TOOL, log, startLoginGate;
|
|
320031
|
+
var init_login_gate = __esm({
|
|
320032
|
+
"src/commands/proxy/login-gate.ts"() {
|
|
320033
|
+
init_server2();
|
|
320034
|
+
init_stdio2();
|
|
320035
|
+
init_types4();
|
|
320036
|
+
init_browser_login();
|
|
320037
|
+
init_login();
|
|
320038
|
+
LOGIN_TOOL = "LambforgeLogin";
|
|
320039
|
+
log = (line) => process.stderr.write(`${line}
|
|
320040
|
+
`);
|
|
320041
|
+
startLoginGate = async (apiUrl) => {
|
|
320042
|
+
let state = { kind: "idle" };
|
|
320043
|
+
const begin = async () => {
|
|
320044
|
+
const start3 = await startBrowserLogin(apiUrl);
|
|
320045
|
+
state = { kind: "waiting", start: start3 };
|
|
320046
|
+
log(
|
|
320047
|
+
`Lambforge login: open ${start3.verificationUrl} (code ${start3.userCode})`
|
|
320048
|
+
);
|
|
320049
|
+
waitForApproval(apiUrl, start3).then(async ({ token, key }) => {
|
|
320050
|
+
await loginWithToken({
|
|
320051
|
+
token,
|
|
320052
|
+
key,
|
|
320053
|
+
url: apiUrl,
|
|
320054
|
+
uploadUrl: "",
|
|
320055
|
+
ci: false,
|
|
320056
|
+
silent: true
|
|
320057
|
+
});
|
|
320058
|
+
state = { kind: "done" };
|
|
320059
|
+
log("Lambforge login saved - reconnect this MCP server.");
|
|
320060
|
+
}).catch((e2) => {
|
|
320061
|
+
state = { kind: "failed", error: e2.message };
|
|
320062
|
+
log(`Lambforge login failed: ${e2.message}`);
|
|
320063
|
+
});
|
|
320064
|
+
return start3;
|
|
320065
|
+
};
|
|
320066
|
+
const answer = async () => {
|
|
320067
|
+
if (state.kind === "done") {
|
|
320068
|
+
return 'Logged in. Ask the user to reconnect the "lambforge" MCP server (in Claude Code: /mcp -> lambforge -> Reconnect); after that every Lambforge tool is available.';
|
|
320069
|
+
}
|
|
320070
|
+
if (state.kind === "waiting") {
|
|
320071
|
+
const { start: start4 } = state;
|
|
320072
|
+
return `Still waiting. Ask the user to open ${start4.verificationUrl} and approve code ${start4.userCode}, then call ${LOGIN_TOOL} again.`;
|
|
320073
|
+
}
|
|
320074
|
+
const start3 = await begin();
|
|
320075
|
+
return [
|
|
320076
|
+
"Not logged in to Lambforge yet. Show the user this link and code:",
|
|
320077
|
+
"",
|
|
320078
|
+
` ${start3.verificationUrl}`,
|
|
320079
|
+
` Code: ${start3.userCode}`,
|
|
320080
|
+
"",
|
|
320081
|
+
"They open it (signed in to lambforge.com), check the code matches and press Approve.",
|
|
320082
|
+
`Then call ${LOGIN_TOOL} again; it reports when the login is saved.`,
|
|
320083
|
+
"You cannot approve it yourself."
|
|
320084
|
+
].join("\n");
|
|
320085
|
+
};
|
|
320086
|
+
const server2 = new Server(
|
|
320087
|
+
{ name: "gapi-proxy", version: "1.0.0" },
|
|
320088
|
+
{ capabilities: { tools: {} } }
|
|
320089
|
+
);
|
|
320090
|
+
server2.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
320091
|
+
tools: [
|
|
320092
|
+
{
|
|
320093
|
+
name: LOGIN_TOOL,
|
|
320094
|
+
description: "gcli is not logged in to Lambforge, so no other Lambforge tool is available yet. Call this to get a login link and code for the user; call again to check whether they approved it.",
|
|
320095
|
+
inputSchema: { type: "object", properties: {} }
|
|
320096
|
+
}
|
|
320097
|
+
]
|
|
320098
|
+
}));
|
|
320099
|
+
server2.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
320100
|
+
if (request.params.name !== LOGIN_TOOL) {
|
|
320101
|
+
return {
|
|
320102
|
+
isError: true,
|
|
320103
|
+
content: [
|
|
320104
|
+
{
|
|
320105
|
+
type: "text",
|
|
320106
|
+
text: `Not logged in to Lambforge - call ${LOGIN_TOOL} first.`
|
|
320107
|
+
}
|
|
320108
|
+
]
|
|
320109
|
+
};
|
|
320110
|
+
}
|
|
320111
|
+
try {
|
|
320112
|
+
return { content: [{ type: "text", text: await answer() }] };
|
|
320113
|
+
} catch (e2) {
|
|
320114
|
+
if (state.kind === "failed") state = { kind: "idle" };
|
|
320115
|
+
return {
|
|
320116
|
+
isError: true,
|
|
320117
|
+
content: [{ type: "text", text: e2.message }]
|
|
320118
|
+
};
|
|
320119
|
+
}
|
|
320120
|
+
});
|
|
320121
|
+
await server2.connect(new StdioServerTransport());
|
|
320122
|
+
log(`Not logged in - serving only ${LOGIN_TOOL}.`);
|
|
320123
|
+
await new Promise(() => void 0);
|
|
320124
|
+
};
|
|
320125
|
+
}
|
|
320126
|
+
});
|
|
320127
|
+
|
|
319719
320128
|
// src/commands/proxy/start.ts
|
|
319720
320129
|
var start_exports = {};
|
|
319721
320130
|
__export(start_exports, {
|
|
@@ -319724,7 +320133,12 @@ __export(start_exports, {
|
|
|
319724
320133
|
performFetch: () => performFetch
|
|
319725
320134
|
});
|
|
319726
320135
|
async function startProxy(cmd) {
|
|
319727
|
-
|
|
320136
|
+
if (!(0, import_fs9.existsSync)(tokenDirectory)) {
|
|
320137
|
+
return startLoginGate(
|
|
320138
|
+
cmd.url ? cmd.url.replace(/\/mcp\/?$/, "") : "https://api.lambforge.com"
|
|
320139
|
+
);
|
|
320140
|
+
}
|
|
320141
|
+
return (0, import_rxjs47.lastValueFrom)(
|
|
319728
320142
|
GraphqlClienAPI.getConfig().pipe(
|
|
319729
320143
|
(0, import_operators31.take)(1),
|
|
319730
320144
|
(0, import_operators31.map)((config2) => ({
|
|
@@ -319740,7 +320154,7 @@ async function startProxy(cmd) {
|
|
|
319740
320154
|
process.stderr.write("Retrieving config for auth...\n");
|
|
319741
320155
|
}),
|
|
319742
320156
|
(0, import_operators31.switchMap)(
|
|
319743
|
-
(config2) => config2?.token ? (0,
|
|
320157
|
+
(config2) => config2?.token ? (0, import_rxjs47.of)(config2) : (0, import_rxjs47.throwError)(
|
|
319744
320158
|
() => new Error("User is not authenticated (no token in config)")
|
|
319745
320159
|
)
|
|
319746
320160
|
),
|
|
@@ -319758,7 +320172,7 @@ async function startProxy(cmd) {
|
|
|
319758
320172
|
Authorization: config2.token
|
|
319759
320173
|
}
|
|
319760
320174
|
},
|
|
319761
|
-
fetch: (input, init) => (0,
|
|
320175
|
+
fetch: (input, init) => (0, import_rxjs47.lastValueFrom)(performFetch(input, init))
|
|
319762
320176
|
}),
|
|
319763
320177
|
client: new Client({
|
|
319764
320178
|
name: "gapi-proxy-client",
|
|
@@ -319769,7 +320183,7 @@ async function startProxy(cmd) {
|
|
|
319769
320183
|
process.stderr.write("Connecting to upstream...\n");
|
|
319770
320184
|
}),
|
|
319771
320185
|
(0, import_operators31.switchMap)(
|
|
319772
|
-
(config2) => (0,
|
|
320186
|
+
(config2) => (0, import_rxjs47.from)(config2.client.connect(config2.transport)).pipe((0, import_operators31.map)(() => config2))
|
|
319773
320187
|
),
|
|
319774
320188
|
(0, import_operators31.tap)(() => {
|
|
319775
320189
|
process.stderr.write("Connected to upstream MCP server\n");
|
|
@@ -319795,25 +320209,25 @@ async function startProxy(cmd) {
|
|
|
319795
320209
|
capabilities: config2.capabilities || {}
|
|
319796
320210
|
}
|
|
319797
320211
|
);
|
|
319798
|
-
server2.fallbackRequestHandler = async (request) => (0,
|
|
319799
|
-
(0,
|
|
320212
|
+
server2.fallbackRequestHandler = async (request) => (0, import_rxjs47.lastValueFrom)(
|
|
320213
|
+
(0, import_rxjs47.defer)(() => config2.client.request(request, external_exports3.any())).pipe(
|
|
319800
320214
|
(0, import_operators31.catchError)((e2) => {
|
|
319801
320215
|
process.stderr.write(`Upstream error: ${e2.message}
|
|
319802
320216
|
`);
|
|
319803
|
-
return (0,
|
|
320217
|
+
return (0, import_rxjs47.throwError)(() => e2);
|
|
319804
320218
|
})
|
|
319805
320219
|
)
|
|
319806
320220
|
);
|
|
319807
320221
|
server2.fallbackNotificationHandler = async (notification) => {
|
|
319808
|
-
await (0,
|
|
319809
|
-
(0,
|
|
320222
|
+
await (0, import_rxjs47.lastValueFrom)(
|
|
320223
|
+
(0, import_rxjs47.of)(notification).pipe(
|
|
319810
320224
|
(0, import_operators31.filter)((n) => n.method !== "notifications/initialized"),
|
|
319811
320225
|
(0, import_operators31.switchMap)(
|
|
319812
|
-
(n) => (0,
|
|
320226
|
+
(n) => (0, import_rxjs47.defer)(() => config2.client.notification(n)).pipe(
|
|
319813
320227
|
(0, import_operators31.catchError)((e2) => {
|
|
319814
320228
|
process.stderr.write(`Notification error: ${e2}
|
|
319815
320229
|
`);
|
|
319816
|
-
return
|
|
320230
|
+
return import_rxjs47.EMPTY;
|
|
319817
320231
|
})
|
|
319818
320232
|
)
|
|
319819
320233
|
),
|
|
@@ -319823,7 +320237,7 @@ async function startProxy(cmd) {
|
|
|
319823
320237
|
};
|
|
319824
320238
|
return server2;
|
|
319825
320239
|
}),
|
|
319826
|
-
(0, import_operators31.switchMap)((server2) => (0,
|
|
320240
|
+
(0, import_operators31.switchMap)((server2) => (0, import_rxjs47.from)(server2.connect(new StdioServerTransport()))),
|
|
319827
320241
|
(0, import_operators31.tap)(() => {
|
|
319828
320242
|
process.stderr.write("MCP stdio server ready\n");
|
|
319829
320243
|
}),
|
|
@@ -319833,22 +320247,25 @@ async function startProxy(cmd) {
|
|
|
319833
320247
|
)
|
|
319834
320248
|
);
|
|
319835
320249
|
}
|
|
319836
|
-
var
|
|
320250
|
+
var import_fs9, import_rxjs47, import_operators31, import_stream2, pendingToken, currentToken, withToken, performFetch;
|
|
319837
320251
|
var init_start = __esm({
|
|
319838
320252
|
"src/commands/proxy/start.ts"() {
|
|
319839
320253
|
init_client2();
|
|
319840
320254
|
init_streamableHttp();
|
|
319841
320255
|
init_server2();
|
|
319842
320256
|
init_stdio2();
|
|
319843
|
-
|
|
320257
|
+
import_fs9 = require("fs");
|
|
320258
|
+
import_rxjs47 = __toESM(require_cjs());
|
|
319844
320259
|
import_operators31 = __toESM(require_operators());
|
|
319845
320260
|
import_stream2 = require("stream");
|
|
319846
320261
|
init_zod();
|
|
319847
320262
|
init_gql_client();
|
|
320263
|
+
init_types();
|
|
320264
|
+
init_login_gate();
|
|
319848
320265
|
pendingToken = null;
|
|
319849
320266
|
currentToken = (force = false) => {
|
|
319850
320267
|
if (!pendingToken || force) {
|
|
319851
|
-
pendingToken = (0,
|
|
320268
|
+
pendingToken = (0, import_rxjs47.lastValueFrom)(
|
|
319852
320269
|
GraphqlClienAPI.getConfig(force).pipe(
|
|
319853
320270
|
(0, import_operators31.take)(1),
|
|
319854
320271
|
(0, import_operators31.map)((config2) => config2.token)
|
|
@@ -319865,7 +320282,7 @@ var init_start = __esm({
|
|
|
319865
320282
|
return { ...init, headers };
|
|
319866
320283
|
};
|
|
319867
320284
|
performFetch = (input, init) => {
|
|
319868
|
-
return (0,
|
|
320285
|
+
return (0, import_rxjs47.from)(currentToken()).pipe(
|
|
319869
320286
|
(0, import_operators31.switchMap)((token) => fetch(input, withToken(init, token))),
|
|
319870
320287
|
(0, import_operators31.switchMap)((res) => {
|
|
319871
320288
|
if (res.status === 401 || res.status === 403) {
|
|
@@ -319873,7 +320290,7 @@ var init_start = __esm({
|
|
|
319873
320290
|
`[DEBUG] Request failed with ${res.status}. Refreshing token...
|
|
319874
320291
|
`
|
|
319875
320292
|
);
|
|
319876
|
-
return (0,
|
|
320293
|
+
return (0, import_rxjs47.from)(currentToken(true)).pipe(
|
|
319877
320294
|
(0, import_operators31.switchMap)((token) => {
|
|
319878
320295
|
process.stderr.write(
|
|
319879
320296
|
"[DEBUG] Token refreshed. Retrying request...\n"
|
|
@@ -319882,7 +320299,7 @@ var init_start = __esm({
|
|
|
319882
320299
|
})
|
|
319883
320300
|
);
|
|
319884
320301
|
}
|
|
319885
|
-
return (0,
|
|
320302
|
+
return (0, import_rxjs47.of)(res);
|
|
319886
320303
|
}),
|
|
319887
320304
|
(0, import_operators31.map)((res) => {
|
|
319888
320305
|
if (typeof res?.body?.pipeThrough !== "function") {
|
|
@@ -319901,7 +320318,7 @@ var init_start = __esm({
|
|
|
319901
320318
|
(0, import_operators31.catchError)((e2) => {
|
|
319902
320319
|
process.stderr.write(`[ERROR] Fetch error: ${e2.message}
|
|
319903
320320
|
`);
|
|
319904
|
-
return (0,
|
|
320321
|
+
return (0, import_rxjs47.throwError)(() => e2);
|
|
319905
320322
|
})
|
|
319906
320323
|
);
|
|
319907
320324
|
};
|
|
@@ -319913,16 +320330,16 @@ var create_exports3 = {};
|
|
|
319913
320330
|
__export(create_exports3, {
|
|
319914
320331
|
default: () => create_default3
|
|
319915
320332
|
});
|
|
319916
|
-
var
|
|
320333
|
+
var import_rxjs48, import_operators32, create_default3;
|
|
319917
320334
|
var init_create3 = __esm({
|
|
319918
320335
|
"src/commands/rabbitmq/create.ts"() {
|
|
319919
|
-
|
|
320336
|
+
import_rxjs48 = __toESM(require_cjs());
|
|
319920
320337
|
import_operators32 = __toESM(require_operators());
|
|
319921
320338
|
init_helpers();
|
|
319922
320339
|
init_gql_client();
|
|
319923
320340
|
init_log();
|
|
319924
320341
|
init_load_spec();
|
|
319925
|
-
create_default3 = (cmd) => (0,
|
|
320342
|
+
create_default3 = (cmd) => (0, import_rxjs48.lastValueFrom)(
|
|
319926
320343
|
parseProjectId(cmd.project).pipe(
|
|
319927
320344
|
(0, import_operators32.switchMap)(
|
|
319928
320345
|
(projectId) => loadSpec(
|
|
@@ -319961,15 +320378,15 @@ var list_exports5 = {};
|
|
|
319961
320378
|
__export(list_exports5, {
|
|
319962
320379
|
default: () => list_default5
|
|
319963
320380
|
});
|
|
319964
|
-
var
|
|
320381
|
+
var import_rxjs49, import_operators33, list_default5;
|
|
319965
320382
|
var init_list5 = __esm({
|
|
319966
320383
|
"src/commands/rabbitmq/list.ts"() {
|
|
319967
|
-
|
|
320384
|
+
import_rxjs49 = __toESM(require_cjs());
|
|
319968
320385
|
import_operators33 = __toESM(require_operators());
|
|
319969
320386
|
init_helpers();
|
|
319970
320387
|
init_gql_client();
|
|
319971
320388
|
init_log();
|
|
319972
|
-
list_default5 = (cmd) => (0,
|
|
320389
|
+
list_default5 = (cmd) => (0, import_rxjs49.lastValueFrom)(
|
|
319973
320390
|
parseProjectId(cmd.project).pipe(
|
|
319974
320391
|
(0, import_operators33.switchMap)(
|
|
319975
320392
|
(projectId) => GraphqlClienAPI.listRabbitMqInstances(projectId)
|
|
@@ -320004,15 +320421,15 @@ var delete_exports2 = {};
|
|
|
320004
320421
|
__export(delete_exports2, {
|
|
320005
320422
|
default: () => delete_default2
|
|
320006
320423
|
});
|
|
320007
|
-
var
|
|
320424
|
+
var import_rxjs50, import_operators34, delete_default2;
|
|
320008
320425
|
var init_delete2 = __esm({
|
|
320009
320426
|
"src/commands/rabbitmq/delete.ts"() {
|
|
320010
|
-
|
|
320427
|
+
import_rxjs50 = __toESM(require_cjs());
|
|
320011
320428
|
import_operators34 = __toESM(require_operators());
|
|
320012
320429
|
init_helpers();
|
|
320013
320430
|
init_gql_client();
|
|
320014
320431
|
init_log();
|
|
320015
|
-
delete_default2 = (cmd) => (0,
|
|
320432
|
+
delete_default2 = (cmd) => (0, import_rxjs50.lastValueFrom)(
|
|
320016
320433
|
parseProjectId(cmd.project).pipe(
|
|
320017
320434
|
(0, import_operators34.switchMap)(
|
|
320018
320435
|
(projectId) => GraphqlClienAPI.uninstallRabbitMq(cmd.id, projectId)
|
|
@@ -320584,19 +321001,19 @@ var init_connection = __esm({
|
|
|
320584
321001
|
});
|
|
320585
321002
|
|
|
320586
321003
|
// src/commands/runner/daemon.ts
|
|
320587
|
-
var
|
|
321004
|
+
var import_child_process4, import_fs10, import_promises6, import_os5, import_path5, import_util11, DEFAULT_SERVICE_NAME, RUNNER_AUTH_EXIT_CODE, systemdQuote, unitPath, buildUnit, resolveGcliCommand, defaultExec, SystemdUserService, assertSystemdAvailable;
|
|
320588
321005
|
var init_daemon = __esm({
|
|
320589
321006
|
"src/commands/runner/daemon.ts"() {
|
|
320590
|
-
|
|
320591
|
-
|
|
321007
|
+
import_child_process4 = require("child_process");
|
|
321008
|
+
import_fs10 = require("fs");
|
|
320592
321009
|
import_promises6 = require("fs/promises");
|
|
320593
|
-
|
|
321010
|
+
import_os5 = require("os");
|
|
320594
321011
|
import_path5 = require("path");
|
|
320595
321012
|
import_util11 = require("util");
|
|
320596
321013
|
DEFAULT_SERVICE_NAME = "lambforge-runner";
|
|
320597
321014
|
RUNNER_AUTH_EXIT_CODE = 78;
|
|
320598
321015
|
systemdQuote = (word) => /^[A-Za-z0-9_@%+=:,./-]+$/.test(word) ? word : `"${word.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
320599
|
-
unitPath = (serviceName, home = (0,
|
|
321016
|
+
unitPath = (serviceName, home = (0, import_os5.homedir)()) => (0, import_path5.join)(home, ".config", "systemd", "user", `${serviceName}.service`);
|
|
320600
321017
|
buildUnit = ({
|
|
320601
321018
|
serviceName,
|
|
320602
321019
|
execStart,
|
|
@@ -320635,7 +321052,7 @@ var init_daemon = __esm({
|
|
|
320635
321052
|
}
|
|
320636
321053
|
let script = argv[1];
|
|
320637
321054
|
try {
|
|
320638
|
-
script = (0,
|
|
321055
|
+
script = (0, import_fs10.realpathSync)(script);
|
|
320639
321056
|
} catch {
|
|
320640
321057
|
}
|
|
320641
321058
|
const ephemeral = /[/\\]_npx[/\\]|[/\\]\.npm[/\\]_cacache/.test(script);
|
|
@@ -320644,9 +321061,9 @@ var init_daemon = __esm({
|
|
|
320644
321061
|
warning: ephemeral ? `gcli is running from the npx cache (${script}), which npm may clean up and break the service. Install it globally first: npm i -g @gapi/gcli, then re-run this command with \`gcli\`.` : void 0
|
|
320645
321062
|
};
|
|
320646
321063
|
};
|
|
320647
|
-
defaultExec = (file2, args) => (0, import_util11.promisify)(
|
|
321064
|
+
defaultExec = (file2, args) => (0, import_util11.promisify)(import_child_process4.execFile)(file2, args, { encoding: "utf8" });
|
|
320648
321065
|
SystemdUserService = class {
|
|
320649
|
-
constructor(serviceName = DEFAULT_SERVICE_NAME, exec2 = defaultExec, home = (0,
|
|
321066
|
+
constructor(serviceName = DEFAULT_SERVICE_NAME, exec2 = defaultExec, home = (0, import_os5.homedir)()) {
|
|
320650
321067
|
this.serviceName = serviceName;
|
|
320651
321068
|
this.exec = exec2;
|
|
320652
321069
|
this.home = home;
|
|
@@ -320673,7 +321090,7 @@ var init_daemon = __esm({
|
|
|
320673
321090
|
}
|
|
320674
321091
|
/** Whether `runner:daemon:install` wrote the unit. */
|
|
320675
321092
|
installed() {
|
|
320676
|
-
return (0,
|
|
321093
|
+
return (0, import_fs10.existsSync)(unitPath(this.serviceName, this.home));
|
|
320677
321094
|
}
|
|
320678
321095
|
start() {
|
|
320679
321096
|
return this.systemctl("start", this.unit);
|
|
@@ -320737,11 +321154,11 @@ __export(start_exports2, {
|
|
|
320737
321154
|
default: () => start_default,
|
|
320738
321155
|
resolveRunner: () => resolveRunner
|
|
320739
321156
|
});
|
|
320740
|
-
var
|
|
321157
|
+
var import_os6, import_rxjs51, RUNNER_VERSION, resolveRunner, start_default;
|
|
320741
321158
|
var init_start2 = __esm({
|
|
320742
321159
|
"src/commands/runner/start.ts"() {
|
|
320743
|
-
|
|
320744
|
-
|
|
321160
|
+
import_os6 = require("os");
|
|
321161
|
+
import_rxjs51 = __toESM(require_cjs());
|
|
320745
321162
|
init_gql_client();
|
|
320746
321163
|
init_log();
|
|
320747
321164
|
init_config();
|
|
@@ -320760,9 +321177,9 @@ var init_start2 = __esm({
|
|
|
320760
321177
|
if (saved) {
|
|
320761
321178
|
return saved;
|
|
320762
321179
|
}
|
|
320763
|
-
const name2 = cmd.name || (0,
|
|
321180
|
+
const name2 = cmd.name || (0, import_os6.hostname)();
|
|
320764
321181
|
Logger.info(`Registering this machine as local runner "${name2}"...`);
|
|
320765
|
-
const { runner, token } = await (0,
|
|
321182
|
+
const { runner, token } = await (0, import_rxjs51.lastValueFrom)(
|
|
320766
321183
|
GraphqlClienAPI.createLocalRunner(name2)
|
|
320767
321184
|
).catch((e2) => {
|
|
320768
321185
|
throw new Error(
|
|
@@ -320823,10 +321240,10 @@ __export(daemon_commands_exports, {
|
|
|
320823
321240
|
stop: () => stop,
|
|
320824
321241
|
uninstall: () => uninstall
|
|
320825
321242
|
});
|
|
320826
|
-
var
|
|
321243
|
+
var import_child_process5, install, uninstall, installedService, reportStarted, start, restart, stop, status, logs;
|
|
320827
321244
|
var init_daemon_commands = __esm({
|
|
320828
321245
|
"src/commands/runner/daemon-commands.ts"() {
|
|
320829
|
-
|
|
321246
|
+
import_child_process5 = require("child_process");
|
|
320830
321247
|
init_log();
|
|
320831
321248
|
init_config();
|
|
320832
321249
|
init_daemon();
|
|
@@ -320942,7 +321359,7 @@ var init_daemon_commands = __esm({
|
|
|
320942
321359
|
assertSystemdAvailable();
|
|
320943
321360
|
const serviceName = cmd.service || DEFAULT_SERVICE_NAME;
|
|
320944
321361
|
return new Promise((resolve2) => {
|
|
320945
|
-
(0,
|
|
321362
|
+
(0, import_child_process5.spawn)(
|
|
320946
321363
|
"journalctl",
|
|
320947
321364
|
["--user", "-u", `${serviceName}.service`, "-f", "-n", cmd.lines || "50"],
|
|
320948
321365
|
{ stdio: "inherit" }
|
|
@@ -320957,14 +321374,14 @@ var list_exports6 = {};
|
|
|
320957
321374
|
__export(list_exports6, {
|
|
320958
321375
|
default: () => list_default6
|
|
320959
321376
|
});
|
|
320960
|
-
var
|
|
321377
|
+
var import_rxjs52, import_operators35, list_default6;
|
|
320961
321378
|
var init_list6 = __esm({
|
|
320962
321379
|
"src/commands/runner/list.ts"() {
|
|
320963
|
-
|
|
321380
|
+
import_rxjs52 = __toESM(require_cjs());
|
|
320964
321381
|
import_operators35 = __toESM(require_operators());
|
|
320965
321382
|
init_gql_client();
|
|
320966
321383
|
init_log();
|
|
320967
|
-
list_default6 = () => (0,
|
|
321384
|
+
list_default6 = () => (0, import_rxjs52.lastValueFrom)(
|
|
320968
321385
|
GraphqlClienAPI.listLocalRunners().pipe(
|
|
320969
321386
|
(0, import_operators35.tap)((runners) => {
|
|
320970
321387
|
Logger.log("-------------------");
|
|
@@ -320997,10 +321414,10 @@ __export(models_exports, {
|
|
|
320997
321414
|
default: () => models_default,
|
|
320998
321415
|
parseSelection: () => parseSelection
|
|
320999
321416
|
});
|
|
321000
|
-
var
|
|
321417
|
+
var import_rxjs53, isShown, parseSelection, models_default;
|
|
321001
321418
|
var init_models = __esm({
|
|
321002
321419
|
"src/commands/runner/models.ts"() {
|
|
321003
|
-
|
|
321420
|
+
import_rxjs53 = __toESM(require_cjs());
|
|
321004
321421
|
init_gql_client();
|
|
321005
321422
|
init_log();
|
|
321006
321423
|
init_config();
|
|
@@ -321030,11 +321447,11 @@ var init_models = __esm({
|
|
|
321030
321447
|
}
|
|
321031
321448
|
let runner;
|
|
321032
321449
|
if (selection) {
|
|
321033
|
-
runner = await (0,
|
|
321450
|
+
runner = await (0, import_rxjs53.lastValueFrom)(
|
|
321034
321451
|
GraphqlClienAPI.setLocalRunnerModels(runnerId, selection.models)
|
|
321035
321452
|
);
|
|
321036
321453
|
} else {
|
|
321037
|
-
const runners = await (0,
|
|
321454
|
+
const runners = await (0, import_rxjs53.lastValueFrom)(GraphqlClienAPI.listLocalRunners());
|
|
321038
321455
|
runner = runners.find((r2) => r2.id === runnerId);
|
|
321039
321456
|
}
|
|
321040
321457
|
if (!runner) {
|
|
@@ -321069,10 +321486,10 @@ var delete_exports3 = {};
|
|
|
321069
321486
|
__export(delete_exports3, {
|
|
321070
321487
|
default: () => delete_default3
|
|
321071
321488
|
});
|
|
321072
|
-
var
|
|
321489
|
+
var import_rxjs54, delete_default3;
|
|
321073
321490
|
var init_delete3 = __esm({
|
|
321074
321491
|
"src/commands/runner/delete.ts"() {
|
|
321075
|
-
|
|
321492
|
+
import_rxjs54 = __toESM(require_cjs());
|
|
321076
321493
|
init_gql_client();
|
|
321077
321494
|
init_log();
|
|
321078
321495
|
init_config();
|
|
@@ -321082,7 +321499,7 @@ var init_delete3 = __esm({
|
|
|
321082
321499
|
if (!runnerId) {
|
|
321083
321500
|
throw new Error("Specify the runner with --id (see `gcli runner:list`).");
|
|
321084
321501
|
}
|
|
321085
|
-
await (0,
|
|
321502
|
+
await (0, import_rxjs54.lastValueFrom)(GraphqlClienAPI.deleteLocalRunner(runnerId));
|
|
321086
321503
|
if (saved?.id === runnerId) {
|
|
321087
321504
|
await forgetRunner();
|
|
321088
321505
|
}
|
|
@@ -321098,10 +321515,10 @@ __export(start_exports3, {
|
|
|
321098
321515
|
});
|
|
321099
321516
|
async function start2(args) {
|
|
321100
321517
|
Logger.log("---------------------------------");
|
|
321101
|
-
return (0,
|
|
321518
|
+
return (0, import_rxjs55.lastValueFrom)(
|
|
321102
321519
|
loadSpec().pipe(
|
|
321103
321520
|
(0, import_operators36.switchMap)(
|
|
321104
|
-
(config2) => (0,
|
|
321521
|
+
(config2) => (0, import_rxjs55.of)({
|
|
321105
321522
|
watcher: (0, import_node_fs2.watch)(process.cwd(), {
|
|
321106
321523
|
recursive: true
|
|
321107
321524
|
}),
|
|
@@ -321130,7 +321547,7 @@ async function start2(args) {
|
|
|
321130
321547
|
outfile,
|
|
321131
321548
|
startCommand,
|
|
321132
321549
|
ignorelist
|
|
321133
|
-
}) => (0,
|
|
321550
|
+
}) => (0, import_rxjs55.from)(build_default(args)).pipe(
|
|
321134
321551
|
(0, import_operators36.tap)(() => {
|
|
321135
321552
|
Logger.warn(
|
|
321136
321553
|
`\u{1F4E2} Starting script "${startCommand} ${outfile}"`
|
|
@@ -321148,10 +321565,10 @@ async function start2(args) {
|
|
|
321148
321565
|
);
|
|
321149
321566
|
}),
|
|
321150
321567
|
(0, import_operators36.tap)(
|
|
321151
|
-
() => (0,
|
|
321152
|
-
(0,
|
|
321153
|
-
(0,
|
|
321154
|
-
(0,
|
|
321568
|
+
() => (0, import_rxjs55.merge)(
|
|
321569
|
+
(0, import_rxjs55.fromEvent)(process, "SIGINT"),
|
|
321570
|
+
(0, import_rxjs55.fromEvent)(process, "SIGTERM"),
|
|
321571
|
+
(0, import_rxjs55.fromEvent)(process, "exit")
|
|
321155
321572
|
).pipe(
|
|
321156
321573
|
(0, import_operators36.debounceTime)(100),
|
|
321157
321574
|
(0, import_operators36.tap)(() => {
|
|
@@ -321163,7 +321580,7 @@ async function start2(args) {
|
|
|
321163
321580
|
).subscribe()
|
|
321164
321581
|
),
|
|
321165
321582
|
(0, import_operators36.switchMap)(
|
|
321166
|
-
() => (0,
|
|
321583
|
+
() => (0, import_rxjs55.fromEvent)(watcher, "change").pipe(
|
|
321167
321584
|
(0, import_operators36.map)(([event, filename]) => ({
|
|
321168
321585
|
event,
|
|
321169
321586
|
filename
|
|
@@ -321212,12 +321629,12 @@ async function start2(args) {
|
|
|
321212
321629
|
)
|
|
321213
321630
|
);
|
|
321214
321631
|
}
|
|
321215
|
-
var import_node_child_process, import_node_fs2,
|
|
321632
|
+
var import_node_child_process, import_node_fs2, import_rxjs55, import_operators36;
|
|
321216
321633
|
var init_start3 = __esm({
|
|
321217
321634
|
"src/commands/start/start.ts"() {
|
|
321218
321635
|
import_node_child_process = require("node:child_process");
|
|
321219
321636
|
import_node_fs2 = require("node:fs");
|
|
321220
|
-
|
|
321637
|
+
import_rxjs55 = __toESM(require_cjs());
|
|
321221
321638
|
import_operators36 = __toESM(require_operators());
|
|
321222
321639
|
init_log();
|
|
321223
321640
|
init_build();
|
|
@@ -321230,16 +321647,16 @@ var create_cron_exports = {};
|
|
|
321230
321647
|
__export(create_cron_exports, {
|
|
321231
321648
|
default: () => create_cron_default
|
|
321232
321649
|
});
|
|
321233
|
-
var
|
|
321650
|
+
var import_rxjs56, import_operators37, create_cron_default;
|
|
321234
321651
|
var init_create_cron = __esm({
|
|
321235
321652
|
"src/commands/triggers/cron/create-cron.ts"() {
|
|
321236
|
-
|
|
321653
|
+
import_rxjs56 = __toESM(require_cjs());
|
|
321237
321654
|
import_operators37 = __toESM(require_operators());
|
|
321238
321655
|
init_helpers();
|
|
321239
321656
|
init_gql_client();
|
|
321240
321657
|
init_log();
|
|
321241
321658
|
init_load_spec();
|
|
321242
|
-
create_cron_default = (cmd) => (0,
|
|
321659
|
+
create_cron_default = (cmd) => (0, import_rxjs56.lastValueFrom)(
|
|
321243
321660
|
parseProjectId(cmd.project).pipe(
|
|
321244
321661
|
(0, import_operators37.switchMap)(
|
|
321245
321662
|
(projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
|
|
@@ -321262,7 +321679,7 @@ var init_create_cron = __esm({
|
|
|
321262
321679
|
)
|
|
321263
321680
|
),
|
|
321264
321681
|
(0, import_operators37.switchMap)(
|
|
321265
|
-
({ lambdaId, cron, triggerName, lambdaName }) => !cron || !triggerName ? (0,
|
|
321682
|
+
({ lambdaId, cron, triggerName, lambdaName }) => !cron || !triggerName ? (0, import_rxjs56.throwError)(
|
|
321266
321683
|
() => new Error(
|
|
321267
321684
|
"cron:create needs --cron and --triggerName (or triggers.time.cron / triggerName in lambforge.yaml)"
|
|
321268
321685
|
)
|
|
@@ -321295,16 +321712,16 @@ var delete_cron_exports = {};
|
|
|
321295
321712
|
__export(delete_cron_exports, {
|
|
321296
321713
|
default: () => delete_cron_default
|
|
321297
321714
|
});
|
|
321298
|
-
var
|
|
321715
|
+
var import_rxjs57, import_operators38, delete_cron_default;
|
|
321299
321716
|
var init_delete_cron = __esm({
|
|
321300
321717
|
"src/commands/triggers/cron/delete-cron.ts"() {
|
|
321301
|
-
|
|
321718
|
+
import_rxjs57 = __toESM(require_cjs());
|
|
321302
321719
|
import_operators38 = __toESM(require_operators());
|
|
321303
321720
|
init_helpers();
|
|
321304
321721
|
init_gql_client();
|
|
321305
321722
|
init_log();
|
|
321306
321723
|
init_load_spec();
|
|
321307
|
-
delete_cron_default = (cmd) => (0,
|
|
321724
|
+
delete_cron_default = (cmd) => (0, import_rxjs57.lastValueFrom)(
|
|
321308
321725
|
parseProjectId(cmd.project).pipe(
|
|
321309
321726
|
(0, import_operators38.switchMap)(
|
|
321310
321727
|
(projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
|
|
@@ -321348,18 +321765,18 @@ var list_crons_exports = {};
|
|
|
321348
321765
|
__export(list_crons_exports, {
|
|
321349
321766
|
default: () => list_crons_default
|
|
321350
321767
|
});
|
|
321351
|
-
var
|
|
321768
|
+
var import_rxjs58, import_operators39, list_crons_default;
|
|
321352
321769
|
var init_list_crons = __esm({
|
|
321353
321770
|
"src/commands/triggers/cron/list-crons.ts"() {
|
|
321354
|
-
|
|
321771
|
+
import_rxjs58 = __toESM(require_cjs());
|
|
321355
321772
|
import_operators39 = __toESM(require_operators());
|
|
321356
321773
|
init_helpers();
|
|
321357
321774
|
init_gql_client();
|
|
321358
321775
|
init_log();
|
|
321359
|
-
list_crons_default = (cmd) => (0,
|
|
321776
|
+
list_crons_default = (cmd) => (0, import_rxjs58.lastValueFrom)(
|
|
321360
321777
|
parseProjectId(cmd.project).pipe(
|
|
321361
321778
|
(0, import_operators39.switchMap)(
|
|
321362
|
-
(projectId) => (0,
|
|
321779
|
+
(projectId) => (0, import_rxjs58.combineLatest)([
|
|
321363
321780
|
GraphqlClienAPI.listProjectTimeTriggers(projectId),
|
|
321364
321781
|
GraphqlClienAPI.listLambdas(projectId)
|
|
321365
321782
|
])
|
|
@@ -321392,15 +321809,15 @@ var list_exports7 = {};
|
|
|
321392
321809
|
__export(list_exports7, {
|
|
321393
321810
|
default: () => list_default7
|
|
321394
321811
|
});
|
|
321395
|
-
var
|
|
321812
|
+
var import_rxjs59, import_operators40, list_default7;
|
|
321396
321813
|
var init_list7 = __esm({
|
|
321397
321814
|
"src/commands/triggers/message-queue/list.ts"() {
|
|
321398
|
-
|
|
321815
|
+
import_rxjs59 = __toESM(require_cjs());
|
|
321399
321816
|
import_operators40 = __toESM(require_operators());
|
|
321400
321817
|
init_helpers();
|
|
321401
321818
|
init_gql_client();
|
|
321402
321819
|
init_log();
|
|
321403
|
-
list_default7 = (cmd) => (0,
|
|
321820
|
+
list_default7 = (cmd) => (0, import_rxjs59.lastValueFrom)(
|
|
321404
321821
|
parseProjectId(cmd.project).pipe(
|
|
321405
321822
|
(0, import_operators40.switchMap)(
|
|
321406
321823
|
(projectId) => GraphqlClienAPI.listMessageQueueTriggers(projectId)
|
|
@@ -321436,10 +321853,10 @@ __export(save_exports, {
|
|
|
321436
321853
|
mergeOverExisting: () => mergeOverExisting,
|
|
321437
321854
|
toTriggerInput: () => toTriggerInput
|
|
321438
321855
|
});
|
|
321439
|
-
var
|
|
321856
|
+
var import_rxjs60, import_operators41, int2, toTriggerInput, mergeOverExisting, save_default;
|
|
321440
321857
|
var init_save = __esm({
|
|
321441
321858
|
"src/commands/triggers/message-queue/save.ts"() {
|
|
321442
|
-
|
|
321859
|
+
import_rxjs60 = __toESM(require_cjs());
|
|
321443
321860
|
import_operators41 = __toESM(require_operators());
|
|
321444
321861
|
init_helpers();
|
|
321445
321862
|
init_gql_client();
|
|
@@ -321502,11 +321919,11 @@ var init_save = __esm({
|
|
|
321502
321919
|
)
|
|
321503
321920
|
);
|
|
321504
321921
|
};
|
|
321505
|
-
save_default = (mode, cmd) => (0,
|
|
321922
|
+
save_default = (mode, cmd) => (0, import_rxjs60.lastValueFrom)(
|
|
321506
321923
|
parseProjectId(cmd.project).pipe(
|
|
321507
321924
|
(0, import_operators41.switchMap)((projectId) => {
|
|
321508
321925
|
const changes = toTriggerInput(mode, cmd);
|
|
321509
|
-
const payload$ = mode === "create" ? (0,
|
|
321926
|
+
const payload$ = mode === "create" ? (0, import_rxjs60.of)(changes) : GraphqlClienAPI.listMessageQueueTriggers(projectId).pipe(
|
|
321510
321927
|
(0, import_operators41.map)(
|
|
321511
321928
|
(triggers) => mergeOverExisting(
|
|
321512
321929
|
triggers.find((t2) => t2.name === cmd.name),
|
|
@@ -321544,15 +321961,15 @@ var delete_exports4 = {};
|
|
|
321544
321961
|
__export(delete_exports4, {
|
|
321545
321962
|
default: () => delete_default4
|
|
321546
321963
|
});
|
|
321547
|
-
var
|
|
321964
|
+
var import_rxjs61, import_operators42, delete_default4;
|
|
321548
321965
|
var init_delete4 = __esm({
|
|
321549
321966
|
"src/commands/triggers/message-queue/delete.ts"() {
|
|
321550
|
-
|
|
321967
|
+
import_rxjs61 = __toESM(require_cjs());
|
|
321551
321968
|
import_operators42 = __toESM(require_operators());
|
|
321552
321969
|
init_helpers();
|
|
321553
321970
|
init_gql_client();
|
|
321554
321971
|
init_log();
|
|
321555
|
-
delete_default4 = (cmd) => (0,
|
|
321972
|
+
delete_default4 = (cmd) => (0, import_rxjs61.lastValueFrom)(
|
|
321556
321973
|
parseProjectId(cmd.project).pipe(
|
|
321557
321974
|
(0, import_operators42.switchMap)(
|
|
321558
321975
|
(projectId) => GraphqlClienAPI.deleteMessageQueueTrigger(projectId, cmd.name)
|
|
@@ -321662,11 +322079,11 @@ var init_definition = __esm({
|
|
|
321662
322079
|
});
|
|
321663
322080
|
|
|
321664
322081
|
// src/commands/workflow/helpers.ts
|
|
321665
|
-
var import_promises7,
|
|
322082
|
+
var import_promises7, import_rxjs62, import_operators43, resolveWorkflow, withProject, readWorkflowFile, writeTextFile, POLL_MS, followRun, printRunResult;
|
|
321666
322083
|
var init_helpers4 = __esm({
|
|
321667
322084
|
"src/commands/workflow/helpers.ts"() {
|
|
321668
322085
|
import_promises7 = require("fs/promises");
|
|
321669
|
-
|
|
322086
|
+
import_rxjs62 = __toESM(require_cjs());
|
|
321670
322087
|
import_operators43 = __toESM(require_operators());
|
|
321671
322088
|
init_helpers();
|
|
321672
322089
|
init_gql_client();
|
|
@@ -321688,18 +322105,18 @@ var init_helpers4 = __esm({
|
|
|
321688
322105
|
})
|
|
321689
322106
|
);
|
|
321690
322107
|
};
|
|
321691
|
-
withProject = (project, fn) => (0,
|
|
322108
|
+
withProject = (project, fn) => (0, import_rxjs62.lastValueFrom)(parseProjectId(project).pipe((0, import_operators43.switchMap)(fn)));
|
|
321692
322109
|
readWorkflowFile = (path2) => {
|
|
321693
322110
|
if (!path2) {
|
|
321694
322111
|
throw new Error("--file is required (a workflow YAML or JSON file)");
|
|
321695
322112
|
}
|
|
321696
|
-
return (0,
|
|
322113
|
+
return (0, import_rxjs62.from)((0, import_promises7.readFile)(path2, "utf8")).pipe((0, import_operators43.map)(parseWorkflowFile));
|
|
321697
322114
|
};
|
|
321698
|
-
writeTextFile = (path2, text) => (0,
|
|
322115
|
+
writeTextFile = (path2, text) => (0, import_rxjs62.from)((0, import_promises7.writeFile)(path2, text, "utf8"));
|
|
321699
322116
|
POLL_MS = 2e3;
|
|
321700
322117
|
followRun = (projectId, workflowId, runName) => {
|
|
321701
322118
|
let printed = 0;
|
|
321702
|
-
return (0,
|
|
322119
|
+
return (0, import_rxjs62.timer)(0, POLL_MS).pipe(
|
|
321703
322120
|
(0, import_operators43.switchMap)(
|
|
321704
322121
|
() => GraphqlClienAPI.getWorkflowRun(projectId, workflowId, runName)
|
|
321705
322122
|
),
|
|
@@ -321772,10 +322189,10 @@ var get_exports2 = {};
|
|
|
321772
322189
|
__export(get_exports2, {
|
|
321773
322190
|
default: () => get_default2
|
|
321774
322191
|
});
|
|
321775
|
-
var
|
|
322192
|
+
var import_rxjs63, import_operators45, get_default2;
|
|
321776
322193
|
var init_get2 = __esm({
|
|
321777
322194
|
"src/commands/workflow/get.ts"() {
|
|
321778
|
-
|
|
322195
|
+
import_rxjs63 = __toESM(require_cjs());
|
|
321779
322196
|
import_operators45 = __toESM(require_operators());
|
|
321780
322197
|
init_log();
|
|
321781
322198
|
init_definition();
|
|
@@ -321791,7 +322208,7 @@ var init_get2 = __esm({
|
|
|
321791
322208
|
});
|
|
321792
322209
|
if (!cmd.out) {
|
|
321793
322210
|
Logger.log(text);
|
|
321794
|
-
return (0,
|
|
322211
|
+
return (0, import_rxjs63.of)(null);
|
|
321795
322212
|
}
|
|
321796
322213
|
return writeTextFile(cmd.out, text).pipe(
|
|
321797
322214
|
(0, import_operators45.tap)(() => Logger.info(`Wrote ${cmd.out}`))
|
|
@@ -321861,11 +322278,11 @@ var generate_exports = {};
|
|
|
321861
322278
|
__export(generate_exports, {
|
|
321862
322279
|
default: () => generate_default
|
|
321863
322280
|
});
|
|
321864
|
-
var import_promises8,
|
|
322281
|
+
var import_promises8, import_rxjs64, import_operators47, generate_default;
|
|
321865
322282
|
var init_generate = __esm({
|
|
321866
322283
|
"src/commands/workflow/generate.ts"() {
|
|
321867
322284
|
import_promises8 = require("fs/promises");
|
|
321868
|
-
|
|
322285
|
+
import_rxjs64 = __toESM(require_cjs());
|
|
321869
322286
|
import_operators47 = __toESM(require_operators());
|
|
321870
322287
|
init_gql_client();
|
|
321871
322288
|
init_log();
|
|
@@ -321878,7 +322295,7 @@ var init_generate = __esm({
|
|
|
321878
322295
|
'Describe the workflow: --description "charge the card with retries, then email the receipt"'
|
|
321879
322296
|
);
|
|
321880
322297
|
}
|
|
321881
|
-
const base$ = cmd.from ? (0,
|
|
322298
|
+
const base$ = cmd.from ? (0, import_rxjs64.from)((0, import_promises8.readFile)(cmd.from, "utf8")).pipe((0, import_operators47.map)(parseWorkflowFile)) : cmd.name ? GraphqlClienAPI.listWorkflows(projectId).pipe(
|
|
321882
322299
|
(0, import_operators47.switchMap)(
|
|
321883
322300
|
(workflows) => workflows.some((w) => w.name === cmd.name) ? resolveWorkflow(projectId, cmd.name).pipe(
|
|
321884
322301
|
(0, import_operators47.map)((w) => ({
|
|
@@ -321886,9 +322303,9 @@ var init_generate = __esm({
|
|
|
321886
322303
|
description: w.description ?? void 0,
|
|
321887
322304
|
definition: w.definition
|
|
321888
322305
|
}))
|
|
321889
|
-
) : (0,
|
|
322306
|
+
) : (0, import_rxjs64.of)(null)
|
|
321890
322307
|
)
|
|
321891
|
-
) : (0,
|
|
322308
|
+
) : (0, import_rxjs64.of)(null);
|
|
321892
322309
|
return base$.pipe(
|
|
321893
322310
|
(0, import_operators47.tap)(() => Logger.info("Asking the AI for a draft...")),
|
|
321894
322311
|
(0, import_operators47.switchMap)(
|
|
@@ -321915,10 +322332,10 @@ var init_generate = __esm({
|
|
|
321915
322332
|
const text = toWorkflowYaml(file2);
|
|
321916
322333
|
const written$ = cmd.out ? writeTextFile(cmd.out, text).pipe(
|
|
321917
322334
|
(0, import_operators47.tap)(() => Logger.info(`Wrote ${cmd.out}`))
|
|
321918
|
-
) : (0,
|
|
322335
|
+
) : (0, import_rxjs64.of)(null).pipe((0, import_operators47.tap)(() => !cmd.apply && Logger.log(text)));
|
|
321919
322336
|
return written$.pipe(
|
|
321920
322337
|
(0, import_operators47.switchMap)(
|
|
321921
|
-
() => cmd.apply ? applyWorkflow(projectId, file2) : (0,
|
|
322338
|
+
() => cmd.apply ? applyWorkflow(projectId, file2) : (0, import_rxjs64.of)(null).pipe(
|
|
321922
322339
|
(0, import_operators47.tap)(
|
|
321923
322340
|
() => Logger.info(
|
|
321924
322341
|
cmd.out ? `Review it, then: gcli workflow:apply --file ${cmd.out}${file2.name ? "" : " --name <name>"}` : "Save it with -o <file>, or re-run with --apply --name <name>"
|
|
@@ -321992,11 +322409,11 @@ var run_exports = {};
|
|
|
321992
322409
|
__export(run_exports, {
|
|
321993
322410
|
default: () => run_default
|
|
321994
322411
|
});
|
|
321995
|
-
var import_promises9,
|
|
322412
|
+
var import_promises9, import_rxjs65, import_operators50, run_default;
|
|
321996
322413
|
var init_run = __esm({
|
|
321997
322414
|
"src/commands/workflow/run.ts"() {
|
|
321998
322415
|
import_promises9 = require("fs/promises");
|
|
321999
|
-
|
|
322416
|
+
import_rxjs65 = __toESM(require_cjs());
|
|
322000
322417
|
import_operators50 = __toESM(require_operators());
|
|
322001
322418
|
init_gql_client();
|
|
322002
322419
|
init_log();
|
|
@@ -322004,7 +322421,7 @@ var init_run = __esm({
|
|
|
322004
322421
|
init_helpers4();
|
|
322005
322422
|
run_default = (cmd) => withProject(
|
|
322006
322423
|
cmd.project,
|
|
322007
|
-
(projectId) => (cmd.inputFile ? (0,
|
|
322424
|
+
(projectId) => (cmd.inputFile ? (0, import_rxjs65.from)((0, import_promises9.readFile)(cmd.inputFile, "utf8")) : (0, import_rxjs65.of)(cmd.input)).pipe(
|
|
322008
322425
|
(0, import_operators50.map)(parseRunInput),
|
|
322009
322426
|
(0, import_operators50.switchMap)(
|
|
322010
322427
|
(input) => resolveWorkflow(projectId, cmd.name).pipe(
|
|
@@ -322012,7 +322429,7 @@ var init_run = __esm({
|
|
|
322012
322429
|
(w) => GraphqlClienAPI.startWorkflowRun(projectId, w.id, input).pipe(
|
|
322013
322430
|
(0, import_operators50.tap)((run2) => Logger.info(`Started run ${run2.name}`)),
|
|
322014
322431
|
(0, import_operators50.switchMap)(
|
|
322015
|
-
(run2) => cmd.wait ? followRun(projectId, w.id, run2.name) : (0,
|
|
322432
|
+
(run2) => cmd.wait ? followRun(projectId, w.id, run2.name) : (0, import_rxjs65.of)(run2).pipe(
|
|
322016
322433
|
(0, import_operators50.tap)(
|
|
322017
322434
|
() => Logger.info(
|
|
322018
322435
|
`Follow it: gcli workflow:status --name ${w.name} --run ${run2.name} --follow`
|
|
@@ -322186,11 +322603,11 @@ var trigger_add_exports = {};
|
|
|
322186
322603
|
__export(trigger_add_exports, {
|
|
322187
322604
|
default: () => trigger_add_default
|
|
322188
322605
|
});
|
|
322189
|
-
var import_promises10,
|
|
322606
|
+
var import_promises10, import_rxjs66, import_operators54, trigger_add_default;
|
|
322190
322607
|
var init_trigger_add = __esm({
|
|
322191
322608
|
"src/commands/workflow/trigger-add.ts"() {
|
|
322192
322609
|
import_promises10 = require("fs/promises");
|
|
322193
|
-
|
|
322610
|
+
import_rxjs66 = __toESM(require_cjs());
|
|
322194
322611
|
import_operators54 = __toESM(require_operators());
|
|
322195
322612
|
init_gql_client();
|
|
322196
322613
|
init_log();
|
|
@@ -322198,7 +322615,7 @@ var init_trigger_add = __esm({
|
|
|
322198
322615
|
init_triggers();
|
|
322199
322616
|
trigger_add_default = (cmd) => withProject(
|
|
322200
322617
|
cmd.project,
|
|
322201
|
-
(projectId) => (cmd.inputFile ? (0,
|
|
322618
|
+
(projectId) => (cmd.inputFile ? (0, import_rxjs66.from)((0, import_promises10.readFile)(cmd.inputFile, "utf8")) : (0, import_rxjs66.of)(void 0)).pipe(
|
|
322202
322619
|
(0, import_operators54.map)((inputText) => buildTriggerInput({ ...cmd, inputText })),
|
|
322203
322620
|
(0, import_operators54.switchMap)(
|
|
322204
322621
|
(trigger) => resolveWorkflow(projectId, cmd.name).pipe(
|
|
@@ -322328,11 +322745,11 @@ var init_approvals = __esm({
|
|
|
322328
322745
|
}
|
|
322329
322746
|
};
|
|
322330
322747
|
ApprovalGate = class {
|
|
322331
|
-
constructor(policy, backend, prompt,
|
|
322748
|
+
constructor(policy, backend, prompt, log2, timeoutMs = APPROVAL_TIMEOUT_MS) {
|
|
322332
322749
|
this.policy = policy;
|
|
322333
322750
|
this.backend = backend;
|
|
322334
322751
|
this.prompt = prompt;
|
|
322335
|
-
this.log =
|
|
322752
|
+
this.log = log2;
|
|
322336
322753
|
this.timeoutMs = timeoutMs;
|
|
322337
322754
|
this.waiting = /* @__PURE__ */ new Map();
|
|
322338
322755
|
// A web answer that arrived before the card's id was back here.
|
|
@@ -322459,15 +322876,15 @@ var init_config2 = __esm({
|
|
|
322459
322876
|
});
|
|
322460
322877
|
|
|
322461
322878
|
// src/commands/workspace/files.ts
|
|
322462
|
-
var
|
|
322879
|
+
var import_child_process6, import_crypto2, import_fs11, import_path6, import_util12, run, WorkspaceError, MAX_READ_BYTES, MAX_WRITE_BYTES, DEFAULT_LIST_LIMIT, MAX_LIST_LIMIT, DEFAULT_SEARCH_RESULTS, MAX_SEARCH_RESULTS, MAX_MATCH_TEXT, SKIP_DIRS, SECRET_FILE, SECRET_TEMPLATE, isSecretFile, contentHash, toPosix, WorkspaceFiles;
|
|
322463
322880
|
var init_files = __esm({
|
|
322464
322881
|
"src/commands/workspace/files.ts"() {
|
|
322465
|
-
|
|
322882
|
+
import_child_process6 = require("child_process");
|
|
322466
322883
|
import_crypto2 = require("crypto");
|
|
322467
|
-
|
|
322884
|
+
import_fs11 = require("fs");
|
|
322468
322885
|
import_path6 = require("path");
|
|
322469
322886
|
import_util12 = require("util");
|
|
322470
|
-
run = (0, import_util12.promisify)(
|
|
322887
|
+
run = (0, import_util12.promisify)(import_child_process6.execFile);
|
|
322471
322888
|
WorkspaceError = class extends Error {
|
|
322472
322889
|
constructor(message, status2 = 400) {
|
|
322473
322890
|
super(message);
|
|
@@ -322509,7 +322926,7 @@ var init_files = __esm({
|
|
|
322509
322926
|
let existing = abs;
|
|
322510
322927
|
for (; ; ) {
|
|
322511
322928
|
try {
|
|
322512
|
-
const real = await
|
|
322929
|
+
const real = await import_fs11.promises.realpath(existing);
|
|
322513
322930
|
const realFromRoot = (0, import_path6.relative)(this.root, real);
|
|
322514
322931
|
if (realFromRoot.startsWith("..") || (0, import_path6.isAbsolute)(realFromRoot)) {
|
|
322515
322932
|
throw new WorkspaceError(
|
|
@@ -322568,7 +322985,7 @@ var init_files = __esm({
|
|
|
322568
322985
|
const out = [];
|
|
322569
322986
|
const walk = async (relDir) => {
|
|
322570
322987
|
if (out.length > limit) return;
|
|
322571
|
-
const entries = await
|
|
322988
|
+
const entries = await import_fs11.promises.readdir((0, import_path6.join)(this.root, relDir), { withFileTypes: true }).catch(() => []);
|
|
322572
322989
|
for (const entry of entries) {
|
|
322573
322990
|
if (SKIP_DIRS.has(entry.name)) continue;
|
|
322574
322991
|
const rel = relDir === "." ? entry.name : `${relDir}/${entry.name}`;
|
|
@@ -322611,7 +323028,7 @@ var init_files = __esm({
|
|
|
322611
323028
|
entries = entries.slice(0, limit);
|
|
322612
323029
|
await Promise.all(
|
|
322613
323030
|
entries.filter((e2) => e2.type === "file").map(async (e2) => {
|
|
322614
|
-
e2.size = await
|
|
323031
|
+
e2.size = await import_fs11.promises.stat((0, import_path6.join)(this.root, e2.path)).then((s2) => s2.size).catch(() => void 0);
|
|
322615
323032
|
})
|
|
322616
323033
|
);
|
|
322617
323034
|
return {
|
|
@@ -322622,12 +323039,12 @@ var init_files = __esm({
|
|
|
322622
323039
|
async read(args) {
|
|
322623
323040
|
if (!args.path) throw new WorkspaceError("path is required");
|
|
322624
323041
|
const { abs, rel } = await this.resolvePath(args.path);
|
|
322625
|
-
const stat2 = await
|
|
323042
|
+
const stat2 = await import_fs11.promises.stat(abs).catch(() => null);
|
|
322626
323043
|
if (!stat2) throw new WorkspaceError(`${rel} does not exist`, 404);
|
|
322627
323044
|
if (stat2.isDirectory()) {
|
|
322628
323045
|
throw new WorkspaceError(`${rel} is a directory - use LocalListFiles`);
|
|
322629
323046
|
}
|
|
322630
|
-
const buffer = await
|
|
323047
|
+
const buffer = await import_fs11.promises.readFile(abs);
|
|
322631
323048
|
if (buffer.subarray(0, 8e3).includes(0)) {
|
|
322632
323049
|
return { path: rel, size: stat2.size, binary: true, content: "" };
|
|
322633
323050
|
}
|
|
@@ -322656,7 +323073,7 @@ var init_files = __esm({
|
|
|
322656
323073
|
};
|
|
322657
323074
|
}
|
|
322658
323075
|
async currentText(abs) {
|
|
322659
|
-
return
|
|
323076
|
+
return import_fs11.promises.readFile(abs, "utf-8").catch((e2) => {
|
|
322660
323077
|
if (e2?.code === "ENOENT") return null;
|
|
322661
323078
|
throw e2;
|
|
322662
323079
|
});
|
|
@@ -322677,8 +323094,8 @@ var init_files = __esm({
|
|
|
322677
323094
|
);
|
|
322678
323095
|
}
|
|
322679
323096
|
}
|
|
322680
|
-
await
|
|
322681
|
-
await
|
|
323097
|
+
await import_fs11.promises.mkdir((0, import_path6.dirname)(abs), { recursive: true });
|
|
323098
|
+
await import_fs11.promises.writeFile(abs, content, "utf-8");
|
|
322682
323099
|
return {
|
|
322683
323100
|
path: rel,
|
|
322684
323101
|
size: Buffer.byteLength(content),
|
|
@@ -322710,7 +323127,7 @@ var init_files = __esm({
|
|
|
322710
323127
|
);
|
|
322711
323128
|
}
|
|
322712
323129
|
const after = args.replaceAll ? before.split(args.oldText).join(args.newText ?? "") : before.replace(args.oldText, () => args.newText ?? "");
|
|
322713
|
-
await
|
|
323130
|
+
await import_fs11.promises.writeFile(abs, after, "utf-8");
|
|
322714
323131
|
return {
|
|
322715
323132
|
path: rel,
|
|
322716
323133
|
replacements: args.replaceAll ? count : 1,
|
|
@@ -322721,14 +323138,14 @@ var init_files = __esm({
|
|
|
322721
323138
|
async delete(args) {
|
|
322722
323139
|
if (!args.path) throw new WorkspaceError("path is required");
|
|
322723
323140
|
const { abs, rel } = await this.resolvePath(args.path, { forWrite: true });
|
|
322724
|
-
const stat2 = await
|
|
323141
|
+
const stat2 = await import_fs11.promises.lstat(abs).catch(() => null);
|
|
322725
323142
|
if (!stat2) return { path: rel, deleted: false };
|
|
322726
323143
|
if (stat2.isDirectory()) {
|
|
322727
323144
|
throw new WorkspaceError(
|
|
322728
323145
|
`${rel} is a directory - only files can be deleted (use RunCommand for more)`
|
|
322729
323146
|
);
|
|
322730
323147
|
}
|
|
322731
|
-
await
|
|
323148
|
+
await import_fs11.promises.unlink(abs);
|
|
322732
323149
|
return { path: rel, deleted: true };
|
|
322733
323150
|
}
|
|
322734
323151
|
async search(args) {
|
|
@@ -322780,7 +323197,7 @@ var init_files = __esm({
|
|
|
322780
323197
|
raw = [];
|
|
322781
323198
|
for (const file2 of await this.allFiles(rel, 2e4)) {
|
|
322782
323199
|
if (globRe && !globRe.test(file2)) continue;
|
|
322783
|
-
const text = await
|
|
323200
|
+
const text = await import_fs11.promises.readFile((0, import_path6.join)(this.root, file2)).catch(() => null);
|
|
322784
323201
|
if (!text || text.subarray(0, 8e3).includes(0)) continue;
|
|
322785
323202
|
text.toString("utf-8").split("\n").forEach((line, i2) => {
|
|
322786
323203
|
if (raw.length <= max && re.test(line)) {
|
|
@@ -322801,10 +323218,10 @@ var init_files = __esm({
|
|
|
322801
323218
|
});
|
|
322802
323219
|
|
|
322803
323220
|
// src/commands/workspace/processes.ts
|
|
322804
|
-
var
|
|
323221
|
+
var import_child_process7, DEFAULT_TIMEOUT_S, MAX_TIMEOUT_S, MAX_STREAM_CHARS, MAX_PROCESS_LINES, MAX_PROCESSES, DEFAULT_WAIT_S, MAX_WAIT_S, KILL_GRACE_MS, ANSI, stripAnsi, BASE_ENV, buildEnv, shellOf, killTree, terminate, TailBuffer, runCommand, ProcessManager;
|
|
322805
323222
|
var init_processes = __esm({
|
|
322806
323223
|
"src/commands/workspace/processes.ts"() {
|
|
322807
|
-
|
|
323224
|
+
import_child_process7 = require("child_process");
|
|
322808
323225
|
init_files();
|
|
322809
323226
|
DEFAULT_TIMEOUT_S = 300;
|
|
322810
323227
|
MAX_TIMEOUT_S = 1800;
|
|
@@ -322887,7 +323304,7 @@ var init_processes = __esm({
|
|
|
322887
323304
|
if (!child.pid || child.exitCode !== null) return;
|
|
322888
323305
|
try {
|
|
322889
323306
|
if (process.platform === "win32") {
|
|
322890
|
-
(0,
|
|
323307
|
+
(0, import_child_process7.spawn)("taskkill", ["/pid", String(child.pid), "/T", "/F"]);
|
|
322891
323308
|
} else {
|
|
322892
323309
|
process.kill(-child.pid, signal);
|
|
322893
323310
|
}
|
|
@@ -322929,7 +323346,7 @@ ${this.text}` : this.text;
|
|
|
322929
323346
|
);
|
|
322930
323347
|
const started = Date.now();
|
|
322931
323348
|
const [shell, shellArgs] = shellOf(args.command);
|
|
322932
|
-
const child = (0,
|
|
323349
|
+
const child = (0, import_child_process7.spawn)(shell, shellArgs, {
|
|
322933
323350
|
cwd: args.cwd,
|
|
322934
323351
|
env: args.env,
|
|
322935
323352
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -323019,7 +323436,7 @@ ${this.text}` : this.text;
|
|
|
323019
323436
|
}
|
|
323020
323437
|
}
|
|
323021
323438
|
const [shell, shellArgs] = shellOf(args.command);
|
|
323022
|
-
const child = (0,
|
|
323439
|
+
const child = (0, import_child_process7.spawn)(shell, shellArgs, {
|
|
323023
323440
|
cwd: args.cwd,
|
|
323024
323441
|
env: args.env,
|
|
323025
323442
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -323175,10 +323592,10 @@ ${this.text}` : this.text;
|
|
|
323175
323592
|
});
|
|
323176
323593
|
|
|
323177
323594
|
// src/commands/workspace/connection.ts
|
|
323178
|
-
var
|
|
323595
|
+
var import_os7, WORKSPACE_PATH_PREFIX, WORKSPACE_OPS, HEARTBEAT_MUTATION2, REQUEST_APPROVAL_MUTATION, SETTLE_APPROVAL_MUTATION, str, num, short, WorkspaceConnection;
|
|
323179
323596
|
var init_connection2 = __esm({
|
|
323180
323597
|
"src/commands/workspace/connection.ts"() {
|
|
323181
|
-
|
|
323598
|
+
import_os7 = require("os");
|
|
323182
323599
|
init_tunnel();
|
|
323183
323600
|
init_approvals();
|
|
323184
323601
|
init_files();
|
|
@@ -323261,7 +323678,7 @@ var init_connection2 = __esm({
|
|
|
323261
323678
|
const data = await this.operation(HEARTBEAT_MUTATION2, {
|
|
323262
323679
|
info: {
|
|
323263
323680
|
root: this.options.root,
|
|
323264
|
-
hostname: (0,
|
|
323681
|
+
hostname: (0, import_os7.hostname)(),
|
|
323265
323682
|
platform: process.platform,
|
|
323266
323683
|
gitBranch: await this.files.gitBranch(),
|
|
323267
323684
|
clientVersion: this.options.version,
|
|
@@ -323325,7 +323742,7 @@ var init_connection2 = __esm({
|
|
|
323325
323742
|
}
|
|
323326
323743
|
/** One operation (exposed for tests). */
|
|
323327
323744
|
async dispatch(op, args, signal) {
|
|
323328
|
-
const
|
|
323745
|
+
const log2 = (line) => this.options.logger.info(line);
|
|
323329
323746
|
switch (op) {
|
|
323330
323747
|
case "info":
|
|
323331
323748
|
return {
|
|
@@ -323338,21 +323755,21 @@ var init_connection2 = __esm({
|
|
|
323338
323755
|
processes: this.processes.list()
|
|
323339
323756
|
};
|
|
323340
323757
|
case "list":
|
|
323341
|
-
|
|
323758
|
+
log2(`-> list ${str(args.path) ?? "."}`);
|
|
323342
323759
|
return this.files.list({
|
|
323343
323760
|
path: str(args.path),
|
|
323344
323761
|
recursive: args.recursive !== false,
|
|
323345
323762
|
limit: num(args.limit)
|
|
323346
323763
|
});
|
|
323347
323764
|
case "read":
|
|
323348
|
-
|
|
323765
|
+
log2(`-> read ${str(args.path)}`);
|
|
323349
323766
|
return this.files.read({
|
|
323350
323767
|
path: str(args.path),
|
|
323351
323768
|
startLine: num(args.startLine),
|
|
323352
323769
|
endLine: num(args.endLine)
|
|
323353
323770
|
});
|
|
323354
323771
|
case "search":
|
|
323355
|
-
|
|
323772
|
+
log2(`-> search /${str(args.pattern)}/ in ${str(args.path) ?? "."}`);
|
|
323356
323773
|
return this.files.search({
|
|
323357
323774
|
pattern: str(args.pattern),
|
|
323358
323775
|
path: str(args.path),
|
|
@@ -323367,7 +323784,7 @@ var init_connection2 = __esm({
|
|
|
323367
323784
|
content: str(args.content) ?? "",
|
|
323368
323785
|
expectedHash: str(args.expectedHash)
|
|
323369
323786
|
});
|
|
323370
|
-
|
|
323787
|
+
log2(`\u270E ${result.created ? "created" : "wrote"} ${result.path}`);
|
|
323371
323788
|
return result;
|
|
323372
323789
|
}
|
|
323373
323790
|
case "edit": {
|
|
@@ -323378,12 +323795,12 @@ var init_connection2 = __esm({
|
|
|
323378
323795
|
replaceAll: args.replaceAll === true,
|
|
323379
323796
|
expectedHash: str(args.expectedHash)
|
|
323380
323797
|
});
|
|
323381
|
-
|
|
323798
|
+
log2(`\u270E edited ${result.path} (${result.replacements}x)`);
|
|
323382
323799
|
return result;
|
|
323383
323800
|
}
|
|
323384
323801
|
case "delete": {
|
|
323385
323802
|
const result = await this.files.delete({ path: str(args.path) });
|
|
323386
|
-
if (result.deleted)
|
|
323803
|
+
if (result.deleted) log2(`\u270E deleted ${result.path}`);
|
|
323387
323804
|
return result;
|
|
323388
323805
|
}
|
|
323389
323806
|
case "exec":
|
|
@@ -323402,7 +323819,7 @@ var init_connection2 = __esm({
|
|
|
323402
323819
|
const result = await this.processes.stop({
|
|
323403
323820
|
processId: str(args.processId)
|
|
323404
323821
|
});
|
|
323405
|
-
|
|
323822
|
+
log2(`\u25A0 stopped ${result.processId}`);
|
|
323406
323823
|
return result;
|
|
323407
323824
|
}
|
|
323408
323825
|
default:
|
|
@@ -323573,12 +323990,12 @@ __export(start_exports4, {
|
|
|
323573
323990
|
WORKSPACE_VERSION: () => WORKSPACE_VERSION,
|
|
323574
323991
|
default: () => start_default2
|
|
323575
323992
|
});
|
|
323576
|
-
var import_promises12, import_path7,
|
|
323993
|
+
var import_promises12, import_path7, import_rxjs67, WORKSPACE_VERSION, csv, resolveWorkspace, start_default2;
|
|
323577
323994
|
var init_start4 = __esm({
|
|
323578
323995
|
"src/commands/workspace/start.ts"() {
|
|
323579
323996
|
import_promises12 = require("fs/promises");
|
|
323580
323997
|
import_path7 = require("path");
|
|
323581
|
-
|
|
323998
|
+
import_rxjs67 = __toESM(require_cjs());
|
|
323582
323999
|
init_helpers();
|
|
323583
324000
|
init_gql_client();
|
|
323584
324001
|
init_log();
|
|
@@ -323608,7 +324025,7 @@ var init_start4 = __esm({
|
|
|
323608
324025
|
if (saved && (!cmd.project || cmd.project === saved.projectId)) {
|
|
323609
324026
|
return saved;
|
|
323610
324027
|
}
|
|
323611
|
-
const projectId = await (0,
|
|
324028
|
+
const projectId = await (0, import_rxjs67.lastValueFrom)(parseProjectId(cmd.project)).catch(
|
|
323612
324029
|
() => {
|
|
323613
324030
|
throw new Error(
|
|
323614
324031
|
"No project selected. Pass --project <projectId> or run `gcli project:use <projectId>` first."
|
|
@@ -323617,7 +324034,7 @@ var init_start4 = __esm({
|
|
|
323617
324034
|
);
|
|
323618
324035
|
const name2 = cmd.name || (0, import_path7.basename)(root);
|
|
323619
324036
|
Logger.info(`Registering ${root} as local workspace "${name2}"...`);
|
|
323620
|
-
const { workspace, token } = await (0,
|
|
324037
|
+
const { workspace, token } = await (0, import_rxjs67.lastValueFrom)(
|
|
323621
324038
|
GraphqlClienAPI.createLocalWorkspace(projectId, name2)
|
|
323622
324039
|
).catch((e2) => {
|
|
323623
324040
|
throw new Error(
|
|
@@ -323708,16 +324125,16 @@ var list_exports9 = {};
|
|
|
323708
324125
|
__export(list_exports9, {
|
|
323709
324126
|
default: () => list_default9
|
|
323710
324127
|
});
|
|
323711
|
-
var
|
|
324128
|
+
var import_rxjs68, list_default9;
|
|
323712
324129
|
var init_list9 = __esm({
|
|
323713
324130
|
"src/commands/workspace/list.ts"() {
|
|
323714
|
-
|
|
324131
|
+
import_rxjs68 = __toESM(require_cjs());
|
|
323715
324132
|
init_gql_client();
|
|
323716
324133
|
init_log();
|
|
323717
324134
|
init_config2();
|
|
323718
324135
|
list_default9 = async (cmd) => {
|
|
323719
324136
|
const [workspaces, saved] = await Promise.all([
|
|
323720
|
-
(0,
|
|
324137
|
+
(0, import_rxjs68.lastValueFrom)(GraphqlClienAPI.listLocalWorkspaces(cmd.project)),
|
|
323721
324138
|
readSavedWorkspaces()
|
|
323722
324139
|
]);
|
|
323723
324140
|
const onThisMachine = new Set(Object.values(saved).map((w) => w.id));
|
|
@@ -323751,11 +324168,11 @@ var delete_exports6 = {};
|
|
|
323751
324168
|
__export(delete_exports6, {
|
|
323752
324169
|
default: () => delete_default6
|
|
323753
324170
|
});
|
|
323754
|
-
var import_promises13,
|
|
324171
|
+
var import_promises13, import_rxjs69, delete_default6;
|
|
323755
324172
|
var init_delete6 = __esm({
|
|
323756
324173
|
"src/commands/workspace/delete.ts"() {
|
|
323757
324174
|
import_promises13 = require("fs/promises");
|
|
323758
|
-
|
|
324175
|
+
import_rxjs69 = __toESM(require_cjs());
|
|
323759
324176
|
init_gql_client();
|
|
323760
324177
|
init_log();
|
|
323761
324178
|
init_config2();
|
|
@@ -323767,7 +324184,7 @@ var init_delete6 = __esm({
|
|
|
323767
324184
|
"No workspace registered for this directory - pass --id (see `gcli workspace:list`)."
|
|
323768
324185
|
);
|
|
323769
324186
|
}
|
|
323770
|
-
await (0,
|
|
324187
|
+
await (0, import_rxjs69.lastValueFrom)(GraphqlClienAPI.deleteLocalWorkspace(workspaceId));
|
|
323771
324188
|
await forgetWorkspace({ id: workspaceId });
|
|
323772
324189
|
Logger.log(
|
|
323773
324190
|
`Local workspace ${workspaceId} deleted; its token no longer works.`
|
|
@@ -323792,7 +324209,9 @@ init_src();
|
|
|
323792
324209
|
// src/commands/auth/index.ts
|
|
323793
324210
|
init_helpers();
|
|
323794
324211
|
function registerAuthCommands(program2) {
|
|
323795
|
-
program2.command("login").description(
|
|
324212
|
+
program2.command("login").description(
|
|
324213
|
+
"Log in. Without --token: prints a link, opens your browser and waits for you to approve it on lambforge.com"
|
|
324214
|
+
).option("--no-browser", "Only print the login link, do not open a browser").option("-k, --key <key>", "Specify api key").option("-uu, --uploadUrl <key>", "Specify upload server").option("-ci, --ci", "Initialize directories for CI/CD purposes").option(
|
|
323796
324215
|
"-t, --token <token>",
|
|
323797
324216
|
"Specify custom token generated from the website"
|
|
323798
324217
|
).option("-u, --url <url>", "Specify api url").action(lazy(() => Promise.resolve().then(() => (init_login(), login_exports)).then((m2) => m2.default)));
|
|
@@ -323928,7 +324347,27 @@ function registerClusterCommands(program2) {
|
|
|
323928
324347
|
program2.command("cluster:autoscale").description(
|
|
323929
324348
|
"Change the worker autoscaling policy - only the flags you pass change"
|
|
323930
324349
|
)
|
|
323931
|
-
).option("--enable", "Turn autoscaling on (multi-node clusters only)").option("--disable", "Turn autoscaling off").option("--min <min>", "Minimum workers (1-10)").option("--max <max>", "Maximum workers (1-10)").option("--cpuUp <percent>", "Scale up at this CPU % (1-100)").option("--memUp <percent>", "Scale up at this memory % (1-100)").option("--cpuDown <percent>", "Scale down below this CPU % (1-100)").option("--memDown <percent>", "Scale down below this memory % (1-100)").option("--samples <n>", "Consecutive readings before acting (1-20)").option("--cooldown <minutes>", "Minutes between scale actions (1-1440)").
|
|
324350
|
+
).option("--enable", "Turn autoscaling on (multi-node clusters only)").option("--disable", "Turn autoscaling off").option("--min <min>", "Minimum workers (1-10)").option("--max <max>", "Maximum workers (1-10)").option("--cpuUp <percent>", "Scale up at this CPU % (1-100)").option("--memUp <percent>", "Scale up at this memory % (1-100)").option("--cpuDown <percent>", "Scale down below this CPU % (1-100)").option("--memDown <percent>", "Scale down below this memory % (1-100)").option("--samples <n>", "Consecutive readings before acting (1-20)").option("--cooldown <minutes>", "Minutes between scale actions (1-1440)").option(
|
|
324351
|
+
"--profile <profile>",
|
|
324352
|
+
"conservative | balanced | aggressive presets the thresholds above; custom uses them as given"
|
|
324353
|
+
).option(
|
|
324354
|
+
"--serverTypes <types>",
|
|
324355
|
+
`Comma-separated worker server types in order of preference, e.g. cx33,cpx22 (the next is used when one is out of stock); "" = the cluster's own type`
|
|
324356
|
+
).option("--step <n>", "Workers added per scale-up (1-3, custom profile)").option(
|
|
324357
|
+
"--mode <mode>",
|
|
324358
|
+
"thresholds (CPU/memory %) | pods (create the cheapest nodes that fit unschedulable pods)"
|
|
324359
|
+
).option(
|
|
324360
|
+
"--consolidation",
|
|
324361
|
+
"pods mode: remove the newest worker when its pods fit elsewhere"
|
|
324362
|
+
).option("--no-consolidation", "pods mode: never remove workers by itself").option(
|
|
324363
|
+
"--minNodeAge <minutes>",
|
|
324364
|
+
"pods mode: never remove a worker younger than this (5-1440)"
|
|
324365
|
+
).action(lazy(() => Promise.resolve().then(() => (init_autoscale(), autoscale_exports)).then((m2) => m2.default)));
|
|
324366
|
+
target(
|
|
324367
|
+
program2.command("cluster:plan").description(
|
|
324368
|
+
"Why pods are pending and what the pods-mode autoscaler would do: a verdict per pod, the nodes it would create, consolidation"
|
|
324369
|
+
)
|
|
324370
|
+
).action(lazy(() => Promise.resolve().then(() => (init_plan2(), plan_exports)).then((m2) => m2.default)));
|
|
323932
324371
|
target(
|
|
323933
324372
|
program2.command("cluster:multi-node").description(
|
|
323934
324373
|
"Convert a single-node cluster to dedicated worker nodes (required for autoscaling)"
|