@flue/client 0.0.8 → 0.0.10

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 (2) hide show
  1. package/dist/index.mjs +16 -2
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -157,7 +157,7 @@ function transformEvent(raw) {
157
157
  timestamp: now,
158
158
  sessionId: raw.properties?.sessionID ?? "",
159
159
  type: "error",
160
- message: raw.properties?.error ?? "unknown error"
160
+ message: typeof raw.properties?.error === "string" ? raw.properties.error : raw.properties?.error ? JSON.stringify(raw.properties.error) : "unknown error"
161
161
  };
162
162
  return null;
163
163
  }
@@ -165,6 +165,13 @@ function transformEvent(raw) {
165
165
  //#endregion
166
166
  //#region src/shell.ts
167
167
  async function runShell(command, options) {
168
+ console.log("[flue] shell: running", {
169
+ command,
170
+ cwd: options?.cwd,
171
+ env: options?.env ? Object.keys(options.env) : void 0,
172
+ stdin: options?.stdin ? `${options.stdin.length} chars` : void 0,
173
+ timeout: options?.timeout
174
+ });
168
175
  return new Promise((resolve) => {
169
176
  const child = exec(command, {
170
177
  cwd: options?.cwd,
@@ -175,11 +182,18 @@ async function runShell(command, options) {
175
182
  timeout: options?.timeout
176
183
  }, (error, stdout, stderr) => {
177
184
  const rawCode = error && typeof error.code === "number" ? error.code : 0;
178
- resolve({
185
+ const result = {
179
186
  stdout: stdout ?? "",
180
187
  stderr: stderr ?? "",
181
188
  exitCode: error ? rawCode || 1 : 0
189
+ };
190
+ console.log("[flue] shell: completed", {
191
+ command,
192
+ exitCode: result.exitCode,
193
+ stdout: result.stdout.length > 200 ? `${result.stdout.slice(0, 200)}... (${result.stdout.length} chars)` : result.stdout,
194
+ stderr: result.stderr.length > 200 ? `${result.stderr.slice(0, 200)}... (${result.stderr.length} chars)` : result.stderr
182
195
  });
196
+ resolve(result);
183
197
  });
184
198
  if (options?.stdin) {
185
199
  child.stdin?.write(options.stdin);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flue/client",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {