@cardelli/ambit 0.1.3 → 0.1.5

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.
Files changed (64) hide show
  1. package/esm/deno.d.ts +1 -0
  2. package/esm/deno.js +3 -2
  3. package/esm/deps/jsr.io/@std/cli/1.0.28/_data.d.ts.map +1 -0
  4. package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/_run_length.d.ts.map +1 -1
  5. package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/mod.d.ts.map +1 -1
  6. package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/parse_args.d.ts.map +1 -1
  7. package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/parse_args.js +17 -3
  8. package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/prompt_secret.d.ts.map +1 -1
  9. package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/unicode_width.d.ts.map +1 -1
  10. package/esm/deps/jsr.io/@std/collections/{1.1.3 → 1.1.6}/deep_merge.d.ts +2 -2
  11. package/esm/deps/jsr.io/@std/collections/{1.1.3 → 1.1.6}/deep_merge.d.ts.map +1 -1
  12. package/esm/deps/jsr.io/@std/collections/{1.1.3 → 1.1.6}/deep_merge.js +30 -20
  13. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.js +1 -1
  14. package/esm/deps/jsr.io/@zod/zod/4.3.6/src/v4/core/json-schema-generator.d.ts +1 -1
  15. package/esm/lib/cli.d.ts +0 -1
  16. package/esm/lib/cli.d.ts.map +1 -1
  17. package/esm/lib/cli.js +41 -26
  18. package/esm/lib/command.d.ts +23 -48
  19. package/esm/lib/command.d.ts.map +1 -1
  20. package/esm/lib/command.js +60 -89
  21. package/esm/lib/output.d.ts +1 -1
  22. package/esm/lib/output.d.ts.map +1 -1
  23. package/esm/lib/output.js +5 -9
  24. package/esm/lib/result.d.ts +19 -7
  25. package/esm/lib/result.d.ts.map +1 -1
  26. package/esm/lib/result.js +47 -1
  27. package/esm/main.d.ts.map +1 -1
  28. package/esm/main.js +3 -2
  29. package/esm/src/cli/commands/create.js +111 -97
  30. package/esm/src/cli/commands/deploy.js +61 -35
  31. package/esm/src/cli/commands/destroy.js +224 -29
  32. package/esm/src/cli/commands/doctor.js +2 -2
  33. package/esm/src/cli/commands/list.js +1 -1
  34. package/esm/src/cli/commands/status.js +1 -1
  35. package/esm/src/cli/mod.d.ts.map +1 -1
  36. package/esm/src/cli/mod.js +4 -3
  37. package/esm/src/discovery.d.ts +13 -0
  38. package/esm/src/discovery.d.ts.map +1 -1
  39. package/esm/src/discovery.js +42 -0
  40. package/esm/src/docker/router/start.sh +18 -72
  41. package/esm/src/providers/fly.d.ts +6 -0
  42. package/esm/src/providers/fly.d.ts.map +1 -1
  43. package/esm/src/providers/fly.js +77 -81
  44. package/esm/src/providers/tailscale.d.ts.map +1 -1
  45. package/esm/src/providers/tailscale.js +5 -11
  46. package/esm/src/template.d.ts +8 -7
  47. package/esm/src/template.d.ts.map +1 -1
  48. package/esm/src/template.js +32 -26
  49. package/package.json +7 -1
  50. package/esm/deps/jsr.io/@std/cli/1.0.27/_data.d.ts.map +0 -1
  51. package/esm/deps/jsr.io/@std/collections/1.1.3/_utils.d.ts +0 -6
  52. package/esm/deps/jsr.io/@std/collections/1.1.3/_utils.d.ts.map +0 -1
  53. package/esm/deps/jsr.io/@std/collections/1.1.3/_utils.js +0 -18
  54. /package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/_data.d.ts +0 -0
  55. /package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/_data.js +0 -0
  56. /package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/_run_length.d.ts +0 -0
  57. /package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/_run_length.js +0 -0
  58. /package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/mod.d.ts +0 -0
  59. /package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/mod.js +0 -0
  60. /package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/parse_args.d.ts +0 -0
  61. /package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/prompt_secret.d.ts +0 -0
  62. /package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/prompt_secret.js +0 -0
  63. /package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/unicode_width.d.ts +0 -0
  64. /package/esm/deps/jsr.io/@std/cli/{1.0.27 → 1.0.28}/unicode_width.js +0 -0
