@autter/runtime-node 1.9.1 → 1.10.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.
@@ -1,8 +1,11 @@
1
1
  import {
2
+ authHeaders,
2
3
  noteCompatFeature,
4
+ noteIngestRefusal,
3
5
  observeIngesterResponse,
6
+ resolveIngestKey,
4
7
  sharedSlot
5
- } from "./chunk-VIP2EL47.js";
8
+ } from "./chunk-KWAJIELR.js";
6
9
 
7
10
  // ../runtime-core/dist/index.js
8
11
  var SENSITIVE_KEY_PATTERNS = [
@@ -1556,7 +1559,7 @@ function otlpSink(options = {}) {
1556
1559
  method: "POST",
1557
1560
  headers: {
1558
1561
  "content-type": "application/json",
1559
- authorization: `Bearer ${apiKey}`
1562
+ ...authHeaders(resolveIngestKey(apiKey, {}))
1560
1563
  },
1561
1564
  body,
1562
1565
  signal: AbortSignal.timeout(
@@ -1566,6 +1569,14 @@ function otlpSink(options = {}) {
1566
1569
  observeIngesterResponse({ status: response.status, headers: response.headers, route: "/v1/logs" });
1567
1570
  if (!response.ok) {
1568
1571
  failure = new Error(`Runtime log export failed (${response.status})`);
1572
+ if (response.status !== 429 && response.status < 500) {
1573
+ noteIngestRefusal({
1574
+ status: response.status,
1575
+ route: "/v1/logs",
1576
+ endpoint,
1577
+ body: await response.text().catch(() => "")
1578
+ });
1579
+ }
1569
1580
  if (response.status !== 429 && response.status < 500) break;
1570
1581
  retryAfter = response.headers.get("retry-after");
1571
1582
  } else {
package/dist/cli.cjs CHANGED
@@ -4,14 +4,25 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkLYXQC4FIcjs = require('./chunk-LYXQC4FI.cjs');
8
- require('./chunk-3P573RHA.cjs');
7
+
8
+
9
+
10
+
11
+ var _chunkHBH64LWQcjs = require('./chunk-HBH64LWQ.cjs');
12
+ require('./chunk-S6WJ5YLP.cjs');
9
13
 
10
14
  // src/cli.ts
11
15
  var _child_process = require('child_process');
12
16
  var _fs = require('fs');
13
17
  var _module = require('module');
14
18
  var _path = require('path');
19
+ var USAGE = `Usage: npx @autter/runtime-node <command> [options]
20
+
21
+ Commands:
22
+ doctor Versions, storage, features and the key, in one report
23
+ verify Send a test event end to end and name the first failing step
24
+
25
+ Run a command with --help for its options.`;
15
26
  function delegateToRuntimeCli(argv) {
16
27
  try {
17
28
  const manifest = _module.createRequire.call(void 0, _path.join.call(void 0, process.cwd(), "package.json")).resolve("@autter/runtime-cli/package.json");
@@ -30,23 +41,39 @@ async function main(argv) {
30
41
  console.error("autter-runtime sourcemaps is part of @autter/runtime-cli: npm install -D @autter/runtime-cli");
31
42
  return 64;
32
43
  }
44
+ if (command === "verify") {
45
+ const parsed2 = _chunkHBH64LWQcjs.parseVerifyArgs.call(void 0, rest);
46
+ if ("help" in parsed2) {
47
+ console.log(_chunkHBH64LWQcjs.VERIFY_USAGE);
48
+ return 0;
49
+ }
50
+ if ("error" in parsed2) {
51
+ console.error(`${parsed2.error}
52
+
53
+ ${_chunkHBH64LWQcjs.VERIFY_USAGE}`);
54
+ return 64;
55
+ }
56
+ const report2 = await _chunkHBH64LWQcjs.runVerify.call(void 0, parsed2);
57
+ console.log(parsed2.json ? JSON.stringify(report2, null, 2) : _chunkHBH64LWQcjs.formatVerifyReport.call(void 0, report2));
58
+ return report2.exitCode;
59
+ }
33
60
  if (command !== "doctor") {
34
- console.log(_chunkLYXQC4FIcjs.DOCTOR_USAGE);
61
+ console.log(USAGE);
35
62
  return command === void 0 || command === "--help" || command === "-h" ? 0 : 64;
36
63
  }
37
- const parsed = _chunkLYXQC4FIcjs.parseDoctorArgs.call(void 0, rest);
64
+ const parsed = _chunkHBH64LWQcjs.parseDoctorArgs.call(void 0, rest);
38
65
  if ("help" in parsed) {
39
- console.log(_chunkLYXQC4FIcjs.DOCTOR_USAGE);
66
+ console.log(_chunkHBH64LWQcjs.DOCTOR_USAGE);
40
67
  return 0;
41
68
  }
42
69
  if ("error" in parsed) {
43
70
  console.error(`${parsed.error}
44
71
 
45
- ${_chunkLYXQC4FIcjs.DOCTOR_USAGE}`);
72
+ ${_chunkHBH64LWQcjs.DOCTOR_USAGE}`);
46
73
  return 64;
47
74
  }
48
- const report = await _chunkLYXQC4FIcjs.runDoctor.call(void 0, parsed);
49
- console.log(parsed.json ? JSON.stringify(report, null, 2) : _chunkLYXQC4FIcjs.formatDoctorReport.call(void 0, report));
75
+ const report = await _chunkHBH64LWQcjs.runDoctor.call(void 0, parsed);
76
+ console.log(parsed.json ? JSON.stringify(report, null, 2) : _chunkHBH64LWQcjs.formatDoctorReport.call(void 0, report));
50
77
  return report.exitCode;
51
78
  }
52
79
  main(process.argv.slice(2)).then(
@@ -54,7 +81,7 @@ main(process.argv.slice(2)).then(
54
81
  process.exitCode = code;
55
82
  },
56
83
  (err) => {
57
- console.error("autter doctor failed:", err instanceof Error ? err.message : err);
84
+ console.error("autter-runtime failed:", err instanceof Error ? err.message : err);
58
85
  process.exitCode = 2;
59
86
  }
60
87
  );
package/dist/cli.js CHANGED
@@ -1,17 +1,28 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  DOCTOR_USAGE,
4
+ VERIFY_USAGE,
4
5
  formatDoctorReport,
6
+ formatVerifyReport,
5
7
  parseDoctorArgs,
6
- runDoctor
7
- } from "./chunk-FYMEBULO.js";
8
- import "./chunk-VIP2EL47.js";
8
+ parseVerifyArgs,
9
+ runDoctor,
10
+ runVerify
11
+ } from "./chunk-3UODRQBD.js";
12
+ import "./chunk-KWAJIELR.js";
9
13
 
10
14
  // src/cli.ts
11
15
  import { spawnSync } from "child_process";
12
16
  import { readFileSync } from "fs";
13
17
  import { createRequire } from "module";
14
18
  import { dirname, join, resolve } from "path";
19
+ var USAGE = `Usage: npx @autter/runtime-node <command> [options]
20
+
21
+ Commands:
22
+ doctor Versions, storage, features and the key, in one report
23
+ verify Send a test event end to end and name the first failing step
24
+
25
+ Run a command with --help for its options.`;
15
26
  function delegateToRuntimeCli(argv) {
16
27
  try {
17
28
  const manifest = createRequire(join(process.cwd(), "package.json")).resolve("@autter/runtime-cli/package.json");
@@ -30,8 +41,24 @@ async function main(argv) {
30
41
  console.error("autter-runtime sourcemaps is part of @autter/runtime-cli: npm install -D @autter/runtime-cli");
31
42
  return 64;
32
43
  }
44
+ if (command === "verify") {
45
+ const parsed2 = parseVerifyArgs(rest);
46
+ if ("help" in parsed2) {
47
+ console.log(VERIFY_USAGE);
48
+ return 0;
49
+ }
50
+ if ("error" in parsed2) {
51
+ console.error(`${parsed2.error}
52
+
53
+ ${VERIFY_USAGE}`);
54
+ return 64;
55
+ }
56
+ const report2 = await runVerify(parsed2);
57
+ console.log(parsed2.json ? JSON.stringify(report2, null, 2) : formatVerifyReport(report2));
58
+ return report2.exitCode;
59
+ }
33
60
  if (command !== "doctor") {
34
- console.log(DOCTOR_USAGE);
61
+ console.log(USAGE);
35
62
  return command === void 0 || command === "--help" || command === "-h" ? 0 : 64;
36
63
  }
37
64
  const parsed = parseDoctorArgs(rest);
@@ -54,7 +81,7 @@ main(process.argv.slice(2)).then(
54
81
  process.exitCode = code;
55
82
  },
56
83
  (err) => {
57
- console.error("autter doctor failed:", err instanceof Error ? err.message : err);
84
+ console.error("autter-runtime failed:", err instanceof Error ? err.message : err);
58
85
  process.exitCode = 2;
59
86
  }
60
87
  );