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.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { Effect as Effect29, Layer, LogLevel, Logger } from "effect";
|
|
|
9
9
|
// package.json
|
|
10
10
|
var package_default = {
|
|
11
11
|
name: "gigadrive",
|
|
12
|
-
version: "2.
|
|
12
|
+
version: "2.10.0",
|
|
13
13
|
repository: {
|
|
14
14
|
type: "git",
|
|
15
15
|
url: "https://github.com/Gigadrive/sdk.git",
|
|
@@ -3062,7 +3062,8 @@ var describeMicroVm = (vm, now = Date.now()) => {
|
|
|
3062
3062
|
`Image: ${vm.image.name}`,
|
|
3063
3063
|
`Size: ${vm.vcpus} vCPU, ${formatMemory(vm.memoryMb)} memory, ${formatMemory(vm.diskMb)} disk`,
|
|
3064
3064
|
`Region: ${vm.region}`,
|
|
3065
|
-
`Network: ${vm.network.egress === "deny" ? "outbound traffic blocked" : "internet access"}`,
|
|
3065
|
+
`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"}`,
|
|
3066
|
+
`Previews: ${vm.network.previews === "private" ? "private (preview token required)" : "public"}`,
|
|
3066
3067
|
`Application: ${vm.applicationId}`,
|
|
3067
3068
|
`Created: ${vm.createdAt}`
|
|
3068
3069
|
];
|
|
@@ -3329,6 +3330,20 @@ var createInput = (flags) => Effect22.gen(function* () {
|
|
|
3329
3330
|
onNone: () => Effect22.succeed(void 0),
|
|
3330
3331
|
onSome: (text) => parseLifetime("--timeout", text)
|
|
3331
3332
|
});
|
|
3333
|
+
if (flags.denyEgress && flags.allowEgress.length > 0) {
|
|
3334
|
+
return yield* new InvalidMicroVmOptionsError({
|
|
3335
|
+
message: "--allow-egress cannot be combined with --deny-egress."
|
|
3336
|
+
});
|
|
3337
|
+
}
|
|
3338
|
+
if (flags.allowEgress.length > 32) {
|
|
3339
|
+
return yield* new InvalidMicroVmOptionsError({ message: "--allow-egress takes at most 32 networks." });
|
|
3340
|
+
}
|
|
3341
|
+
const badNetwork = flags.allowEgress.find((network) => !/^\d{1,3}(\.\d{1,3}){3}\/\d{1,2}$/.test(network.trim()));
|
|
3342
|
+
if (badNetwork !== void 0) {
|
|
3343
|
+
return yield* new InvalidMicroVmOptionsError({
|
|
3344
|
+
message: `--allow-egress must be an IPv4 network such as 140.82.112.0/20 (got ${badNetwork}).`
|
|
3345
|
+
});
|
|
3346
|
+
}
|
|
3332
3347
|
const badPort = flags.ports.find((port) => !Number.isInteger(port) || port < 1 || port > 65535);
|
|
3333
3348
|
if (badPort !== void 0) {
|
|
3334
3349
|
return yield* new InvalidMicroVmOptionsError({ message: `--port must be between 1 and 65535 (got ${badPort}).` });
|
|
@@ -3347,7 +3362,13 @@ var createInput = (flags) => Effect22.gen(function* () {
|
|
|
3347
3362
|
...flags.ports.length > 0 ? { ports: [...flags.ports] } : {},
|
|
3348
3363
|
...env ? { env } : {},
|
|
3349
3364
|
...metadata ? { metadata } : {},
|
|
3350
|
-
...flags.denyEgress
|
|
3365
|
+
...flags.denyEgress || flags.privatePreviews || flags.allowEgress.length > 0 ? {
|
|
3366
|
+
network: {
|
|
3367
|
+
egress: flags.denyEgress ? "deny" : "allow",
|
|
3368
|
+
...flags.privatePreviews ? { previews: "private" } : {},
|
|
3369
|
+
...flags.allowEgress.length > 0 ? { allow: [...flags.allowEgress] } : {}
|
|
3370
|
+
}
|
|
3371
|
+
} : {},
|
|
3351
3372
|
...Option14.match(flags.region, { onNone: () => ({}), onSome: (region) => ({ region }) })
|
|
3352
3373
|
};
|
|
3353
3374
|
return input;
|
|
@@ -3362,6 +3383,13 @@ var createMicroVm = (flags) => Effect22.gen(function* () {
|
|
|
3362
3383
|
return vm;
|
|
3363
3384
|
}
|
|
3364
3385
|
for (const line of describeMicroVm(vm)) yield* Console12.log(line);
|
|
3386
|
+
if (vm.previewToken) {
|
|
3387
|
+
yield* Console12.log(`
|
|
3388
|
+
Preview token: ${vm.previewToken}`);
|
|
3389
|
+
yield* Console12.log(
|
|
3390
|
+
"Shown only now. Send it in the x-gigadrive-preview-token header, or open a preview URL once with ?gd_preview_token=<token>."
|
|
3391
|
+
);
|
|
3392
|
+
}
|
|
3365
3393
|
yield* Console12.log(`
|
|
3366
3394
|
Run a command: gigadrive microvms exec ${vm.id} -- <command>`);
|
|
3367
3395
|
yield* Console12.log(`Open a shell: gigadrive microvms shell ${vm.id}`);
|
|
@@ -3391,7 +3419,7 @@ var createCommand = Command12.make(
|
|
|
3391
3419
|
),
|
|
3392
3420
|
ports: Options7.integer("port").pipe(
|
|
3393
3421
|
Options7.withAlias("p"),
|
|
3394
|
-
Options7.withDescription("Port to expose on a
|
|
3422
|
+
Options7.withDescription("Port to expose on a preview URL (repeatable, up to 8)"),
|
|
3395
3423
|
Options7.repeated
|
|
3396
3424
|
),
|
|
3397
3425
|
env: envOption,
|
|
@@ -3401,6 +3429,15 @@ var createCommand = Command12.make(
|
|
|
3401
3429
|
Options7.repeated
|
|
3402
3430
|
),
|
|
3403
3431
|
denyEgress: Options7.boolean("deny-egress").pipe(Options7.withDescription("Block all outbound network traffic")),
|
|
3432
|
+
privatePreviews: Options7.boolean("private-previews").pipe(
|
|
3433
|
+
Options7.withDescription("Answer preview URLs only to requests that carry the preview token printed at create")
|
|
3434
|
+
),
|
|
3435
|
+
allowEgress: Options7.text("allow-egress").pipe(
|
|
3436
|
+
Options7.withDescription(
|
|
3437
|
+
"Only reach this public IPv4 network, such as 140.82.112.0/20, besides DNS (repeatable, up to 32)"
|
|
3438
|
+
),
|
|
3439
|
+
Options7.repeated
|
|
3440
|
+
),
|
|
3404
3441
|
region: Options7.text("region").pipe(Options7.withDescription("Region to place the microVM in"), Options7.optional),
|
|
3405
3442
|
json: jsonOption2
|
|
3406
3443
|
},
|