@stacksjs/ts-cloud 0.7.4 → 0.7.6

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.
Files changed (58) hide show
  1. package/dist/aws/index.js +259 -0
  2. package/dist/bin/cli.js +316 -316
  3. package/dist/chunk-0wxyppza.js +146 -0
  4. package/dist/chunk-3knnr7wh.js +601 -0
  5. package/dist/chunk-3rsfns7x.js +10427 -0
  6. package/dist/chunk-93hjhs78.js +1752 -0
  7. package/dist/chunk-arsh1g5h.js +1749 -0
  8. package/dist/chunk-b82pbxyp.js +1572 -0
  9. package/dist/chunk-c6rgvg1j.js +46124 -0
  10. package/dist/chunk-d2p5n2aq.js +23 -0
  11. package/dist/chunk-d7p84vz5.js +1699 -0
  12. package/dist/chunk-dpkk640m.js +4392 -0
  13. package/dist/chunk-eq08r166.js +8 -0
  14. package/dist/chunk-hsk6fe6x.js +371 -0
  15. package/dist/chunk-mj1tmhte.js +13 -0
  16. package/dist/chunk-p6309384.js +12828 -0
  17. package/dist/chunk-pegd7rmf.js +10 -0
  18. package/dist/chunk-pqfzdg68.js +12 -0
  19. package/dist/chunk-qpj3edwz.js +601 -0
  20. package/dist/chunk-tjjgajbh.js +1032 -0
  21. package/dist/chunk-tnztxpcb.js +630 -0
  22. package/dist/chunk-tt4kxske.js +1788 -0
  23. package/dist/chunk-v0bahtg2.js +4 -0
  24. package/dist/chunk-vd87cpvn.js +1754 -0
  25. package/dist/chunk-zn0nxxa8.js +1779 -0
  26. package/dist/deploy/index.js +87 -0
  27. package/dist/dns/index.js +31 -0
  28. package/dist/drivers/hetzner/provision.d.ts +53 -0
  29. package/dist/drivers/index.d.ts +5 -1
  30. package/dist/drivers/index.js +98 -0
  31. package/dist/drivers/shared/remote-exec.d.ts +47 -0
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js +4383 -91358
  34. package/dist/push/index.js +509 -0
  35. package/dist/ui/index.html +3 -3
  36. package/dist/ui/server/actions.html +3 -3
  37. package/dist/ui/server/backups.html +3 -3
  38. package/dist/ui/server/database.html +3 -3
  39. package/dist/ui/server/deployments.html +3 -3
  40. package/dist/ui/server/firewall.html +3 -3
  41. package/dist/ui/server/logs.html +3 -3
  42. package/dist/ui/server/services.html +3 -3
  43. package/dist/ui/server/sites.html +3 -3
  44. package/dist/ui/server/ssh-keys.html +3 -3
  45. package/dist/ui/server/terminal.html +3 -3
  46. package/dist/ui/server/workers.html +3 -3
  47. package/dist/ui/serverless/alarms.html +3 -3
  48. package/dist/ui/serverless/assets.html +3 -3
  49. package/dist/ui/serverless/data.html +3 -3
  50. package/dist/ui/serverless/deployments.html +3 -3
  51. package/dist/ui/serverless/functions.html +3 -3
  52. package/dist/ui/serverless/logs.html +3 -3
  53. package/dist/ui/serverless/queues.html +3 -3
  54. package/dist/ui/serverless/scheduler.html +3 -3
  55. package/dist/ui/serverless/secrets.html +3 -3
  56. package/dist/ui/serverless/traces.html +3 -3
  57. package/dist/ui/serverless.html +3 -3
  58. package/package.json +3 -3
