paratix 0.10.0 → 0.12.3

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.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { E as Environment, M as Module, a as ModuleMetaEntry, b as MetaEnvironmentValue, c as EnvironmentMetaEntry, d as SshdPortMetaEntry, e as SystemHostMetaEntry, f as SystemRebootMetaEntry, g as ModuleResult, h as ExecResult, i as ModuleStatus, j as SshConnection, O as OrchestrationStep, S as ServerDefinition } from './types-Cl2Muw1x.js';
2
- export { k as EnvironmentValue, l as ExecOptions, N as NEEDS_APPLY, m as SshConfig } from './types-Cl2Muw1x.js';
3
- export { a as apt, b as archive, c as command, d as compose, e as cron, f as download, g as file, h as git, i as group, j as hostname, m as mount, n as net, o as op, p as package, q as quadlet, r as releaseUpgrade, k as rsync, s as script, l as service, t as ssh, u as sshd, v as sysctl, w as system, x as systemd, y as ufw, z as user } from './user-CJDqZC8n.js';
1
+ import { E as Environment, M as Module, a as ModuleMetaEntry, b as MetaEnvironmentValue, c as EnvironmentMetaEntry, S as SshdPortMetaEntry, d as SystemHostMetaEntry, e as SystemRebootMetaEntry, f as ModuleResult, g as ExecResult, h as ModuleStatus, i as SshConnection, O as OrchestrationStep, j as ShutdownSignal, k as ServerDefinition } from './index-udpAybq3.js';
2
+ export { l as EnvironmentValue, m as ExecOptions, N as NEEDS_APPLY, n as SshConfig, o as apt, p as archive, q as command, r as compose, s as cron, t as download, u as file, v as git, w as group, x as hostname, y as mount, z as net, A as op, B as package, C as quadlet, D as releaseUpgrade, F as rsync, G as script, H as service, I as ssh, J as sshd, K as swap, L as sysctl, P as system, Q as systemd, R as timer, T as ufw, U as user } from './index-udpAybq3.js';
4
3
 
5
4
  /**
6
5
  * Fail the run if a condition on the current env is not satisfied.
@@ -36,6 +35,10 @@ declare function fail(message: string): Module;
36
35
  * Pause execution and wait for the operator to press Enter.
37
36
  * Useful for interactive confirmation during a run.
38
37
  *
38
+ * Honors the runner's prompt abort signal: a SIGINT during the pause cancels
39
+ * the wait, removes the stdin `data` listener, and rejects the apply promise
40
+ * with the signal's abort reason.
41
+ *
39
42
  * @param message - Prompt shown to the operator. Defaults to `"Press enter to continue..."`.
40
43
  * @returns A Module that pauses execution.
41
44
  */
@@ -97,6 +100,32 @@ type WhenFunction = {
97
100
  } & typeof baseWhen;
98
101
  declare const when: WhenFunction;
99
102
 
103
+ /**
104
+ * Resolve a single env key to its concrete value.
105
+ * Lazy function values are awaited; plain primitive values are returned as-is.
106
+ *
107
+ * @param environment - The env map to look up the key in.
108
+ * @param key - The key to resolve.
109
+ * @returns The resolved primitive value.
110
+ * @throws {Error} When the key is not present in `environment`.
111
+ */
112
+ declare function resolveEnvironment(environment: Environment, key: string): Promise<boolean | number | string>;
113
+
114
+ /**
115
+ * Public API helper that returns the current first-run flag.
116
+ *
117
+ * Returns `true` only when called from inside a
118
+ * `withCliProcessEnvironment` body whose `firstRun` option was `true`.
119
+ * Outside of a CLI invocation, or when the flag was not set, the helper
120
+ * returns `false`. The helper is async-context aware: a playbook that
121
+ * schedules its own microtasks/timers within the CLI body keeps observing
122
+ * the same flag, while concurrent work outside that body sees `false`.
123
+ *
124
+ * @returns `true` when the current async context is a first-run CLI body.
125
+ */
126
+ declare function isFirstRun(): boolean;
127
+
128
+ type MetaValueType = "boolean" | "number" | "string";
100
129
  type BooleanEnvironmentMetaEntry = {
101
130
  valueType: "boolean";
102
131
  } & EnvironmentMetaEntry;
