@intentius/chant-lexicon-fly 0.124.31 → 0.124.33
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/codegen/docs-cli.js +6 -0
- package/dist/codegen/docs.js +143 -0
- package/dist/codegen/generate-cli.js +26 -0
- package/dist/codegen/generate-lexicon.js +38 -0
- package/dist/codegen/generate-typescript.js +45 -0
- package/dist/codegen/generate.js +82 -0
- package/dist/codegen/naming.js +33 -0
- package/dist/codegen/package.js +35 -0
- package/dist/components/capability-plugin.js +26 -0
- package/dist/components/fly-release.js +335 -0
- package/dist/components/index.js +10 -0
- package/dist/components/run-agent.js +133 -0
- package/dist/composites/catalog.js +176 -0
- package/dist/composites/fly-deploy.js +91 -0
- package/dist/composites/fly-otel-collector.js +66 -0
- package/dist/composites/fly-site.js +80 -0
- package/dist/coverage.js +29 -0
- package/dist/describe-resources.js +443 -0
- package/dist/detect.js +63 -0
- package/dist/export-resources.js +81 -0
- package/dist/generated/index.js +44 -0
- package/dist/generated/runtime.js +4 -0
- package/dist/import/generator.js +208 -0
- package/dist/import/live-export.js +81 -0
- package/dist/import/parser.js +157 -0
- package/dist/index.js +40 -0
- package/dist/integrity.json +3 -3
- package/dist/lint/audit-catalog.js +28 -0
- package/dist/lint/audit-lineage.js +5 -0
- package/dist/lint/post-synth/fly-helpers.js +24 -0
- package/dist/lint/post-synth/fly010-machine-requires-image.js +33 -0
- package/dist/lint/post-synth/fly011-mount-references-declared-volume.js +58 -0
- package/dist/lint/post-synth/index.js +6 -0
- package/dist/lint/rules/guest-sizing.js +92 -0
- package/dist/lint/rules/index.js +12 -0
- package/dist/lint/rules/no-secret-literals.js +58 -0
- package/dist/lint/rules/valid-region.js +52 -0
- package/dist/lsp/completions.js +12 -0
- package/dist/lsp/hover.js +12 -0
- package/dist/manifest.json +1 -1
- package/dist/mcp/context-tools.js +113 -0
- package/dist/okf/types/Machine.md +1 -1
- package/dist/op/activities/box-services.js +88 -0
- package/dist/op/activities/emulator-images.js +32 -0
- package/dist/op/activities/flaps.js +34 -0
- package/dist/op/activities/fly-apply.js +911 -0
- package/dist/op/activities/fly-release-step.js +21 -0
- package/dist/op/activities/fly-rollback-step.js +22 -0
- package/dist/op/activities/index.js +53 -0
- package/dist/op/activities/machine-release.js +236 -0
- package/dist/op/activities/machines-contract.js +81 -0
- package/dist/op/activities/machines-fake.js +203 -0
- package/dist/op/activities/machines-local-cli.js +85 -0
- package/dist/op/activities/machines-local.js +395 -0
- package/dist/op/activities/progress.js +10 -0
- package/dist/op/activities/sprite-config.js +409 -0
- package/dist/op/activities/sprite-fs.js +131 -0
- package/dist/op/activities/sprite-service-converge.js +224 -0
- package/dist/op/activities/sprite-services.js +174 -0
- package/dist/op/activities/sprite-tasks.js +57 -0
- package/dist/op/activities/sprites-contract.js +87 -0
- package/dist/op/activities/sprites-emulator.js +72 -0
- package/dist/op/activities/sprites-fake.js +547 -0
- package/dist/op/activities/sprites.js +515 -0
- package/dist/op/activity-contracts.js +82 -0
- package/dist/op/builders.js +157 -0
- package/dist/ownership.js +29 -0
- package/dist/package-cli.js +20 -0
- package/dist/plugin.js +298 -0
- package/dist/pseudo.js +26 -0
- package/dist/reference-catalog.js +37 -0
- package/dist/release-metadata.js +59 -0
- package/dist/release-store.js +46 -0
- package/dist/serializer.js +299 -0
- package/dist/spec/fetch.js +32 -0
- package/dist/spec/parse.js +260 -0
- package/dist/teardown.js +194 -0
- package/dist/types/index.d.ts +33 -2
- package/dist/validate-cli.js +4 -0
- package/dist/validate.js +33 -0
- package/package.json +11 -11
- package/src/codegen/package.ts +2 -2
- package/src/generated/index.d.ts +33 -2
package/dist/teardown.js
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Env teardown for the fly lexicon (chant #1222) — both halves of the
|
|
3
|
+
* `teardownOwned` / `executeTeardown` capability pair, over the applier's own
|
|
4
|
+
* flaps primitives (op/activities/fly-apply.ts).
|
|
5
|
+
*
|
|
6
|
+
* Selection follows the two-tier ownership convention (#743, D2):
|
|
7
|
+
*
|
|
8
|
+
* - Machines carry the primary marker in `config.metadata`
|
|
9
|
+
* (`managed-by: chant` + `chant-stack` + `chant-env`), so a machine is a
|
|
10
|
+
* candidate exactly when its own metadata reads back the requested
|
|
11
|
+
* stack + env identity.
|
|
12
|
+
* - The app is the boundary for everything metadata-less (volumes, IPs,
|
|
13
|
+
* certificates, secrets). An app becomes a candidate only when it has at
|
|
14
|
+
* least one machine and EVERY machine in it carries the requested
|
|
15
|
+
* identity — an app also hosting a foreign or other-env machine is never
|
|
16
|
+
* deleted whole; only its matching machines are.
|
|
17
|
+
*
|
|
18
|
+
* Enumeration lists apps via `GET /v1/apps` (mudflaps serves it as-is; real
|
|
19
|
+
* flaps wants `?org_slug=`, appended from FLY_ORG / FLY_ORG_SLUG when set)
|
|
20
|
+
* and each app's machines. An unlistable app is a hole (#1089) — unknown,
|
|
21
|
+
* never absent.
|
|
22
|
+
*
|
|
23
|
+
* Execution deletes machines first (lease → destroy → wait, the applier's
|
|
24
|
+
* `destroyMachine`) and apps last (`deleteApp`, which takes the app-scoped
|
|
25
|
+
* volumes/IPs/certs with it). Before every delete the live side is re-read
|
|
26
|
+
* and the identity re-verified; already-gone is `deleted` (teardown is
|
|
27
|
+
* idempotent), an identity mismatch is `not-prunable`, never a delete.
|
|
28
|
+
*/
|
|
29
|
+
import { readOwnership } from "@intentius/chant/ownership";
|
|
30
|
+
import { FLY_METADATA_OWNERSHIP_KEYS } from "./ownership.js";
|
|
31
|
+
import { resolveEndpoint, defaultFlyHttp, listMachines, destroyMachine, deleteApp, } from "./op/activities/fly-apply.js";
|
|
32
|
+
const APP_TYPE = "Fly::Machines::App";
|
|
33
|
+
const MACHINE_TYPE = "Fly::Machines::Machine";
|
|
34
|
+
/** Live machine states that mean the machine is gone or on its way out. */
|
|
35
|
+
const TERMINAL_STATES = new Set(["destroyed", "destroying"]);
|
|
36
|
+
/** True when a machine's own metadata reads back exactly the requested identity. */
|
|
37
|
+
function matchesMarker(machine, marker) {
|
|
38
|
+
const read = readOwnership(machine.config?.metadata, FLY_METADATA_OWNERSHIP_KEYS);
|
|
39
|
+
return read !== undefined && read.stack === marker.stack && read.env === marker.env;
|
|
40
|
+
}
|
|
41
|
+
/** Machines that are actually live — terminal ones are already gone. */
|
|
42
|
+
function liveMachines(machines) {
|
|
43
|
+
return machines.filter((m) => !TERMINAL_STATES.has(m.state));
|
|
44
|
+
}
|
|
45
|
+
/** `GET /v1/apps`, with `?org_slug=` appended when the env names an org. */
|
|
46
|
+
async function listApps(ctx, http, signal) {
|
|
47
|
+
const org = process.env.FLY_ORG || process.env.FLY_ORG_SLUG;
|
|
48
|
+
const url = `${ctx.base}/v1/apps${org ? `?org_slug=${encodeURIComponent(org)}` : ""}`;
|
|
49
|
+
const res = await http("GET", url, undefined, undefined, signal);
|
|
50
|
+
if (res.status >= 300)
|
|
51
|
+
throw new Error(`app list failed (${res.status}): ${res.text}`);
|
|
52
|
+
const body = JSON.parse(res.text);
|
|
53
|
+
return (body.apps ?? []).map((a) => a.name).filter((n) => typeof n === "string" && n.length > 0);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Enumerate the env's marker-matching machines and whole-app boundaries — the
|
|
57
|
+
* fly half of `chant lifecycle teardown <env>` planning.
|
|
58
|
+
*/
|
|
59
|
+
export async function teardownOwned(options, deps = {}) {
|
|
60
|
+
const http = deps.http ?? defaultFlyHttp();
|
|
61
|
+
const ctx = { base: resolveEndpoint({ ...(deps.endpoint ? { endpoint: deps.endpoint } : {}) }) };
|
|
62
|
+
const candidates = [];
|
|
63
|
+
const holes = [];
|
|
64
|
+
const apps = await listApps(ctx, http); // a failed app list throws — core turns it into a whole-lexicon hole
|
|
65
|
+
for (const app of apps) {
|
|
66
|
+
let machines;
|
|
67
|
+
try {
|
|
68
|
+
machines = liveMachines(await listMachines(ctx, app, http));
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
holes.push({
|
|
72
|
+
name: app,
|
|
73
|
+
type: APP_TYPE,
|
|
74
|
+
reason: "read-failed",
|
|
75
|
+
detail: err instanceof Error ? err.message : String(err),
|
|
76
|
+
});
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const matching = machines.filter((m) => matchesMarker(m, options.marker));
|
|
80
|
+
for (const m of matching) {
|
|
81
|
+
candidates.push({
|
|
82
|
+
name: `${app}/${m.name}`,
|
|
83
|
+
type: MACHINE_TYPE,
|
|
84
|
+
physicalId: m.id,
|
|
85
|
+
marker: readOwnership(m.config?.metadata, FLY_METADATA_OWNERSHIP_KEYS),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// The app boundary: whole-app delete only when every live machine carries
|
|
89
|
+
// the requested identity. Its marker is read back off its machines — the
|
|
90
|
+
// only channel an app has (#743).
|
|
91
|
+
if (machines.length > 0 && matching.length === machines.length) {
|
|
92
|
+
candidates.push({
|
|
93
|
+
name: app,
|
|
94
|
+
type: APP_TYPE,
|
|
95
|
+
marker: readOwnership(matching[0].config?.metadata, FLY_METADATA_OWNERSHIP_KEYS),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return { candidates, ...(holes.length > 0 ? { holes } : {}) };
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Delete the handed-over candidates: machines first, apps last. One outcome
|
|
103
|
+
* per candidate, always.
|
|
104
|
+
*/
|
|
105
|
+
export async function executeTeardown(options, deps = {}) {
|
|
106
|
+
const http = deps.http ?? defaultFlyHttp();
|
|
107
|
+
const ctx = { base: resolveEndpoint({ ...(deps.endpoint ? { endpoint: deps.endpoint } : {}) }) };
|
|
108
|
+
const outcomes = [];
|
|
109
|
+
for (const candidate of options.candidates.filter((c) => c.type === MACHINE_TYPE)) {
|
|
110
|
+
outcomes.push(await destroyMachineCandidate(ctx, candidate, options.marker, http, deps.wait));
|
|
111
|
+
}
|
|
112
|
+
for (const candidate of options.candidates.filter((c) => c.type === APP_TYPE)) {
|
|
113
|
+
outcomes.push(await deleteAppCandidate(ctx, candidate, options.marker, http));
|
|
114
|
+
}
|
|
115
|
+
for (const candidate of options.candidates) {
|
|
116
|
+
if (candidate.type === MACHINE_TYPE || candidate.type === APP_TYPE)
|
|
117
|
+
continue;
|
|
118
|
+
outcomes.push({
|
|
119
|
+
name: candidate.name,
|
|
120
|
+
type: candidate.type,
|
|
121
|
+
outcome: "not-prunable",
|
|
122
|
+
detail: `fly teardown deletes machines and apps; ${candidate.type} is app-scoped and goes with its app`,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return { outcomes };
|
|
126
|
+
}
|
|
127
|
+
async function destroyMachineCandidate(ctx, candidate, marker, http, wait) {
|
|
128
|
+
const base = {
|
|
129
|
+
name: candidate.name,
|
|
130
|
+
type: candidate.type,
|
|
131
|
+
...(candidate.physicalId ? { physicalId: candidate.physicalId } : {}),
|
|
132
|
+
};
|
|
133
|
+
const slash = candidate.name.indexOf("/");
|
|
134
|
+
if (slash <= 0) {
|
|
135
|
+
return { ...base, outcome: "not-prunable", detail: "machine candidate name is not app/machine-shaped" };
|
|
136
|
+
}
|
|
137
|
+
const app = candidate.name.slice(0, slash);
|
|
138
|
+
const machineName = candidate.name.slice(slash + 1);
|
|
139
|
+
let machines;
|
|
140
|
+
try {
|
|
141
|
+
machines = await listMachines(ctx, app, http);
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
return { ...base, outcome: "failed", detail: err instanceof Error ? err.message : String(err) };
|
|
145
|
+
}
|
|
146
|
+
const live = liveMachines(machines).find((m) => candidate.physicalId ? m.id === candidate.physicalId : m.name === machineName);
|
|
147
|
+
if (!live) {
|
|
148
|
+
return { ...base, outcome: "deleted", detail: "already absent" };
|
|
149
|
+
}
|
|
150
|
+
// Re-verify right before destroying — a delete is not undoable.
|
|
151
|
+
if (!matchesMarker(live, marker)) {
|
|
152
|
+
return {
|
|
153
|
+
...base,
|
|
154
|
+
outcome: "not-prunable",
|
|
155
|
+
detail: "the live machine no longer carries the requested marker identity",
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
await destroyMachine(ctx, app, live.id, http, undefined, { ...(wait ?? {}), state: live.state, name: live.name });
|
|
160
|
+
}
|
|
161
|
+
catch (err) {
|
|
162
|
+
return { ...base, outcome: "failed", detail: err instanceof Error ? err.message : String(err) };
|
|
163
|
+
}
|
|
164
|
+
return { ...base, outcome: "deleted" };
|
|
165
|
+
}
|
|
166
|
+
async function deleteAppCandidate(ctx, candidate, marker, http) {
|
|
167
|
+
const base = { name: candidate.name, type: candidate.type };
|
|
168
|
+
const app = candidate.name;
|
|
169
|
+
// The boundary re-check: an app that (still, or again) hosts any machine
|
|
170
|
+
// outside the requested identity is not deleted whole. Machines this same
|
|
171
|
+
// execution just destroyed are gone by now — destroyMachine waits.
|
|
172
|
+
let machines;
|
|
173
|
+
try {
|
|
174
|
+
machines = liveMachines(await listMachines(ctx, app, http));
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
return { ...base, outcome: "failed", detail: err instanceof Error ? err.message : String(err) };
|
|
178
|
+
}
|
|
179
|
+
const foreign = machines.filter((m) => !matchesMarker(m, marker));
|
|
180
|
+
if (foreign.length > 0) {
|
|
181
|
+
return {
|
|
182
|
+
...base,
|
|
183
|
+
outcome: "not-prunable",
|
|
184
|
+
detail: `the app hosts ${foreign.length} machine(s) outside the requested identity`,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
const result = await deleteApp(ctx, app, http);
|
|
189
|
+
return result.deleted ? { ...base, outcome: "deleted" } : { ...base, outcome: "deleted", detail: "already absent" };
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
return { ...base, outcome: "failed", detail: err instanceof Error ? err.message : String(err) };
|
|
193
|
+
}
|
|
194
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -59,6 +59,10 @@ export declare class Machine {
|
|
|
59
59
|
/** An object defining the Machine configuration */
|
|
60
60
|
config?: MachineConfig;
|
|
61
61
|
lease_ttl?: number;
|
|
62
|
+
/** The minimum version of the app's secrets the Machine must run with. Set it to the `version`
|
|
63
|
+
returned by the endpoints that set or delete app secrets, so that the Machine is guaranteed
|
|
64
|
+
to see those changes. This field belongs at the top level of the request body, not in
|
|
65
|
+
`config`. If omitted, the app's current secrets version is looked up for you. */
|
|
62
66
|
min_secrets_version?: number;
|
|
63
67
|
/** Unique name for this Machine. If omitted, one is generated for you */
|
|
64
68
|
name?: string;
|
|
@@ -338,37 +342,59 @@ export declare class MachineConfig {
|
|
|
338
342
|
constructor(props: {
|
|
339
343
|
/** Optional boolean telling the Machine to destroy itself once it’s complete (default false) */
|
|
340
344
|
auto_destroy?: boolean;
|
|
345
|
+
/** A cache drive attached to the Machine */
|
|
341
346
|
cache_drive?: MachineCacheDrive;
|
|
342
347
|
/** An optional object that defines one or more named top-level checks. The key for each check is the check name. */
|
|
343
348
|
checks?: Record<string, MachineCheck>;
|
|
344
|
-
/** Containers are a list of containers that will run in the machine
|
|
345
|
-
only specific organizations. */
|
|
349
|
+
/** Containers are a list of containers that will run in the machine, each from its own image. */
|
|
346
350
|
containers?: ContainerConfig[];
|
|
347
351
|
/** Deprecated: use Service.Autostart instead */
|
|
348
352
|
disable_machine_autostart?: boolean;
|
|
353
|
+
/** DNS settings for the Machine */
|
|
349
354
|
dns?: DNSConfig;
|
|
350
355
|
/** An object filled with key/value pairs to be set as environment variables */
|
|
351
356
|
env?: Record<string, string>;
|
|
357
|
+
/** Files to write into the Machine, from either a raw value or an app secret */
|
|
352
358
|
files?: File[];
|
|
359
|
+
/** The resources (CPUs, memory, etc.) allocated to the Machine */
|
|
353
360
|
guest?: MachineGuest;
|
|
354
361
|
/** The docker image to run */
|
|
355
362
|
image?: string;
|
|
363
|
+
/** Arguments for init, Fly.io's footprint inside the Machine, which controls how your own code is run */
|
|
356
364
|
init?: MachineInit;
|
|
365
|
+
/** Key/value pairs of Machine metadata. Fly.io uses metadata internally for routing, process groups, and clusters */
|
|
357
366
|
metadata?: Record<string, string>;
|
|
367
|
+
/** An optional metrics endpoint for Prometheus on Fly.io to scrape */
|
|
358
368
|
metrics?: MachineMetrics;
|
|
369
|
+
/** Persistent volumes to mount in the Machine. A Machine can mount at most one volume, which must be on
|
|
370
|
+
the same host. The mounted volume cannot be changed by updating the Machine */
|
|
359
371
|
mounts?: MachineMount[];
|
|
372
|
+
/** Multiple processes to run within this one Machine, all from the Machine's image. Unrelated to the
|
|
373
|
+
process groups in fly.toml, which run on separate Machines. To run processes from different
|
|
374
|
+
images, use containers instead */
|
|
360
375
|
processes?: MachineProcess[];
|
|
376
|
+
/** Whether and how the Machine is restarted after its main process exits */
|
|
361
377
|
restart?: MachineRestart;
|
|
378
|
+
/** The size of the Machine's root filesystem and whether it persists */
|
|
362
379
|
rootfs?: MachineRootfs;
|
|
380
|
+
/** Run the Machine at an interval: one of hourly, daily, weekly or monthly. The interval starts when
|
|
381
|
+
the Machine is created */
|
|
363
382
|
schedule?: string;
|
|
383
|
+
/** Network services that Fly Proxy routes traffic to */
|
|
364
384
|
services?: MachineService[];
|
|
365
385
|
/** Deprecated: use Guest instead */
|
|
366
386
|
size?: string;
|
|
387
|
+
/** Spot pricing settings for the Machine */
|
|
367
388
|
spot?: MachineSpot;
|
|
368
389
|
/** Standbys enable a machine to be a standby for another. In the event of a hardware failure,
|
|
369
390
|
the standby machine will be started. */
|
|
370
391
|
standbys?: string[];
|
|
392
|
+
/** Static files to serve under a URL prefix. Fly Proxy routes matching requests to a file server
|
|
393
|
+
inside the Machine, bypassing your application's own process; the Machine must be running. The
|
|
394
|
+
files are read either from a path inside the Machine or from a Tigris bucket that belongs to the
|
|
395
|
+
app; no bucket is created for you */
|
|
371
396
|
statics?: Static[];
|
|
397
|
+
/** How the Machine is shut down gracefully: the signal sent to it and how long to wait before a hard shutdown */
|
|
372
398
|
stop_config?: StopConfig;
|
|
373
399
|
});
|
|
374
400
|
}
|
|
@@ -578,9 +604,14 @@ export declare class ReplayCache {
|
|
|
578
604
|
|
|
579
605
|
export declare class Static {
|
|
580
606
|
constructor(props: {
|
|
607
|
+
/** The path inside the Machine, or inside tigris_bucket when set, where the files to serve are located */
|
|
581
608
|
guest_path: string;
|
|
609
|
+
/** The URL prefix under which the files are served */
|
|
582
610
|
url_prefix: string;
|
|
611
|
+
/** The document served for requests to the URL prefix or any of its subfolders. Only works with tigris_bucket */
|
|
583
612
|
index_document?: string;
|
|
613
|
+
/** An existing Tigris bucket belonging to the app to read the files from, instead of the Machine's
|
|
614
|
+
filesystem. The files are still served through the Machine */
|
|
584
615
|
tigris_bucket?: string;
|
|
585
616
|
});
|
|
586
617
|
}
|
package/dist/validate.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validate generated lexicon-fly artifacts.
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper around the core validation framework
|
|
5
|
+
* with fly-specific configuration.
|
|
6
|
+
*/
|
|
7
|
+
import { dirname } from "path";
|
|
8
|
+
import { fileURLToPath } from "url";
|
|
9
|
+
import { validateLexiconArtifacts } from "@intentius/chant/codegen/validate";
|
|
10
|
+
/**
|
|
11
|
+
* The curated top-level Machines API resources (#741). A regeneration that
|
|
12
|
+
* loses one — an upstream rename, a spec fetch that returned a partial
|
|
13
|
+
* document — must fail validation rather than ship a lexicon missing a kind.
|
|
14
|
+
*/
|
|
15
|
+
const REQUIRED_NAMES = [
|
|
16
|
+
"App",
|
|
17
|
+
"Machine",
|
|
18
|
+
"Volume",
|
|
19
|
+
"IPAddress",
|
|
20
|
+
"Certificate",
|
|
21
|
+
"Secret",
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* Validate the generated lexicon-fly artifacts.
|
|
25
|
+
*/
|
|
26
|
+
export async function validate(opts) {
|
|
27
|
+
const basePath = opts?.basePath ?? dirname(dirname(fileURLToPath(import.meta.url)));
|
|
28
|
+
return validateLexiconArtifacts({
|
|
29
|
+
lexiconJsonFilename: "lexicon-fly.json",
|
|
30
|
+
requiredNames: REQUIRED_NAMES,
|
|
31
|
+
basePath,
|
|
32
|
+
});
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-fly",
|
|
3
|
-
"version": "0.124.
|
|
3
|
+
"version": "0.124.33",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"src/",
|
|
@@ -13,37 +13,37 @@
|
|
|
13
13
|
".": {
|
|
14
14
|
"development": "./src/index.ts",
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
16
|
-
"default": "./
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
17
|
},
|
|
18
18
|
"./*": {
|
|
19
19
|
"development": "./src/*.ts",
|
|
20
20
|
"types": "./dist/*.d.ts",
|
|
21
|
-
"default": "./
|
|
21
|
+
"default": "./dist/*.js"
|
|
22
22
|
},
|
|
23
23
|
"./detect": {
|
|
24
24
|
"development": "./src/detect.ts",
|
|
25
25
|
"types": "./dist/detect.d.ts",
|
|
26
|
-
"default": "./
|
|
26
|
+
"default": "./dist/detect.js"
|
|
27
27
|
},
|
|
28
28
|
"./components": {
|
|
29
29
|
"development": "./src/components/index.ts",
|
|
30
30
|
"types": "./dist/components/index.d.ts",
|
|
31
|
-
"default": "./
|
|
31
|
+
"default": "./dist/components/index.js"
|
|
32
32
|
},
|
|
33
33
|
"./op/activities": {
|
|
34
34
|
"development": "./src/op/activities/index.ts",
|
|
35
35
|
"types": "./dist/op/activities/index.d.ts",
|
|
36
|
-
"default": "./
|
|
36
|
+
"default": "./dist/op/activities/index.js"
|
|
37
37
|
},
|
|
38
38
|
"./op/activity-contracts": {
|
|
39
39
|
"development": "./src/op/activity-contracts.ts",
|
|
40
40
|
"types": "./dist/op/activity-contracts.d.ts",
|
|
41
|
-
"default": "./
|
|
41
|
+
"default": "./dist/op/activity-contracts.js"
|
|
42
42
|
},
|
|
43
43
|
"./lint/post-synth": {
|
|
44
44
|
"development": "./src/lint/post-synth/index.ts",
|
|
45
45
|
"types": "./dist/lint/post-synth/index.d.ts",
|
|
46
|
-
"default": "./
|
|
46
|
+
"default": "./dist/lint/post-synth/index.js"
|
|
47
47
|
},
|
|
48
48
|
"./manifest": "./dist/manifest.json",
|
|
49
49
|
"./meta": "./dist/meta.json",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"validate": "tsx src/validate-cli.ts",
|
|
56
56
|
"docs": "tsx src/codegen/docs-cli.ts",
|
|
57
57
|
"prepack": "npm run generate && npm run bundle && npm run validate && npm run build",
|
|
58
|
-
"build": "../../scripts/tsc7.sh -p tsconfig.build.json && tsc-alias -p tsconfig.build.json
|
|
58
|
+
"build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@intentius/chant-lexicon-otel": "^0.124.
|
|
61
|
+
"@intentius/chant-lexicon-otel": "^0.124.33",
|
|
62
62
|
"ws": "^8.18.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"zod": "^4.3.6"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@intentius/chant": "^0.124.
|
|
72
|
+
"@intentius/chant": "^0.124.33",
|
|
73
73
|
"zod": "^4.3.6"
|
|
74
74
|
},
|
|
75
75
|
"description": "Fly.io Machines lexicon for chant — declarative IaC in TypeScript",
|
package/src/codegen/package.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { generate } from "./generate";
|
|
|
3
3
|
import { flyPlugin } from "../plugin";
|
|
4
4
|
import { readFileSync } from "fs";
|
|
5
5
|
import { dirname, join } from "path";
|
|
6
|
-
import {
|
|
6
|
+
import { moduleSourceDir } from "@intentius/chant/module-source";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Package the fly lexicon for distribution.
|
|
@@ -13,7 +13,7 @@ export async function packageLexicon(options?: { verbose?: boolean; force?: bool
|
|
|
13
13
|
// relative to src/, so srcDir must be the parent of this directory.
|
|
14
14
|
// Pointing it at src/codegen made collectRules glob a directory that does
|
|
15
15
|
// not exist, and the bundle shipped zero rules alongside zero skills.
|
|
16
|
-
const srcDir = dirname(
|
|
16
|
+
const srcDir = dirname(moduleSourceDir(import.meta.url));
|
|
17
17
|
const pkgJson = JSON.parse(readFileSync(join(srcDir, "..", "package.json"), "utf-8"));
|
|
18
18
|
|
|
19
19
|
const { spec, stats } = await packagePipeline({
|
package/src/generated/index.d.ts
CHANGED
|
@@ -59,6 +59,10 @@ export declare class Machine {
|
|
|
59
59
|
/** An object defining the Machine configuration */
|
|
60
60
|
config?: MachineConfig;
|
|
61
61
|
lease_ttl?: number;
|
|
62
|
+
/** The minimum version of the app's secrets the Machine must run with. Set it to the `version`
|
|
63
|
+
returned by the endpoints that set or delete app secrets, so that the Machine is guaranteed
|
|
64
|
+
to see those changes. This field belongs at the top level of the request body, not in
|
|
65
|
+
`config`. If omitted, the app's current secrets version is looked up for you. */
|
|
62
66
|
min_secrets_version?: number;
|
|
63
67
|
/** Unique name for this Machine. If omitted, one is generated for you */
|
|
64
68
|
name?: string;
|
|
@@ -338,37 +342,59 @@ export declare class MachineConfig {
|
|
|
338
342
|
constructor(props: {
|
|
339
343
|
/** Optional boolean telling the Machine to destroy itself once it’s complete (default false) */
|
|
340
344
|
auto_destroy?: boolean;
|
|
345
|
+
/** A cache drive attached to the Machine */
|
|
341
346
|
cache_drive?: MachineCacheDrive;
|
|
342
347
|
/** An optional object that defines one or more named top-level checks. The key for each check is the check name. */
|
|
343
348
|
checks?: Record<string, MachineCheck>;
|
|
344
|
-
/** Containers are a list of containers that will run in the machine
|
|
345
|
-
only specific organizations. */
|
|
349
|
+
/** Containers are a list of containers that will run in the machine, each from its own image. */
|
|
346
350
|
containers?: ContainerConfig[];
|
|
347
351
|
/** Deprecated: use Service.Autostart instead */
|
|
348
352
|
disable_machine_autostart?: boolean;
|
|
353
|
+
/** DNS settings for the Machine */
|
|
349
354
|
dns?: DNSConfig;
|
|
350
355
|
/** An object filled with key/value pairs to be set as environment variables */
|
|
351
356
|
env?: Record<string, string>;
|
|
357
|
+
/** Files to write into the Machine, from either a raw value or an app secret */
|
|
352
358
|
files?: File[];
|
|
359
|
+
/** The resources (CPUs, memory, etc.) allocated to the Machine */
|
|
353
360
|
guest?: MachineGuest;
|
|
354
361
|
/** The docker image to run */
|
|
355
362
|
image?: string;
|
|
363
|
+
/** Arguments for init, Fly.io's footprint inside the Machine, which controls how your own code is run */
|
|
356
364
|
init?: MachineInit;
|
|
365
|
+
/** Key/value pairs of Machine metadata. Fly.io uses metadata internally for routing, process groups, and clusters */
|
|
357
366
|
metadata?: Record<string, string>;
|
|
367
|
+
/** An optional metrics endpoint for Prometheus on Fly.io to scrape */
|
|
358
368
|
metrics?: MachineMetrics;
|
|
369
|
+
/** Persistent volumes to mount in the Machine. A Machine can mount at most one volume, which must be on
|
|
370
|
+
the same host. The mounted volume cannot be changed by updating the Machine */
|
|
359
371
|
mounts?: MachineMount[];
|
|
372
|
+
/** Multiple processes to run within this one Machine, all from the Machine's image. Unrelated to the
|
|
373
|
+
process groups in fly.toml, which run on separate Machines. To run processes from different
|
|
374
|
+
images, use containers instead */
|
|
360
375
|
processes?: MachineProcess[];
|
|
376
|
+
/** Whether and how the Machine is restarted after its main process exits */
|
|
361
377
|
restart?: MachineRestart;
|
|
378
|
+
/** The size of the Machine's root filesystem and whether it persists */
|
|
362
379
|
rootfs?: MachineRootfs;
|
|
380
|
+
/** Run the Machine at an interval: one of hourly, daily, weekly or monthly. The interval starts when
|
|
381
|
+
the Machine is created */
|
|
363
382
|
schedule?: string;
|
|
383
|
+
/** Network services that Fly Proxy routes traffic to */
|
|
364
384
|
services?: MachineService[];
|
|
365
385
|
/** Deprecated: use Guest instead */
|
|
366
386
|
size?: string;
|
|
387
|
+
/** Spot pricing settings for the Machine */
|
|
367
388
|
spot?: MachineSpot;
|
|
368
389
|
/** Standbys enable a machine to be a standby for another. In the event of a hardware failure,
|
|
369
390
|
the standby machine will be started. */
|
|
370
391
|
standbys?: string[];
|
|
392
|
+
/** Static files to serve under a URL prefix. Fly Proxy routes matching requests to a file server
|
|
393
|
+
inside the Machine, bypassing your application's own process; the Machine must be running. The
|
|
394
|
+
files are read either from a path inside the Machine or from a Tigris bucket that belongs to the
|
|
395
|
+
app; no bucket is created for you */
|
|
371
396
|
statics?: Static[];
|
|
397
|
+
/** How the Machine is shut down gracefully: the signal sent to it and how long to wait before a hard shutdown */
|
|
372
398
|
stop_config?: StopConfig;
|
|
373
399
|
});
|
|
374
400
|
}
|
|
@@ -578,9 +604,14 @@ export declare class ReplayCache {
|
|
|
578
604
|
|
|
579
605
|
export declare class Static {
|
|
580
606
|
constructor(props: {
|
|
607
|
+
/** The path inside the Machine, or inside tigris_bucket when set, where the files to serve are located */
|
|
581
608
|
guest_path: string;
|
|
609
|
+
/** The URL prefix under which the files are served */
|
|
582
610
|
url_prefix: string;
|
|
611
|
+
/** The document served for requests to the URL prefix or any of its subfolders. Only works with tigris_bucket */
|
|
583
612
|
index_document?: string;
|
|
613
|
+
/** An existing Tigris bucket belonging to the app to read the files from, instead of the Machine's
|
|
614
|
+
filesystem. The files are still served through the Machine */
|
|
584
615
|
tigris_bucket?: string;
|
|
585
616
|
});
|
|
586
617
|
}
|