@@ -0,0 +1,87 @@
1
+ import {
2
+ buildFunctionEnv,
3
+ dashboardActions,
4
+ deployServerlessApp,
5
+ deploySite,
6
+ infraEnvFromOutputs,
7
+ redeployServerlessApp,
8
+ resolveDashboardAction,
9
+ resolveDashboardData,
10
+ rollbackServerlessApp,
11
+ runRemoteCommand,
12
+ sanitizeCloudConfig,
13
+ setMaintenance,
14
+ startLocalDashboardServer
15
+ } from "../chunk-p6309384.js";
16
+ import {
17
+ buildAndPushServerlessImage
18
+ } from "../chunk-0wxyppza.js";
19
+ import"../chunk-b82pbxyp.js";
20
+ import"../chunk-hsk6fe6x.js";
21
+ import {
22
+ DASHBOARD_CREDENTIALS_FILE,
23
+ MANAGEMENT_DASHBOARD_SITE,
24
+ buildManagementDashboardArtifact,
25
+ ensureManagementDashboard,
26
+ isPhpSite,
27
+ resolveDashboardAuth,
28
+ resolveSiteDeployTarget,
29
+ resolveSiteKind,
30
+ resolveUiSource,
31
+ validateDeploymentConfig
32
+ } from "../chunk-dpkk640m.js";
33
+ import"../chunk-c6rgvg1j.js";
34
+ import"../chunk-93hjhs78.js";
35
+ import {
36
+ deleteStaticSite,
37
+ deployStaticSite,
38
+ deployStaticSiteFull,
39
+ deployStaticSiteWithExternalDns,
40
+ deployStaticSiteWithExternalDnsFull,
41
+ generateExternalDnsStaticSiteTemplate,
42
+ generateStaticSiteTemplate,
43
+ invalidateCache,
44
+ uploadStaticFiles
45
+ } from "../chunk-d7p84vz5.js";
46
+ import"../chunk-tjjgajbh.js";
47
+ import"../chunk-tt4kxske.js";
48
+ import"../chunk-tnztxpcb.js";
49
+ import"../chunk-qpj3edwz.js";
50
+ import"../chunk-vd87cpvn.js";
51
+ import"../chunk-arsh1g5h.js";
52
+ import"../chunk-v0bahtg2.js";
53
+ export {
54
+ validateDeploymentConfig,
55
+ uploadStaticFiles,
56
+ startLocalDashboardServer,
57
+ setMaintenance,
58
+ sanitizeCloudConfig,
59
+ runRemoteCommand,
60
+ rollbackServerlessApp,
61
+ resolveUiSource,
62
+ resolveSiteKind,
63
+ resolveSiteDeployTarget,
64
+ resolveDashboardData,
65
+ resolveDashboardAuth,
66
+ resolveDashboardAction,
67
+ redeployServerlessApp,
68
+ isPhpSite,
69
+ invalidateCache,
70
+ infraEnvFromOutputs,
71
+ generateStaticSiteTemplate,
72
+ generateExternalDnsStaticSiteTemplate,
73
+ ensureManagementDashboard,
74
+ deployStaticSiteWithExternalDnsFull,
75
+ deployStaticSiteWithExternalDns,
76
+ deployStaticSiteFull,
77
+ deployStaticSite,
78
+ deploySite,
79
+ deployServerlessApp,
80
+ deleteStaticSite,
81
+ dashboardActions,
82
+ buildManagementDashboardArtifact,
83
+ buildFunctionEnv,
84
+ buildAndPushServerlessImage,
85
+ MANAGEMENT_DASHBOARD_SITE,
86
+ DASHBOARD_CREDENTIALS_FILE
87
+ };
@@ -0,0 +1,31 @@
1
+ import {
2
+ CloudflareProvider,
3
+ DnsProviderFactory,
4
+ GoDaddyProvider,
5
+ PorkbunProvider,
6
+ Route53Provider,
7
+ UnifiedDnsValidator,
8
+ createDnsProvider,
9
+ createGoDaddyValidator,
10
+ createPorkbunValidator,
11
+ createRoute53Validator,
12
+ detectDnsProvider,
13
+ dnsProviders
14
+ } from "../chunk-tt4kxske.js";
15
+ import"../chunk-tnztxpcb.js";
16
+ import"../chunk-arsh1g5h.js";
17
+ import"../chunk-v0bahtg2.js";
18
+ export {
19
+ dnsProviders,
20
+ detectDnsProvider,
21
+ createRoute53Validator,
22
+ createPorkbunValidator,
23
+ createGoDaddyValidator,
24
+ createDnsProvider,
25
+ UnifiedDnsValidator,
26
+ Route53Provider,
27
+ PorkbunProvider,
28
+ GoDaddyProvider,
29
+ DnsProviderFactory,
30
+ CloudflareProvider
31
+ };
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Idempotent find-or-create provisioning helpers on top of the Hetzner client.
3
+ *
4
+ * These are the building blocks for "deploy X onto a Hetzner box" scripts:
5
+ * each helper reuses an existing resource when one matches (by name, or by
6
+ * key body for SSH keys) and creates it otherwise, so re-running a deploy
7
+ * converges instead of failing on duplicates.
8
+ */
9
+ import type { CreateServerOptions, HetznerClient, HetznerFirewallRule, HetznerServer } from './client';
10
+ export interface EnsuredResource {
11
+ id: number;
12
+ name: string;
13
+ created: boolean;
14
+ }
15
+ export interface EnsureSshKeyOptions {
16
+ /** Name used if the key needs to be registered. */
17
+ name: string;
18
+ /** OpenSSH public key (`<type> <base64> [comment]`). */
19
+ publicKey: string;
20
+ labels?: Record<string, string>;
21
+ }
22
+ /**
23
+ * Register an SSH public key, reusing any already-registered key with the
24
+ * same body (comment/whitespace differences ignored) regardless of its name.
25
+ */
26
+ export declare function ensureSshKey(client: HetznerClient, options: EnsureSshKeyOptions): Promise<EnsuredResource>;
27
+ export interface EnsureFirewallOptions {
28
+ name: string;
29
+ rules: HetznerFirewallRule[];
30
+ labels?: Record<string, string>;
31
+ }
32
+ /**
33
+ * Find a firewall by name and sync its rules to the given set, or create it.
34
+ * Rules are replaced in-place on reuse so the firewall always matches the
35
+ * declared config.
36
+ */
37
+ export declare function ensureFirewall(client: HetznerClient, options: EnsureFirewallOptions): Promise<EnsuredResource>;
38
+ export interface EnsureServerOptions extends CreateServerOptions {
39
+ /** Wait until the (created or reused) server reaches `running`. @default true */
40
+ waitForRunning?: boolean;
41
+ }
42
+ export interface EnsuredServer {
43
+ server: HetznerServer;
44
+ created: boolean;
45
+ }
46
+ /**
47
+ * Find a server by name or create it, waiting until it is running by default.
48
+ * Creation options (`userData`, `sshKeys`, `firewalls`, ...) only apply when
49
+ * the server does not exist yet — an existing server is reused as-is.
50
+ */
51
+ export declare function ensureServer(client: HetznerClient, options: EnsureServerOptions): Promise<EnsuredServer>;
52
+ /** The public IPv4 of a server, throwing when it has none. */
53
+ export declare function serverPublicIpv4(server: HetznerServer): string;
@@ -2,8 +2,12 @@ export * from './factory';
2
2
  export { AwsDriver } from './aws/driver';