@@ -4,24 +4,69 @@
4
4
  import "../_dnt.polyfills.js";
5
5
  import { spawn } from "node:child_process";
6
6
  import { Spinner } from "./cli.js";
7
+ import { Result } from "./result.js";
8
+ // =============================================================================
9
+ // Command Result
10
+ // =============================================================================
11
+ export class CmdResult {
12
+ code;
13
+ stdout;
14
+ stderr;
15
+ ok;
16
+ constructor(code, stdout, stderr) {
17
+ this.code = code;
18
+ this.stdout = stdout;
19
+ this.stderr = stderr;
20
+ this.ok = code === 0;
21
+ }
22
+ /** Parse stdout as JSON, returning Result<T>. */
23
+ json() {
24
+ if (!this.ok) {
25
+ return Result.err(this.stderr || `Command failed with code ${this.code}`);
26
+ }
27
+ try {
28
+ return Result.ok(JSON.parse(this.stdout));
29
+ }
30
+ catch {
31
+ return Result.err(`Failed to parse JSON: ${this.stdout.slice(0, 100)}`);
32
+ }
33
+ }
34
+ /** Merged stdout + stderr. */
35
+ get output() {
36
+ return (this.stdout + this.stderr).trimEnd();
37
+ }
38
+ }
7
39
  // =============================================================================
8
40
  // Run Command
9
41
  // =============================================================================
10
42
  /**
11
43
  * Run a command and capture output.
44
+ * When `interactive: true`, inherits all stdio (no capture).
12
45
  */
