@flowscripter/dynamic-cli-framework-api 1.2.0 → 1.3.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.
@@ -4,7 +4,7 @@ export declare const SPAWN_SERVICE_ID = "@flowscripter/dynamic-cli-framework/spa
4
4
  *
5
5
  * `ok` is `true` only when the process launched and exited with code `0`. A launch failure (e.g.
6
6
  * the binary was not found) sets `error` with no `exitCode`; a non-zero exit sets `exitCode` with
7
- * no `error`.
7
+ * no `error`; a process that did not exit within {@link SpawnOptions.timeoutMs} sets `timedOut`.
8
8
  */
9
9
  export type SpawnResult = {
10
10
  ok: true;
@@ -13,6 +13,9 @@ export type SpawnResult = {
13
13
  ok: false;
14
14
  exitCode?: number;
15
15
  error?: Error;
16
+ } | {
17
+ ok: false;
18
+ timedOut: true;
16
19
  };
17
20
  /**
18
21
  * Options for {@link SpawnService.spawn}.
@@ -40,6 +43,12 @@ export interface SpawnOptions {
40
43
  * `true`.
41
44
  */
42
45
  longRunning?: boolean;
46
+ /**
47
+ * If specified, the spawned process is aborted (`SIGTERM`, followed by `SIGKILL` if it has not
48
+ * exited after a grace period) if it has not exited within this many milliseconds. Defaults to
49
+ * unbounded.
50
+ */
51
+ timeoutMs?: number;
43
52
  }
44
53
  /**
45
54
  * Service allowing a {@link Command} to spawn a child process, with output optionally captured
@@ -1 +1 @@
1
- {"version":3,"file":"SpawnService.d.ts","sourceRoot":"","sources":["../../../../src/service/core/SpawnService.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,sDAAsD,CAAC;AAEpF;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAEpD;;GAE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G;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,WAAW,YAAY;IACnC;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACrF"}
@@ -88,5 +88,18 @@ export default interface UpgradeService {
88
88
  * @return the {@link UpgradeResult}. Never rejects.
89
89
  */
90
90
  upgrade(os?: SupportedOs, arch?: SupportedArch, installMethod?: InstallMethod): Promise<UpgradeResult>;
91
+ /**
92
+ * Returns the result of the version check that was started eagerly once this service's
93
+ * dependencies were set (or starts one now, with default/no-override detection, if none has
94
+ * started yet). Every call is backed by the same cached promise.
95
+ *
96
+ * @param waitForResult if `true`, waits for the check to fully resolve. If `false` (default),
97
+ * gives up and resolves to `undefined` after an internal bounded delay, so callers on a
98
+ * startup/opportunistic path are never blocked by a slow network/spawn call.
99
+ *
100
+ * @return the {@link UpgradeCheckResult}, or `undefined` if unsupported/unconfigured or the
101
+ * bounded wait elapsed. Never rejects.
102
+ */
103
+ getUpgradeCheckResult(waitForResult?: boolean): Promise<UpgradeCheckResult | undefined>;
91
104
  }
92
105
  //# sourceMappingURL=UpgradeService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UpgradeService.d.ts","sourceRoot":"","sources":["../../../../src/service/core/UpgradeService.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,wDAAwD,CAAC;AAExF;;GAEG;AACH,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,oBAAY,aAAa;IACvB,YAAY,iBAAiB;IAC7B,QAAQ,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,IAAI,CAAC,EAAE,aAAa,EACpB,aAAa,CAAC,EAAE,aAAa,GAC5B,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAC;IAE3C;;;;;;;;OAQG;IACH,OAAO,CACL,EAAE,CAAC,EAAE,WAAW,EAChB,IAAI,CAAC,EAAE,aAAa,EACpB,aAAa,CAAC,EAAE,aAAa,GAC5B,OAAO,CAAC,aAAa,CAAC,CAAC;IAE1B;;;;;;;;;;;OAWG;IACH,qBAAqB,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAC;CACzF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowscripter/dynamic-cli-framework-api",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "API for https://github.com/flowscripter/dynamic-cli-framework",
5
5
  "keywords": [
6
6
  "bun",
@@ -5,11 +5,12 @@ export const SPAWN_SERVICE_ID = "@flowscripter/dynamic-cli-framework/spawn-servi
5
5
  *
6
6
  * `ok` is `true` only when the process launched and exited with code `0`. A launch failure (e.g.
7
7
  * the binary was not found) sets `error` with no `exitCode`; a non-zero exit sets `exitCode` with
8
- * no `error`.
8
+ * no `error`; a process that did not exit within {@link SpawnOptions.timeoutMs} sets `timedOut`.
9
9
  */
10
10
  export type SpawnResult =
11
11
  | { ok: true; exitCode: number }
12
- | { ok: false; exitCode?: number; error?: Error };
12
+ | { ok: false; exitCode?: number; error?: Error }
13
+ | { ok: false; timedOut: true };
13
14
 
14
15
  /**
15
16
  * Options for {@link SpawnService.spawn}.
@@ -40,6 +41,13 @@ export interface SpawnOptions {
40
41
  * `true`.
41
42
  */
42
43
  longRunning?: boolean;
44
+
45
+ /**
46
+ * If specified, the spawned process is aborted (`SIGTERM`, followed by `SIGKILL` if it has not
47
+ * exited after a grace period) if it has not exited within this many milliseconds. Defaults to
48
+ * unbounded.
49
+ */
50
+ timeoutMs?: number;
43
51
  }
44
52
 
45
53
  /**
@@ -106,4 +106,18 @@ export default interface UpgradeService {
106
106
  arch?: SupportedArch,
107
107
  installMethod?: InstallMethod,
108
108
  ): Promise<UpgradeResult>;
109
+
110
+ /**
111
+ * Returns the result of the version check that was started eagerly once this service's
112
+ * dependencies were set (or starts one now, with default/no-override detection, if none has
113
+ * started yet). Every call is backed by the same cached promise.
114
+ *
115
+ * @param waitForResult if `true`, waits for the check to fully resolve. If `false` (default),
116
+ * gives up and resolves to `undefined` after an internal bounded delay, so callers on a
117
+ * startup/opportunistic path are never blocked by a slow network/spawn call.
118
+ *
119
+ * @return the {@link UpgradeCheckResult}, or `undefined` if unsupported/unconfigured or the
120
+ * bounded wait elapsed. Never rejects.
121
+ */
122
+ getUpgradeCheckResult(waitForResult?: boolean): Promise<UpgradeCheckResult | undefined>;
109
123
  }