@@ -107,7 +136,7 @@ type NumberEnvironmentMetaEntry = {
107
136
  type StringEnvironmentMetaEntry = {
108
137
  valueType: "string";
109
138
  } & EnvironmentMetaEntry;
110
- declare function environmentMeta(name: string, value: MetaEnvironmentValue, valueType?: "boolean" | "number" | "string"): EnvironmentMetaEntry;
139
+ declare function environmentMeta(name: string, value: MetaEnvironmentValue, valueType?: MetaValueType): EnvironmentMetaEntry;
111
140
  declare function sshdPortMeta(port: number): SshdPortMetaEntry;
112
141
  declare function systemHostMeta(host: string): SystemHostMetaEntry;
113
142
  declare function systemRebootMeta(): SystemRebootMetaEntry;
@@ -132,7 +161,22 @@ declare function environmentToMetaEntries(environment: Environment): ModuleMetaE
132
161
  declare function diffEnvironmentToMetaEntries(original: Environment, current: Environment): ModuleMetaEntry[] | undefined;
133
162
 
134
163
  declare function failed(message: string): ModuleResult;
135
- declare function failedCommand(message: string, result: ExecResult): ModuleResult;
164
+ /**
165
+ * Build a `failed` ModuleResult from an `ExecResult`. When `secrets` is
166
+ * provided, every secret variant is masked in the rendered error message and
167
+ * in the stored stdout/stderr so the hash, signed URL, or token never leaks
168
+ * through `failedCommand`'s output. Callers that already pass `secrets` to
169
+ * `ssh.exec` should forward the same list here so the failure path stays
170
+ * symmetric with the success path.
171
+ *
172
+ * @param message - Human-readable summary of the failure context.
173
+ * @param result - The non-zero `ExecResult` returned by `ssh.exec` (typically
174
+ * captured via `ignoreExitCode: true`).
175
+ * @param secrets - Optional list of secret strings to mask in the rendered
176
+ * error message and the captured stdout/stderr.
177
+ * @returns A failed ModuleResult whose error is a {@link CommandError}.
178
+ */
179
+ declare function failedCommand(message: string, result: ExecResult, secrets?: string[]): ModuleResult;
136
180
 
137
181
  type SignalHooks = {
138
182
  onSignalFinished?: (status: ModuleStatus) => void;
@@ -151,7 +195,7 @@ type RecipeModule = {
151
195
  apply: (ssh: null | SshConnection, environment: Environment, options?: {
152
196
  onChildStep?: (step: OrchestrationStep) => Promise<void>;
153
197
  onSignalStep?: (step: OrchestrationStep) => Promise<void>;
154
- shutdownSignal?: () => NodeJS.Signals | null;
198
+ shutdownSignal?: () => null | ShutdownSignal;
155
199
  signalHooks?: SignalHooks;
156
200
  verbose?: boolean;
157
201
  }) => Promise<ModuleResult>;
@@ -213,4 +257,4 @@ declare function server(config: ServerDefinition): ServerDefinition;
213
257
  */
214
258
  declare function shellQuote(s: string): string;
215
259
 
216
- export { Environment, EnvironmentMetaEntry, ExecResult, MetaEnvironmentValue, Module, ModuleMetaEntry, ModuleResult, ServerDefinition, SshConnection, SshdPortMetaEntry, SystemHostMetaEntry, SystemRebootMetaEntry, assert, assertValidModuleMetaEntries, assertValidModuleMetaEntry, debug, diffEnvironmentToMetaEntries, environmentMeta, environmentToMetaEntries, fail, failed, failedCommand, firstRun, isBooleanEnvironmentMetaEntry, isEnvironmentMetaEntry, isLazyEnvironmentMetaEntry, isNumberEnvironmentMetaEntry, isSshdPortMetaEntry, isStringEnvironmentMetaEntry, isSystemHostMetaEntry, isSystemRebootMetaEntry, mergeEnvironmentFromMeta, meta, pause, recipe, server, shellQuote, signals, sshdPortMeta, systemHostMeta, systemRebootMeta, when };
260
+ export { Environment, EnvironmentMetaEntry, ExecResult, MetaEnvironmentValue, Module, ModuleMetaEntry, ModuleResult, ServerDefinition, ShutdownSignal, SshConnection, SshdPortMetaEntry, SystemHostMetaEntry, SystemRebootMetaEntry, assert, assertValidModuleMetaEntries, assertValidModuleMetaEntry, debug, diffEnvironmentToMetaEntries, environmentMeta, environmentToMetaEntries, fail, failed, failedCommand, firstRun, isBooleanEnvironmentMetaEntry, isEnvironmentMetaEntry, isFirstRun, isLazyEnvironmentMetaEntry, isNumberEnvironmentMetaEntry, isSshdPortMetaEntry, isStringEnvironmentMetaEntry, isSystemHostMetaEntry, isSystemRebootMetaEntry, mergeEnvironmentFromMeta, meta, pause, recipe, resolveEnvironment, server, shellQuote, signals, sshdPortMeta, systemHostMeta, systemRebootMeta, when };