13
46
  export const runCommand = (args, options) => {
14
47
  const [cmd, ...cmdArgs] = args;
48
+ const interactive = options?.interactive ?? false;
15
49
  return new Promise((resolve) => {
16
50
  const child = spawn(cmd, cmdArgs, {
17
51
  cwd: options?.cwd,
18
52
  env: options?.env ? { ...process.env, ...options.env } : undefined,
19
- stdio: [
20
- options?.stdin === "inherit" ? "inherit" : "ignore",
21
- "pipe",
22
- "pipe",
23
- ],
53
+ stdio: interactive
54
+ ? "inherit"
55
+ : [
56
+ options?.stdin === "inherit" ? "inherit" : "ignore",
57
+ "pipe",
58
+ "pipe",
59
+ ],
24
60
  });
61
+ if (interactive) {
62
+ child.on("error", () => {
63
+ resolve(new CmdResult(-1, "", ""));
64
+ });
65
+ child.on("close", (code) => {
66
+ resolve(new CmdResult(code ?? 1, "", ""));
67
+ });
68
+ return;
69
+ }
25
70
  const stdout = [];
26
71
  const stderr = [];
27
72
  child.stdout.setEncoding("utf8");
@@ -29,98 +74,24 @@ export const runCommand = (args, options) => {
29
74
  child.stdout.on("data", (chunk) => stdout.push(chunk));
30
75
  child.stderr.on("data", (chunk) => stderr.push(chunk));
31
76
  child.on("error", (error) => {
32
- resolve({
33
- success: false,
34
- code: -1,
35
- stdout: "",
36
- stderr: error.message,
37
- });
77
+ resolve(new CmdResult(-1, "", error.message));
38
78
  });
39
79
  child.on("close", (code) => {
40
- resolve({
41
- success: code === 0,
42
- code: code ?? 1,
43
- stdout: stdout.join(""),
44
- stderr: stderr.join(""),
45
- });
80
+ resolve(new CmdResult(code ?? 1, stdout.join(""), stderr.join("")));
46
81
  });
47
82
  });
48
83
  };
49
84
  // =============================================================================
50
- // Run Command with JSON Output
51
- // =============================================================================
52
- /**
53
- * Run a command that outputs JSON and parse it.
54
- */
55
- export const runCommandJson = async (args, options) => {
56
- const result = await runCommand(args, options);
57
- if (!result.success) {
58
- return {
59
- success: false,
60
- error: result.stderr || `Command failed with code ${result.code}`,
61
- };
62
- }
63
- try {
64
- const data = JSON.parse(result.stdout);
65
- return { success: true, data };
66
- }
67
- catch {
68
- return {
69
- success: false,
70
- error: `Failed to parse JSON output: ${result.stdout.slice(0, 100)}`,
71
- };
72
- }
73
- };
74
- // =============================================================================
75
- // Run with Spinner
85
+ // Wrappers
76
86
  // =============================================================================
77
- /**
78
- * Run a command while showing a spinner.
79
- */
80
- export const runWithSpinner = async (label, args, options) => {
87
+ /** Run with spinner, return CmdResult. */
88
+ export const runQuiet = (label, args, options) => {
81
89
  const spinner = new Spinner();
82
90
  spinner.start(label);
83
- const result = await runCommand(args, options);
84
- if (result.success) {
85
- spinner.success(label);
86
- }
87
- else {
88
- spinner.fail(label);
89
- }
90
- return result;
91
- };
92
- // =============================================================================
93
- // Run Quiet
94
- // =============================================================================
95
- /**
96
- * Run a command with spinner and return simplified result.
97
- */
98
- export const runQuiet = async (label, args, options) => {
99
- const result = await runWithSpinner(label, args, options);
100
- return {
101
- success: result.success,
102
- output: result.stdout + result.stderr,
103
- };
104
- };
105
- // =============================================================================
106
- // Run Interactive
107
- // =============================================================================
108
- /**
109
- * Run a command interactively (inherits stdio).
110
- */
111
- export const runInteractive = (args, options) => {
112
- const [cmd, ...cmdArgs] = args;
113
- return new Promise((resolve) => {
114
- const child = spawn(cmd, cmdArgs, {
115
- cwd: options?.cwd,
116
- env: options?.env ? { ...process.env, ...options.env } : undefined,
117
- stdio: "inherit",
118
- });
119
- child.on("error", () => {
120
- resolve({ success: false, code: -1 });
121
- });
122
- child.on("close", (code) => {
123
- resolve({ success: (code ?? 1) === 0, code: code ?? 1 });
124
- });
91
+ return runCommand(args, options).then((r) => {
92
+ r.ok ? spinner.success(label) : spinner.fail(label);
93
+ return r;
125
94
  });
126
95
  };
96
+ /** Run and parse stdout as JSON. */
97
+ export const runJson = (args, options) => runCommand(args, options).then((r) => r.json());
@@ -12,6 +12,7 @@ export declare class Output<T extends Record<string, unknown>> {
12
12
  constructor(jsonMode: boolean);
13
13
  done(data: T): this;
14
14
  fail(error: string, data?: Record<string, unknown>): this;
15
+ print(): void;
15
16
  ok(text: string): this;
16
17
  err(text: string): this;
17
18
  info(text: string): this;
@@ -25,7 +26,6 @@ export declare class Output<T extends Record<string, unknown>> {
25
26
  fail(msg: string): void;
26
27
  stop(): void;
27
28
  };
28
- print(): void;
29
29
  die(message: string): never;
30
30
  isJson(): boolean;
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAGA,OAAO,sBAAsB,CAAC;AAmB9B,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG,CAAC,CAAC;AAChD,MAAM,MAAM,WAAW,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAMvD,qBAAa,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnD,OAAO,CAAC,MAAM,CAGE;IAChB,OAAO,CAAC,QAAQ,CAAU;gBAEd,QAAQ,EAAE,OAAO;IAS7B,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAMnB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IASzD,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKtB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKvB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKvB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK1B,KAAK,IAAI,IAAI;IAMb,OAAO,CACL,OAAO,EAAE,MAAM,GACd;QAAE,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,IAAI,IAAI,IAAI,CAAA;KAAE;IAkBxE,KAAK,IAAI,IAAI;IAOb,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK;IAU3B,MAAM,IAAI,OAAO;CAGlB;AAMD,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5D,QAAQ,EAAE,OAAO,GAChB,MAAM,CAAC,CAAC,CAAC,CAEX"}
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAGA,OAAO,sBAAsB,CAAC;AAmB9B,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG,CAAC,CAAC;AAChD,MAAM,MAAM,WAAW,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAMvD,qBAAa,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnD,OAAO,CAAC,MAAM,CAGE;IAChB,OAAO,CAAC,QAAQ,CAAU;gBAEd,QAAQ,EAAE,OAAO;IAS7B,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAMnB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAKzD,KAAK,IAAI,IAAI;IAUb,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKtB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKvB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKvB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK1B,KAAK,IAAI,IAAI;IAKb,OAAO,CACL,OAAO,EAAE,MAAM,GACd;QAAE,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,IAAI,IAAI,IAAI,CAAA;KAAE;IAiBxE,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK;IAS3B,MAAM,IAAI,OAAO;CAGlB;AAMD,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5D,QAAQ,EAAE,OAAO,GAChB,MAAM,CAAC,CAAC,CAAC,CAEX"}
package/esm/lib/output.js CHANGED
@@ -26,6 +26,11 @@ export class Output {
26
26
  this.result = { ok: false, error, ...data };
27
27
  return this;
28
28
  }
29
+ print() {
30
+ if (this.jsonMode && this.result) {
31
+ console.log(JSON.stringify(this.result, null, 2));
32
+ }
33
+ }
29
34
  // ===========================================================================
30
35
  // Human-Mode Output (no-op in JSON mode)
31
36
  // ===========================================================================
@@ -69,7 +74,6 @@ export class Output {
69
74
  console.log();
70
75
  return this;
71
76
  }
72
- // JSON-aware spinner — no-op in JSON mode
73
77
  spinner(message) {
74
78
  if (this.jsonMode) {
75
79
  return { success: () => { }, fail: () => { }, stop: () => { } };
@@ -85,13 +89,6 @@ export class Output {
85
89
  // ===========================================================================
86
90
  // Terminal Output
87
91
  // ===========================================================================
88
- // Print result as JSON (no-op in human mode)
89
- print() {
90
- if (this.jsonMode && this.result) {
91
- console.log(JSON.stringify(this.result, null, 2));
92
- }
93
- }
94
- // Fatal error — outputs { ok: false, error } and exits
95
92
  die(message) {
96
93
  if (this.jsonMode) {
97
94
  console.log(JSON.stringify({ ok: false, error: message }, null, 2));
@@ -101,7 +98,6 @@ export class Output {
101
98
  }
102
99
  dntShim.Deno.exit(1);
103
100
  }
104
- // Check if in JSON mode
105
101
  isJson() {
106
102
  return this.jsonMode;
107
103
  }
@@ -1,8 +1,20 @@
1
- export type Result<T, K extends string = string> = ({
2
- ok: true;
3
- } & T) | {
4
- ok: false;
5
- kind: K;
6
- message: string;
7
- };
1
+ import "../_dnt.polyfills.js";
2
+ export declare class Result<T> {
3
+ readonly ok: boolean;
4
+ private readonly _value;
5
+ private readonly _error;
6
+ private constructor();
7
+ static ok<T>(value: T): Result<T>;
8
+ static err<T = never>(error: string): Result<T>;
9
+ get value(): T | undefined;
10
+ get error(): string | undefined;
11
+ map<U>(fn: (value: T) => U): Result<U>;
12
+ flatMap<U>(fn: (value: T) => Result<U>): Result<U>;
13
+ unwrap(): T;
14
+ unwrapOr(fallback: T): T;
15
+ match<U>(cases: {
16
+ ok: (value: T) => U;
17
+ err: (error: string) => U;
18
+ }): U;
19
+ }
8
20
  //# sourceMappingURL=result.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/lib/result.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,IAC3C,CAAC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG,CAAC,CAAC,GAClB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/lib/result.ts"],"names":[],"mappings":"AAGA,OAAO,sBAAsB,CAAC;AAG9B,qBAAa,MAAM,CAAC,CAAC;IAEjB,QAAQ,CAAC,EAAE,EAAE,OAAO;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHzB,OAAO;IAMP,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAIjC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;IAI/C,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,CAEzB;IAED,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAKtC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAKlD,MAAM,IAAI,CAAC;IAKX,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC;IAIxB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE;QAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;QAAC,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,CAAA;KAAE,GAAG,CAAC;CAGvE"}
package/esm/lib/result.js CHANGED
@@ -1 +1,47 @@
1
- export {};
1
+ // =============================================================================
2
+ // Result<T> — Shared Success/Failure Type
3
+ // =============================================================================
4
+ import "../_dnt.polyfills.js";
5
+ export class Result {
6
+ ok;
7
+ _value;
8
+ _error;
9
+ constructor(ok, _value, _error) {
10
+ this.ok = ok;
11
+ this._value = _value;
12
+ this._error = _error;
13
+ }
14
+ static ok(value) {
15
+ return new Result(true, value, undefined);
16
+ }
17
+ static err(error) {
18
+ return new Result(false, undefined, error);
19
+ }
20
+ get value() {
21
+ return this._value;
22
+ }
23
+ get error() {
24
+ return this._error;
25
+ }
26
+ map(fn) {
27
+ if (this.ok)
28
+ return Result.ok(fn(this._value));
29
+ return Result.err(this._error);
30
+ }
31
+ flatMap(fn) {
32
+ if (this.ok)
33
+ return fn(this._value);
34
+ return Result.err(this._error);
35
+ }
36
+ unwrap() {
37
+ if (this.ok)
38
+ return this._value;
39
+ throw new Error(this._error);
40
+ }
41
+ unwrapOr(fallback) {
42
+ return this.ok ? this._value : fallback;
43
+ }
44
+ match(cases) {
45
+ return this.ok ? cases.ok(this._value) : cases.err(this._error);
46
+ }
47
+ }
package/esm/main.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,qBAAqB,CAAC;AA8B7B,OAAO,8BAA8B,CAAC;AACtC,OAAO,8BAA8B,CAAC;AACtC,OAAO,4BAA4B,CAAC;AACpC,OAAO,8BAA8B,CAAC;AACtC,OAAO,+BAA+B,CAAC;AACvC,OAAO,8BAA8B,CAAC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,qBAAqB,CAAC;AA+B7B,OAAO,8BAA8B,CAAC;AACtC,OAAO,8BAA8B,CAAC;AACtC,OAAO,4BAA4B,CAAC;AACpC,OAAO,8BAA8B,CAAC;AACtC,OAAO,+BAA+B,CAAC;AACvC,OAAO,8BAA8B,CAAC"}
package/esm/main.js CHANGED
@@ -13,13 +13,14 @@ import * as dntShim from "./_dnt.shims.js";
13
13
  // create Create a Tailscale subnet router on a Fly.io custom network
14
14
  // deploy Deploy an app safely on a custom private network
15
15
  // status Show router status, network, and tailnet info
16
- // destroy Tear down the router, clean up DNS and tailnet device
16
+ // destroy Destroy a network (router) or a workload app
17
17
  // doctor Check that Tailscale and the router are working correctly
18
18
  //
19
19
  // Examples:
20
20
  // ambit create browsers
21
21
  // ambit status
22
- // ambit destroy
22
+ // ambit destroy network browsers
23
+ // ambit destroy app my-app.browsers
23
24
  // ambit doctor
24
25
  //
25
26
  // =============================================================================