@stacksjs/ts-cloud 0.7.59 → 0.7.61
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/dist/auth/encryption.d.ts +2 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/bin/cli.js +2973 -2973
- package/dist/{chunk-g126cfn9.js → chunk-c82m4yzn.js} +79 -67
- package/dist/{chunk-9m6b4m74.js → chunk-pbh6b828.js} +61 -17
- package/dist/{chunk-e05phx5f.js → chunk-rxhqny6z.js} +2 -2
- package/dist/{chunk-vdk53yyq.js → chunk-tq46tnxv.js} +102 -64
- package/dist/{chunk-exbcsab2.js → chunk-zvk0f89t.js} +1 -1
- package/dist/control-plane/index.d.ts +1 -1
- package/dist/control-plane/store.d.ts +2 -1
- package/dist/deploy/dashboard-config-module.d.ts +7 -1
- package/dist/deploy/dashboard-session.d.ts +2 -1
- package/dist/deploy/dashboard-users.d.ts +5 -4
- package/dist/deploy/index.d.ts +1 -1
- package/dist/deploy/index.js +7 -7
- package/dist/deploy/management-dashboard.d.ts +4 -3
- package/dist/drivers/index.js +2 -2
- package/dist/drivers/shared/releases.d.ts +32 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -10
- package/dist/ui/access-denied.html +2 -2
- package/dist/ui/account/automation.html +4 -4
- package/dist/ui/account/security.html +2 -2
- package/dist/ui/applications/compose.html +4 -4
- package/dist/ui/applications/new.html +2 -2
- package/dist/ui/data/backups.html +4 -4
- package/dist/ui/data/services.html +4 -4
- package/dist/ui/data/volumes.html +4 -4
- package/dist/ui/index.html +4 -4
- package/dist/ui/operations/alerts.html +4 -4
- package/dist/ui/operations/configuration.html +4 -4
- package/dist/ui/operations/jobs.html +4 -4
- package/dist/ui/operations/maintenance.html +4 -4
- package/dist/ui/operations/observability.html +4 -4
- package/dist/ui/operations/previews.html +4 -4
- package/dist/ui/operations/queue.html +4 -4
- package/dist/ui/operations/regions.html +4 -4
- package/dist/ui/operations/releases.html +4 -4
- package/dist/ui/operations/workloads.html +4 -4
- package/dist/ui/security.html +2 -2
- package/dist/ui/server/actions.html +4 -4
- package/dist/ui/server/activity.html +2 -2
- package/dist/ui/server/capacity.html +4 -4
- package/dist/ui/server/database.html +4 -4
- package/dist/ui/server/deployments.html +4 -4
- package/dist/ui/server/diagnostics.html +2 -2
- package/dist/ui/server/firewall.html +4 -4
- package/dist/ui/server/fleet.html +4 -4
- package/dist/ui/server/logs.html +4 -4
- package/dist/ui/server/metrics.html +2 -2
- package/dist/ui/server/security.html +2 -2
- package/dist/ui/server/services.html +2 -2
- package/dist/ui/server/sites.html +4 -4
- package/dist/ui/server/ssh-keys.html +4 -4
- package/dist/ui/server/team.html +4 -4
- package/dist/ui/serverless/alarms.html +3 -3
- package/dist/ui/serverless/assets.html +2 -2
- package/dist/ui/serverless/cost.html +2 -2
- package/dist/ui/serverless/data.html +4 -4
- package/dist/ui/serverless/deployments.html +2 -2
- package/dist/ui/serverless/firewall.html +2 -2
- package/dist/ui/serverless/functions.html +4 -4
- package/dist/ui/serverless/logs.html +4 -4
- package/dist/ui/serverless/metrics.html +2 -2
- package/dist/ui/serverless/queues.html +4 -4
- package/dist/ui/serverless/secrets.html +4 -4
- package/dist/ui/serverless/traces.html +4 -4
- package/dist/ui/serverless.html +3 -3
- package/package.json +3 -3
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
step,
|
|
10
10
|
success,
|
|
11
11
|
warn
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-zvk0f89t.js";
|
|
13
13
|
import {
|
|
14
14
|
AwsBackupClient,
|
|
15
15
|
CloudWatchLogsClient,
|
|
@@ -45,12 +45,13 @@ import {
|
|
|
45
45
|
resolveSiteKind,
|
|
46
46
|
resolveUiSource,
|
|
47
47
|
siteInstallBase
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-pbh6b828.js";
|
|
49
49
|
import {
|
|
50
50
|
artifactKey,
|
|
51
51
|
buildCloudFormationTemplate,
|
|
52
52
|
composeServerlessAppTemplate,
|
|
53
53
|
createExistingStaticFullStackPreset,
|
|
54
|
+
isStatePath,
|
|
54
55
|
laravelServerlessEnvDefaults,
|
|
55
56
|
packagePhpApp,
|
|
56
57
|
packageServerlessApp,
|
|
@@ -62,8 +63,11 @@ import {
|
|
|
62
63
|
resolveServerlessAppStackName,
|
|
63
64
|
resolveServerlessArtifactBucketName,
|
|
64
65
|
resolveServerlessAssetBucketName,
|
|
65
|
-
resolveServerlessRuntime
|
|
66
|
-
|
|
66
|
+
resolveServerlessRuntime,
|
|
67
|
+
resolveStatePath,
|
|
68
|
+
setStateDir,
|
|
69
|
+
statePath
|
|
70
|
+
} from "./chunk-tq46tnxv.js";
|
|
67
71
|
import {
|
|
68
72
|
SSMClient
|
|
69
73
|
} from "./chunk-703nkybg.js";
|
|
@@ -1546,7 +1550,7 @@ var controlPlaneMigrations = [
|
|
|
1546
1550
|
// src/control-plane/store.ts
|
|
1547
1551
|
import { createHash, randomBytes } from "node:crypto";
|
|
1548
1552
|
import { chmodSync, existsSync, mkdirSync, statSync, writeFileSync } from "node:fs";
|
|
1549
|
-
import { dirname
|
|
1553
|
+
import { dirname } from "node:path";
|
|
1550
1554
|
import { Database } from "bun:sqlite";
|
|
1551
1555
|
|
|
1552
1556
|
// src/control-plane/authorization.ts
|
|
@@ -1703,7 +1707,9 @@ class UnsupportedSchemaVersionError extends Error {
|
|
|
1703
1707
|
}
|
|
1704
1708
|
|
|
1705
1709
|
// src/control-plane/store.ts
|
|
1706
|
-
|
|
1710
|
+
function controlPlaneDatabaseFile() {
|
|
1711
|
+
return statePath("control-plane.sqlite");
|
|
1712
|
+
}
|
|
1707
1713
|
var MAX_CONTROL_PLANE_JSON_BYTES = 64 * 1024;
|
|
1708
1714
|
var MAX_CONTROL_PLANE_ERROR_BYTES = 16 * 1024;
|
|
1709
1715
|
var TERMINAL_STATES = ["succeeded", "failed", "cancelled", "timed_out"];
|
|
@@ -1978,7 +1984,7 @@ class ControlPlaneStore {
|
|
|
1978
1984
|
nowFn;
|
|
1979
1985
|
idFn;
|
|
1980
1986
|
constructor(options = {}) {
|
|
1981
|
-
this.path = options.path ??
|
|
1987
|
+
this.path = options.path ?? resolveStatePath(options.cwd ?? process.cwd(), "control-plane.sqlite");
|
|
1982
1988
|
this.nowFn = options.now ?? (() => new Date);
|
|
1983
1989
|
this.idFn = options.id ?? (() => crypto.randomUUID());
|
|
1984
1990
|
const inMemory = this.path === ":memory:";
|
|
@@ -7980,13 +7986,15 @@ import { createHash as createHash8 } from "node:crypto";
|
|
|
7980
7986
|
import { existsSync as existsSync3, mkdirSync as mkdirSync2, mkdtempSync, readdirSync, readFileSync, rmSync, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
7981
7987
|
import { tmpdir } from "node:os";
|
|
7982
7988
|
import { basename as basename2, join as join3, relative, resolve as resolve2 } from "node:path";
|
|
7983
|
-
var IGNORED_DIRECTORIES = new Set([".git", "
|
|
7989
|
+
var IGNORED_DIRECTORIES = new Set([".git", "node_modules", "dist", "coverage"]);
|
|
7984
7990
|
function filesIn(directory, base = directory) {
|
|
7985
7991
|
const files = [];
|
|
7986
7992
|
for (const name of readdirSync(directory).sort()) {
|
|
7987
7993
|
if (IGNORED_DIRECTORIES.has(name))
|
|
7988
7994
|
continue;
|
|
7989
7995
|
const path = join3(directory, name);
|
|
7996
|
+
if (isStatePath(path, base))
|
|
7997
|
+
continue;
|
|
7990
7998
|
const stat2 = statSync2(path);
|
|
7991
7999
|
if (stat2.isDirectory())
|
|
7992
8000
|
files.push(...filesIn(path, base));
|
|
@@ -8309,7 +8317,7 @@ async function deployServerlessApp(config, environment2, opts = {}) {
|
|
|
8309
8317
|
}
|
|
8310
8318
|
if (imageMode) {
|
|
8311
8319
|
step("Building + pushing container image");
|
|
8312
|
-
const { buildAndPushServerlessImage } = await import("./chunk-
|
|
8320
|
+
const { buildAndPushServerlessImage } = await import("./chunk-rxhqny6z.js");
|
|
8313
8321
|
const built = await buildAndPushServerlessImage({
|
|
8314
8322
|
app,
|
|
8315
8323
|
projectRoot,
|
|
@@ -9312,7 +9320,7 @@ import { createHash as createHash33 } from "node:crypto";
|
|
|
9312
9320
|
import { existsSync as existsSync20, mkdtempSync as mkdtempSync3, readdirSync as readdirSync8, rmSync as rmSync3, statSync as statSync6 } from "node:fs";
|
|
9313
9321
|
import { readFile as readFile2, writeFile as writeFile4 } from "node:fs/promises";
|
|
9314
9322
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
9315
|
-
import { dirname as dirname9, extname as extname3, join as
|
|
9323
|
+
import { dirname as dirname9, extname as extname3, join as join13, normalize as normalize3, relative as relative7, resolve as resolve15, sep as sep5 } from "node:path";
|
|
9316
9324
|
import { fileURLToPath } from "node:url";
|
|
9317
9325
|
// src/alerts/store.ts
|
|
9318
9326
|
import { createCipheriv, createDecipheriv, createHash as createHash9, randomBytes as randomBytes2 } from "node:crypto";
|
|
@@ -12061,7 +12069,7 @@ async function manifestRequest(fetchFn, root, image, token, signal, authorizatio
|
|
|
12061
12069
|
// src/onboarding/artifact-store.ts
|
|
12062
12070
|
import { createHash as createHash12 } from "node:crypto";
|
|
12063
12071
|
import { chmodSync as chmodSync2, existsSync as existsSync5, mkdirSync as mkdirSync3, renameSync, unlinkSync, writeFileSync as writeFileSync3 } from "node:fs";
|
|
12064
|
-
import { basename as basename3, join as join5
|
|
12072
|
+
import { basename as basename3, join as join5 } from "node:path";
|
|
12065
12073
|
function map2(row) {
|
|
12066
12074
|
return {
|
|
12067
12075
|
id: String(row.id),
|
|
@@ -12085,7 +12093,7 @@ class ApplicationArtifactStore {
|
|
|
12085
12093
|
nowFn;
|
|
12086
12094
|
constructor(controlPlane, options) {
|
|
12087
12095
|
this.controlPlane = controlPlane;
|
|
12088
|
-
this.root =
|
|
12096
|
+
this.root = resolveStatePath(options.cwd, "artifacts");
|
|
12089
12097
|
this.idFn = options.id ?? (() => crypto.randomUUID());
|
|
12090
12098
|
this.nowFn = options.now ?? (() => new Date);
|
|
12091
12099
|
}
|
|
@@ -18266,13 +18274,15 @@ async function sendAuthenticationEmail(config, message) {
|
|
|
18266
18274
|
// src/auth/encryption.ts
|
|
18267
18275
|
import { randomBytes as randomBytes6 } from "node:crypto";
|
|
18268
18276
|
import { chmodSync as chmodSync4, existsSync as existsSync6, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync5 } from "node:fs";
|
|
18269
|
-
import { dirname as dirname2
|
|
18270
|
-
|
|
18277
|
+
import { dirname as dirname2 } from "node:path";
|
|
18278
|
+
function authEncryptionKeyFile() {
|
|
18279
|
+
return statePath("auth-encryption-key");
|
|
18280
|
+
}
|
|
18271
18281
|
function resolveAuthEncryptionKey(cwd) {
|
|
18272
18282
|
const configured = process.env.TS_CLOUD_AUTH_ENCRYPTION_KEY?.trim();
|
|
18273
18283
|
if (configured)
|
|
18274
18284
|
return configured;
|
|
18275
|
-
const file =
|
|
18285
|
+
const file = resolveStatePath(cwd, "auth-encryption-key");
|
|
18276
18286
|
try {
|
|
18277
18287
|
if (existsSync6(file)) {
|
|
18278
18288
|
const saved = readFileSync4(file, "utf8").trim();
|
|
@@ -21959,7 +21969,7 @@ class AwsElastiCacheTransport {
|
|
|
21959
21969
|
}
|
|
21960
21970
|
// src/data-services/docker-transport.ts
|
|
21961
21971
|
import { mkdir as mkdir2, writeFile } from "node:fs/promises";
|
|
21962
|
-
import { join as
|
|
21972
|
+
import { join as join7 } from "node:path";
|
|
21963
21973
|
async function docker(args, stdin, allowFailure = false) {
|
|
21964
21974
|
const process3 = Bun.spawn(["docker", ...args], {
|
|
21965
21975
|
stdin: stdin == null ? "ignore" : "pipe",
|
|
@@ -22071,7 +22081,7 @@ function labels(inspect) {
|
|
|
22071
22081
|
class DockerDataTransport {
|
|
22072
22082
|
runtime;
|
|
22073
22083
|
backupRoot;
|
|
22074
|
-
constructor(runtime3 = new BunDockerRuntime, backupRoot =
|
|
22084
|
+
constructor(runtime3 = new BunDockerRuntime, backupRoot = resolveStatePath(process.cwd(), "backups", "data")) {
|
|
22075
22085
|
this.runtime = runtime3;
|
|
22076
22086
|
this.backupRoot = backupRoot;
|
|
22077
22087
|
}
|
|
@@ -22254,7 +22264,7 @@ requirepass ${credential2.replaceAll("\\", "\\\\").replaceAll(`
|
|
|
22254
22264
|
if (!/^[A-Za-z0-9_.-]{2,120}$/.test(backupId))
|
|
22255
22265
|
throw new Error("Backup identifier contains unsupported characters.");
|
|
22256
22266
|
await mkdir2(this.backupRoot, { recursive: true, mode: 448 });
|
|
22257
|
-
const path =
|
|
22267
|
+
const path = join7(this.backupRoot, `${backupId}.sql`);
|
|
22258
22268
|
await writeFile(path, exported.body, { mode: 384 });
|
|
22259
22269
|
return { status: "available", backupId, path, engine, database, username };
|
|
22260
22270
|
}
|
|
@@ -22497,7 +22507,7 @@ class FilesystemBackupSource {
|
|
|
22497
22507
|
runtime;
|
|
22498
22508
|
root;
|
|
22499
22509
|
restoreRoot;
|
|
22500
|
-
constructor(root, runtime3 = new BunFilesystemArchiveRuntime, restoreRoot =
|
|
22510
|
+
constructor(root, runtime3 = new BunFilesystemArchiveRuntime, restoreRoot = resolveStatePath(root, "restores", "files")) {
|
|
22501
22511
|
this.runtime = runtime3;
|
|
22502
22512
|
this.root = resolve7(root);
|
|
22503
22513
|
this.restoreRoot = resolve7(restoreRoot);
|
|
@@ -22826,7 +22836,7 @@ class ControlPlaneBackupSource {
|
|
|
22826
22836
|
controlPlane;
|
|
22827
22837
|
root;
|
|
22828
22838
|
restoreRoot;
|
|
22829
|
-
constructor(controlPlane, root, restoreRoot =
|
|
22839
|
+
constructor(controlPlane, root, restoreRoot = resolveStatePath(root, "restores", "control-plane")) {
|
|
22830
22840
|
this.controlPlane = controlPlane;
|
|
22831
22841
|
this.root = resolve8(root);
|
|
22832
22842
|
this.restoreRoot = resolve8(restoreRoot);
|
|
@@ -23000,7 +23010,7 @@ class AwsInfrastructureBackupSource {
|
|
|
23000
23010
|
}
|
|
23001
23011
|
// src/config.ts
|
|
23002
23012
|
import { existsSync as existsSync11 } from "node:fs";
|
|
23003
|
-
import { join as
|
|
23013
|
+
import { join as join9 } from "node:path";
|
|
23004
23014
|
import { pathToFileURL } from "node:url";
|
|
23005
23015
|
|
|
23006
23016
|
// ../../node_modules/bunfig/dist/index.js
|
|
@@ -23020,7 +23030,7 @@ import { existsSync as existsSync32, mkdirSync as mkdirSync22, readdirSync as re
|
|
|
23020
23030
|
import { homedir } from "os";
|
|
23021
23031
|
import { dirname as dirname22, resolve as resolve32 } from "path";
|
|
23022
23032
|
import process6 from "process";
|
|
23023
|
-
import { join as
|
|
23033
|
+
import { join as join8, relative as relative5, resolve as resolve22 } from "path";
|
|
23024
23034
|
import process22 from "process";
|
|
23025
23035
|
import { existsSync as existsSync222, mkdirSync as mkdirSync5, readdirSync as readdirSync5, writeFileSync as writeFileSync6 } from "fs";
|
|
23026
23036
|
import { dirname as dirname5, resolve as resolve9 } from "path";
|
|
@@ -28338,7 +28348,7 @@ var init_dist = __esm(async () => {
|
|
|
28338
28348
|
};
|
|
28339
28349
|
defaultConfigDir = resolve9(process3.cwd(), "config");
|
|
28340
28350
|
defaultGeneratedDir = resolve9(process3.cwd(), "src/generated");
|
|
28341
|
-
defaultLogDirectory = process22.env.CLARITY_LOG_DIR ||
|
|
28351
|
+
defaultLogDirectory = process22.env.CLARITY_LOG_DIR || join8(getProjectRoot(), "logs");
|
|
28342
28352
|
defaultConfig = {
|
|
28343
28353
|
level: "info",
|
|
28344
28354
|
defaultName: "clarity",
|
|
@@ -31699,7 +31709,7 @@ function isDefaultConfig(config5) {
|
|
|
31699
31709
|
return config5.project?.slug === defaultConfig4.project?.slug && Object.keys(config5.environments ?? {}).length === 1 && !!config5.environments?.production;
|
|
31700
31710
|
}
|
|
31701
31711
|
async function loadStacksCloudConfig() {
|
|
31702
|
-
const candidates = [
|
|
31712
|
+
const candidates = [join9(process.cwd(), "config", "cloud.ts"), join9(process.cwd(), "config", "cloud.js")];
|
|
31703
31713
|
for (const file of candidates) {
|
|
31704
31714
|
if (!existsSync11(file))
|
|
31705
31715
|
continue;
|
|
@@ -31719,6 +31729,7 @@ async function getConfig() {
|
|
|
31719
31729
|
if (isDefaultConfig(_config)) {
|
|
31720
31730
|
_config = await loadStacksCloudConfig() ?? _config;
|
|
31721
31731
|
}
|
|
31732
|
+
setStateDir(_config.stateDir);
|
|
31722
31733
|
}
|
|
31723
31734
|
return _config;
|
|
31724
31735
|
}
|
|
@@ -36925,7 +36936,7 @@ class SecurityPostureStore {
|
|
|
36925
36936
|
}
|
|
36926
36937
|
// src/security/pre-deploy-scanner.ts
|
|
36927
36938
|
import { existsSync as existsSync14, readdirSync as readdirSync7, readFileSync as readFileSync6, statSync as statSync5 } from "node:fs";
|
|
36928
|
-
import { extname as extname2, join as
|
|
36939
|
+
import { extname as extname2, join as join10, relative as relative6 } from "node:path";
|
|
36929
36940
|
var SECRET_PATTERNS = [
|
|
36930
36941
|
{
|
|
36931
36942
|
name: "AWS Access Key ID",
|
|
@@ -37357,7 +37368,7 @@ class PreDeployScanner {
|
|
|
37357
37368
|
const scan = (currentDir) => {
|
|
37358
37369
|
const entries = readdirSync7(currentDir, { withFileTypes: true });
|
|
37359
37370
|
for (const entry2 of entries) {
|
|
37360
|
-
const fullPath =
|
|
37371
|
+
const fullPath = join10(currentDir, entry2.name);
|
|
37361
37372
|
if (entry2.isDirectory()) {
|
|
37362
37373
|
if (!excludeDirs.includes(entry2.name)) {
|
|
37363
37374
|
scan(fullPath);
|
|
@@ -37675,7 +37686,7 @@ class AwsIamCapabilityScanner {
|
|
|
37675
37686
|
// src/security/artifacts.ts
|
|
37676
37687
|
import { createHash as createHash29, createVerify as createVerify2 } from "node:crypto";
|
|
37677
37688
|
import { existsSync as existsSync16, readFileSync as readFileSync7 } from "node:fs";
|
|
37678
|
-
import { basename as basename5, join as
|
|
37689
|
+
import { basename as basename5, join as join11, resolve as resolve13 } from "node:path";
|
|
37679
37690
|
function sha256(value2) {
|
|
37680
37691
|
return createHash29("sha256").update(value2).digest("hex");
|
|
37681
37692
|
}
|
|
@@ -37707,7 +37718,7 @@ function packageComponents(manifest3) {
|
|
|
37707
37718
|
return [...found.values()].sort((left, right) => `${left.name}@${left.version}`.localeCompare(`${right.name}@${right.version}`));
|
|
37708
37719
|
}
|
|
37709
37720
|
function generateCycloneDxSbom(root, options = {}) {
|
|
37710
|
-
const manifestPath =
|
|
37721
|
+
const manifestPath = join11(resolve13(root), "package.json");
|
|
37711
37722
|
if (!existsSync16(manifestPath))
|
|
37712
37723
|
throw new Error(`Cannot generate an SBOM: ${manifestPath} was not found`);
|
|
37713
37724
|
const encoded = readFileSync7(manifestPath, "utf8");
|
|
@@ -38168,7 +38179,7 @@ function generatePassword() {
|
|
|
38168
38179
|
|
|
38169
38180
|
// src/deploy/dashboard-data-server.ts
|
|
38170
38181
|
import { existsSync as existsSync17, readFileSync as readFileSync8 } from "node:fs";
|
|
38171
|
-
import { join as
|
|
38182
|
+
import { join as join12 } from "node:path";
|
|
38172
38183
|
|
|
38173
38184
|
// src/deploy/ssh-config-editor.ts
|
|
38174
38185
|
import { createHash as createHash30 } from "node:crypto";
|
|
@@ -38443,11 +38454,11 @@ function configuredRegion(config6) {
|
|
|
38443
38454
|
return config6.project.region ?? "us-east-1";
|
|
38444
38455
|
}
|
|
38445
38456
|
function loadLocalState(config6, environment2) {
|
|
38446
|
-
const
|
|
38447
|
-
if (!existsSync17(
|
|
38457
|
+
const statePath2 = join12(process.cwd(), "storage", "cloud", "state", `${config6.project.slug}-${environment2}.json`);
|
|
38458
|
+
if (!existsSync17(statePath2))
|
|
38448
38459
|
return null;
|
|
38449
38460
|
try {
|
|
38450
|
-
return JSON.parse(readFileSync8(
|
|
38461
|
+
return JSON.parse(readFileSync8(statePath2, "utf8"));
|
|
38451
38462
|
} catch {
|
|
38452
38463
|
return null;
|
|
38453
38464
|
}
|
|
@@ -39738,15 +39749,14 @@ function routePolicy(method, pathname) {
|
|
|
39738
39749
|
// src/deploy/dashboard-session.ts
|
|
39739
39750
|
import { createHmac as createHmac5, randomBytes as randomBytes13, timingSafeEqual as timingSafeEqual5 } from "node:crypto";
|
|
39740
39751
|
import { chmodSync as chmodSync5, existsSync as existsSync18, mkdirSync as mkdirSync6, readFileSync as readFileSync9, writeFileSync as writeFileSync8 } from "node:fs";
|
|
39741
|
-
import { dirname as dirname7
|
|
39752
|
+
import { dirname as dirname7 } from "node:path";
|
|
39742
39753
|
var SESSION_COOKIE = "ts_cloud_session";
|
|
39743
|
-
var SECRET_FILE = join14(".ts-cloud", "dashboard-secret");
|
|
39744
39754
|
var SESSION_TTL_MS = 8 * 60 * 60 * 1000;
|
|
39745
39755
|
function resolveSessionSecret(cwd) {
|
|
39746
39756
|
const fromEnv = process.env.TS_CLOUD_DASHBOARD_SECRET?.trim();
|
|
39747
39757
|
if (fromEnv)
|
|
39748
39758
|
return fromEnv;
|
|
39749
|
-
const file =
|
|
39759
|
+
const file = resolveStatePath(cwd, "dashboard-secret");
|
|
39750
39760
|
try {
|
|
39751
39761
|
if (existsSync18(file)) {
|
|
39752
39762
|
const saved = readFileSync9(file, "utf8").trim();
|
|
@@ -39826,8 +39836,10 @@ function clearSessionCookie(options = { secure: true }) {
|
|
|
39826
39836
|
|
|
39827
39837
|
// src/deploy/dashboard-users.ts
|
|
39828
39838
|
import { chmodSync as chmodSync6, existsSync as existsSync19, mkdirSync as mkdirSync7, readFileSync as readFileSync10, writeFileSync as writeFileSync10 } from "node:fs";
|
|
39829
|
-
import { dirname as dirname8
|
|
39830
|
-
|
|
39839
|
+
import { dirname as dirname8 } from "node:path";
|
|
39840
|
+
function usersFile() {
|
|
39841
|
+
return statePath("dashboard-users.json");
|
|
39842
|
+
}
|
|
39831
39843
|
function isValidUsername(value2) {
|
|
39832
39844
|
return /^[a-z0-9][a-z0-9._-]{1,31}$/i.test(value2);
|
|
39833
39845
|
}
|
|
@@ -39863,7 +39875,7 @@ function parseUsersFile(text2) {
|
|
|
39863
39875
|
}
|
|
39864
39876
|
}
|
|
39865
39877
|
function usersFilePath(cwd) {
|
|
39866
|
-
return
|
|
39878
|
+
return resolveStatePath(cwd, "dashboard-users.json");
|
|
39867
39879
|
}
|
|
39868
39880
|
function loadUsers(cwd) {
|
|
39869
39881
|
const file = usersFilePath(cwd);
|
|
@@ -42355,7 +42367,7 @@ function pruneDashboardTempRoots(root = tmpdir3(), running = isProcessRunning) {
|
|
|
42355
42367
|
for (const entry2 of readdirSync8(root, { withFileTypes: true })) {
|
|
42356
42368
|
if (!entry2.isDirectory() || !entry2.name.startsWith(DASHBOARD_TEMP_PREFIX))
|
|
42357
42369
|
continue;
|
|
42358
|
-
const path =
|
|
42370
|
+
const path = join13(root, entry2.name);
|
|
42359
42371
|
const owned = entry2.name.match(/^ts-cloud-dashboard-(\d+)-/);
|
|
42360
42372
|
if (owned) {
|
|
42361
42373
|
const pid = Number(owned[1]);
|
|
@@ -42531,10 +42543,10 @@ function resolveDashboardEnvironment(available2, fallback, requested) {
|
|
|
42531
42543
|
}
|
|
42532
42544
|
async function loadLocalEnv(cwd) {
|
|
42533
42545
|
const candidates = [
|
|
42534
|
-
|
|
42535
|
-
|
|
42536
|
-
|
|
42537
|
-
|
|
42546
|
+
join13(here, "..", "..", "..", "..", ".env"),
|
|
42547
|
+
join13(cwd, ".env"),
|
|
42548
|
+
join13(cwd, ".env.local"),
|
|
42549
|
+
join13(cwd, ".env.production")
|
|
42538
42550
|
];
|
|
42539
42551
|
for (const file of candidates) {
|
|
42540
42552
|
if (!existsSync20(file))
|
|
@@ -42558,10 +42570,10 @@ async function loadLocalEnv(cwd) {
|
|
|
42558
42570
|
}
|
|
42559
42571
|
function resolveCloudConfigPath(cwd) {
|
|
42560
42572
|
const candidates = [
|
|
42561
|
-
|
|
42562
|
-
|
|
42563
|
-
|
|
42564
|
-
|
|
42573
|
+
join13(cwd, "config", "cloud.ts"),
|
|
42574
|
+
join13(cwd, "config", "cloud.js"),
|
|
42575
|
+
join13(cwd, "cloud.config.ts"),
|
|
42576
|
+
join13(cwd, "cloud.config.js")
|
|
42565
42577
|
];
|
|
42566
42578
|
return candidates.find((file) => existsSync20(file)) ?? null;
|
|
42567
42579
|
}
|
|
@@ -42747,15 +42759,15 @@ async function resolveLiveDashboardData(config6, environment2) {
|
|
|
42747
42759
|
}
|
|
42748
42760
|
function resolveUiSourceDir(cwd) {
|
|
42749
42761
|
const candidates = [
|
|
42750
|
-
|
|
42751
|
-
|
|
42752
|
-
|
|
42753
|
-
|
|
42754
|
-
|
|
42755
|
-
|
|
42762
|
+
join13(cwd, "packages", "ui"),
|
|
42763
|
+
join13(here, "..", "..", "..", "ui"),
|
|
42764
|
+
join13(here, "..", "..", "ui"),
|
|
42765
|
+
join13(here, "..", "ui-src"),
|
|
42766
|
+
join13(here, "..", "..", "ui-src"),
|
|
42767
|
+
join13(here, "..", "..", "dist", "ui-src")
|
|
42756
42768
|
];
|
|
42757
42769
|
for (const dir of candidates) {
|
|
42758
|
-
if (existsSync20(
|
|
42770
|
+
if (existsSync20(join13(dir, "pages")) && existsSync20(join13(dir, "package.json")))
|
|
42759
42771
|
return dir;
|
|
42760
42772
|
}
|
|
42761
42773
|
return null;
|
|
@@ -42766,8 +42778,8 @@ async function buildLiveUi(cwd, data) {
|
|
|
42766
42778
|
return null;
|
|
42767
42779
|
let outDir;
|
|
42768
42780
|
try {
|
|
42769
|
-
outDir = mkdtempSync3(
|
|
42770
|
-
const localStx =
|
|
42781
|
+
outDir = mkdtempSync3(join13(tmpdir3(), `${DASHBOARD_TEMP_PREFIX}${process.pid}-`));
|
|
42782
|
+
const localStx = join13(uiDir, "node_modules", ".bin", "stx");
|
|
42771
42783
|
const cmd = existsSync20(localStx) ? [localStx, "build", "--pages", "pages", "--out", outDir, "--no-sitemap", "--no-cache"] : ["bunx", "--bun", "@stacksjs/stx", "build", "--pages", "pages", "--out", outDir, "--no-sitemap", "--no-cache"];
|
|
42772
42784
|
const proc = Bun.spawn(cmd, {
|
|
42773
42785
|
cwd: uiDir,
|
|
@@ -43037,19 +43049,19 @@ function staticPath(uiRoot, pathname) {
|
|
|
43037
43049
|
const normalized = normalize3(wanted);
|
|
43038
43050
|
if (normalized.startsWith("..") || normalized.includes("/../"))
|
|
43039
43051
|
return null;
|
|
43040
|
-
const base =
|
|
43052
|
+
const base = join13(uiRoot, normalized);
|
|
43041
43053
|
if (existsSync20(base) && !statSync6(base).isDirectory())
|
|
43042
43054
|
return base;
|
|
43043
43055
|
if (!extname3(base) && existsSync20(`${base}.html`))
|
|
43044
43056
|
return `${base}.html`;
|
|
43045
|
-
if (!extname3(base) && existsSync20(
|
|
43046
|
-
return
|
|
43057
|
+
if (!extname3(base) && existsSync20(join13(base, "index.html")))
|
|
43058
|
+
return join13(base, "index.html");
|
|
43047
43059
|
return null;
|
|
43048
43060
|
}
|
|
43049
43061
|
async function serveStatic(uiRoot, pathname) {
|
|
43050
43062
|
const file = staticPath(uiRoot, pathname);
|
|
43051
43063
|
if (!file) {
|
|
43052
|
-
const notFound =
|
|
43064
|
+
const notFound = join13(uiRoot, "404.html");
|
|
43053
43065
|
if (existsSync20(notFound))
|
|
43054
43066
|
return new Response(await readFile2(notFound), {
|
|
43055
43067
|
status: 404,
|
|
@@ -43255,7 +43267,7 @@ async function startLocalDashboardServer(options = {}) {
|
|
|
43255
43267
|
const resolveBackupSource = (policy3) => backupSources[policy3.resourceKind];
|
|
43256
43268
|
const resolveBackupDestination = (destination2) => destination2.provider === "aws_backup" ? undefined : backupDestination;
|
|
43257
43269
|
const volumeStore = new VolumeStore(controlPlane.store);
|
|
43258
|
-
const volumeDrivers = [new DockerNamedVolumeDriver, new ServerPathVolumeDriver(
|
|
43270
|
+
const volumeDrivers = [new DockerNamedVolumeDriver, new ServerPathVolumeDriver(resolveStatePath(cwd, "volumes"))];
|
|
43259
43271
|
const volumeService = new VolumeService(volumeStore, volumeDrivers, operationQueue);
|
|
43260
43272
|
const fleetStore = new FleetStore(controlPlane.store);
|
|
43261
43273
|
const fleetService = new FleetService(fleetStore, [new SshFleetDriver("aws"), new SshFleetDriver("hetzner"), new SshFleetDriver("ssh")], operationQueue);
|
|
@@ -43427,12 +43439,12 @@ async function startLocalDashboardServer(options = {}) {
|
|
|
43427
43439
|
};
|
|
43428
43440
|
await publishStatus("pending", `Preview deployment started for ${String(source.commitSha).slice(0, 12)}`);
|
|
43429
43441
|
}
|
|
43430
|
-
checkoutRoot = mkdtempSync3(
|
|
43442
|
+
checkoutRoot = mkdtempSync3(join13(tmpdir3(), "ts-cloud-queued-source-"));
|
|
43431
43443
|
context.log(`Checking out immutable source commit ${source.commitSha}.`, { stream: "system" });
|
|
43432
43444
|
const cloned = await cloneSourceBinding({
|
|
43433
43445
|
remote,
|
|
43434
43446
|
binding,
|
|
43435
|
-
destination:
|
|
43447
|
+
destination: join13(checkoutRoot, "checkout"),
|
|
43436
43448
|
ref: String(source.branch ?? binding.defaultBranch),
|
|
43437
43449
|
commitSha: String(source.commitSha)
|
|
43438
43450
|
}, { credential: sourceConnections.getCredential(connection.id), deployKey });
|
|
@@ -43607,7 +43619,7 @@ async function startLocalDashboardServer(options = {}) {
|
|
|
43607
43619
|
ts-cloud dashboard: created the first admin.
|
|
43608
43620
|
username: ${bootstrap.generated.username}
|
|
43609
43621
|
password: ${bootstrap.generated.password}
|
|
43610
|
-
Saved (hashed) to .
|
|
43622
|
+
Saved (hashed) to ${usersFile()}. This password is shown once.
|
|
43611
43623
|
`);
|
|
43612
43624
|
}
|
|
43613
43625
|
} else {
|
|
@@ -44300,11 +44312,11 @@ This link expires in one hour and can be used once.`
|
|
|
44300
44312
|
const deployKey = typeof body.source.deployKeyId === "string" ? sourceConnections.getDeployKey(body.source.deployKeyId) : undefined;
|
|
44301
44313
|
if (deployKey && deployKey.connectionId !== connection.id)
|
|
44302
44314
|
throw new Error("Deploy key does not belong to this connection");
|
|
44303
|
-
const temporary = mkdtempSync3(
|
|
44315
|
+
const temporary = mkdtempSync3(join13(tmpdir3(), "ts-cloud-onboarding-git-"));
|
|
44304
44316
|
try {
|
|
44305
44317
|
const cloned = await cloneSourceBinding({
|
|
44306
44318
|
remote: repository.cloneUrl,
|
|
44307
|
-
destination:
|
|
44319
|
+
destination: join13(temporary, "checkout"),
|
|
44308
44320
|
ref: String(body.source.ref ?? repository.defaultBranch),
|
|
44309
44321
|
sparsePaths: Array.isArray(body.source.sparsePaths) ? body.source.sparsePaths.map(String) : undefined,
|
|
44310
44322
|
binding: {
|
|
@@ -48638,4 +48650,4 @@ data: ${JSON.stringify({ cursor: position, at: new Date().toISOString() })}
|
|
|
48638
48650
|
};
|
|
48639
48651
|
return { server, url: `http://${host2}:${server.port}/` };
|
|
48640
48652
|
}
|
|
48641
|
-
export { defaultConfig4 as defaultConfig, getConfig, loadCloudConfig, config5 as config, encodeBase32, decodeBase32, hotp, totp, verifyTotp, matchTotpCounter, totpUri, AUTH_SESSION_IDLE_TTL_MS, AUTH_SESSION_ABSOLUTE_TTL_MS, AUTH_ACTION_TOKEN_TTL_MS, AUTH_MFA_CHALLENGE_TTL_MS, AUTH_OIDC_TRANSACTION_TTL_MS, AuthenticationStore, sendAuthenticationEmail,
|
|
48653
|
+
export { defaultConfig4 as defaultConfig, getConfig, loadCloudConfig, config5 as config, encodeBase32, decodeBase32, hotp, totp, verifyTotp, matchTotpCounter, totpUri, AUTH_SESSION_IDLE_TTL_MS, AUTH_SESSION_ABSOLUTE_TTL_MS, AUTH_ACTION_TOKEN_TTL_MS, AUTH_MFA_CHALLENGE_TTL_MS, AUTH_OIDC_TRANSACTION_TTL_MS, AuthenticationStore, sendAuthenticationEmail, authEncryptionKeyFile, resolveAuthEncryptionKey, sanitizeOidcReturnPath, discoverOidcProvider, beginOidcAuthorization, completeOidcAuthorization, CONTROL_PLANE_SCHEMA_VERSION, controlPlaneMigrations, AUTHORIZATION_CAPABILITIES, roleCapabilities, scopeContains, authorizeOrganization, effectiveCapabilities, OptimisticConcurrencyError, InvalidOperationTransitionError, UnsupportedSchemaVersionError, controlPlaneDatabaseFile, MAX_CONTROL_PLANE_JSON_BYTES, MAX_CONTROL_PLANE_ERROR_BYTES, sanitizeControlPlaneValue, ControlPlaneStore, searchControlPlane, API_TOKEN_DEFAULT_TTL_MS, API_TOKEN_MAX_TTL_MS, API_IDEMPOTENCY_TTL_MS, AutomationIdentityStore, TsCloudApiError, TsCloudClient, parseCompose, exportCompose, diffCompose, listComposeTemplates, getComposeTemplate, renderComposeTemplate, parseComposeCatalog, planComposeTemplateUpgrade, composeProjectName, buildComposeRuntimeCommand, buildComposeScaleCommand, buildComposeLogsCommand, buildComposeShellCommand, QueueCancellationError, QueueTimeoutError, RetryableOperationError, DurableOperationQueue, DurableQueueWorker, PreviewEnvironmentStore, PreviewEnvironmentService, DEPLOYMENT_QUEUE_KINDS, resolveQueuedDeploymentCommand, createDeploymentQueueHandlers, unsupportedVolumeCapabilities, volumeCapabilities, validateMountPath, validateAttachment, VolumeService, createVolumeQueueHandlers, DockerNamedVolumeDriver, ServerPathVolumeDriver, CloudBlockVolumeDriver, VolumeStore, synchronizeComposeVolumes, completeComposeVolumeDeletion, ComposeApplicationStore, ComposeApplicationService, releaseStrategyCapabilities, assertReleaseStrategy, ReleaseStore, ReleaseService, releaseTrafficPlan, activateImmutableRelease, rollbackImmutableRelease, RELEASE_QUEUE_KINDS, createReleaseQueueHandlers, SourceConnectionStore, SourceProviderError, GithubSourceAdapter, GitlabSourceAdapter, BitbucketSourceAdapter, GiteaSourceAdapter, createSourceAdapter, normalizeSourceEvent, processSourceWebhook, webhookEndpoint, discoverGitRefs, cloneSourceBinding, testSourceConnection, syncSourceRepositories, listSourceReferences, reconcileSourceWebhook, removeSourceWebhook, API_VERSION, openApiDocument, ApiServiceError, requestHash, AutomationApiService, createApiV1Handler, SecurityPostureStore, SECRET_PATTERNS, PreDeployScanner, scanForSecrets, formatScanResults, SecurityScannerRunner, SecretFindingScanner, TrivyImageScanner, AwsIamCapabilityScanner, generateCycloneDxSbom, generateImageSbom, attachSbomToRelease, attachVulnerabilitySummary, createReleaseProvenance, attachProvenanceToRelease, verifyArtifactSignature, securityScope, ensureDefaultSecurityPolicies, recordPreDeploySecretScan, recordSkippedSecretScan, recordDashboardHostPosture, productionChangeReview, secureContainerRelease, runtimeId2 as runtimeId, unsupportedCapabilities, capabilities2 as capabilities, normalizeRuntimeStatus, redactRuntimeConfig, ageSeconds, bytes, discoverRuntimeInventory, ecsWorkloads, lambdaWorkloads, parseDockerInspect, dockerWorkloads, DockerDiscoveryAdapter, parseSystemdRecords, systemdWorkloads, SystemdDiscoveryAdapter, EcsRuntimeAdapter, LambdaRuntimeAdapter, createRuntimeAdapters, resolveRuntimeInventory, authorizeRuntimePath, DIAGNOSTIC_PRESETS, RuntimeOperationService, RuntimeStreamRegistry, DEFAULT_TELEMETRY_POLICY, normalizeTelemetryPolicy, telemetryPolicyKey, loadTelemetryPolicy, saveTelemetryPolicy, telemetryEstimatedMonthlyCost, redactTelemetryText, redactTelemetryValue, pathTemplate, telemetryCursor, telemetryPercentile, telemetryBucketLabel, TelemetryStore, AlertStore, AlertEvaluator, isQuietHours, NotificationRouter, HealthCheckRunner, evaluateTelemetryAlertRules, normalizeScheduleExpression, nextScheduleRuns, previewSchedule, jobProviderCapability, renderServerCron, eventBridgeScheduleInput, reconcileJobObservation, desiredState, ServerCronJobAdapter, EventBridgeJobAdapter, JobProviderReconciler, synchronizeConfiguredJobs, JobService, createJobQueueHandlers, JobStore, dataServiceCapabilities, DataServiceStore, connectionGuidance, DataServiceLifecycle, createDataServiceQueueHandlers, AwsRdsDataAdapter, AwsAuroraDataAdapter, AwsElastiCacheDataAdapter, ServerDataAdapter, ContainerDataAdapter, AwsRdsTransport, AwsAuroraTransport, AwsElastiCacheTransport, BunDockerRuntime, DockerDataTransport, EncryptedDataSecretStore, SystemFleetSshTransport, SshFleetDriver, createFleetQueueHandlers, FleetStore, FleetService, zeroCapacity, capacity, PlacementStore, PlacementService, RemoteBuildService, createRemoteBuildQueueHandlers, TransportRemoteBuildDriver, createServerBuildDriver, createEcsBuildDriver, createAsgBuildDriver, RegionStore, RegionService, createRegionQueueHandlers, AwsRegionalDriver, UnavailableRegionalDriver, canonicalJson, manifestDigest, documentDigest, publicKeyFingerprint, verifyUpdateSignature, updateCompatibility, MaintenanceStore, maintenanceWindowOpen, MaintenanceService, createMaintenanceQueueHandlers, TransportPlatformMaintenanceDriver, ControlPlaneCleanupDriver, TransportDisasterRecoveryDriver, collectServerDnsDomains, removeStaleServerAddressRecords, ensureDashboardActor, initializeDashboardControlPlane, synchronizeDashboardUsers, trackDashboardOperation, dashboardPageRoutes, resolveLegacyDashboardRoute, routesForDashboard, deploySite, createStaticApiOriginDependencies, deployStaticApiOrigin, verifyStaticApiOrigin, estimateStaticApiOriginMonthlyCost, createExistingStaticFullStackDependencies, generateExistingStaticFullStackTemplate, deployExistingStaticFullStack, estimateExistingStaticFullStackMonthlyCost, hashContainerContext, createContainerImageDependencies, buildAndPushContainerImage, infraEnvFromOutputs, buildFunctionEnv, deployServerlessApp, redeployServerlessApp, rollbackServerlessApp, setMaintenance, runRemoteCommand, resolveDashboardData, validateBackupDestination, BackupStore, encryptBackup, decryptBackup, backupCredentialStatus, S3BackupDestinationAdapter, BackupCoordinator, createBackupQueueHandlers, AwsDatabaseBackupSource, compressBackup, decompressBackup, BunFilesystemArchiveRuntime, FilesystemBackupSource, LogicalDatabaseBackupSource, BunDockerVolumeRuntime, DockerVolumeBackupSource, ControlPlaneBackupSource, AwsInfrastructureBackupSource, ConfigurationStore, parseDotenv, serializeDotenv, LocalEncryptedConfigurationBackend, AwsSecretsManagerConfigurationBackend, AwsSsmConfigurationBackend, ExternalConfigurationBackend, ConfigurationService, synchronizeConfiguredConfiguration, sanitizeCloudConfig, dashboardActions, resolveDashboardAction, startLocalDashboardServer };
|