gigadrive 2.8.1 → 2.9.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.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.8.1",
12
+ version: "2.9.0",
13
13
  repository: {
14
14
  type: "git",
15
15
  url: "https://github.com/Gigadrive/sdk.git",
@@ -3063,6 +3063,7 @@ var describeMicroVm = (vm, now = Date.now()) => {
3063
3063
  `Size: ${vm.vcpus} vCPU, ${formatMemory(vm.memoryMb)} memory, ${formatMemory(vm.diskMb)} disk`,
3064
3064
  `Region: ${vm.region}`,
3065
3065
  `Network: ${vm.network.egress === "deny" ? "outbound traffic blocked" : "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
  ];
@@ -3347,7 +3348,12 @@ var createInput = (flags) => Effect22.gen(function* () {
3347
3348
  ...flags.ports.length > 0 ? { ports: [...flags.ports] } : {},
3348
3349
  ...env ? { env } : {},
3349
3350
  ...metadata ? { metadata } : {},
3350
- ...flags.denyEgress ? { network: { egress: "deny" } } : {},
3351
+ ...flags.denyEgress || flags.privatePreviews ? {
3352
+ network: {
3353
+ egress: flags.denyEgress ? "deny" : "allow",
3354
+ ...flags.privatePreviews ? { previews: "private" } : {}
3355
+ }
3356
+ } : {},
3351
3357
  ...Option14.match(flags.region, { onNone: () => ({}), onSome: (region) => ({ region }) })
3352
3358
  };
3353
3359
  return input;
@@ -3362,6 +3368,13 @@ var createMicroVm = (flags) => Effect22.gen(function* () {
3362
3368
  return vm;
3363
3369
  }
3364
3370
  for (const line of describeMicroVm(vm)) yield* Console12.log(line);
3371
+ if (vm.previewToken) {
3372
+ yield* Console12.log(`
3373
+ Preview token: ${vm.previewToken}`);
3374
+ yield* Console12.log(
3375
+ "Shown only now. Send it in the x-gigadrive-preview-token header, or open a preview URL once with ?gd_preview_token=<token>."
3376
+ );
3377
+ }
3365
3378
  yield* Console12.log(`
3366
3379
  Run a command: gigadrive microvms exec ${vm.id} -- <command>`);
3367
3380
  yield* Console12.log(`Open a shell: gigadrive microvms shell ${vm.id}`);
@@ -3391,7 +3404,7 @@ var createCommand = Command12.make(
3391
3404
  ),
3392
3405
  ports: Options7.integer("port").pipe(
3393
3406
  Options7.withAlias("p"),
3394
- Options7.withDescription("Port to expose on a public preview URL (repeatable, up to 8)"),
3407
+ Options7.withDescription("Port to expose on a preview URL (repeatable, up to 8)"),
3395
3408
  Options7.repeated
3396
3409
  ),
3397
3410
  env: envOption,
@@ -3401,6 +3414,9 @@ var createCommand = Command12.make(
3401
3414
  Options7.repeated
3402
3415
  ),
3403
3416
  denyEgress: Options7.boolean("deny-egress").pipe(Options7.withDescription("Block all outbound network traffic")),
3417
+ privatePreviews: Options7.boolean("private-previews").pipe(
3418
+ Options7.withDescription("Answer preview URLs only to requests that carry the preview token printed at create")
3419
+ ),
3404
3420
  region: Options7.text("region").pipe(Options7.withDescription("Region to place the microVM in"), Options7.optional),
3405
3421
  json: jsonOption2
3406
3422
  },