3
3
  export { HetznerDriver } from './hetzner/driver';
4
4
  export { isBoxMode, LocalBoxDriver } from './local-box/driver';
5
- export { HetznerClient, resolveHetznerApiToken } from './hetzner/client';
5
+ export { HetznerClient, normalizeSshPublicKey, resolveHetznerApiToken } from './hetzner/client';
6
6
  export { generateUbuntuAppCloudInit, wrapCloudInitUserData } from './hetzner/cloud-init';
7
+ export { ensureFirewall, ensureServer, ensureSshKey, serverPublicIpv4 } from './hetzner/provision';
8
+ export type { EnsuredResource, EnsuredServer, EnsureFirewallOptions, EnsureServerOptions, EnsureSshKeyOptions, } from './hetzner/provision';
9
+ export { buildSshArgs, scpUpload, sshExec, sshExecOrThrow, waitForCloudInit, waitForSsh } from './shared/remote-exec';
10
+ export type { RemoteExecOptions, RemoteExecResult, WaitOptions } from './shared/remote-exec';
7
11
  export { buildAwsArtifactFetch, buildLocalArtifactFetch, buildSiteDeployScript, buildStaticSiteDeployScript, resolveExecStart, } from './shared/deploy-script';
8
12
  export { deployAllComputeSites, deploySiteRelease, reloadRpxGateway } from './shared/compute-deploy';
9
13
  export { buildRpxConfig, buildRpxLbConfig, buildRpxProvisionScript, deriveRouteId, normalizeRoutePath, renderRpxLauncher, DEFAULT_RPX_CERTS_DIR, RPX_DIR, RPX_LAUNCHER_PATH, RPX_SERVICE_NAME, } from './shared/rpx-gateway';
