gigadrive 2.8.0 → 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.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.8.0",
35
+ version: "2.9.0",
36
36
  repository: {
37
37
  type: "git",
38
38
  url: "https://github.com/Gigadrive/sdk.git",
@@ -3073,6 +3073,7 @@ var describeMicroVm = (vm, now = Date.now()) => {
3073
3073
  `Size: ${vm.vcpus} vCPU, ${formatMemory(vm.memoryMb)} memory, ${formatMemory(vm.diskMb)} disk`,
3074
3074
  `Region: ${vm.region}`,
3075
3075
  `Network: ${vm.network.egress === "deny" ? "outbound traffic blocked" : "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
  ];
@@ -3357,7 +3358,12 @@ var createInput = (flags) => import_effect24.Effect.gen(function* () {
3357
3358
  ...flags.ports.length > 0 ? { ports: [...flags.ports] } : {},
3358
3359
  ...env ? { env } : {},
3359
3360
  ...metadata ? { metadata } : {},
3360
- ...flags.denyEgress ? { network: { egress: "deny" } } : {},
3361
+ ...flags.denyEgress || flags.privatePreviews ? {
3362
+ network: {
3363
+ egress: flags.denyEgress ? "deny" : "allow",
3364
+ ...flags.privatePreviews ? { previews: "private" } : {}
3365
+ }
3366
+ } : {},
3361
3367
  ...import_effect24.Option.match(flags.region, { onNone: () => ({}), onSome: (region) => ({ region }) })
3362
3368
  };
3363
3369
  return input;
@@ -3372,6 +3378,13 @@ var createMicroVm = (flags) => import_effect24.Effect.gen(function* () {
3372
3378
  return vm;
3373
3379
  }
3374
3380
  for (const line of describeMicroVm(vm)) yield* import_effect24.Console.log(line);
3381
+ if (vm.previewToken) {
3382
+ yield* import_effect24.Console.log(`
3383
+ Preview token: ${vm.previewToken}`);
3384
+ yield* import_effect24.Console.log(
3385
+ "Shown only now. Send it in the x-gigadrive-preview-token header, or open a preview URL once with ?gd_preview_token=<token>."
3386
+ );
3387
+ }
3375
3388
  yield* import_effect24.Console.log(`
3376
3389
  Run a command: gigadrive microvms exec ${vm.id} -- <command>`);
3377
3390
  yield* import_effect24.Console.log(`Open a shell: gigadrive microvms shell ${vm.id}`);
@@ -3401,7 +3414,7 @@ var createCommand = import_cli12.Command.make(
3401
3414
  ),
3402
3415
  ports: import_cli12.Options.integer("port").pipe(
3403
3416
  import_cli12.Options.withAlias("p"),
3404
- import_cli12.Options.withDescription("Port to expose on a public preview URL (repeatable, up to 8)"),
3417
+ import_cli12.Options.withDescription("Port to expose on a preview URL (repeatable, up to 8)"),
3405
3418
  import_cli12.Options.repeated
3406
3419
  ),
3407
3420
  env: envOption,
@@ -3411,6 +3424,9 @@ var createCommand = import_cli12.Command.make(
3411
3424
  import_cli12.Options.repeated
3412
3425
  ),
3413
3426
  denyEgress: import_cli12.Options.boolean("deny-egress").pipe(import_cli12.Options.withDescription("Block all outbound network traffic")),
3427
+ privatePreviews: import_cli12.Options.boolean("private-previews").pipe(
3428
+ import_cli12.Options.withDescription("Answer preview URLs only to requests that carry the preview token printed at create")
3429
+ ),
3414
3430
  region: import_cli12.Options.text("region").pipe(import_cli12.Options.withDescription("Region to place the microVM in"), import_cli12.Options.optional),
3415
3431
  json: jsonOption2
3416
3432
  },