@ts-cloud/core 0.16.44 → 0.16.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.
@@ -1,5 +1,12 @@
1
1
  import type { CloudConfig, EnvironmentType, SiteConfig } from '../types';
2
2
  export type CloudProviderName = 'aws' | 'hetzner' | 'ssh';
3
+ /**
4
+ * Everything `cloud.provider` accepts. Fly.io is not a {@link CloudProviderName}:
5
+ * it runs a container image on Machines, so it has no box for a CloudDriver to
6
+ * provision, ship a release to, or reach over SSH, and it deploys through
7
+ * `deployToFly()` instead.
8
+ */
9
+ export type DeployProviderName = CloudProviderName | 'fly';
3
10
  /**
4
11
  * Exhaustive provider map. Provider-specific contract tests key off this type,
5
12
  * so adding a provider without adding its resilience coverage is a type error.
@@ -187,4 +194,4 @@ export interface DeploySiteReleaseResult {
187
194
  * is a per-machine override, not a statement of intent); the Hetzner token
188
195
  * check keeps the behaviour it always had.
189
196
  */
190
- export declare function resolveCloudProvider(config: CloudConfig): CloudProviderName;
197
+ export declare function resolveCloudProvider(config: CloudConfig): DeployProviderName;
package/dist/types.d.ts CHANGED
@@ -9,9 +9,12 @@ export interface CloudProviderConfig {
9
9
  * Raspberry Pi on the LAN, a colocated box, a VM from a provider ts-cloud
10
10
  * has no API driver for). Nothing is created or destroyed on your behalf;
11
11
  * see {@link SshConfig}.
12
+ *
13
+ * `'fly'` runs the app as a container image on Fly.io Machines; there is no
14
+ * box to provision or reach over SSH. See {@link FlyConfig}.
12
15
  * @default 'aws'
13
16
  */
14
- provider?: 'aws' | 'hetzner' | 'ssh';
17
+ provider?: 'aws' | 'hetzner' | 'ssh' | 'fly';
15
18
  /**
16
19
  * Attach this project's sites to a box owned by ANOTHER project instead of
17
20
  * provisioning one. Set to the owner project's `project.slug` (e.g. `'stacks'`);
@@ -170,6 +173,45 @@ export interface SshHostConfig {
170
173
  * redirect a deploy to another machine. Resolution lives in one place:
171
174
  * `resolveSshSettings` in `@stacksjs/ts-cloud` (`drivers/ssh/config.ts`).
172
175
  */
176
+ /**
177
+ * A Fly.io app, run as Machines from a container image.
178
+ *
179
+ * The API token comes from `FLY_API_TOKEN`, never config: it can create and
180
+ * destroy every Machine in the organization.
181
+ */
182
+ export interface FlyConfig {
183
+ /** The Fly app name, unique across Fly.io. Defaults to `<project.slug>-<environment>`. */
184
+ app?: string;
185
+ /** The organization the app is created in. @default 'personal' */
186
+ org?: string;
187
+ /** Regions to run in, one Machine per region per `count`. @default ['iad'] */
188
+ regions?: string[];
189
+ /** Machines per region. @default 1 */
190
+ count?: number;
191
+ /** The port the app listens on inside the Machine. @default 3000 */
192
+ internalPort?: number;
193
+ /** A path answering 200 when the app is up, checked before traffic arrives. @default '/' */
194
+ healthPath?: string;
195
+ /** @default { cpuKind: 'shared', cpus: 1, memoryMb: 512 } */
196
+ vm?: {
197
+ cpuKind?: 'shared' | 'performance';
198
+ cpus?: number;
199
+ memoryMb?: number;
200
+ };
201
+ /**
202
+ * A persistent volume per Machine, for SQLite or uploads. A Fly volume
203
+ * attaches to one Machine, so each Machine gets its own.
204
+ */
205
+ volume?: {
206
+ name?: string;
207
+ sizeGb: number;
208
+ path: string;
209
+ };
210
+ /** Stop idle Machines and start them on the next request. @default false */
211
+ autoStop?: boolean;
212
+ /** Custom hostnames to request certificates for, beside `<app>.fly.dev`. */
213
+ hostnames?: string[];
214
+ }
173
215
  export interface SshConfig {
174
216
  /** The hosts to deploy to. Exactly one host is supported today. Env: `TS_CLOUD_SSH_HOST`. */
175
217
  hosts: SshHostConfig[];
@@ -262,6 +304,11 @@ export interface CloudConfig {
262
304
  * provider.
263
305
  */
264
306
  ssh?: SshConfig;
307
+ /**
308
+ * Fly.io Machines (when cloud.provider is 'fly'): the app runs as a
309
+ * container image, deployed through the Machines API.
310
+ */
311
+ fly?: FlyConfig;
265
312
  /**
266
313
  * Object storage provider selection (AWS S3, Backblaze B2, Hetzner Object Storage).
267
314
  * Independent of `cloud.provider` — you can run compute on AWS while keeping
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ts-cloud/core",
3
3
  "type": "module",
4
- "version": "0.16.44",
4
+ "version": "0.16.46",
5
5
  "description": "Core CloudFormation generation library for ts-cloud",
6
6
  "author": "Chris Breuer <chris@stacksjs.com>",
7
7
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "typecheck": "tsc --noEmit"
32
32
  },
33
33
  "dependencies": {
34
- "@ts-cloud/aws-types": "0.16.44"
34
+ "@ts-cloud/aws-types": "0.16.46"
35
35
  },
36
36
  "devDependencies": {
37
37
  "typescript": "^7.0.2"