@@ -0,0 +1,98 @@
1
+ import {
2
+ AwsDriver,
3
+ CloudDriverFactory,
4
+ DEFAULT_RPX_CERTS_DIR,
5
+ HetznerClient,
6
+ HetznerDriver,
7
+ LocalBoxDriver,
8
+ MANAGED_CACHE_POLICY_DISABLED,
9
+ MANAGED_CACHE_POLICY_OPTIMIZED,
10
+ MANAGED_ORIGIN_REQUEST_POLICY_ALL_VIEWER,
11
+ RPX_DIR,
12
+ RPX_LAUNCHER_PATH,
13
+ RPX_SERVICE_NAME,
14
+ buildAwsArtifactFetch,
15
+ buildCloudFrontOriginConfig,
16
+ buildLocalArtifactFetch,
17
+ buildRpxConfig,
18
+ buildRpxLbConfig,
19
+ buildRpxProvisionScript,
20
+ buildSiteDeployScript,
21
+ buildSshArgs,
22
+ buildStaticSiteDeployScript,
23
+ buildUbuntuBootstrapScript,
24
+ cloudDrivers,
25
+ createCloudDriver,
26
+ deployAllComputeSites,
27
+ deploySiteRelease,
28
+ deriveRouteId,
29
+ ensureFirewall,
30
+ ensureServer,
31
+ ensureSshKey,
32
+ isBoxMode,
33
+ normalizeRoutePath,
34
+ normalizeSshPublicKey,
35
+ reloadRpxGateway,
36
+ renderRpxLauncher,
37
+ resolveExecStart,
38
+ resolveHetznerApiToken,
39
+ scpUpload,
40
+ serverPublicIpv4,
41
+ sshExec,
42
+ sshExecOrThrow,
43
+ waitForCloudInit,
44
+ waitForSsh,
45
+ wrapCloudInitUserData
46
+ } from "../chunk-dpkk640m.js";
47
+ import"../chunk-c6rgvg1j.js";
48
+ import"../chunk-93hjhs78.js";
49
+ import"../chunk-qpj3edwz.js";
50
+ import"../chunk-vd87cpvn.js";
51
+ import"../chunk-arsh1g5h.js";
52
+ import"../chunk-v0bahtg2.js";
53
+ export {
54
+ wrapCloudInitUserData,
55
+ waitForSsh,
56
+ waitForCloudInit,
57
+ sshExecOrThrow,
58
+ sshExec,
59
+ serverPublicIpv4,
60
+ scpUpload,
61
+ resolveHetznerApiToken,
62
+ resolveExecStart,
63
+ renderRpxLauncher,
64
+ reloadRpxGateway,
65
+ normalizeSshPublicKey,
66
+ normalizeRoutePath,
67
+ isBoxMode,
68
+ buildUbuntuBootstrapScript as generateUbuntuAppCloudInit,
69
+ ensureSshKey,
70
+ ensureServer,
71
+ ensureFirewall,
72
+ deriveRouteId,
73
+ deploySiteRelease,
74
+ deployAllComputeSites,
75
+ createCloudDriver,
76
+ cloudDrivers,
77
+ buildStaticSiteDeployScript,
78
+ buildSshArgs,
79
+ buildSiteDeployScript,
80
+ buildRpxProvisionScript,
81
+ buildRpxLbConfig,
82
+ buildRpxConfig,
83
+ buildLocalArtifactFetch,
84
+ buildCloudFrontOriginConfig,
85
+ buildAwsArtifactFetch,
86
+ RPX_SERVICE_NAME,
87
+ RPX_LAUNCHER_PATH,
88
+ RPX_DIR,
89
+ MANAGED_ORIGIN_REQUEST_POLICY_ALL_VIEWER,
90
+ MANAGED_CACHE_POLICY_OPTIMIZED,
91
+ MANAGED_CACHE_POLICY_DISABLED,
92
+ LocalBoxDriver,
93
+ HetznerDriver,
94
+ HetznerClient,
95
+ DEFAULT_RPX_CERTS_DIR,
96
+ CloudDriverFactory,
97
+ AwsDriver
98
+ };
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Minimal SSH/scp helpers for driving a freshly-provisioned box from a deploy
3
+ * script, plus wait loops for the boot milestones every provider shares
4
+ * (sshd accepting connections, cloud-init finished).
5
+ *
6
+ * Uses the system `ssh`/`scp` binaries via Bun.spawn — no keys or agents are
7
+ * managed here; pass `identityFile` or rely on the ambient SSH config.
8
+ */
9
+ export interface RemoteExecOptions {
10
+ /** SSH user. @default 'root' */
11
+ user?: string;
12
+ /** Private key passed as `ssh -i`. Omit to use the ambient SSH config/agent. */
13
+ identityFile?: string;
14
+ /** SSH `ConnectTimeout` in seconds. @default 10 */
15
+ connectTimeoutSec?: number;
16
+ }
17
+ export interface RemoteExecResult {
18
+ code: number;
19
+ stdout: string;
20
+ stderr: string;
21
+ }
22
+ /**
23
+ * The ssh/scp CLI arguments implied by {@link RemoteExecOptions}. Host key
24
+ * checking is disabled because these helpers target freshly-created servers
25
+ * whose host keys cannot be known in advance.
26
+ */
27
+ export declare function buildSshArgs(options?: RemoteExecOptions): string[];
28
+ /** Run a command on the host over SSH, capturing exit code and output. */
29
+ export declare function sshExec(host: string, command: string, options?: RemoteExecOptions): Promise<RemoteExecResult>;
30
+ /** Like {@link sshExec}, but throws on non-zero exit and returns stdout. */
31
+ export declare function sshExecOrThrow(host: string, command: string, options?: RemoteExecOptions): Promise<string>;
32
+ /** Copy local files into a directory on the host via scp. */
33
+ export declare function scpUpload(host: string, localPaths: string[], remoteDir: string, options?: RemoteExecOptions): Promise<void>;
34
+ export interface WaitOptions extends RemoteExecOptions {
35
+ /** Give up after this long. */
36
+ timeoutMs?: number;
37
+ /** Delay between attempts. @default 5000 */
38
+ pollIntervalMs?: number;
39
+ }
40
+ /** Poll until sshd accepts the connection (box booted + key authorized). */
41
+ export declare function waitForSsh(host: string, options?: WaitOptions): Promise<void>;
42
+ /**
43
+ * Poll `cloud-init status` until it reports done. Throws when cloud-init
44
+ * reports an error so a broken first boot fails the deploy instead of
45
+ * surfacing later as missing packages.
46
+ */
47
+ export declare function waitForCloudInit(host: string, options?: WaitOptions): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export type { MigrateEndpoint, MigrateError, MigrateOptions, MigratePlanItem, Mi
11
11
  export * from './ssl';
12
12
  export { deployStaticSite, deployStaticSiteFull, uploadStaticFiles, invalidateCache, deleteStaticSite, generateStaticSiteTemplate, deployStaticSiteWithExternalDns, deployStaticSiteWithExternalDnsFull, generateExternalDnsStaticSiteTemplate, deploySite, resolveSiteDeployTarget, resolveSiteKind, validateDeploymentConfig, buildAndPushServerlessImage, buildFunctionEnv, deployServerlessApp, infraEnvFromOutputs, redeployServerlessApp, rollbackServerlessApp, runRemoteCommand, setMaintenance, buildManagementDashboardArtifact, DASHBOARD_CREDENTIALS_FILE, ensureManagementDashboard, MANAGEMENT_DASHBOARD_SITE, resolveDashboardAuth, resolveUiSource, } from './deploy';
13
13
  export type { EnsureDashboardLogger, ResolvedDashboardAuth, StaticSiteConfig, DeployResult, UploadOptions, ExternalDnsStaticSiteConfig, ExternalDnsDeployResult, DeploySiteConfig, DeploySiteResult, StaticSiteDnsProvider, SiteDeployKind, DeploymentValidationResult, BuildImageOptions, BuiltImage, CodeSource, DeployServerlessOptions, ResolvedContext, } from './deploy';
14
- export { createCloudDriver, CloudDriverFactory, cloudDrivers, AwsDriver, HetznerDriver, HetznerClient, resolveHetznerApiToken, generateUbuntuAppCloudInit, wrapCloudInitUserData, buildSiteDeployScript, buildStaticSiteDeployScript, resolveExecStart, deployAllComputeSites, deploySiteRelease, } from './drivers';
14
+ export { createCloudDriver, CloudDriverFactory, cloudDrivers, AwsDriver, HetznerDriver, HetznerClient, resolveHetznerApiToken, normalizeSshPublicKey, ensureFirewall, ensureServer, ensureSshKey, serverPublicIpv4, sshExec, sshExecOrThrow, scpUpload, waitForSsh, waitForCloudInit, buildSshArgs, generateUbuntuAppCloudInit, wrapCloudInitUserData, buildSiteDeployScript, buildStaticSiteDeployScript, resolveExecStart, deployAllComputeSites, deploySiteRelease, } from './drivers';
15
15
  export type { CreateCloudDriverOptions } from './drivers/factory';
16
16
  export { dashboardActions, resolveDashboardAction, sanitizeCloudConfig, startLocalDashboardServer, } from './deploy/local-dashboard-server';
17
17
  export type { DashboardAction, LocalDashboardServer, LocalDashboardServerOptions, } from './deploy/local-dashboard-server';