@foam-ai/node-cliengo 0.1.0-alpha.2 → 0.1.0-alpha.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.
@@ -24,6 +24,8 @@
24
24
  * features (trace propagation, log enrichment, NR bridging) still work.
25
25
  * - Token undefined + forceExport: throws (fail-fast — you asked to force
26
26
  * export but provided no credentials).
27
+ * - Custom endpoint without forceExport: throws. Production always uses the
28
+ * default Foam endpoint; custom endpoints are only for dev/staging.
27
29
  * - Auto-shutdown (SIGTERM/SIGINT): flushes all providers with 5s timeout,
28
30
  * then calls process.exit(0). Without the explicit exit, registering
29
31
  * process.on('SIGTERM') replaces Node's default terminate behavior — services
@@ -25,6 +25,8 @@
25
25
  * features (trace propagation, log enrichment, NR bridging) still work.
26
26
  * - Token undefined + forceExport: throws (fail-fast — you asked to force
27
27
  * export but provided no credentials).
28
+ * - Custom endpoint without forceExport: throws. Production always uses the
29
+ * default Foam endpoint; custom endpoints are only for dev/staging.
28
30
  * - Auto-shutdown (SIGTERM/SIGINT): flushes all providers with 5s timeout,
29
31
  * then calls process.exit(0). Without the explicit exit, registering
30
32
  * process.on('SIGTERM') replaces Node's default terminate behavior — services
@@ -144,6 +146,9 @@ function init(serviceName, token, options = {}) {
144
146
  }
145
147
  const hasToken = Boolean(token);
146
148
  const canExport = shouldExport && hasToken;
149
+ if (options.endpoint && !options.forceExport) {
150
+ throw new Error('[foam] custom endpoint requires forceExport: true — production always uses the default Foam endpoint');
151
+ }
147
152
  const endpoint = options.endpoint ?? constants_1.FOAM_OTEL_ENDPOINT;
148
153
  const resource = (0, resources_1.resourceFromAttributes)({ 'service.name': serviceName });
149
154
  const authHeaders = token
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foam-ai/node-cliengo",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.0-alpha.3",
4
4
  "description": "Unified observability (traces, logs, metrics) for Cliengo Node.js services, connecting New Relic APM with Foam's OTel collector.",
5
5
  "main": "dist/node-cliengo/src/index.js",
6
6
  "types": "dist/node-cliengo/src/index.d.ts",
@@ -20,8 +20,8 @@
20
20
  "peerDependencies": {
21
21
  "@opentelemetry/api": "^1.9.0",
22
22
  "newrelic": ">=12.0.0",
23
- "winston": "^3.0.0",
24
- "pino": "^8.0.0 || ^9.0.0"
23
+ "pino": "^8.0.0 || ^9.0.0",
24
+ "winston": "^3.0.0"
25
25
  },
26
26
  "peerDependenciesMeta": {
27
27
  "newrelic": {
@@ -35,18 +35,20 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@opentelemetry/sdk-trace-base": "^2.0.0",
39
- "@opentelemetry/sdk-logs": "^0.203.0",
40
- "@opentelemetry/sdk-metrics": "^2.0.1",
41
- "@opentelemetry/exporter-trace-otlp-http": "^0.203.0",
38
+ "@opentelemetry/api-logs": "^0.203.0",
42
39
  "@opentelemetry/exporter-logs-otlp-http": "^0.203.0",
43
40
  "@opentelemetry/exporter-metrics-otlp-http": "^0.201.1",
41
+ "@opentelemetry/exporter-trace-otlp-http": "^0.203.0",
44
42
  "@opentelemetry/resources": "^2.0.1",
45
- "@opentelemetry/api-logs": "^0.203.0"
43
+ "@opentelemetry/sdk-logs": "^0.203.0",
44
+ "@opentelemetry/sdk-metrics": "^2.0.1",
45
+ "@opentelemetry/sdk-trace-base": "^2.0.0"
46
46
  },
47
47
  "devDependencies": {
48
+ "@opentelemetry/api": "^1.9.1",
49
+ "@types/node": "^20.11.0",
48
50
  "typescript": "^6.0.2",
49
- "@types/node": "^20.11.0"
51
+ "vitest": "^4.1.8"
50
52
  },
51
53
  "engines": {
52
54
  "node": ">=18"