@naturalcycles/nodejs-lib 15.80.2 → 15.81.1

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.
@@ -146,10 +146,13 @@ class Exec2 {
146
146
  ...env,
147
147
  },
148
148
  });
149
- p.on('close', code => {
150
- const isSuccessful = !code;
149
+ p.on('close', (code, signal) => {
150
+ const isSuccessful = code === 0;
151
151
  this.logFinish(cmd, opt, started, isSuccessful);
152
- if (code) {
152
+ if (signal) {
153
+ return reject(new Error(`spawnAsync killed by signal ${signal}: ${cmd}`));
154
+ }
155
+ if (!isSuccessful) {
153
156
  return reject(new Error(`spawnAsync exited with code ${code}: ${cmd}`));
154
157
  }
155
158
  resolve();
@@ -217,16 +220,19 @@ class Exec2 {
217
220
  process.stderr.write(data);
218
221
  }
219
222
  });
220
- p.on('close', code => {
221
- const isSuccessful = !code;
223
+ p.on('close', (code, signal) => {
224
+ const isSuccessful = code === 0;
222
225
  this.logFinish(cmd, opt, started, isSuccessful);
223
- const exitCode = code || 0;
226
+ const exitCode = code ?? -1;
224
227
  const o = {
225
228
  exitCode,
226
229
  stdout: stdout.trim(),
227
230
  stderr: stderr.trim(),
228
231
  };
229
- if (throwOnNonZeroCode && code) {
232
+ if (signal) {
233
+ return reject(new SpawnError(`spawnAsyncAndReturn killed by signal ${signal}: ${cmd}`, o));
234
+ }
235
+ if (throwOnNonZeroCode && !isSuccessful) {
230
236
  return reject(new SpawnError(`spawnAsyncAndReturn exited with code ${code}: ${cmd}`, o));
231
237
  }
232
238
  resolve(o);
@@ -42,7 +42,9 @@ export interface SlackMessage<CTX = any> extends SlackMessageProps {
42
42
  */
43
43
  kv?: AnyObject;
44
44
  /**
45
- * If specified - adds `@name1`, `@name2` in the end of the message
45
+ * Slack Member IDs to mention at the end of the message.
46
+ * Use Member IDs (e.g., 'U1234567890'), not usernames.
47
+ * To find a Member ID: click on their profile in Slack → "..." → "Copy member ID".
46
48
  */
47
49
  mentions?: string[];
48
50
  /**
@@ -4,5 +4,6 @@ export * from './joi.model.js';
4
4
  export * from './joi.shared.schemas.js';
5
5
  export * from './joi.validation.error.js';
6
6
  export * from './joi.validation.util.js';
7
- export type { StringSchema } from './string.extensions.js';
8
7
  export type { AlternativesSchema, AnySchema, ArraySchema, BinarySchema, BooleanSchema, DateSchema, FunctionSchema, ObjectSchema, ValidationErrorItem, };
8
+ export type { NumberSchema } from './number.extensions.js';
9
+ export type { StringSchema } from './string.extensions.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
3
  "type": "module",
4
- "version": "15.80.2",
4
+ "version": "15.81.1",
5
5
  "dependencies": {
6
6
  "@naturalcycles/js-lib": "^15",
7
7
  "@types/js-yaml": "^4",
@@ -174,10 +174,13 @@ class Exec2 {
174
174
  },
175
175
  })
176
176
 
177
- p.on('close', code => {
178
- const isSuccessful = !code
177
+ p.on('close', (code, signal) => {
178
+ const isSuccessful = code === 0
179
179
  this.logFinish(cmd, opt, started, isSuccessful)
180
- if (code) {
180
+ if (signal) {
181
+ return reject(new Error(`spawnAsync killed by signal ${signal}: ${cmd}`))
182
+ }
183
+ if (!isSuccessful) {
181
184
  return reject(new Error(`spawnAsync exited with code ${code}: ${cmd}`))
182
185
  }
183
186
  resolve()
@@ -259,16 +262,19 @@ class Exec2 {
259
262
  }
260
263
  })
261
264
 
262
- p.on('close', code => {
263
- const isSuccessful = !code
265
+ p.on('close', (code, signal) => {
266
+ const isSuccessful = code === 0
264
267
  this.logFinish(cmd, opt, started, isSuccessful)
265
- const exitCode = code || 0
268
+ const exitCode = code ?? -1
266
269
  const o: SpawnOutput = {
267
270
  exitCode,
268
271
  stdout: stdout.trim(),
269
272
  stderr: stderr.trim(),
270
273
  }
271
- if (throwOnNonZeroCode && code) {
274
+ if (signal) {
275
+ return reject(new SpawnError(`spawnAsyncAndReturn killed by signal ${signal}: ${cmd}`, o))
276
+ }
277
+ if (throwOnNonZeroCode && !isSuccessful) {
272
278
  return reject(new SpawnError(`spawnAsyncAndReturn exited with code ${code}: ${cmd}`, o))
273
279
  }
274
280
  resolve(o)
@@ -51,7 +51,9 @@ export interface SlackMessage<CTX = any> extends SlackMessageProps {
51
51
  kv?: AnyObject
52
52
 
53
53
  /**
54
- * If specified - adds `@name1`, `@name2` in the end of the message
54
+ * Slack Member IDs to mention at the end of the message.
55
+ * Use Member IDs (e.g., 'U1234567890'), not usernames.
56
+ * To find a Member ID: click on their profile in Slack → "..." → "Copy member ID".
55
57
  */
56
58
  mentions?: string[]
57
59
 
@@ -15,7 +15,6 @@ export * from './joi.model.js'
15
15
  export * from './joi.shared.schemas.js'
16
16
  export * from './joi.validation.error.js'
17
17
  export * from './joi.validation.util.js'
18
- export type { StringSchema } from './string.extensions.js'
19
18
 
20
19
  export type {
21
20
  AlternativesSchema,
@@ -27,7 +26,7 @@ export type {
27
26
  FunctionSchema,
28
27
  ObjectSchema,
29
28
  ValidationErrorItem,
30
- // extended
31
- // NumberSchema,
32
- // StringSchema,
33
29
  }
30
+ // extended
31
+ export type { NumberSchema } from './number.extensions.js'
32
+ export type { StringSchema } from './string.extensions.js'