gigadrive 2.8.1 → 2.10.0
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/index.cjs +41 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +41 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -32,7 +32,7 @@ var import_effect31 = require("effect");
|
|
|
32
32
|
// package.json
|
|
33
33
|
var package_default = {
|
|
34
34
|
name: "gigadrive",
|
|
35
|
-
version: "2.
|
|
35
|
+
version: "2.10.0",
|
|
36
36
|
repository: {
|
|
37
37
|
type: "git",
|
|
38
38
|
url: "https://github.com/Gigadrive/sdk.git",
|
|
@@ -3072,7 +3072,8 @@ var describeMicroVm = (vm, now = Date.now()) => {
|
|
|
3072
3072
|
`Image: ${vm.image.name}`,
|
|
3073
3073
|
`Size: ${vm.vcpus} vCPU, ${formatMemory(vm.memoryMb)} memory, ${formatMemory(vm.diskMb)} disk`,
|
|
3074
3074
|
`Region: ${vm.region}`,
|
|
3075
|
-
`Network: ${vm.network.egress === "deny" ? "outbound traffic blocked" : "internet access"}`,
|
|
3075
|
+
`Network: ${vm.network.egress === "deny" ? "outbound traffic blocked" : vm.network.allow && vm.network.allow.length > 0 ? `only ${vm.network.allow.join(", ")} (and DNS)` : "internet access"}`,
|
|
3076
|
+
`Previews: ${vm.network.previews === "private" ? "private (preview token required)" : "public"}`,
|
|
3076
3077
|
`Application: ${vm.applicationId}`,
|
|
3077
3078
|
`Created: ${vm.createdAt}`
|
|
3078
3079
|
];
|
|
@@ -3339,6 +3340,20 @@ var createInput = (flags) => import_effect24.Effect.gen(function* () {
|
|
|
3339
3340
|
onNone: () => import_effect24.Effect.succeed(void 0),
|
|
3340
3341
|
onSome: (text) => parseLifetime("--timeout", text)
|
|
3341
3342
|
});
|
|
3343
|
+
if (flags.denyEgress && flags.allowEgress.length > 0) {
|
|
3344
|
+
return yield* new InvalidMicroVmOptionsError({
|
|
3345
|
+
message: "--allow-egress cannot be combined with --deny-egress."
|
|
3346
|
+
});
|
|
3347
|
+
}
|
|
3348
|
+
if (flags.allowEgress.length > 32) {
|
|
3349
|
+
return yield* new InvalidMicroVmOptionsError({ message: "--allow-egress takes at most 32 networks." });
|
|
3350
|
+
}
|
|
3351
|
+
const badNetwork = flags.allowEgress.find((network) => !/^\d{1,3}(\.\d{1,3}){3}\/\d{1,2}$/.test(network.trim()));
|
|
3352
|
+
if (badNetwork !== void 0) {
|
|
3353
|
+
return yield* new InvalidMicroVmOptionsError({
|
|
3354
|
+
message: `--allow-egress must be an IPv4 network such as 140.82.112.0/20 (got ${badNetwork}).`
|
|
3355
|
+
});
|
|
3356
|
+
}
|
|
3342
3357
|
const badPort = flags.ports.find((port) => !Number.isInteger(port) || port < 1 || port > 65535);
|
|
3343
3358
|
if (badPort !== void 0) {
|
|
3344
3359
|
return yield* new InvalidMicroVmOptionsError({ message: `--port must be between 1 and 65535 (got ${badPort}).` });
|
|
@@ -3357,7 +3372,13 @@ var createInput = (flags) => import_effect24.Effect.gen(function* () {
|
|
|
3357
3372
|
...flags.ports.length > 0 ? { ports: [...flags.ports] } : {},
|
|
3358
3373
|
...env ? { env } : {},
|
|
3359
3374
|
...metadata ? { metadata } : {},
|
|
3360
|
-
...flags.denyEgress
|
|
3375
|
+
...flags.denyEgress || flags.privatePreviews || flags.allowEgress.length > 0 ? {
|
|
3376
|
+
network: {
|
|
3377
|
+
egress: flags.denyEgress ? "deny" : "allow",
|
|
3378
|
+
...flags.privatePreviews ? { previews: "private" } : {},
|
|
3379
|
+
...flags.allowEgress.length > 0 ? { allow: [...flags.allowEgress] } : {}
|
|
3380
|
+
}
|
|
3381
|
+
} : {},
|
|
3361
3382
|
...import_effect24.Option.match(flags.region, { onNone: () => ({}), onSome: (region) => ({ region }) })
|
|
3362
3383
|
};
|
|
3363
3384
|
return input;
|
|
@@ -3372,6 +3393,13 @@ var createMicroVm = (flags) => import_effect24.Effect.gen(function* () {
|
|
|
3372
3393
|
return vm;
|
|
3373
3394
|
}
|
|
3374
3395
|
for (const line of describeMicroVm(vm)) yield* import_effect24.Console.log(line);
|
|
3396
|
+
if (vm.previewToken) {
|
|
3397
|
+
yield* import_effect24.Console.log(`
|
|
3398
|
+
Preview token: ${vm.previewToken}`);
|
|
3399
|
+
yield* import_effect24.Console.log(
|
|
3400
|
+
"Shown only now. Send it in the x-gigadrive-preview-token header, or open a preview URL once with ?gd_preview_token=<token>."
|
|
3401
|
+
);
|
|
3402
|
+
}
|
|
3375
3403
|
yield* import_effect24.Console.log(`
|
|
3376
3404
|
Run a command: gigadrive microvms exec ${vm.id} -- <command>`);
|
|
3377
3405
|
yield* import_effect24.Console.log(`Open a shell: gigadrive microvms shell ${vm.id}`);
|
|
@@ -3401,7 +3429,7 @@ var createCommand = import_cli12.Command.make(
|
|
|
3401
3429
|
),
|
|
3402
3430
|
ports: import_cli12.Options.integer("port").pipe(
|
|
3403
3431
|
import_cli12.Options.withAlias("p"),
|
|
3404
|
-
import_cli12.Options.withDescription("Port to expose on a
|
|
3432
|
+
import_cli12.Options.withDescription("Port to expose on a preview URL (repeatable, up to 8)"),
|
|
3405
3433
|
import_cli12.Options.repeated
|
|
3406
3434
|
),
|
|
3407
3435
|
env: envOption,
|
|
@@ -3411,6 +3439,15 @@ var createCommand = import_cli12.Command.make(
|
|
|
3411
3439
|
import_cli12.Options.repeated
|
|
3412
3440
|
),
|
|
3413
3441
|
denyEgress: import_cli12.Options.boolean("deny-egress").pipe(import_cli12.Options.withDescription("Block all outbound network traffic")),
|
|
3442
|
+
privatePreviews: import_cli12.Options.boolean("private-previews").pipe(
|
|
3443
|
+
import_cli12.Options.withDescription("Answer preview URLs only to requests that carry the preview token printed at create")
|
|
3444
|
+
),
|
|
3445
|
+
allowEgress: import_cli12.Options.text("allow-egress").pipe(
|
|
3446
|
+
import_cli12.Options.withDescription(
|
|
3447
|
+
"Only reach this public IPv4 network, such as 140.82.112.0/20, besides DNS (repeatable, up to 32)"
|
|
3448
|
+
),
|
|
3449
|
+
import_cli12.Options.repeated
|
|
3450
|
+
),
|
|
3414
3451
|
region: import_cli12.Options.text("region").pipe(import_cli12.Options.withDescription("Region to place the microVM in"), import_cli12.Options.optional),
|
|
3415
3452
|
json: jsonOption2
|
|
3416
3453
|
},
|