@stacksjs/ts-cloud 0.7.44 → 0.7.46
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/aws/index.js +1 -1
- package/dist/bin/cli.js +591 -591
- package/dist/{chunk-v8d5kvf3.js → chunk-3bfv1z4v.js} +12 -2
- package/dist/{chunk-w5vzhhr3.js → chunk-73vcqg6z.js} +2 -2
- package/dist/{chunk-g4ev4092.js → chunk-g34h2wmk.js} +52 -13
- package/dist/{chunk-h4b7p6c8.js → chunk-jp2a8yad.js} +3 -3
- package/dist/deploy/index.js +3 -3
- package/dist/dns/index.js +1 -1
- package/dist/dns/porkbun.d.ts +2 -1
- package/dist/index.js +3 -3
- package/dist/ui/index.html +3 -3
- package/dist/ui/server/actions.html +3 -3
- package/dist/ui/server/backups.html +3 -3
- package/dist/ui/server/database.html +3 -3
- package/dist/ui/server/deployments.html +3 -3
- package/dist/ui/server/firewall.html +3 -3
- package/dist/ui/server/logs.html +3 -3
- package/dist/ui/server/services.html +3 -3
- package/dist/ui/server/sites.html +3 -3
- package/dist/ui/server/ssh-keys.html +3 -3
- package/dist/ui/server/team.html +3 -3
- package/dist/ui/server/terminal.html +3 -3
- package/dist/ui/server/workers.html +3 -3
- package/dist/ui/serverless/alarms.html +3 -3
- package/dist/ui/serverless/assets.html +3 -3
- package/dist/ui/serverless/data.html +3 -3
- package/dist/ui/serverless/deployments.html +3 -3
- package/dist/ui/serverless/functions.html +3 -3
- package/dist/ui/serverless/logs.html +3 -3
- package/dist/ui/serverless/queues.html +3 -3
- package/dist/ui/serverless/scheduler.html +3 -3
- package/dist/ui/serverless/secrets.html +3 -3
- package/dist/ui/serverless/traces.html +3 -3
- package/dist/ui/serverless.html +3 -3
- package/package.json +3 -3
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
// src/dns/porkbun.ts
|
|
8
8
|
var PORKBUN_API_URL = "https://api.porkbun.com/api/json/v3";
|
|
9
9
|
var PORKBUN_MAX_ATTEMPTS = 8;
|
|
10
|
+
var PORKBUN_REQUEST_TIMEOUT_MS = 15000;
|
|
10
11
|
function isRetryablePorkbunResponse(status, message = "") {
|
|
11
12
|
return status === 408 || status === 409 || status === 425 || status === 429 || status >= 500 || /rate limit|temporar|timed? ?out|try again/i.test(message);
|
|
12
13
|
}
|
|
@@ -21,14 +22,20 @@ class PorkbunProvider {
|
|
|
21
22
|
name = "porkbun";
|
|
22
23
|
apiKey;
|
|
23
24
|
secretKey;
|
|
24
|
-
|
|
25
|
+
requestTimeoutMs;
|
|
26
|
+
constructor(apiKey, secretKey, requestTimeoutMs = PORKBUN_REQUEST_TIMEOUT_MS) {
|
|
25
27
|
this.apiKey = apiKey;
|
|
26
28
|
this.secretKey = secretKey;
|
|
29
|
+
this.requestTimeoutMs = requestTimeoutMs;
|
|
27
30
|
}
|
|
28
31
|
async request(endpoint, additionalBody = {}) {
|
|
29
32
|
let lastError;
|
|
30
33
|
for (let attempt = 1;attempt <= PORKBUN_MAX_ATTEMPTS; attempt += 1) {
|
|
31
34
|
let response;
|
|
35
|
+
const controller = new AbortController;
|
|
36
|
+
const timeout = setTimeout(() => {
|
|
37
|
+
controller.abort(new Error(`Porkbun API request timed out after ${this.requestTimeoutMs}ms`));
|
|
38
|
+
}, this.requestTimeoutMs);
|
|
32
39
|
try {
|
|
33
40
|
response = await fetch(`${PORKBUN_API_URL}${endpoint}`, {
|
|
34
41
|
method: "POST",
|
|
@@ -39,7 +46,8 @@ class PorkbunProvider {
|
|
|
39
46
|
apikey: this.apiKey,
|
|
40
47
|
secretapikey: this.secretKey,
|
|
41
48
|
...additionalBody
|
|
42
|
-
})
|
|
49
|
+
}),
|
|
50
|
+
signal: controller.signal
|
|
43
51
|
});
|
|
44
52
|
} catch (error) {
|
|
45
53
|
lastError = error;
|
|
@@ -47,6 +55,8 @@ class PorkbunProvider {
|
|
|
47
55
|
throw error;
|
|
48
56
|
await waitForPorkbunRetry(attempt);
|
|
49
57
|
continue;
|
|
58
|
+
} finally {
|
|
59
|
+
clearTimeout(timeout);
|
|
50
60
|
}
|
|
51
61
|
if (!response.ok) {
|
|
52
62
|
lastError = new Error(`Porkbun API error: ${response.status} ${response.statusText}`);
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
generateStaticSiteTemplate,
|
|
6
6
|
invalidateCache,
|
|
7
7
|
uploadStaticFiles
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-jp2a8yad.js";
|
|
9
9
|
import"./chunk-tjjgajbh.js";
|
|
10
|
-
import"./chunk-
|
|
10
|
+
import"./chunk-3bfv1z4v.js";
|
|
11
11
|
import"./chunk-tnztxpcb.js";
|
|
12
12
|
import"./chunk-qpj3edwz.js";
|
|
13
13
|
import"./chunk-vd87cpvn.js";
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
} from "./chunk-stt1z5cx.js";
|
|
48
48
|
import {
|
|
49
49
|
deployStaticSiteWithExternalDnsFull
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-jp2a8yad.js";
|
|
51
51
|
import {
|
|
52
52
|
CloudFrontClient
|
|
53
53
|
} from "./chunk-tjjgajbh.js";
|
|
@@ -1201,7 +1201,7 @@ async function resolveDashboardData(config, environment) {
|
|
|
1201
1201
|
return out;
|
|
1202
1202
|
}
|
|
1203
1203
|
// src/deploy/local-dashboard-server.ts
|
|
1204
|
-
import { existsSync as existsSync18, statSync as statSync3 } from "node:fs";
|
|
1204
|
+
import { existsSync as existsSync18, rmSync, statSync as statSync3 } from "node:fs";
|
|
1205
1205
|
import { readFile, writeFile as writeFile4 } from "node:fs/promises";
|
|
1206
1206
|
import { mkdtempSync } from "node:fs";
|
|
1207
1207
|
import { tmpdir } from "node:os";
|
|
@@ -12940,8 +12940,9 @@ async function buildLiveUi(cwd, data) {
|
|
|
12940
12940
|
const uiDir = resolveUiSourceDir(cwd);
|
|
12941
12941
|
if (!uiDir)
|
|
12942
12942
|
return null;
|
|
12943
|
+
let outDir;
|
|
12943
12944
|
try {
|
|
12944
|
-
|
|
12945
|
+
outDir = mkdtempSync(join12(tmpdir(), "ts-cloud-dashboard-"));
|
|
12945
12946
|
const localStx = join12(uiDir, "node_modules", ".bin", "stx");
|
|
12946
12947
|
const cmd = existsSync18(localStx) ? [localStx, "build", "--pages", "pages", "--out", outDir, "--no-sitemap", "--no-cache"] : ["bunx", "--bun", "@stacksjs/stx", "build", "--pages", "pages", "--out", outDir, "--no-sitemap", "--no-cache"];
|
|
12947
12948
|
const proc = Bun.spawn(cmd, {
|
|
@@ -12959,6 +12960,7 @@ async function buildLiveUi(cwd, data) {
|
|
|
12959
12960
|
proc.exited
|
|
12960
12961
|
]);
|
|
12961
12962
|
if (exitCode !== 0) {
|
|
12963
|
+
rmSync(outDir, { recursive: true, force: true });
|
|
12962
12964
|
if (process.env.TSCLOUD_DASHBOARD_VERBOSE)
|
|
12963
12965
|
console.warn(`ts-cloud dashboard: live UI build failed; serving the pre-built UI.
|
|
12964
12966
|
${stdout}
|
|
@@ -12967,6 +12969,8 @@ ${stderr}`);
|
|
|
12967
12969
|
}
|
|
12968
12970
|
return outDir;
|
|
12969
12971
|
} catch (err) {
|
|
12972
|
+
if (outDir)
|
|
12973
|
+
rmSync(outDir, { recursive: true, force: true });
|
|
12970
12974
|
if (process.env.TSCLOUD_DASHBOARD_VERBOSE)
|
|
12971
12975
|
console.warn(`ts-cloud dashboard: live UI build errored; serving the pre-built UI. ${err.message}`);
|
|
12972
12976
|
return null;
|
|
@@ -13132,20 +13136,49 @@ async function startLocalDashboardServer(options = {}) {
|
|
|
13132
13136
|
let latestData = initialData;
|
|
13133
13137
|
const packagedUi = resolveUiSource(cwd);
|
|
13134
13138
|
const uiCache = new Map;
|
|
13139
|
+
const uiBuilds = new Map;
|
|
13140
|
+
const ownedUiRoots = new Set;
|
|
13141
|
+
let uiGeneration = 0;
|
|
13142
|
+
function clearUiCache() {
|
|
13143
|
+
uiGeneration += 1;
|
|
13144
|
+
uiCache.clear();
|
|
13145
|
+
for (const root of ownedUiRoots)
|
|
13146
|
+
rmSync(root, { recursive: true, force: true });
|
|
13147
|
+
ownedUiRoots.clear();
|
|
13148
|
+
}
|
|
13135
13149
|
const scopeKey = (user) => user.role === "admin" ? "admin" : `member:${Object.entries(user.sites).sort(([a], [b]) => a.localeCompare(b)).map(([site, role]) => `${site}=${role}`).join(",")}`;
|
|
13136
13150
|
async function uiRootFor(user) {
|
|
13137
13151
|
const key = scopeKey(user);
|
|
13138
13152
|
const cached = uiCache.get(key);
|
|
13139
13153
|
if (cached)
|
|
13140
13154
|
return cached;
|
|
13141
|
-
const
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
const
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13155
|
+
const pending = uiBuilds.get(key);
|
|
13156
|
+
if (pending)
|
|
13157
|
+
return pending;
|
|
13158
|
+
const generation = uiGeneration;
|
|
13159
|
+
const build = (async () => {
|
|
13160
|
+
const scoped = {
|
|
13161
|
+
...scopeDashboardData(latestData, { user, slug: config6.project.slug }),
|
|
13162
|
+
viewer: { role: user.role }
|
|
13163
|
+
};
|
|
13164
|
+
const liveRoot = await buildLiveUi(cwd, scoped);
|
|
13165
|
+
if (liveRoot && generation !== uiGeneration) {
|
|
13166
|
+
rmSync(liveRoot, { recursive: true, force: true });
|
|
13167
|
+
return packagedUi?.uiRoot;
|
|
13168
|
+
}
|
|
13169
|
+
if (liveRoot)
|
|
13170
|
+
ownedUiRoots.add(liveRoot);
|
|
13171
|
+
const root = liveRoot ?? packagedUi?.uiRoot;
|
|
13172
|
+
if (root)
|
|
13173
|
+
uiCache.set(key, root);
|
|
13174
|
+
return root;
|
|
13175
|
+
})();
|
|
13176
|
+
uiBuilds.set(key, build);
|
|
13177
|
+
try {
|
|
13178
|
+
return await build;
|
|
13179
|
+
} finally {
|
|
13180
|
+
uiBuilds.delete(key);
|
|
13181
|
+
}
|
|
13149
13182
|
}
|
|
13150
13183
|
const adminUiRoot = await uiRootFor({ username: "", passwordHash: "", role: "admin", sites: {} });
|
|
13151
13184
|
if (!adminUiRoot)
|
|
@@ -13288,7 +13321,7 @@ async function startLocalDashboardServer(options = {}) {
|
|
|
13288
13321
|
environment = requested;
|
|
13289
13322
|
actions = dashboardActions(environment);
|
|
13290
13323
|
latestData = await resolveLiveDashboardData(config6, environment);
|
|
13291
|
-
|
|
13324
|
+
clearUiCache();
|
|
13292
13325
|
}
|
|
13293
13326
|
return json({ ok: true, environment, environments: availableEnvironments });
|
|
13294
13327
|
}
|
|
@@ -13560,7 +13593,7 @@ async function startLocalDashboardServer(options = {}) {
|
|
|
13560
13593
|
if (password && password.length < 12)
|
|
13561
13594
|
return json({ ok: false, error: "Password must be at least 12 characters." }, 422);
|
|
13562
13595
|
const result = upsertMember(cwd, { username, password, name: typeof body.name === "string" ? body.name : undefined, sites });
|
|
13563
|
-
|
|
13596
|
+
clearUiCache();
|
|
13564
13597
|
return json({ ok: true, user: describeUser(result.user), password: result.password });
|
|
13565
13598
|
}
|
|
13566
13599
|
if (url.pathname === "/api/users" && req.method === "DELETE") {
|
|
@@ -13714,6 +13747,12 @@ async function startLocalDashboardServer(options = {}) {
|
|
|
13714
13747
|
}
|
|
13715
13748
|
}
|
|
13716
13749
|
});
|
|
13750
|
+
const stop = server.stop.bind(server);
|
|
13751
|
+
server.stop = (closeActiveConnections) => {
|
|
13752
|
+
clearInterval(throttleSweep);
|
|
13753
|
+
clearUiCache();
|
|
13754
|
+
return stop(closeActiveConnections);
|
|
13755
|
+
};
|
|
13717
13756
|
return { server, url: `http://${host}:${server.port}/` };
|
|
13718
13757
|
}
|
|
13719
13758
|
export { defaultConfig4 as defaultConfig, getConfig, loadCloudConfig, config5 as config, collectServerDnsDomains, removeStaleServerAddressRecords, deploySite, infraEnvFromOutputs, buildFunctionEnv, deployServerlessApp, redeployServerlessApp, rollbackServerlessApp, setMaintenance, runRemoteCommand, resolveDashboardData, sanitizeCloudConfig, dashboardActions, resolveDashboardAction, startLocalDashboardServer };
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Route53Provider,
|
|
8
8
|
UnifiedDnsValidator,
|
|
9
9
|
createDnsProvider
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3bfv1z4v.js";
|
|
11
11
|
import {
|
|
12
12
|
Route53Client
|
|
13
13
|
} from "./chunk-tnztxpcb.js";
|
|
@@ -813,7 +813,7 @@ async function deployStaticSiteWithExternalDnsFull(config) {
|
|
|
813
813
|
}
|
|
814
814
|
}
|
|
815
815
|
onProgress?.("upload", "Uploading files to S3...");
|
|
816
|
-
const { uploadStaticFiles } = await import("./chunk-
|
|
816
|
+
const { uploadStaticFiles } = await import("./chunk-73vcqg6z.js");
|
|
817
817
|
const uploadResult = await uploadStaticFiles({
|
|
818
818
|
sourceDir,
|
|
819
819
|
bucket: infraResult.bucket,
|
|
@@ -833,7 +833,7 @@ async function deployStaticSiteWithExternalDnsFull(config) {
|
|
|
833
833
|
}
|
|
834
834
|
if (infraResult.distributionId && uploadResult.uploaded > 0) {
|
|
835
835
|
onProgress?.("invalidate", "Invalidating CloudFront cache...");
|
|
836
|
-
const { invalidateCache } = await import("./chunk-
|
|
836
|
+
const { invalidateCache } = await import("./chunk-73vcqg6z.js");
|
|
837
837
|
await invalidateCache(infraResult.distributionId);
|
|
838
838
|
}
|
|
839
839
|
onProgress?.("complete", "Deployment complete!");
|
package/dist/deploy/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
sanitizeCloudConfig,
|
|
15
15
|
setMaintenance,
|
|
16
16
|
startLocalDashboardServer
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-g34h2wmk.js";
|
|
18
18
|
import {
|
|
19
19
|
buildAndPushServerlessImage
|
|
20
20
|
} from "../chunk-tskj9fay.js";
|
|
@@ -45,9 +45,9 @@ import {
|
|
|
45
45
|
generateStaticSiteTemplate,
|
|
46
46
|
invalidateCache,
|
|
47
47
|
uploadStaticFiles
|
|
48
|
-
} from "../chunk-
|
|
48
|
+
} from "../chunk-jp2a8yad.js";
|
|
49
49
|
import"../chunk-tjjgajbh.js";
|
|
50
|
-
import"../chunk-
|
|
50
|
+
import"../chunk-3bfv1z4v.js";
|
|
51
51
|
import"../chunk-tnztxpcb.js";
|
|
52
52
|
import"../chunk-qpj3edwz.js";
|
|
53
53
|
import"../chunk-vd87cpvn.js";
|
package/dist/dns/index.js
CHANGED
package/dist/dns/porkbun.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export declare class PorkbunProvider implements DnsProvider {
|
|
|
7
7
|
readonly name = "porkbun";
|
|
8
8
|
private apiKey;
|
|
9
9
|
private secretKey;
|
|
10
|
-
|
|
10
|
+
private requestTimeoutMs;
|
|
11
|
+
constructor(apiKey: string, secretKey: string, requestTimeoutMs?: number);
|
|
11
12
|
/**
|
|
12
13
|
* Make an authenticated API request to Porkbun
|
|
13
14
|
*/
|
package/dist/index.js
CHANGED
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
sanitizeCloudConfig,
|
|
58
58
|
setMaintenance,
|
|
59
59
|
startLocalDashboardServer
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-g34h2wmk.js";
|
|
61
61
|
import {
|
|
62
62
|
buildAndPushServerlessImage
|
|
63
63
|
} from "./chunk-tskj9fay.js";
|
|
@@ -528,7 +528,7 @@ import {
|
|
|
528
528
|
generateStaticSiteTemplate,
|
|
529
529
|
invalidateCache,
|
|
530
530
|
uploadStaticFiles
|
|
531
|
-
} from "./chunk-
|
|
531
|
+
} from "./chunk-jp2a8yad.js";
|
|
532
532
|
import {
|
|
533
533
|
CloudFrontClient
|
|
534
534
|
} from "./chunk-tjjgajbh.js";
|
|
@@ -546,7 +546,7 @@ import {
|
|
|
546
546
|
createRoute53Validator,
|
|
547
547
|
detectDnsProvider,
|
|
548
548
|
dnsProviders
|
|
549
|
-
} from "./chunk-
|
|
549
|
+
} from "./chunk-3bfv1z4v.js";
|
|
550
550
|
import {
|
|
551
551
|
Route53Client
|
|
552
552
|
} from "./chunk-tnztxpcb.js";
|